Skip to main content
Module

x/importmap/testdata/packages-via-trailing-slashes.json

Resolve specifiers with import maps.
Go to Latest
File
{ "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/", "mapped/": "https://example.com/", "mapped/path/": "https://github.com/WICG/import-maps/issues/207/" } }, "importMapBaseURL": "https://example.com/app/index.html", "baseURL": "https://example.com/js/app.mjs", "name": "Package-like scenarios", "link": "https://github.com/WICG/import-maps#packages-via-trailing-slashes", "tests": { "package main modules": { "expectedResults": { "moment": "https://example.com/node_modules/moment/src/moment.js", "lodash-dot": "https://example.com/app/node_modules/lodash-es/lodash.js", "lodash-dotdot": "https://example.com/node_modules/lodash-es/lodash.js" } }, "package submodules": { "expectedResults": { "moment/foo": "https://example.com/node_modules/moment/src/foo", "lodash-dot/foo": "https://example.com/app/node_modules/lodash-es/foo", "lodash-dotdot/foo": "https://example.com/node_modules/lodash-es/foo" } }, "package names that end in a slash should just pass through": { "expectedResults": { "moment/": "https://example.com/node_modules/moment/src/" } }, "package modules that are not declared should fail": { "expectedResults": { "underscore/": null, "underscore/foo": null } }, "backtracking via ..": { "expectedResults": { "mapped/path": "https://example.com/path", "mapped/path/": "https://github.com/WICG/import-maps/issues/207/", "mapped/path/..": null, "mapped/path/../backtrack": null, "mapped/path/../../backtrack": null, "mapped/path/../../../backtrack": null, "moment/../backtrack": null, "moment/..": null } } }}