mirror of https://github.com/microsoft/vscode.git
esm - inline `minimist` (#230155)
* esm - inline `minimist` * . * . * .
This commit is contained in:
parent
11cc1c8181
commit
36b52aa938
|
@ -64,6 +64,16 @@ function optimizeESMTask(opts) {
|
|||
});
|
||||
}
|
||||
};
|
||||
const overrideExternalPlugin = {
|
||||
name: 'override-external',
|
||||
setup(build) {
|
||||
// We inline selected modules that are we depend on on startup without
|
||||
// a conditional `await import(...)` by hooking into the resolution.
|
||||
build.onResolve({ filter: /^minimist$/ }, () => {
|
||||
return { path: path.join(REPO_ROOT_PATH, 'node_modules', 'minimist', 'index.js'), external: false };
|
||||
});
|
||||
},
|
||||
};
|
||||
const task = esbuild.build({
|
||||
bundle: true,
|
||||
external: entryPoint.exclude,
|
||||
|
@ -71,7 +81,7 @@ function optimizeESMTask(opts) {
|
|||
platform: 'neutral', // makes esm
|
||||
format: 'esm',
|
||||
sourcemap: 'external',
|
||||
plugins: [boilerplateTrimmer],
|
||||
plugins: [boilerplateTrimmer, overrideExternalPlugin],
|
||||
target: ['es2022'],
|
||||
loader: {
|
||||
'.ttf': 'file',
|
||||
|
|
|
@ -96,6 +96,17 @@ function optimizeESMTask(opts: IOptimizeESMTaskOpts): NodeJS.ReadWriteStream {
|
|||
}
|
||||
};
|
||||
|
||||
const overrideExternalPlugin: esbuild.Plugin = {
|
||||
name: 'override-external',
|
||||
setup(build) {
|
||||
// We inline selected modules that are we depend on on startup without
|
||||
// a conditional `await import(...)` by hooking into the resolution.
|
||||
build.onResolve({ filter: /^minimist$/ }, () => {
|
||||
return { path: path.join(REPO_ROOT_PATH, 'node_modules', 'minimist', 'index.js'), external: false };
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const task = esbuild.build({
|
||||
bundle: true,
|
||||
external: entryPoint.exclude,
|
||||
|
@ -103,7 +114,7 @@ function optimizeESMTask(opts: IOptimizeESMTaskOpts): NodeJS.ReadWriteStream {
|
|||
platform: 'neutral', // makes esm
|
||||
format: 'esm',
|
||||
sourcemap: 'external',
|
||||
plugins: [boilerplateTrimmer],
|
||||
plugins: [boilerplateTrimmer, overrideExternalPlugin],
|
||||
target: ['es2022'],
|
||||
loader: {
|
||||
'.ttf': 'file',
|
||||
|
|
|
@ -18,11 +18,6 @@ flakySuite('Native Modules (all platforms)', () => {
|
|||
assert.ok(typeof kerberos.initializeClient === 'function', testErrorMessage('kerberos'));
|
||||
});
|
||||
|
||||
test('minimist', async () => {
|
||||
const { default: minimist } = await import('minimist');
|
||||
assert.ok(typeof minimist === 'function', testErrorMessage('minimist'));
|
||||
});
|
||||
|
||||
test('yauzl', async () => {
|
||||
const { default: yauzl } = await import('yauzl');
|
||||
assert.ok(typeof yauzl.ZipFile === 'function', testErrorMessage('yauzl'));
|
||||
|
|
|
@ -11,6 +11,7 @@ import { FileChangeType, IFileChange } from '../../common/files.js';
|
|||
import { URI } from '../../../../base/common/uri.js';
|
||||
import { DeferredPromise, ThrottledDelayer } from '../../../../base/common/async.js';
|
||||
import { hash } from '../../../../base/common/hash.js';
|
||||
import { onUnexpectedError } from '../../../../base/common/errors.js';
|
||||
|
||||
interface ISuspendedWatchRequest {
|
||||
readonly id: number;
|
||||
|
@ -107,7 +108,7 @@ export abstract class BaseWatcher extends Disposable implements IWatcher {
|
|||
}
|
||||
}
|
||||
|
||||
return this.updateWatchersDelayer.trigger(() => this.doWatch(nonSuspendedRequests), delayed ? this.getUpdateWatchersDelay() : 0);
|
||||
return this.updateWatchersDelayer.trigger(() => this.doWatch(nonSuspendedRequests), delayed ? this.getUpdateWatchersDelay() : 0).catch(error => onUnexpectedError(error));
|
||||
}
|
||||
|
||||
protected getUpdateWatchersDelay(): number {
|
||||
|
|
Loading…
Reference in New Issue