Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Resource Representation Variants #164

Merged
merged 1,191 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1191 commits
Select commit Hold shift + click to select a range
12d364e
Migrate fixture path to resources/fixtures/
snuggs Apr 9, 2018
1ee7d52
Update path to add current working directory
snuggs Apr 9, 2018
a6a8c80
update to use defined resource from directory location
snuggs Apr 9, 2018
5abda0d
Update only test for Defined Resource disallowed methods
snuggs Apr 9, 2018
6d83ccb
Update whitespace for test
snuggs Apr 9, 2018
8440516
Test Get assets via subresource identity
snuggs Apr 10, 2018
8fd6faf
Add koa-send
snuggs Apr 10, 2018
b41e4f8
Migrate send and mount capabilities
snuggs Apr 10, 2018
79880e7
Setup test for Resource assets
snuggs Apr 10, 2018
8f4ca6e
update get response for context body
snuggs Apr 10, 2018
9177aee
Add link to pipped stream responses
snuggs Apr 10, 2018
db8840b
Add spec for http range requests
snuggs Apr 10, 2018
6fd25a0
Add link to koa-stream
snuggs Apr 10, 2018
a2a29e5
Refactor koa-send from application
snuggs Apr 10, 2018
fdb882e
Refactor koa-send from application
snuggs Apr 10, 2018
227b36b
Add test for Content-Length
snuggs Apr 10, 2018
5be37b4
Migrate meta statistics helper in Resource
snuggs Apr 10, 2018
8984a64
Add resources/fixtures/index.html
snuggs Apr 10, 2018
35dc9c5
Add resources/fixtures/index.mjs
snuggs Apr 10, 2018
6dcf4a3
Migrate filesystem requirement to head of Resource
snuggs Apr 10, 2018
e17f164
Remove console directory logging from Resource
snuggs Apr 10, 2018
35874a5
Add test for subresource last-modified HTTP header
snuggs Apr 10, 2018
c77847f
Fix formatting in route.text
snuggs Apr 10, 2018
db70497
Fix bug in constant declaration
snuggs Apr 10, 2018
24eabbd
Fix whitespace in Resource test
snuggs Apr 10, 2018
c3c38fe
Test GET subresource with predefined body
snuggs Apr 10, 2018
cb2b3c4
Add test for successful status with context
snuggs Apr 10, 2018
106002d
Add test for successful subresource response body
snuggs Apr 10, 2018
f32db32
Update server to use hello endpoint
snuggs Apr 10, 2018
5689f76
Add cat gif meow
snuggs Apr 10, 2018
c51c4c1
Update cat gif
snuggs Apr 10, 2018
7c276fb
Add style for subresource example
snuggs Apr 10, 2018
4d58b3c
Add image of cat
snuggs Apr 10, 2018
f1ed395
Add module and nomodule resources
snuggs Apr 10, 2018
18408fe
Add index.js file
snuggs Apr 10, 2018
6453a87
Update message for nomodule resource
snuggs Apr 10, 2018
bd46621
Test import module strategy
snuggs Apr 10, 2018
80081cd
Add foo.mjs resource
snuggs Apr 10, 2018
00674f2
Rename subresource foo.mjs to dependency.mjs
snuggs Apr 10, 2018
563918c
Update imported dependency in subresource
snuggs Apr 10, 2018
9f5c80c
Fix capitalization of log message
snuggs Apr 10, 2018
76831aa
Add link to index overflow
snuggs Apr 10, 2018
7a8fe49
Fix whitespace
snuggs Apr 10, 2018
d3ec2f6
Fix whitespace
snuggs Apr 10, 2018
7f22093
Add koa link to real world app
snuggs Apr 10, 2018
eeeeaa7
Add link to real world app
snuggs Apr 10, 2018
41d40bc
Promisify filesystem and stat
snuggs Apr 12, 2018
f30b99f
Convert old callback style to utility promise
snuggs Apr 12, 2018
859111c
Do super.get test
snuggs Apr 12, 2018
bf1515e
Use better name for scanning file stats
snuggs Apr 12, 2018
e561940
Refactor send middleware
snuggs Apr 12, 2018
0c7b144
Convert to use backticks
snuggs Apr 12, 2018
1680a10
Refactor send middleware
snuggs Apr 12, 2018
ba723f4
Add root to filesystem
snuggs Apr 12, 2018
fe20894
Fix boolen path lookup
snuggs Apr 12, 2018
26df9e8
Change only test
snuggs Apr 12, 2018
dc88aa8
Change only test for path lookup
snuggs Apr 12, 2018
6062c58
Refactor base path to top includes
snuggs Apr 13, 2018
8c8ed80
Fix formatting for included variables
snuggs Apr 13, 2018
a96d77a
Migrate default and safe methods
snuggs Apr 13, 2018
43e9a75
Migrate base path
snuggs Apr 13, 2018
760d780
normalize path from array
snuggs Apr 13, 2018
c597b39
Fix whitespace
snuggs Apr 13, 2018
610511c
Fix formatting of context.body
snuggs Apr 13, 2018
3531f30
fix ok test
snuggs Apr 13, 2018
0ce3b94
Migrate Base factory in resource
snuggs Apr 14, 2018
bd3e206
Better naming convention for what is done /cc @tmornini
snuggs Apr 14, 2018
b0eece2
Add disable method
snuggs Apr 15, 2018
4bfff97
Migrate property definition
snuggs Apr 17, 2018
0e2ca04
Migrate property definition
snuggs Apr 17, 2018
e8e7215
Update method signature of disable
snuggs Apr 17, 2018
cca0609
Reformat allow includes
snuggs Apr 17, 2018
c3ec2b3
Fix header formatting
snuggs Apr 17, 2018
fc4c66c
Migrate response streams
snuggs Apr 17, 2018
ece185a
Refactor send Resource body/payload(?) /cc @tmornini
snuggs Apr 17, 2018
a425c1e
Refactor response headers into object
snuggs Apr 17, 2018
ada8201
Refactor Resource async send
snuggs Apr 17, 2018
681e926
Refactor Base path logic. AKA sexy backflip
snuggs Apr 17, 2018
20f56ca
Convert to backticks
snuggs Apr 17, 2018
a4cf196
Add whitespace
snuggs Apr 17, 2018
6927722
Add whitespace
snuggs Apr 17, 2018
9a95e9e
Format identify uri within Route implementation
snuggs Apr 17, 2018
c118546
Migrate identify uri closer to head of file
snuggs Apr 17, 2018
6cd193c
Add message about non blocking io
snuggs Apr 17, 2018
1cc63d7
Refactor promisify routine within Resource send
snuggs Apr 17, 2018
ce5914e
Reorder constants
snuggs Apr 17, 2018
cef74d0
Remove comment
snuggs Apr 17, 2018
dad08c1
Add whitespace
snuggs Apr 19, 2018
30c03b8
Add whitespace
snuggs Apr 19, 2018
d239df1
Move comment for connect
snuggs Apr 20, 2018
8da9be2
Update bug in constant definition
snuggs Apr 22, 2018
064d877
Change export files
snuggs Apr 29, 2018
001c754
Change only test
snuggs Apr 29, 2018
57a7251
Change echo of file coverage
snuggs May 1, 2018
ae68f05
Change echo of file coverage
snuggs May 1, 2018
b16941a
Add only test
snuggs May 1, 2018
428412d
Test console logging
snuggs May 2, 2018
ff49eef
Test console logging
snuggs May 2, 2018
e2c8a9b
Add const func
snuggs May 2, 2018
23f1c10
Log tests for super.get
snuggs May 2, 2018
a94e2d1
fix whitespace for identity
snuggs May 2, 2018
c5783c3
do identity check for await send
snuggs May 2, 2018
7cff916
Add const endpoint
snuggs May 2, 2018
34838fe
Fix tests to run with full file
snuggs May 2, 2018
d8f0ffd
Add spec coverage to bin/test
snuggs May 2, 2018
11e4bf2
Add ability to test single files
snuggs May 2, 2018
5c59f99
Fix whitespacing
snuggs May 2, 2018
73f0485
Remove unfinished breaking tests
snuggs May 2, 2018
1e9cbcb
Fix whitespacing
snuggs May 2, 2018
fddb661
You know life is good when refactoring bash scripts.
snuggs May 2, 2018
49e4053
Final refactor of bash script
snuggs May 2, 2018
2fc7609
Update variable bug in bin/test
snuggs May 2, 2018
2e38383
Log context body
snuggs May 2, 2018
312b70d
Test logging of response body
snuggs May 2, 2018
ea78fcb
Convert to capitalized response headers
snuggs May 2, 2018
e1c3512
Deny GET */index.es subresource
snuggs May 2, 2018
9514e39
Fix whitespace
snuggs May 2, 2018
bbedc4c
Add mount point comment
snuggs May 2, 2018
dc0c707
update whitespace of resource/index.es
snuggs May 2, 2018
a0e9111
fix Server test for public assets
snuggs May 2, 2018
39377df
FULL 170+ ✅ test suite passing for the first time EVAR! #WOOT 🎉
snuggs May 2, 2018
06d6aac
Add public/index.es
snuggs May 2, 2018
96a51f1
Remove public/*.es from .gitignore
snuggs May 2, 2018
2a2b5fe
Change node engine
snuggs May 2, 2018
0349a0d
Refactor tests for full test suite passing
snuggs May 3, 2018
25eb2ed
Fix middleware/snuggsi.es and middleware/snuggsi.test runs
snuggs May 3, 2018
8416983
Enable middleware/snuggsi.test
snuggs May 3, 2018
bce17cc
Update middleware/snuggsi.test to reflect proper minification rules
snuggs May 3, 2018
f1a5b66
add test in middleware/snuggsi.test for GET / Accept: */*
snuggs May 3, 2018
06bdc3b
test for snuggsi root hijacking
snuggs May 3, 2018
14fb2b7
Test GET default subresource Accept: text/html
snuggs May 3, 2018
21cea3a
Remove un necessary scripts from bin/publish
snuggs May 3, 2018
c80e3c4
Add back examples to public copying
snuggs May 3, 2018
faed285
Update start path of browser sync
snuggs May 3, 2018
3998a56
Add short video clip
snuggs May 5, 2018
8a248d2
Add video
snuggs May 5, 2018
0f4e823
Add css file
snuggs May 5, 2018
42d45e5
Add png image
snuggs May 5, 2018
23d63e1
Add jpeg resource/fixture
snuggs May 5, 2018
ee215a1
Add audio segment
snuggs May 5, 2018
8d82514
Add mp3 file
snuggs May 5, 2018
ae58431
Add resource/fixtures/index.ogg
snuggs May 5, 2018
4aa3499
Add wav file
snuggs May 5, 2018
d824672
Add media figures
snuggs May 5, 2018
789c6d6
Add block for caption
snuggs May 5, 2018
f7683b6
Add block formatting for resource/fixtures
snuggs May 5, 2018
fdbe87e
Add PDF Document
snuggs May 5, 2018
a021591
Add resources/fixtures/index.txt
snuggs May 5, 2018
1295c1d
Add resources/fixtures/index.css
snuggs May 5, 2018
a349b85
Center everything
snuggs May 5, 2018
2790bd6
Add margin
snuggs May 5, 2018
af87759
Add negotiator and remove extensions
snuggs May 5, 2018
87d737d
Change index.es on server code
snuggs May 5, 2018
f837e29
Add logging for negotiator
snuggs May 6, 2018
c1edb81
Add negotiator tests
snuggs May 6, 2018
b0e92c1
Add negotiator to stack
snuggs May 6, 2018
5bf4a51
Convert to use Accept header testing
snuggs May 6, 2018
14bebfd
Convert to use Accept header testing
snuggs May 6, 2018
c72865a
Update whitespacing
snuggs May 6, 2018
ddf9968
Remove empty test from negotiator
snuggs May 6, 2018
9350ddb
Update response testing for negotiator
snuggs May 6, 2018
1b3e688
Update const definition order for negotiator
snuggs May 6, 2018
4d529ec
Change cont variables
snuggs May 6, 2018
247e0df
Refactor negotiator test
snuggs May 6, 2018
8ea20f4
Refactor const variables
snuggs May 6, 2018
8393a00
Refactor accepts testing for negotiation
snuggs May 6, 2018
1607145
Refactor middleware/negotiator spec description
snuggs May 6, 2018
7256522
Add tests for CDN distribution and caching of HTML and JSON
snuggs May 6, 2018
bb78cdc
Fix whitespacing
snuggs May 6, 2018
255b5bd
Refactor audio controls
snuggs May 6, 2018
91e75a6
Remove legacy media elements
snuggs May 6, 2018
163645e
Add index.json resource
snuggs May 6, 2018
d4c2262
Use resource fixtures
snuggs May 7, 2018
22014ee
Remove body test
snuggs May 8, 2018
13c7846
Add accepts predicates
snuggs May 8, 2018
d48734b
Log acceptance criteria
snuggs May 8, 2018
594a4d6
Fix bug in acceptance criteria
snuggs May 8, 2018
4866f0f
Remove accept encoding
snuggs May 8, 2018
95b3c16
Rearrange logging for acceptance criteria
snuggs May 8, 2018
3c965d1
Migrate next callback routine
snuggs May 8, 2018
808348e
Update console logging of acceptance criteria
snuggs May 8, 2018
990f80a
refactor to use string template literals
snuggs May 8, 2018
00d459e
Add comment for HEAD
snuggs May 9, 2018
824c54a
Tests returning false positives
snuggs May 9, 2018
923d4b4
Tests returning false positives
snuggs May 9, 2018
364cfb8
Fix whitespacing
snuggs May 9, 2018
89618f3
Convert to use backticks for date routing test
snuggs May 9, 2018
b17e3d2
Convert to use backticks for date routing test
snuggs May 9, 2018
3ddcaee
Refactor route URI segment {token} parameters
snuggs May 9, 2018
bc2a1c1
Refactor middleware/route.test and use backticks
snuggs May 9, 2018
879ba58
Refactor random math string for URI routing
snuggs May 9, 2018
3ae6d50
Refactor to use backticks in resource implementation and test
snuggs May 9, 2018
4969f72
Add test for route URI without endpoint
snuggs May 10, 2018
064f800
Remove unnecessary string interpolation
snuggs May 11, 2018
31497f0
Refactor middleware/route.es
snuggs May 11, 2018
2225057
refactor middleware route.es
snuggs May 11, 2018
fa65ce9
Set default resource as 501 Not implemented
snuggs May 11, 2018
b2eb027
Refactor middleware/route.test
snuggs May 11, 2018
2923b2a
Refactor middleware/route.test
snuggs May 11, 2018
8f39bf9
Major refactor to middleware route.es
snuggs May 11, 2018
13191d5
Reorganize method signature
snuggs May 11, 2018
455062a
Fix whitespacing within middleware/route.es
snuggs May 11, 2018
8032ed1
Refactor parameterizer within middleware/route.es
snuggs May 11, 2018
2fbd3f9
Boss move refactor of params
snuggs May 11, 2018
bcda144
Migrate context.params side effect into parameterize
snuggs May 11, 2018
be962e2
Migrate comments to top of middleware/route.es
snuggs May 11, 2018
efe273a
Refactor into surrogate URI pattern
snuggs May 11, 2018
afc40b7
Rename surrogate to trailing
snuggs May 11, 2018
6e0802a
Refactor to use backticks
snuggs May 11, 2018
43884b6
Refactor tokenized uri
snuggs May 11, 2018
568b9ee
reorder method signature for middleware/route.es
snuggs May 11, 2018
e2437a7
refactor tokenized uri parameters
snuggs May 11, 2018
10deddf
Refactor constant instantiation within resource/index.es
snuggs May 11, 2018
a66e4a8
Add OPTIONS response
snuggs May 11, 2018
dcbbbff
Use backticks instead of function calls
snuggs May 11, 2018
572b512
Refactor constructor of server/index.es
snuggs May 11, 2018
0e921ef
Refactor constructor of server/index.test
snuggs May 11, 2018
f17ffe2
Add test for Server.close with backticks
snuggs May 11, 2018
7a77b79
Update test definition within server/index.test
snuggs May 11, 2018
8003aef
Update filtered HTTP METHODS
snuggs May 11, 2018
57a9095
Refactor server/index.es and server/index.test
snuggs May 11, 2018
d47075a
Refactor trailing slash test from uri
snuggs May 11, 2018
17d330b
Update test for surrogate subresource undefined identity
snuggs May 11, 2018
0d1e6df
Implement Resource HTML GET / Accept: text/html
snuggs May 11, 2018
145b6cc
Implement Resource HTML GET / Accept: text/txt
snuggs May 11, 2018
d8dc742
Implement Resource HTML GET / Accept: text/css
snuggs May 11, 2018
33396bd
Implement Resource HTML GET / Accept: text/json
snuggs May 11, 2018
9e7cc72
Implement Resource HTML GET / Accept: application/javascript
snuggs May 11, 2018
c07c0d0
FAILING TEST (Le Sigh 😞 )
snuggs May 11, 2018
e22bf1e
Update examples resource
snuggs May 11, 2018
45f0871
Add examples route and resource to serve
snuggs May 11, 2018
12b4ef8
Add caching ranges comment
snuggs May 14, 2018
2c3e923
Add link to readFile being far slower
snuggs May 14, 2018
303f21c
Add link to readFile being far slower
snuggs May 14, 2018
dedc259
Add link to koa-stream
snuggs May 14, 2018
6ec9ecb
Add link to AWS requests using streams
snuggs May 14, 2018
ae72aad
Change resolve to then
snuggs May 16, 2018
64d784f
Migrate join buffer
snuggs May 16, 2018
b9a482c
Refactor method signature for module export
snuggs May 16, 2018
a20c8b1
Refactor buffer out of read module and into join function
snuggs May 16, 2018
63676ba
Remove bug from join source
snuggs May 16, 2018
87c3518
Refactor join algorithm for stream buffer reading
snuggs May 16, 2018
a635878
Add whitespace to join
snuggs May 17, 2018
f4a4cd7
Add only test
snuggs Jun 6, 2018
5586336
Remove package lock
snuggs Jun 6, 2018
40a797f
Use backticks for context.accepts
snuggs Jun 7, 2018
496585d
Update whitespace
snuggs Jun 7, 2018
45169e9
Add comment for preload
snuggs Jun 8, 2018
f942161
Add comment for preload
snuggs Jun 8, 2018
00dc115
Skip tests as per @tmornini recommendation /cc @brandondees
snuggs Jun 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ NOTES
.DS_Store
public/*.html
public/examples
public/*.es
public/*.css

17 changes: 16 additions & 1 deletion bin/serve.es
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
(new (require ('..').Server)).serve `public`
const
{ Server, Resource }
= require ('..')

, { route }
= require ('../middleware')

middleware = [
route (`/hello/`, Resource `/resource/fixtures/`)
, route (`/examples/`, Resource `/examples/`)
]

void

(new Server (middleware))
.serve `public`
32 changes: 15 additions & 17 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
#!/usr/bin/env bash

# Run tape

# https://gist.github.com/branneman/8775568
# https://gist.github.com/branneman/8048520
# https://stackoverflow.com/questions/10265798/determine-project-root-from-a-running-node-js-application
export ROOT=$(pwd)

export PORT=8181
export ROOT=$(pwd)
export API="element"
export NODE_PATH=$ROOT
export ENTRY="index.test"
#export API="elements,token-list"
#export PATHS="{test,middleware,mixins,$ELEMENTS}"
export MODULES="{.,test,server,middleware,$API}"
export FILES="$ROOT/$MODULES/$ENTRY"
export COVERAGE="$ROOT/node_modules/.bin/tap-nyc"

echo "Covering $MODULES"
export TEST="$ROOT/node_modules/.bin/tape"
export SPEC="$ROOT/node_modules/.bin/tap-spec"
export COVER="$ROOT/node_modules/.bin/tap-nyc"
export LIBRARIES=".,test,server,resource,middleware"
export TESTS=$ROOT/${1:-"{$LIBRARIES,$API}/$ENTRY"}

# https://gist.github.com/branneman/8775568
# https://gist.github.com/branneman/8048520
export NODE_PATH=$ROOT
echo "Covering $TESTS"

$ROOT/node_modules/.bin/tape \
--require ./ \
-- $FILES \
| $COVERAGE
$TEST \
--require ./ \
-- $TESTS \
| $SPEC
48 changes: 42 additions & 6 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
_📖 [Please see `bin/README.md`](../bin/README.md) For a list of `bin` scripts used within the build pipeline._


## Glossary

- [Content Negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation)
- [MDN MIME Types List](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types)
- [MDN HTTP MIME Types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)
- [WHATWG MIME Types](https://html.spec.whatwg.org/#javascript-mime-type)
- [WHATWG MIME Sniffing](https://mimesniff.spec.whatwg.org/#javascript-mime-type)
- [WHATWG/W3C approval of media types](https://github.com/w3c/webcomponents/issues/645#issuecomment-317338144)
- [IETF Media Type Specifications and Registration Procedures _(rfc6838)_](https://tools.ietf.org/html/rfc6838)


### ECMAScript Standardization

Solves the "Duplicate Directory" problem - https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md#poly-packages

- [TC39 - ECMAScript _formerly TC39-TG1)_](https://ecma-international.org/memento/TC39.htm)
- [IANA `application/ecmascript` Media Type](https://www.iana.org/assignments/media-types/application/ecmascript)
- [IETF ECMAScript Media Types Updates](https://datatracker.ietf.org/doc/draft-bfarias-javascript-mjs/)
- [ECMASCript Media Type Specification _(rfc4329 Section 8.2)_](https://tools.ietf.org/html/rfc4329#section-8.2)
- [Why you should know `application/ecmascript`](https://stackoverflow.com/questions/9664282/difference-between-application-x-javascript-and-text-javascript-content-types)


#### References

- WHATWG Fetch Preload desitinations and module scripts - https://tools.ietf.org/html/rfc6838
- 2Ality Module Specifiers - http://2ality.com/2017/05/es-module-specifiers.html
- The state of Webpack modules - https://medium.com/webpack/the-state-of-javascript-modules-4636d1774358
- ECMAScript Modules - https://hackernoon.com/node-js-tc-39-and-modules-a1118aecf95e
- ESM (ECMAScript Module) Detection in Node.js - https://github.com/nodejs/node/wiki/ES6-Module-Detection-in-Node#detection-problem
- Node.js EPS - https://github.com/bmeck/node-eps/blob/a1eab9bf023bbe13a79ddb18f0622a5d57215f9b/002-es-modules.md#461-default-imports
- Point script to module script WHATWG - https://github.com/whatwg/html/issues/1013
- Correct usage of mime types - https://github.com/bmeck/I-D/issues/16


### Javascript Standardization

- [IANA `application/javascript` Media Type](https://www.iana.org/assignments/media-types/application/javascript)
- [Javascript Media Type Specification _(rfc4329 Section 7.2)_](https://tools.ietf.org/html/rfc4329#section-7.2)


## `snuggsi.min.es.br`

*Mime Type* : `application/ecmascript` _([Specification](https://tools.ietf.org/html/rfc4329#section-8.2))_
Expand All @@ -17,12 +57,8 @@ _📖 [Please see `bin/README.md`](../bin/README.md) For a list of `bin` script
*Weight* : ~ 1,600 OCTETS _(1.6kiloBytes)_


## Glossary
- [Content Negotiation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation)
- [Javascript MIME types](https://html.spec.whatwg.org/#javascript-mime-type)
- [Scripting Media Types _(rfc4329)_](https://www.rfc-editor.org/rfc/rfc4329.txt)
- [WHATWG/W3c approval of media types](https://github.com/w3c/webcomponents/issues/645#issuecomment-317338144)
- [why you should know `application/ecmascript`](https://stackoverflow.com/questions/9664282/difference-between-application-x-javascript-and-text-javascript-content-types)
### Networking

- [Difference between Ethernet frame and Packet](https://www.youtube.com/watch?v=wcSee63SIlg)
- [MTU _(Maximum Transmission Unit)_](https://en.wikipedia.org/wiki/Maximum_transmission_unit)
- [_(Ethernet)_ Frame](https://en.wikipedia.org/wiki/Ethernet_frame)
Expand Down
9 changes: 9 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# snuggsi ツ - Easy Web Components

**Create RealWorld App**

https://github.com/koajs/koa/issues/979
https://github.com/gothinkster/realworld


## [Component Registry](http://snuggsi.herokuapp.com/examples)


## The Template

See [MDN <template>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template)
for more details

- `<template>`


## Custom Elements

- `<hello-world>`
Expand All @@ -25,6 +33,7 @@ for more details
- `<drag-drop>`
- `<ping-pong>`


## Web Components

- `<skype-clone>`
Expand Down
10 changes: 6 additions & 4 deletions examples/index.es
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
console.warn ('this is coming from examples wohoo')
module.exports =

const
{ routes }
= require ('./')
class {
get (context, element) {
console.warn ('Getting', element)
}
}
12 changes: 8 additions & 4 deletions html-link-element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ The HTML `<link>` element specifies relationships between the current document a

https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf

- WHATWG Fetching - https://fetch.spec.whatwg.org/#fetching
- WHATWG Initializing context/content specific fetch defaults https://github.com/whatwg/fetch/issues/43
- WHATWG Obtaining a link element - https://w3c.github.io/html/document-metadata.html#obtain
- W3C Preload https://github.com/w3c/preload
- W3C Preload https://github.com/w3c/preload/issues/92
- W3C Preload Tests - https://w3c-test.org/preload
Expand All @@ -37,6 +40,8 @@ The HTML `<link>` element specifies relationships between the current document a
- Core - https://gist.github.com/aFarkas/34dde117000ec7075053#file-preload-core-js
- Script - https://gist.github.com/aFarkas/34dde117000ec7075053#file-preload-as-script-js
- Style - https://gist.github.com/aFarkas/34dde117000ec7075053#file-preload-as-style-js
- Firefox "Accept Header for images has been simplified" - https://www.fxsitecompat.com/en-CA/docs/2016/accept-header-for-images-has-been-simplified/


#### Preload Use Cases

Expand All @@ -46,7 +51,6 @@ The HTML `<link>` element specifies relationships between the current document a

- Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1405761


### Prefetch

- IE11 Support for Prerender / Prefetch - https://msdn.microsoft.com/en-us/library/dn265039(v=vs.85).aspx
Expand All @@ -57,8 +61,6 @@ The HTML `<link>` element specifies relationships between the current document a
- IE11 Support for Prerender / Prefetch - https://msdn.microsoft.com/en-us/library/dn265039(v=vs.85).aspx




## Onload

Why `GlobalEventHandlers.onload`?
Expand All @@ -83,7 +85,9 @@ The HTML `<link>` element specifies relationships between the current document a

## Implementation Tickets

- Chromium Bugs - https://bugs.chromium.org/p/chromium/issues/detail?id=67522
- Link rel preload as attribute doesn't support document value - https://bugs.chromium.org/p/chromium/issues/detail?id=593267
- (Chrome) Centralize the setting of Accept headers - https://chromium.googlesource.com/chromium/src/+/1f3d63b1d496218b7c90a27dd1699560592a6dcc
- Implement load event for `link` element - https://bugs.chromium.org/p/chromium/issues/detail?id=67522
- https://bugzilla.mozilla.org/show_bug.cgi?id=185236
- Load CSS - https://github.com/filamentgroup/loadCSS/blob/master/src/loadCSS.js
- CSS Preload - https://github.com/filamentgroup/loadCSS/blob/master/src/cssrelpreload.js
Expand Down
3 changes: 2 additions & 1 deletion index.es
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require ('./polyfills')

module.exports = {
Server : require ('server')
Resource : require ('resource')
, Server : require ('server')
}
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<meta
name=viewport
content='width=device-width,initial-scale=1'
content='user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,height=device-height'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @mrbernnz

>
<link
as=style
Expand All @@ -16,9 +16,11 @@
href=/index.css
rel='preload stylesheet'
>
<!--
<link
as=fetch
rel=preload
type=text/html
id=github-ribbon
href=/examples/github-ribbon
>
Expand All @@ -27,6 +29,7 @@
rel=preload
id=header-group
href=/examples/header-group>
-->


<style>
Expand Down Expand Up @@ -374,7 +377,7 @@ <h2 slot=header>

</nav>

<main>
<main role=main>

<section view id=installation>
<h1>Easy Installation</h1>
Expand Down Expand Up @@ -928,7 +931,7 @@ <h3>Further Learning</h3>

</aside>

<footer>
<footer role=contentinfo>
<header><a title=snuggsi.esツ href=/>snuggsi.esツ</a></header>

<em>Copyright &copy; 2018 A <strong>devPunks</strong> project</em>
Expand Down
6 changes: 5 additions & 1 deletion index.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const
{ test }
= require ('test')

, { Test, Server }
, { Test, Server, Resource }
= require ('.')


Expand All @@ -12,3 +12,7 @@ test ('snuggsi.Test',

test ('snuggsi.Server',
t => { t.assert (Server), t.end () })


test ('snuggsi.Resource',
t => { t.assert (Resource), t.end () })
16 changes: 16 additions & 0 deletions middleware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Middleware used for CSP (Content Security Policy).
- https://medium.com/square-corner-blog/content-security-policy-for-single-page-web-apps-78f2b2cf1757
- https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet

## snuggsi.route

Used for routing.

- https://www.w3.org/Provider/Style/URI.html
- Why you should always add a trailing `/` - https://cdivilly.wordpress.com/2014/03/11/why-trailing-slashes-on-uris-are-important/


## snuggsi.browse

Expand All @@ -23,6 +30,15 @@ Middleware used for developer tools like browsersync and browser extensions.

Middleware used for Content Negotiaton.

- https://github.com/w3c/preload/issues/113
- https://github.com/whatwg/mimesniff/issues/42
- Oye vey! https://wiki.whatwg.org/wiki/Why_not_conneg
- Media Types (part II) rfc2046 - https://www.ietf.org/rfc/rfc2046
- MIME (Multipurpose Internet Mail Extensions) Types (part I) rfc2045 - https://www.ietf.org/rfc/rfc2045
- Picking the right mime type - https://www.maxcdn.com/one/tutorial/mime-types/
- Require servers to use `text/javascript` - https://github.com/whatwg/html/pull/3096
- MDN HTTP MIME Types - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types


## snuggsi.compressor

Expand Down
13 changes: 10 additions & 3 deletions middleware/assets.es
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
module.exports = path =>
require ('koa-static')
( path, { defer: true } )
const
route
= require ('./route')

, Resource
= require ('resource')


module.exports =
path => route ('/', Resource (`/${path}/`))
16 changes: 6 additions & 10 deletions middleware/assets.test
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
const
{ test, browse, get }
{ test, fetch }
= require ('test')

, { assets }
= require ('.')

, Server
= require ('server')

, request
= require ('request')
, { Server }
= require ('..')


test ('random location of assets')

test ('assets', t => {
test ('assets', async t => {

const
server
= (new Server).serve ``

request
.get ('http://localhost:8181', response => { })
await fetch ('http://localhost:8181')


t.ok (true)

server.close ()
server.close ``
t.end ()
})
Loading