From 8041c6d12aa8b50541da103d91e41a4d467289e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Tue, 11 Jul 2023 10:47:50 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=91=8C=20factorize=20worker=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/worker/scripts/build-worker-string.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/worker/scripts/build-worker-string.js b/packages/worker/scripts/build-worker-string.js index 3781bd45e8..7df10b35d4 100755 --- a/packages/worker/scripts/build-worker-string.js +++ b/packages/worker/scripts/build-worker-string.js @@ -7,8 +7,9 @@ const bundlePath = path.resolve(__dirname, '../bundle') const workerBundlePath = path.join(bundlePath, 'worker.js') const workerBundleContent = fs.readFileSync(workerBundlePath, { encoding: 'utf-8' }) -writeOutput('cjs', `exports.workerString = ${JSON.stringify(workerBundleContent)}\n`) -writeOutput('esm', `export const workerString = ${JSON.stringify(workerBundleContent)}\n`) +const workerString = `${JSON.stringify(workerBundleContent)}\n` +writeOutput('cjs', `exports.workerString = ${workerString}`) +writeOutput('esm', `export const workerString = ${workerString}`) function writeOutput(moduleType, content) { const outputPath = path.resolve(__dirname, path.join('..', 'string', moduleType)) From 5c2897bab1f25c66f24838b3f06f0d9ce34e0d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Tue, 11 Jul 2023 10:49:26 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=91=8C=20change=20output=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/worker/.npmignore | 2 ++ packages/worker/scripts/build-worker-string.js | 6 +++--- packages/worker/string/package.json | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/worker/.npmignore b/packages/worker/.npmignore index 2513632005..b33ab99fc9 100644 --- a/packages/worker/.npmignore +++ b/packages/worker/.npmignore @@ -1,6 +1,8 @@ * !/bundle/worker.js !/string/**/* +!/cjs/**/* +!/esm/**/* !/src/**/* /src/**/*.spec.ts /src/**/*.specHelper.ts diff --git a/packages/worker/scripts/build-worker-string.js b/packages/worker/scripts/build-worker-string.js index 7df10b35d4..5ed129c060 100755 --- a/packages/worker/scripts/build-worker-string.js +++ b/packages/worker/scripts/build-worker-string.js @@ -12,8 +12,8 @@ writeOutput('cjs', `exports.workerString = ${workerString}`) writeOutput('esm', `export const workerString = ${workerString}`) function writeOutput(moduleType, content) { - const outputPath = path.resolve(__dirname, path.join('..', 'string', moduleType)) + const outputPath = path.resolve(__dirname, path.join('..', moduleType, 'entries')) fs.mkdirSync(outputPath, { recursive: true }) - fs.writeFileSync(path.join(outputPath, 'main.js'), content) - fs.writeFileSync(path.join(outputPath, 'main.d.ts'), 'export declare const workerString: string\n') + fs.writeFileSync(path.join(outputPath, 'string.js'), content) + fs.writeFileSync(path.join(outputPath, 'string.d.ts'), 'export declare const workerString: string\n') } diff --git a/packages/worker/string/package.json b/packages/worker/string/package.json index 12a1e8f408..db127a797e 100644 --- a/packages/worker/string/package.json +++ b/packages/worker/string/package.json @@ -1,6 +1,6 @@ { "private": true, - "main": "cjs/main.js", - "module": "esm/main.js", - "types": "cjs/main.d.ts" + "main": "../cjs/entries/string.js", + "module": "../esm/entries/string.js", + "types": "../cjs/entries/string.d.ts" }