From 4e3a1acf17307042e58ef5c6cdab6a2c0bb48a60 Mon Sep 17 00:00:00 2001 From: Jaya Krishna Date: Wed, 10 Jul 2024 21:43:54 +0530 Subject: [PATCH] fix tests for patched version of @jspm/generator --- docs.md | 8 ++++---- package-lock.json | 2 +- package.json | 2 +- src/link.ts | 2 +- test/ownname.test.ts | 4 ++-- test/providers.test.ts | 6 ++++-- test/scenarios.ts | 9 ++++----- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/docs.md b/docs.md index 0fbc2cef5..764b1c789 100644 --- a/docs.md +++ b/docs.md @@ -45,7 +45,7 @@ If no modules are given, all "imports" in the initial map are relinked. * `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online) * `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) -* `--integrity` Add module preloads with integrity attributes to HTML output (default: false) +* `--integrity` Add module integrity attributes to the import map (default: false) * `--compact` Output a compact import map (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) @@ -87,7 +87,7 @@ If no packages are provided, all "imports" in the initial map are reinstalled. * `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online) * `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) -* `--integrity` Add module preloads with integrity attributes to HTML output (default: false) +* `--integrity` Add module integrity attributes to the import map (default: false) * `--compact` Output a compact import map (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) @@ -137,7 +137,7 @@ Uninstalls packages from an import map. The given packages must be valid package * `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online) * `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) -* `--integrity` Add module preloads with integrity attributes to HTML output (default: false) +* `--integrity` Add module integrity attributes to the import map (default: false) * `--compact` Output a compact import map (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) @@ -169,7 +169,7 @@ Updates packages in an import map to the latest versions that are compatible wit * `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online) * `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against * `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic) -* `--integrity` Add module preloads with integrity attributes to HTML output (default: false) +* `--integrity` Add module integrity attributes to the import map (default: false) * `--compact` Output a compact import map (default: false) * `--stdout` Output the import map to stdout (default: false) * `--silent` Silence all output (default: false) diff --git a/package-lock.json b/package-lock.json index fa82319f4..4ac3c0edb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^0.34.2", - "@babel/core": "^7.21.4", + "@babel/core": "^7.24.7", "@types/node": "^18.15.11", "esbuild": "^0.16.17", "eslint": "^8.38.0", diff --git a/package.json b/package.json index 1d5dba832..10b6d650c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^0.34.2", - "@babel/core": "^7.21.4", + "@babel/core": "^7.24.7", "@types/node": "^18.15.11", "esbuild": "^0.16.17", "eslint": "^8.38.0", diff --git a/src/link.ts b/src/link.ts index 61bdef708..d3dcba712 100644 --- a/src/link.ts +++ b/src/link.ts @@ -127,7 +127,7 @@ async function handleLocalFile( generator: Generator ) { const source = await fs.readFile(resolvedModule.target, { encoding: "utf8" }); - const { default: babel } = await import("@babel/core"); + const babel = await import("@babel/core"); try { babel.parse(source); diff --git a/test/ownname.test.ts b/test/ownname.test.ts index 9a7230523..de0cd14ef 100644 --- a/test/ownname.test.ts +++ b/test/ownname.test.ts @@ -9,11 +9,11 @@ const scenarios: Scenario[] = [ commands: ["jspm install app"], validationFn: async (files: Map) => { // Installing the own-name package "app" should result in the version of - // es-module-lexer in the import map being upgraded to 1.4.1, since it's a + // es-module-lexer in the import map being upgraded to 1.5.4, since it's a // transitive dependency of "./app.js". const map = JSON.parse(files.get("importmap.json")); assert( - map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.4.1") + map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.5.4") ); }, }, diff --git a/test/providers.test.ts b/test/providers.test.ts index 824687d2d..cdbc8dbef 100644 --- a/test/providers.test.ts +++ b/test/providers.test.ts @@ -45,8 +45,10 @@ for (const provider of availableProviders) { let spec = "lit"; let name = "lit"; if (provider.includes("deno")) { - spec = "denoland:oak/body.ts"; // deno doesn't support npm packages - name = "oak/body.ts"; + // spec = "denoland:oak/body.ts"; // deno doesn't support npm packages + // name = "oak/body.ts"; + spec = "denoland:zod"; + name = "zod"; } if (provider === "node") { spec = "@jspm/core/nodelibs/fs"; // node provider is only for polyfills diff --git a/test/scenarios.ts b/test/scenarios.ts index 0f8a5e06a..03b777a1c 100644 --- a/test/scenarios.ts +++ b/test/scenarios.ts @@ -61,7 +61,7 @@ export async function mapDirectory(dir: string): Promise { } else { const subFiles = await mapDirectory(filePath); for (const [subFile, subData] of subFiles) { - files.set(path.join(file, subFile).replace(/\\/g, '/'), subData); + files.set(path.join(file, subFile).replace(/\\/g, "/"), subData); } } } @@ -103,10 +103,9 @@ async function deleteTmpPkg(dir: string) { try { await fs.rm(dir, { recursive: true }); return; - } - catch (err) { - if (err.code === 'EBUSY') - await new Promise(resolve => setTimeout(resolve, 10)); + } catch (err) { + if (err.code === "EBUSY") + await new Promise((resolve) => setTimeout(resolve, 10)); } } } else {