@jsenv/module-resolution
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -5,38 +5,2 @@ 'use strict'; | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
// eslint-disable-next-line no-undef | ||
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) !== "object") { | ||
var globalObject; | ||
if (undefined) { | ||
globalObject = undefined; | ||
} else { | ||
// eslint-disable-next-line no-extend-native | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
globalObject = __global__; | ||
delete Object.prototype.__global__; | ||
} | ||
globalObject.globalThis = globalObject; | ||
} | ||
var hrefToScheme = function hrefToScheme(href) { | ||
@@ -110,2 +74,12 @@ var colonIndex = href.indexOf(":"); | ||
var nativeTypeOf = function nativeTypeOf(obj) { | ||
return typeof obj; | ||
}; | ||
var customTypeOf = function customTypeOf(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf; | ||
var assertImportMap = function assertImportMap(value) { | ||
@@ -127,2 +101,20 @@ if (value === null) { | ||
/** | ||
* DISCLAIMER: | ||
* For now you could not resolve to a different origin | ||
* because applyImportMap work only with pathname and not url. | ||
* | ||
* It means passing | ||
* { | ||
* imports: { | ||
* "foo": "https://example.com/node_modules/foo/index.js" | ||
* } | ||
* } | ||
* is not supported | ||
* | ||
* I could convert https://github.com/WICG/import-maps/blob/93f94c6dfb268bde3009644b65580fb2fbb98fcf/reference-implementation/lib/resolver.js#L12 | ||
* into import/export and use it directly. | ||
* | ||
* | ||
*/ | ||
var applyImportMap = function applyImportMap(_ref) { | ||
@@ -160,3 +152,3 @@ var importMap = _ref.importMap, | ||
var scopeImports = scopes[matchingPathnamePattern]; | ||
return applyImports({ | ||
var scopeRemapping = applyImports({ | ||
href: href, | ||
@@ -166,9 +158,19 @@ imports: scopeImports // scopePattern: matchingPathnamePattern, | ||
}); | ||
if (scopeRemapping !== null) { | ||
return scopeRemapping; | ||
} | ||
} | ||
} | ||
return applyImports({ | ||
var topLevelimportRemapping = applyImports({ | ||
href: href, | ||
imports: imports | ||
}); | ||
if (topLevelimportRemapping !== null) { | ||
return topLevelimportRemapping; | ||
} | ||
return href; | ||
}; | ||
@@ -200,3 +202,3 @@ | ||
return href; | ||
return null; | ||
}; | ||
@@ -304,2 +306,3 @@ | ||
// https://github.com/systemjs/systemjs/blob/master/src/common.js | ||
// "../folder/file.js" | ||
@@ -356,2 +359,3 @@ | ||
// could be useful: https://url.spec.whatwg.org/#url-miscellaneous | ||
var resolveImport = function resolveImport(_ref) { | ||
@@ -358,0 +362,0 @@ var importer = _ref.importer, |
var __dmail_assert__ = function (exports) { | ||
'use strict'; | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} // eslint-disable-next-line no-undef | ||
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) !== "object") { | ||
var globalObject; | ||
if (undefined) { | ||
globalObject = undefined; | ||
} else { | ||
// eslint-disable-next-line no-extend-native | ||
Object.defineProperty(Object.prototype, "__global__", { | ||
get: function get() { | ||
return this; | ||
}, | ||
configurable: true | ||
}); // eslint-disable-next-line no-undef | ||
globalObject = __global__; | ||
delete Object.prototype.__global__; | ||
} | ||
globalObject.globalThis = globalObject; | ||
} | ||
var hrefToScheme = function hrefToScheme(href) { | ||
@@ -108,2 +72,12 @@ var colonIndex = href.indexOf(":"); | ||
var nativeTypeOf = function nativeTypeOf(obj) { | ||
return typeof obj; | ||
}; | ||
var customTypeOf = function customTypeOf(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf; | ||
var assertImportMap = function assertImportMap(value) { | ||
@@ -124,3 +98,22 @@ if (value === null) { | ||
}; | ||
/** | ||
* DISCLAIMER: | ||
* For now you could not resolve to a different origin | ||
* because applyImportMap work only with pathname and not url. | ||
* | ||
* It means passing | ||
* { | ||
* imports: { | ||
* "foo": "https://example.com/node_modules/foo/index.js" | ||
* } | ||
* } | ||
* is not supported | ||
* | ||
* I could convert https://github.com/WICG/import-maps/blob/93f94c6dfb268bde3009644b65580fb2fbb98fcf/reference-implementation/lib/resolver.js#L12 | ||
* into import/export and use it directly. | ||
* | ||
* | ||
*/ | ||
var applyImportMap = function applyImportMap(_ref) { | ||
@@ -158,3 +151,3 @@ var importMap = _ref.importMap, | ||
var scopeImports = scopes[matchingPathnamePattern]; | ||
return applyImports({ | ||
var scopeRemapping = applyImports({ | ||
href: href, | ||
@@ -164,9 +157,19 @@ imports: scopeImports // scopePattern: matchingPathnamePattern, | ||
}); | ||
if (scopeRemapping !== null) { | ||
return scopeRemapping; | ||
} | ||
} | ||
} | ||
return applyImports({ | ||
var topLevelimportRemapping = applyImports({ | ||
href: href, | ||
imports: imports | ||
}); | ||
if (topLevelimportRemapping !== null) { | ||
return topLevelimportRemapping; | ||
} | ||
return href; | ||
}; | ||
@@ -198,3 +201,3 @@ | ||
return href; | ||
return null; | ||
}; | ||
@@ -302,3 +305,4 @@ | ||
return "".concat(importerOrigin, "/").concat(specifier.slice(1)); | ||
}; // "../folder/file.js" | ||
}; // https://github.com/systemjs/systemjs/blob/master/src/common.js | ||
// "../folder/file.js" | ||
@@ -354,4 +358,5 @@ | ||
return "".concat(importerOrigin, "/").concat(specifier); | ||
}; | ||
}; // could be useful: https://url.spec.whatwg.org/#url-miscellaneous | ||
var resolveImport = function resolveImport(_ref) { | ||
@@ -358,0 +363,0 @@ var importer = _ref.importer, |
{ | ||
"name": "@jsenv/module-resolution", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"license": "MIT", | ||
@@ -42,19 +42,19 @@ "repository": { | ||
"@jsenv/href": "1.0.0", | ||
"@jsenv/import-map": "2.0.0" | ||
"@jsenv/import-map": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@dmail/assert": "3.14.0", | ||
"@jsenv/bundling": "3.1.0", | ||
"@jsenv/chromium-launcher": "2.9.0", | ||
"@jsenv/bundling": "5.14.0", | ||
"@jsenv/chromium-launcher": "3.5.0", | ||
"@jsenv/codecov-upload": "1.7.0", | ||
"@jsenv/execution": "3.3.0", | ||
"@jsenv/exploring-server": "2.19.0", | ||
"@jsenv/node-launcher": "3.5.0", | ||
"@jsenv/node-module-import-map": "6.2.0", | ||
"@jsenv/execution": "5.6.0", | ||
"@jsenv/exploring-server": "3.7.0", | ||
"@jsenv/node-launcher": "4.12.0", | ||
"@jsenv/node-module-import-map": "7.0.0", | ||
"@jsenv/eslint-config": "10.0.0", | ||
"@jsenv/prettier-config": "1.0.0", | ||
"@jsenv/prettier-check-project": "3.3.0", | ||
"@jsenv/testing": "2.5.0", | ||
"@jsenv/prettier-check-project": "3.4.0", | ||
"@jsenv/testing": "3.0.0", | ||
"babel-eslint": "11.0.0-beta.0", | ||
"eslint": "6.2.2", | ||
"eslint": "6.4.0", | ||
"prettier": "1.18.2", | ||
@@ -61,0 +61,0 @@ "rimraf": "3.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
949
93943
+ Added@jsenv/import-map@3.0.0(transitive)
- Removed@jsenv/import-map@2.0.0(transitive)
Updated@jsenv/import-map@3.0.0