From a539628f6c5cdddd2a801d504977e48263b25d6c Mon Sep 17 00:00:00 2001 From: Damien Maillard Date: Fri, 17 Jul 2020 09:37:59 +0200 Subject: [PATCH] 12.0.0 This major release is mostly about keeping import map for node module and writing importmap file separated. - replace generateImportMapForProjectPackage by getImportMapFromNodeModules - getImportMapFromNodeModules only return importmap, it does not write to filesystem anymore. - add getImportMapFromFile - add generateImportMapForProject - generate importmap for package self ref by default see https://github.com/nodejs/node/pull/31002 - rename some parameter like favoredExports becoming packagesExportsPreference - ensure a package self reference is stronger than self dev dependency --- docs/advanced.md | 77 ------------------ package.json | 2 +- readme.md | 80 ++++++++++++++++++- src/generateImportMapForProject.js | 4 + src/getImportMapFromNodeModules.js | 8 +- .../circular/circular.test.js | 2 +- .../exports-and-main/exports-and-main.test.js | 2 +- .../exports-complex/exports-complex.test.js | 2 +- .../exports-directory-scoped.test.js | 2 +- .../exports-directory.test.js | 2 +- .../exports-file-conditional.test.js | 4 +- .../exports-file-deep-2.test.js | 2 +- .../exports-file-deep.test.js | 2 +- .../exports-file/exports-file.test.js | 2 +- .../exports-string/exports-string.test.js | 2 +- .../exports-sugar-conditional.test.js | 4 +- .../exports-sugar/exports-sugar.test.js | 2 +- .../imports-leading-slash.test.js | 2 +- .../inside/inside.test.js | 2 +- .../main-directory-trailing.test.js | 2 +- .../main-directory/main-directory.test.js | 2 +- .../main-jsnext/main-jsnext.test.js | 2 +- .../main-relative/main-relative.test.js | 2 +- .../main-undefined/main-undefined.test.js | 2 +- .../main-without-extension.test.js | 2 +- .../malformed-dependency-package.test.js | 2 +- .../manual-override/manual-override.test.js | 2 +- .../missing-dependency-package.test.js | 2 +- .../missing-root-package.test.js | 2 +- .../optional-dependency.test.js | 2 +- .../scoped-inside-scoped.test.js | 2 +- .../self-import-2/self-import-2.test.js | 1 - .../self-import-3/self-import-3.test.js | 1 - .../self-import/self-import.test.js | 1 - 34 files changed, 113 insertions(+), 117 deletions(-) delete mode 100644 docs/advanced.md diff --git a/docs/advanced.md b/docs/advanced.md deleted file mode 100644 index 684b6574..00000000 --- a/docs/advanced.md +++ /dev/null @@ -1,77 +0,0 @@ -# Table of contents - -- [generateImportMapForProject](#generateImportMapForProject) - - [importMapFile](#importMapFile) - - [importMapFileRelativeUrl](#importMapFileRelativeUrl) - - [importMapFileLog](#importMapFileLog) -- [getImportMapFromFile](#getImportMapFromFile) - - [importMapFileUrl](#importMapFileUrl) - -# generateImportMapForProject - -`generateImportMapForProject` is an async function receiving an array of promise resolving to importmaps. It awaits for every importmap, compose them into one and write it into a file. - -> This function is meant to be responsible of generating the final importMap file that a project uses. - -For example code below will generate an import map from node_modules + a file + an inline importmap. - -```js -import { - getImportMapFromNodeModules, - getImportMapFromFile, - generateImportMapForProject, -} from "@jsenv/node-module-import-map" - -const projectDirectoryUrl = new URL("./", import.meta.url) -const customImportMapFileUrl = new URL("./import-map-custom.importmap", projectDirectoryUrl) - -await generateImportMapForProject( - [ - getImportMapFromNodeModules({ - projectDirectoryUrl, - projectPackageDevDependenciesIncluded: true, - }), - getImportMapFromFile(customImportMapFileUrl), - { - imports: { - foo: "./bar.js", - }, - }, - ], - { - projectDirectoryUrl, - importMapFileRelativeUrl: "./import-map.importmap", - }, -) -``` - -— source code at [src/generateImportMapForProject.js](../src/generateImportMapForProject.js). - -## importMapFile - -`importMapFile` parameter is a boolean controling if importMap is written to a file. This parameters is optional and enabled by default. - -## importMapFileRelativeUrl - -`importMapFileRelativeUrl` parameter is a string controlling where importMap file is written. This parameter is optional and by default it's `"./import-map.importmap"`. - -## importMapFileLog - -`importMapFileLog` parameter a boolean controlling if there is log in the terminal when importMap file is written. This parameter is optional and by default it's enabled. - -# getImportMapFromFile - -`getImportMapFromFile` is an async function reading importmap from a file. - -```js -import { getImportMapFromFile } from "@jsenv/node-module-import-map" - -const importMapFileUrl = new URL("./import-map.importmap", import.meta.url) -const importMap = await getImportMapFromFile(importMapFileUrl) -``` - -— source code at [src/getImportMapFromFile.js](../src/getImportMapFromFile.js). - -## importMapFileUrl - -`importMapFileUrl` parameter a string or an url leading to the importmap file. This parameter is **required**. diff --git a/package.json b/package.json index c871e165..174d6256 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jsenv/node-module-import-map", - "version": "12.0.0-alpha.0", + "version": "12.0.0", "description": "Generate importmap for node_modules.", "license": "MIT", "repository": { diff --git a/readme.md b/readme.md index c12f2a76..372d0b26 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,12 @@ Generate importmap for node_modules. - [Step 1 - Setup basic project](#step-1---setup-project) - [Step 2 - Generate project importMap](#step-2---generate-project-importMap) - [Custom node module resolution](#custom-node-module-resolution) -- [Advanced usage](#Advanced-usage) +- [generateImportMapForProject](#generateImportMapForProject) + - [importMapFile](#importMapFile) + - [importMapFileRelativeUrl](#importMapFileRelativeUrl) + - [importMapFileLog](#importMapFileLog) +- [getImportMapFromFile](#getImportMapFromFile) + - [importMapFileUrl](#importMapFileUrl) # Presentation @@ -135,8 +140,75 @@ We do this because importMap are used on the web where a file outside project fo In practice it does not impact you because node modules are inside your project folder. If not, write all your dependencies in your `package.json` and re-run `npm install`. -# Advanced usage +# generateImportMapForProject -This repository also provides the ability to compose several import map into a final importmap file. +`generateImportMapForProject` is an async function receiving an array of promise resolving to importmaps. It awaits for every importmap, compose them into one and write it into a file. -[docs/advanced.md](./docs/advanced.md) +> This function is meant to be responsible of generating the final importMap file that a project uses. + +For example code below will generate an import map from node_modules + a file + an inline importmap. + +```js +import { + getImportMapFromNodeModules, + getImportMapFromFile, + generateImportMapForProject, +} from "@jsenv/node-module-import-map" + +const projectDirectoryUrl = new URL("./", import.meta.url) +const customImportMapFileUrl = new URL("./import-map-custom.importmap", projectDirectoryUrl) +const importMapInputs = [ + getImportMapFromNodeModules({ + projectDirectoryUrl, + projectPackageDevDependenciesIncluded: true, + }), + getImportMapFromFile(customImportMapFileUrl), + { + imports: { + foo: "./bar.js", + }, + }, +] + +await generateImportMapForProject(importMapInputs, { + projectDirectoryUrl, + importMapFileRelativeUrl: "./import-map.importmap", +}) +``` + +— source code at [src/generateImportMapForProject.js](./src/generateImportMapForProject.js). + +## importMapInputs + +`importMapInputs` is an array of importmap object or promise resolving to importmap objects. This parameter is optional and is an empty array by default. + +> When `importMapInputs` is empty a warning is emitted and `generateImportMapForProject` write an empty importmap file. + +## importMapFile + +`importMapFile` parameter is a boolean controling if importMap is written to a file. This parameters is optional and enabled by default. + +## importMapFileRelativeUrl + +`importMapFileRelativeUrl` parameter is a string controlling where importMap file is written. This parameter is optional and by default it's `"./import-map.importmap"`. + +## importMapFileLog + +`importMapFileLog` parameter a boolean controlling if there is log in the terminal when importMap file is written. This parameter is optional and by default it's enabled. + +# getImportMapFromFile + +`getImportMapFromFile` is an async function reading importmap from a file. + +```js +import { getImportMapFromFile } from "@jsenv/node-module-import-map" + +const importMapFileUrl = new URL("./import-map.importmap", import.meta.url) +const importMap = await getImportMapFromFile(importMapFileUrl) +``` + +— source code at [src/getImportMapFromFile.js](../src/getImportMapFromFile.js). + +## importMapFileUrl + +`importMapFileUrl` parameter a string or an url leading to the importmap file. This parameter is **required**. diff --git a/src/generateImportMapForProject.js b/src/generateImportMapForProject.js index 4b959073..b52905ef 100644 --- a/src/generateImportMapForProject.js +++ b/src/generateImportMapForProject.js @@ -26,6 +26,10 @@ export const generateImportMapForProject = async ( async () => { projectDirectoryUrl = assertAndNormalizeDirectoryUrl(projectDirectoryUrl) + if (importMapInputs.length === 0) { + console.warn(`importMapInputs is empty, the generated importmap will be empty`) + } + const importMaps = await Promise.all(importMapInputs) const importMap = importMaps.reduce((previous, current) => { diff --git a/src/getImportMapFromNodeModules.js b/src/getImportMapFromNodeModules.js index d13eb5c4..a3aeeba5 100644 --- a/src/getImportMapFromNodeModules.js +++ b/src/getImportMapFromNodeModules.js @@ -29,7 +29,7 @@ export const getImportMapFromNodeModules = async ({ // pass ["import", "browser", "require"] to read browser first if defined packagesExportsPreference = ["import", "node", "require"], packagesExportsIncluded = true, - packagesSelfImport = true, + packagesSelfReference = true, packagesImportsIncluded = true, packagesManualOverrides = {}, }) => @@ -152,7 +152,7 @@ export const getImportMapFromNodeModules = async ({ }) } - if (packagesSelfImport) { + if (packagesSelfReference) { const { packageIsRoot, packageDirectoryRelativeUrl } = packageInfo // allow import 'package-name/dir/file.js' in package-name files @@ -191,7 +191,7 @@ export const getImportMapFromNodeModules = async ({ // packageDirectoryUrlExpected, } = packageInfo - if (packageIsRoot && packagesSelfImport) { + if (packageIsRoot && packagesSelfReference) { Object.keys(importsForPackageExports).forEach((from) => { const to = importsForPackageExports[from] addImportMapping({ @@ -258,7 +258,7 @@ export const getImportMapFromNodeModules = async ({ }, }) => { const self = packageIsRoot || packageIsProject - if (self && !packagesSelfImport) return + if (self && !packagesSelfReference) return const mainFileUrl = await resolvePackageMain({ packageFileUrl, diff --git a/test/getImportMapFromNodeModules/circular/circular.test.js b/test/getImportMapFromNodeModules/circular/circular.test.js index 31ac4a72..493690bb 100644 --- a/test/getImportMapFromNodeModules/circular/circular.test.js +++ b/test/getImportMapFromNodeModules/circular/circular.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/exports-and-main/exports-and-main.test.js b/test/getImportMapFromNodeModules/exports-and-main/exports-and-main.test.js index ecd133ec..9b6c6124 100644 --- a/test/getImportMapFromNodeModules/exports-and-main/exports-and-main.test.js +++ b/test/getImportMapFromNodeModules/exports-and-main/exports-and-main.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/exports-complex/exports-complex.test.js b/test/getImportMapFromNodeModules/exports-complex/exports-complex.test.js index e82821f6..ac0bbde0 100644 --- a/test/getImportMapFromNodeModules/exports-complex/exports-complex.test.js +++ b/test/getImportMapFromNodeModules/exports-complex/exports-complex.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/exports-directory-scoped/exports-directory-scoped.test.js b/test/getImportMapFromNodeModules/exports-directory-scoped/exports-directory-scoped.test.js index 255d105c..66995a15 100644 --- a/test/getImportMapFromNodeModules/exports-directory-scoped/exports-directory-scoped.test.js +++ b/test/getImportMapFromNodeModules/exports-directory-scoped/exports-directory-scoped.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/exports-directory/exports-directory.test.js b/test/getImportMapFromNodeModules/exports-directory/exports-directory.test.js index 436d54b3..695783ef 100644 --- a/test/getImportMapFromNodeModules/exports-directory/exports-directory.test.js +++ b/test/getImportMapFromNodeModules/exports-directory/exports-directory.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/exports-file-conditional/exports-file-conditional.test.js b/test/getImportMapFromNodeModules/exports-file-conditional/exports-file-conditional.test.js index ca283a74..a39cb1fc 100644 --- a/test/getImportMapFromNodeModules/exports-file-conditional/exports-file-conditional.test.js +++ b/test/getImportMapFromNodeModules/exports-file-conditional/exports-file-conditional.test.js @@ -8,7 +8,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, packagesExportsPreference: ["browser"], - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { @@ -25,7 +25,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, packagesExportsPreference: [], - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-file-deep-2/exports-file-deep-2.test.js b/test/getImportMapFromNodeModules/exports-file-deep-2/exports-file-deep-2.test.js index 475c6f4f..d517da11 100644 --- a/test/getImportMapFromNodeModules/exports-file-deep-2/exports-file-deep-2.test.js +++ b/test/getImportMapFromNodeModules/exports-file-deep-2/exports-file-deep-2.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-file-deep/exports-file-deep.test.js b/test/getImportMapFromNodeModules/exports-file-deep/exports-file-deep.test.js index caee399b..2bb05efb 100644 --- a/test/getImportMapFromNodeModules/exports-file-deep/exports-file-deep.test.js +++ b/test/getImportMapFromNodeModules/exports-file-deep/exports-file-deep.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-file/exports-file.test.js b/test/getImportMapFromNodeModules/exports-file/exports-file.test.js index 079c2a26..1f4f654b 100644 --- a/test/getImportMapFromNodeModules/exports-file/exports-file.test.js +++ b/test/getImportMapFromNodeModules/exports-file/exports-file.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-string/exports-string.test.js b/test/getImportMapFromNodeModules/exports-string/exports-string.test.js index 798c5959..896ba04d 100644 --- a/test/getImportMapFromNodeModules/exports-string/exports-string.test.js +++ b/test/getImportMapFromNodeModules/exports-string/exports-string.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-sugar-conditional/exports-sugar-conditional.test.js b/test/getImportMapFromNodeModules/exports-sugar-conditional/exports-sugar-conditional.test.js index 1eacb159..3fd71174 100644 --- a/test/getImportMapFromNodeModules/exports-sugar-conditional/exports-sugar-conditional.test.js +++ b/test/getImportMapFromNodeModules/exports-sugar-conditional/exports-sugar-conditional.test.js @@ -8,7 +8,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, packagesExportsPreference: ["browser"], - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { @@ -23,7 +23,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) { const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/exports-sugar/exports-sugar.test.js b/test/getImportMapFromNodeModules/exports-sugar/exports-sugar.test.js index 798c5959..896ba04d 100644 --- a/test/getImportMapFromNodeModules/exports-sugar/exports-sugar.test.js +++ b/test/getImportMapFromNodeModules/exports-sugar/exports-sugar.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/imports-leading-slash/imports-leading-slash.test.js b/test/getImportMapFromNodeModules/imports-leading-slash/imports-leading-slash.test.js index 728b2e7f..0b6c2588 100644 --- a/test/getImportMapFromNodeModules/imports-leading-slash/imports-leading-slash.test.js +++ b/test/getImportMapFromNodeModules/imports-leading-slash/imports-leading-slash.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/inside/inside.test.js b/test/getImportMapFromNodeModules/inside/inside.test.js index 3b1fd947..7f22a071 100644 --- a/test/getImportMapFromNodeModules/inside/inside.test.js +++ b/test/getImportMapFromNodeModules/inside/inside.test.js @@ -7,7 +7,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const importMap = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const actual = importMap const expected = { diff --git a/test/getImportMapFromNodeModules/main-directory-trailing/main-directory-trailing.test.js b/test/getImportMapFromNodeModules/main-directory-trailing/main-directory-trailing.test.js index 425444b4..41cdc4f1 100644 --- a/test/getImportMapFromNodeModules/main-directory-trailing/main-directory-trailing.test.js +++ b/test/getImportMapFromNodeModules/main-directory-trailing/main-directory-trailing.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/main-directory/main-directory.test.js b/test/getImportMapFromNodeModules/main-directory/main-directory.test.js index 77d12c89..0fc509b8 100644 --- a/test/getImportMapFromNodeModules/main-directory/main-directory.test.js +++ b/test/getImportMapFromNodeModules/main-directory/main-directory.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/main-jsnext/main-jsnext.test.js b/test/getImportMapFromNodeModules/main-jsnext/main-jsnext.test.js index ebb592c6..97aeaf2d 100644 --- a/test/getImportMapFromNodeModules/main-jsnext/main-jsnext.test.js +++ b/test/getImportMapFromNodeModules/main-jsnext/main-jsnext.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/main-relative/main-relative.test.js b/test/getImportMapFromNodeModules/main-relative/main-relative.test.js index 1ef3a0db..38b5fd6e 100644 --- a/test/getImportMapFromNodeModules/main-relative/main-relative.test.js +++ b/test/getImportMapFromNodeModules/main-relative/main-relative.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/main-undefined/main-undefined.test.js b/test/getImportMapFromNodeModules/main-undefined/main-undefined.test.js index 50e1d94f..58637d26 100644 --- a/test/getImportMapFromNodeModules/main-undefined/main-undefined.test.js +++ b/test/getImportMapFromNodeModules/main-undefined/main-undefined.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/main-without-extension/main-without-extension.test.js b/test/getImportMapFromNodeModules/main-without-extension/main-without-extension.test.js index dafef7f3..dce80a26 100644 --- a/test/getImportMapFromNodeModules/main-without-extension/main-without-extension.test.js +++ b/test/getImportMapFromNodeModules/main-without-extension/main-without-extension.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/malformed-dependency-package/malformed-dependency-package.test.js b/test/getImportMapFromNodeModules/malformed-dependency-package/malformed-dependency-package.test.js index fc1953e6..234862cc 100644 --- a/test/getImportMapFromNodeModules/malformed-dependency-package/malformed-dependency-package.test.js +++ b/test/getImportMapFromNodeModules/malformed-dependency-package/malformed-dependency-package.test.js @@ -7,7 +7,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ logLevel: "off", projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: {}, diff --git a/test/getImportMapFromNodeModules/manual-override/manual-override.test.js b/test/getImportMapFromNodeModules/manual-override/manual-override.test.js index 120a8283..192bd4e3 100644 --- a/test/getImportMapFromNodeModules/manual-override/manual-override.test.js +++ b/test/getImportMapFromNodeModules/manual-override/manual-override.test.js @@ -14,7 +14,7 @@ const actual = await getImportMapFromNodeModules({ }, }, }, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/missing-dependency-package/missing-dependency-package.test.js b/test/getImportMapFromNodeModules/missing-dependency-package/missing-dependency-package.test.js index 5a264677..14efa122 100644 --- a/test/getImportMapFromNodeModules/missing-dependency-package/missing-dependency-package.test.js +++ b/test/getImportMapFromNodeModules/missing-dependency-package/missing-dependency-package.test.js @@ -7,7 +7,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ logLevel: "error", projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: {}, diff --git a/test/getImportMapFromNodeModules/missing-root-package/missing-root-package.test.js b/test/getImportMapFromNodeModules/missing-root-package/missing-root-package.test.js index c36467b0..f83685dc 100644 --- a/test/getImportMapFromNodeModules/missing-root-package/missing-root-package.test.js +++ b/test/getImportMapFromNodeModules/missing-root-package/missing-root-package.test.js @@ -8,7 +8,7 @@ const packageFileUrl = resolveUrl("./package.json", testDirectoryUrl) try { await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) throw new Error("should throw") } catch (error) { diff --git a/test/getImportMapFromNodeModules/optional-dependency/optional-dependency.test.js b/test/getImportMapFromNodeModules/optional-dependency/optional-dependency.test.js index 5c0f09cd..a5cfc826 100644 --- a/test/getImportMapFromNodeModules/optional-dependency/optional-dependency.test.js +++ b/test/getImportMapFromNodeModules/optional-dependency/optional-dependency.test.js @@ -6,7 +6,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: {}, diff --git a/test/getImportMapFromNodeModules/scoped-inside-scoped/scoped-inside-scoped.test.js b/test/getImportMapFromNodeModules/scoped-inside-scoped/scoped-inside-scoped.test.js index c1d54edc..cb59d09b 100644 --- a/test/getImportMapFromNodeModules/scoped-inside-scoped/scoped-inside-scoped.test.js +++ b/test/getImportMapFromNodeModules/scoped-inside-scoped/scoped-inside-scoped.test.js @@ -7,7 +7,7 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, projectPackageDevDependenciesIncluded: true, - packagesSelfImport: false, + packagesSelfReference: false, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/self-import-2/self-import-2.test.js b/test/getImportMapFromNodeModules/self-import-2/self-import-2.test.js index 1cb6a9d1..b9bb553d 100644 --- a/test/getImportMapFromNodeModules/self-import-2/self-import-2.test.js +++ b/test/getImportMapFromNodeModules/self-import-2/self-import-2.test.js @@ -6,7 +6,6 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: true, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/self-import-3/self-import-3.test.js b/test/getImportMapFromNodeModules/self-import-3/self-import-3.test.js index 7c994458..e910695c 100644 --- a/test/getImportMapFromNodeModules/self-import-3/self-import-3.test.js +++ b/test/getImportMapFromNodeModules/self-import-3/self-import-3.test.js @@ -6,7 +6,6 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: true, }) const expected = { imports: { diff --git a/test/getImportMapFromNodeModules/self-import/self-import.test.js b/test/getImportMapFromNodeModules/self-import/self-import.test.js index 4bbf6b8f..bbb35ed6 100644 --- a/test/getImportMapFromNodeModules/self-import/self-import.test.js +++ b/test/getImportMapFromNodeModules/self-import/self-import.test.js @@ -6,7 +6,6 @@ const testDirectoryUrl = resolveUrl("./", import.meta.url) const actual = await getImportMapFromNodeModules({ projectDirectoryUrl: testDirectoryUrl, - packagesSelfImport: true, }) const expected = { imports: {