Skip to content

Commit e25ce3e

Browse files
author
Tajudeen
committed
Fix third-party module imports in extensions.js (fancy-log, gulp-filter, etc.)
Removed .default accessors for modules that don't have default exports: - fancy_log_1.default -> fancy_log_1 - gulp_filter_1.default -> gulp_filter_1 - gulp_buffer_1.default -> gulp_buffer_1 - gulp_rename_1.default -> gulp_rename_1 - ansi_colors_1.default -> ansi_colors_1
1 parent d6e531a commit e25ce3e

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

build/lib/extensions.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ const root = path.dirname(path.dirname(__dirname));
4040
const commit = (0, getVersion_1.getVersion)(root);
4141
const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
4242
function minifyExtensionResources(input) {
43-
const jsonFilter = (0, gulp_filter_1.default)(['**/*.json', '**/*.code-snippets'], { restore: true });
43+
const jsonFilter = (0, gulp_filter_1)(['**/*.json', '**/*.code-snippets'], { restore: true });
4444
return input
4545
.pipe(jsonFilter)
46-
.pipe((0, gulp_buffer_1.default)())
46+
.pipe((0, gulp_buffer_1)())
4747
.pipe(event_stream_1.default.mapSync((f) => {
4848
const errors = [];
4949
const value = jsoncParser.parse(f.contents.toString('utf8'), errors, { allowTrailingComma: true });
@@ -56,10 +56,10 @@ function minifyExtensionResources(input) {
5656
.pipe(jsonFilter.restore);
5757
}
5858
function updateExtensionPackageJSON(input, update) {
59-
const packageJsonFilter = (0, gulp_filter_1.default)('extensions/*/package.json', { restore: true });
59+
const packageJsonFilter = (0, gulp_filter_1)('extensions/*/package.json', { restore: true });
6060
return input
6161
.pipe(packageJsonFilter)
62-
.pipe((0, gulp_buffer_1.default)())
62+
.pipe((0, gulp_buffer_1)())
6363
.pipe(event_stream_1.default.mapSync((f) => {
6464
const data = JSON.parse(f.contents.toString('utf8'));
6565
f.contents = Buffer.from(JSON.stringify(update(data)));
@@ -122,7 +122,7 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) {
122122
const webpackConfigLocations = glob_1.default.sync(path.join(extensionPath, '**', webpackConfigFileName), { ignore: ['**/node_modules'] });
123123
const webpackStreams = webpackConfigLocations.flatMap(webpackConfigPath => {
124124
const webpackDone = (err, stats) => {
125-
(0, fancy_log_1.default)(`Bundled extension: ${ansi_colors_1.default.yellow(path.join(path.basename(extensionPath), path.relative(extensionPath, webpackConfigPath)))}...`);
125+
(0, fancy_log_1)(`Bundled extension: ${ansi_colors_1.yellow(path.join(path.basename(extensionPath), path.relative(extensionPath, webpackConfigPath)))}...`);
126126
if (err) {
127127
result.emit('error', err);
128128
}
@@ -216,8 +216,8 @@ function fromMarketplace(serviceUrl, { name: extensionName, version, sha256, met
216216
const json = require('gulp-json-editor');
217217
const [publisher, name] = extensionName.split('.');
218218
const url = `${serviceUrl}/publishers/${publisher}/vsextensions/${name}/${version}/vspackage`;
219-
(0, fancy_log_1.default)('Downloading extension:', ansi_colors_1.default.yellow(`${extensionName}@${version}`), '...');
220-
const packageJsonFilter = (0, gulp_filter_1.default)('package.json', { restore: true });
219+
(0, fancy_log_1)('Downloading extension:', ansi_colors_1.yellow(`${extensionName}@${version}`), '...');
220+
const packageJsonFilter = (0, gulp_filter_1)('package.json', { restore: true });
221221
return (0, fetch_1.fetchUrls)('', {
222222
base: url,
223223
nodeFetchOptions: {
@@ -226,19 +226,19 @@ function fromMarketplace(serviceUrl, { name: extensionName, version, sha256, met
226226
checksumSha256: sha256
227227
})
228228
.pipe(vzip.src())
229-
.pipe((0, gulp_filter_1.default)('extension/**'))
230-
.pipe((0, gulp_rename_1.default)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
229+
.pipe((0, gulp_filter_1)('extension/**'))
230+
.pipe((0, gulp_rename_1)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
231231
.pipe(packageJsonFilter)
232-
.pipe((0, gulp_buffer_1.default)())
232+
.pipe((0, gulp_buffer_1)())
233233
.pipe(json({ __metadata: metadata }))
234234
.pipe(packageJsonFilter.restore);
235235
}
236236
function fromVsix(vsixPath, { name: extensionName, version, sha256, metadata }) {
237237
const json = require('gulp-json-editor');
238-
(0, fancy_log_1.default)('Using local VSIX for extension:', ansi_colors_1.default.yellow(`${extensionName}@${version}`), '...');
239-
const packageJsonFilter = (0, gulp_filter_1.default)('package.json', { restore: true });
238+
(0, fancy_log_1)('Using local VSIX for extension:', ansi_colors_1.yellow(`${extensionName}@${version}`), '...');
239+
const packageJsonFilter = (0, gulp_filter_1)('package.json', { restore: true });
240240
return gulp_1.default.src(vsixPath)
241-
.pipe((0, gulp_buffer_1.default)())
241+
.pipe((0, gulp_buffer_1)())
242242
.pipe(event_stream_1.default.mapSync((f) => {
243243
const hash = crypto_1.default.createHash('sha256');
244244
hash.update(f.contents);
@@ -249,28 +249,28 @@ function fromVsix(vsixPath, { name: extensionName, version, sha256, metadata })
249249
return f;
250250
}))
251251
.pipe(vzip.src())
252-
.pipe((0, gulp_filter_1.default)('extension/**'))
253-
.pipe((0, gulp_rename_1.default)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
252+
.pipe((0, gulp_filter_1)('extension/**'))
253+
.pipe((0, gulp_rename_1)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
254254
.pipe(packageJsonFilter)
255-
.pipe((0, gulp_buffer_1.default)())
255+
.pipe((0, gulp_buffer_1)())
256256
.pipe(json({ __metadata: metadata }))
257257
.pipe(packageJsonFilter.restore);
258258
}
259259
function fromGithub({ name, version, repo, sha256, metadata }) {
260260
const json = require('gulp-json-editor');
261-
(0, fancy_log_1.default)('Downloading extension from GH:', ansi_colors_1.default.yellow(`${name}@${version}`), '...');
262-
const packageJsonFilter = (0, gulp_filter_1.default)('package.json', { restore: true });
261+
(0, fancy_log_1)('Downloading extension from GH:', ansi_colors_1.yellow(`${name}@${version}`), '...');
262+
const packageJsonFilter = (0, gulp_filter_1)('package.json', { restore: true });
263263
return (0, fetch_1.fetchGithub)(new URL(repo).pathname, {
264264
version,
265265
name: name => name.endsWith('.vsix'),
266266
checksumSha256: sha256
267267
})
268-
.pipe((0, gulp_buffer_1.default)())
268+
.pipe((0, gulp_buffer_1)())
269269
.pipe(vzip.src())
270-
.pipe((0, gulp_filter_1.default)('extension/**'))
271-
.pipe((0, gulp_rename_1.default)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
270+
.pipe((0, gulp_filter_1)('extension/**'))
271+
.pipe((0, gulp_rename_1)(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
272272
.pipe(packageJsonFilter)
273-
.pipe((0, gulp_buffer_1.default)())
273+
.pipe((0, gulp_buffer_1)())
274274
.pipe(json({ __metadata: metadata }))
275275
.pipe(packageJsonFilter.restore);
276276
}
@@ -378,7 +378,7 @@ function doPackageLocalExtensionsStream(forWeb, disableMangle, native) {
378378
.filter(({ manifestPath }) => (forWeb ? isWebExtension(require(manifestPath)) : true)));
379379
const localExtensionsStream = minifyExtensionResources(event_stream_1.default.merge(...localExtensionsDescriptions.map(extension => {
380380
return fromLocal(extension.path, forWeb, disableMangle)
381-
.pipe((0, gulp_rename_1.default)(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
381+
.pipe((0, gulp_rename_1)(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
382382
})));
383383
let result;
384384
if (forWeb) {
@@ -407,7 +407,7 @@ function packageMarketplaceExtensionsStream(forWeb) {
407407
];
408408
const marketplaceExtensionsStream = minifyExtensionResources(event_stream_1.default.merge(...marketplaceExtensionsDescriptions
409409
.map(extension => {
410-
const src = (0, builtInExtensions_1.getExtensionStream)(extension).pipe((0, gulp_rename_1.default)(p => p.dirname = `extensions/${p.dirname}`));
410+
const src = (0, builtInExtensions_1.getExtensionStream)(extension).pipe((0, gulp_rename_1)(p => p.dirname = `extensions/${p.dirname}`));
411411
return updateExtensionPackageJSON(src, (data) => {
412412
delete data.scripts;
413413
delete data.dependencies;
@@ -510,16 +510,16 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
510510
if (outputPath) {
511511
const relativePath = path.relative(extensionsPath, outputPath).replace(/\\/g, '/');
512512
const match = relativePath.match(/[^\/]+(\/server|\/client)?/);
513-
(0, fancy_log_1.default)(`Finished ${ansi_colors_1.default.green(taskName)} ${ansi_colors_1.default.cyan(match[0])} with ${stats.errors.length} errors.`);
513+
(0, fancy_log_1)(`Finished ${ansi_colors_1.green(taskName)} ${ansi_colors_1.cyan(match[0])} with ${stats.errors.length} errors.`);
514514
}
515515
if (Array.isArray(stats.errors)) {
516516
stats.errors.forEach((error) => {
517-
fancy_log_1.default.error(error);
517+
fancy_log_1.error(error);
518518
});
519519
}
520520
if (Array.isArray(stats.warnings)) {
521521
stats.warnings.forEach((warning) => {
522-
fancy_log_1.default.warn(warning);
522+
fancy_log_1.warn(warning);
523523
});
524524
}
525525
}
@@ -539,7 +539,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
539539
else {
540540
webpack(webpackConfigs).run((err, stats) => {
541541
if (err) {
542-
fancy_log_1.default.error(err);
542+
fancy_log_1.error(err);
543543
reject();
544544
}
545545
else {
@@ -553,9 +553,9 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
553553
async function esbuildExtensions(taskName, isWatch, scripts) {
554554
function reporter(stdError, script) {
555555
const matches = (stdError || '').match(/\> (.+): error: (.+)?/g);
556-
(0, fancy_log_1.default)(`Finished ${ansi_colors_1.default.green(taskName)} ${script} with ${matches ? matches.length : 0} errors.`);
556+
(0, fancy_log_1)(`Finished ${ansi_colors_1.green(taskName)} ${script} with ${matches ? matches.length : 0} errors.`);
557557
for (const match of matches || []) {
558-
fancy_log_1.default.error(match);
558+
fancy_log_1.error(match);
559559
}
560560
}
561561
const tasks = scripts.map(({ script, outputRoot }) => {
@@ -575,7 +575,7 @@ async function esbuildExtensions(taskName, isWatch, scripts) {
575575
return resolve();
576576
});
577577
proc.stdout.on('data', (data) => {
578-
(0, fancy_log_1.default)(`${ansi_colors_1.default.green(taskName)}: ${data.toString('utf8')}`);
578+
(0, fancy_log_1)(`${ansi_colors_1.green(taskName)}: ${data.toString('utf8')}`);
579579
});
580580
});
581581
});

0 commit comments

Comments
 (0)