VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)

* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9

* delete unused folders

* distro

* Bump build node version

* update chokidar

* FIx hygiene errors

* distro

* Fix extension lint issues

* Remove strict-vscode

* Add copyright header exemptions

* Bump vscode-extension-telemetry to fix webpacking issue with zone.js

* distro

* Fix failing tests (revert marked.js back to current one until we decide to update)

* Skip searchmodel test

* Fix mac build

* temp debug script loading

* Try disabling coverage

* log error too

* Revert "log error too"

This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f.

* Revert "temp debug script loading"

This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c.

* Add comments explaining coverage disabling

* Fix ansi_up loading issue

* Merge latest from ads

* Use newer option

* Fix compile

* add debug logging warn

* Always log stack

* log more

* undo debug

* Update to use correct base path (+cleanup)

* distro

* fix compile errors

* Remove strict-vscode

* Fix sql editors not showing

* Show db dropdown input & fix styling

* Fix more info in gallery

* Fix gallery asset requests

* Delete unused workflow

* Fix tapable resolutions for smoke test compile error

* Fix smoke compile

* Disable crash reporting

* Disable interactive

Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
Charles Gagnon
2022-01-06 09:06:56 -08:00
committed by GitHub
parent fd2736b6a6
commit 2bc6a0cd01
2099 changed files with 79520 additions and 43813 deletions

View File

