mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -17,7 +17,7 @@ import { Stream } from 'stream';
|
||||
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
interface IExtensionDefinition {
|
||||
export interface IExtensionDefinition {
|
||||
name: string;
|
||||
version: string;
|
||||
repo: string;
|
||||
|
||||
79
build/lib/builtInExtensionsCG.js
Normal file
79
build/lib/builtInExtensionsCG.js
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const got_1 = require("got");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const ansiColors = require("ansi-colors");
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
const rootCG = path.join(root, 'extensionsCG');
|
||||
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../product.json'), 'utf8'));
|
||||
const builtInExtensions = productjson.builtInExtensions;
|
||||
const webBuiltInExtensions = productjson.webBuiltInExtensions;
|
||||
const token = process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined;
|
||||
const contentBasePath = 'raw.githubusercontent.com';
|
||||
const contentFileNames = ['package.json', 'package-lock.json', 'yarn.lock'];
|
||||
async function downloadExtensionDetails(extension) {
|
||||
var _a, _b, _c;
|
||||
const extensionLabel = `${extension.name}@${extension.version}`;
|
||||
const repository = url.parse(extension.repo).path.substr(1);
|
||||
const repositoryContentBaseUrl = `https://${token ? `${token}@` : ''}${contentBasePath}/${repository}/v${extension.version}`;
|
||||
const promises = [];
|
||||
for (const fileName of contentFileNames) {
|
||||
promises.push(new Promise(resolve => {
|
||||
got_1.default(`${repositoryContentBaseUrl}/${fileName}`)
|
||||
.then(response => {
|
||||
resolve({ fileName, body: response.rawBody });
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response.statusCode === 404) {
|
||||
resolve({ fileName, body: undefined });
|
||||
}
|
||||
else {
|
||||
resolve({ fileName, body: null });
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
console.log(extensionLabel);
|
||||
const results = await Promise.all(promises);
|
||||
for (const result of results) {
|
||||
if (result.body) {
|
||||
const extensionFolder = path.join(rootCG, extension.name);
|
||||
fs.mkdirSync(extensionFolder, { recursive: true });
|
||||
fs.writeFileSync(path.join(extensionFolder, result.fileName), result.body);
|
||||
console.log(` - ${result.fileName} ${ansiColors.green('✔︎')}`);
|
||||
}
|
||||
else if (result.body === undefined) {
|
||||
console.log(` - ${result.fileName} ${ansiColors.yellow('⚠️')}`);
|
||||
}
|
||||
else {
|
||||
console.log(` - ${result.fileName} ${ansiColors.red('🛑')}`);
|
||||
}
|
||||
}
|
||||
// Validation
|
||||
if (!((_a = results.find(r => r.fileName === 'package.json')) === null || _a === void 0 ? void 0 : _a.body)) {
|
||||
// throw new Error(`The "package.json" file could not be found for the built-in extension - ${extensionLabel}`);
|
||||
}
|
||||
if (!((_b = results.find(r => r.fileName === 'package-lock.json')) === null || _b === void 0 ? void 0 : _b.body) &&
|
||||
!((_c = results.find(r => r.fileName === 'yarn.lock')) === null || _c === void 0 ? void 0 : _c.body)) {
|
||||
// throw new Error(`The "package-lock.json"/"yarn.lock" could not be found for the built-in extension - ${extensionLabel}`);
|
||||
}
|
||||
}
|
||||
async function main() {
|
||||
for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
|
||||
await downloadExtensionDetails(extension);
|
||||
}
|
||||
}
|
||||
main().then(() => {
|
||||
console.log(`Built-in extensions component data downloaded ${ansiColors.green('✔︎')}`);
|
||||
process.exit(0);
|
||||
}, err => {
|
||||
console.log(`Built-in extensions component data could not be downloaded ${ansiColors.red('🛑')}`);
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
83
build/lib/builtInExtensionsCG.ts
Normal file
83
build/lib/builtInExtensionsCG.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import got from 'got';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
import ansiColors = require('ansi-colors');
|
||||
import { IExtensionDefinition } from './builtInExtensions';
|
||||
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
const rootCG = path.join(root, 'extensionsCG');
|
||||
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../product.json'), 'utf8'));
|
||||
const builtInExtensions = <IExtensionDefinition[]>productjson.builtInExtensions;
|
||||
const webBuiltInExtensions = <IExtensionDefinition[]>productjson.webBuiltInExtensions;
|
||||
const token = process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined;
|
||||
|
||||
const contentBasePath = 'raw.githubusercontent.com';
|
||||
const contentFileNames = ['package.json', 'package-lock.json', 'yarn.lock'];
|
||||
|
||||
async function downloadExtensionDetails(extension: IExtensionDefinition): Promise<void> {
|
||||
const extensionLabel = `${extension.name}@${extension.version}`;
|
||||
const repository = url.parse(extension.repo).path!.substr(1);
|
||||
const repositoryContentBaseUrl = `https://${token ? `${token}@` : ''}${contentBasePath}/${repository}/v${extension.version}`;
|
||||
|
||||
const promises = [];
|
||||
for (const fileName of contentFileNames) {
|
||||
promises.push(new Promise<{ fileName: string, body: Buffer | undefined | null }>(resolve => {
|
||||
got(`${repositoryContentBaseUrl}/${fileName}`)
|
||||
.then(response => {
|
||||
resolve({ fileName, body: response.rawBody });
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response.statusCode === 404) {
|
||||
resolve({ fileName, body: undefined });
|
||||
} else {
|
||||
resolve({ fileName, body: null });
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
console.log(extensionLabel);
|
||||
const results = await Promise.all(promises);
|
||||
for (const result of results) {
|
||||
if (result.body) {
|
||||
const extensionFolder = path.join(rootCG, extension.name);
|
||||
fs.mkdirSync(extensionFolder, { recursive: true });
|
||||
fs.writeFileSync(path.join(extensionFolder, result.fileName), result.body);
|
||||
console.log(` - ${result.fileName} ${ansiColors.green('✔︎')}`);
|
||||
} else if (result.body === undefined) {
|
||||
console.log(` - ${result.fileName} ${ansiColors.yellow('⚠️')}`);
|
||||
} else {
|
||||
console.log(` - ${result.fileName} ${ansiColors.red('🛑')}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Validation
|
||||
if (!results.find(r => r.fileName === 'package.json')?.body) {
|
||||
// throw new Error(`The "package.json" file could not be found for the built-in extension - ${extensionLabel}`);
|
||||
}
|
||||
if (!results.find(r => r.fileName === 'package-lock.json')?.body &&
|
||||
!results.find(r => r.fileName === 'yarn.lock')?.body) {
|
||||
// throw new Error(`The "package-lock.json"/"yarn.lock" could not be found for the built-in extension - ${extensionLabel}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
|
||||
await downloadExtensionDetails(extension);
|
||||
}
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
console.log(`Built-in extensions component data downloaded ${ansiColors.green('✔︎')}`);
|
||||
process.exit(0);
|
||||
}, err => {
|
||||
console.log(`Built-in extensions component data could not be downloaded ${ansiColors.red('🛑')}`);
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -28,7 +28,7 @@ exports.config = {
|
||||
version: util.getElectronVersion(),
|
||||
productAppName: product.nameLong,
|
||||
companyName: 'Microsoft Corporation',
|
||||
copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',
|
||||
copyright: 'Copyright (C) 2021 Microsoft. All rights reserved',
|
||||
darwinIcon: 'resources/darwin/code.icns',
|
||||
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
||||
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
||||
|
||||
@@ -32,7 +32,7 @@ export const config = {
|
||||
version: util.getElectronVersion(),
|
||||
productAppName: product.nameLong,
|
||||
companyName: 'Microsoft Corporation',
|
||||
copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',
|
||||
copyright: 'Copyright (C) 2021 Microsoft. All rights reserved',
|
||||
darwinIcon: 'resources/darwin/code.icns',
|
||||
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
||||
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
||||
|
||||
@@ -237,14 +237,14 @@ XLF.parse = function (xlfString) {
|
||||
}
|
||||
let val = unit.target[0];
|
||||
if (typeof val !== 'string') {
|
||||
val = val._;
|
||||
// We allow empty source values so support them for translations as well.
|
||||
val = val._ ? val._ : '';
|
||||
}
|
||||
if (key && val) {
|
||||
messages[key] = decodeEntities(val);
|
||||
}
|
||||
else {
|
||||
reject(new Error(`XLF parsing error: XLIFF file ${originalFilePath} does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.`));
|
||||
if (!key) {
|
||||
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${originalFilePath} is missing the ID attribute.`));
|
||||
return;
|
||||
}
|
||||
messages[key] = decodeEntities(val);
|
||||
});
|
||||
files.push({ messages: messages, originalFilePath: originalFilePath, language: language.toLowerCase() });
|
||||
}
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
"name": "vs/workbench/api/common",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/backup",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/bulkEdit",
|
||||
"project": "vscode-workbench"
|
||||
@@ -218,6 +214,10 @@
|
||||
"name": "vs/workbench/contrib/webviewPanel",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/workspace",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/workspaces",
|
||||
"project": "vscode-workbench"
|
||||
@@ -254,6 +254,10 @@
|
||||
"name": "vs/workbench/services/authToken",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/backup",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/bulkEdit",
|
||||
"project": "vscode-workbench"
|
||||
@@ -294,6 +298,10 @@
|
||||
"name": "vs/workbench/services/files",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/history",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/log",
|
||||
"project": "vscode-workbench"
|
||||
@@ -389,6 +397,10 @@
|
||||
{
|
||||
"name": "vs/workbench/services/gettingStarted",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/host",
|
||||
"project": "vscode-workbench"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -339,13 +339,14 @@ export class XLF {
|
||||
|
||||
let val = unit.target[0];
|
||||
if (typeof val !== 'string') {
|
||||
val = val._;
|
||||
// We allow empty source values so support them for translations as well.
|
||||
val = val._ ? val._ : '';
|
||||
}
|
||||
if (key && val) {
|
||||
messages[key] = decodeEntities(val);
|
||||
} else {
|
||||
reject(new Error(`XLF parsing error: XLIFF file ${originalFilePath} does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.`));
|
||||
if (!key) {
|
||||
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${originalFilePath} is missing the ID attribute.`));
|
||||
return;
|
||||
}
|
||||
messages[key] = decodeEntities(val);
|
||||
});
|
||||
files.push({ messages: messages, originalFilePath: originalFilePath, language: language.toLowerCase() });
|
||||
}
|
||||
|
||||
@@ -56,7 +56,9 @@ const CORE_TYPES = [
|
||||
const NATIVE_TYPES = [
|
||||
'NativeParsedArgs',
|
||||
'INativeEnvironmentService',
|
||||
'INativeWindowConfiguration'
|
||||
'AbstractNativeEnvironmentService',
|
||||
'INativeWindowConfiguration',
|
||||
'ICommonNativeHostService'
|
||||
];
|
||||
const RULES = [
|
||||
// Tests: skip
|
||||
@@ -79,19 +81,9 @@ const RULES = [
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
// Common: vs/platform/environment/common/argv.ts
|
||||
// Common: vs/platform/environment/common/*
|
||||
{
|
||||
target: '**/{vs,sql}/platform/environment/common/argv.ts',
|
||||
disallowedTypes: [ /* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
'lib.dom.d.ts',
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
// Common: vs/platform/environment/common/environment.ts
|
||||
{
|
||||
target: '**/{vs,sql}/platform/environment/common/environment.ts',
|
||||
target: '**/{vs,sql}/platform/environment/common/*.ts',
|
||||
disallowedTypes: [ /* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
@@ -109,6 +101,16 @@ const RULES = [
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
// Common: vs/platform/native/common/native.ts
|
||||
{
|
||||
target: '**/vs/platform/native/common/native.ts',
|
||||
disallowedTypes: [ /* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
'lib.dom.d.ts',
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
// Common: vs/workbench/api/common/extHostExtensionService.ts
|
||||
{
|
||||
target: '**/{vs,sql}/workbench/api/common/extHostExtensionService.ts',
|
||||
@@ -197,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);
|
||||
@@ -248,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);
|
||||
}
|
||||
@@ -259,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);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ const CORE_TYPES = [
|
||||
const NATIVE_TYPES = [
|
||||
'NativeParsedArgs',
|
||||
'INativeEnvironmentService',
|
||||
'INativeWindowConfiguration'
|
||||
'AbstractNativeEnvironmentService',
|
||||
'INativeWindowConfiguration',
|
||||
'ICommonNativeHostService'
|
||||
];
|
||||
|
||||
const RULES = [
|
||||
@@ -86,20 +88,9 @@ const RULES = [
|
||||
]
|
||||
},
|
||||
|
||||
// Common: vs/platform/environment/common/argv.ts
|
||||
// Common: vs/platform/environment/common/*
|
||||
{
|
||||
target: '**/{vs,sql}/platform/environment/common/argv.ts',
|
||||
disallowedTypes: [/* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
'lib.dom.d.ts', // no DOM
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
|
||||
// Common: vs/platform/environment/common/environment.ts
|
||||
{
|
||||
target: '**/{vs,sql}/platform/environment/common/environment.ts',
|
||||
target: '**/{vs,sql}/platform/environment/common/*.ts',
|
||||
disallowedTypes: [/* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
@@ -119,6 +110,17 @@ const RULES = [
|
||||
]
|
||||
},
|
||||
|
||||
// Common: vs/platform/native/common/native.ts
|
||||
{
|
||||
target: '**/vs/platform/native/common/native.ts',
|
||||
disallowedTypes: [/* Ignore native types that are defined from here */],
|
||||
allowedTypes: CORE_TYPES,
|
||||
disallowedDefinitions: [
|
||||
'lib.dom.d.ts', // no DOM
|
||||
'@types/node' // no node.js
|
||||
]
|
||||
},
|
||||
|
||||
// Common: vs/workbench/api/common/extHostExtensionService.ts
|
||||
{
|
||||
target: '**/{vs,sql}/workbench/api/common/extHostExtensionService.ts',
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rollupAngular = void 0;
|
||||
const fs = require("fs");
|
||||
const rollup = require("rollup");
|
||||
const path = require("path");
|
||||
// getting around stupid import rules
|
||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
async function rollupModule(options) {
|
||||
const moduleName = options.moduleName;
|
||||
try {
|
||||
const inputFile = options.inputFile;
|
||||
const outputDirectory = options.outputDirectory;
|
||||
await fs.promises.mkdir(outputDirectory, {
|
||||
recursive: true
|
||||
});
|
||||
const outputFileName = options.outputFileName;
|
||||
const outputMapName = `${outputFileName}.map`;
|
||||
const external = options.external || [];
|
||||
const outputFilePath = path.resolve(outputDirectory, outputFileName);
|
||||
const outputMapPath = path.resolve(outputDirectory, outputMapName);
|
||||
const bundle = await rollup.rollup({
|
||||
input: inputFile,
|
||||
plugins: [
|
||||
nodeResolve(),
|
||||
commonjs(),
|
||||
],
|
||||
external,
|
||||
});
|
||||
const generatedBundle = await bundle.generate({
|
||||
name: moduleName,
|
||||
format: 'umd',
|
||||
sourcemap: true
|
||||
});
|
||||
const result = generatedBundle.output[0];
|
||||
result.code = result.code + '\n//# sourceMappingURL=' + path.basename(outputMapName);
|
||||
await fs.promises.writeFile(outputFilePath, result.code);
|
||||
await fs.promises.writeFile(outputMapPath, result.map);
|
||||
return {
|
||||
name: moduleName,
|
||||
result: true
|
||||
};
|
||||
}
|
||||
catch (ex) {
|
||||
return {
|
||||
name: moduleName,
|
||||
result: false,
|
||||
exception: ex
|
||||
};
|
||||
}
|
||||
}
|
||||
function rollupAngular(root) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const modules = ['core', 'animations', 'common', 'compiler', 'forms', 'platform-browser', 'platform-browser-dynamic', 'router'];
|
||||
const tasks = modules.map((module) => {
|
||||
return rollupModule({
|
||||
moduleName: `ng.${module}`,
|
||||
inputFile: path.resolve(root, 'node_modules', '@angular', module, '@angular', `${module}.es5.js`),
|
||||
outputDirectory: path.resolve(root, 'node_modules', '@angular', module, 'bundles'),
|
||||
outputFileName: `${module}.umd.js`,
|
||||
external: modules.map(mn => `@angular/${mn}`)
|
||||
});
|
||||
});
|
||||
// array of booleans
|
||||
const x = await Promise.all(tasks);
|
||||
const result = x.reduce((prev, current) => {
|
||||
if (!current.result) {
|
||||
prev.fails.push(current.name);
|
||||
prev.exceptions.push(current.exception);
|
||||
prev.result = false;
|
||||
}
|
||||
return prev;
|
||||
}, {
|
||||
fails: [],
|
||||
exceptions: [],
|
||||
result: true,
|
||||
});
|
||||
if (!result.result) {
|
||||
return reject(`failures: ${result.fails} - exceptions: ${JSON.stringify(result.exceptions)}`);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
exports.rollupAngular = rollupAngular;
|
||||
@@ -1,109 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as rollup from 'rollup';
|
||||
import * as path from 'path';
|
||||
|
||||
// getting around stupid import rules
|
||||
const nodeResolve = require('rollup-plugin-node-resolve');
|
||||
const commonjs = require('rollup-plugin-commonjs');
|
||||
|
||||
export interface IRollupOptions {
|
||||
moduleName: string;
|
||||
inputFile: string;
|
||||
outputDirectory: string;
|
||||
outputFileName: string;
|
||||
external?: string[];
|
||||
}
|
||||
|
||||
async function rollupModule(options: IRollupOptions) {
|
||||
const moduleName = options.moduleName;
|
||||
try {
|
||||
const inputFile = options.inputFile;
|
||||
const outputDirectory = options.outputDirectory;
|
||||
|
||||
await fs.promises.mkdir(outputDirectory, {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
const outputFileName = options.outputFileName;
|
||||
const outputMapName = `${outputFileName}.map`;
|
||||
const external = options.external || [];
|
||||
|
||||
const outputFilePath = path.resolve(outputDirectory, outputFileName);
|
||||
const outputMapPath = path.resolve(outputDirectory, outputMapName);
|
||||
|
||||
const bundle = await rollup.rollup({
|
||||
input: inputFile,
|
||||
plugins: [
|
||||
nodeResolve(),
|
||||
commonjs(),
|
||||
],
|
||||
external,
|
||||
});
|
||||
|
||||
const generatedBundle = await bundle.generate({
|
||||
name: moduleName,
|
||||
format: 'umd',
|
||||
sourcemap: true
|
||||
});
|
||||
|
||||
const result = generatedBundle.output[0];
|
||||
result.code = result.code + '\n//# sourceMappingURL=' + path.basename(outputMapName);
|
||||
|
||||
await fs.promises.writeFile(outputFilePath, result.code);
|
||||
await fs.promises.writeFile(outputMapPath, result.map);
|
||||
|
||||
return {
|
||||
name: moduleName,
|
||||
result: true
|
||||
};
|
||||
} catch (ex) {
|
||||
return {
|
||||
name: moduleName,
|
||||
result: false,
|
||||
exception: ex
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function rollupAngular(root: string): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
|
||||
const modules = ['core', 'animations', 'common', 'compiler', 'forms', 'platform-browser', 'platform-browser-dynamic', 'router'];
|
||||
const tasks = modules.map((module) => {
|
||||
return rollupModule({
|
||||
moduleName: `ng.${module}`,
|
||||
inputFile: path.resolve(root, 'node_modules', '@angular', module, '@angular', `${module}.es5.js`),
|
||||
outputDirectory: path.resolve(root, 'node_modules', '@angular', module, 'bundles'),
|
||||
outputFileName: `${module}.umd.js`,
|
||||
external: modules.map(mn => `@angular/${mn}`)
|
||||
});
|
||||
});
|
||||
|
||||
// array of booleans
|
||||
const x = await Promise.all(tasks);
|
||||
|
||||
const result = x.reduce<{ fails: string[]; exceptions: string[]; result: boolean }>((prev, current) => {
|
||||
if (!current.result) {
|
||||
prev.fails.push(current.name);
|
||||
prev.exceptions.push(current.exception);
|
||||
prev.result = false;
|
||||
}
|
||||
return prev;
|
||||
}, {
|
||||
fails: [],
|
||||
exceptions: [],
|
||||
result: true,
|
||||
});
|
||||
|
||||
if (!result.result) {
|
||||
return reject(`failures: ${result.fails} - exceptions: ${JSON.stringify(result.exceptions)}`);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -21,20 +21,20 @@ suite('XLF Parser Tests', () => {
|
||||
});
|
||||
test('XLF to keys & messages conversion', () => {
|
||||
i18n.XLF.parse(sampleTranslatedXlf).then(function (resolvedFiles) {
|
||||
assert.deepEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
assert.deepStrictEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
assert.strictEqual(resolvedFiles[0].originalFilePath, originalFilePath);
|
||||
});
|
||||
});
|
||||
test('JSON file source path to Transifex resource match', () => {
|
||||
const editorProject = 'vscode-editor', workbenchProject = 'vscode-workbench';
|
||||
const platform = { name: 'vs/platform', project: editorProject }, editorContrib = { name: 'vs/editor/contrib', project: editorProject }, editor = { name: 'vs/editor', project: editorProject }, base = { name: 'vs/base', project: editorProject }, code = { name: 'vs/code', project: workbenchProject }, workbenchParts = { name: 'vs/workbench/contrib/html', project: workbenchProject }, workbenchServices = { name: 'vs/workbench/services/textfile', project: workbenchProject }, workbench = { name: 'vs/workbench', project: workbenchProject };
|
||||
assert.deepEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,8 +23,8 @@ suite('XLF Parser Tests', () => {
|
||||
});
|
||||
|
||||
test('XLF to keys & messages conversion', () => {
|
||||
i18n.XLF.parse(sampleTranslatedXlf).then(function(resolvedFiles) {
|
||||
assert.deepEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
i18n.XLF.parse(sampleTranslatedXlf).then(function (resolvedFiles) {
|
||||
assert.deepStrictEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
assert.strictEqual(resolvedFiles[0].originalFilePath, originalFilePath);
|
||||
});
|
||||
});
|
||||
@@ -40,15 +40,15 @@ suite('XLF Parser Tests', () => {
|
||||
code = { name: 'vs/code', project: workbenchProject },
|
||||
workbenchParts = { name: 'vs/workbench/contrib/html', project: workbenchProject },
|
||||
workbenchServices = { name: 'vs/workbench/services/textfile', project: workbenchProject },
|
||||
workbench = { name: 'vs/workbench', project: workbenchProject};
|
||||
workbench = { name: 'vs/workbench', project: workbenchProject };
|
||||
|
||||
assert.deepEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -311,7 +311,7 @@ function markNodes(ts, languageService, options) {
|
||||
setColor(node, 0 /* White */);
|
||||
// add to black queue
|
||||
enqueue_black(node);
|
||||
// // move from one queue to the other
|
||||
// move from one queue to the other
|
||||
// black_queue.push(node);
|
||||
// setColor(node, NodeColor.Black);
|
||||
return;
|
||||
@@ -414,8 +414,8 @@ function markNodes(ts, languageService, options) {
|
||||
setColor(symbolImportNode, 2 /* Black */);
|
||||
}
|
||||
if (symbol && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||
const declaration = symbol.declarations[i];
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations[i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
if (ts.isSourceFile(declaration)) {
|
||||
// Do not enqueue full source files
|
||||
// (they can be the declaration of a module import)
|
||||
@@ -474,8 +474,8 @@ function markNodes(ts, languageService, options) {
|
||||
}
|
||||
}
|
||||
function nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol) {
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||
const declaration = symbol.declarations[i];
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations[i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declarationSourceFile = declaration.getSourceFile();
|
||||
if (nodeSourceFile === declarationSourceFile) {
|
||||
if (declaration.pos <= node.pos && node.end <= declaration.end) {
|
||||
@@ -686,11 +686,11 @@ function getRealNodeSymbol(ts, checker, node) {
|
||||
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
||||
// import {A, B} from "mod";
|
||||
// to jump to the implementation directly.
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations) {
|
||||
// We should mark the import as visited
|
||||
importNode = symbol.declarations[0];
|
||||
importNode = symbol.declarations[0]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
symbol = aliased;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
|
||||
// add to black queue
|
||||
enqueue_black(node);
|
||||
|
||||
// // move from one queue to the other
|
||||
// move from one queue to the other
|
||||
// black_queue.push(node);
|
||||
// setColor(node, NodeColor.Black);
|
||||
return;
|
||||
@@ -531,8 +531,8 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
|
||||
}
|
||||
|
||||
if (symbol && !nodeIsInItsOwnDeclaration(nodeSourceFile, node, symbol)) {
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||
const declaration = symbol.declarations[i];
|
||||
for (let i = 0, len = symbol.declarations!.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations![i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
if (ts.isSourceFile(declaration)) {
|
||||
// Do not enqueue full source files
|
||||
// (they can be the declaration of a module import)
|
||||
@@ -596,8 +596,8 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language
|
||||
}
|
||||
|
||||
function nodeIsInItsOwnDeclaration(nodeSourceFile: ts.SourceFile, node: ts.Node, symbol: ts.Symbol): boolean {
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||
const declaration = symbol.declarations[i];
|
||||
for (let i = 0, len = symbol.declarations!.length; i < len; i++) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declaration = symbol.declarations![i]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
const declarationSourceFile = declaration.getSourceFile();
|
||||
|
||||
if (nodeSourceFile === declarationSourceFile) {
|
||||
@@ -838,11 +838,11 @@ function getRealNodeSymbol(ts: typeof import('typescript'), checker: ts.TypeChec
|
||||
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
||||
// import {A, B} from "mod";
|
||||
// to jump to the implementation directly.
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations![0])) { // {{SQL CARBON EDIT}} Compile fixes
|
||||
const aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations) {
|
||||
// We should mark the import as visited
|
||||
importNode = symbol.declarations[0];
|
||||
importNode = symbol.declarations![0]; // {{SQL CARBON EDIT}} Compile fixes
|
||||
symbol = aliased;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user