nx 19.6.0-beta.1 → 19.6.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/bin/post-install.js +8 -0
  2. package/package.json +12 -12
  3. package/schemas/nx-schema.json +25 -0
  4. package/schemas/project-schema.json +7 -0
  5. package/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +1 -0
  7. package/src/command-line/nx-commands.js +3 -0
  8. package/src/command-line/sync/command-object.d.ts +6 -0
  9. package/src/command-line/sync/command-object.js +25 -0
  10. package/src/command-line/sync/sync.d.ts +6 -0
  11. package/src/command-line/sync/sync.js +30 -0
  12. package/src/config/nx-json.d.ts +23 -0
  13. package/src/config/workspace-json-project-json.d.ts +5 -0
  14. package/src/daemon/client/client.d.ts +5 -0
  15. package/src/daemon/client/client.js +33 -0
  16. package/src/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +6 -0
  17. package/src/daemon/message-types/flush-sync-generator-changes-to-disk.js +11 -0
  18. package/src/daemon/message-types/get-registered-sync-generators.d.ts +5 -0
  19. package/src/daemon/message-types/get-registered-sync-generators.js +11 -0
  20. package/src/daemon/message-types/get-sync-generator-changes.d.ts +6 -0
  21. package/src/daemon/message-types/get-sync-generator-changes.js +11 -0
  22. package/src/daemon/message-types/update-workspace-context.d.ts +8 -0
  23. package/src/daemon/message-types/update-workspace-context.js +11 -0
  24. package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +2 -0
  25. package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +11 -0
  26. package/src/daemon/server/handle-get-registered-sync-generators.d.ts +2 -0
  27. package/src/daemon/server/handle-get-registered-sync-generators.js +11 -0
  28. package/src/daemon/server/handle-get-sync-generator-changes.d.ts +2 -0
  29. package/src/daemon/server/handle-get-sync-generator-changes.js +17 -0
  30. package/src/daemon/server/handle-update-workspace-context.d.ts +2 -0
  31. package/src/daemon/server/handle-update-workspace-context.js +11 -0
  32. package/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -0
  33. package/src/daemon/server/project-graph-incremental-recomputation.js +19 -2
  34. package/src/daemon/server/server.js +25 -0
  35. package/src/daemon/server/sync-generators.d.ts +6 -0
  36. package/src/daemon/server/sync-generators.js +202 -0
  37. package/src/daemon/socket-utils.js +18 -5
  38. package/src/daemon/tmp-dir.js +2 -1
  39. package/src/native/nx.wasm32-wasi.wasm +0 -0
  40. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  41. package/src/tasks-runner/run-command.d.ts +1 -1
  42. package/src/tasks-runner/run-command.js +120 -2
  43. package/src/utils/plugins/output.js +1 -1
  44. package/src/utils/sync-generators.d.ts +22 -0
  45. package/src/utils/sync-generators.js +161 -0
  46. package/src/utils/workspace-context.d.ts +1 -0
  47. package/src/utils/workspace-context.js +16 -0
  48. package/src/daemon/message-types/update-context-files.d.ts +0 -7
  49. package/src/daemon/message-types/update-context-files.js +0 -11
@@ -5,6 +5,7 @@ exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
5
5
  exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
6
6
  exports.globWithWorkspaceContext = globWithWorkspaceContext;
7
7
  exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
8
+ exports.updateContextWithChangedFiles = updateContextWithChangedFiles;
8
9
  exports.updateFilesInContext = updateFilesInContext;
9
10
  exports.getAllFileDataInContext = getAllFileDataInContext;
10
11
  exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
@@ -56,6 +57,21 @@ async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
56
57
  }
57
58
  return client_1.daemonClient.hashGlob(globs, exclude);
58
59
  }
60
+ async function updateContextWithChangedFiles(createdFiles, updatedFiles, deletedFiles) {
61
+ if (!client_1.daemonClient.enabled()) {
62
+ updateFilesInContext([...createdFiles, ...updatedFiles], deletedFiles);
63
+ }
64
+ else if ((0, is_on_daemon_1.isOnDaemon)()) {
65
+ // make sure to only import this when running on the daemon
66
+ const { addUpdatedAndDeletedFiles } = await Promise.resolve().then(() => require('../daemon/server/project-graph-incremental-recomputation'));
67
+ // update files for the incremental graph recomputation on the daemon
68
+ addUpdatedAndDeletedFiles(createdFiles, updatedFiles, deletedFiles);
69
+ }
70
+ else {
71
+ // daemon is enabled but we are not running on it, ask the daemon to update the context
72
+ await client_1.daemonClient.updateWorkspaceContext(createdFiles, updatedFiles, deletedFiles);
73
+ }
74
+ }
59
75
  function updateFilesInContext(updatedFiles, deletedFiles) {
60
76
  return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
61
77
  }
@@ -1,7 +0,0 @@
1
- export declare const GLOB: "GLOB";
2
- export type HandleUpdateContextMessage = {
3
- type: typeof GLOB;
4
- updatedFiles: string[];
5
- deletedFiles: string[];
6
- };
7
- export declare function isHandleUpdateContextMessage(message: unknown): message is HandleUpdateContextMessage;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GLOB = void 0;
4
- exports.isHandleUpdateContextMessage = isHandleUpdateContextMessage;
5
- exports.GLOB = 'GLOB';
6
- function isHandleUpdateContextMessage(message) {
7
- return (typeof message === 'object' &&
8
- message !== null &&
9
- 'type' in message &&
10
- message['type'] === exports.GLOB);
11
- }