@@ -25,7 +25,7 @@ async function downloadExtensionDetails(extension) {
const promises = [];
for (const fileName of contentFileNames) {
promises.push(new Promise(resolve => {
got_1.default(`${repositoryContentBaseUrl}/${fileName}`)
(0, got_1.default)(`${repositoryContentBaseUrl}/${fileName}`)
.then(response => {
resolve({ fileName, body: response.rawBody });
})

View File

@@ -17,7 +17,7 @@ const fancyLog = require("fancy-log");
const ansiColors = require("ansi-colors");
const os = require("os");
const watch = require('./watch');
const reporter = reporter_1.createReporter();
const reporter = (0, reporter_1.createReporter)();
function getTypeScriptCompilerOptions(src) {
const rootDir = path.join(__dirname, `../../${src}`);
let options = {};
@@ -37,6 +37,9 @@ function createCompile(src, build, emitError) {
const sourcemaps = require('gulp-sourcemaps');
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
const overrideOptions = Object.assign(Object.assign({}, getTypeScriptCompilerOptions(src)), { inlineSources: Boolean(build) });
if (!build) {
overrideOptions.inlineSourceMap = true;
}
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
function pipeline(token) {
const bom = require('gulp-bom');

View File

@@ -44,6 +44,9 @@ function createCompile(src: string, build: boolean, emitError?: boolean) {
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
const overrideOptions = { ...getTypeScriptCompilerOptions(src), inlineSources: Boolean(build) };
if (!build) {
overrideOptions.inlineSourceMap = true;
}
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));

View File

@@ -11,19 +11,69 @@ const vfs = require("vinyl-fs");
const filter = require("gulp-filter");
const _ = require("underscore");
const util = require("./util");
function isDocumentSuffix(str) {
return str === 'document' || str === 'script' || str === 'file' || str === 'source code';
}
const root = path.dirname(path.dirname(__dirname));
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
const commit = util.getVersion(root);
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
function darwinBundleDocumentType(extensions, icon) {
/**
* Generate a `DarwinDocumentType` given a list of file extensions, an icon name, and an optional suffix or file type name.
* @param extensions A list of file extensions, such as `['bat', 'cmd']`
* @param icon A sentence-cased file type name that matches the lowercase name of a darwin icon resource.
* For example, `'HTML'` instead of `'html'`, or `'Java'` instead of `'java'`.
* This parameter is lowercased before it is used to reference an icon file.
* @param nameOrSuffix An optional suffix or a string to use as the file type. If a suffix is provided,
* it is used with the icon parameter to generate a file type string. If nothing is provided,
* `'document'` is used with the icon parameter to generate file type string.
*
* For example, if you call `darwinBundleDocumentType(..., 'HTML')`, the resulting file type is `"HTML document"`,
* and the `'html'` darwin icon is used.
*
* If you call `darwinBundleDocumentType(..., 'Javascript', 'file')`, the resulting file type is `"Javascript file"`.
* and the `'javascript'` darwin icon is used.
*
* If you call `darwinBundleDocumentType(..., 'bat', 'Windows command script')`, the file type is `"Windows command script"`,
* and the `'bat'` darwin icon is used.
*/
function darwinBundleDocumentType(extensions, icon, nameOrSuffix) {
// If given a suffix, generate a name from it. If not given anything, default to 'document'
if (isDocumentSuffix(nameOrSuffix) || !nameOrSuffix) {
nameOrSuffix = icon.charAt(0).toUpperCase() + icon.slice(1) + ' ' + (nameOrSuffix !== null && nameOrSuffix !== void 0 ? nameOrSuffix : 'document');
}
return {
name: product.nameLong + ' document',
name: nameOrSuffix,
role: 'Editor',
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
extensions: extensions,
iconFile: icon
iconFile: 'resources/darwin/' + icon + '.icns'
};
}
/**
* Generate several `DarwinDocumentType`s with unique names and a shared icon.
* @param types A map of file type names to their associated file extensions.
* @param icon A darwin icon resource to use. For example, `'HTML'` would refer to `resources/darwin/html.icns`
*
* Examples:
* ```
* darwinBundleDocumentTypes({ 'C header file': 'h', 'C source code': 'c' },'c')
* darwinBundleDocumentTypes({ 'React source code': ['jsx', 'tsx'] }, 'react')
* ```
*/
// {{SQL CARBON EDIT}} Remove unused
// function darwinBundleDocumentTypes(types: { [name: string]: string | string[] }, icon: string): DarwinDocumentType[] {
// return Object.keys(types).map((name: string): DarwinDocumentType => {
// const extensions = types[name];
// return {
// name: name,
// role: 'Editor',
// ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
// extensions: Array.isArray(extensions) ? extensions : [extensions],
// iconFile: 'resources/darwin/' + icon + '.icns',
// } as DarwinDocumentType;
// });
// }
exports.config = {
version: util.getElectronVersion(),
productAppName: product.nameLong,
@@ -35,7 +85,7 @@ exports.config = {
darwinHelpBookFolder: 'VS Code HelpBook',
darwinHelpBookName: 'VS Code HelpBook',
darwinBundleDocumentTypes: [
darwinBundleDocumentType(["csv", "json", "sqlplan", "sql", "xml"], 'resources/darwin/code_file.icns'),
darwinBundleDocumentType(['csv', 'json', 'sqlplan', 'sql', 'xml'], 'code_file'),
],
darwinBundleURLTypes: [{
role: 'Viewer',

View File

@@ -12,22 +12,84 @@ import * as filter from 'gulp-filter';
import * as _ from 'underscore';
import * as util from './util';
type DarwinDocumentSuffix = 'document' | 'script' | 'file' | 'source code';
type DarwinDocumentType = {
name: string,
role: string,
ostypes: string[],
extensions: string[],
iconFile: string,
};
function isDocumentSuffix(str?: string): str is DarwinDocumentSuffix {
return str === 'document' || str === 'script' || str === 'file' || str === 'source code';
}
const root = path.dirname(path.dirname(__dirname));
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
const commit = util.getVersion(root);
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
function darwinBundleDocumentType(extensions: string[], icon: string) {
/**
* Generate a `DarwinDocumentType` given a list of file extensions, an icon name, and an optional suffix or file type name.
* @param extensions A list of file extensions, such as `['bat', 'cmd']`
* @param icon A sentence-cased file type name that matches the lowercase name of a darwin icon resource.
* For example, `'HTML'` instead of `'html'`, or `'Java'` instead of `'java'`.
* This parameter is lowercased before it is used to reference an icon file.
* @param nameOrSuffix An optional suffix or a string to use as the file type. If a suffix is provided,
* it is used with the icon parameter to generate a file type string. If nothing is provided,
* `'document'` is used with the icon parameter to generate file type string.
*
* For example, if you call `darwinBundleDocumentType(..., 'HTML')`, the resulting file type is `"HTML document"`,
* and the `'html'` darwin icon is used.
*
* If you call `darwinBundleDocumentType(..., 'Javascript', 'file')`, the resulting file type is `"Javascript file"`.
* and the `'javascript'` darwin icon is used.
*
* If you call `darwinBundleDocumentType(..., 'bat', 'Windows command script')`, the file type is `"Windows command script"`,
* and the `'bat'` darwin icon is used.
*/
function darwinBundleDocumentType(extensions: string[], icon: string, nameOrSuffix?: string | DarwinDocumentSuffix): DarwinDocumentType {
// If given a suffix, generate a name from it. If not given anything, default to 'document'
if (isDocumentSuffix(nameOrSuffix) || !nameOrSuffix) {
nameOrSuffix = icon.charAt(0).toUpperCase() + icon.slice(1) + ' ' + (nameOrSuffix ?? 'document');
}
return {
name: product.nameLong + ' document',
name: nameOrSuffix,
role: 'Editor',
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
extensions: extensions,
iconFile: icon
iconFile: 'resources/darwin/' + icon + '.icns'
};
}
/**
* Generate several `DarwinDocumentType`s with unique names and a shared icon.
* @param types A map of file type names to their associated file extensions.
* @param icon A darwin icon resource to use. For example, `'HTML'` would refer to `resources/darwin/html.icns`
*
* Examples:
* ```
* darwinBundleDocumentTypes({ 'C header file': 'h', 'C source code': 'c' },'c')
* darwinBundleDocumentTypes({ 'React source code': ['jsx', 'tsx'] }, 'react')
* ```
*/
// {{SQL CARBON EDIT}} Remove unused
// function darwinBundleDocumentTypes(types: { [name: string]: string | string[] }, icon: string): DarwinDocumentType[] {
// return Object.keys(types).map((name: string): DarwinDocumentType => {
// const extensions = types[name];
// return {
// name: name,
// role: 'Editor',
// ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
// extensions: Array.isArray(extensions) ? extensions : [extensions],
// iconFile: 'resources/darwin/' + icon + '.icns',
// } as DarwinDocumentType;
// });
// }
export const config = {
version: util.getElectronVersion(),
productAppName: product.nameLong,
@@ -39,7 +101,7 @@ export const config = {
darwinHelpBookFolder: 'VS Code HelpBook',
darwinHelpBookName: 'VS Code HelpBook',
darwinBundleDocumentTypes: [
darwinBundleDocumentType(["csv", "json", "sqlplan", "sql", "xml"], 'resources/darwin/code_file.icns'),
darwinBundleDocumentType(['csv', 'json', 'sqlplan', 'sql', 'xml'], 'code_file'),
],
darwinBundleURLTypes: [{
role: 'Viewer',

View File

@@ -21,7 +21,7 @@ module.exports = new class {
const configs = context.options;
for (const config of configs) {
if (minimatch(context.getFilename(), config.target)) {
return utils_1.createImportRuleListener((node, value) => this._checkImport(context, config, node, value));
return (0, utils_1.createImportRuleListener)((node, value) => this._checkImport(context, config, node, value));
}
}
return {};
@@ -29,7 +29,7 @@ module.exports = new class {
_checkImport(context, config, node, path) {
// resolve relative paths
if (path[0] === '.') {
path = path_1.join(context.getFilename(), path);
path = (0, path_1.join)(context.getFilename(), path);
}
let restrictions;
if (typeof config.restrictions === 'string') {

View File

@@ -17,7 +17,7 @@ module.exports = new class {
};
}
create(context) {
const fileDirname = path_1.dirname(context.getFilename());
const fileDirname = (0, path_1.dirname)(context.getFilename());
const parts = fileDirname.split(/\\|\//);
const ruleArgs = context.options[0];
let config;
@@ -39,11 +39,11 @@ module.exports = new class {
// nothing
return {};
}
return utils_1.createImportRuleListener((node, path) => {
return (0, utils_1.createImportRuleListener)((node, path) => {
if (path[0] === '.') {
path = path_1.join(path_1.dirname(context.getFilename()), path);
path = (0, path_1.join)((0, path_1.dirname)(context.getFilename()), path);
}
const parts = path_1.dirname(path).split(/\\|\//);
const parts = (0, path_1.dirname)(path).split(/\\|\//);
for (let i = parts.length - 1; i >= 0; i--) {
const part = parts[i];
if (config.allowed.has(part)) {

View File

@@ -20,10 +20,10 @@ module.exports = new class NoNlsInStandaloneEditorRule {
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName)
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName)
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) {
return utils_1.createImportRuleListener((node, path) => {
return (0, utils_1.createImportRuleListener)((node, path) => {
// resolve relative paths
if (path[0] === '.') {
path = path_1.join(context.getFilename(), path);
path = (0, path_1.join)(context.getFilename(), path);
}
if (/vs(\/|\\)nls/.test(path)) {
context.report({

View File

@@ -21,10 +21,10 @@ module.exports = new class NoNlsInStandaloneEditorRule {
// the vs/editor folder is allowed to use the standalone editor
return {};
}
return utils_1.createImportRuleListener((node, path) => {
return (0, utils_1.createImportRuleListener)((node, path) => {
// resolve relative paths
if (path[0] === '.') {
path = path_1.join(context.getFilename(), path);
path = (0, path_1.join)(context.getFilename(), path);
}
if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path)
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path)

View File

@@ -15,7 +15,7 @@ module.exports = new (_a = class TranslationRemind {
};
}
create(context) {
return utils_1.createImportRuleListener((node, path) => this._checkImport(context, node, path));
return (0, utils_1.createImportRuleListener)((node, path) => this._checkImport(context, node, path));
}
_checkImport(context, node, path) {
if (path !== TranslationRemind.NLS_MODULE) {
@@ -31,7 +31,7 @@ module.exports = new (_a = class TranslationRemind {
let resourceDefined = false;
let json;
try {
json = fs_1.readFileSync('./build/lib/i18n.resources.json', 'utf8');
json = (0, fs_1.readFileSync)('./build/lib/i18n.resources.json', 'utf8');
}
catch (e) {
console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.');

View File

@@ -1,7 +1,7 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
module.exports = new class ApiVsCodeInComments {
constructor() {

View File

@@ -21,6 +21,8 @@ const fancyLog = require("fancy-log");
const ansiColors = require("ansi-colors");
const buffer = require('gulp-buffer');
const jsoncParser = require("jsonc-parser");
const dependencies_1 = require("./dependencies");
const _ = require("underscore");
const util = require('./util');
const root = path.dirname(path.dirname(__dirname));
const commit = util.getVersion(root);
@@ -145,7 +147,7 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
console.error(packagedDependencies);
result.emit('error', err);
});
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
return result.pipe((0, stats_1.createStatsStream)(path.basename(extensionPath)));
}
function fromLocalNormal(extensionPath) {
const result = es.through();
@@ -163,7 +165,7 @@ function fromLocalNormal(extensionPath) {
es.readArray(files).pipe(result);
})
.catch(err => result.emit('error', err));
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
return result.pipe((0, stats_1.createStatsStream)(path.basename(extensionPath)));
}
exports.fromLocalNormal = fromLocalNormal;
const baseHeaders = {
@@ -254,14 +256,30 @@ const productJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../produ
const builtInExtensions = productJson.builtInExtensions || [];
const webBuiltInExtensions = productJson.webBuiltInExtensions || [];
/**
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionsUtil.ts`
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionManifestPropertiesService.ts`
*/
function isWebExtension(manifest) {
if (Boolean(manifest.browser)) {
return true;
}
if (Boolean(manifest.main)) {
return false;
}
// neither browser nor main
if (typeof manifest.extensionKind !== 'undefined') {
const extensionKind = Array.isArray(manifest.extensionKind) ? manifest.extensionKind : [manifest.extensionKind];
return (extensionKind.indexOf('web') >= 0);
if (extensionKind.indexOf('web') >= 0) {
return true;
}
}
return (!Boolean(manifest.main) || Boolean(manifest.browser));
if (typeof manifest.contributes !== 'undefined') {
for (const id of ['debuggers', 'terminal', 'typescriptServerPlugins']) {
if (manifest.contributes.hasOwnProperty(id)) {
return false;
}
}
}
return true;
}
function packageLocalExtensionsStream(forWeb) {
const localExtensionsDescriptions = (glob.sync('extensions/*/package.json')
@@ -284,8 +302,10 @@ function packageLocalExtensionsStream(forWeb) {
result = localExtensionsStream;
}
else {
// also include shared node modules
result = es.merge(localExtensionsStream, gulp.src('extensions/node_modules/**', { base: '.' }));
// also include shared production node modules
const productionDependencies = (0, dependencies_1.getProductionDependencies)('extensions/');
const dependenciesSrc = _.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`]));
result = es.merge(localExtensionsStream, gulp.src(dependenciesSrc, { base: '.' }));
}
return (result
.pipe(util2.setExecutableBit(['**/*.sh'])));
@@ -400,7 +420,7 @@ function translatePackageJSON(packageJSON, packageNLSPath) {
else if (typeof val === 'string' && val.charCodeAt(0) === CharCode_PC && val.charCodeAt(val.length - 1) === CharCode_PC) {
const translated = packageNls[val.substr(1, val.length - 2)];
if (translated) {
obj[key] = translated;
obj[key] = typeof translated === 'string' ? translated : (typeof translated.message === 'string' ? translated.message : val);
}
}
}
@@ -470,7 +490,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
reject();
}
else {
reporter(stats.toJson());
reporter(stats === null || stats === void 0 ? void 0 : stats.toJson());
}
});
}
@@ -481,7 +501,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
reject();
}
else {
reporter(stats.toJson());
reporter(stats === null || stats === void 0 ? void 0 : stats.toJson());
resolve();
}
});

View File

@@ -21,6 +21,8 @@ import * as ansiColors from 'ansi-colors';
const buffer = require('gulp-buffer');
import * as jsoncParser from 'jsonc-parser';
import webpack = require('webpack');
import { getProductionDependencies } from './dependencies';
import _ = require('underscore');
const util = require('./util');
const root = path.dirname(path.dirname(__dirname));
const commit = util.getVersion(root);
@@ -303,19 +305,38 @@ const webBuiltInExtensions: IBuiltInExtension[] = productJson.webBuiltInExtensio
type ExtensionKind = 'ui' | 'workspace' | 'web';
interface IExtensionManifest {
main: string;
browser: string;
main?: string;
browser?: string;
extensionKind?: ExtensionKind | ExtensionKind[];
extensionPack?: string[];
extensionDependencies?: string[];
contributes?: { [id: string]: any };
}
/**
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionsUtil.ts`
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionManifestPropertiesService.ts`
*/
function isWebExtension(manifest: IExtensionManifest): boolean {
if (Boolean(manifest.browser)) {
return true;
}
if (Boolean(manifest.main)) {
return false;
}
// neither browser nor main
if (typeof manifest.extensionKind !== 'undefined') {
const extensionKind = Array.isArray(manifest.extensionKind) ? manifest.extensionKind : [manifest.extensionKind];
return (extensionKind.indexOf('web') >= 0);
if (extensionKind.indexOf('web') >= 0) {
return true;
}
}
return (!Boolean(manifest.main) || Boolean(manifest.browser));
if (typeof manifest.contributes !== 'undefined') {
for (const id of ['debuggers', 'terminal', 'typescriptServerPlugins']) {
if (manifest.contributes.hasOwnProperty(id)) {
return false;
}
}
}
return true;
}
export function packageLocalExtensionsStream(forWeb: boolean): Stream {
@@ -344,8 +365,10 @@ export function packageLocalExtensionsStream(forWeb: boolean): Stream {
if (forWeb) {
result = localExtensionsStream;
} else {
// also include shared node modules
result = es.merge(localExtensionsStream, gulp.src('extensions/node_modules/**', { base: '.' }));
// also include shared production node modules
const productionDependencies = getProductionDependencies('extensions/');
const dependenciesSrc = _.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`]));
result = es.merge(localExtensionsStream, gulp.src(dependenciesSrc, { base: '.' }));
}
return (
@@ -469,8 +492,11 @@ export function packageRebuildExtensionsStream(): NodeJS.ReadWriteStream {
// {{SQL CARBON EDIT}} end
export function translatePackageJSON(packageJSON: string, packageNLSPath: string) {
interface NLSFormat {
[key: string]: string | { message: string, comment: string[] };
}
const CharCode_PC = '%'.charCodeAt(0);
const packageNls = JSON.parse(fs.readFileSync(packageNLSPath).toString());
const packageNls: NLSFormat = JSON.parse(fs.readFileSync(packageNLSPath).toString());
const translate = (obj: any) => {
for (let key in obj) {
const val = obj[key];
@@ -481,7 +507,7 @@ export function translatePackageJSON(packageJSON: string, packageNLSPath: string
} else if (typeof val === 'string' && val.charCodeAt(0) === CharCode_PC && val.charCodeAt(val.length - 1) === CharCode_PC) {
const translated = packageNls[val.substr(1, val.length - 2)];
if (translated) {
obj[key] = translated;
obj[key] = typeof translated === 'string' ? translated : (typeof translated.message === 'string' ? translated.message : val);
}
}
}
@@ -556,7 +582,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
if (err) {
reject();
} else {
reporter(stats.toJson());
reporter(stats?.toJson());
}
});
} else {
@@ -565,7 +591,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
fancyLog.error(err);
reject();
} else {
reporter(stats.toJson());
reporter(stats?.toJson());
resolve();
}
});

View File

@@ -466,7 +466,7 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
});
}
function processNlsFiles(opts) {
return event_stream_1.through(function (file) {
return (0, event_stream_1.through)(function (file) {
let fileName = path.basename(file.path);
if (fileName === 'nls.metadata.json') {
let json = null;
@@ -524,7 +524,7 @@ function getResource(sourceFile) {
}
exports.getResource = getResource;
function createXlfFilesForCoreBundle() {
return event_stream_1.through(function (file) {
return (0, event_stream_1.through)(function (file) {
const basename = path.basename(file.path);
if (basename === 'nls.metadata.json') {
if (file.isBuffer()) {
@@ -579,7 +579,7 @@ function createXlfFilesForExtensions() {
let counter = 0;
let folderStreamEnded = false;
let folderStreamEndEmitted = false;
return event_stream_1.through(function (extensionFolder) {
return (0, event_stream_1.through)(function (extensionFolder) {
const folderStream = this;
const stat = fs.statSync(extensionFolder.path);
if (!stat.isDirectory()) {
@@ -597,7 +597,7 @@ function createXlfFilesForExtensions() {
}
return _xlf;
}
gulp.src([`.build/extensions/${extensionName}/package.nls.json`, `.build/extensions/${extensionName}/**/nls.metadata.json`], { allowEmpty: true }).pipe(event_stream_1.through(function (file) {
gulp.src([`.build/extensions/${extensionName}/package.nls.json`, `.build/extensions/${extensionName}/**/nls.metadata.json`], { allowEmpty: true }).pipe((0, event_stream_1.through)(function (file) {
if (file.isBuffer()) {
const buffer = file.contents;
const basename = path.basename(file.path);
@@ -656,7 +656,7 @@ function createXlfFilesForExtensions() {
}
exports.createXlfFilesForExtensions = createXlfFilesForExtensions;
function createXlfFilesForIsl() {
return event_stream_1.through(function (file) {
return (0, event_stream_1.through)(function (file) {
let projectName, resourceFile;
if (path.basename(file.path) === 'messages.en.isl') {
projectName = setupProject;
@@ -709,7 +709,7 @@ exports.createXlfFilesForIsl = createXlfFilesForIsl;
function pushXlfFiles(apiHostname, username, password) {
let tryGetPromises = [];
let updateCreatePromises = [];
return event_stream_1.through(function (file) {
return (0, event_stream_1.through)(function (file) {
const project = path.dirname(file.relative);
const fileName = path.basename(file.path);
const slug = fileName.substr(0, fileName.length - '.xlf'.length);
@@ -771,7 +771,7 @@ function getAllResources(project, apiHostname, username, password) {
function findObsoleteResources(apiHostname, username, password) {
let resourcesByProject = Object.create(null);
resourcesByProject[extensionsProject] = [].concat(exports.externalExtensionsWithTranslations); // clone
return event_stream_1.through(function (file) {
return (0, event_stream_1.through)(function (file) {
const project = path.dirname(file.relative);
const fileName = path.basename(file.path);
const slug = fileName.substr(0, fileName.length - '.xlf'.length);
@@ -923,7 +923,7 @@ function pullXlfFiles(apiHostname, username, password, language, resources) {
const credentials = `${username}:${password}`;
let expectedTranslationsCount = resources.length;
let translationsRetrieved = 0, called = false;
return event_stream_1.readable(function (_count, callback) {
return (0, event_stream_1.readable)(function (_count, callback) {
// Mark end of stream when all resources were retrieved
if (translationsRetrieved === expectedTranslationsCount) {
return this.emit('end');
@@ -981,7 +981,7 @@ function retrieveResource(language, resource, apiHostname, credentials) {
}
function prepareI18nFiles() {
let parsePromises = [];
return event_stream_1.through(function (xlf) {
return (0, event_stream_1.through)(function (xlf) {
let stream = this;
let parsePromise = XLF.parse(xlf.contents.toString());
parsePromises.push(parsePromise);
@@ -1026,7 +1026,7 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse
let mainPack = { version: exports.i18nPackVersion, contents: {} };
let extensionsPacks = {};
let errors = [];
return event_stream_1.through(function (xlf) {
return (0, event_stream_1.through)(function (xlf) {
let project = path.basename(path.dirname(path.dirname(xlf.relative)));
let resource = path.basename(xlf.relative, '.xlf');
let contents = xlf.contents.toString();
@@ -1088,7 +1088,7 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse
exports.prepareI18nPackFiles = prepareI18nPackFiles;
function prepareIslFiles(language, innoSetupConfig) {
let parsePromises = [];
return event_stream_1.through(function (xlf) {
return (0, event_stream_1.through)(function (xlf) {
let stream = this;
let parsePromise = XLF.parse(xlf.contents.toString());
parsePromises.push(parsePromise);

View File

@@ -46,6 +46,10 @@
"name": "vs/workbench/contrib/callHierarchy",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/typeHierarchy",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/codeActions",
"project": "vscode-workbench"
@@ -94,6 +98,10 @@
"name": "vs/workbench/contrib/issue",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/interactive",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/keybindings",
"project": "vscode-workbench"
@@ -246,6 +254,10 @@
"name": "vs/workbench/contrib/views",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/languageDetection",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/actions",
"project": "vscode-workbench"

View File

@@ -199,7 +199,7 @@ const RULES = [
]
}
];
const TS_CONFIG_PATH = path_1.join(__dirname, '../../', 'src', 'tsconfig.json');
const TS_CONFIG_PATH = (0, path_1.join)(__dirname, '../../', 'src', 'tsconfig.json');
let hasErrors = false;
function checkFile(program, sourceFile, rule) {
checkNode(sourceFile);
@@ -250,8 +250,8 @@ function checkFile(program, sourceFile, rule) {
}
function createProgram(tsconfigPath) {
const tsConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
const configHostParser = { fileExists: fs_1.existsSync, readDirectory: ts.sys.readDirectory, readFile: file => fs_1.readFileSync(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' };
const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, path_1.resolve(path_1.dirname(tsconfigPath)), { noEmit: true });
const configHostParser = { fileExists: fs_1.existsSync, readDirectory: ts.sys.readDirectory, readFile: file => (0, fs_1.readFileSync)(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' };
const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, (0, path_1.resolve)((0, path_1.dirname)(tsconfigPath)), { noEmit: true });
const compilerHost = ts.createCompilerHost(tsConfigParsed.options, true);
return ts.createProgram(tsConfigParsed.fileNames, tsConfigParsed.options, compilerHost);
}
@@ -261,7 +261,7 @@ function createProgram(tsconfigPath) {
const program = createProgram(TS_CONFIG_PATH);
for (const sourceFile of program.getSourceFiles()) {
for (const rule of RULES) {
if (minimatch_1.match([sourceFile.fileName], rule.target).length > 0) {
if ((0, minimatch_1.match)([sourceFile.fileName], rule.target).length > 0) {
if (!rule.skip) {
checkFile(program, sourceFile, rule);
}

View File

@@ -96,7 +96,7 @@ function modifyI18nPackFiles(existingTranslationFolder, resultingTranslationPath
let mainPack = { version: i18n.i18nPackVersion, contents: {} };
let extensionsPacks = {};
let errors = [];
return event_stream_1.through(function (xlf) {
return (0, event_stream_1.through)(function (xlf) {
let rawResource = path.basename(xlf.relative, '.xlf');
let resource = rawResource.substring(0, rawResource.lastIndexOf('.'));
let contents = xlf.contents.toString();

View File

@@ -53,8 +53,8 @@ define([], [${wrap + lines.map(l => indent + l).join(',\n') + wrap}]);`;
* Returns a stream containing the patched JavaScript and source maps.
*/
function nls() {
const input = event_stream_1.through();
const output = input.pipe(event_stream_1.through(function (f) {
const input = (0, event_stream_1.through)();
const output = input.pipe((0, event_stream_1.through)(function (f) {
if (!f.sourceMap) {
return this.emit('error', new Error(`File ${f.relative} does not have sourcemaps.`));
}
@@ -72,7 +72,7 @@ function nls() {
}
_nls.patchFiles(f, typescript).forEach(f => this.emit('data', f));
}));
return event_stream_1.duplex(input, output);
return (0, event_stream_1.duplex)(input, output);
}
exports.nls = nls;
function isImportNode(ts, node) {

View File

@@ -98,7 +98,7 @@ function toConcatStream(src, bundledFileHeader, sources, dest, fileContentMapper
return es.readArray(treatedSources)
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
.pipe(concat(dest))
.pipe(stats_1.createStatsStream(dest));
.pipe((0, stats_1.createStatsStream)(dest));
}
function toBundleStream(src, bundledFileHeader, bundles, fileContentMapper) {
return es.merge(bundles.map(function (bundle) {
@@ -155,7 +155,7 @@ function optimizeTask(opts) {
addComment: true,
includeContent: true
}))
.pipe(opts.languages && opts.languages.length ? i18n_1.processNlsFiles({
.pipe(opts.languages && opts.languages.length ? (0, i18n_1.processNlsFiles)({
fileHeader: bundledFileHeader,
languages: opts.languages
}) : es.through())
@@ -179,7 +179,7 @@ function minifyTask(src, sourceMapBaseUrl) {
sourcemap: 'external',
outdir: '.',
platform: 'node',
target: ['node14.16'],
target: ['esnext'],
write: false
}).then(res => {
const jsFile = res.outputFiles.find(f => /\.js$/.test(f.path));

View File

@@ -256,7 +256,7 @@ export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) =>
sourcemap: 'external',
outdir: '.',
platform: 'node',
target: ['node14.16'],
target: ['esnext'],
write: false
}).then(res => {
const jsFile = res.outputFiles.find(f => /\.js$/.test(f.path))!;

View File

@@ -12,7 +12,7 @@ const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
const rootDir = path.resolve(__dirname, '..', '..');
function runProcess(command, args = []) {
return new Promise((resolve, reject) => {
const child = child_process_1.spawn(command, args, { cwd: rootDir, stdio: 'inherit', env: process.env });
const child = (0, child_process_1.spawn)(command, args, { cwd: rootDir, stdio: 'inherit', env: process.env });
child.on('exit', err => !err ? resolve() : process.exit(err !== null && err !== void 0 ? err : 1));
child.on('error', reject);
});

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
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.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");
@@ -274,3 +274,51 @@ function getElectronVersion() {
return target;
}
exports.getElectronVersion = getElectronVersion;
function acquireWebNodePaths() {
var _a;
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 = {};
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'));
let entryPoint = typeof packageData.browser === 'string' ? packageData.browser : (_a = packageData.main) !== null && _a !== void 0 ? _a : packageData.main; // {{SQL CARBON EDIT}} Some packages (like Turndown) have objects in this field instead of the entry point, fall back to main in that case
// On rare cases a package doesn't have an entrypoint so we assume it has a dist folder with a min.js
if (!entryPoint) {
console.warn(`No entry point for ${key} assuming dist/${key}.min.js`);
entryPoint = `dist/${key}.min.js`;
}
// Remove any starting path information so it's all relative info
if (entryPoint.startsWith('./')) {
entryPoint = entryPoint.substr(2);
}
else if (entryPoint.startsWith('/')) {
entryPoint = entryPoint.substr(1);
}
nodePaths[key] = entryPoint;
}
return nodePaths;
}
exports.acquireWebNodePaths = acquireWebNodePaths;
function buildWebNodePaths(outDir) {
const result = () => new Promise((resolve, _) => {
const root = path.join(__dirname, '..', '..');
const nodePaths = acquireWebNodePaths();
// Now we write the node paths to out/vs
const outDirectory = path.join(root, outDir, 'vs');
fs.mkdirSync(outDirectory, { recursive: true });
const headerWithGeneratedFileWarning = `/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// This file is generated by build/npm/postinstall.js. Do not edit.`;
const fileContents = `${headerWithGeneratedFileWarning}\nself.webPackagePaths = ${JSON.stringify(nodePaths, null, 2)};`;
fs.writeFileSync(path.join(outDirectory, 'webPackagePaths.js'), fileContents, 'utf8');
resolve();
});
result.taskName = 'build-web-node-paths';
return result;
}
exports.buildWebNodePaths = buildWebNodePaths;

View File

@@ -340,3 +340,50 @@ export function getElectronVersion(): string {
const target = /^target "(.*)"$/m.exec(yarnrc)![1];
return target;
}
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 } = {};
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'));
let entryPoint = typeof packageData.browser === 'string' ? packageData.browser : packageData.main ?? packageData.main; // {{SQL CARBON EDIT}} Some packages (like Turndown) have objects in this field instead of the entry point, fall back to main in that case
// On rare cases a package doesn't have an entrypoint so we assume it has a dist folder with a min.js
if (!entryPoint) {
console.warn(`No entry point for ${key} assuming dist/${key}.min.js`);
entryPoint = `dist/${key}.min.js`;
}
// Remove any starting path information so it's all relative info
if (entryPoint.startsWith('./')) {
entryPoint = entryPoint.substr(2);
} else if (entryPoint.startsWith('/')) {
entryPoint = entryPoint.substr(1);
}
nodePaths[key] = entryPoint;
}
return nodePaths;
}
export function buildWebNodePaths(outDir: string) {
const result = () => new Promise<void>((resolve, _) => {
const root = path.join(__dirname, '..', '..');
const nodePaths = acquireWebNodePaths();
// Now we write the node paths to out/vs
const outDirectory = path.join(root, outDir, 'vs');
fs.mkdirSync(outDirectory, { recursive: true });
const headerWithGeneratedFileWarning = `/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// This file is generated by build/npm/postinstall.js. Do not edit.`;
const fileContents = `${headerWithGeneratedFileWarning}\nself.webPackagePaths = ${JSON.stringify(nodePaths, null, 2)};`;
fs.writeFileSync(path.join(outDirectory, 'webPackagePaths.js'), fileContents, 'utf8');
resolve();
});
result.taskName = 'build-web-node-paths';
return result;
}