Conversation
🦋 Changeset is good to goLatest commit: 5e0adf7 We got this. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The preview packages of this pull request have been published. @bigtest/agentInstall using the following command: $ npm install @bigtest/agent@manifestOr update your package.json file: {
"@bigtest/agent": "manifest"
}@bigtest/atomInstall using the following command: $ npm install @bigtest/atom@manifestOr update your package.json file: {
"@bigtest/atom": "manifest"
}@bigtest/bundlerInstall using the following command: $ npm install @bigtest/bundler@manifestOr update your package.json file: {
"@bigtest/bundler": "manifest"
}@bigtest/cliInstall using the following command: $ npm install @bigtest/cli@manifestOr update your package.json file: {
"@bigtest/cli": "manifest"
}@bigtest/interactorInstall using the following command: $ npm install @bigtest/interactor@manifestOr update your package.json file: {
"@bigtest/interactor": "manifest"
}@bigtest/serverInstall using the following command: $ npm install @bigtest/server@manifestOr update your package.json file: {
"@bigtest/server": "manifest"
}@bigtest/webdriverInstall using the following command: $ npm install @bigtest/webdriver@manifestOr update your package.json file: {
"@bigtest/webdriver": "manifest"
} |
cowboyd
left a comment
There was a problem hiding this comment.
Nice set of stability fixes! 🍷
packages/bundler/src/bundler.ts
Outdated
| }); | ||
|
|
||
| rollup = watch(prepareRollupOptions(bundles)); | ||
| let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event')); |
There was a problem hiding this comment.
I'm still not quite sure why a try/catch won't catch the right thing. If you put it around 82-90, it will catch any exception raised therein.
There was a problem hiding this comment.
This is what it was originally:
let rollup: RollupWatcher = watch(prepareRollupOptions(bundles));;
let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event'));
let messages = events
.map(([event]) => event)
.filter(event => event.code === 'END' || event.code === 'ERROR')
.map(event => event.code === 'ERROR' ? { type: 'error', error: event.error } : { type: 'update' });
try {
yield messages.forEach(function*(message) {
bundler.channel.send(message as BundlerMessage);
});
} finally {
rollup.close();
}Which is wrong I think, prompting me to make a change. However, rather than just wrap more in the try block I thought ensure() was the way to go, but now that you've explained that that's not the way to go I'll update to this:
let rollup: RollupWatcher = watch(prepareRollupOptions(bundles));;
try {
let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event'));
let messages = events
.map(([event]) => event)
.filter(event => event.code === 'END' || event.code === 'ERROR')
.map(event => event.code === 'ERROR' ? { type: 'error', error: event.error } : { type: 'update' });
yield messages.forEach(function*(message) {
bundler.channel.send(message as BundlerMessage);
});
} finally {
rollup.close();
}
Motivation
I noticed a few things to clean up:
Bundlertry/finallywas not wrapping the code that needed itfs.promises.truncate()that causes warnings fsPromises.truncate doesn't close fd. nodejs/node#34189Approach
ensure()API instead oftry/finallyinBundlerftruncate()instead oftruncate()until the fix is released