@jsenv/import-map
Advanced tools
Comparing version 6.7.2 to 6.7.3
{ | ||
"name": "@jsenv/import-map", | ||
"version": "6.7.2", | ||
"version": "6.7.3", | ||
"description": "Helpers to implement importmaps.", | ||
@@ -32,15 +32,15 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "node ./script/test/test.js", | ||
"test-with-coverage": "node ./script/test/test.js --coverage", | ||
"eslint-check": "eslint .", | ||
"prettier-format": "node ./script/prettier-format/prettier-format.js", | ||
"start-exploring": "node --no-warnings ./script/start-exploring/start-exploring.js", | ||
"test": "node --no-warnings ./script/test/test.js", | ||
"test-with-coverage": "npm run test -- --coverage", | ||
"eslint-check": "node ./node_modules/eslint/bin/eslint.js .", | ||
"prettier-format": "node --no-warnings ./script/prettier-format/prettier-format.js", | ||
"prettier-format-stage": "npm run prettier-format -- --staged", | ||
"prettier-check": "npm run prettier-format -- --dry-run", | ||
"upload-coverage": "node ./script/upload-coverage/upload-coverage.js", | ||
"generate-esmodule-bundle": "node --no-warnings ./script/generate-esmodule-bundle/generate-esmodule-bundle.js", | ||
"generate-commonjs-bundle": "node ./script/generate-commonjs-bundle/generate-commonjs-bundle.js", | ||
"generate-import-map": "node ./script/generate-import-map/generate-import-map.js", | ||
"install-git-hooks": "node ./script/install-git-hooks/install-git-hooks.js", | ||
"dist": "npm run clean && npm run generate-commonjs-bundle", | ||
"clean": "rimraf dist && rimraf coverage", | ||
"reinstall": "npm run clean && rimraf node_modules && npm install", | ||
"generate-import-map": "node --no-warnings ./script/generate-import-map/generate-import-map.js", | ||
"install-git-hooks": "node --no-warnings ./script/install-git-hooks/install-git-hooks.js", | ||
"dist": "npm run generate-esmodule-bundle && npm run generate-commonjs-bundle", | ||
"prepublishOnly": "node ./script/transform-package/remove-postinstall.js && npm run dist", | ||
@@ -52,17 +52,19 @@ "postpublish": "node ./script/transform-package/restore-postinstall.js", | ||
"devDependencies": { | ||
"@jsenv/assert": "1.2.2", | ||
"@jsenv/codecov-upload": "3.2.0", | ||
"@jsenv/core": "11.2.4", | ||
"@jsenv/eslint-config": "12.2.0", | ||
"@jsenv/git-hooks": "1.2.0", | ||
"@jsenv/github-release-package": "1.1.1", | ||
"@jsenv/node-module-import-map": "11.0.0", | ||
"@jsenv/package-publish": "1.4.1", | ||
"@jsenv/prettier-check-project": "5.4.0", | ||
"@jsenv/assert": "2.1.0", | ||
"@jsenv/codecov-upload": "3.4.0", | ||
"@jsenv/core": "12.2.1", | ||
"@jsenv/eslint-config": "12.3.1", | ||
"@jsenv/git-hooks": "1.3.3", | ||
"@jsenv/github-release-package": "1.2.2", | ||
"@jsenv/node-module-import-map": "11.0.1", | ||
"@jsenv/package-publish": "1.5.1", | ||
"@jsenv/prettier-check-project": "5.5.0", | ||
"@jsenv/prettier-config": "1.2.0", | ||
"babel-eslint": "11.0.0-beta.0", | ||
"eslint": "6.8.0", | ||
"prettier": "1.19.1", | ||
"rimraf": "3.0.1" | ||
"playwright-chromium": "0.11.1", | ||
"playwright-firefox": "0.11.1", | ||
"playwright-webkit": "0.11.1", | ||
"prettier": "1.19.1" | ||
} | ||
} |
@@ -14,10 +14,9 @@ # import-map | ||
- [Installation](#installation) | ||
- [Documentation](#Usage) | ||
- [composeTwoImportMaps](#composetwoimportmaps) | ||
- [normalizeImportMap](#normalizeimportmap) | ||
- [resolveImport](#resolveimport) | ||
- [composeTwoImportMaps](#composetwoimportmaps) | ||
- [normalizeImportMap](#normalizeimportmap) | ||
- [resolveImport](#resolveimport) | ||
# Presentation | ||
`@jsenv/import-map` can be used to implement the behaviour of importMap as described in the specification. It is written using es modules and is compatible with Node.js. | ||
`@jsenv/import-map` can be used to implement the behaviour of importMap as described in the specification. It is written using es modules and compatible with browsers and Node.js. | ||
@@ -29,11 +28,7 @@ — see [importMap spec](https://github.com/WICG/import-maps) | ||
```console | ||
npm install --save-dev @jsenv/import-map@6.7.2 | ||
npm install --save-dev @jsenv/import-map | ||
``` | ||
# Documentation | ||
# composeTwoImportMaps | ||
`@jsenv/import-map` exports are documented in this section. | ||
## composeTwoImportMaps | ||
`composeTwoImportMaps` takes two `importMap` and return a single `importMap` being the composition of the two. | ||
@@ -70,3 +65,3 @@ | ||
## normalizeImportMap | ||
# normalizeImportMap | ||
@@ -102,3 +97,3 @@ `normalizeImportMap` returns an `importMap` resolved against an `url` and sorted. | ||
## resolveImport | ||
# resolveImport | ||
@@ -105,0 +100,0 @@ `resolveImport` returns an import `url` applying an `importMap` to `specifier` and `importer`. The provided `importMap` must be resolved and sorted to work as expected. You can use [normalizeImportMap](#normalizeimportmap) to do that. |
@@ -15,12 +15,22 @@ // https://github.com/systemjs/systemjs/blob/89391f92dfeac33919b0223bbf834a1f4eea5750/src/common.js#L136 | ||
const composeTwoImports = (leftImports = {}, rightImports = {}) => { | ||
return { ...leftImports, ...rightImports } | ||
return { | ||
...leftImports, | ||
...rightImports, | ||
} | ||
} | ||
const composeTwoScopes = (leftScopes = {}, rightScopes = {}) => { | ||
const scopes = { ...leftScopes } | ||
const scopes = { | ||
...leftScopes, | ||
} | ||
Object.keys(rightScopes).forEach((scopeKey) => { | ||
if (scopes.hasOwnProperty(scopeKey)) { | ||
scopes[scopeKey] = { ...scopes[scopeKey], ...rightScopes[scopeKey] } | ||
scopes[scopeKey] = { | ||
...scopes[scopeKey], | ||
...rightScopes[scopeKey], | ||
} | ||
} else { | ||
scopes[scopeKey] = { ...rightScopes[scopeKey] } | ||
scopes[scopeKey] = { | ||
...rightScopes[scopeKey], | ||
} | ||
} | ||
@@ -27,0 +37,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
92346
23
1461
16
119