mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Add proper typings for a few more build script dependencies
For #276864
This commit is contained in:
@@ -15,7 +15,7 @@ const gulp_gzip_1 = __importDefault(require("gulp-gzip"));
|
||||
const mime_1 = __importDefault(require("mime"));
|
||||
const identity_1 = require("@azure/identity");
|
||||
const util_1 = require("../lib/util");
|
||||
const azure = require('gulp-azure-storage');
|
||||
const gulp_azure_storage_1 = __importDefault(require("gulp-azure-storage"));
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new identity_1.ClientAssertionCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], () => Promise.resolve(process.env['AZURE_ID_TOKEN']));
|
||||
mime_1.default.define({
|
||||
@@ -91,10 +91,10 @@ async function main() {
|
||||
const compressed = all
|
||||
.pipe((0, gulp_filter_1.default)(f => MimeTypesToCompress.has(mime_1.default.lookup(f.path))))
|
||||
.pipe((0, gulp_gzip_1.default)({ append: false }))
|
||||
.pipe(azure.upload(options(true)));
|
||||
.pipe(gulp_azure_storage_1.default.upload(options(true)));
|
||||
const uncompressed = all
|
||||
.pipe((0, gulp_filter_1.default)(f => !MimeTypesToCompress.has(mime_1.default.lookup(f.path))))
|
||||
.pipe(azure.upload(options(false)));
|
||||
.pipe(gulp_azure_storage_1.default.upload(options(false)));
|
||||
const out = event_stream_1.default.merge(compressed, uncompressed)
|
||||
.pipe(event_stream_1.default.through(function (f) {
|
||||
console.log('Uploaded:', f.relative);
|
||||
@@ -110,7 +110,7 @@ async function main() {
|
||||
});
|
||||
const filesOut = event_stream_1.default.readArray([listing])
|
||||
.pipe((0, gulp_gzip_1.default)({ append: false }))
|
||||
.pipe(azure.upload(options(true)));
|
||||
.pipe(gulp_azure_storage_1.default.upload(options(true)));
|
||||
console.log(`Uploading: files.txt (${files.length} files)`); // debug
|
||||
await wait(filesOut);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import gzip from 'gulp-gzip';
|
||||
import mime from 'mime';
|
||||
import { ClientAssertionCredential } from '@azure/identity';
|
||||
import { VinylStat } from '../lib/util';
|
||||
const azure = require('gulp-azure-storage');
|
||||
import azure from 'gulp-azure-storage';
|
||||
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new ClientAssertionCredential(process.env['AZURE_TENANT_ID']!, process.env['AZURE_CLIENT_ID']!, () => Promise.resolve(process.env['AZURE_ID_TOKEN']!));
|
||||
|
||||
@@ -14,7 +14,7 @@ const gulp_gzip_1 = __importDefault(require("gulp-gzip"));
|
||||
const identity_1 = require("@azure/identity");
|
||||
const path = require("path");
|
||||
const fs_1 = require("fs");
|
||||
const azure = require('gulp-azure-storage');
|
||||
const gulp_azure_storage_1 = __importDefault(require("gulp-azure-storage"));
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new identity_1.ClientAssertionCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], () => Promise.resolve(process.env['AZURE_ID_TOKEN']));
|
||||
function main() {
|
||||
@@ -106,7 +106,7 @@ function main() {
|
||||
console.log(`##vso[artifact.upload containerfolder=nlsmetadata;artifactname=${data.basename}]${data.path}`);
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload({
|
||||
.pipe(gulp_azure_storage_1.default.upload({
|
||||
account: process.env.AZURE_STORAGE_ACCOUNT,
|
||||
credential,
|
||||
container: '$web',
|
||||
|
||||
@@ -11,7 +11,7 @@ import gzip from 'gulp-gzip';
|
||||
import { ClientAssertionCredential } from '@azure/identity';
|
||||
import path = require('path');
|
||||
import { readFileSync } from 'fs';
|
||||
const azure = require('gulp-azure-storage');
|
||||
import azure from 'gulp-azure-storage';
|
||||
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new ClientAssertionCredential(process.env['AZURE_TENANT_ID']!, process.env['AZURE_CLIENT_ID']!, () => Promise.resolve(process.env['AZURE_ID_TOKEN']!));
|
||||
|
||||
@@ -46,7 +46,7 @@ const vinyl_fs_1 = __importDefault(require("vinyl-fs"));
|
||||
const util = __importStar(require("../lib/util"));
|
||||
const dependencies_1 = require("../lib/dependencies");
|
||||
const identity_1 = require("@azure/identity");
|
||||
const azure = require('gulp-azure-storage');
|
||||
const gulp_azure_storage_1 = __importDefault(require("gulp-azure-storage"));
|
||||
const root = path_1.default.dirname(path_1.default.dirname(__dirname));
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new identity_1.ClientAssertionCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], () => Promise.resolve(process.env['AZURE_ID_TOKEN']));
|
||||
@@ -84,7 +84,7 @@ function main() {
|
||||
console.log('Uploading Sourcemap', data.relative); // debug
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload({
|
||||
.pipe(gulp_azure_storage_1.default.upload({
|
||||
account: process.env.AZURE_STORAGE_ACCOUNT,
|
||||
credential,
|
||||
container: '$web',
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as util from '../lib/util';
|
||||
import { getProductionDependencies } from '../lib/dependencies';
|
||||
import { ClientAssertionCredential } from '@azure/identity';
|
||||
import Stream from 'stream';
|
||||
const azure = require('gulp-azure-storage');
|
||||
import azure from 'gulp-azure-storage';
|
||||
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
const commit = process.env['BUILD_SOURCEVERSION'];
|
||||
|
||||
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createAsar = createAsar;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const event_stream_1 = __importDefault(require("event-stream"));
|
||||
const pickle = require('chromium-pickle-js');
|
||||
const Filesystem = require('asar/lib/filesystem');
|
||||
const chromium_pickle_js_1 = __importDefault(require("chromium-pickle-js"));
|
||||
const filesystem_js_1 = __importDefault(require("asar/lib/filesystem.js"));
|
||||
const vinyl_1 = __importDefault(require("vinyl"));
|
||||
const minimatch_1 = __importDefault(require("minimatch"));
|
||||
function createAsar(folderPath, unpackGlobs, skipGlobs, duplicateGlobs, destFilename) {
|
||||
@@ -41,7 +41,7 @@ function createAsar(folderPath, unpackGlobs, skipGlobs, duplicateGlobs, destFile
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filesystem = new Filesystem(folderPath);
|
||||
const filesystem = new filesystem_js_1.default(folderPath);
|
||||
const out = [];
|
||||
// Keep track of pending inserts
|
||||
let pendingInserts = 0;
|
||||
@@ -121,10 +121,10 @@ function createAsar(folderPath, unpackGlobs, skipGlobs, duplicateGlobs, destFile
|
||||
}, function () {
|
||||
const finish = () => {
|
||||
{
|
||||
const headerPickle = pickle.createEmpty();
|
||||
const headerPickle = chromium_pickle_js_1.default.createEmpty();
|
||||
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||
const headerBuf = headerPickle.toBuffer();
|
||||
const sizePickle = pickle.createEmpty();
|
||||
const sizePickle = chromium_pickle_js_1.default.createEmpty();
|
||||
sizePickle.writeUInt32(headerBuf.length);
|
||||
const sizeBuf = sizePickle.toBuffer();
|
||||
out.unshift(headerBuf);
|
||||
|
||||
@@ -5,18 +5,11 @@
|
||||
|
||||
import path from 'path';
|
||||
import es from 'event-stream';
|
||||
const pickle = require('chromium-pickle-js');
|
||||
const Filesystem = <typeof AsarFilesystem>require('asar/lib/filesystem');
|
||||
import pickle from 'chromium-pickle-js';
|
||||
import Filesystem from 'asar/lib/filesystem.js';
|
||||
import VinylFile from 'vinyl';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
declare class AsarFilesystem {
|
||||
readonly header: unknown;
|
||||
constructor(src: string);
|
||||
insertDirectory(path: string, shouldUnpack?: boolean): unknown;
|
||||
insertFile(path: string, shouldUnpack: boolean, file: { stat: { size: number; mode: number } }, options: {}): Promise<void>;
|
||||
}
|
||||
|
||||
export function createAsar(folderPath: string, unpackGlobs: string[], skipGlobs: string[], duplicateGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
|
||||
|
||||
const shouldUnpackFile = (file: VinylFile): boolean => {
|
||||
|
||||
@@ -59,8 +59,9 @@ const os_1 = __importDefault(require("os"));
|
||||
const vinyl_1 = __importDefault(require("vinyl"));
|
||||
const task = __importStar(require("./task"));
|
||||
const index_1 = require("./mangle/index");
|
||||
const ts = require("typescript");
|
||||
const watch = require('./watch');
|
||||
const typescript_1 = __importDefault(require("typescript"));
|
||||
const watch_1 = __importDefault(require("./watch"));
|
||||
const gulp_bom_1 = __importDefault(require("gulp-bom"));
|
||||
// --- gulp-tsb: compile and transpile --------------------------------
|
||||
const reporter = (0, reporter_1.createReporter)();
|
||||
function getTypeScriptCompilerOptions(src) {
|
||||
@@ -91,14 +92,13 @@ function createCompile(src, { build, emitError, transpileOnly, preserveEnglish }
|
||||
transpileWithEsbuild: typeof transpileOnly !== 'boolean' && transpileOnly.esbuild
|
||||
}, err => reporter(err));
|
||||
function pipeline(token) {
|
||||
const bom = require('gulp-bom');
|
||||
const tsFilter = util.filter(data => /\.ts$/.test(data.path));
|
||||
const isUtf8Test = (f) => /(\/|\\)test(\/|\\).*utf8/.test(f.path);
|
||||
const isRuntimeJs = (f) => f.path.endsWith('.js') && !f.path.includes('fixtures');
|
||||
const noDeclarationsFilter = util.filter(data => !(/\.d\.ts$/.test(data.path)));
|
||||
const input = event_stream_1.default.through();
|
||||
const output = input
|
||||
.pipe(util.$if(isUtf8Test, bom())) // this is required to preserve BOM in test files that loose it otherwise
|
||||
.pipe(util.$if(isUtf8Test, (0, gulp_bom_1.default)())) // this is required to preserve BOM in test files that loose it otherwise
|
||||
.pipe(util.$if(!build && isRuntimeJs, util.appendOwnPathSourceURL()))
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
@@ -149,7 +149,7 @@ function compileTask(src, out, build, options = {}) {
|
||||
let ts2tsMangler = new index_1.Mangler(compile.projectPath, (...data) => (0, fancy_log_1.default)(ansi_colors_1.default.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
|
||||
const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
|
||||
mangleStream = event_stream_1.default.through(async function write(data) {
|
||||
const tsNormalPath = ts.normalizePath(data.path);
|
||||
const tsNormalPath = typescript_1.default.normalizePath(data.path);
|
||||
const newContents = (await newContentsByFileName).get(tsNormalPath);
|
||||
if (newContents !== undefined) {
|
||||
data.contents = Buffer.from(newContents.out);
|
||||
@@ -176,7 +176,7 @@ function watchTask(out, build, srcPath = 'src') {
|
||||
const task = () => {
|
||||
const compile = createCompile(srcPath, { build, emitError: false, transpileOnly: false, preserveEnglish: false });
|
||||
const src = gulp_1.default.src(`${srcPath}/**`, { base: srcPath });
|
||||
const watchSrc = watch(`${srcPath}/**`, { base: srcPath, readDelay: 200 });
|
||||
const watchSrc = (0, watch_1.default)(`${srcPath}/**`, { base: srcPath, readDelay: 200 });
|
||||
const generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
return watchSrc
|
||||
@@ -333,7 +333,7 @@ exports.watchApiProposalNamesTask = task.define('watch-api-proposal-names', () =
|
||||
const task = () => gulp_1.default.src('src/vscode-dts/**')
|
||||
.pipe(generateApiProposalNames())
|
||||
.pipe(apiProposalNamesReporter.end(true));
|
||||
return watch('src/vscode-dts/**', { readDelay: 200 })
|
||||
return (0, watch_1.default)('src/vscode-dts/**', { readDelay: 200 })
|
||||
.pipe(util.debounce(task))
|
||||
.pipe(gulp_1.default.dest('src'));
|
||||
});
|
||||
|
||||
@@ -18,8 +18,9 @@ import File from 'vinyl';
|
||||
import * as task from './task';
|
||||
import { Mangler } from './mangle/index';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
import ts = require('typescript');
|
||||
const watch = require('./watch');
|
||||
import ts from 'typescript';
|
||||
import watch from './watch';
|
||||
import bom from 'gulp-bom';
|
||||
|
||||
|
||||
// --- gulp-tsb: compile and transpile --------------------------------
|
||||
@@ -66,7 +67,6 @@ export function createCompile(src: string, { build, emitError, transpileOnly, pr
|
||||
}, err => reporter(err));
|
||||
|
||||
function pipeline(token?: util.ICancellationToken) {
|
||||
const bom = require('gulp-bom') as typeof import('gulp-bom');
|
||||
|
||||
const tsFilter = util.filter(data => /\.ts$/.test(data.path));
|
||||
const isUtf8Test = (f: File) => /(\/|\\)test(\/|\\).*utf8/.test(f.path);
|
||||
|
||||
3
build/lib/typings/@vscode/gulp-electron.d.ts
vendored
Normal file
3
build/lib/typings/@vscode/gulp-electron.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare module '@vscode/gulp-electron' {
|
||||
export default function electron(options: any): NodeJS.ReadWriteStream;
|
||||
}
|
||||
9
build/lib/typings/asar.d.ts
vendored
Normal file
9
build/lib/typings/asar.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
declare module 'asar/lib/filesystem.js' {
|
||||
|
||||
export default class AsarFilesystem {
|
||||
readonly header: unknown;
|
||||
constructor(src: string);
|
||||
insertDirectory(path: string, shouldUnpack?: boolean): unknown;
|
||||
insertFile(path: string, shouldUnpack: boolean, file: { stat: { size: number; mode: number } }, options: {}): Promise<void>;
|
||||
}
|
||||
}
|
||||
10
build/lib/typings/chromium-pickle-js.d.ts
vendored
Normal file
10
build/lib/typings/chromium-pickle-js.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
declare module 'chromium-pickle-js' {
|
||||
export interface Pickle {
|
||||
writeString(value: string): void;
|
||||
writeUInt32(value: number): void;
|
||||
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
export function createEmpty(): Pickle;
|
||||
}
|
||||
5
build/lib/typings/gulp-azure-storage.d.ts
vendored
Normal file
5
build/lib/typings/gulp-azure-storage.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare module 'gulp-azure-storage' {
|
||||
import { ThroughStream } from 'event-stream';
|
||||
|
||||
export function upload(options: any): ThroughStream;
|
||||
}
|
||||
4
build/lib/typings/gulp-vinyl-zip.d.ts
vendored
Normal file
4
build/lib/typings/gulp-vinyl-zip.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
declare module 'gulp-vinyl-zip' {
|
||||
export function src(): NodeJS.ReadWriteStream;
|
||||
}
|
||||
3
build/lib/typings/vscode-gulp-watch.d.ts
vendored
Normal file
3
build/lib/typings/vscode-gulp-watch.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare module 'vscode-gulp-watch' {
|
||||
export default function watch(...args: any[]): any;
|
||||
}
|
||||
@@ -4,8 +4,9 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const watch = process.platform === 'win32' ? require('./watch-win32') : require('vscode-gulp-watch');
|
||||
module.exports = function () {
|
||||
return watch.apply(null, arguments);
|
||||
};
|
||||
function default_1(...args) {
|
||||
return watch.apply(null, args);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
const watch = process.platform === 'win32' ? require('./watch-win32') : require('vscode-gulp-watch');
|
||||
|
||||
module.exports = function () {
|
||||
return watch.apply(null, arguments);
|
||||
};
|
||||
export default function (...args: any[]): any {
|
||||
return watch.apply(null, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user