Skip to content

Commit ec5cc4e

Browse files
authored
Merge pull request #114 from astitv-sh/feature/smus
Fix: dirs.js and gulpfile.extensions.js patching errors
2 parents b3f3325 + 8fc4a34 commit ec5cc4e

File tree

5 files changed

+4410
-869
lines changed

5 files changed

+4410
-869
lines changed

patched-vscode/build/gulpfile.extensions.js

Lines changed: 184 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -28,184 +28,184 @@ const ext = require('./lib/extensions');
2828
// ignore: ['**/out/**', '**/node_modules/**']
2929
// });
3030
const compilations = [
31-
'extensions/configuration-editing/tsconfig.json',
32-
'extensions/css-language-features/client/tsconfig.json',
33-
'extensions/css-language-features/server/tsconfig.json',
34-
'extensions/debug-auto-launch/tsconfig.json',
35-
'extensions/debug-server-ready/tsconfig.json',
36-
'extensions/emmet/tsconfig.json',
37-
'extensions/extension-editing/tsconfig.json',
38-
'extensions/git/tsconfig.json',
39-
'extensions/git-base/tsconfig.json',
40-
'extensions/github/tsconfig.json',
41-
'extensions/github-authentication/tsconfig.json',
42-
'extensions/grunt/tsconfig.json',
43-
'extensions/gulp/tsconfig.json',
44-
'extensions/html-language-features/client/tsconfig.json',
45-
'extensions/html-language-features/server/tsconfig.json',
46-
'extensions/ipynb/tsconfig.json',
47-
'extensions/jake/tsconfig.json',
48-
'extensions/json-language-features/client/tsconfig.json',
49-
'extensions/json-language-features/server/tsconfig.json',
50-
'extensions/markdown-language-features/preview-src/tsconfig.json',
51-
'extensions/markdown-language-features/server/tsconfig.json',
52-
'extensions/markdown-language-features/tsconfig.json',
53-
'extensions/markdown-math/tsconfig.json',
54-
'extensions/media-preview/tsconfig.json',
55-
'extensions/merge-conflict/tsconfig.json',
56-
'extensions/microsoft-authentication/tsconfig.json',
57-
'extensions/notebook-renderers/tsconfig.json',
58-
'extensions/npm/tsconfig.json',
59-
'extensions/php-language-features/tsconfig.json',
60-
'extensions/references-view/tsconfig.json',
61-
'extensions/search-result/tsconfig.json',
62-
'extensions/simple-browser/tsconfig.json',
63-
'extensions/sagemaker-extension/tsconfig.json',
64-
'extensions/sagemaker-idle-extension/tsconfig.json',
65-
'extensions/sagemaker-terminal-crash-mitigation/tsconfig.json',
66-
'extensions/sagemaker-open-notebook-extension/tsconfig.json',
67-
'extensions/sagemaker-ui-dark-theme/tsconfig.json',
31+
'extensions/configuration-editing/tsconfig.json',
32+
'extensions/css-language-features/client/tsconfig.json',
33+
'extensions/css-language-features/server/tsconfig.json',
34+
'extensions/debug-auto-launch/tsconfig.json',
35+
'extensions/debug-server-ready/tsconfig.json',
36+
'extensions/emmet/tsconfig.json',
37+
'extensions/extension-editing/tsconfig.json',
38+
'extensions/git/tsconfig.json',
39+
'extensions/git-base/tsconfig.json',
40+
'extensions/github/tsconfig.json',
41+
'extensions/github-authentication/tsconfig.json',
42+
'extensions/grunt/tsconfig.json',
43+
'extensions/gulp/tsconfig.json',
44+
'extensions/html-language-features/client/tsconfig.json',
45+
'extensions/html-language-features/server/tsconfig.json',
46+
'extensions/ipynb/tsconfig.json',
47+
'extensions/jake/tsconfig.json',
48+
'extensions/json-language-features/client/tsconfig.json',
49+
'extensions/json-language-features/server/tsconfig.json',
50+
'extensions/markdown-language-features/preview-src/tsconfig.json',
51+
'extensions/markdown-language-features/server/tsconfig.json',
52+
'extensions/markdown-language-features/tsconfig.json',
53+
'extensions/markdown-math/tsconfig.json',
54+
'extensions/media-preview/tsconfig.json',
55+
'extensions/merge-conflict/tsconfig.json',
56+
'extensions/microsoft-authentication/tsconfig.json',
57+
'extensions/notebook-renderers/tsconfig.json',
58+
'extensions/npm/tsconfig.json',
59+
'extensions/php-language-features/tsconfig.json',
60+
'extensions/references-view/tsconfig.json',
61+
'extensions/search-result/tsconfig.json',
62+
'extensions/simple-browser/tsconfig.json',
63+
'extensions/sagemaker-extension/tsconfig.json',
64+
'extensions/sagemaker-idle-extension/tsconfig.json',
65+
'extensions/sagemaker-terminal-crash-mitigation/tsconfig.json',
66+
'extensions/sagemaker-open-notebook-extension/tsconfig.json',
67+
'extensions/sagemaker-ui-dark-theme/tsconfig.json',
6868
'extensions/post-startup-notifications/tsconfig.json',
69-
'extensions/tunnel-forwarding/tsconfig.json',
70-
'extensions/typescript-language-features/test-workspace/tsconfig.json',
71-
'extensions/typescript-language-features/web/tsconfig.json',
72-
'extensions/typescript-language-features/tsconfig.json',
73-
'extensions/vscode-api-tests/tsconfig.json',
74-
'extensions/vscode-colorize-tests/tsconfig.json',
75-
'extensions/vscode-test-resolver/tsconfig.json',
76-
77-
'.vscode/extensions/vscode-selfhost-test-provider/tsconfig.json',
69+
'extensions/tunnel-forwarding/tsconfig.json',
70+
'extensions/typescript-language-features/test-workspace/tsconfig.json',
71+
'extensions/typescript-language-features/web/tsconfig.json',
72+
'extensions/typescript-language-features/tsconfig.json',
73+
'extensions/vscode-api-tests/tsconfig.json',
74+
'extensions/vscode-colorize-tests/tsconfig.json',
75+
'extensions/vscode-test-resolver/tsconfig.json',
76+
77+
'.vscode/extensions/vscode-selfhost-test-provider/tsconfig.json',
7878
];
7979

