mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
This reverts commit 2179e52fb9
.
This commit is contained in:
parent
107f6cade5
commit
84c46b71a5
|
@ -9,15 +9,13 @@ const gulp = require('gulp');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const task = require('./lib/task');
|
const task = require('./lib/task');
|
||||||
const compilation = require('./lib/compilation');
|
const compilation = require('./lib/compilation');
|
||||||
const optimize = require('./lib/optimize');
|
|
||||||
|
|
||||||
// Full compile, including nls and inline sources in sourcemaps, for build
|
// Full compile, including nls and inline sources in sourcemaps, for build
|
||||||
const compileBuildTask = task.define('compile-build',
|
const compileBuildTask = task.define('compile-build',
|
||||||
task.series(
|
task.series(
|
||||||
util.rimraf('out-build'),
|
util.rimraf('out-build'),
|
||||||
util.buildWebNodePaths('out-build'),
|
util.buildWebNodePaths('out-build'),
|
||||||
compilation.compileTask('src', 'out-build', true),
|
compilation.compileTask('src', 'out-build', true)
|
||||||
optimize.optimizeLoaderTask('out-build', 'out-build', true)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
gulp.task(compileBuildTask);
|
gulp.task(compileBuildTask);
|
||||||
|
|
|
@ -7,7 +7,7 @@ const gulp = require('gulp');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const task = require('./lib/task');
|
const task = require('./lib/task');
|
||||||
const optimize = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
const es = require('event-stream');
|
const es = require('event-stream');
|
||||||
const File = require('vinyl');
|
const File = require('vinyl');
|
||||||
const i18n = require('./lib/i18n');
|
const i18n = require('./lib/i18n');
|
||||||
|
@ -86,29 +86,26 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
|
||||||
|
|
||||||
const compileEditorAMDTask = task.define('compile-editor-amd', compilation.compileTask('out-editor-src', 'out-editor-build', true));
|
const compileEditorAMDTask = task.define('compile-editor-amd', compilation.compileTask('out-editor-src', 'out-editor-build', true));
|
||||||
|
|
||||||
const optimizeEditorAMDTask = task.define('optimize-editor-amd', optimize.optimizeTask(
|
const optimizeEditorAMDTask = task.define('optimize-editor-amd', common.optimizeTask({
|
||||||
{
|
src: 'out-editor-build',
|
||||||
out: 'out-editor',
|
entryPoints: editorEntryPoints,
|
||||||
amd: {
|
resources: editorResources,
|
||||||
src: 'out-editor-build',
|
loaderConfig: {
|
||||||
entryPoints: editorEntryPoints,
|
paths: {
|
||||||
resources: editorResources,
|
'vs': 'out-editor-build/vs',
|
||||||
loaderConfig: {
|
'vs/css': 'out-editor-build/vs/css.build',
|
||||||
paths: {
|
'vs/nls': 'out-editor-build/vs/nls.build',
|
||||||
'vs': 'out-editor-build/vs',
|
'vscode': 'empty:'
|
||||||
'vs/css': 'out-editor-build/vs/css.build',
|
|
||||||
'vs/nls': 'out-editor-build/vs/nls.build',
|
|
||||||
'vscode': 'empty:'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
header: BUNDLED_FILE_HEADER,
|
|
||||||
bundleInfo: true,
|
|
||||||
languages
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
));
|
bundleLoader: false,
|
||||||
|
header: BUNDLED_FILE_HEADER,
|
||||||
|
bundleInfo: true,
|
||||||
|
out: 'out-editor',
|
||||||
|
languages: languages
|
||||||
|
}));
|
||||||
|
|
||||||
const minifyEditorAMDTask = task.define('minify-editor-amd', optimize.minifyTask('out-editor'));
|
const minifyEditorAMDTask = task.define('minify-editor-amd', common.minifyTask('out-editor'));
|
||||||
|
|
||||||
const createESMSourcesAndResourcesTask = task.define('extract-editor-esm', () => {
|
const createESMSourcesAndResourcesTask = task.define('extract-editor-esm', () => {
|
||||||
standalone.createESMSourcesAndResources2({
|
standalone.createESMSourcesAndResources2({
|
||||||
|
|
|
@ -20,6 +20,7 @@ const root = path.dirname(__dirname);
|
||||||
const commit = util.getVersion(root);
|
const commit = util.getVersion(root);
|
||||||
const plumber = require('gulp-plumber');
|
const plumber = require('gulp-plumber');
|
||||||
const ext = require('./lib/extensions');
|
const ext = require('./lib/extensions');
|
||||||
|
const product = require('../product.json');
|
||||||
|
|
||||||
const extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
const extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ const path = require('path');
|
||||||
const es = require('event-stream');
|
const es = require('event-stream');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const task = require('./lib/task');
|
const task = require('./lib/task');
|
||||||
const optimize = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
const rename = require('gulp-rename');
|
const rename = require('gulp-rename');
|
||||||
const replace = require('gulp-replace');
|
const replace = require('gulp-replace');
|
||||||
|
@ -58,10 +58,15 @@ const serverResources = [
|
||||||
'out-build/bootstrap-fork.js',
|
'out-build/bootstrap-fork.js',
|
||||||
'out-build/bootstrap-amd.js',
|
'out-build/bootstrap-amd.js',
|
||||||
'out-build/bootstrap-node.js',
|
'out-build/bootstrap-node.js',
|
||||||
|
'out-build/paths.js',
|
||||||
|
|
||||||
// Performance
|
// Performance
|
||||||
'out-build/vs/base/common/performance.js',
|
'out-build/vs/base/common/performance.js',
|
||||||
|
|
||||||
|
// main entry points
|
||||||
|
'out-build/server-cli.js',
|
||||||
|
'out-build/server-main.js',
|
||||||
|
|
||||||
// Watcher
|
// Watcher
|
||||||
'out-build/vs/platform/files/**/*.exe',
|
'out-build/vs/platform/files/**/*.exe',
|
||||||
'out-build/vs/platform/files/**/*.md',
|
'out-build/vs/platform/files/**/*.md',
|
||||||
|
@ -249,7 +254,7 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
|
||||||
const date = new Date().toISOString();
|
const date = new Date().toISOString();
|
||||||
|
|
||||||
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
||||||
.pipe(json({ commit, date, version }));
|
.pipe(json({ commit, date }));
|
||||||
|
|
||||||
const license = gulp.src(['remote/LICENSE'], { base: 'remote', allowEmpty: true });
|
const license = gulp.src(['remote/LICENSE'], { base: 'remote', allowEmpty: true });
|
||||||
|
|
||||||
|
@ -352,42 +357,23 @@ function tweakProductForServerWeb(product) {
|
||||||
['reh', 'reh-web'].forEach(type => {
|
['reh', 'reh-web'].forEach(type => {
|
||||||
const optimizeTask = task.define(`optimize-vscode-${type}`, task.series(
|
const optimizeTask = task.define(`optimize-vscode-${type}`, task.series(
|
||||||
util.rimraf(`out-vscode-${type}`),
|
util.rimraf(`out-vscode-${type}`),
|
||||||
optimize.optimizeTask(
|
common.optimizeTask({
|
||||||
{
|
src: 'out-build',
|
||||||
out: `out-vscode-${type}`,
|
entryPoints: _.flatten(type === 'reh' ? serverEntryPoints : serverWithWebEntryPoints),
|
||||||
amd: {
|
otherSources: [],
|
||||||
src: 'out-build',
|
resources: type === 'reh' ? serverResources : serverWithWebResources,
|
||||||
entryPoints: _.flatten(type === 'reh' ? serverEntryPoints : serverWithWebEntryPoints),
|
loaderConfig: common.loaderConfig(),
|
||||||
otherSources: [],
|
out: `out-vscode-${type}`,
|
||||||
resources: type === 'reh' ? serverResources : serverWithWebResources,
|
inlineAmdImages: true,
|
||||||
loaderConfig: optimize.loaderConfig(),
|
bundleInfo: undefined,
|
||||||
inlineAmdImages: true,
|
fileContentMapper: createVSCodeWebFileContentMapper('.build/extensions', type === 'reh-web' ? tweakProductForServerWeb(product) : product)
|
||||||
bundleInfo: undefined,
|
})
|
||||||
fileContentMapper: createVSCodeWebFileContentMapper('.build/extensions', type === 'reh-web' ? tweakProductForServerWeb(product) : product)
|
|
||||||
},
|
|
||||||
commonJS: {
|
|
||||||
src: 'out-build',
|
|
||||||
entryPoints: [
|
|
||||||
'out-build/server-main.js',
|
|
||||||
'out-build/server-cli.js'
|
|
||||||
],
|
|
||||||
platform: 'node',
|
|
||||||
external: [
|
|
||||||
'minimist',
|
|
||||||
// TODO: we cannot inline `product.json` because
|
|
||||||
// it is being changed during build time at a later
|
|
||||||
// point in time (such as `checksums`)
|
|
||||||
'../product.json'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
|
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
|
||||||
optimizeTask,
|
optimizeTask,
|
||||||
util.rimraf(`out-vscode-${type}-min`),
|
util.rimraf(`out-vscode-${type}-min`),
|
||||||
optimize.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
|
common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
|
||||||
));
|
));
|
||||||
gulp.task(minifyTask);
|
gulp.task(minifyTask);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const _ = require('underscore');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const task = require('./lib/task');
|
const task = require('./lib/task');
|
||||||
const buildfile = require('../src/buildfile');
|
const buildfile = require('../src/buildfile');
|
||||||
const optimize = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
const root = path.dirname(__dirname);
|
const root = path.dirname(__dirname);
|
||||||
const commit = util.getVersion(root);
|
const commit = util.getVersion(root);
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
|
@ -52,6 +52,8 @@ const vscodeEntryPoints = _.flatten([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const vscodeResources = [
|
const vscodeResources = [
|
||||||
|
'out-build/main.js',
|
||||||
|
'out-build/cli.js',
|
||||||
'out-build/bootstrap.js',
|
'out-build/bootstrap.js',
|
||||||
'out-build/bootstrap-fork.js',
|
'out-build/bootstrap-fork.js',
|
||||||
'out-build/bootstrap-amd.js',
|
'out-build/bootstrap-amd.js',
|
||||||
|
@ -61,9 +63,12 @@ const vscodeResources = [
|
||||||
'!out-build/vs/code/browser/**/*.html',
|
'!out-build/vs/code/browser/**/*.html',
|
||||||
'!out-build/vs/editor/standalone/**/*.svg',
|
'!out-build/vs/editor/standalone/**/*.svg',
|
||||||
'out-build/vs/base/common/performance.js',
|
'out-build/vs/base/common/performance.js',
|
||||||
|
'out-build/vs/base/common/stripComments.js',
|
||||||
|
'out-build/vs/base/node/languagePacks.js',
|
||||||
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',
|
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',
|
||||||
'out-build/vs/base/browser/ui/codicons/codicon/**',
|
'out-build/vs/base/browser/ui/codicons/codicon/**',
|
||||||
'out-build/vs/base/parts/sandbox/electron-browser/preload.js',
|
'out-build/vs/base/parts/sandbox/electron-browser/preload.js',
|
||||||
|
'out-build/vs/platform/environment/node/userDataPath.js',
|
||||||
'out-build/vs/workbench/browser/media/*-theme.css',
|
'out-build/vs/workbench/browser/media/*-theme.css',
|
||||||
'out-build/vs/workbench/contrib/debug/**/*.json',
|
'out-build/vs/workbench/contrib/debug/**/*.json',
|
||||||
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',
|
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',
|
||||||
|
@ -85,34 +90,14 @@ const vscodeResources = [
|
||||||
|
|
||||||
const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
|
const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
|
||||||
util.rimraf('out-vscode'),
|
util.rimraf('out-vscode'),
|
||||||
optimize.optimizeTask(
|
common.optimizeTask({
|
||||||
{
|
src: 'out-build',
|
||||||
out: 'out-vscode',
|
entryPoints: vscodeEntryPoints,
|
||||||
amd: {
|
resources: vscodeResources,
|
||||||
src: 'out-build',
|
loaderConfig: common.loaderConfig(),
|
||||||
entryPoints: vscodeEntryPoints,
|
out: 'out-vscode',
|
||||||
resources: vscodeResources,
|
bundleInfo: undefined
|
||||||
loaderConfig: optimize.loaderConfig(),
|
})
|
||||||
bundleInfo: undefined
|
|
||||||
},
|
|
||||||
commonJS: {
|
|
||||||
src: 'out-build',
|
|
||||||
entryPoints: [
|
|
||||||
'out-build/main.js',
|
|
||||||
'out-build/cli.js'
|
|
||||||
],
|
|
||||||
platform: 'node',
|
|
||||||
external: [
|
|
||||||
'electron',
|
|
||||||
'minimist',
|
|
||||||
// TODO: we cannot inline `product.json` because
|
|
||||||
// it is being changed during build time at a later
|
|
||||||
// point in time (such as `checksums`)
|
|
||||||
'../product.json'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
gulp.task(optimizeVSCodeTask);
|
gulp.task(optimizeVSCodeTask);
|
||||||
|
|
||||||
|
@ -120,7 +105,7 @@ const sourceMappingURLBase = `https://ticino.blob.core.windows.net/sourcemaps/${
|
||||||
const minifyVSCodeTask = task.define('minify-vscode', task.series(
|
const minifyVSCodeTask = task.define('minify-vscode', task.series(
|
||||||
optimizeVSCodeTask,
|
optimizeVSCodeTask,
|
||||||
util.rimraf('out-vscode-min'),
|
util.rimraf('out-vscode-min'),
|
||||||
optimize.minifyTask('out-vscode', `${sourceMappingURLBase}/core`)
|
common.minifyTask('out-vscode', `${sourceMappingURLBase}/core`)
|
||||||
));
|
));
|
||||||
gulp.task(minifyVSCodeTask);
|
gulp.task(minifyVSCodeTask);
|
||||||
|
|
||||||
|
@ -226,7 +211,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||||
.pipe(json(packageJsonUpdates));
|
.pipe(json(packageJsonUpdates));
|
||||||
|
|
||||||
const date = new Date().toISOString();
|
const date = new Date().toISOString();
|
||||||
const productJsonUpdate = { commit, date, checksums, version };
|
const productJsonUpdate = { commit, date, checksums };
|
||||||
|
|
||||||
if (shouldSetupSettingsSearch()) {
|
if (shouldSetupSettingsSearch()) {
|
||||||
productJsonUpdate.settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
productJsonUpdate.settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
||||||
|
|
|
@ -10,7 +10,7 @@ const path = require('path');
|
||||||
const es = require('event-stream');
|
const es = require('event-stream');
|
||||||
const util = require('./lib/util');
|
const util = require('./lib/util');
|
||||||
const task = require('./lib/task');
|
const task = require('./lib/task');
|
||||||
const optimize = require('./lib/optimize');
|
const common = require('./lib/optimize');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
const rename = require('gulp-rename');
|
const rename = require('gulp-rename');
|
||||||
const filter = require('gulp-filter');
|
const filter = require('gulp-filter');
|
||||||
|
@ -153,28 +153,24 @@ exports.createVSCodeWebFileContentMapper = createVSCodeWebFileContentMapper;
|
||||||
|
|
||||||
const optimizeVSCodeWebTask = task.define('optimize-vscode-web', task.series(
|
const optimizeVSCodeWebTask = task.define('optimize-vscode-web', task.series(
|
||||||
util.rimraf('out-vscode-web'),
|
util.rimraf('out-vscode-web'),
|
||||||
optimize.optimizeTask(
|
common.optimizeTask({
|
||||||
{
|
src: 'out-build',
|
||||||
out: 'out-vscode-web',
|
entryPoints: _.flatten(vscodeWebEntryPoints),
|
||||||
amd: {
|
otherSources: [],
|
||||||
src: 'out-build',
|
resources: vscodeWebResources,
|
||||||
entryPoints: _.flatten(vscodeWebEntryPoints),
|
loaderConfig: common.loaderConfig(),
|
||||||
otherSources: [],
|
externalLoaderInfo: util.createExternalLoaderConfig(product.webEndpointUrl, commit, quality),
|
||||||
resources: vscodeWebResources,
|
out: 'out-vscode-web',
|
||||||
loaderConfig: optimize.loaderConfig(),
|
inlineAmdImages: true,
|
||||||
externalLoaderInfo: util.createExternalLoaderConfig(product.webEndpointUrl, commit, quality),
|
bundleInfo: undefined,
|
||||||
inlineAmdImages: true,
|
fileContentMapper: createVSCodeWebFileContentMapper('.build/web/extensions', product)
|
||||||
bundleInfo: undefined,
|
})
|
||||||
fileContentMapper: createVSCodeWebFileContentMapper('.build/web/extensions', product)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
const minifyVSCodeWebTask = task.define('minify-vscode-web', task.series(
|
const minifyVSCodeWebTask = task.define('minify-vscode-web', task.series(
|
||||||
optimizeVSCodeWebTask,
|
optimizeVSCodeWebTask,
|
||||||
util.rimraf('out-vscode-web-min'),
|
util.rimraf('out-vscode-web-min'),
|
||||||
optimize.minifyTask('out-vscode-web', `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
|
common.minifyTask('out-vscode-web', `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
|
||||||
));
|
));
|
||||||
gulp.task(minifyVSCodeWebTask);
|
gulp.task(minifyVSCodeWebTask);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.minifyTask = exports.optimizeTask = exports.optimizeLoaderTask = exports.loaderConfig = void 0;
|
exports.minifyTask = exports.optimizeTask = exports.loaderConfig = void 0;
|
||||||
const es = require("event-stream");
|
const es = require("event-stream");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const concat = require("gulp-concat");
|
const concat = require("gulp-concat");
|
||||||
|
@ -135,83 +135,56 @@ const DEFAULT_FILE_HEADER = [
|
||||||
' * Copyright (C) Microsoft Corporation. All rights reserved.',
|
' * Copyright (C) Microsoft Corporation. All rights reserved.',
|
||||||
' *--------------------------------------------------------*/'
|
' *--------------------------------------------------------*/'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
function optimizeAMDTask(opts) {
|
function optimizeTask(opts) {
|
||||||
const src = opts.src;
|
const src = opts.src;
|
||||||
const entryPoints = opts.entryPoints;
|
const entryPoints = opts.entryPoints;
|
||||||
const resources = opts.resources;
|
const resources = opts.resources;
|
||||||
const loaderConfig = opts.loaderConfig;
|
const loaderConfig = opts.loaderConfig;
|
||||||
const bundledFileHeader = opts.header || DEFAULT_FILE_HEADER;
|
const bundledFileHeader = opts.header || DEFAULT_FILE_HEADER;
|
||||||
|
const bundleLoader = (typeof opts.bundleLoader === 'undefined' ? true : opts.bundleLoader);
|
||||||
|
const out = opts.out;
|
||||||
const fileContentMapper = opts.fileContentMapper || ((contents, _path) => contents);
|
const fileContentMapper = opts.fileContentMapper || ((contents, _path) => contents);
|
||||||
const sourcemaps = require('gulp-sourcemaps');
|
|
||||||
const bundlesStream = es.through(); // this stream will contain the bundled files
|
|
||||||
const resourcesStream = es.through(); // this stream will contain the resources
|
|
||||||
const bundleInfoStream = es.through(); // this stream will contain bundleInfo.json
|
|
||||||
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
|
||||||
if (err || !result) {
|
|
||||||
return bundlesStream.emit('error', JSON.stringify(err));
|
|
||||||
}
|
|
||||||
toBundleStream(src, bundledFileHeader, result.files, fileContentMapper).pipe(bundlesStream);
|
|
||||||
// Remove css inlined resources
|
|
||||||
const filteredResources = resources.slice();
|
|
||||||
result.cssInlinedResources.forEach(function (resource) {
|
|
||||||
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
|
||||||
log('optimizer', 'excluding inlined: ' + resource);
|
|
||||||
}
|
|
||||||
filteredResources.push('!' + resource);
|
|
||||||
});
|
|
||||||
gulp.src(filteredResources, { base: `${src}`, allowEmpty: true }).pipe(resourcesStream);
|
|
||||||
const bundleInfoArray = [];
|
|
||||||
if (opts.bundleInfo) {
|
|
||||||
bundleInfoArray.push(new VinylFile({
|
|
||||||
path: 'bundleInfo.json',
|
|
||||||
base: '.',
|
|
||||||
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
|
||||||
});
|
|
||||||
const result = es.merge(loader(src, bundledFileHeader, false, opts.externalLoaderInfo), bundlesStream, resourcesStream, bundleInfoStream);
|
|
||||||
return result
|
|
||||||
.pipe(sourcemaps.write('./', {
|
|
||||||
sourceRoot: undefined,
|
|
||||||
addComment: true,
|
|
||||||
includeContent: true
|
|
||||||
}))
|
|
||||||
.pipe(opts.languages && opts.languages.length ? (0, i18n_1.processNlsFiles)({
|
|
||||||
fileHeader: bundledFileHeader,
|
|
||||||
languages: opts.languages
|
|
||||||
}) : es.through());
|
|
||||||
}
|
|
||||||
function optimizeCommonJSTask(opts) {
|
|
||||||
const esbuild = require('esbuild');
|
|
||||||
const src = opts.src;
|
|
||||||
const entryPoints = opts.entryPoints;
|
|
||||||
return gulp.src(entryPoints, { base: `${src}`, allowEmpty: true })
|
|
||||||
.pipe(es.map((f, cb) => {
|
|
||||||
esbuild.build({
|
|
||||||
entryPoints: [f.path],
|
|
||||||
bundle: true,
|
|
||||||
platform: opts.platform,
|
|
||||||
write: false,
|
|
||||||
external: opts.external
|
|
||||||
}).then(res => {
|
|
||||||
const jsFile = res.outputFiles[0];
|
|
||||||
f.contents = Buffer.from(jsFile.contents);
|
|
||||||
cb(undefined, f);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
function optimizeLoaderTask(src, out, bundleLoader, bundledFileHeader = '', externalLoaderInfo) {
|
|
||||||
return () => loader(src, bundledFileHeader, bundleLoader, externalLoaderInfo).pipe(gulp.dest(out));
|
|
||||||
}
|
|
||||||
exports.optimizeLoaderTask = optimizeLoaderTask;
|
|
||||||
function optimizeTask(opts) {
|
|
||||||
return function () {
|
return function () {
|
||||||
const optimizers = [optimizeAMDTask(opts.amd)];
|
const sourcemaps = require('gulp-sourcemaps');
|
||||||
if (opts.commonJS) {
|
const bundlesStream = es.through(); // this stream will contain the bundled files
|
||||||
optimizers.push(optimizeCommonJSTask(opts.commonJS));
|
const resourcesStream = es.through(); // this stream will contain the resources
|
||||||
}
|
const bundleInfoStream = es.through(); // this stream will contain bundleInfo.json
|
||||||
return es.merge(...optimizers).pipe(gulp.dest(opts.out));
|
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
||||||
|
if (err || !result) {
|
||||||
|
return bundlesStream.emit('error', JSON.stringify(err));
|
||||||
|
}
|
||||||
|
toBundleStream(src, bundledFileHeader, result.files, fileContentMapper).pipe(bundlesStream);
|
||||||
|
// Remove css inlined resources
|
||||||
|
const filteredResources = resources.slice();
|
||||||
|
result.cssInlinedResources.forEach(function (resource) {
|
||||||
|
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
||||||
|
log('optimizer', 'excluding inlined: ' + resource);
|
||||||
|
}
|
||||||
|
filteredResources.push('!' + resource);
|
||||||
|
});
|
||||||
|
gulp.src(filteredResources, { base: `${src}`, allowEmpty: true }).pipe(resourcesStream);
|
||||||
|
const bundleInfoArray = [];
|
||||||
|
if (opts.bundleInfo) {
|
||||||
|
bundleInfoArray.push(new VinylFile({
|
||||||
|
path: 'bundleInfo.json',
|
||||||
|
base: '.',
|
||||||
|
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||||
|
});
|
||||||
|
const result = es.merge(loader(src, bundledFileHeader, bundleLoader, opts.externalLoaderInfo), bundlesStream, resourcesStream, bundleInfoStream);
|
||||||
|
return result
|
||||||
|
.pipe(sourcemaps.write('./', {
|
||||||
|
sourceRoot: undefined,
|
||||||
|
addComment: true,
|
||||||
|
includeContent: true
|
||||||
|
}))
|
||||||
|
.pipe(opts.languages && opts.languages.length ? (0, i18n_1.processNlsFiles)({
|
||||||
|
fileHeader: bundledFileHeader,
|
||||||
|
languages: opts.languages
|
||||||
|
}) : es.through())
|
||||||
|
.pipe(gulp.dest(out));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.optimizeTask = optimizeTask;
|
exports.optimizeTask = optimizeTask;
|
||||||
|
|
|
@ -153,7 +153,7 @@ function toBundleStream(src: string, bundledFileHeader: string, bundles: bundle.
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOptimizeAMDTaskOpts {
|
export interface IOptimizeTaskOpts {
|
||||||
/**
|
/**
|
||||||
* The folder to read files from.
|
* The folder to read files from.
|
||||||
*/
|
*/
|
||||||
|
@ -184,7 +184,11 @@ export interface IOptimizeAMDTaskOpts {
|
||||||
*/
|
*/
|
||||||
bundleInfo: boolean;
|
bundleInfo: boolean;
|
||||||
/**
|
/**
|
||||||
* Language configuration.
|
* (out folder name)
|
||||||
|
*/
|
||||||
|
out: string;
|
||||||
|
/**
|
||||||
|
* (out folder name)
|
||||||
*/
|
*/
|
||||||
languages?: Language[];
|
languages?: Language[];
|
||||||
/**
|
/**
|
||||||
|
@ -201,125 +205,67 @@ const DEFAULT_FILE_HEADER = [
|
||||||
' *--------------------------------------------------------*/'
|
' *--------------------------------------------------------*/'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
function optimizeAMDTask(opts: IOptimizeAMDTaskOpts): NodeJS.ReadWriteStream {
|
export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStream {
|
||||||
const src = opts.src;
|
const src = opts.src;
|
||||||
const entryPoints = opts.entryPoints;
|
const entryPoints = opts.entryPoints;
|
||||||
const resources = opts.resources;
|
const resources = opts.resources;
|
||||||
const loaderConfig = opts.loaderConfig;
|
const loaderConfig = opts.loaderConfig;
|
||||||
const bundledFileHeader = opts.header || DEFAULT_FILE_HEADER;
|
const bundledFileHeader = opts.header || DEFAULT_FILE_HEADER;
|
||||||
|
const bundleLoader = (typeof opts.bundleLoader === 'undefined' ? true : opts.bundleLoader);
|
||||||
|
const out = opts.out;
|
||||||
const fileContentMapper = opts.fileContentMapper || ((contents: string, _path: string) => contents);
|
const fileContentMapper = opts.fileContentMapper || ((contents: string, _path: string) => contents);
|
||||||
|
|
||||||
const sourcemaps = require('gulp-sourcemaps') as typeof import('gulp-sourcemaps');
|
|
||||||
|
|
||||||
const bundlesStream = es.through(); // this stream will contain the bundled files
|
|
||||||
const resourcesStream = es.through(); // this stream will contain the resources
|
|
||||||
const bundleInfoStream = es.through(); // this stream will contain bundleInfo.json
|
|
||||||
|
|
||||||
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
|
||||||
if (err || !result) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
|
||||||
|
|
||||||
toBundleStream(src, bundledFileHeader, result.files, fileContentMapper).pipe(bundlesStream);
|
|
||||||
|
|
||||||
// Remove css inlined resources
|
|
||||||
const filteredResources = resources.slice();
|
|
||||||
result.cssInlinedResources.forEach(function (resource) {
|
|
||||||
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
|
||||||
log('optimizer', 'excluding inlined: ' + resource);
|
|
||||||
}
|
|
||||||
filteredResources.push('!' + resource);
|
|
||||||
});
|
|
||||||
gulp.src(filteredResources, { base: `${src}`, allowEmpty: true }).pipe(resourcesStream);
|
|
||||||
|
|
||||||
const bundleInfoArray: VinylFile[] = [];
|
|
||||||
if (opts.bundleInfo) {
|
|
||||||
bundleInfoArray.push(new VinylFile({
|
|
||||||
path: 'bundleInfo.json',
|
|
||||||
base: '.',
|
|
||||||
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = es.merge(
|
|
||||||
loader(src, bundledFileHeader, false, opts.externalLoaderInfo),
|
|
||||||
bundlesStream,
|
|
||||||
resourcesStream,
|
|
||||||
bundleInfoStream
|
|
||||||
);
|
|
||||||
|
|
||||||
return result
|
|
||||||
.pipe(sourcemaps.write('./', {
|
|
||||||
sourceRoot: undefined,
|
|
||||||
addComment: true,
|
|
||||||
includeContent: true
|
|
||||||
}))
|
|
||||||
.pipe(opts.languages && opts.languages.length ? processNlsFiles({
|
|
||||||
fileHeader: bundledFileHeader,
|
|
||||||
languages: opts.languages
|
|
||||||
}) : es.through());
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IOptimizeCommonJSTaskOpts {
|
|
||||||
/**
|
|
||||||
* The paths to consider for optimizing.
|
|
||||||
*/
|
|
||||||
entryPoints: string[];
|
|
||||||
/**
|
|
||||||
* The folder to read files from.
|
|
||||||
*/
|
|
||||||
src: string;
|
|
||||||
/**
|
|
||||||
* ESBuild `platform` option: https://esbuild.github.io/api/#platform
|
|
||||||
*/
|
|
||||||
platform: 'browser' | 'node' | 'neutral';
|
|
||||||
/**
|
|
||||||
* ESBuild `external` option: https://esbuild.github.io/api/#external
|
|
||||||
*/
|
|
||||||
external: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
function optimizeCommonJSTask(opts: IOptimizeCommonJSTaskOpts): NodeJS.ReadWriteStream {
|
|
||||||
const esbuild = require('esbuild') as typeof import('esbuild');
|
|
||||||
|
|
||||||
const src = opts.src;
|
|
||||||
const entryPoints = opts.entryPoints;
|
|
||||||
|
|
||||||
return gulp.src(entryPoints, { base: `${src}`, allowEmpty: true })
|
|
||||||
.pipe(es.map((f: any, cb) => {
|
|
||||||
esbuild.build({
|
|
||||||
entryPoints: [f.path],
|
|
||||||
bundle: true,
|
|
||||||
platform: opts.platform,
|
|
||||||
write: false,
|
|
||||||
external: opts.external
|
|
||||||
}).then(res => {
|
|
||||||
const jsFile = res.outputFiles[0];
|
|
||||||
f.contents = Buffer.from(jsFile.contents);
|
|
||||||
|
|
||||||
cb(undefined, f);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function optimizeLoaderTask(src: string, out: string, bundleLoader: boolean, bundledFileHeader = '', externalLoaderInfo?: any): () => NodeJS.ReadWriteStream {
|
|
||||||
return () => loader(src, bundledFileHeader, bundleLoader, externalLoaderInfo).pipe(gulp.dest(out));
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IOptimizeTaskOpts {
|
|
||||||
out: string;
|
|
||||||
amd: IOptimizeAMDTaskOpts;
|
|
||||||
commonJS?: IOptimizeCommonJSTaskOpts;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStream {
|
|
||||||
return function () {
|
return function () {
|
||||||
const optimizers = [optimizeAMDTask(opts.amd)];
|
const sourcemaps = require('gulp-sourcemaps') as typeof import('gulp-sourcemaps');
|
||||||
if (opts.commonJS) {
|
|
||||||
optimizers.push(optimizeCommonJSTask(opts.commonJS));
|
|
||||||
}
|
|
||||||
|
|
||||||
return es.merge(...optimizers).pipe(gulp.dest(opts.out));
|
const bundlesStream = es.through(); // this stream will contain the bundled files
|
||||||
|
const resourcesStream = es.through(); // this stream will contain the resources
|
||||||
|
const bundleInfoStream = es.through(); // this stream will contain bundleInfo.json
|
||||||
|
|
||||||
|
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
||||||
|
if (err || !result) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||||
|
|
||||||
|
toBundleStream(src, bundledFileHeader, result.files, fileContentMapper).pipe(bundlesStream);
|
||||||
|
|
||||||
|
// Remove css inlined resources
|
||||||
|
const filteredResources = resources.slice();
|
||||||
|
result.cssInlinedResources.forEach(function (resource) {
|
||||||
|
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
||||||
|
log('optimizer', 'excluding inlined: ' + resource);
|
||||||
|
}
|
||||||
|
filteredResources.push('!' + resource);
|
||||||
|
});
|
||||||
|
gulp.src(filteredResources, { base: `${src}`, allowEmpty: true }).pipe(resourcesStream);
|
||||||
|
|
||||||
|
const bundleInfoArray: VinylFile[] = [];
|
||||||
|
if (opts.bundleInfo) {
|
||||||
|
bundleInfoArray.push(new VinylFile({
|
||||||
|
path: 'bundleInfo.json',
|
||||||
|
base: '.',
|
||||||
|
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = es.merge(
|
||||||
|
loader(src, bundledFileHeader, bundleLoader, opts.externalLoaderInfo),
|
||||||
|
bundlesStream,
|
||||||
|
resourcesStream,
|
||||||
|
bundleInfoStream
|
||||||
|
);
|
||||||
|
|
||||||
|
return result
|
||||||
|
.pipe(sourcemaps.write('./', {
|
||||||
|
sourceRoot: undefined,
|
||||||
|
addComment: true,
|
||||||
|
includeContent: true
|
||||||
|
}))
|
||||||
|
.pipe(opts.languages && opts.languages.length ? processNlsFiles({
|
||||||
|
fileHeader: bundledFileHeader,
|
||||||
|
languages: opts.languages
|
||||||
|
}) : es.through())
|
||||||
|
.pipe(gulp.dest(out));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
src/bootstrap-amd.js
vendored
7
src/bootstrap-amd.js
vendored
|
@ -6,11 +6,6 @@
|
||||||
//@ts-check
|
//@ts-check
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Store the node.js require function in a variable
|
|
||||||
// before loading our AMD loader to avoid issues
|
|
||||||
// when this file is bundled with other files.
|
|
||||||
const nodeRequire = require;
|
|
||||||
|
|
||||||
const loader = require('./vs/loader');
|
const loader = require('./vs/loader');
|
||||||
const bootstrap = require('./bootstrap');
|
const bootstrap = require('./bootstrap');
|
||||||
const performance = require('./vs/base/common/performance');
|
const performance = require('./vs/base/common/performance');
|
||||||
|
@ -22,7 +17,7 @@ const nlsConfig = bootstrap.setupNLS();
|
||||||
loader.config({
|
loader.config({
|
||||||
baseUrl: bootstrap.fileUriFromPath(__dirname, { isWindows: process.platform === 'win32' }),
|
baseUrl: bootstrap.fileUriFromPath(__dirname, { isWindows: process.platform === 'win32' }),
|
||||||
catchError: true,
|
catchError: true,
|
||||||
nodeRequire,
|
nodeRequire: require,
|
||||||
'vs/nls': nlsConfig,
|
'vs/nls': nlsConfig,
|
||||||
amdModulesPattern: /^vs\//,
|
amdModulesPattern: /^vs\//,
|
||||||
recordStats: true
|
recordStats: true
|
||||||
|
|
|
@ -35,6 +35,7 @@ exports.base = [
|
||||||
exclude: ['vs/nls'],
|
exclude: ['vs/nls'],
|
||||||
prepend: [
|
prepend: [
|
||||||
{ path: 'vs/loader.js' },
|
{ path: 'vs/loader.js' },
|
||||||
|
{ path: 'vs/nls.js', amdModuleId: 'vs/nls' },
|
||||||
{ path: 'vs/base/worker/workerMain.js' }
|
{ path: 'vs/base/worker/workerMain.js' }
|
||||||
],
|
],
|
||||||
dest: 'vs/base/worker/workerMain.js'
|
dest: 'vs/base/worker/workerMain.js'
|
||||||
|
|
|
@ -34,7 +34,7 @@ bootstrap.enableASARSupport();
|
||||||
|
|
||||||
// Set userData path before app 'ready' event
|
// Set userData path before app 'ready' event
|
||||||
const args = parseCLIArgs();
|
const args = parseCLIArgs();
|
||||||
const userDataPath = getUserDataPath(args, product.nameShort ?? 'code-oss-dev');
|
const userDataPath = getUserDataPath(args);
|
||||||
app.setPath('userData', userDataPath);
|
app.setPath('userData', userDataPath);
|
||||||
|
|
||||||
// Resolve code cache path
|
// Resolve code cache path
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class NativeEnvironmentService extends AbstractNativeEnvironmentService {
|
||||||
super(args, {
|
super(args, {
|
||||||
homeDir: homedir(),
|
homeDir: homedir(),
|
||||||
tmpDir: tmpdir(),
|
tmpDir: tmpdir(),
|
||||||
userDataDir: getUserDataPath(args, productService.nameShort)
|
userDataDir: getUserDataPath(args)
|
||||||
}, productService);
|
}, productService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,4 @@ import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||||
* - respect VSCODE_APPDATA environment variable
|
* - respect VSCODE_APPDATA environment variable
|
||||||
* - respect --user-data-dir CLI argument
|
* - respect --user-data-dir CLI argument
|
||||||
*/
|
*/
|
||||||
export function getUserDataPath(args: NativeParsedArgs, productName: string): string;
|
export function getUserDataPath(args: NativeParsedArgs): string;
|
||||||
|
|
|
@ -14,18 +14,18 @@
|
||||||
*
|
*
|
||||||
* @param {typeof import('path')} path
|
* @param {typeof import('path')} path
|
||||||
* @param {typeof import('os')} os
|
* @param {typeof import('os')} os
|
||||||
|
* @param {string} productName
|
||||||
* @param {string} cwd
|
* @param {string} cwd
|
||||||
*/
|
*/
|
||||||
function factory(path, os, cwd) {
|
function factory(path, os, productName, cwd) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {NativeParsedArgs} cliArgs
|
* @param {NativeParsedArgs} cliArgs
|
||||||
* @param {string} productName
|
|
||||||
*
|
*
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function getUserDataPath(cliArgs, productName) {
|
function getUserDataPath(cliArgs) {
|
||||||
const userDataPath = doGetUserDataPath(cliArgs, productName);
|
const userDataPath = doGetUserDataPath(cliArgs);
|
||||||
const pathsToResolve = [userDataPath];
|
const pathsToResolve = [userDataPath];
|
||||||
|
|
||||||
// If the user-data-path is not absolute, make
|
// If the user-data-path is not absolute, make
|
||||||
|
@ -43,11 +43,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {NativeParsedArgs} cliArgs
|
* @param {NativeParsedArgs} cliArgs
|
||||||
* @param {string} productName
|
|
||||||
*
|
*
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function doGetUserDataPath(cliArgs, productName) {
|
function doGetUserDataPath(cliArgs) {
|
||||||
|
|
||||||
// 0. Running out of sources has a fixed productName
|
// 0. Running out of sources has a fixed productName
|
||||||
if (process.env['VSCODE_DEV']) {
|
if (process.env['VSCODE_DEV']) {
|
||||||
|
@ -107,18 +106,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof define === 'function') {
|
if (typeof define === 'function') {
|
||||||
define(['path', 'os', 'vs/base/common/process'], function (
|
define(['require', 'path', 'os', 'vs/base/common/network', 'vs/base/common/resources', 'vs/base/common/process'], function (
|
||||||
|
require,
|
||||||
/** @type {typeof import('path')} */ path,
|
/** @type {typeof import('path')} */ path,
|
||||||
/** @type {typeof import('os')} */ os,
|
/** @type {typeof import('os')} */ os,
|
||||||
|
/** @type {typeof import('../../../base/common/network')} */ network,
|
||||||
|
/** @type {typeof import("../../../base/common/resources")} */ resources,
|
||||||
/** @type {typeof import("../../../base/common/process")} */ process
|
/** @type {typeof import("../../../base/common/process")} */ process
|
||||||
) {
|
) {
|
||||||
return factory(path, os, process.cwd()); // amd
|
const rootPath = resources.dirname(network.FileAccess.asFileUri('', require));
|
||||||
});
|
const pkg = require.__$__nodeRequire(resources.joinPath(rootPath, 'package.json').fsPath);
|
||||||
|
|
||||||
|
return factory(path, os, pkg.name, process.cwd());
|
||||||
|
}); // amd
|
||||||
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||||
|
const pkg = require('../../../../../package.json');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
module.exports = factory(path, os, process.env['VSCODE_CWD'] || process.cwd()); // commonjs
|
module.exports = factory(path, os, pkg.name, process.env['VSCODE_CWD'] || process.cwd()); // commonjs
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown context');
|
throw new Error('Unknown context');
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,11 @@
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { OPTIONS, parseArgs } from 'vs/platform/environment/node/argv';
|
import { OPTIONS, parseArgs } from 'vs/platform/environment/node/argv';
|
||||||
import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
||||||
import product from 'vs/platform/product/common/product';
|
|
||||||
|
|
||||||
suite('User data path', () => {
|
suite('User data path', () => {
|
||||||
|
|
||||||
test('getUserDataPath - default', () => {
|
test('getUserDataPath - default', () => {
|
||||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS), product.nameShort);
|
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||||
assert.ok(path.length > 0);
|
assert.ok(path.length > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ suite('User data path', () => {
|
||||||
const portableDir = 'portable-dir';
|
const portableDir = 'portable-dir';
|
||||||
process.env['VSCODE_PORTABLE'] = portableDir;
|
process.env['VSCODE_PORTABLE'] = portableDir;
|
||||||
|
|
||||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS), product.nameShort);
|
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||||
assert.ok(path.includes(portableDir));
|
assert.ok(path.includes(portableDir));
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof origPortable === 'string') {
|
if (typeof origPortable === 'string') {
|
||||||
|
@ -37,7 +36,7 @@ suite('User data path', () => {
|
||||||
const args = parseArgs(process.argv, OPTIONS);
|
const args = parseArgs(process.argv, OPTIONS);
|
||||||
args['user-data-dir'] = cliUserDataDir;
|
args['user-data-dir'] = cliUserDataDir;
|
||||||
|
|
||||||
const path = getUserDataPath(args, product.nameShort);
|
const path = getUserDataPath(args);
|
||||||
assert.ok(path.includes(cliUserDataDir));
|
assert.ok(path.includes(cliUserDataDir));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ suite('User data path', () => {
|
||||||
const appDataDir = 'appdata-dir';
|
const appDataDir = 'appdata-dir';
|
||||||
process.env['VSCODE_APPDATA'] = appDataDir;
|
process.env['VSCODE_APPDATA'] = appDataDir;
|
||||||
|
|
||||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS), product.nameShort);
|
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||||
assert.ok(path.includes(appDataDir));
|
assert.ok(path.includes(appDataDir));
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof origAppData === 'string') {
|
if (typeof origAppData === 'string') {
|
||||||
|
|
|
@ -32,6 +32,7 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
||||||
const rootPath = dirname(FileAccess.asFileUri('', require));
|
const rootPath = dirname(FileAccess.asFileUri('', require));
|
||||||
|
|
||||||
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
||||||
|
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string };
|
||||||
|
|
||||||
// Running out of sources
|
// Running out of sources
|
||||||
if (env['VSCODE_DEV']) {
|
if (env['VSCODE_DEV']) {
|
||||||
|
@ -43,16 +44,9 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version is added during built time, but we still
|
Object.assign(product, {
|
||||||
// want to have it running out of sources so we
|
version: pkg.version
|
||||||
// read it from package.json only when we need it.
|
});
|
||||||
if (!product.version) {
|
|
||||||
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string };
|
|
||||||
|
|
||||||
Object.assign(product, {
|
|
||||||
version: pkg.version
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Web environment or unknown
|
// Web environment or unknown
|
||||||
|
|
|
@ -84,7 +84,7 @@ export const TestNativeWindowConfiguration: INativeWindowConfiguration = {
|
||||||
product,
|
product,
|
||||||
homeDir: homeDir,
|
homeDir: homeDir,
|
||||||
tmpDir: tmpdir(),
|
tmpDir: tmpdir(),
|
||||||
userDataDir: getUserDataPath(args, product.nameShort),
|
userDataDir: getUserDataPath(args),
|
||||||
profiles: { profile: NULL_PROFILE, all: [NULL_PROFILE] },
|
profiles: { profile: NULL_PROFILE, all: [NULL_PROFILE] },
|
||||||
...args
|
...args
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue