mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Upgrade xml2js to v0.5.0 + migration to @vscode/vsce + migration to @azure/storage-blob (#22664)
This commit is contained in:
@@ -24,7 +24,6 @@ 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);
|
||||
@@ -69,7 +68,7 @@ function fromLocal(extensionPath, forWeb) {
|
||||
delete data.dependencies;
|
||||
delete data.devDependencies;
|
||||
if (data.main) {
|
||||
data.main = data.main.replace('/out/', /dist/);
|
||||
data.main = data.main.replace('/out/', '/dist/');
|
||||
}
|
||||
return data;
|
||||
});
|
||||
@@ -78,6 +77,9 @@ function fromLocal(extensionPath, forWeb) {
|
||||
}
|
||||
exports.fromLocal = fromLocal;
|
||||
function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const vsce = require('@vscode/vsce');
|
||||
const webpack = require('webpack');
|
||||
const webpackGulp = require('webpack-stream');
|
||||
const result = es.through();
|
||||
const packagedDependencies = [];
|
||||
const packageJsonConfig = require(path.join(extensionPath, 'package.json'));
|
||||
@@ -89,9 +91,6 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const vsce = require('vsce');
|
||||
const webpack = require('webpack');
|
||||
const webpackGulp = require('webpack-stream');
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn, packagedDependencies }).then(fileNames => {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
@@ -104,7 +103,7 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
// 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'] });
|
||||
const webpackStreams = webpackConfigLocations.map(webpackConfigPath => {
|
||||
const webpackStreams = webpackConfigLocations.flatMap(webpackConfigPath => {
|
||||
const webpackDone = (err, stats) => {
|
||||
fancyLog(`Bundled extension: ${ansiColors.yellow(path.join(path.basename(extensionPath), path.relative(extensionPath, webpackConfigPath)))}...`);
|
||||
if (err) {
|
||||
@@ -118,24 +117,27 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
result.emit('error', compilation.warnings.join('\n'));
|
||||
}
|
||||
};
|
||||
const webpackConfig = Object.assign(Object.assign({}, require(webpackConfigPath)), { mode: 'production' });
|
||||
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);
|
||||
}))
|
||||
.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);
|
||||
}));
|
||||
const exportedConfig = require(webpackConfigPath);
|
||||
return (Array.isArray(exportedConfig) ? exportedConfig : [exportedConfig]).map(config => {
|
||||
const webpackConfig = Object.assign(Object.assign({}, config), { mode: 'production' });
|
||||
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);
|
||||
}))
|
||||
.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);
|
||||
}));
|
||||
});
|
||||
});
|
||||
es.merge(...webpackStreams, es.readArray(files))
|
||||
// .pipe(es.through(function (data) {
|
||||
@@ -152,8 +154,8 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
return result.pipe((0, stats_1.createStatsStream)(path.basename(extensionPath)));
|
||||
}
|
||||
function fromLocalNormal(extensionPath) {
|
||||
const vsce = require('@vscode/vsce');
|
||||
const result = es.through();
|
||||
const vsce = require('vsce');
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||
.then(fileNames => {
|
||||
const files = fileNames
|
||||
@@ -342,8 +344,9 @@ function packageLocalExtensionsStream(forWeb) {
|
||||
else {
|
||||
// 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: '.' }));
|
||||
const dependenciesSrc = productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`]).flat();
|
||||
result = es.merge(localExtensionsStream, gulp.src(dependenciesSrc, { base: '.' })
|
||||
.pipe(util2.cleanNodeModules(path.join(root, 'build', '.moduleignore'))));
|
||||
}
|
||||
return (result
|
||||
.pipe(util2.setExecutableBit(['**/*.sh'])));
|
||||
|
||||
Reference in New Issue
Block a user