parsing-specifier-keys.json (7280B)
1 { 2 "importMapBaseURL": "https://base.example/path1/path2/path3", 3 "tests": { 4 "Relative URL specifier keys should absolutize strings prefixed with ./, ../, or / into the corresponding URLs": { 5 "importMap": { 6 "imports": { 7 "./foo": "/dotslash", 8 "../foo": "/dotdotslash", 9 "/foo": "/slash" 10 } 11 }, 12 "expectedParsedImportMap": { 13 "imports": { 14 "https://base.example/path1/path2/foo": "https://base.example/dotslash", 15 "https://base.example/path1/foo": "https://base.example/dotdotslash", 16 "https://base.example/foo": "https://base.example/slash" 17 }, 18 "scopes": {} 19 } 20 }, 21 "Relative URL specifier keys should not absolutize strings prefixed with ./, ../, or / with a data: URL base": { 22 "importMap": { 23 "imports": { 24 "./foo": "https://example.com/dotslash", 25 "../foo": "https://example.com/dotdotslash", 26 "/foo": "https://example.com/slash" 27 } 28 }, 29 "importMapBaseURL": "data:text/html,", 30 "expectedParsedImportMap": { 31 "imports": { 32 "./foo": "https://example.com/dotslash", 33 "../foo": "https://example.com/dotdotslash", 34 "/foo": "https://example.com/slash" 35 }, 36 "scopes": {} 37 } 38 }, 39 "Relative URL specifier keys should absolutize the literal strings ./, ../, or / with no suffix": { 40 "importMap": { 41 "imports": { 42 "./": "/dotslash/", 43 "../": "/dotdotslash/", 44 "/": "/slash/" 45 } 46 }, 47 "expectedParsedImportMap": { 48 "imports": { 49 "https://base.example/path1/path2/": "https://base.example/dotslash/", 50 "https://base.example/path1/": "https://base.example/dotdotslash/", 51 "https://base.example/": "https://base.example/slash/" 52 }, 53 "scopes": {} 54 } 55 }, 56 "Relative URL specifier keys should work with /s, ?s, and #s": { 57 "importMap": { 58 "imports": { 59 "./foo/bar?baz#qux": "/foo" 60 } 61 }, 62 "expectedParsedImportMap": { 63 "imports": { 64 "https://base.example/path1/path2/foo/bar?baz#qux": "https://base.example/foo" 65 }, 66 "scopes": {} 67 } 68 }, 69 "Relative URL specifier keys should ignore an empty string key": { 70 "importMap": { 71 "imports": { 72 "": "/foo" 73 } 74 }, 75 "expectedParsedImportMap": { 76 "imports": {}, 77 "scopes": {} 78 } 79 }, 80 "Relative URL specifier keys should treat percent-encoded variants of ./, ../, or / as bare specifiers": { 81 "importMap": { 82 "imports": { 83 "%2E/": "/dotSlash1/", 84 "%2E%2E/": "/dotDotSlash1/", 85 ".%2F": "/dotSlash2", 86 "..%2F": "/dotDotSlash2", 87 "%2F": "/slash2", 88 "%2E%2F": "/dotSlash3", 89 "%2E%2E%2F": "/dotDotSlash3" 90 } 91 }, 92 "expectedParsedImportMap": { 93 "imports": { 94 "%2E/": "https://base.example/dotSlash1/", 95 "%2E%2E/": "https://base.example/dotDotSlash1/", 96 ".%2F": "https://base.example/dotSlash2", 97 "..%2F": "https://base.example/dotDotSlash2", 98 "%2F": "https://base.example/slash2", 99 "%2E%2F": "https://base.example/dotSlash3", 100 "%2E%2E%2F": "https://base.example/dotDotSlash3" 101 }, 102 "scopes": {} 103 } 104 }, 105 "Relative URL specifier keys should deduplicate based on URL parsing rules": { 106 "importMap": { 107 "imports": { 108 "./foo/\\": "/foo1", 109 "./foo//": "/foo2", 110 "./foo\\\\": "/foo3" 111 } 112 }, 113 "expectedParsedImportMap": { 114 "imports": { 115 "https://base.example/path1/path2/foo//": "https://base.example/foo3" 116 }, 117 "scopes": {} 118 } 119 }, 120 "Absolute URL specifier keys should accept all absolute URL specifier keys, with or without fetch schemes": { 121 "importMap": { 122 "imports": { 123 "about:good": "/about", 124 "blob:good": "/blob", 125 "data:good": "/data", 126 "file:///good": "/file", 127 "filesystem:http://example.com/good/": "/filesystem/", 128 "http://good/": "/http/", 129 "https://good/": "/https/", 130 "ftp://good/": "/ftp/", 131 "import:bad": "/import", 132 "mailto:bad": "/mailto", 133 "javascript:bad": "/javascript", 134 "wss:bad": "/wss" 135 } 136 }, 137 "expectedParsedImportMap": { 138 "imports": { 139 "about:good": "https://base.example/about", 140 "blob:good": "https://base.example/blob", 141 "data:good": "https://base.example/data", 142 "file:///good": "https://base.example/file", 143 "filesystem:http://example.com/good/": "https://base.example/filesystem/", 144 "http://good/": "https://base.example/http/", 145 "https://good/": "https://base.example/https/", 146 "ftp://good/": "https://base.example/ftp/", 147 "import:bad": "https://base.example/import", 148 "mailto:bad": "https://base.example/mailto", 149 "javascript:bad": "https://base.example/javascript", 150 "wss://bad/": "https://base.example/wss" 151 }, 152 "scopes": {} 153 } 154 }, 155 "Absolute URL specifier keys should parse absolute URLs, treating unparseable ones as bare specifiers": { 156 "importMap": { 157 "imports": { 158 "https://example.com:demo": "/unparseable2", 159 "http://[www.example.com]/": "/unparseable3/", 160 "https:example.org": "/invalidButParseable1/", 161 "https://///example.com///": "/invalidButParseable2/", 162 "https://example.net": "/prettyNormal/", 163 "https://ex%41mple.com/": "/percentDecoding/" 164 } 165 }, 166 "expectedParsedImportMap": { 167 "imports": { 168 "https://example.com:demo": "https://base.example/unparseable2", 169 "http://[www.example.com]/": "https://base.example/unparseable3/", 170 "https://example.org/": "https://base.example/invalidButParseable1/", 171 "https://example.com///": "https://base.example/invalidButParseable2/", 172 "https://example.net/": "https://base.example/prettyNormal/", 173 "https://example.com/": "https://base.example/percentDecoding/" 174 }, 175 "scopes": {} 176 } 177 }, 178 "Specifier keys should be sort correctly (issue #181) - Test #1": { 179 "importMap": { 180 "imports": { 181 "https://example.com/aaa": "https://example.com/aaa", 182 "https://example.com/a": "https://example.com/a" 183 } 184 }, 185 "expectedParsedImportMap": { 186 "imports": { 187 "https://example.com/aaa": "https://example.com/aaa", 188 "https://example.com/a": "https://example.com/a" 189 }, 190 "scopes": {} 191 } 192 }, 193 "Specifier keys should be sort correctly (issue #181) - Test #2": { 194 "importMap": { 195 "imports": { 196 "https://example.com/a": "https://example.com/a", 197 "https://example.com/aaa": "https://example.com/aaa" 198 } 199 }, 200 "expectedParsedImportMap": { 201 "imports": { 202 "https://example.com/aaa": "https://example.com/aaa", 203 "https://example.com/a": "https://example.com/a" 204 }, 205 "scopes": {} 206 } 207 } 208 } 209 }