diff --git a/docs.md b/docs.md index c13212a1..0fbc2cef 100644 --- a/docs.md +++ b/docs.md @@ -47,7 +47,6 @@ If no modules are given, all "imports" in the initial map are relinked. * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) * `--integrity` Add module preloads with integrity attributes to HTML output (default: false) * `--compact` Output a compact import map (default: false) -* `--freeze` Freeze input map dependencies, i.e. do not modify them (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) * `-h, --help` Display this message @@ -90,7 +89,6 @@ If no packages are provided, all "imports" in the initial map are reinstalled. * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) * `--integrity` Add module preloads with integrity attributes to HTML output (default: false) * `--compact` Output a compact import map (default: false) -* `--freeze` Freeze input map dependencies, i.e. do not modify them (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) * `-h, --help` Display this message @@ -141,7 +139,6 @@ Uninstalls packages from an import map. The given packages must be valid package * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) * `--integrity` Add module preloads with integrity attributes to HTML output (default: false) * `--compact` Output a compact import map (default: false) -* `--freeze` Freeze input map dependencies, i.e. do not modify them (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) * `-h, --help` Display this message @@ -174,7 +171,6 @@ Updates packages in an import map to the latest versions that are compatible wit * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) * `--integrity` Add module preloads with integrity attributes to HTML output (default: false) * `--compact` Output a compact import map (default: false) -* `--freeze` Freeze input map dependencies, i.e. do not modify them (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) * `-h, --help` Display this message diff --git a/src/build/rollup-importmap-plugin.ts b/src/build/rollup-importmap-plugin.ts index 603a165d..e3eb055c 100644 --- a/src/build/rollup-importmap-plugin.ts +++ b/src/build/rollup-importmap-plugin.ts @@ -16,10 +16,11 @@ const isValidUrl = (url: string) => { export const RollupImportmapPlugin = async (flags: Flags): Promise => { /* - Install without a freeze might bump the versions. - We would like to maintian 1:1 on what users defined in importmap. + We need to load the importmap from local into the generator. + And then run a re-install. So, the generator uses the importmap + to resolve any dependencies. */ - const generator = await getGenerator({ ...flags, freeze: true }); + const generator = await getGenerator({ ...flags }); await generator.reinstall(); return { diff --git a/src/cli.ts b/src/cli.ts index 33045cb7..09a8c69e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -85,11 +85,6 @@ const rootOpt: opt = [ "URL to treat as server root, i.e. rebase import maps against", {}, ]; -const freezeOpt: opt = [ - "--freeze", - "Freeze input map dependencies, i.e. do not modify them", - { default: false }, -]; const silentOpt: opt = ["--silent", "Silence all output", { default: false }]; const buildConfigOpt: opt = [ "--config ", @@ -134,7 +129,6 @@ cli .option(...preloadOpt) .option(...integrityOpt) .option(...compactOpt) - .option(...freezeOpt) .option(...stdoutOpt) .example( (name) => `Link a remote package in importmap.json @@ -181,7 +175,6 @@ cli .option(...preloadOpt) .option(...integrityOpt) .option(...compactOpt) - .option(...freezeOpt) .option(...stdoutOpt) .example( (name) => `Install a package @@ -236,7 +229,6 @@ cli .option(...preloadOpt) .option(...integrityOpt) .option(...compactOpt) - .option(...freezeOpt) .option(...stdoutOpt) .example( (name) => ` @@ -265,7 +257,6 @@ cli .option(...preloadOpt) .option(...integrityOpt) .option(...compactOpt) - .option(...freezeOpt) .option(...stdoutOpt) .example( (name) => ` diff --git a/src/types.ts b/src/types.ts index 69ce6198..7ae156c5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -11,7 +11,6 @@ export interface Flags extends BuildFlags { preload?: boolean | string; integrity?: boolean; compact?: boolean; - freeze?: boolean; silent?: boolean; cache?: string; } diff --git a/src/utils.ts b/src/utils.ts index d7d97bcf..a9a3c3d4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -205,7 +205,6 @@ export async function getGenerator( defaultProvider: getProvider(flags), resolutions: getResolutions(flags), cache: getCacheMode(flags), - freeze: flags.freeze, commonJS: true, // TODO: only for --local flag }); } diff --git a/test/freeze.test.ts b/test/freeze.test.ts deleted file mode 100644 index c89903f5..00000000 --- a/test/freeze.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import assert from "assert"; -import { type Scenario, runScenarios } from "./scenarios"; - -const importMap = new Map([ - [ - "importmap.json", - JSON.stringify({ - imports: { - fs: "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.20/nodelibs/node/fs.js", - }, - }), - ], -]); - -const scenarios: Scenario[] = [ - // Installing without freeze should bump the version of core: - { - files: importMap, - commands: ["jspm install node:process"], - validationFn: async (files: Map) => { - const map = JSON.parse(files.get("importmap.json")); - assert(!map.imports.fs.includes("2.0.0-beta.20")); - assert(!map.imports.process.includes("2.0.0-beta.20")); - }, - }, - - // Installing with freeze should keep it fixed: - { - files: importMap, - commands: ["jspm install node:process --freeze"], - validationFn: async (files: Map) => { - const map = JSON.parse(files.get("importmap.json")); - assert(map.imports.fs.includes("2.0.0-beta.20")); - assert(map.imports.process.includes("2.0.0-beta.20")); - }, - }, -]; - -runScenarios(scenarios);