@nx/vite 23.2.0-beta.4 → 23.2.0-beta.5

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.
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxViteBuildCoordinationPlugin = nxViteBuildCoordinationPlugin;
4
- const watch_1 = require("nx/src/command-line/watch/watch");
5
4
  const child_process_1 = require("child_process");
6
- const client_1 = require("nx/src/daemon/client/client");
7
- const output_1 = require("nx/src/utils/output");
5
+ const internal_1 = require("@nx/devkit/internal");
6
+ const devkit_1 = require("@nx/devkit");
8
7
  function nxViteBuildCoordinationPlugin(options) {
9
8
  let activeBuildProcess;
10
9
  let unregisterFileWatcher;
@@ -40,13 +39,13 @@ function nxViteBuildCoordinationPlugin(options) {
40
39
  function createFileWatcher() {
41
40
  // Failed rebuilds in watch mode should not crash the dev server. Log and
42
41
  // keep watching so the next file change can rebuild.
43
- const runner = new watch_1.BatchFunctionRunner(() => buildChangedProjects().catch((error) => {
44
- output_1.output.error({
42
+ const runner = new internal_1.BatchFunctionRunner(() => buildChangedProjects().catch((error) => {
43
+ devkit_1.output.error({
45
44
  title: 'Failed to rebuild projects. Fix the errors and save again.',
46
45
  bodyLines: error?.message ? [error.message] : undefined,
47
46
  });
48
47
  }));
49
- return client_1.daemonClient.registerFileWatcher({ watchProjects: 'all' }, (err, data) => {
48
+ return internal_1.daemonClient.registerFileWatcher({ watchProjects: 'all' }, (err, data) => {
50
49
  if (err === 'reconnecting') {
51
50
  // Silent - daemon restarts automatically on lockfile changes
52
51
  return;
@@ -56,13 +55,13 @@ function nxViteBuildCoordinationPlugin(options) {
56
55
  return;
57
56
  }
58
57
  else if (err === 'closed') {
59
- output_1.output.error({
58
+ devkit_1.output.error({
60
59
  title: `Failed to reconnect to daemon after multiple attempts`,
61
60
  });
62
61
  process.exit(1);
63
62
  }
64
63
  else if (err) {
65
- output_1.output.error({
64
+ devkit_1.output.error({
66
65
  title: `Watch error: ${err?.message ?? 'Unknown'}`,
67
66
  });
68
67
  }
@@ -83,13 +82,13 @@ function nxViteBuildCoordinationPlugin(options) {
83
82
  if (firstBuildStart) {
84
83
  firstBuildStart = false;
85
84
  await buildChangedProjects();
86
- if (client_1.daemonClient.enabled()) {
85
+ if (internal_1.daemonClient.enabled()) {
87
86
  unregisterFileWatcher = await createFileWatcher();
88
87
  process.on('exit', () => unregisterFileWatcher());
89
88
  process.on('SIGINT', () => process.exit());
90
89
  }
91
90
  else {
92
- output_1.output.warn({
91
+ devkit_1.output.warn({
93
92
  title: 'Nx Daemon is not enabled. Projects will not be rebuilt when files change.',
94
93
  });
95
94
  }
@@ -7,8 +7,6 @@ const js_1 = require("@nx/js");
7
7
  const internal_2 = require("@nx/js/internal");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_path_1 = require("node:path");
10
- const file_hasher_1 = require("nx/src/hasher/file-hasher");
11
- const cache_directory_1 = require("nx/src/utils/cache-directory");
12
10
  const executor_utils_1 = require("../utils/executor-utils");
13
11
  const picomatch = require("picomatch");
14
12
  /**
@@ -22,9 +20,9 @@ const viteConfigGlob = '**/vite.config.{js,ts,mjs,mts,cjs,cts}';
22
20
  exports.createNodes = [
23
21
  viteConfigGlob,
24
22
  async (configFilePaths, options, context) => {
25
- const optionsHash = (0, file_hasher_1.hashObject)(options);
23
+ const optionsHash = (0, internal_1.hashObject)(options);
26
24
  const normalizedOptions = normalizeOptions(options);
27
- const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
25
+ const cachePath = (0, node_path_1.join)(internal_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
28
26
  const targetsCache = new internal_1.PluginCache(cachePath);
29
27
  const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
30
28
  const { roots: projectRoots, configFiles: validConfigFiles } = configFilePaths.reduce((acc, configFile) => {
@@ -1,3 +1,3 @@
1
- import type { Tree } from 'nx/src/generators/tree';
1
+ import { type Tree } from '@nx/devkit';
2
2
  export declare function getInstalledViteVersion(tree: Tree): string | undefined;
3
3
  export declare function getInstalledViteMajorVersion(tree: Tree): 5 | 6 | 7 | 8 | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vite",
3
- "version": "23.2.0-beta.4",
3
+ "version": "23.2.0-beta.5",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -101,13 +101,13 @@
101
101
  "semver": "^7.6.3",
102
102
  "tslib": "^2.3.0",
103
103
  "ajv": "^8.0.0",
104
- "@nx/devkit": "23.2.0-beta.4",
105
- "@nx/js": "23.2.0-beta.4",
106
- "@nx/vitest": "23.2.0-beta.4"
104
+ "@nx/devkit": "23.2.0-beta.5",
105
+ "@nx/js": "23.2.0-beta.5",
106
+ "@nx/vitest": "23.2.0-beta.5"
107
107
  },
108
108
  "devDependencies": {
109
- "@nx/eslint": "23.2.0-beta.4",
110
- "nx": "23.2.0-beta.4"
109
+ "@nx/eslint": "23.2.0-beta.5",
110
+ "nx": "23.2.0-beta.5"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"