mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Revert build folder update to fix it properly (#22981)
* Revert "Disable publishing crash reports temporarily (#22950)" This reverts commit13a791d14e. * Revert "Compile build folder (#22811)" This reverts commit2c07c09d0d.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.watchApiProposalNamesTask = exports.compileApiProposalNamesTask = exports.watchTask = exports.compileTask = exports.transpileTask = void 0;
|
||||
const es = require("event-stream");
|
||||
@@ -52,7 +52,7 @@ function createCompile(src, build, emitError, transpileOnly) {
|
||||
console.warn('* and re-run the build/watch task *');
|
||||
console.warn('********************************************************************************************');
|
||||
}
|
||||
const compilation = tsb.create(projectPath, overrideOptions, { verbose: false }, err => reporter(err));
|
||||
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
function pipeline(token) {
|
||||
const bom = require('gulp-bom');
|
||||
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
|
||||
@@ -204,7 +204,7 @@ function generateApiProposalNames() {
|
||||
const match = /\r?\n/m.exec(src);
|
||||
eol = match ? match[0] : os.EOL;
|
||||
}
|
||||
catch (_a) {
|
||||
catch {
|
||||
eol = os.EOL;
|
||||
}
|
||||
const pattern = /vscode\.proposed\.([a-zA-Z]+)\.d\.ts$/;
|
||||
|
||||
@@ -60,7 +60,7 @@ function createCompile(src: string, build: boolean, emitError: boolean, transpil
|
||||
}
|
||||
|
||||
|
||||
const compilation = tsb.create(projectPath, overrideOptions, { verbose: false }, err => reporter(err));
|
||||
const compilation = tsb.create(projectPath, overrideOptions, false, err => reporter(err));
|
||||
|
||||
function pipeline(token?: util.ICancellationToken) {
|
||||
const bom = require('gulp-bom') as typeof import('gulp-bom');
|
||||
|
||||
@@ -77,7 +77,7 @@ module.exports = new (_a = class ApiEventNaming {
|
||||
if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return def;
|
||||
}
|
||||
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.Property) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return def.key;
|
||||
}
|
||||
return this.getIdent(def.parent);
|
||||
|
||||
@@ -88,7 +88,7 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
|
||||
|
||||
if (def.type === AST_NODE_TYPES.Identifier) {
|
||||
return def;
|
||||
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.Property) && def.key.type === AST_NODE_TYPES.Identifier) {
|
||||
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.PropertyDefinition) && def.key.type === AST_NODE_TYPES.Identifier) {
|
||||
return def.key;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@ function minifyExtensionResources(input) {
|
||||
.pipe(jsonFilter)
|
||||
.pipe(buffer())
|
||||
.pipe(es.mapSync((f) => {
|
||||
const errors = [];
|
||||
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
|
||||
if (errors.length === 0) {
|
||||
// file parsed OK => just stringify to drop whitespace and comments
|
||||
f.contents = Buffer.from(JSON.stringify(value));
|
||||
}
|
||||
return f;
|
||||
}))
|
||||
const errors = [];
|
||||
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
|
||||
if (errors.length === 0) {
|
||||
// file parsed OK => just stringify to drop whitespace and comments
|
||||
f.contents = Buffer.from(JSON.stringify(value));
|
||||
}
|
||||
return f;
|
||||
}))
|
||||
.pipe(jsonFilter.restore);
|
||||
}
|
||||
function updateExtensionPackageJSON(input, update) {
|
||||
@@ -50,10 +50,10 @@ function updateExtensionPackageJSON(input, update) {
|
||||
.pipe(packageJsonFilter)
|
||||
.pipe(buffer())
|
||||
.pipe(es.mapSync((f) => {
|
||||
const data = JSON.parse(f.contents.toString('utf8'));
|
||||
f.contents = Buffer.from(JSON.stringify(update(data)));
|
||||
return f;
|
||||
}))
|
||||
const data = JSON.parse(f.contents.toString('utf8'));
|
||||
f.contents = Buffer.from(JSON.stringify(update(data)));
|
||||
return f;
|
||||
}))
|
||||
.pipe(packageJsonFilter.restore);
|
||||
}
|
||||
function fromLocal(extensionPath, forWeb) {
|
||||
@@ -95,11 +95,11 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
// check for a webpack configuration files, then invoke webpack
|
||||
// and merge its output with the files stream.
|
||||
const webpackConfigLocations = glob.sync(path.join(extensionPath, '**', webpackConfigFileName), { ignore: ['**/node_modules'] });
|
||||
@@ -123,20 +123,20 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path);
|
||||
return webpackGulp(webpackConfig, webpack, webpackDone)
|
||||
.pipe(es.through(function (data) {
|
||||
data.stat = data.stat || {};
|
||||
data.base = extensionPath;
|
||||
this.emit('data', data);
|
||||
}))
|
||||
data.stat = data.stat || {};
|
||||
data.base = extensionPath;
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(es.through(function (data) {
|
||||
// source map handling:
|
||||
// * rewrite sourceMappingURL
|
||||
// * save to disk so that upload-task picks this up
|
||||
const contents = data.contents.toString('utf8');
|
||||
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
|
||||
return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
|
||||
}), 'utf8');
|
||||
this.emit('data', data);
|
||||
}));
|
||||
// source map handling:
|
||||
// * rewrite sourceMappingURL
|
||||
// * save to disk so that upload-task picks this up
|
||||
const contents = data.contents.toString('utf8');
|
||||
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
|
||||
return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
|
||||
}), 'utf8');
|
||||
this.emit('data', data);
|
||||
}));
|
||||
});
|
||||
});
|
||||
es.merge(...webpackStreams, es.readArray(files))
|
||||
@@ -158,16 +158,16 @@ function fromLocalNormal(extensionPath) {
|
||||
const result = es.through();
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||
.then(fileNames => {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
es.readArray(files).pipe(result);
|
||||
})
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
es.readArray(files).pipe(result);
|
||||
})
|
||||
.catch(err => result.emit('error', err));
|
||||
return result.pipe((0, stats_1.createStatsStream)(path.basename(extensionPath)));
|
||||
}
|
||||
@@ -244,7 +244,6 @@ const excludedExtensions = [
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
'vscode-custom-editor-tests',
|
||||
'vscode-notebook-tests',
|
||||
'integration-tests', // {{SQL CARBON EDIT}}
|
||||
];
|
||||
// {{SQL CARBON EDIT}}
|
||||
@@ -325,11 +324,11 @@ function isWebExtension(manifest) {
|
||||
function packageLocalExtensionsStream(forWeb) {
|
||||
const localExtensionsDescriptions = (glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const absoluteManifestPath = path.join(root, manifestPath);
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath, manifestPath: absoluteManifestPath };
|
||||
})
|
||||
const absoluteManifestPath = path.join(root, manifestPath);
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath, manifestPath: absoluteManifestPath };
|
||||
})
|
||||
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
|
||||
.filter(({ name }) => builtInExtensions.every(b => b.name !== name))
|
||||
.filter(({ name }) => externalExtensions.indexOf(name) === -1) // {{SQL CARBON EDIT}} Remove external Extensions with separate package
|
||||
@@ -360,15 +359,15 @@ function packageMarketplaceExtensionsStream(forWeb, galleryServiceUrl) {
|
||||
];
|
||||
const marketplaceExtensionsStream = minifyExtensionResources(es.merge(...marketplaceExtensionsDescriptions
|
||||
.map(extension => {
|
||||
const input = (galleryServiceUrl ? fromMarketplace(galleryServiceUrl, extension) : fromGithub(extension))
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
return updateExtensionPackageJSON(input, (data) => {
|
||||
delete data.scripts;
|
||||
delete data.dependencies;
|
||||
delete data.devDependencies;
|
||||
return data;
|
||||
});
|
||||
})));
|
||||
const input = (galleryServiceUrl ? fromMarketplace(galleryServiceUrl, extension) : fromGithub(extension))
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
return updateExtensionPackageJSON(input, (data) => {
|
||||
delete data.scripts;
|
||||
delete data.dependencies;
|
||||
delete data.devDependencies;
|
||||
return data;
|
||||
});
|
||||
})));
|
||||
return (marketplaceExtensionsStream
|
||||
.pipe(util2.setExecutableBit(['**/*.sh'])));
|
||||
}
|
||||
@@ -413,10 +412,10 @@ exports.scanBuiltinExtensions = scanBuiltinExtensions;
|
||||
function packageExternalExtensionsStream() {
|
||||
const extenalExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
.filter(({ name }) => externalExtensions.indexOf(name) >= 0 || exports.vscodeExternalExtensions.indexOf(name) >= 0);
|
||||
const builtExtensions = extenalExtensionDescriptions.map(extension => {
|
||||
return fromLocal(extension.path, false)
|
||||
@@ -434,10 +433,10 @@ exports.cleanRebuildExtensions = cleanRebuildExtensions;
|
||||
function packageRebuildExtensionsStream() {
|
||||
const extenalExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
.filter(({ name }) => rebuildExtensions.indexOf(name) >= 0);
|
||||
const builtExtensions = extenalExtensionDescriptions.map(extension => {
|
||||
return fromLocal(extension.path, false)
|
||||
|
||||
@@ -1012,7 +1012,7 @@ function prepareI18nFiles() {
|
||||
}
|
||||
exports.prepareI18nFiles = prepareI18nFiles;
|
||||
function createI18nFile(originalFilePath, messages) {
|
||||
let result = Object.create(null);
|
||||
const result = Object.create(null);
|
||||
result[''] = [
|
||||
'--------------------------------------------------------------------------------------------',
|
||||
'Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
@@ -1035,16 +1035,16 @@ function createI18nFile(originalFilePath, messages) {
|
||||
exports.createI18nFile = createI18nFile;
|
||||
exports.i18nPackVersion = '1.0.0'; // {{SQL CARBON EDIT}} Needed in locfunc.
|
||||
function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pseudo = false) {
|
||||
const parsePromises = [];
|
||||
const mainPack = { version: exports.i18nPackVersion, contents: {} };
|
||||
const extensionsPacks = {};
|
||||
const errors = [];
|
||||
let parsePromises = [];
|
||||
let mainPack = { version: exports.i18nPackVersion, contents: {} };
|
||||
let extensionsPacks = {};
|
||||
let errors = [];
|
||||
return (0, event_stream_1.through)(function (xlf) {
|
||||
const project = path.basename(path.dirname(path.dirname(xlf.relative)));
|
||||
const resource = path.basename(xlf.relative, '.xlf');
|
||||
const contents = xlf.contents.toString();
|
||||
let project = path.basename(path.dirname(path.dirname(xlf.relative)));
|
||||
let resource = path.basename(xlf.relative, '.xlf');
|
||||
let contents = xlf.contents.toString();
|
||||
log(`Found ${project}: ${resource}`);
|
||||
const parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents);
|
||||
let parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents);
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(resolvedFiles => {
|
||||
resolvedFiles.forEach(file => {
|
||||
|
||||
@@ -77,12 +77,6 @@ const RULES: IRule[] = [
|
||||
skip: true // -> skip all test files
|
||||
},
|
||||
|
||||
// TODO@bpasero remove me once electron utility process has landed
|
||||
{
|
||||
target: '**/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts',
|
||||
skip: true
|
||||
},
|
||||
|
||||
// Common: vs/base/common/platform.ts
|
||||
{
|
||||
target: '**/{vs,sql}/base/common/platform.ts',
|
||||
|
||||
@@ -104,12 +104,11 @@ function hasModifier(modifiers, kind) {
|
||||
return false;
|
||||
}
|
||||
function isStatic(ts, member) {
|
||||
const modifiers = ts.canHaveModifiers(member) ? ts.getModifiers(member) : undefined;
|
||||
return hasModifier(modifiers, ts.SyntaxKind.StaticKeyword);
|
||||
return hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword);
|
||||
}
|
||||
function isDefaultExport(ts, declaration) {
|
||||
const modifiers = ts.canHaveModifiers(declaration) ? ts.getModifiers(declaration) : undefined;
|
||||
return hasModifier(modifiers, ts.SyntaxKind.DefaultKeyword) && hasModifier(modifiers, ts.SyntaxKind.ExportKeyword);
|
||||
return (hasModifier(declaration.modifiers, ts.SyntaxKind.DefaultKeyword)
|
||||
&& hasModifier(declaration.modifiers, ts.SyntaxKind.ExportKeyword));
|
||||
}
|
||||
function getMassagedTopLevelDeclarationText(ts, sourceFile, declaration, importName, usage, enums) {
|
||||
let result = getNodeText(sourceFile, declaration);
|
||||
|
||||
@@ -115,7 +115,7 @@ function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number
|
||||
return sourceFile.getFullText().substring(node.pos, node.end);
|
||||
}
|
||||
|
||||
function hasModifier(modifiers: readonly ts.Modifier[] | undefined, kind: ts.SyntaxKind): boolean {
|
||||
function hasModifier(modifiers: ts.NodeArray<ts.ModifierLike> | undefined, kind: ts.SyntaxKind): boolean {
|
||||
if (modifiers) {
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const mod = modifiers[i];
|
||||
@@ -128,13 +128,14 @@ function hasModifier(modifiers: readonly ts.Modifier[] | undefined, kind: ts.Syn
|
||||
}
|
||||
|
||||
function isStatic(ts: typeof import('typescript'), member: ts.ClassElement | ts.TypeElement): boolean {
|
||||
const modifiers = ts.canHaveModifiers(member) ? ts.getModifiers(member) : undefined;
|
||||
return hasModifier(modifiers, ts.SyntaxKind.StaticKeyword);
|
||||
return hasModifier(member.modifiers, ts.SyntaxKind.StaticKeyword);
|
||||
}
|
||||
|
||||
function isDefaultExport(ts: typeof import('typescript'), declaration: ts.InterfaceDeclaration | ts.ClassDeclaration): boolean {
|
||||
const modifiers = ts.canHaveModifiers(declaration) ? ts.getModifiers(declaration) : undefined;
|
||||
return hasModifier(modifiers, ts.SyntaxKind.DefaultKeyword) && hasModifier(modifiers, ts.SyntaxKind.ExportKeyword);
|
||||
return (
|
||||
hasModifier(declaration.modifiers, ts.SyntaxKind.DefaultKeyword)
|
||||
&& hasModifier(declaration.modifiers, ts.SyntaxKind.ExportKeyword)
|
||||
);
|
||||
}
|
||||
|
||||
function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: IEnumEntry[]): string {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const child_process_1 = require("child_process");
|
||||
@@ -95,6 +95,10 @@ class BooleanPolicy extends BasePolicy {
|
||||
}
|
||||
}
|
||||
class IntPolicy extends BasePolicy {
|
||||
constructor(name, category, minimumVersion, description, moduleName, defaultValue) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'number') {
|
||||
@@ -106,10 +110,6 @@ class IntPolicy extends BasePolicy {
|
||||
}
|
||||
return new IntPolicy(name, category, minimumVersion, description, moduleName, defaultValue);
|
||||
}
|
||||
constructor(name, category, minimumVersion, description, moduleName, defaultValue) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [
|
||||
`<decimal id="${this.name}" valueName="${this.name}" />`
|
||||
@@ -139,6 +139,11 @@ class StringPolicy extends BasePolicy {
|
||||
}
|
||||
}
|
||||
class StringEnumPolicy extends BasePolicy {
|
||||
constructor(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.enum_ = enum_;
|
||||
this.enumDescriptions = enumDescriptions;
|
||||
}
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'string') {
|
||||
@@ -160,11 +165,6 @@ class StringEnumPolicy extends BasePolicy {
|
||||
}
|
||||
return new StringEnumPolicy(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions);
|
||||
}
|
||||
constructor(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.enum_ = enum_;
|
||||
this.enumDescriptions = enumDescriptions;
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [
|
||||
`<enum id="${this.name}" valueName="${this.name}">`,
|
||||
@@ -185,12 +185,11 @@ class StringEnumPolicy extends BasePolicy {
|
||||
const IntQ = {
|
||||
Q: `(number) @value`,
|
||||
value(matches) {
|
||||
var _a;
|
||||
const match = matches[0];
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const value = (_a = match.captures.filter((c) => c.name === 'value')[0]) === null || _a === void 0 ? void 0 : _a.node.text;
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
@@ -203,16 +202,15 @@ const StringQ = {
|
||||
(call_expression function: (identifier) @localizeFn arguments: (arguments (string (string_fragment) @nlsKey) (string (string_fragment) @value)) (#eq? @localizeFn localize))
|
||||
]`,
|
||||
value(matches) {
|
||||
var _a, _b;
|
||||
const match = matches[0];
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const value = (_a = match.captures.filter((c) => c.name === 'value')[0]) === null || _a === void 0 ? void 0 : _a.node.text;
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
const nlsKey = (_b = match.captures.filter((c) => c.name === 'nlsKey')[0]) === null || _b === void 0 ? void 0 : _b.node.text;
|
||||
const nlsKey = match.captures.filter(c => c.name === 'nlsKey')[0]?.node.text;
|
||||
if (nlsKey) {
|
||||
return { value, nlsKey };
|
||||
}
|
||||
@@ -323,7 +321,7 @@ function getPolicies(moduleName, node) {
|
||||
)
|
||||
`);
|
||||
const categories = new Map();
|
||||
return query.matches(node).map((m) => {
|
||||
return query.matches(node).map(m => {
|
||||
const configurationNode = m.captures.filter(c => c.name === 'configuration')[0].node;
|
||||
const settingNode = m.captures.filter(c => c.name === 'setting')[0].node;
|
||||
const policyNode = m.captures.filter(c => c.name === 'policy')[0].node;
|
||||
@@ -463,13 +461,12 @@ async function parsePolicies() {
|
||||
return policies;
|
||||
}
|
||||
async function getTranslations() {
|
||||
var _a;
|
||||
const updateUrl = product.updateUrl;
|
||||
if (!updateUrl) {
|
||||
console.warn(`Skipping policy localization: No 'updateUrl' found in 'product.json'.`);
|
||||
return [];
|
||||
}
|
||||
const resourceUrlTemplate = (_a = product.extensionsGallery) === null || _a === void 0 ? void 0 : _a.resourceUrlTemplate;
|
||||
const resourceUrlTemplate = product.extensionsGallery?.resourceUrlTemplate;
|
||||
if (!resourceUrlTemplate) {
|
||||
console.warn(`Skipping policy localization: No 'resourceUrlTemplate' found in 'product.json'.`);
|
||||
return [];
|
||||
|
||||
@@ -316,7 +316,7 @@ const IntQ: QType<number> = {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const value = match.captures.filter((c: { name: string; }) => c.name === 'value')[0]?.node.text;
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
@@ -339,13 +339,13 @@ const StringQ: QType<string | NlsString> = {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const value = match.captures.filter((c: { name: string; }) => c.name === 'value')[0]?.node.text;
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
|
||||
const nlsKey = match.captures.filter((c: { name: string; }) => c.name === 'nlsKey')[0]?.node.text;
|
||||
const nlsKey = match.captures.filter(c => c.name === 'nlsKey')[0]?.node.text;
|
||||
|
||||
if (nlsKey) {
|
||||
return { value, nlsKey };
|
||||
@@ -487,7 +487,7 @@ function getPolicies(moduleName: string, node: Parser.SyntaxNode): Policy[] {
|
||||
|
||||
const categories = new Map<string, Category>();
|
||||
|
||||
return query.matches(node).map((m: { captures: any[]; }) => {
|
||||
return query.matches(node).map(m => {
|
||||
const configurationNode = m.captures.filter(c => c.name === 'configuration')[0].node;
|
||||
const settingNode = m.captures.filter(c => c.name === 'setting')[0].node;
|
||||
const policyNode = m.captures.filter(c => c.name === 'policy')[0].node;
|
||||
|
||||
@@ -16,11 +16,11 @@ var ShakeLevel;
|
||||
})(ShakeLevel = exports.ShakeLevel || (exports.ShakeLevel = {}));
|
||||
function toStringShakeLevel(shakeLevel) {
|
||||
switch (shakeLevel) {
|
||||
case 0 /* ShakeLevel.Files */:
|
||||
case 0 /* Files */:
|
||||
return 'Files (0)';
|
||||
case 1 /* ShakeLevel.InnerFile */:
|
||||
case 1 /* InnerFile */:
|
||||
return 'InnerFile (1)';
|
||||
case 2 /* ShakeLevel.ClassMembers */:
|
||||
case 2 /* ClassMembers */:
|
||||
return 'ClassMembers (2)';
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,7 @@ var NodeColor;
|
||||
NodeColor[NodeColor["Black"] = 2] = "Black";
|
||||
})(NodeColor || (NodeColor = {}));
|
||||
function getColor(node) {
|
||||
return node.$$$color || 0 /* NodeColor.White */;
|
||||
return node.$$$color || 0 /* White */;
|
||||
}
|
||||
function setColor(node, color) {
|
||||
node.$$$color = color;
|
||||
@@ -237,7 +237,7 @@ function isNeededSourceFile(node) {
|
||||
function nodeOrParentIsBlack(node) {
|
||||
while (node) {
|
||||
const color = getColor(node);
|
||||
if (color === 2 /* NodeColor.Black */) {
|
||||
if (color === 2 /* Black */) {
|
||||
return true;
|
||||
}
|
||||
node = node.parent;
|
||||
@@ -245,7 +245,7 @@ function nodeOrParentIsBlack(node) {
|
||||
return false;
|
||||
}
|
||||
function nodeOrChildIsBlack(node) {
|
||||
if (getColor(node) === 2 /* NodeColor.Black */) {
|
||||
if (getColor(node) === 2 /* Black */) {
|
||||
return true;
|
||||
}
|
||||
for (const child of node.getChildren()) {
|
||||
@@ -309,10 +309,10 @@ function markNodes(ts, languageService, options) {
|
||||
if (!program) {
|
||||
throw new Error('Could not get program from language service');
|
||||
}
|
||||
if (options.shakeLevel === 0 /* ShakeLevel.Files */) {
|
||||
if (options.shakeLevel === 0 /* Files */) {
|
||||
// Mark all source files Black
|
||||
program.getSourceFiles().forEach((sourceFile) => {
|
||||
setColor(sourceFile, 2 /* NodeColor.Black */);
|
||||
setColor(sourceFile, 2 /* Black */);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -324,7 +324,7 @@ function markNodes(ts, languageService, options) {
|
||||
sourceFile.forEachChild((node) => {
|
||||
if (ts.isImportDeclaration(node)) {
|
||||
if (!node.importClause && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
enqueueImport(node, node.moduleSpecifier.text);
|
||||
}
|
||||
return;
|
||||
@@ -332,7 +332,7 @@ function markNodes(ts, languageService, options) {
|
||||
if (ts.isExportDeclaration(node)) {
|
||||
if (!node.exportClause && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {
|
||||
// export * from "foo";
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
enqueueImport(node, node.moduleSpecifier.text);
|
||||
}
|
||||
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
||||
@@ -373,21 +373,21 @@ function markNodes(ts, languageService, options) {
|
||||
return null;
|
||||
}
|
||||
function enqueue_gray(node) {
|
||||
if (nodeOrParentIsBlack(node) || getColor(node) === 1 /* NodeColor.Gray */) {
|
||||
if (nodeOrParentIsBlack(node) || getColor(node) === 1 /* Gray */) {
|
||||
return;
|
||||
}
|
||||
setColor(node, 1 /* NodeColor.Gray */);
|
||||
setColor(node, 1 /* Gray */);
|
||||
gray_queue.push(node);
|
||||
}
|
||||
function enqueue_black(node) {
|
||||
const previousColor = getColor(node);
|
||||
if (previousColor === 2 /* NodeColor.Black */) {
|
||||
if (previousColor === 2 /* Black */) {
|
||||
return;
|
||||
}
|
||||
if (previousColor === 1 /* NodeColor.Gray */) {
|
||||
if (previousColor === 1 /* Gray */) {
|
||||
// remove from gray queue
|
||||
gray_queue.splice(gray_queue.indexOf(node), 1);
|
||||
setColor(node, 0 /* NodeColor.White */);
|
||||
setColor(node, 0 /* White */);
|
||||
// add to black queue
|
||||
enqueue_black(node);
|
||||
// move from one queue to the other
|
||||
@@ -400,7 +400,7 @@ function markNodes(ts, languageService, options) {
|
||||
}
|
||||
const fileName = node.getSourceFile().fileName;
|
||||
if (/^defaultLib:/.test(fileName) || /\.d\.ts$/.test(fileName)) {
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
return;
|
||||
}
|
||||
const sourceFile = node.getSourceFile();
|
||||
@@ -411,9 +411,9 @@ function markNodes(ts, languageService, options) {
|
||||
if (ts.isSourceFile(node)) {
|
||||
return;
|
||||
}
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
black_queue.push(node);
|
||||
if (options.shakeLevel === 2 /* ShakeLevel.ClassMembers */ && (ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isPropertySignature(node) || ts.isPropertyDeclaration(node) || ts.isGetAccessor(node) || ts.isSetAccessor(node))) {
|
||||
if (options.shakeLevel === 2 /* ClassMembers */ && (ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || ts.isPropertySignature(node) || ts.isPropertyDeclaration(node) || ts.isGetAccessor(node) || ts.isSetAccessor(node))) {
|
||||
const references = languageService.getReferencesAtPosition(node.getSourceFile().fileName, node.name.pos + node.name.getLeadingTriviaWidth());
|
||||
if (references) {
|
||||
for (let i = 0, len = references.length; i < len; i++) {
|
||||
@@ -476,7 +476,7 @@ function markNodes(ts, languageService, options) {
|
||||
if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) {
|
||||
gray_queue.splice(i, 1);
|
||||
black_queue.push(node);
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
@@ -506,7 +506,7 @@ function markNodes(ts, languageService, options) {
|
||||
// (they can be the declaration of a module import)
|
||||
continue;
|
||||
}
|
||||
if (options.shakeLevel === 2 /* ShakeLevel.ClassMembers */ && (ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration)) && !isLocalCodeExtendingOrInheritingFromDefaultLibSymbol(ts, program, checker, declaration)) {
|
||||
if (options.shakeLevel === 2 /* ClassMembers */ && (ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration)) && !isLocalCodeExtendingOrInheritingFromDefaultLibSymbol(ts, program, checker, declaration)) {
|
||||
enqueue_black(declaration.name);
|
||||
for (let j = 0; j < declaration.members.length; j++) {
|
||||
const member = declaration.members[j];
|
||||
@@ -556,7 +556,7 @@ function markNodes(ts, languageService, options) {
|
||||
const aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations && aliased.declarations.length > 0) {
|
||||
if (nodeOrParentIsBlack(aliased.declarations[0]) || nodeOrChildIsBlack(aliased.declarations[0])) {
|
||||
setColor(node, 2 /* NodeColor.Black */);
|
||||
setColor(node, 2 /* Black */);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,7 +603,7 @@ function generateResult(ts, languageService, shakeLevel) {
|
||||
result += data;
|
||||
}
|
||||
function writeMarkedNodes(node) {
|
||||
if (getColor(node) === 2 /* NodeColor.Black */) {
|
||||
if (getColor(node) === 2 /* Black */) {
|
||||
return keep(node);
|
||||
}
|
||||
// Always keep certain top-level statements
|
||||
@@ -619,34 +619,34 @@ function generateResult(ts, languageService, shakeLevel) {
|
||||
if (ts.isImportDeclaration(node)) {
|
||||
if (node.importClause && node.importClause.namedBindings) {
|
||||
if (ts.isNamespaceImport(node.importClause.namedBindings)) {
|
||||
if (getColor(node.importClause.namedBindings) === 2 /* NodeColor.Black */) {
|
||||
if (getColor(node.importClause.namedBindings) === 2 /* Black */) {
|
||||
return keep(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const survivingImports = [];
|
||||
for (const importNode of node.importClause.namedBindings.elements) {
|
||||
if (getColor(importNode) === 2 /* NodeColor.Black */) {
|
||||
if (getColor(importNode) === 2 /* Black */) {
|
||||
survivingImports.push(importNode.getFullText(sourceFile));
|
||||
}
|
||||
}
|
||||
const leadingTriviaWidth = node.getLeadingTriviaWidth();
|
||||
const leadingTrivia = sourceFile.text.substr(node.pos, leadingTriviaWidth);
|
||||
if (survivingImports.length > 0) {
|
||||
if (node.importClause && node.importClause.name && getColor(node.importClause) === 2 /* NodeColor.Black */) {
|
||||
if (node.importClause && node.importClause.name && getColor(node.importClause) === 2 /* Black */) {
|
||||
return write(`${leadingTrivia}import ${node.importClause.name.text}, {${survivingImports.join(',')} } from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||
}
|
||||
return write(`${leadingTrivia}import {${survivingImports.join(',')} } from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||
}
|
||||
else {
|
||||
if (node.importClause && node.importClause.name && getColor(node.importClause) === 2 /* NodeColor.Black */) {
|
||||
if (node.importClause && node.importClause.name && getColor(node.importClause) === 2 /* Black */) {
|
||||
return write(`${leadingTrivia}import ${node.importClause.name.text} from${node.moduleSpecifier.getFullText(sourceFile)};`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (node.importClause && getColor(node.importClause) === 2 /* NodeColor.Black */) {
|
||||
if (node.importClause && getColor(node.importClause) === 2 /* Black */) {
|
||||
return keep(node);
|
||||
}
|
||||
}
|
||||
@@ -655,7 +655,7 @@ function generateResult(ts, languageService, shakeLevel) {
|
||||
if (node.exportClause && node.moduleSpecifier && ts.isNamedExports(node.exportClause)) {
|
||||
const survivingExports = [];
|
||||
for (const exportSpecifier of node.exportClause.elements) {
|
||||
if (getColor(exportSpecifier) === 2 /* NodeColor.Black */) {
|
||||
if (getColor(exportSpecifier) === 2 /* Black */) {
|
||||
survivingExports.push(exportSpecifier.getFullText(sourceFile));
|
||||
}
|
||||
}
|
||||
@@ -666,11 +666,11 @@ function generateResult(ts, languageService, shakeLevel) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shakeLevel === 2 /* ShakeLevel.ClassMembers */ && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && nodeOrChildIsBlack(node)) {
|
||||
if (shakeLevel === 2 /* ClassMembers */ && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) && nodeOrChildIsBlack(node)) {
|
||||
let toWrite = node.getFullText();
|
||||
for (let i = node.members.length - 1; i >= 0; i--) {
|
||||
const member = node.members[i];
|
||||
if (getColor(member) === 2 /* NodeColor.Black */ || !member.name) {
|
||||
if (getColor(member) === 2 /* Black */ || !member.name) {
|
||||
// keep method
|
||||
continue;
|
||||
}
|
||||
@@ -686,7 +686,7 @@ function generateResult(ts, languageService, shakeLevel) {
|
||||
}
|
||||
node.forEachChild(writeMarkedNodes);
|
||||
}
|
||||
if (getColor(sourceFile) !== 2 /* NodeColor.Black */) {
|
||||
if (getColor(sourceFile) !== 2 /* Black */) {
|
||||
if (!nodeOrChildIsBlack(sourceFile)) {
|
||||
// none of the elements are reachable
|
||||
if (isNeededSourceFile(sourceFile)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createTypeScriptBuilder = exports.CancellationToken = void 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.create = void 0;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Transpiler = void 0;
|
||||
const ts = require("typescript");
|
||||
@@ -11,21 +10,20 @@ const threads = require("node:worker_threads");
|
||||
const Vinyl = require("vinyl");
|
||||
const node_os_1 = require("node:os");
|
||||
function transpile(tsSrc, options) {
|
||||
var _a, _b;
|
||||
const isAmd = /\n(import|export)/m.test(tsSrc);
|
||||
if (!isAmd && ((_a = options.compilerOptions) === null || _a === void 0 ? void 0 : _a.module) === ts.ModuleKind.AMD) {
|
||||
if (!isAmd && options.compilerOptions?.module === ts.ModuleKind.AMD) {
|
||||
// enforce NONE module-system for not-amd cases
|
||||
options = Object.assign(Object.assign({}, options), { compilerOptions: Object.assign(Object.assign({}, options.compilerOptions), { module: ts.ModuleKind.None }) });
|
||||
options = { ...options, ...{ compilerOptions: { ...options.compilerOptions, module: ts.ModuleKind.None } } };
|
||||
}
|
||||
const out = ts.transpileModule(tsSrc, options);
|
||||
return {
|
||||
jsSrc: out.outputText,
|
||||
diag: (_b = out.diagnostics) !== null && _b !== void 0 ? _b : []
|
||||
diag: out.diagnostics ?? []
|
||||
};
|
||||
}
|
||||
if (!threads.isMainThread) {
|
||||
// WORKER
|
||||
(_a = threads.parentPort) === null || _a === void 0 ? void 0 : _a.addListener('message', (req) => {
|
||||
threads.parentPort?.addListener('message', (req) => {
|
||||
const res = {
|
||||
jsSrcs: [],
|
||||
diagnostics: []
|
||||
@@ -44,7 +42,6 @@ class TranspileWorker {
|
||||
this._worker = new threads.Worker(__filename);
|
||||
this._durations = [];
|
||||
this._worker.addListener('message', (res) => {
|
||||
var _a, _b;
|
||||
if (!this._pending) {
|
||||
console.error('RECEIVING data WITHOUT request');
|
||||
return;
|
||||
@@ -75,7 +72,7 @@ class TranspileWorker {
|
||||
if (suffixLen === 5 /* SuffixTypes.Dts */ && _isDefaultEmpty(jsSrc)) {
|
||||
continue;
|
||||
}
|
||||
const outBase = (_b = (_a = options.compilerOptions) === null || _a === void 0 ? void 0 : _a.outDir) !== null && _b !== void 0 ? _b : file.base;
|
||||
const outBase = options.compilerOptions?.outDir ?? file.base;
|
||||
const outPath = outFileFn(file.path);
|
||||
outFiles.push(new Vinyl({
|
||||
path: outPath,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.graph = exports.strings = exports.collections = void 0;
|
||||
|
||||
Reference in New Issue
Block a user