nx 21.0.0-canary.20250206-8bd0bcd → 21.0.0-canary.20250418-8619c1d
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/.eslintrc.json +5 -1
- package/package.json +13 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +186 -35
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/graph/graph.js +2 -0
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +47 -35
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +4 -1
- package/src/command-line/init/implementation/utils.js +108 -44
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +68 -38
- package/src/command-line/migrate/migrate-ui-api.d.ts +56 -0
- package/src/command-line/migrate/migrate-ui-api.js +188 -0
- package/src/command-line/migrate/migrate.d.ts +17 -0
- package/src/command-line/migrate/migrate.js +106 -63
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.js +18 -15
- package/src/command-line/release/command-object.d.ts +2 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +129 -42
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/index.d.ts +4 -0
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +251 -0
- package/src/command-line/release/version/release-group-processor.js +1040 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +95 -0
- package/src/command-line/release/version/test-utils.js +416 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +170 -0
- package/src/command-line/release/version/version-actions.js +183 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +80 -262
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/run.js +1 -1
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/commands-runner/get-command-projects.js +17 -2
- package/src/config/misc-interfaces.d.ts +10 -0
- package/src/config/nx-json.d.ts +153 -15
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/task-graph.d.ts +5 -0
- package/src/config/workspace-json-project-json.d.ts +6 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.js +15 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-internals.d.ts +2 -1
- package/src/devkit-internals.js +4 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +18 -17
- package/src/executors/run-commands/run-commands.impl.js +25 -292
- package/src/executors/run-commands/running-tasks.d.ts +40 -0
- package/src/executors/run-commands/running-tasks.js +386 -0
- package/src/executors/run-script/run-script.impl.js +4 -3
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/native/index.d.ts +94 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +6 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +2 -1
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.d.ts +1 -1
- package/src/plugins/package-json/create-nodes.js +3 -1
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +25 -11
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +2 -3
- package/src/tasks-runner/cache.d.ts +20 -6
- package/src/tasks-runner/cache.js +104 -20
- package/src/tasks-runner/create-task-graph.d.ts +4 -1
- package/src/tasks-runner/create-task-graph.js +48 -16
- package/src/tasks-runner/default-tasks-runner.js +4 -13
- package/src/tasks-runner/forked-process-task-runner.d.ts +13 -14
- package/src/tasks-runner/forked-process-task-runner.js +160 -303
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +59 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +64 -0
- package/src/tasks-runner/life-cycle.d.ts +10 -3
- package/src/tasks-runner/life-cycle.js +23 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +7 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +6 -1
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +17 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +221 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +17 -8
- package/src/tasks-runner/pseudo-terminal.js +63 -47
- package/src/tasks-runner/run-command.d.ts +1 -0
- package/src/tasks-runner/run-command.js +180 -23
- package/src/tasks-runner/running-tasks/batch-process.d.ts +14 -0
- package/src/tasks-runner/running-tasks/batch-process.js +70 -0
- package/src/tasks-runner/running-tasks/node-child-process.d.ts +36 -0
- package/src/tasks-runner/running-tasks/node-child-process.js +184 -0
- package/src/tasks-runner/running-tasks/noop-child-process.d.ts +15 -0
- package/src/tasks-runner/running-tasks/noop-child-process.js +19 -0
- package/src/tasks-runner/running-tasks/running-task.d.ts +8 -0
- package/src/tasks-runner/running-tasks/running-task.js +6 -0
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-orchestrator.d.ts +25 -7
- package/src/tasks-runner/task-orchestrator.js +237 -95
- package/src/tasks-runner/tasks-schedule.js +5 -1
- package/src/tasks-runner/utils.d.ts +2 -10
- package/src/tasks-runner/utils.js +27 -15
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/git-utils.d.ts +1 -1
- package/src/utils/git-utils.js +8 -3
- package/src/utils/handle-errors.js +15 -0
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
package/src/native/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { join, basename } = require('path');
|
2
|
-
const { copyFileSync, existsSync, mkdirSync } = require('fs');
|
2
|
+
const { copyFileSync, existsSync, mkdirSync, renameSync } = require('fs');
|
3
3
|
const Module = require('module');
|
4
4
|
const { nxVersion } = require('../utils/versions');
|
5
5
|
const { getNativeFileCacheLocation } = require('./native-file-cache-location');
|
@@ -71,14 +71,28 @@ Module._load = function (request, parent, isMain) {
|
|
71
71
|
|
72
72
|
// we copy the file to a workspace-scoped tmp directory and prefix with nxVersion to avoid stale files being loaded
|
73
73
|
const nativeFileCacheLocation = getNativeFileCacheLocation();
|
74
|
+
// This is a path to copy to, not the one that gets loaded
|
75
|
+
const tmpTmpFile = join(
|
76
|
+
nativeFileCacheLocation,
|
77
|
+
nxVersion + '-' + Math.random() + fileName
|
78
|
+
);
|
79
|
+
// This is the path that will get loaded
|
74
80
|
const tmpFile = join(nativeFileCacheLocation, nxVersion + '-' + fileName);
|
81
|
+
|
82
|
+
// If the file to be loaded already exists, just load it
|
75
83
|
if (existsSync(tmpFile)) {
|
76
84
|
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
77
85
|
}
|
78
86
|
if (!existsSync(nativeFileCacheLocation)) {
|
79
87
|
mkdirSync(nativeFileCacheLocation, { recursive: true });
|
80
88
|
}
|
81
|
-
|
89
|
+
// First copy to a unique location for each process
|
90
|
+
copyFileSync(nativeLocation, tmpTmpFile);
|
91
|
+
|
92
|
+
// Then rename to the final location
|
93
|
+
renameSync(tmpTmpFile, tmpFile);
|
94
|
+
|
95
|
+
// Load from the final location
|
82
96
|
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
83
97
|
} else {
|
84
98
|
// call the original _load function for everything else
|
@@ -361,12 +361,15 @@ if (!nativeBinding) {
|
|
361
361
|
throw new Error(`Failed to load native binding`)
|
362
362
|
}
|
363
363
|
|
364
|
+
module.exports.AppLifeCycle = nativeBinding.AppLifeCycle
|
364
365
|
module.exports.ChildProcess = nativeBinding.ChildProcess
|
365
366
|
module.exports.FileLock = nativeBinding.FileLock
|
366
367
|
module.exports.HashPlanner = nativeBinding.HashPlanner
|
368
|
+
module.exports.HttpRemoteCache = nativeBinding.HttpRemoteCache
|
367
369
|
module.exports.ImportResult = nativeBinding.ImportResult
|
368
370
|
module.exports.NxCache = nativeBinding.NxCache
|
369
371
|
module.exports.NxTaskHistory = nativeBinding.NxTaskHistory
|
372
|
+
module.exports.RunningTasksService = nativeBinding.RunningTasksService
|
370
373
|
module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
|
371
374
|
module.exports.TaskDetails = nativeBinding.TaskDetails
|
372
375
|
module.exports.TaskHasher = nativeBinding.TaskHasher
|
@@ -379,12 +382,15 @@ module.exports.EventType = nativeBinding.EventType
|
|
379
382
|
module.exports.expandOutputs = nativeBinding.expandOutputs
|
380
383
|
module.exports.findImports = nativeBinding.findImports
|
381
384
|
module.exports.getBinaryTarget = nativeBinding.getBinaryTarget
|
385
|
+
module.exports.getDefaultMaxCacheSize = nativeBinding.getDefaultMaxCacheSize
|
382
386
|
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
383
387
|
module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
|
384
388
|
module.exports.hashArray = nativeBinding.hashArray
|
385
389
|
module.exports.hashFile = nativeBinding.hashFile
|
386
390
|
module.exports.IS_WASM = nativeBinding.IS_WASM
|
387
391
|
module.exports.remove = nativeBinding.remove
|
392
|
+
module.exports.restoreTerminal = nativeBinding.restoreTerminal
|
393
|
+
module.exports.TaskStatus = nativeBinding.TaskStatus
|
388
394
|
module.exports.testOnlyTransferFileMap = nativeBinding.testOnlyTransferFileMap
|
389
395
|
module.exports.transferProjectGraph = nativeBinding.transferProjectGraph
|
390
396
|
module.exports.validateOutputs = nativeBinding.validateOutputs
|
@@ -76,25 +76,26 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
76
76
|
__napiInstance.exports['__napi_register__TaskHasher_impl_27']?.()
|
77
77
|
__napiInstance.exports['__napi_register__Task_struct_28']?.()
|
78
78
|
__napiInstance.exports['__napi_register__TaskTarget_struct_29']?.()
|
79
|
-
__napiInstance.exports['
|
80
|
-
__napiInstance.exports['
|
81
|
-
__napiInstance.exports['
|
82
|
-
__napiInstance.exports['
|
83
|
-
__napiInstance.exports['
|
84
|
-
__napiInstance.exports['
|
85
|
-
__napiInstance.exports['
|
86
|
-
__napiInstance.exports['
|
87
|
-
__napiInstance.exports['
|
88
|
-
__napiInstance.exports['
|
89
|
-
__napiInstance.exports['
|
90
|
-
__napiInstance.exports['
|
91
|
-
__napiInstance.exports['
|
92
|
-
__napiInstance.exports['
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
79
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_30']?.()
|
80
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_31']?.()
|
81
|
+
__napiInstance.exports['__napi_register__FileData_struct_32']?.()
|
82
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_33']?.()
|
83
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_34']?.()
|
84
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_35']?.()
|
85
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_36']?.()
|
86
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_37']?.()
|
87
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_38']?.()
|
88
|
+
__napiInstance.exports['__napi_register__NxJson_struct_39']?.()
|
89
|
+
__napiInstance.exports['__napi_register__FileLock_struct_40']?.()
|
90
|
+
__napiInstance.exports['__napi_register__FileLock_impl_42']?.()
|
91
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_43']?.()
|
92
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_54']?.()
|
93
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_55']?.()
|
94
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_56']?.()
|
95
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_57']?.()
|
96
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_58']?.()
|
97
|
+
__napiInstance.exports['__napi_register__FileMap_struct_59']?.()
|
98
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_60']?.()
|
98
99
|
}
|
99
100
|
export const FileLock = __napiModule.exports.FileLock
|
100
101
|
export const HashPlanner = __napiModule.exports.HashPlanner
|
package/src/native/nx.wasi.cjs
CHANGED
@@ -107,25 +107,26 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
107
107
|
__napiInstance.exports['__napi_register__TaskHasher_impl_27']?.()
|
108
108
|
__napiInstance.exports['__napi_register__Task_struct_28']?.()
|
109
109
|
__napiInstance.exports['__napi_register__TaskTarget_struct_29']?.()
|
110
|
-
__napiInstance.exports['
|
111
|
-
__napiInstance.exports['
|
112
|
-
__napiInstance.exports['
|
113
|
-
__napiInstance.exports['
|
114
|
-
__napiInstance.exports['
|
115
|
-
__napiInstance.exports['
|
116
|
-
__napiInstance.exports['
|
117
|
-
__napiInstance.exports['
|
118
|
-
__napiInstance.exports['
|
119
|
-
__napiInstance.exports['
|
120
|
-
__napiInstance.exports['
|
121
|
-
__napiInstance.exports['
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
124
|
-
__napiInstance.exports['
|
125
|
-
__napiInstance.exports['
|
126
|
-
__napiInstance.exports['
|
127
|
-
__napiInstance.exports['
|
128
|
-
__napiInstance.exports['
|
110
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_30']?.()
|
111
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_31']?.()
|
112
|
+
__napiInstance.exports['__napi_register__FileData_struct_32']?.()
|
113
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_33']?.()
|
114
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_34']?.()
|
115
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_35']?.()
|
116
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_36']?.()
|
117
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_37']?.()
|
118
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_38']?.()
|
119
|
+
__napiInstance.exports['__napi_register__NxJson_struct_39']?.()
|
120
|
+
__napiInstance.exports['__napi_register__FileLock_struct_40']?.()
|
121
|
+
__napiInstance.exports['__napi_register__FileLock_impl_42']?.()
|
122
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_43']?.()
|
123
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_54']?.()
|
124
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_55']?.()
|
125
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_56']?.()
|
126
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_57']?.()
|
127
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_58']?.()
|
128
|
+
__napiInstance.exports['__napi_register__FileMap_struct_59']?.()
|
129
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_60']?.()
|
129
130
|
}
|
130
131
|
module.exports.FileLock = __napiModule.exports.FileLock
|
131
132
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
Binary file
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.nxCloudTasksRunnerShell = void 0;
|
4
|
-
const resolution_helpers_1 = require("./resolution-helpers");
|
5
|
-
const update_manager_1 = require("./update-manager");
|
6
4
|
const default_tasks_runner_1 = require("../tasks-runner/default-tasks-runner");
|
7
5
|
const output_1 = require("../utils/output");
|
6
|
+
const resolution_helpers_1 = require("./resolution-helpers");
|
7
|
+
const update_manager_1 = require("./update-manager");
|
8
8
|
const nxCloudTasksRunnerShell = async (tasks, options, context) => {
|
9
9
|
try {
|
10
10
|
const { nxCloudClient, version } = await (0, update_manager_1.verifyOrUpdateNxCloudClient)(options);
|
@@ -27,7 +27,7 @@ const nxCloudTasksRunnerShell = async (tasks, options, context) => {
|
|
27
27
|
if (e instanceof update_manager_1.NxCloudEnterpriseOutdatedError) {
|
28
28
|
output_1.output.warn({
|
29
29
|
title: e.message,
|
30
|
-
bodyLines: ['Nx Cloud will not used for this command.', ...body],
|
30
|
+
bodyLines: ['Nx Cloud will not be used for this command.', ...body],
|
31
31
|
});
|
32
32
|
}
|
33
33
|
const results = await (0, default_tasks_runner_1.defaultTasksRunner)(tasks, options, context);
|
@@ -10,8 +10,10 @@ exports.getLockFileDependencies = getLockFileDependencies;
|
|
10
10
|
exports.lockFileExists = lockFileExists;
|
11
11
|
exports.getLockFileName = getLockFileName;
|
12
12
|
exports.createLockFile = createLockFile;
|
13
|
-
const
|
14
|
-
const
|
13
|
+
const node_child_process_1 = require("node:child_process");
|
14
|
+
const node_fs_1 = require("node:fs");
|
15
|
+
const node_path_1 = require("node:path");
|
16
|
+
const semver_1 = require("semver");
|
15
17
|
const package_manager_1 = require("../../../utils/package-manager");
|
16
18
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
17
19
|
const output_1 = require("../../../utils/output");
|
@@ -25,23 +27,26 @@ const YARN_LOCK_FILE = 'yarn.lock';
|
|
25
27
|
const NPM_LOCK_FILE = 'package-lock.json';
|
26
28
|
const PNPM_LOCK_FILE = 'pnpm-lock.yaml';
|
27
29
|
const BUN_LOCK_FILE = 'bun.lockb';
|
30
|
+
const BUN_TEXT_LOCK_FILE = 'bun.lock';
|
28
31
|
exports.LOCKFILES = [
|
29
32
|
YARN_LOCK_FILE,
|
30
33
|
NPM_LOCK_FILE,
|
31
34
|
PNPM_LOCK_FILE,
|
32
35
|
BUN_LOCK_FILE,
|
36
|
+
BUN_TEXT_LOCK_FILE,
|
33
37
|
];
|
34
|
-
const YARN_LOCK_PATH = (0,
|
35
|
-
const NPM_LOCK_PATH = (0,
|
36
|
-
const PNPM_LOCK_PATH = (0,
|
37
|
-
const BUN_LOCK_PATH = (0,
|
38
|
+
const YARN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, YARN_LOCK_FILE);
|
39
|
+
const NPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, NPM_LOCK_FILE);
|
40
|
+
const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, PNPM_LOCK_FILE);
|
41
|
+
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_LOCK_FILE);
|
42
|
+
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_TEXT_LOCK_FILE);
|
38
43
|
/**
|
39
44
|
* Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
|
40
45
|
*/
|
41
46
|
function getLockFileNodes(packageManager, contents, lockFileHash, context) {
|
42
47
|
try {
|
43
48
|
if (packageManager === 'yarn') {
|
44
|
-
const packageJson = (0, fileutils_1.readJsonFile)((0,
|
49
|
+
const packageJson = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'));
|
45
50
|
return (0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson);
|
46
51
|
}
|
47
52
|
if (packageManager === 'pnpm') {
|
@@ -99,16 +104,16 @@ function getLockFileDependencies(packageManager, contents, lockFileHash, context
|
|
99
104
|
}
|
100
105
|
function lockFileExists(packageManager) {
|
101
106
|
if (packageManager === 'yarn') {
|
102
|
-
return (0,
|
107
|
+
return (0, node_fs_1.existsSync)(YARN_LOCK_PATH);
|
103
108
|
}
|
104
109
|
if (packageManager === 'pnpm') {
|
105
|
-
return (0,
|
110
|
+
return (0, node_fs_1.existsSync)(PNPM_LOCK_PATH);
|
106
111
|
}
|
107
112
|
if (packageManager === 'npm') {
|
108
|
-
return (0,
|
113
|
+
return (0, node_fs_1.existsSync)(NPM_LOCK_PATH);
|
109
114
|
}
|
110
115
|
if (packageManager === 'bun') {
|
111
|
-
return (0,
|
116
|
+
return (0, node_fs_1.existsSync)(BUN_LOCK_PATH) || (0, node_fs_1.existsSync)(BUN_TEXT_LOCK_PATH);
|
112
117
|
}
|
113
118
|
throw new Error(`Unknown package manager ${packageManager} or lock file missing`);
|
114
119
|
}
|
@@ -143,7 +148,17 @@ function getLockFilePath(packageManager) {
|
|
143
148
|
return NPM_LOCK_PATH;
|
144
149
|
}
|
145
150
|
if (packageManager === 'bun') {
|
146
|
-
|
151
|
+
try {
|
152
|
+
const bunVersion = (0, node_child_process_1.execSync)('bun --version').toString().trim();
|
153
|
+
// In version 1.2.0, bun switched to a text based lockfile format by default
|
154
|
+
if ((0, semver_1.gte)(bunVersion, '1.2.0')) {
|
155
|
+
return BUN_TEXT_LOCK_FILE;
|
156
|
+
}
|
157
|
+
return BUN_LOCK_PATH;
|
158
|
+
}
|
159
|
+
catch {
|
160
|
+
return BUN_LOCK_PATH;
|
161
|
+
}
|
147
162
|
}
|
148
163
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
149
164
|
}
|
@@ -157,7 +172,7 @@ function getLockFilePath(packageManager) {
|
|
157
172
|
*/
|
158
173
|
function createLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot)) {
|
159
174
|
const normalizedPackageJson = (0, package_json_1.normalizePackageJson)(packageJson);
|
160
|
-
const content = (0,
|
175
|
+
const content = (0, node_fs_1.readFileSync)(getLockFilePath(packageManager), 'utf8');
|
161
176
|
try {
|
162
177
|
if (packageManager === 'yarn') {
|
163
178
|
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
|
@@ -3,7 +3,7 @@ import { PackageJson } from '../../../../utils/package-json';
|
|
3
3
|
* Get version of hoisted package if available
|
4
4
|
*/
|
5
5
|
export declare function getHoistedPackageVersion(packageName: string): string;
|
6
|
-
export type NormalizedPackageJson = Pick<PackageJson, 'name' | 'version' | 'license' | 'dependencies' | 'devDependencies' | 'peerDependencies' | 'peerDependenciesMeta' | 'optionalDependencies' | 'packageManager'>;
|
6
|
+
export type NormalizedPackageJson = Pick<PackageJson, 'name' | 'version' | 'license' | 'dependencies' | 'devDependencies' | 'peerDependencies' | 'peerDependenciesMeta' | 'optionalDependencies' | 'packageManager' | 'resolutions'>;
|
7
7
|
/**
|
8
8
|
* Strip off non-pruning related fields from package.json
|
9
9
|
*/
|
@@ -19,7 +19,7 @@ function getHoistedPackageVersion(packageName) {
|
|
19
19
|
* Strip off non-pruning related fields from package.json
|
20
20
|
*/
|
21
21
|
function normalizePackageJson(packageJson) {
|
22
|
-
const { name, version, license, dependencies, devDependencies, peerDependencies, peerDependenciesMeta, optionalDependencies, packageManager, } = packageJson;
|
22
|
+
const { name, version, license, dependencies, devDependencies, peerDependencies, peerDependenciesMeta, optionalDependencies, packageManager, resolutions, } = packageJson;
|
23
23
|
return {
|
24
24
|
name,
|
25
25
|
version,
|
@@ -30,5 +30,6 @@ function normalizePackageJson(packageJson) {
|
|
30
30
|
peerDependenciesMeta,
|
31
31
|
optionalDependencies,
|
32
32
|
packageManager,
|
33
|
+
resolutions,
|
33
34
|
};
|
34
35
|
}
|
@@ -29,14 +29,14 @@ function getYarnLockfileNodes(lockFileContent, lockFileHash, packageJson) {
|
|
29
29
|
const isBerry = !!__metadata;
|
30
30
|
// yarn classic splits keys when parsing so we need to stich them back together
|
31
31
|
const groupedDependencies = groupDependencies(dependencies, isBerry);
|
32
|
-
return getNodes(groupedDependencies, packageJson,
|
32
|
+
return getNodes(groupedDependencies, packageJson, isBerry);
|
33
33
|
}
|
34
34
|
function getYarnLockfileDependencies(lockFileContent, lockFileHash, ctx) {
|
35
35
|
const { __metadata, ...dependencies } = parseLockFile(lockFileContent, lockFileHash);
|
36
36
|
const isBerry = !!__metadata;
|
37
37
|
// yarn classic splits keys when parsing so we need to stich them back together
|
38
38
|
const groupedDependencies = groupDependencies(dependencies, isBerry);
|
39
|
-
return getDependencies(groupedDependencies,
|
39
|
+
return getDependencies(groupedDependencies, ctx);
|
40
40
|
}
|
41
41
|
function getPackageNameKeyPairs(keys) {
|
42
42
|
const result = new Map();
|
@@ -51,7 +51,7 @@ function getPackageNameKeyPairs(keys) {
|
|
51
51
|
});
|
52
52
|
return result;
|
53
53
|
}
|
54
|
-
function getNodes(dependencies, packageJson,
|
54
|
+
function getNodes(dependencies, packageJson, isBerry) {
|
55
55
|
const nodes = new Map();
|
56
56
|
const combinedDeps = {
|
57
57
|
...packageJson.dependencies,
|
@@ -68,7 +68,7 @@ function getNodes(dependencies, packageJson, keyMap, isBerry) {
|
|
68
68
|
nameKeyPairs.forEach((keySet, packageName) => {
|
69
69
|
const keysArray = Array.from(keySet);
|
70
70
|
// use key relevant to the package name
|
71
|
-
const version = findVersion(packageName, keysArray[0], snapshot, isBerry);
|
71
|
+
const [version, isAlias] = findVersion(packageName, keysArray[0], snapshot, isBerry);
|
72
72
|
// use keys linked to the extracted package name
|
73
73
|
keysArray.forEach((key) => {
|
74
74
|
// we don't need to keep duplicates, we can just track the keys
|
@@ -79,7 +79,7 @@ function getNodes(dependencies, packageJson, keyMap, isBerry) {
|
|
79
79
|
}
|
80
80
|
const node = {
|
81
81
|
type: 'npm',
|
82
|
-
name: version
|
82
|
+
name: version && !isAlias
|
83
83
|
? `npm:${packageName}@${version}`
|
84
84
|
: `npm:${packageName}`,
|
85
85
|
data: {
|
@@ -151,7 +151,7 @@ function findVersion(packageName, key, snapshot, isBerry) {
|
|
151
151
|
? snapshot.resolution && !snapshot.resolution.startsWith(`${packageName}@`)
|
152
152
|
: versionRange.startsWith('npm:');
|
153
153
|
if (isAlias) {
|
154
|
-
return versionRange;
|
154
|
+
return [versionRange, true];
|
155
155
|
}
|
156
156
|
// check for berry tarball packages
|
157
157
|
if (isBerry &&
|
@@ -159,13 +159,13 @@ function findVersion(packageName, key, snapshot, isBerry) {
|
|
159
159
|
// different registry would yield suffix following '::' which we don't need
|
160
160
|
snapshot.resolution.split('::')[0] !==
|
161
161
|
`${packageName}@npm:${snapshot.version}`) {
|
162
|
-
return snapshot.resolution.slice(packageName.length + 1);
|
162
|
+
return [snapshot.resolution.slice(packageName.length + 1)];
|
163
163
|
}
|
164
164
|
if (!isBerry && isTarballPackage(versionRange, snapshot)) {
|
165
|
-
return snapshot.resolved;
|
165
|
+
return [snapshot.resolved];
|
166
166
|
}
|
167
167
|
// otherwise it's a standard version
|
168
|
-
return snapshot.version;
|
168
|
+
return [snapshot.version];
|
169
169
|
}
|
170
170
|
// check if snapshot represents tarball package
|
171
171
|
function isTarballPackage(versionRange, snapshot) {
|
@@ -193,7 +193,7 @@ function getHoistedVersion(packageName) {
|
|
193
193
|
return version;
|
194
194
|
}
|
195
195
|
}
|
196
|
-
function getDependencies(dependencies,
|
196
|
+
function getDependencies(dependencies, ctx) {
|
197
197
|
const projectGraphDependencies = [];
|
198
198
|
Object.keys(dependencies).forEach((keys) => {
|
199
199
|
const snapshot = dependencies[keys];
|
@@ -203,8 +203,26 @@ function getDependencies(dependencies, keyMap, ctx) {
|
|
203
203
|
[snapshot.dependencies, snapshot.optionalDependencies].forEach((section) => {
|
204
204
|
if (section) {
|
205
205
|
Object.entries(section).forEach(([name, versionRange]) => {
|
206
|
-
|
206
|
+
let target = keyMap.get(`${name}@npm:${versionRange}`) ||
|
207
207
|
keyMap.get(`${name}@${versionRange}`);
|
208
|
+
if (!target) {
|
209
|
+
const shortRange = versionRange.replace(/^npm:/, '');
|
210
|
+
// for range like 'npm:*' the above will not be a match
|
211
|
+
if (shortRange === '*') {
|
212
|
+
const foundKey = Array.from(keyMap.keys()).find((k) => k.startsWith(`${name}@`));
|
213
|
+
if (foundKey) {
|
214
|
+
target = keyMap.get(foundKey);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
else if (shortRange.includes('||')) {
|
218
|
+
// when range is a union of ranges, we need to treat it as an array
|
219
|
+
const ranges = shortRange.split('||').map((r) => r.trim());
|
220
|
+
target = Object.values(keyMap).find((n) => {
|
221
|
+
return (n.data.packageName === name &&
|
222
|
+
ranges.some((r) => (0, semver_1.satisfies)(n.data.version, r)));
|
223
|
+
})?.[1];
|
224
|
+
}
|
225
|
+
}
|
208
226
|
if (target) {
|
209
227
|
const dep = {
|
210
228
|
source: node.name,
|
@@ -271,11 +289,11 @@ function addPackageVersion(packageName, version, collection, isBerry) {
|
|
271
289
|
collection.set(packageName, new Set());
|
272
290
|
}
|
273
291
|
collection.get(packageName).add(`${packageName}@${version}`);
|
274
|
-
if (isBerry && !version.startsWith('npm:')) {
|
292
|
+
if (isBerry && !version.startsWith('npm:') && !version.startsWith('patch:')) {
|
275
293
|
collection.get(packageName).add(`${packageName}@npm:${version}`);
|
276
294
|
}
|
277
295
|
}
|
278
|
-
function mapSnapshots(
|
296
|
+
function mapSnapshots(rootDependencies, nodes, packageJson, isBerry) {
|
279
297
|
// map snapshot to set of keys (e.g. `eslint@^7.0.0, eslint@npm:^7.0.0`)
|
280
298
|
const snapshotMap = new Map();
|
281
299
|
// track all existing dependencies's keys
|
@@ -286,8 +304,11 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
|
|
286
304
|
...packageJson.optionalDependencies,
|
287
305
|
...packageJson.peerDependencies,
|
288
306
|
};
|
307
|
+
const resolutions = {
|
308
|
+
...packageJson.resolutions,
|
309
|
+
};
|
289
310
|
// yarn classic splits keys when parsing so we need to stich them back together
|
290
|
-
const groupedDependencies = groupDependencies(
|
311
|
+
const groupedDependencies = groupDependencies(rootDependencies, isBerry);
|
291
312
|
// collect snapshots and their matching keys
|
292
313
|
Object.values(nodes).forEach((node) => {
|
293
314
|
const foundOriginalKeys = findOriginalKeys(groupedDependencies, node);
|
@@ -311,9 +332,19 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
|
|
311
332
|
snapshotMap.get(snapshot).add(requestedKey);
|
312
333
|
}
|
313
334
|
}
|
335
|
+
const requestedResolutionsVersion = getPackageJsonVersion(resolutions, node);
|
336
|
+
if (requestedResolutionsVersion) {
|
337
|
+
addPackageVersion(node.data.packageName, requestedResolutionsVersion, existingKeys, isBerry);
|
338
|
+
const requestedKey = isBerry
|
339
|
+
? reverseMapBerryKey(node, requestedResolutionsVersion, snapshot)
|
340
|
+
: `${node.data.packageName}@${requestedResolutionsVersion}`;
|
341
|
+
if (!snapshotMap.get(snapshot).has(requestedKey)) {
|
342
|
+
snapshotMap.get(snapshot).add(requestedKey);
|
343
|
+
}
|
344
|
+
}
|
314
345
|
if (isBerry) {
|
315
346
|
// look for patched versions
|
316
|
-
const patch = findPatchedKeys(groupedDependencies, node);
|
347
|
+
const patch = findPatchedKeys(groupedDependencies, node, resolutions[node.data.packageName]);
|
317
348
|
if (patch) {
|
318
349
|
const [matchedKeys, snapshot] = patch;
|
319
350
|
snapshotMap.set(snapshot, new Set(matchedKeys));
|
@@ -321,7 +352,7 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
|
|
321
352
|
}
|
322
353
|
});
|
323
354
|
// remove keys that match version ranges that have been pruned away
|
324
|
-
snapshotMap.forEach((snapshotValue,
|
355
|
+
snapshotMap.forEach((snapshotValue, snapshot) => {
|
325
356
|
for (const key of snapshotValue.values()) {
|
326
357
|
const packageName = key.slice(0, key.indexOf('@', 1));
|
327
358
|
let normalizedKey = key;
|
@@ -353,8 +384,8 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
|
|
353
384
|
}
|
354
385
|
function reverseMapBerryKey(node, version, snapshot) {
|
355
386
|
// alias packages already have version
|
356
|
-
if (version.startsWith('npm:')) {
|
357
|
-
`${node.data.packageName}@${version}`;
|
387
|
+
if (version.startsWith('npm:') || version.startsWith('patch:')) {
|
388
|
+
return `${node.data.packageName}@${version}`;
|
358
389
|
}
|
359
390
|
// check for berry tarball packages
|
360
391
|
if (snapshot.resolution &&
|
@@ -363,15 +394,28 @@ function reverseMapBerryKey(node, version, snapshot) {
|
|
363
394
|
}
|
364
395
|
return `${node.data.packageName}@npm:${version}`;
|
365
396
|
}
|
366
|
-
function getPackageJsonVersion(
|
397
|
+
function getPackageJsonVersion(dependencies, node) {
|
367
398
|
const { packageName, version } = node.data;
|
368
|
-
if (
|
369
|
-
|
370
|
-
|
371
|
-
|
399
|
+
if (dependencies[packageName]) {
|
400
|
+
const patchRegex = new RegExp(`^patch:${packageName}@(.*)|#.*$`);
|
401
|
+
// extract the version from the patch or use the full version
|
402
|
+
const versionRange = dependencies[packageName].match(patchRegex)?.[1] ||
|
403
|
+
dependencies[packageName];
|
404
|
+
if (versionRange === version || (0, semver_1.satisfies)(version, versionRange)) {
|
405
|
+
return dependencies[packageName];
|
372
406
|
}
|
373
407
|
}
|
374
408
|
}
|
409
|
+
function isStandardPackage(snapshot, version) {
|
410
|
+
return snapshot.version === version;
|
411
|
+
}
|
412
|
+
function isBerryAlias(snapshot, version) {
|
413
|
+
return snapshot.resolution && `npm:${snapshot.resolution}` === version;
|
414
|
+
}
|
415
|
+
function isClassicAlias(node, keys) {
|
416
|
+
return (node.data.version.startsWith('npm:') &&
|
417
|
+
keys.some((k) => k === `${node.data.packageName}@${node.data.version}`));
|
418
|
+
}
|
375
419
|
function findOriginalKeys(dependencies, node) {
|
376
420
|
for (const keyExpr of Object.keys(dependencies)) {
|
377
421
|
const snapshot = dependencies[keyExpr];
|
@@ -379,18 +423,9 @@ function findOriginalKeys(dependencies, node) {
|
|
379
423
|
if (!keys.some((k) => k.startsWith(`${node.data.packageName}@`))) {
|
380
424
|
continue;
|
381
425
|
}
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
}
|
386
|
-
// berry alias package
|
387
|
-
if (snapshot.resolution &&
|
388
|
-
`npm:${snapshot.resolution}` === node.data.version) {
|
389
|
-
return [keys, snapshot];
|
390
|
-
}
|
391
|
-
// classic alias
|
392
|
-
if (node.data.version.startsWith('npm:') &&
|
393
|
-
keys.some((k) => k === `${node.data.packageName}@${node.data.version}`)) {
|
426
|
+
if (isStandardPackage(snapshot, node.data.version) ||
|
427
|
+
isBerryAlias(snapshot, node.data.version) ||
|
428
|
+
isClassicAlias(node, keys)) {
|
394
429
|
return [keys, snapshot];
|
395
430
|
}
|
396
431
|
// tarball package
|
@@ -400,16 +435,27 @@ function findOriginalKeys(dependencies, node) {
|
|
400
435
|
}
|
401
436
|
}
|
402
437
|
}
|
403
|
-
function findPatchedKeys(dependencies, node) {
|
438
|
+
function findPatchedKeys(dependencies, node, resolutionVersion) {
|
404
439
|
for (const keyExpr of Object.keys(dependencies)) {
|
405
440
|
const snapshot = dependencies[keyExpr];
|
406
441
|
const keys = keyExpr.split(', ');
|
407
442
|
if (!keys[0].startsWith(`${node.data.packageName}@patch:`)) {
|
408
443
|
continue;
|
409
444
|
}
|
410
|
-
|
411
|
-
|
412
|
-
|
445
|
+
if (keyExpr.includes('.yarn/patches')) {
|
446
|
+
if (!resolutionVersion) {
|
447
|
+
continue;
|
448
|
+
}
|
449
|
+
const key = `${node.data.packageName}@${resolutionVersion}`;
|
450
|
+
// local patches can have different location from than the root lock file
|
451
|
+
// use the one from local package.json as the source of truth as long as the rest of the patch matches
|
452
|
+
// this obviously doesn't cover the case of patch over a patch, but that's a super rare case and one can argue one can just join those two patches
|
453
|
+
if (key.split('::locator')[0] !== keyExpr.split('::locator')[0]) {
|
454
|
+
continue;
|
455
|
+
}
|
456
|
+
else {
|
457
|
+
return [[key], { ...snapshot, resolution: key }];
|
458
|
+
}
|
413
459
|
}
|
414
460
|
if (snapshot.version === node.data.version) {
|
415
461
|
return [keys, snapshot];
|
@@ -19,6 +19,7 @@ const getTouchedProjectsFromLockFile = (fileChanges, projectGraphNodes) => {
|
|
19
19
|
'pnpm-lock.yaml',
|
20
20
|
'pnpm-lock.yml',
|
21
21
|
'bun.lockb',
|
22
|
+
'bun.lock',
|
22
23
|
];
|
23
24
|
if (fileChanges.some((f) => lockFiles.includes(f.file))) {
|
24
25
|
return Object.values(projectGraphNodes).map((p) => p.name);
|
@@ -38,7 +38,7 @@ function buildExplicitTypeScriptDependencies(ctx, targetProjectLocator) {
|
|
38
38
|
if (isVuePluginInstalled()) {
|
39
39
|
moduleExtensions.push('.vue');
|
40
40
|
}
|
41
|
-
for (const [project, fileData] of Object.entries(ctx.
|
41
|
+
for (const [project, fileData] of Object.entries(ctx.filesToProcess.projectFileMap)) {
|
42
42
|
filesToProcess[project] ??= [];
|
43
43
|
for (const { file } of fileData) {
|
44
44
|
if (moduleExtensions.some((ext) => file.endsWith(ext))) {
|
@@ -5,6 +5,11 @@ import type { ProjectGraphExternalNode, ProjectGraphProjectNode } from '../../..
|
|
5
5
|
* resolved external node name from the project graph.
|
6
6
|
*/
|
7
7
|
type NpmResolutionCache = Map<string, string | null>;
|
8
|
+
type PathPattern = {
|
9
|
+
pattern: string;
|
10
|
+
prefix: string;
|
11
|
+
suffix: string;
|
12
|
+
};
|
8
13
|
export declare function isBuiltinModuleImport(importExpr: string): boolean;
|
9
14
|
export declare class TargetProjectLocator {
|
10
15
|
private readonly nodes;
|
@@ -14,6 +19,7 @@ export declare class TargetProjectLocator {
|
|
14
19
|
private npmProjects;
|
15
20
|
private tsConfig;
|
16
21
|
private paths;
|
22
|
+
private parsedPathPatterns;
|
17
23
|
private typescriptResolutionCache;
|
18
24
|
private packagesMetadata;
|
19
25
|
constructor(nodes: Record<string, ProjectGraphProjectNode>, externalNodes?: Record<string, ProjectGraphExternalNode>, npmResolutionCache?: NpmResolutionCache);
|
@@ -36,11 +42,14 @@ export declare class TargetProjectLocator {
|
|
36
42
|
/**
|
37
43
|
* Return file paths matching the import relative to the repo root
|
38
44
|
* @param normalizedImportExpr
|
39
|
-
* @
|
45
|
+
* @deprecated Use `findMatchingPaths` instead. It will be removed in Nx v22.
|
40
46
|
*/
|
41
47
|
findPaths(normalizedImportExpr: string): string[] | undefined;
|
48
|
+
findMatchingPaths(importExpr: string): [pattern: string | PathPattern, paths: string[]] | undefined;
|
42
49
|
findImportInWorkspaceProjects(importPath: string): string | null;
|
43
50
|
findDependencyInWorkspaceProjects(dep: string): string | null;
|
51
|
+
private isPatternMatch;
|
52
|
+
private parsePaths;
|
44
53
|
private resolveImportWithTypescript;
|
45
54
|
private resolveImportWithRequire;
|
46
55
|
private findProjectOfResolvedModule;
|