Very Popular
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192{ "importMapBaseURL": "https://base.example/path1/path2/path3", "tests": { "Relative URL scope keys should work with no prefix": { "importMap": { "scopes": { "foo": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/foo": {} } } }, "Relative URL scope keys should work with ./, ../, and / prefixes": { "importMap": { "scopes": { "./foo": {}, "../foo": {}, "/foo": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/foo": {}, "https://base.example/path1/foo": {}, "https://base.example/foo": {} } } }, "Absolute URL scope keys should ignore relative URL scope keys when the base URL is a data: URL": { "importMap": { "scopes": { "./foo": {}, "../foo": {}, "/foo": {} } }, "importMapBaseURL": "data:text/html,test", "expectedParsedImportMap": { "imports": {}, "scopes": {} } }, "Relative URL scope keys should work with ./, ../, or / with no suffix": { "importMap": { "scopes": { "./": {}, "../": {}, "/": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/": {}, "https://base.example/path1/": {}, "https://base.example/": {} } } }, "Relative URL scope keys should work with /s, ?s, and #s": { "importMap": { "scopes": { "foo/bar?baz#qux": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/foo/bar?baz#qux": {} } } }, "Relative URL scope keys should work with an empty string scope key": { "importMap": { "scopes": { "": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/path3": {} } } }, "Relative URL scope keys should work with / suffixes": { "importMap": { "scopes": { "foo/": {}, "./foo/": {}, "../foo/": {}, "/foo/": {}, "/foo//": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/foo/": {}, "https://base.example/path1/foo/": {}, "https://base.example/foo/": {}, "https://base.example/foo//": {} } } }, "Relative URL scope keys should deduplicate based on URL parsing rules": { "importMap": { "scopes": { "foo/\\": { "1": "./a" }, "foo//": { "2": "./b" }, "foo\\\\": { "3": "./c" } } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/foo//": { "3": "https://base.example/path1/path2/c" } } } }, "Absolute URL scope keys should accept all absolute URL scope keys, with or without fetch schemes": { "importMap": { "scopes": { "about:good": {}, "blob:good": {}, "data:good": {}, "file:///good": {}, "filesystem:http://example.com/good/": {}, "http://good/": {}, "https://good/": {}, "ftp://good/": {}, "import:bad": {}, "mailto:bad": {}, "javascript:bad": {}, "wss:ba": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "about:good": {}, "blob:good": {}, "data:good": {}, "file:///good": {}, "filesystem:http://example.com/good/": {}, "http://good/": {}, "https://good/": {}, "ftp://good/": {}, "import:bad": {}, "mailto:bad": {}, "javascript:bad": {}, "wss://ba/": {} } } }, "Absolute URL scope keys should parse absolute URL scope keys, ignoring unparseable ones": { "importMap": { "scopes": { "https://example.com:demo": {}, "http://[www.example.com]/": {}, "https:example.org": {}, "https://///example.com///": {}, "https://example.net": {}, "https://ex%41mple.com/foo/": {} } }, "expectedParsedImportMap": { "imports": {}, "scopes": { "https://base.example/path1/path2/example.org": {}, "https://example.com///": {}, "https://example.net/": {}, "https://example.com/foo/": {} } } } }}