From 9faad6c42a91dc5837111923cfa6d994525ec027 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 28 May 2023 23:10:01 -0700 Subject: [PATCH] update to @jspm/generator@1.1.9 (#2536) * update to @jspm/generator@1.1.9 * windows support for tests, new generator behaviour --- chompfile.toml | 1 + package-lock.json | 8 ++++---- package.json | 2 +- test/ownname.test.ts | 7 +++---- test/scenarios.ts | 15 ++++++++++++--- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/chompfile.toml b/chompfile.toml index 16c717f90..3de80439d 100644 --- a/chompfile.toml +++ b/chompfile.toml @@ -60,3 +60,4 @@ dep = 'test:' name = 'test:##' dep = 'test/##.test.ts' run = 'tsx $DEP' +serial = true diff --git a/package-lock.json b/package-lock.json index ec634bb5b..3b2f034d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.0.0", "license": "Apache-2.0", "dependencies": { - "@jspm/generator": "^1.1.7", + "@jspm/generator": "^1.1.9", "cac": "^6.7.14", "ora": "^6.3.0", "picocolors": "^1.0.0" @@ -1603,9 +1603,9 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, "node_modules/@jspm/generator": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@jspm/generator/-/generator-1.1.7.tgz", - "integrity": "sha512-m9dfJ5O7zjwOlnx1f6mDRCQH2T8VwZ9cdd3OnnFIYpCWTrTfcBXuVIfyNKf3UjLfFRGe5N2EICtRudXvfNYYxA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@jspm/generator/-/generator-1.1.9.tgz", + "integrity": "sha512-ZSr+yeceUv/+h8tMH68bvzMWwe4rzW+ihx94N0f7ifGLUvT2r7I/tS7l1hpB0kMtL+DIfgS7ENt5gpQIXgrdrQ==", "dependencies": { "@babel/core": "^7.20.12", "@babel/plugin-syntax-import-assertions": "^7.20.0", diff --git a/package.json b/package.json index c9cef2df3..a3deb5772 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "jspm.js" ], "dependencies": { - "@jspm/generator": "^1.1.7", + "@jspm/generator": "^1.1.9", "cac": "^6.7.14", "ora": "^6.3.0", "picocolors": "^1.0.0" diff --git a/test/ownname.test.ts b/test/ownname.test.ts index 881527703..cdbf9d313 100644 --- a/test/ownname.test.ts +++ b/test/ownname.test.ts @@ -9,12 +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 remaining the same, since it's a - // transitive dependency of "./app.js", even though it violates the lock: - // TODO: is this the behaviour we want? + // es-module-lexer in the import map being upgraded to 1.2.2, 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@0.10.5") + map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.2.1") ); }, }, diff --git a/test/scenarios.ts b/test/scenarios.ts index d2296e72c..0f8a5e06a 100644 --- a/test/scenarios.ts +++ b/test/scenarios.ts @@ -46,8 +46,8 @@ export async function runScenario(scenario: Scenario) { cause: err, }); } finally { - await deleteTmpPkg(dir); process.chdir(cwd); + await deleteTmpPkg(dir); } } @@ -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), subData); + files.set(path.join(file, subFile).replace(/\\/g, '/'), subData); } } } @@ -99,7 +99,16 @@ async function createTmpPkg(scenario: Scenario): Promise { async function deleteTmpPkg(dir: string) { if (dir.startsWith(os.tmpdir())) { // ensure it's a tmp dir - return fs.rm(dir, { recursive: true }); + while (true) { + try { + await fs.rm(dir, { recursive: true }); + return; + } + catch (err) { + if (err.code === 'EBUSY') + await new Promise(resolve => setTimeout(resolve, 10)); + } + } } else { throw new Error(`Cannot delete ${dir} as it is not a temporary directory.`); }