mirror of
https://github.com/Microsoft/vscode
synced 2024-11-05 18:29:38 +00:00
Update build scripts
This commit is contained in:
parent
32ddac99d5
commit
d2a8f91fb5
4 changed files with 56 additions and 4 deletions
|
@ -35,7 +35,7 @@ function loaderConfig() {
|
|||
}
|
||||
exports.loaderConfig = loaderConfig;
|
||||
const IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
||||
function loader(src, bundledFileHeader, bundleLoader) {
|
||||
function loader(src, bundledFileHeader, bundleLoader, externalLoaderInfo) {
|
||||
let sources = [
|
||||
`${src}/vs/loader.js`
|
||||
];
|
||||
|
@ -61,6 +61,15 @@ function loader(src, bundledFileHeader, bundleLoader) {
|
|||
else {
|
||||
this.emit('data', data);
|
||||
}
|
||||
}, function () {
|
||||
if (externalLoaderInfo !== undefined) {
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake2',
|
||||
base: '.',
|
||||
contents: Buffer.from(`require.config(${JSON.stringify(externalLoaderInfo, undefined, 2)});`)
|
||||
}));
|
||||
}
|
||||
this.emit('end');
|
||||
}))
|
||||
.pipe(concat('vs/loader.js')));
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export function loaderConfig() {
|
|||
|
||||
const IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
||||
|
||||
function loader(src: string, bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWriteStream {
|
||||
function loader(src: string, bundledFileHeader: string, bundleLoader: boolean, externalLoaderInfo?: any): NodeJS.ReadWriteStream {
|
||||
let sources = [
|
||||
`${src}/vs/loader.js`
|
||||
];
|
||||
|
@ -68,6 +68,15 @@ function loader(src: string, bundledFileHeader: string, bundleLoader: boolean):
|
|||
} else {
|
||||
this.emit('data', data);
|
||||
}
|
||||
}, function () {
|
||||
if (externalLoaderInfo !== undefined) {
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake2',
|
||||
base: '.',
|
||||
contents: Buffer.from(`require.config(${JSON.stringify(externalLoaderInfo, undefined, 2)});`)
|
||||
}));
|
||||
}
|
||||
this.emit('end');
|
||||
}))
|
||||
.pipe(concat('vs/loader.js'))
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildWebNodePaths = exports.acquireWebNodePaths = exports.getElectronVersion = exports.streamToPromise = exports.versionStringToNumber = exports.filter = exports.rebase = exports.getVersion = exports.ensureDir = exports.rreddir = exports.rimraf = exports.rewriteSourceMappingURL = exports.stripSourceMappingURL = exports.loadSourcemaps = exports.cleanNodeModules = exports.skipDirectories = exports.toFileUri = exports.setExecutableBit = exports.fixWin32DirectoryPermissions = exports.incremental = void 0;
|
||||
exports.buildWebNodePaths = exports.createExternalLoaderConfig = exports.acquireWebNodePaths = exports.getElectronVersion = exports.streamToPromise = exports.versionStringToNumber = exports.filter = exports.rebase = exports.getVersion = exports.ensureDir = exports.rreddir = exports.rimraf = exports.rewriteSourceMappingURL = exports.stripSourceMappingURL = exports.loadSourcemaps = exports.cleanNodeModules = exports.skipDirectories = exports.toFileUri = exports.setExecutableBit = exports.fixWin32DirectoryPermissions = exports.incremental = void 0;
|
||||
const es = require("event-stream");
|
||||
const debounce = require("debounce");
|
||||
const _filter = require("gulp-filter");
|
||||
|
@ -301,6 +301,23 @@ function acquireWebNodePaths() {
|
|||
return nodePaths;
|
||||
}
|
||||
exports.acquireWebNodePaths = acquireWebNodePaths;
|
||||
function createExternalLoaderConfig(webEndpoint, commit, quality) {
|
||||
if (!webEndpoint || !commit || !quality) {
|
||||
return undefined;
|
||||
}
|
||||
webEndpoint = webEndpoint + `/${quality}/${commit}`;
|
||||
let nodePaths = acquireWebNodePaths();
|
||||
Object.keys(nodePaths).map(function (key, _) {
|
||||
nodePaths[key] = `${webEndpoint}/node_modules/${key}/${nodePaths[key]}`;
|
||||
});
|
||||
const externalLoaderConfig = {
|
||||
baseUrl: `${webEndpoint}/out`,
|
||||
recordStats: true,
|
||||
paths: nodePaths
|
||||
};
|
||||
return externalLoaderConfig;
|
||||
}
|
||||
exports.createExternalLoaderConfig = createExternalLoaderConfig;
|
||||
function buildWebNodePaths(outDir) {
|
||||
const result = () => new Promise((resolve, _) => {
|
||||
const root = path.join(__dirname, '..', '..');
|
||||
|
|
|
@ -345,7 +345,7 @@ export function acquireWebNodePaths() {
|
|||
const root = path.join(__dirname, '..', '..');
|
||||
const webPackageJSON = path.join(root, '/remote/web', 'package.json');
|
||||
const webPackages = JSON.parse(fs.readFileSync(webPackageJSON, 'utf8')).dependencies;
|
||||
const nodePaths: { [key: string]: string } = {};
|
||||
const nodePaths: { [key: string]: string } = { };
|
||||
for (const key of Object.keys(webPackages)) {
|
||||
const packageJSON = path.join(root, 'node_modules', key, 'package.json');
|
||||
const packageData = JSON.parse(fs.readFileSync(packageJSON, 'utf8'));
|
||||
|
@ -366,6 +366,23 @@ export function acquireWebNodePaths() {
|
|||
return nodePaths;
|
||||
}
|
||||
|
||||
export function createExternalLoaderConfig(webEndpoint?: string, commit?: string, quality?: string) {
|
||||
if (!webEndpoint || !commit || !quality) {
|
||||
return undefined;
|
||||
}
|
||||
webEndpoint = webEndpoint + `/${quality}/${commit}`;
|
||||
let nodePaths = acquireWebNodePaths();
|
||||
Object.keys(nodePaths).map(function (key, _) {
|
||||
nodePaths[key] = `${webEndpoint}/node_modules/${key}/${nodePaths[key]}`;
|
||||
});
|
||||
const externalLoaderConfig = {
|
||||
baseUrl: `${webEndpoint}/out`,
|
||||
recordStats: true,
|
||||
paths: nodePaths
|
||||
};
|
||||
return externalLoaderConfig;
|
||||
}
|
||||
|
||||
export function buildWebNodePaths(outDir: string) {
|
||||
const result = () => new Promise<void>((resolve, _) => {
|
||||
const root = path.join(__dirname, '..', '..');
|
||||
|
|
Loading…
Reference in a new issue