@codingame/monaco-vscode-api 1.78.7 → 1.78.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/monaco-treemending.js +15 -1
- package/monaco-editor-treemending.patch +531 -531
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs/promises';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
3
4
|
import { createRequire } from 'node:module';
|
|
4
5
|
|
|
5
6
|
function Diff() {}
|
|
@@ -850,8 +851,17 @@ async function run() {
|
|
|
850
851
|
console.info('Monaco-editor has already been tree-mended, ignoring');
|
|
851
852
|
process.exit(0);
|
|
852
853
|
}
|
|
854
|
+
// pnpm WA: copy files to a temp directory and patch files there. When finished copy back
|
|
855
|
+
let workingDir = monacoEsmDirectory;
|
|
856
|
+
let tmpDir;
|
|
857
|
+
const havePnpm = monacoEsmDirectory.includes('.pnpm');
|
|
858
|
+
if (havePnpm) {
|
|
859
|
+
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'esm-'));
|
|
860
|
+
workingDir = path.resolve(tmpDir, 'esm');
|
|
861
|
+
await fs.cp(monacoEsmDirectory, workingDir, { recursive: true });
|
|
862
|
+
}
|
|
853
863
|
function getMonacoFile(diff) {
|
|
854
|
-
return path.resolve(
|
|
864
|
+
return path.resolve(workingDir, diff.oldFileName.slice('a/'.length));
|
|
855
865
|
}
|
|
856
866
|
await new Promise((resolve, reject) => {
|
|
857
867
|
applyPatches(patchContent.toString('utf-8'), {
|
|
@@ -889,6 +899,10 @@ async function run() {
|
|
|
889
899
|
}
|
|
890
900
|
});
|
|
891
901
|
});
|
|
902
|
+
// in case of pnpm copy the temp esm back
|
|
903
|
+
if (havePnpm) {
|
|
904
|
+
await fs.cp(tmpDir, monacoDirectory, { recursive: true, force: true });
|
|
905
|
+
}
|
|
892
906
|
// Mark monaco as treemended
|
|
893
907
|
await fs.writeFile(monacoPackageJsonFile, JSON.stringify({
|
|
894
908
|
...monacoPackageJson,
|