Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Oct 22, 2020
1 parent cd5c8da commit 1863452
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"importMap": {
"imports": {
"data:text/": "/lib/test-data/",
"about:text/": "/lib/test-about/",
"blob:text/": "/lib/test-blob/",
"blah:text/": "/lib/test-blah/",
"http:text/": "/lib/test-http/",
"https:text/": "/lib/test-https/",
"file:text/": "/lib/test-file/",
"ftp:text/": "/lib/test-ftp/",
"ws:text/": "/lib/test-ws/",
"wss:text/": "/lib/test-wss/"
}
},
"importMapBaseURL": "https://example.com/app/index.html",
"baseURL": "https://example.com/js/app.mjs",
"name": "URL-like specifiers",
"tests": {
"Non-special vs. special schemes": {
"expectedResults": {
"data:text/javascript,console.log('foo')": "data:text/javascript,console.log('foo')",
"data:text/": "https://example.com/lib/test-data/",
"about:text/foo": "about:text/foo",
"about:text/": "https://example.com/lib/test-about/",
"blob:text/foo": "blob:text/foo",
"blob:text/": "https://example.com/lib/test-blob/",
"blah:text/foo": "blah:text/foo",
"blah:text/": "https://example.com/lib/test-blah/",
"http:text/foo": "https://example.com/lib/test-http/foo",
"http:text/": "https://example.com/lib/test-http/",
"https:text/foo": "https://example.com/lib/test-https/foo",
"https:text/": "https://example.com/lib/test-https/",
"ftp:text/foo": "https://example.com/lib/test-ftp/foo",
"ftp:text/": "https://example.com/lib/test-ftp/",
"file:text/foo": "https://example.com/lib/test-file/foo",
"file:text/": "https://example.com/lib/test-file/",
"ws:text/foo": "https://example.com/lib/test-ws/foo",
"ws:text/": "https://example.com/lib/test-ws/",
"wss:text/foo": "https://example.com/lib/test-wss/foo",
"wss:text/": "https://example.com/lib/test-wss/"
}
}
}
}
27 changes: 1 addition & 26 deletions reference-implementation/__tests__/json/url-specifiers.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@
"/test/": "/lib/url-trailing-slash/",
"./test/": "/lib/url-trailing-slash-dot/",
"/test": "/lib/test1.mjs",
"../test": "/lib/test2.mjs",
"data:text/": "/lib/test-data/",
"about:text/": "/lib/test-about/",
"blob:text/": "/lib/test-blob/",
"blah:text/": "/lib/test-blah/",
"file:text/": "/lib/test-file/",
"ftp:text/": "/lib/test-ftp/",
"ws:text/": "/lib/test-ws/"
"../test": "/lib/test2.mjs"
}
},
"importMapBaseURL": "https://example.com/app/index.html",
Expand Down Expand Up @@ -54,24 +47,6 @@
"expectedResults": {
"/test": "https://example.com/lib/test2.mjs"
}
},
"Non-special vs. special schemes": {
"expectedResults": {
"data:text/javascript,console.log('foo')": "data:text/javascript,console.log('foo')",
"data:text/": "https://example.com/lib/test-data/",
"about:text/foo": "about:text/foo",
"about:text/": "https://example.com/lib/test-about/",
"blob:text/foo": "blob:text/foo",
"blob:text/": "https://example.com/lib/test-blob/",
"blah:text/foo": "blah:text/foo",
"blah:text/": "https://example.com/lib/test-blah/",
"ftp:text/foo": "https://example.com/lib/test-ftp/foo",
"ftp:text/": "https://example.com/lib/test-ftp/",
"file:text/foo": "https://example.com/lib/test-file/foo",
"file:text/": "https://example.com/lib/test-file/",
"ws:text/foo": "https://example.com/lib/test-ws/foo",
"ws:text/": "https://example.com/lib/test-ws/"
}
}
}
}
2 changes: 1 addition & 1 deletion reference-implementation/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ exports.tryURLLikeSpecifierParse = (specifier, baseURL) => {
};

// https://url.spec.whatwg.org/#special-scheme
const specialProtocols = new Set(["ftp:", "file:", "http:", "https:", "ws:", "wss:"]);
const specialProtocols = new Set(['ftp:', 'file:', 'http:', 'https:', 'ws:', 'wss:']);
exports.isSpecial = url => specialProtocols.has(url.protocol);

0 comments on commit 1863452

Please sign in to comment.