Source code

Revision control

Copy as Markdown

Other Tools

{
"importMapBaseURL": "https://example.com/app/index.html",
"tests": {
"Fallback to toplevel and between scopes": {
"importMap": {
"imports": {
"a": "/a-1.mjs",
"b": "/b-1.mjs",
"c": "/c-1.mjs",
"d": "/d-1.mjs"
},
"scopes": {
"/scope2/": {
"a": "/a-2.mjs",
"d": "/d-2.mjs"
},
"/scope2/scope3/": {
"b": "/b-3.mjs",
"d": "/d-3.mjs"
}
}
},
"tests": {
"should fall back to `imports` when no scopes match": {
"expectedResults": {
}
},
"should use a direct scope override": {
"expectedResults": {
}
},
"should use an indirect scope override": {
"expectedResults": {
}
}
}
},
"Relative URL scope keys": {
"importMap": {
"imports": {
"a": "/a-1.mjs",
"b": "/b-1.mjs",
"c": "/c-1.mjs"
},
"scopes": {
"": {
"a": "/a-empty-string.mjs"
},
"./": {
"b": "/b-dot-slash.mjs"
},
"../": {
"c": "/c-dot-dot-slash.mjs"
}
}
},
"tests": {
"An empty string scope is a scope with import map base URL": {
"expectedResults": {
}
},
"'./' scope is a scope with import map base URL's directory": {
"expectedResults": {
}
},
"'../' scope is a scope with import map base URL's parent directory": {
"expectedResults": {
}
}
}
},
"Package-like scenarios": {
"importMap": {
"imports": {
"moment": "/node_modules/moment/src/moment.js",
"moment/": "/node_modules/moment/src/",
"lodash-dot": "./node_modules/lodash-es/lodash.js",
"lodash-dot/": "./node_modules/lodash-es/",
"lodash-dotdot": "../node_modules/lodash-es/lodash.js",
"lodash-dotdot/": "../node_modules/lodash-es/"
},
"scopes": {
"/": {
"moment": "/node_modules_3/moment/src/moment.js",
"vue": "/node_modules_3/vue/dist/vue.runtime.esm.js"
},
"/js/": {
"lodash-dot": "./node_modules_2/lodash-es/lodash.js",
"lodash-dot/": "./node_modules_2/lodash-es/",
"lodash-dotdot": "../node_modules_2/lodash-es/lodash.js",
"lodash-dotdot/": "../node_modules_2/lodash-es/"
}
}
},
"tests": {
"Base URLs inside the scope should use the scope if the scope has matching keys": {
"expectedResults": {
}
},
"Base URLs inside the scope fallback to less specific scope": {
"expectedResults": {
}
},
"Base URLs inside the scope fallback to toplevel": {
"expectedResults": {
}
},
"Base URLs outside a scope shouldn't use the scope even if the scope has matching keys": {
"expectedResults": {
}
},
"Fallback to toplevel or not, depending on trailing slash match": {
"expectedResults": {
}
},
"should still fail for package-like specifiers that are not declared": {
"expectedResults": {
"underscore/": null,
"underscore/foo": null
}
}
}
}
}
}