@nx/web 16.8.0-beta.2 → 16.8.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/web",
3
- "version": "16.8.0-beta.2",
3
+ "version": "16.8.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Web Components contains generators for managing Web Component applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Scaffolding for creating buildable libraries that can be published to npm.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -30,19 +30,17 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nrwl/web": "16.8.0-beta.2",
34
- "@nx/devkit": "16.8.0-beta.2",
35
- "@nx/js": "16.8.0-beta.2",
33
+ "@nrwl/web": "16.8.0-beta.4",
34
+ "@nx/devkit": "16.8.0-beta.4",
35
+ "@nx/js": "16.8.0-beta.4",
36
36
  "chalk": "^4.1.0",
37
- "chokidar": "^3.5.1",
38
37
  "detect-port": "^1.5.1",
39
38
  "http-server": "^14.1.0",
40
- "ignore": "^5.0.4",
41
39
  "tslib": "^2.3.0"
42
40
  },
43
41
  "publishConfig": {
44
42
  "access": "public"
45
43
  },
46
44
  "type": "commonjs",
47
- "gitHead": "9bcc04742f9e1516d8c1ddbfb1907770c347876f"
45
+ "gitHead": "c9aad2dc8c2b34531cf61549bff872e68c481e4e"
48
46
  }
@@ -4,13 +4,12 @@ const tslib_1 = require("tslib");
4
4
  const child_process_1 = require("child_process");
5
5
  const chalk = require("chalk");
6
6
  const devkit_1 = require("@nx/devkit");
7
- const ignore_1 = require("ignore");
8
7
  const fs_1 = require("fs");
9
- const chokidar_1 = require("chokidar");
10
8
  const os_1 = require("os");
11
9
  const path_1 = require("path");
12
10
  const package_json_1 = require("nx/src/utils/package-json");
13
11
  const detectPort = require("detect-port");
12
+ const client_1 = require("nx/src/daemon/client/client");
14
13
  // platform specific command name
15
14
  const pmCmd = (0, os_1.platform)() === 'win32' ? `npx.cmd` : 'npx';
16
15
  function getHttpServerArgs(options) {
@@ -75,30 +74,23 @@ function getBuildTargetOutputPath(options, context) {
75
74
  }
76
75
  return outputPath;
77
76
  }
78
- function getIgnoredGlobs(root) {
79
- const ig = (0, ignore_1.default)();
80
- try {
81
- ig.add((0, fs_1.readFileSync)(`${root}/.gitignore`, 'utf-8'));
82
- }
83
- catch (_a) { }
84
- try {
85
- ig.add((0, fs_1.readFileSync)(`${root}/.nxignore`, 'utf-8'));
86
- }
87
- catch (_b) { }
88
- return ig;
89
- }
90
- function createFileWatcher(root, projectRoot, changeHandler) {
91
- const ignoredGlobs = getIgnoredGlobs(root);
92
- const watcher = (0, chokidar_1.watch)([(0, devkit_1.joinPathFragments)(projectRoot, '**')], {
93
- cwd: root,
94
- ignoreInitial: true,
95
- });
96
- watcher.on('all', (_event, path) => {
97
- if (ignoredGlobs.ignores(path))
98
- return;
99
- changeHandler();
100
- });
101
- return () => watcher.close();
77
+ function createFileWatcher(project, changeHandler) {
78
+ return client_1.daemonClient.registerFileWatcher({
79
+ watchProjects: project ? [project] : 'all',
80
+ includeGlobalWorkspaceFiles: true,
81
+ includeDependentProjects: true,
82
+ }, (error, { changedFiles }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
83
+ var _a;
84
+ if (error === 'closed') {
85
+ throw new Error('Watch error: Daemon closed the connection');
86
+ }
87
+ else if (error) {
88
+ throw new Error(`Watch error: ${(_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : 'Unknown'}`);
89
+ }
90
+ else if (changedFiles.length > 0) {
91
+ changeHandler();
92
+ }
93
+ }));
102
94
  }
103
95
  function fileServerExecutor(options, context) {
104
96
  return tslib_1.__asyncGenerator(this, arguments, function* fileServerExecutor_1() {
@@ -123,7 +115,7 @@ function fileServerExecutor(options, context) {
123
115
  let disposeWatch;
124
116
  if (options.watch) {
125
117
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
126
- disposeWatch = createFileWatcher(context.root, projectRoot, run);
118
+ disposeWatch = yield tslib_1.__await(createFileWatcher(context.projectName, run));
127
119
  }
128
120
  // perform initial run
129
121
  run();