|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <loic@coderpad.io> |
| 3 | +Date: Mon, 29 Sep 2025 12:24:50 +0200 |
| 4 | +Subject: [PATCH] fix: stop rewriting source maps |
| 5 | + |
| 6 | +--- |
| 7 | + build/gulpfile.extensions.js | 5 +---- |
| 8 | + build/gulpfile.vscode.js | 1 - |
| 9 | + build/lib/extensions.js | 13 ------------- |
| 10 | + build/lib/extensions.ts | 14 -------------- |
| 11 | + 4 files changed, 1 insertion(+), 32 deletions(-) |
| 12 | + |
| 13 | +diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js |
| 14 | +index 687bd16fd8c..ca84bc9fc6f 100644 |
| 15 | +--- a/build/gulpfile.extensions.js |
| 16 | ++++ b/build/gulpfile.extensions.js |
| 17 | +@@ -71,8 +71,6 @@ const compilations = [ |
| 18 | + '.vscode/extensions/vscode-selfhost-import-aid/tsconfig.json', |
| 19 | + ]; |
| 20 | + |
| 21 | +-const getBaseUrl = out => `https://main.vscode-cdn.net/sourcemaps/${commit}/${out}`; |
| 22 | +- |
| 23 | + const tasks = compilations.map(function (tsconfigFile) { |
| 24 | + const absolutePath = path.join(root, tsconfigFile); |
| 25 | + const relativeDirname = path.dirname(tsconfigFile.replace(/^(.*\/)?extensions\//i, '')); |
| 26 | +@@ -88,7 +86,6 @@ const tasks = compilations.map(function (tsconfigFile) { |
| 27 | + const srcOpts = { cwd: root, base: srcBase, dot: true }; |
| 28 | + |
| 29 | + const out = path.join(srcRoot, 'out'); |
| 30 | +- const baseUrl = getBaseUrl(out); |
| 31 | + |
| 32 | + function createPipeline(build, emitError, transpileOnly) { |
| 33 | + const tsb = require('./lib/tsb'); |
| 34 | +@@ -117,7 +114,7 @@ const tasks = compilations.map(function (tsconfigFile) { |
| 35 | + .pipe(compilation()) |
| 36 | + .pipe(build ? util.stripSourceMappingURL() : es.through()) |
| 37 | + .pipe(sourcemaps.write('.', { |
| 38 | +- sourceMappingURL: !build ? null : f => `${baseUrl}/${f.relative}.map`, |
| 39 | ++ sourceMappingURL: null, |
| 40 | + addComment: !!build, |
| 41 | + includeContent: !!build, |
| 42 | + // note: trailing slash is important, else the source URLs in V8's file coverage are incorrect |
| 43 | +diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js |
| 44 | +index ed06b6a5aa8..72bab050f5e 100644 |
| 45 | +--- a/build/gulpfile.vscode.js |
| 46 | ++++ b/build/gulpfile.vscode.js |
| 47 | +@@ -293,7 +293,6 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op |
| 48 | + .pipe(util.cleanNodeModules(path.join(__dirname, '.moduleignore'))) |
| 49 | + .pipe(util.cleanNodeModules(path.join(__dirname, `.moduleignore.${process.platform}`))) |
| 50 | + .pipe(jsFilter) |
| 51 | +- .pipe(util.rewriteSourceMappingURL(sourceMappingURLBase)) |
| 52 | + .pipe(jsFilter.restore) |
| 53 | + .pipe(createAsar(path.join(process.cwd(), 'node_modules'), [ |
| 54 | + '**/*.node', |
| 55 | +diff --git a/build/lib/extensions.js b/build/lib/extensions.js |
| 56 | +index aeea722d372..d8e97d315da 100644 |
| 57 | +--- a/build/lib/extensions.js |
| 58 | ++++ b/build/lib/extensions.js |
| 59 | +@@ -69,12 +69,9 @@ const gulp_buffer_1 = __importDefault(require("gulp-buffer")); |
| 60 | + const jsoncParser = __importStar(require("jsonc-parser")); |
| 61 | + const dependencies_1 = require("./dependencies"); |
| 62 | + const builtInExtensions_1 = require("./builtInExtensions"); |
| 63 | +-const getVersion_1 = require("./getVersion"); |
| 64 | + const fetch_1 = require("./fetch"); |
| 65 | + const vzip = require('gulp-vinyl-zip'); |
| 66 | + const root = path_1.default.dirname(path_1.default.dirname(__dirname)); |
| 67 | +-const commit = (0, getVersion_1.getVersion)(root); |
| 68 | +-const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`; |
| 69 | + function minifyExtensionResources(input) { |
| 70 | + const jsonFilter = (0, gulp_filter_1.default)(['**/*.json', '**/*.code-snippets'], { restore: true }); |
| 71 | + return input |
| 72 | +@@ -189,7 +186,6 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) { |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | +- const relativeOutputPath = path_1.default.relative(extensionPath, webpackConfig.output.path); |
| 77 | + return webpackGulp(webpackConfig, webpack, webpackDone) |
| 78 | + .pipe(event_stream_1.default.through(function (data) { |
| 79 | + data.stat = data.stat || {}; |
| 80 | +@@ -197,15 +193,6 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) { |
| 81 | + this.emit('data', data); |
| 82 | + })) |
| 83 | + .pipe(event_stream_1.default.through(function (data) { |
| 84 | +- // source map handling: |
| 85 | +- // * rewrite sourceMappingURL |
| 86 | +- // * save to disk so that upload-task picks this up |
| 87 | +- if (path_1.default.extname(data.basename) === '.js') { |
| 88 | +- const contents = data.contents.toString('utf8'); |
| 89 | +- data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) { |
| 90 | +- return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path_1.default.basename(extensionPath)}/${relativeOutputPath}/${g1}`; |
| 91 | +- }), 'utf8'); |
| 92 | +- } |
| 93 | + this.emit('data', data); |
| 94 | + })); |
| 95 | + }); |
| 96 | +diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts |
| 97 | +index b997fe4046e..d76b6ffd0f3 100644 |
| 98 | +--- a/build/lib/extensions.ts |
| 99 | ++++ b/build/lib/extensions.ts |
| 100 | +@@ -23,13 +23,10 @@ import * as jsoncParser from 'jsonc-parser'; |
| 101 | + import webpack from 'webpack'; |
| 102 | + import { getProductionDependencies } from './dependencies'; |
| 103 | + import { IExtensionDefinition, getExtensionStream } from './builtInExtensions'; |
| 104 | +-import { getVersion } from './getVersion'; |
| 105 | + import { fetchUrls, fetchGithub } from './fetch'; |
| 106 | + const vzip = require('gulp-vinyl-zip'); |
| 107 | + |
| 108 | + const root = path.dirname(path.dirname(__dirname)); |
| 109 | +-const commit = getVersion(root); |
| 110 | +-const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`; |
| 111 | + |
| 112 | + function minifyExtensionResources(input: Stream): Stream { |
| 113 | + const jsonFilter = filter(['**/*.json', '**/*.code-snippets'], { restore: true }); |
| 114 | +@@ -162,7 +159,6 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string, |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | +- const relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path); |
| 119 | + |
| 120 | + return webpackGulp(webpackConfig, webpack, webpackDone) |
| 121 | + .pipe(es.through(function (data) { |
| 122 | +@@ -171,16 +167,6 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string, |
| 123 | + this.emit('data', data); |
| 124 | + })) |
| 125 | + .pipe(es.through(function (data: File) { |
| 126 | +- // source map handling: |
| 127 | +- // * rewrite sourceMappingURL |
| 128 | +- // * save to disk so that upload-task picks this up |
| 129 | +- if (path.extname(data.basename) === '.js') { |
| 130 | +- const contents = (<Buffer>data.contents).toString('utf8'); |
| 131 | +- data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) { |
| 132 | +- return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`; |
| 133 | +- }), 'utf8'); |
| 134 | +- } |
| 135 | +- |
| 136 | + this.emit('data', data); |
| 137 | + })); |
| 138 | + }); |
0 commit comments