8080
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`;
8181

8282
const tasks = compilations.map(function (tsconfigFile) {
83-
const absolutePath = path.join(root, tsconfigFile);
84-
const relativeDirname = path.dirname(tsconfigFile.replace(/^(.*\/)?extensions\//i, ''));
85-
86-
const overrideOptions = {};
87-
overrideOptions.sourceMap = true;
88-
89-
const name = relativeDirname.replace(/\//g, '-');
90-
91-
const srcRoot = path.dirname(tsconfigFile);
92-
const srcBase = path.join(srcRoot, 'src');
93-
const src = path.join(srcBase, '**');
94-
const srcOpts = { cwd: root, base: srcBase, dot: true };
95-
96-
const out = path.join(srcRoot, 'out');
97-
const baseUrl = getBaseUrl(out);
98-
99-
let headerId, headerOut;
100-
const index = relativeDirname.indexOf('/');
101-
if (index < 0) {
102-
headerId = 'vscode.' + relativeDirname;
103-
headerOut = 'out';
104-
} else {
105-
headerId = 'vscode.' + relativeDirname.substr(0, index);
106-
headerOut = relativeDirname.substr(index + 1) + '/out';
107-
}
108-
109-
function createPipeline(build, emitError, transpileOnly) {
110-
const nlsDev = require('vscode-nls-dev');
111-
const tsb = require('./lib/tsb');
112-
const sourcemaps = require('gulp-sourcemaps');
113-
114-
const reporter = createReporter('extensions');
115-
116-
overrideOptions.inlineSources = Boolean(build);
117-
overrideOptions.base = path.dirname(absolutePath);
118-
119-
const compilation = tsb.create(absolutePath, overrideOptions, { verbose: false, transpileOnly, transpileOnlyIncludesDts: transpileOnly, transpileWithSwc: true }, err => reporter(err.toString()));
120-
121-
const pipeline = function () {
122-
const input = es.through();
123-
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true, dot: true });
124-
const output = input
125-
.pipe(plumber({
126-
errorHandler: function (err) {
127-
if (err && !err.__reporter__) {
128-
reporter(err);
129-
}
130-
}
131-
}))
132-
.pipe(tsFilter)
133-
.pipe(util.loadSourcemaps())
134-
.pipe(compilation())
135-
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
136-
.pipe(build ? util.stripSourceMappingURL() : es.through())
137-
.pipe(sourcemaps.write('.', {
138-
sourceMappingURL: !build ? null : f => `${baseUrl}/${f.relative}.map`,
139-
addComment: !!build,
140-
includeContent: !!build,
141-
// note: trailing slash is important, else the source URLs in V8's file coverage are incorrect
142-
sourceRoot: '../src/',
143-
}))
144-
.pipe(tsFilter.restore)
145-
.pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through())
146-
// Filter out *.nls.json file. We needed them only to bundle meta data file.
147-
.pipe(filter(['**', '!**/*.nls.json'], { dot: true }))
148-
.pipe(reporter.end(emitError));
149-
150-
return es.duplex(input, output);
151-
};
152-
153-
// add src-stream for project files
154-
pipeline.tsProjectSrc = () => {
155-
return compilation.src(srcOpts);
156-
};
157-
return pipeline;
158-
}
159-
160-
const cleanTask = task.define(`clean-extension-${name}`, util.rimraf(out));
161-
162-
const transpileTask = task.define(`transpile-extension:${name}`, task.series(cleanTask, () => {
163-
const pipeline = createPipeline(false, true, true);
164-
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
165-
const input = es.merge(nonts, pipeline.tsProjectSrc());
166-
167-
return input
168-
.pipe(pipeline())
169-
.pipe(gulp.dest(out));
170-
}));
171-
172-
const compileTask = task.define(`compile-extension:${name}`, task.series(cleanTask, () => {
173-
const pipeline = createPipeline(false, true);
174-
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
175-
const input = es.merge(nonts, pipeline.tsProjectSrc());
176-
177-
return input
178-
.pipe(pipeline())
179-
.pipe(gulp.dest(out));
180-
}));
181-
182-
const watchTask = task.define(`watch-extension:${name}`, task.series(cleanTask, () => {
183-
const pipeline = createPipeline(false);
184-
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
185-
const input = es.merge(nonts, pipeline.tsProjectSrc());
186-
const watchInput = watcher(src, { ...srcOpts, ...{ readDelay: 200 } });
187-
188-
return watchInput
189-
.pipe(util.incremental(pipeline, input))
190-
.pipe(gulp.dest(out));
191-
}));
192-
193-
const compileBuildTask = task.define(`compile-build-extension-${name}`, task.series(cleanTask, () => {
194-
const pipeline = createPipeline(true, true);
195-
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
196-
const input = es.merge(nonts, pipeline.tsProjectSrc());
197-
198-
return input
199-
.pipe(pipeline())
200-
.pipe(gulp.dest(out));
201-
}));
202-
203-
// Tasks
204-
gulp.task(transpileTask);
205-
gulp.task(compileTask);
206-
gulp.task(watchTask);
207-
208-
return { transpileTask, compileTask, watchTask, compileBuildTask };
83+
const absolutePath = path.join(root, tsconfigFile);
84+
const relativeDirname = path.dirname(tsconfigFile.replace(/^(.*\/)?extensions\//i, ''));
85+
86+
const overrideOptions = {};
87+
overrideOptions.sourceMap = true;
88+
89+
const name = relativeDirname.replace(/\//g, '-');
90+
91+
const srcRoot = path.dirname(tsconfigFile);
92+
const srcBase = path.join(srcRoot, 'src');
93+
const src = path.join(srcBase, '**');
94+
const srcOpts = { cwd: root, base: srcBase, dot: true };
95+
96+
const out = path.join(srcRoot, 'out');
97+
const baseUrl = getBaseUrl(out);
98+
99+
let headerId, headerOut;
100+
const index = relativeDirname.indexOf('/');
101+
if (index < 0) {
102+
headerId = 'vscode.' + relativeDirname;
103+
headerOut = 'out';
104+
} else {
105+
headerId = 'vscode.' + relativeDirname.substr(0, index);
106+
headerOut = relativeDirname.substr(index + 1) + '/out';
107+
}
108+
109+
function createPipeline(build, emitError, transpileOnly) {
110+
const nlsDev = require('vscode-nls-dev');
111+
const tsb = require('./lib/tsb');
112+
const sourcemaps = require('gulp-sourcemaps');
113+
114+
const reporter = createReporter('extensions');
115+
116+
overrideOptions.inlineSources = Boolean(build);
117+
overrideOptions.base = path.dirname(absolutePath);
118+
119+
const compilation = tsb.create(absolutePath, overrideOptions, { verbose: false, transpileOnly, transpileOnlyIncludesDts: transpileOnly, transpileWithSwc: true }, err => reporter(err.toString()));
120+
121+
const pipeline = function () {
122+
const input = es.through();
123+
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true, dot: true });
124+
const output = input
125+
.pipe(plumber({
126+
errorHandler: function (err) {
127+
if (err && !err.__reporter__) {
128+
reporter(err);
129+
}
130+
}
131+
}))
132+
.pipe(tsFilter)
133+
.pipe(util.loadSourcemaps())
134+
.pipe(compilation())
135+
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
136+
.pipe(build ? util.stripSourceMappingURL() : es.through())
137+
.pipe(sourcemaps.write('.', {
138+
sourceMappingURL: !build ? null : f => `${baseUrl}/${f.relative}.map`,
139+
addComment: !!build,
140+
includeContent: !!build,
141+
// note: trailing slash is important, else the source URLs in V8's file coverage are incorrect
142+
sourceRoot: '../src/',
143+
}))
144+
.pipe(tsFilter.restore)
145+
.pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through())
146+
// Filter out *.nls.json file. We needed them only to bundle meta data file.
147+
.pipe(filter(['**', '!**/*.nls.json'], { dot: true }))
148+
.pipe(reporter.end(emitError));
149+
150+
return es.duplex(input, output);
151+
};
152+
153+
// add src-stream for project files
154+
pipeline.tsProjectSrc = () => {
155+
return compilation.src(srcOpts);
156+
};
157+
return pipeline;
158+
}
159+
160+
const cleanTask = task.define(`clean-extension-${name}`, util.rimraf(out));
161+
162+
const transpileTask = task.define(`transpile-extension:${name}`, task.series(cleanTask, () => {
163+
const pipeline = createPipeline(false, true, true);
164+
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
165+
const input = es.merge(nonts, pipeline.tsProjectSrc());
166+
167+
return input
168+
.pipe(pipeline())
169+
.pipe(gulp.dest(out));
170+
}));
171+
172+
const compileTask = task.define(`compile-extension:${name}`, task.series(cleanTask, () => {
173+
const pipeline = createPipeline(false, true);
174+
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
175+
const input = es.merge(nonts, pipeline.tsProjectSrc());
176+
177+
return input
178+
.pipe(pipeline())
179+
.pipe(gulp.dest(out));
180+
}));
181+
182+
const watchTask = task.define(`watch-extension:${name}`, task.series(cleanTask, () => {
183+
const pipeline = createPipeline(false);
184+
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
185+
const input = es.merge(nonts, pipeline.tsProjectSrc());
186+
const watchInput = watcher(src, { ...srcOpts, ...{ readDelay: 200 } });
187+
188+
return watchInput
189+
.pipe(util.incremental(pipeline, input))
190+
.pipe(gulp.dest(out));
191+
}));
192+
193+
const compileBuildTask = task.define(`compile-build-extension-${name}`, task.series(cleanTask, () => {
194+
const pipeline = createPipeline(true, true);
195+
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
196+
const input = es.merge(nonts, pipeline.tsProjectSrc());
197+
198+
return input
199+
.pipe(pipeline())
200+
.pipe(gulp.dest(out));
201+
}));
202+
203+
// Tasks
204+
gulp.task(transpileTask);
205+
gulp.task(compileTask);
206+
gulp.task(watchTask);
207+
208+
return { transpileTask, compileTask, watchTask, compileBuildTask };
209209
});
210210

211211
const transpileExtensionsTask = task.define('transpile-extensions', task.parallel(...tasks.map(t => t.transpileTask)));
@@ -242,18 +242,18 @@ exports.compileExtensionMediaBuildTask = compileExtensionMediaBuildTask;
242242

243243
const cleanExtensionsBuildTask = task.define('clean-extensions-build', util.rimraf('.build/extensions'));
244244
const compileExtensionsBuildTask = task.define('compile-extensions-build', task.series(
245-
cleanExtensionsBuildTask,
246-
task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false).pipe(gulp.dest('.build'))),
247-
task.define('bundle-extensions-build', () => ext.packageLocalExtensionsStream(false, false).pipe(gulp.dest('.build'))),
245+
cleanExtensionsBuildTask,
246+
task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false).pipe(gulp.dest('.build'))),
247+
task.define('bundle-extensions-build', () => ext.packageLocalExtensionsStream(false, false).pipe(gulp.dest('.build'))),
248248
));
249249

250250
gulp.task(compileExtensionsBuildTask);
251251
gulp.task(task.define('extensions-ci', task.series(compileExtensionsBuildTask, compileExtensionMediaBuildTask)));
252252

253253
const compileExtensionsBuildPullRequestTask = task.define('compile-extensions-build-pr', task.series(
254-
cleanExtensionsBuildTask,
255-
task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false).pipe(gulp.dest('.build'))),
256-
task.define('bundle-extensions-build-pr', () => ext.packageLocalExtensionsStream(false, true).pipe(gulp.dest('.build'))),
254+
cleanExtensionsBuildTask,
255+
task.define('bundle-marketplace-extensions-build', () => ext.packageMarketplaceExtensionsStream(false).pipe(gulp.dest('.build'))),
256+
task.define('bundle-extensions-build-pr', () => ext.packageLocalExtensionsStream(false, true).pipe(gulp.dest('.build'))),
257257
));
258258

259259
gulp.task(compileExtensionsBuildPullRequestTask);
@@ -276,10 +276,10 @@ exports.watchWebExtensionsTask = watchWebExtensionsTask;
276276
* @param {boolean} isWatch
277277
*/
278278
async function buildWebExtensions(isWatch) {
279-
const extensionsPath = path.join(root, 'extensions');
280-
const webpackConfigLocations = await nodeUtil.promisify(glob)(
281-
path.join(extensionsPath, '**', 'extension-browser.webpack.config.js'),
282-
{ ignore: ['**/node_modules'] }
283-
);
284-
return ext.webpackExtensions('packaging web extension', isWatch, webpackConfigLocations.map(configPath => ({ configPath })));
279+
const extensionsPath = path.join(root, 'extensions');
280+
const webpackConfigLocations = await nodeUtil.promisify(glob)(
281+
path.join(extensionsPath, '**', 'extension-browser.webpack.config.js'),
282+
{ ignore: ['**/node_modules'] }
283+
);
284+
return ext.webpackExtensions('packaging web extension', isWatch, webpackConfigLocations.map(configPath => ({ configPath })));
285285
}

0 commit comments

Comments
 (0)