@nx/rollup 23.3.0-pr.37068.f95e11e → 23.3.0-pr.37224.268062c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/plugins/with-nx/watch-program-timers.d.ts +10 -0
- package/dist/src/plugins/with-nx/watch-program-timers.js +43 -0
- package/dist/src/plugins/with-nx/with-nx.js +2 -0
- package/dist/src/utils/ensure-dependencies.js +4 -0
- package/package.json +6 -6
- package/readme-template.md +18 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](<>)
|
|
13
13
|
[](http://commitizen.github.io/cz-cli/)
|
|
14
14
|
[](https://go.nx.dev/community)
|
|
15
|
-
[](https://nx.dev/nx-cloud)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as TypeScript from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Returns TypeScript with a `createWatchProgram` whose programs clear the
|
|
4
|
+
* timers they armed when they are closed.
|
|
5
|
+
*
|
|
6
|
+
* TypeScript's `close()` does not cancel a pending program-update timer.
|
|
7
|
+
* If it fires after close, it can recreate file watchers and keep a
|
|
8
|
+
* one-shot Rollup process alive.
|
|
9
|
+
*/
|
|
10
|
+
export declare function clearTimersOnClose(ts: typeof TypeScript): typeof TypeScript;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearTimersOnClose = clearTimersOnClose;
|
|
4
|
+
/**
|
|
5
|
+
* Returns TypeScript with a `createWatchProgram` whose programs clear the
|
|
6
|
+
* timers they armed when they are closed.
|
|
7
|
+
*
|
|
8
|
+
* TypeScript's `close()` does not cancel a pending program-update timer.
|
|
9
|
+
* If it fires after close, it can recreate file watchers and keep a
|
|
10
|
+
* one-shot Rollup process alive.
|
|
11
|
+
*/
|
|
12
|
+
function clearTimersOnClose(ts) {
|
|
13
|
+
return Object.create(ts, {
|
|
14
|
+
createWatchProgram: {
|
|
15
|
+
value(host) {
|
|
16
|
+
const pending = new Set();
|
|
17
|
+
const { setTimeout: schedule, clearTimeout: cancel } = host;
|
|
18
|
+
if (schedule && cancel) {
|
|
19
|
+
host.setTimeout = (callback, ms, ...args) => {
|
|
20
|
+
const timer = schedule(() => {
|
|
21
|
+
pending.delete(timer);
|
|
22
|
+
callback(...args);
|
|
23
|
+
}, ms);
|
|
24
|
+
pending.add(timer);
|
|
25
|
+
return timer;
|
|
26
|
+
};
|
|
27
|
+
host.clearTimeout = (timer) => {
|
|
28
|
+
pending.delete(timer);
|
|
29
|
+
cancel(timer);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const program = ts.createWatchProgram(host);
|
|
33
|
+
const close = program.close;
|
|
34
|
+
program.close = () => {
|
|
35
|
+
close.call(program);
|
|
36
|
+
pending.forEach((timer) => cancel(timer));
|
|
37
|
+
pending.clear();
|
|
38
|
+
};
|
|
39
|
+
return program;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -19,6 +19,7 @@ const generate_package_json_1 = require("../package-json/generate-package-json")
|
|
|
19
19
|
const swc_1 = require("../swc");
|
|
20
20
|
const get_project_node_1 = require("./get-project-node");
|
|
21
21
|
const normalize_options_1 = require("./normalize-options");
|
|
22
|
+
const watch_program_timers_1 = require("./watch-program-timers");
|
|
22
23
|
// These use require because the ES import isn't correct.
|
|
23
24
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
24
25
|
const image = require('@rollup/plugin-image');
|
|
@@ -173,6 +174,7 @@ dependencies) {
|
|
|
173
174
|
: finalConfig.output.dir;
|
|
174
175
|
return require('@rollup/plugin-typescript')({
|
|
175
176
|
tsconfig: tsConfigPath,
|
|
177
|
+
typescript: (0, watch_program_timers_1.clearTimersOnClose)(ts),
|
|
176
178
|
compilerOptions: {
|
|
177
179
|
...tsCompilerOptions,
|
|
178
180
|
composite: false,
|
|
@@ -19,6 +19,10 @@ function ensureDependencies(tree, options) {
|
|
|
19
19
|
'swc-loader': versions_1.swcLoaderVersion,
|
|
20
20
|
}, undefined, true);
|
|
21
21
|
case 'babel':
|
|
22
|
+
// core-js' install script only prints a funding message.
|
|
23
|
+
(0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
|
|
24
|
+
'core-js': false,
|
|
25
|
+
});
|
|
22
26
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
23
27
|
'core-js': versions_1.coreJsVersion, // needed for preset-env to work
|
|
24
28
|
tslib: versions_1.tsLibVersion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rollup",
|
|
3
|
-
"version": "23.3.0-pr.
|
|
3
|
+
"version": "23.3.0-pr.37224.268062c",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
+
"@nx/devkit": "23.3.0-pr.37224.268062c",
|
|
81
|
+
"@nx/js": "23.3.0-pr.37224.268062c",
|
|
80
82
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
81
83
|
"@rollup/plugin-babel": "^6.0.4",
|
|
82
84
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -90,9 +92,7 @@
|
|
|
90
92
|
"picomatch": "4.0.4",
|
|
91
93
|
"postcss": "^8.4.38",
|
|
92
94
|
"postcss-modules": "^6.0.1",
|
|
93
|
-
"tslib": "^2.3.0"
|
|
94
|
-
"@nx/devkit": "23.3.0-pr.37068.f95e11e",
|
|
95
|
-
"@nx/js": "23.3.0-pr.37068.f95e11e"
|
|
95
|
+
"tslib": "^2.3.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"rollup": "^3.0.0 || ^4.0.0"
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"
|
|
107
|
-
"
|
|
106
|
+
"nx": "23.3.0-pr.37224.268062c",
|
|
107
|
+
"source-map-js": "^1.2.0"
|
|
108
108
|
},
|
|
109
109
|
"publishConfig": {
|
|
110
110
|
"access": "public"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
{{links}}
|
|
9
|
+
|
|
10
|
+
<hr>
|
|
11
|
+
|
|
12
|
+
# Nx: Smart Monorepos · Fast Builds
|
|
13
|
+
|
|
14
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
15
|
+
|
|
16
|
+
This package is a [Rollup plugin for Nx](https://nx.dev/nx-api/rollup).
|
|
17
|
+
|
|
18
|
+
{{content}}
|