@nx/rollup 23.3.0-beta.6 → 23.3.0-beta.8

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 CHANGED
@@ -12,7 +12,7 @@
12
12
  [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](<>)
13
13
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
14
14
  [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
15
- [![Nx Sandboxing](https://staging.nx.app/workspaces/62d013ea0852fe0a2df74438/sandbox-badge.svg)](https://nx.dev/docs/features/ci-features/sandboxing)
15
+ [![Hours saved](https://img.shields.io/endpoint?url=https%3A%2F%2Fstaging.nx.app%2Fnx-cloud%2Fbadge%2F62d013ea0852fe0a2df74438%2Fhours-saved.json)](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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/rollup",
3
- "version": "23.3.0-beta.6",
3
+ "version": "23.3.0-beta.8",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -77,8 +77,8 @@
77
77
  }
78
78
  },
79
79
  "dependencies": {
80
- "@nx/devkit": "23.3.0-beta.6",
81
- "@nx/js": "23.3.0-beta.6",
80
+ "@nx/devkit": "23.3.0-beta.8",
81
+ "@nx/js": "23.3.0-beta.8",
82
82
  "@phenomnomnominal/tsquery": "~6.2.0",
83
83
  "@rollup/plugin-babel": "^6.0.4",
84
84
  "@rollup/plugin-commonjs": "^25.0.7",
@@ -103,7 +103,7 @@
103
103
  }
104
104
  },
105
105
  "devDependencies": {
106
- "nx": "23.3.0-beta.6",
106
+ "nx": "23.3.0-beta.8",
107
107
  "source-map-js": "^1.2.0"
108
108
  },
109
109
  "publishConfig": {