nx 21.0.0-beta.1 → 21.0.0-beta.10
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/migrations.json +5 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +182 -35
- package/schemas/project-schema.json +5 -0
- 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/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 +52 -38
- 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 +6 -2
- package/src/command-line/init/implementation/utils.js +110 -45
- 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 +70 -39
- package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
- package/src/command-line/migrate/migrate-ui-api.js +227 -0
- package/src/command-line/migrate/migrate.d.ts +16 -3
- package/src/command-line/migrate/migrate.js +113 -83
- 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 +8 -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 +139 -45
- 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 +252 -0
- package/src/command-line/release/version/release-group-processor.js +1057 -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 +93 -0
- package/src/command-line/release/version/test-utils.js +415 -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 +171 -0
- package/src/command-line/release/version/version-actions.js +195 -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 +84 -262
- package/src/command-line/repair/repair.js +0 -1
- 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/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +2 -2
- 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/config/misc-interfaces.d.ts +11 -1
- package/src/config/nx-json.d.ts +160 -16
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -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 +3 -2
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +9 -4
- package/src/executors/run-commands/running-tasks.js +103 -30
- 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/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/native/index.d.ts +98 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +7 -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 +8 -6
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- 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 +4 -2
- 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/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- 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/public-api.d.ts +1 -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 +3 -3
- package/src/project-graph/utils/project-configuration-utils.js +54 -21
- 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 +3 -4
- 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 +0 -1
- package/src/tasks-runner/create-task-graph.js +11 -11
- package/src/tasks-runner/default-tasks-runner.js +5 -14
- package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
- package/src/tasks-runner/forked-process-task-runner.js +59 -46
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +62 -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 +14 -3
- package/src/tasks-runner/life-cycle.js +37 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
- package/src/tasks-runner/pseudo-terminal.js +37 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +220 -42
- package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
- package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
- package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/src/tasks-runner/running-tasks/shared-running-task.js +30 -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 +26 -10
- package/src/tasks-runner/task-orchestrator.js +212 -57
- package/src/tasks-runner/tasks-runner.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +9 -0
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +18 -12
- 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-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
- 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/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
package/src/native/index.d.ts
CHANGED
@@ -7,7 +7,25 @@ export declare class ExternalObject<T> {
|
|
7
7
|
[K: symbol]: T
|
8
8
|
}
|
9
9
|
}
|
10
|
+
export declare class AppLifeCycle {
|
11
|
+
constructor(tasks: Array<Task>, pinnedTasks: Array<string>, tuiCliArgs: TuiCliArgs, tuiConfig: TuiConfig, titleText: string)
|
12
|
+
startCommand(threadCount?: number | undefined | null): void
|
13
|
+
scheduleTask(task: Task): void
|
14
|
+
startTasks(tasks: Array<Task>, metadata: object): void
|
15
|
+
printTaskTerminalOutput(task: Task, status: string, output: string): void
|
16
|
+
endTasks(taskResults: Array<TaskResult>, metadata: object): void
|
17
|
+
endCommand(): void
|
18
|
+
__init(doneCallback: () => any): void
|
19
|
+
registerRunningTask(taskId: string, parserAndWriter: ExternalObject<[ParserArc, WriterArc]>): void
|
20
|
+
registerRunningTaskWithEmptyParser(taskId: string): void
|
21
|
+
appendTaskOutput(taskId: string, output: string): void
|
22
|
+
setTaskStatus(taskId: string, status: TaskStatus): void
|
23
|
+
registerForcedShutdownCallback(forcedShutdownCallback: () => any): void
|
24
|
+
__setCloudMessage(message: string): Promise<void>
|
25
|
+
}
|
26
|
+
|
10
27
|
export declare class ChildProcess {
|
28
|
+
getParserAndWriter(): ExternalObject<[ParserArc, WriterArc]>
|
11
29
|
kill(): void
|
12
30
|
onExit(callback: (message: string) => void): void
|
13
31
|
onOutput(callback: (message: string) => void): void
|
@@ -26,7 +44,13 @@ export declare class FileLock {
|
|
26
44
|
export declare class HashPlanner {
|
27
45
|
constructor(nxJson: NxJson, projectGraph: ExternalObject<ProjectGraph>)
|
28
46
|
getPlans(taskIds: Array<string>, taskGraph: TaskGraph): Record<string, string[]>
|
29
|
-
getPlansReference(taskIds: Array<string>, taskGraph: TaskGraph):
|
47
|
+
getPlansReference(taskIds: Array<string>, taskGraph: TaskGraph): ExternalObject<Record<string, Array<HashInstruction>>>
|
48
|
+
}
|
49
|
+
|
50
|
+
export declare class HttpRemoteCache {
|
51
|
+
constructor()
|
52
|
+
retrieve(hash: string, cacheDirectory: string): Promise<CachedResult | null>
|
53
|
+
store(hash: string, cacheDirectory: string, terminalOutput: string, code: number): Promise<boolean>
|
30
54
|
}
|
31
55
|
|
32
56
|
export declare class ImportResult {
|
@@ -38,12 +62,13 @@ export declare class ImportResult {
|
|
38
62
|
|
39
63
|
export declare class NxCache {
|
40
64
|
cacheDirectory: string
|
41
|
-
constructor(workspaceRoot: string, cachePath: string, dbConnection: ExternalObject<NxDbConnection>, linkTaskDetails?: boolean | undefined | null)
|
65
|
+
constructor(workspaceRoot: string, cachePath: string, dbConnection: ExternalObject<NxDbConnection>, linkTaskDetails?: boolean | undefined | null, maxCacheSize?: number | undefined | null)
|
42
66
|
get(hash: string): CachedResult | null
|
43
67
|
put(hash: string, terminalOutput: string, outputs: Array<string>, code: number): void
|
44
|
-
applyRemoteCacheResults(hash: string, result: CachedResult): void
|
68
|
+
applyRemoteCacheResults(hash: string, result: CachedResult, outputs?: Array<string> | undefined | null): void
|
45
69
|
getTaskOutputsPath(hash: string): string
|
46
|
-
|
70
|
+
getCacheSize(): number
|
71
|
+
copyFilesFromCache(cachedResult: CachedResult, outputs: Array<string>): number
|
47
72
|
removeOldCacheRecords(): void
|
48
73
|
checkCacheFsInSync(): boolean
|
49
74
|
}
|
@@ -55,6 +80,13 @@ export declare class NxTaskHistory {
|
|
55
80
|
getEstimatedTaskTimings(targets: Array<TaskTarget>): Record<string, number>
|
56
81
|
}
|
57
82
|
|
83
|
+
export declare class RunningTasksService {
|
84
|
+
constructor(db: ExternalObject<NxDbConnection>)
|
85
|
+
getRunningTasks(ids: Array<string>): Array<string>
|
86
|
+
addRunningTask(taskId: string): void
|
87
|
+
removeRunningTask(taskId: string): void
|
88
|
+
}
|
89
|
+
|
58
90
|
export declare class RustPseudoTerminal {
|
59
91
|
constructor()
|
60
92
|
runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, execArgv?: Array<string> | undefined | null, quiet?: boolean | undefined | null, tty?: boolean | undefined | null): ChildProcess
|
@@ -94,6 +126,14 @@ export declare class WorkspaceContext {
|
|
94
126
|
constructor(workspaceRoot: string, cacheDir: string)
|
95
127
|
getWorkspaceFiles(projectRootMap: Record<string, string>): NxWorkspaceFiles
|
96
128
|
glob(globs: Array<string>, exclude?: Array<string> | undefined | null): Array<string>
|
129
|
+
/**
|
130
|
+
* Performs multiple glob pattern matches against workspace files in parallel
|
131
|
+
* @returns An array of arrays, where each inner array contains the file paths
|
132
|
+
* that matched the corresponding glob pattern in the input. The outer array maintains the same order
|
133
|
+
* as the input globs.
|
134
|
+
*/
|
135
|
+
multiGlob(globs: Array<string>, exclude?: Array<string> | undefined | null): Array<Array<string>>
|
136
|
+
hashFilesMatchingGlobs(globGroups: Array<Array<string>>): Array<string>
|
97
137
|
hashFilesMatchingGlob(globs: Array<string>, exclude?: Array<string> | undefined | null): string
|
98
138
|
incrementalUpdate(updatedFiles: Array<string>, deletedFiles: Array<string>): Record<string, string>
|
99
139
|
updateProjectFiles(projectRootMappings: ProjectRootMappings, projectFiles: ExternalObject<ProjectFiles>, globalFiles: ExternalObject<Array<FileData>>, updatedFiles: Record<string, string>, deletedFiles: Array<string>): UpdatedWorkspaceFiles
|
@@ -103,15 +143,16 @@ export declare class WorkspaceContext {
|
|
103
143
|
|
104
144
|
export interface CachedResult {
|
105
145
|
code: number
|
106
|
-
terminalOutput
|
146
|
+
terminalOutput?: string
|
107
147
|
outputsPath: string
|
148
|
+
size?: number
|
108
149
|
}
|
109
150
|
|
110
|
-
export declare export function closeDbConnection(connection: ExternalObject<NxDbConnection>): void
|
151
|
+
export declare export declare function closeDbConnection(connection: ExternalObject<NxDbConnection>): void
|
111
152
|
|
112
|
-
export declare export function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<NxDbConnection>
|
153
|
+
export declare export declare function connectToNxDb(cacheDir: string, nxVersion: string, dbName?: string | undefined | null): ExternalObject<NxDbConnection>
|
113
154
|
|
114
|
-
export declare export function copy(src: string, dest: string):
|
155
|
+
export declare export declare function copy(src: string, dest: string): number
|
115
156
|
|
116
157
|
export interface DepsOutputsInput {
|
117
158
|
dependentTasksOutputFiles: string
|
@@ -128,7 +169,7 @@ export declare const enum EventType {
|
|
128
169
|
create = 'create'
|
129
170
|
}
|
130
171
|
|
131
|
-
export declare export function expandOutputs(directory: string, entries: Array<string>): Array<string>
|
172
|
+
export declare export declare function expandOutputs(directory: string, entries: Array<string>): Array<string>
|
132
173
|
|
133
174
|
export interface ExternalDependenciesInput {
|
134
175
|
externalDependencies: Array<string>
|
@@ -154,19 +195,21 @@ export interface FileSetInput {
|
|
154
195
|
fileset: string
|
155
196
|
}
|
156
197
|
|
157
|
-
export declare export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
|
198
|
+
export declare export declare function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
|
199
|
+
|
200
|
+
export declare export declare function getBinaryTarget(): string
|
158
201
|
|
159
|
-
export declare export function
|
202
|
+
export declare export declare function getDefaultMaxCacheSize(cachePath: string): number
|
160
203
|
|
161
204
|
/**
|
162
205
|
* Expands the given outputs into a list of existing files.
|
163
206
|
* This is used when hashing outputs
|
164
207
|
*/
|
165
|
-
export declare export function getFilesForOutputs(directory: string, entries: Array<string>): Array<string>
|
208
|
+
export declare export declare function getFilesForOutputs(directory: string, entries: Array<string>): Array<string>
|
166
209
|
|
167
|
-
export declare export function getTransformableOutputs(outputs: Array<string>): Array<string>
|
210
|
+
export declare export declare function getTransformableOutputs(outputs: Array<string>): Array<string>
|
168
211
|
|
169
|
-
export declare export function hashArray(input: Array<string>): string
|
212
|
+
export declare export declare function hashArray(input: Array<string | undefined | null>): string
|
170
213
|
|
171
214
|
export interface HashDetails {
|
172
215
|
value: string
|
@@ -184,7 +227,7 @@ export interface HasherOptions {
|
|
184
227
|
selectivelyHashTsConfig: boolean
|
185
228
|
}
|
186
229
|
|
187
|
-
export declare export function hashFile(file: string): string | null
|
230
|
+
export declare export declare function hashFile(file: string): string | null
|
188
231
|
|
189
232
|
export interface InputsInput {
|
190
233
|
input: string
|
@@ -211,6 +254,8 @@ export interface NxWorkspaceFilesExternals {
|
|
211
254
|
allWorkspaceFiles: ExternalObject<Array<FileData>>
|
212
255
|
}
|
213
256
|
|
257
|
+
export declare export declare function parseTaskStatus(stringStatus: string): TaskStatus
|
258
|
+
|
214
259
|
export interface Project {
|
215
260
|
root: string
|
216
261
|
namedInputs?: Record<string, Array<JsInputs>>
|
@@ -224,7 +269,9 @@ export interface ProjectGraph {
|
|
224
269
|
externalNodes: Record<string, ExternalNode>
|
225
270
|
}
|
226
271
|
|
227
|
-
export declare export function remove(src: string): void
|
272
|
+
export declare export declare function remove(src: string): void
|
273
|
+
|
274
|
+
export declare export declare function restoreTerminal(): void
|
228
275
|
|
229
276
|
export interface RuntimeInput {
|
230
277
|
runtime: string
|
@@ -244,6 +291,9 @@ export interface Task {
|
|
244
291
|
target: TaskTarget
|
245
292
|
outputs: Array<string>
|
246
293
|
projectRoot?: string
|
294
|
+
startTime?: number
|
295
|
+
endTime?: number
|
296
|
+
continuous?: boolean
|
247
297
|
}
|
248
298
|
|
249
299
|
export interface TaskGraph {
|
@@ -252,6 +302,13 @@ export interface TaskGraph {
|
|
252
302
|
dependencies: Record<string, Array<string>>
|
253
303
|
}
|
254
304
|
|
305
|
+
export interface TaskResult {
|
306
|
+
task: Task
|
307
|
+
status: string
|
308
|
+
code: number
|
309
|
+
terminalOutput?: string
|
310
|
+
}
|
311
|
+
|
255
312
|
export interface TaskRun {
|
256
313
|
hash: string
|
257
314
|
status: string
|
@@ -260,26 +317,48 @@ export interface TaskRun {
|
|
260
317
|
end: number
|
261
318
|
}
|
262
319
|
|
320
|
+
export declare const enum TaskStatus {
|
321
|
+
Success = 0,
|
322
|
+
Failure = 1,
|
323
|
+
Skipped = 2,
|
324
|
+
LocalCacheKeptExisting = 3,
|
325
|
+
LocalCache = 4,
|
326
|
+
RemoteCache = 5,
|
327
|
+
NotStarted = 6,
|
328
|
+
InProgress = 7,
|
329
|
+
Shared = 8,
|
330
|
+
Stopped = 9
|
331
|
+
}
|
332
|
+
|
263
333
|
export interface TaskTarget {
|
264
334
|
project: string
|
265
335
|
target: string
|
266
336
|
configuration?: string
|
267
337
|
}
|
268
338
|
|
269
|
-
export declare export function testOnlyTransferFileMap(projectFiles: Record<string, Array<FileData>>, nonProjectFiles: Array<FileData>): NxWorkspaceFilesExternals
|
339
|
+
export declare export declare function testOnlyTransferFileMap(projectFiles: Record<string, Array<FileData>>, nonProjectFiles: Array<FileData>): NxWorkspaceFilesExternals
|
270
340
|
|
271
341
|
/**
|
272
342
|
* Transfer the project graph from the JS world to the Rust world, so that we can pass the project graph via memory quicker
|
273
343
|
* This wont be needed once the project graph is created in Rust
|
274
344
|
*/
|
275
|
-
export declare export function transferProjectGraph(projectGraph: ProjectGraph): ExternalObject<ProjectGraph>
|
345
|
+
export declare export declare function transferProjectGraph(projectGraph: ProjectGraph): ExternalObject<ProjectGraph>
|
346
|
+
|
347
|
+
export interface TuiCliArgs {
|
348
|
+
targets?: string[] | undefined
|
349
|
+
tuiAutoExit?: boolean | number | undefined
|
350
|
+
}
|
351
|
+
|
352
|
+
export interface TuiConfig {
|
353
|
+
autoExit?: boolean | number | undefined
|
354
|
+
}
|
276
355
|
|
277
356
|
export interface UpdatedWorkspaceFiles {
|
278
357
|
fileMap: FileMap
|
279
358
|
externalReferences: NxWorkspaceFilesExternals
|
280
359
|
}
|
281
360
|
|
282
|
-
export declare export function validateOutputs(outputs: Array<string>): void
|
361
|
+
export declare export declare function validateOutputs(outputs: Array<string>): void
|
283
362
|
|
284
363
|
export interface WatchEvent {
|
285
364
|
path: string
|
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,16 @@ 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
|
391
|
+
module.exports.parseTaskStatus = nativeBinding.parseTaskStatus
|
387
392
|
module.exports.remove = nativeBinding.remove
|
393
|
+
module.exports.restoreTerminal = nativeBinding.restoreTerminal
|
394
|
+
module.exports.TaskStatus = nativeBinding.TaskStatus
|
388
395
|
module.exports.testOnlyTransferFileMap = nativeBinding.testOnlyTransferFileMap
|
389
396
|
module.exports.transferProjectGraph = nativeBinding.transferProjectGraph
|
390
397
|
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
|
*/
|
@@ -2,24 +2,25 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getHoistedPackageVersion = getHoistedPackageVersion;
|
4
4
|
exports.normalizePackageJson = normalizePackageJson;
|
5
|
-
const fs_1 = require("fs");
|
6
5
|
const workspace_root_1 = require("../../../../utils/workspace-root");
|
6
|
+
const fileutils_1 = require("../../../../utils/fileutils");
|
7
7
|
/**
|
8
8
|
* Get version of hoisted package if available
|
9
9
|
*/
|
10
10
|
function getHoistedPackageVersion(packageName) {
|
11
11
|
const fullPath = `${workspace_root_1.workspaceRoot}/node_modules/${packageName}/package.json`;
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
try {
|
13
|
+
return (0, fileutils_1.readJsonFile)(fullPath)?.version;
|
14
|
+
}
|
15
|
+
catch (e) {
|
16
|
+
return;
|
15
17
|
}
|
16
|
-
return;
|
17
18
|
}
|
18
19
|
/**
|
19
20
|
* Strip off non-pruning related fields from package.json
|
20
21
|
*/
|
21
22
|
function normalizePackageJson(packageJson) {
|
22
|
-
const { name, version, license, dependencies, devDependencies, peerDependencies, peerDependenciesMeta, optionalDependencies, packageManager, } = packageJson;
|
23
|
+
const { name, version, license, dependencies, devDependencies, peerDependencies, peerDependenciesMeta, optionalDependencies, packageManager, resolutions, } = packageJson;
|
23
24
|
return {
|
24
25
|
name,
|
25
26
|
version,
|
@@ -30,5 +31,6 @@ function normalizePackageJson(packageJson) {
|
|
30
31
|
peerDependenciesMeta,
|
31
32
|
optionalDependencies,
|
32
33
|
packageManager,
|
34
|
+
resolutions,
|
33
35
|
};
|
34
36
|
}
|
@@ -9,7 +9,7 @@ exports.usesLeadingDash = usesLeadingDash;
|
|
9
9
|
exports.loadPnpmHoistedDepsDefinition = loadPnpmHoistedDepsDefinition;
|
10
10
|
exports.parseAndNormalizePnpmLockfile = parseAndNormalizePnpmLockfile;
|
11
11
|
exports.stringifyToPnpmYaml = stringifyToPnpmYaml;
|
12
|
-
const
|
12
|
+
const node_fs_1 = require("node:fs");
|
13
13
|
const semver_1 = require("semver");
|
14
14
|
const workspace_root_1 = require("../../../../utils/workspace-root");
|
15
15
|
const file_hasher_1 = require("../../../../hasher/file-hasher");
|
@@ -31,8 +31,8 @@ function usesLeadingDash(data) {
|
|
31
31
|
}
|
32
32
|
function loadPnpmHoistedDepsDefinition() {
|
33
33
|
const fullPath = `${workspace_root_1.workspaceRoot}/node_modules/.modules.yaml`;
|
34
|
-
if ((0,
|
35
|
-
const content = (0,
|
34
|
+
if ((0, node_fs_1.existsSync)(fullPath)) {
|
35
|
+
const content = (0, node_fs_1.readFileSync)(fullPath, 'utf-8');
|
36
36
|
const { load } = require('@zkochan/js-yaml');
|
37
37
|
return load(content)?.hoistedDependencies ?? {};
|
38
38
|
}
|