Files
vscodium/patches/sourcemaps.patch
2025-12-17 15:59:58 +01:00

37 lines
2.5 KiB
Diff

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