Skip to content

Commit

Permalink
Merge branch 'master' into jzempel/config-unlink
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Nov 3, 2023
2 parents ac98a9e + 20a64a1 commit c122ed0
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 40 deletions.
6 changes: 5 additions & 1 deletion cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) {
// do nothing
}

run(command);
const promise = run(command);
if (command.forceExit) {
// eslint-disable-next-line unicorn/no-process-exit
promise.then(() => process.exit());
}
}
1 change: 1 addition & 0 deletions cli/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Basic options:
--failAfterWarnings Exit with an error if the build produced warnings
--filterLogs <filter> Filter log messages
--footer <text> Code to insert at end of bundle (outside wrapper)
--forceExit Force exit the process when done
--no-freeze Do not freeze namespace objects
--generatedCode <preset> Which code features to use (es5/es2015)
--generatedCode.arrowFunctions Use arrow functions in generated code
Expand Down
7 changes: 7 additions & 0 deletions docs/command-line-interface/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ Many options have command line equivalents. In those cases, any arguments passed
--failAfterWarnings Exit with an error if the build produced warnings
--filterLogs <filter> Filter log messages
--footer <text> Code to insert at end of bundle (outside wrapper)
--forceExit Force exit the process when done
--no-freeze Do not freeze namespace objects
--generatedCode <preset> Which code features to use (es5/es2015)
--generatedCode.arrowFunctions Use arrow functions in generated code
Expand Down Expand Up @@ -556,6 +557,12 @@ There is also some advanced syntax available for more complex filters.

will only display logs where the property `log.foo.bar` has the value `"value"`.

### `--forceExit`

Force exit the process when done. In some cases plugins or their dependencies might not cleanup properly and prevent the CLI process from exiting. The root cause can be hard to diagnose and this flag provides an escape hatch until it can be identified and resolved.

Note that this might break certain workflows and won't always work properly.
### `-h`/`--help`
Print the help document.
Expand Down
30 changes: 6 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,12 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-unicorn": "^49.0.0",
"eslint-plugin-vue": "^9.18.0",
"fixturify": "^3.0.0",
"flru": "^1.0.2",
"fs-extra": "^11.1.1",
"github-api": "^3.4.0",
"hash.js": "^1.1.7",
"husky": "^8.0.3",
"inquirer": "^9.2.11",
"is-reference": "^3.0.2",
Expand Down
5 changes: 5 additions & 0 deletions test/cli/samples/force-exit/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = defineTest({
description: 'force exits even with open handles',
command: 'rollup --config rollup.config.js --forceExit',
execute: true
});
Empty file.
16 changes: 16 additions & 0 deletions test/cli/samples/force-exit/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
input: 'main.js',
output: {
format: 'cjs'
},
plugins: [
{
name: 'open-handles',
buildStart() {
setInterval(() => {
// hang forever
}, 2 ** 24);
}
}
]
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"target": "ES2022",
"useDefineForClassFields": false
},
"include": ["typings/**/*.d.ts", "src", "cli", "browser", "rollup.config.ts", "native", "wasm.d.ts"],
"include": ["typings/**/*.d.ts", "src", "cli", "browser", "rollup.config.ts", "native"],
"exclude": ["dist", "node_modules", "test/typescript", "browser/dist"]
}
6 changes: 0 additions & 6 deletions typings/hash.js.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions wasm.d.ts

This file was deleted.

0 comments on commit c122ed0

Please sign in to comment.