fix-reh-bootstrap.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. diff --git a/src/bootstrap-esm.ts b/src/bootstrap-esm.ts
  2. index c4a55e6..7285051 100644
  3. --- a/src/bootstrap-esm.ts
  4. +++ b/src/bootstrap-esm.ts
  5. @@ -6,3 +6,3 @@
  6. import * as fs from 'fs';
  7. -import { register } from 'node:module';
  8. +import * as Module from 'node:module';
  9. import { product, pkg } from './bootstrap-meta.js';
  10. @@ -13,3 +13,3 @@ import { INLSConfiguration } from './vs/nls.js';
  11. // Install a hook to module resolution to map 'fs' to 'original-fs'
  12. -if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
  13. +if (Module.register && (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron'])) {
  14. const jsCode = `
  15. @@ -28,3 +28,4 @@ if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
  16. }`;
  17. - register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);
  18. + // @ts-ignore
  19. + Module.register(`data:text/javascript;base64,${Buffer.from(jsCode).toString('base64')}`, import.meta.url);
  20. }
  21. diff --git a/src/bootstrap-esm.ts.rej b/src/bootstrap-esm.ts.rej
  22. new file mode 100644
  23. index 0000000..df9a975
  24. --- /dev/null
  25. +++ b/src/bootstrap-esm.ts.rej
  26. @@ -0,0 +1,16 @@
  27. +diff a/src/bootstrap-esm.ts b/src/bootstrap-esm.ts (rejected hunks)
  28. +@@ -6,3 +6,3 @@
  29. + import * as fs from 'fs';
  30. +-import { createRequire, register } from 'node:module';
  31. ++import * as Module from 'node:module';
  32. + import { product, pkg } from './bootstrap-meta.js';
  33. +@@ -12,6 +12,7 @@ import { INLSConfiguration } from './vs/nls.js';
  34. +
  35. +-const require = createRequire(import.meta.url);
  36. ++const require = Module.createRequire(import.meta.url);
  37. +
  38. + // Install a hook to module resolution to map 'fs' to 'original-fs'
  39. +-if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
  40. ++// @ts-ignore
  41. ++if (Module.register && (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron'])) {
  42. + const jsCode = `