|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <loic@coderpad.io> |
| 3 | +Date: Tue, 25 Nov 2025 14:07:33 +0100 |
| 4 | +Subject: [PATCH] fix: preserve modules |
| 5 | + |
| 6 | +--- |
| 7 | + build/esm/rollup-types.config.mjs | 5 ++--- |
| 8 | + build/releaseMetadata.ts | 9 --------- |
| 9 | + build/shared.mjs | 3 +++ |
| 10 | + 3 files changed, 5 insertions(+), 12 deletions(-) |
| 11 | + |
| 12 | +diff --git a/build/esm/rollup-types.config.mjs b/build/esm/rollup-types.config.mjs |
| 13 | +index 5043188b..c20573b2 100644 |
| 14 | +--- a/build/esm/rollup-types.config.mjs |
| 15 | ++++ b/build/esm/rollup-types.config.mjs |
| 16 | +@@ -15,13 +15,12 @@ const root = join(import.meta.dirname, '../../'); |
| 17 | + |
| 18 | + export default defineConfig({ |
| 19 | + input: { |
| 20 | +- entry: join(root, './src/editor/editor.main.ts'), |
| 21 | +- editorApi: join(root, './src/editor/editor.api.ts'), |
| 22 | ++ entry: join(root, './src/editor/editor.main.ts') |
| 23 | + }, |
| 24 | + output: { |
| 25 | + dir: join(root, './out/monaco-editor/esm'), |
| 26 | + format: 'es', |
| 27 | +- preserveModules: false, |
| 28 | ++ preserveModules: true, |
| 29 | + entryFileNames: function (chunkInfo) { |
| 30 | + const moduleId = chunkInfo.facadeModuleId; |
| 31 | + if (moduleId) { |
| 32 | +diff --git a/build/releaseMetadata.ts b/build/releaseMetadata.ts |
| 33 | +index d25ceb76..542aa232 100644 |
| 34 | +--- a/build/releaseMetadata.ts |
| 35 | ++++ b/build/releaseMetadata.ts |
| 36 | +@@ -185,15 +185,6 @@ exports.languages = ${JSON.stringify(languages, null, ' ')}; |
| 37 | + const jsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm/metadata.js'); |
| 38 | + ensureDir(path.dirname(jsDestination)); |
| 39 | + fs.writeFileSync(jsDestination, jsContents.replace(/\r\n/g, '\n')); |
| 40 | +- |
| 41 | +- for (const feature of [...features, ...languages]) { |
| 42 | +- const entries = [].concat(feature.entry); |
| 43 | +- for (const entry of entries) { |
| 44 | +- const dtsDestination = path.join(REPO_ROOT, 'out/monaco-editor/esm', entry) + '.d.ts'; |
| 45 | +- ensureDir(path.dirname(dtsDestination)); |
| 46 | +- fs.writeFileSync(dtsDestination, 'export {}\n'); |
| 47 | +- } |
| 48 | +- } |
| 49 | + } |
| 50 | + ); |
| 51 | + } |
| 52 | +diff --git a/build/shared.mjs b/build/shared.mjs |
| 53 | +index dc471455..24c43647 100644 |
| 54 | +--- a/build/shared.mjs |
| 55 | ++++ b/build/shared.mjs |
| 56 | +@@ -14,6 +14,9 @@ import { readdirSync } from 'fs'; |
| 57 | + * @param {string} newExt |
| 58 | + */ |
| 59 | + export function changeExt(filePath, newExt) { |
| 60 | ++ if (filePath.endsWith(newExt)) { |
| 61 | ++ return filePath |
| 62 | ++ } |
| 63 | + const idx = filePath.lastIndexOf('.'); |
| 64 | + if (idx === -1) { |
| 65 | + return filePath + newExt; |
0 commit comments