sourcemaps.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts
  2. index 24462a3..1daa855 100644
  3. --- a/build/lib/extensions.ts
  4. +++ b/build/lib/extensions.ts
  5. @@ -33,4 +33,5 @@ const require = createRequire(import.meta.url);
  6. const root = path.dirname(path.dirname(import.meta.dirname));
  7. +const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
  8. const commit = getVersion(root);
  9. -const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
  10. +const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
  11. @@ -181,3 +182,3 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string,
  12. data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
  13. - return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
  14. + return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions-${path.basename(extensionPath).replaceAll('/', '-')}-${relativeOutputPath.replaceAll('/', '-')}-${g1.replaceAll('/', '-')}`;
  15. }), 'utf8');
  16. diff --git a/build/lib/optimize.ts b/build/lib/optimize.ts
  17. index 58b8e07..f452614 100644
  18. --- a/build/lib/optimize.ts
  19. +++ b/build/lib/optimize.ts
  20. @@ -229,3 +229,3 @@ export function bundleTask(opts: IBundleTaskOpts): () => NodeJS.ReadWriteStream
  21. export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => void {
  22. - const sourceMappingURL = sourceMapBaseUrl ? ((f: any) => `${sourceMapBaseUrl}/${f.relative}.map`) : undefined;
  23. + const sourceMappingURL = sourceMapBaseUrl ? ((f: any) => `${sourceMapBaseUrl}-${f.relative.replaceAll('/', '-')}.map`) : undefined;
  24. const target = getBuildTarget();
  25. diff --git a/build/lib/util.ts b/build/lib/util.ts
  26. index f1354b8..dda8c37 100644
  27. --- a/build/lib/util.ts
  28. +++ b/build/lib/util.ts
  29. @@ -285,4 +285,4 @@ export function rewriteSourceMappingURL(sourceMappingURLBase: string): NodeJS.Re
  30. const contents = (f.contents as Buffer).toString('utf8');
  31. - const str = `//# sourceMappingURL=${sourceMappingURLBase}/${path.dirname(f.relative).replace(/\\/g, '/')}/$1`;
  32. - f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, str));
  33. + const fp = path.dirname(f.relative).replace(/\\/g, '/').replaceAll('/', '-');
  34. + f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, (_m, p) => `//# sourceMappingURL=${sourceMappingURLBase}/${fp}-${p.replaceAll('/', '-')}`));
  35. return f;