nx 24.1.0-beta.0 → 24.1.0-beta.2
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/dist/bin/init-local.js +2 -4
- package/dist/bin/nx-cloud.js +2 -1
- package/dist/bin/nx.js +12 -14
- package/dist/bin/run-executor.js +5 -0
- package/dist/src/adapter/compat.d.ts +1 -1
- package/dist/src/adapter/compat.js +1 -0
- package/dist/src/command-line/completion/scripts/bash.sh +9 -2
- package/dist/src/command-line/completion/scripts/fish.fish +10 -2
- package/dist/src/command-line/completion/scripts/zsh.zsh +8 -2
- package/dist/src/command-line/completion/scripts.js +18 -8
- package/dist/src/command-line/conformance/command-object.d.ts +3 -0
- package/dist/src/command-line/conformance/command-object.js +66 -0
- package/dist/src/command-line/generate/generate.js +2 -4
- package/dist/src/command-line/generate/generator-utils.d.ts +1 -0
- package/dist/src/command-line/generate/generator-utils.js +9 -0
- package/dist/src/command-line/import/import.js +26 -2
- package/dist/src/command-line/import/utils/ai-output.d.ts +9 -1
- package/dist/src/command-line/import/utils/ai-output.js +20 -1
- package/dist/src/command-line/nx-commands.d.ts +1 -1
- package/dist/src/command-line/nx-commands.js +82 -132
- package/dist/src/command-line/release/command-object.d.ts +1 -0
- package/dist/src/command-line/release/command-object.js +4 -0
- package/dist/src/command-line/release/release.js +6 -4
- package/dist/src/command-line/release/utils/repository-git-tags.js +3 -3
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +2 -24
- package/dist/src/command-line/report/report.js +1 -1
- package/dist/src/command-line/reset/reset.js +51 -2
- package/dist/src/config/nx-json.d.ts +117 -0
- package/dist/src/config/workspace-json-project-json.d.ts +6 -7
- package/dist/src/daemon/client/daemon-environment.js +15 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +13 -20
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +14 -7
- package/dist/src/devkit-internals.js +29 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +35 -13
- package/dist/src/generators/utils/glob.js +3 -3
- package/dist/src/hasher/hash-task.d.ts +3 -1
- package/dist/src/hasher/hash-task.js +3 -2
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.d.ts +4 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.js +117 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.md +38 -0
- package/dist/src/native/index.d.ts +6 -8
- package/dist/src/native/index.js +18 -0
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +2 -0
- package/dist/src/native/transform-objects.js +15 -0
- package/dist/src/plugins/js/index.js +24 -9
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +75 -4
- package/dist/src/plugins/js/lock-file/bun-parser.js +976 -142
- package/dist/src/plugins/js/lock-file/lock-file-names.d.ts +6 -0
- package/dist/src/plugins/js/lock-file/lock-file-names.js +16 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +33 -14
- package/dist/src/plugins/js/lock-file/lock-file.js +213 -74
- package/dist/src/plugins/js/lock-file/npm-parser.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +66 -2
- package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +5 -1
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +107 -54
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +52 -10
- package/dist/src/plugins/js/lock-file/pruned-output.js +132 -66
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.d.ts +27 -0
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.js +155 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/dist/src/plugins/js/lock-file/utils/package-json.js +2 -1
- package/dist/src/plugins/js/package-json/create-package-json.d.ts +1 -0
- package/dist/src/plugins/js/package-json/create-package-json.js +197 -8
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +50 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +16 -9
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +17 -28
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +52 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +336 -28
- package/dist/src/plugins/js/utils/register.js +13 -6
- package/dist/src/project-graph/build-project-graph.js +5 -2
- package/dist/src/project-graph/error-types.d.ts +2 -2
- package/dist/src/project-graph/error-types.js +2 -2
- package/dist/src/project-graph/nx-deps-cache.d.ts +3 -2
- package/dist/src/project-graph/nx-deps-cache.js +8 -2
- package/dist/src/project-graph/utils/project-graph-paths.d.ts +8 -0
- package/dist/src/project-graph/utils/project-graph-paths.js +170 -0
- package/dist/src/tasks-runner/batch/run-batch.js +3 -13
- package/dist/src/tasks-runner/cache.js +19 -18
- package/dist/src/tasks-runner/init-tasks-runner.js +23 -17
- package/dist/src/tasks-runner/run-command.js +6 -3
- package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/dist/src/tasks-runner/task-orchestrator.js +29 -4
- package/dist/src/tasks-runner/tasks-schedule.js +1 -1
- package/dist/src/tasks-runner/utils.d.ts +2 -1
- package/dist/src/tasks-runner/utils.js +2 -1
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +7 -9
- package/dist/src/utils/find-workspace-root.js +2 -4
- package/dist/src/utils/git-utils.d.ts +5 -0
- package/dist/src/utils/git-utils.js +23 -1
- package/dist/src/utils/handle-import.js +14 -2
- package/dist/src/utils/installation-directory.d.ts +16 -0
- package/dist/src/utils/installation-directory.js +96 -2
- package/dist/src/utils/json.d.ts +7 -0
- package/dist/src/utils/json.js +32 -0
- package/dist/src/utils/nx-key.js +11 -8
- package/dist/src/utils/output.d.ts +5 -0
- package/dist/src/utils/output.js +11 -4
- package/dist/src/utils/owned-private-dir.d.ts +10 -0
- package/dist/src/utils/owned-private-dir.js +28 -0
- package/dist/src/utils/package-json.d.ts +7 -0
- package/dist/src/utils/package-json.js +9 -0
- package/dist/src/utils/require-nx-key.js +6 -4
- package/dist/src/utils/workspace-root.d.ts +12 -0
- package/dist/src/utils/workspace-root.js +56 -7
- package/migrations.json +6 -0
- package/package.json +15 -12
- package/schemas/nx-schema.json +75 -9
- package/schemas/project-schema.json +5 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const YARN_LOCK_FILE = "yarn.lock";
|
|
2
|
+
export declare const NPM_LOCK_FILE = "package-lock.json";
|
|
3
|
+
export declare const PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
4
|
+
export declare const BUN_LOCK_FILE = "bun.lockb";
|
|
5
|
+
export declare const BUN_TEXT_LOCK_FILE = "bun.lock";
|
|
6
|
+
export declare const LOCKFILES: string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// No imports: the project graph builder loads this, and must not load the lock file parsers.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LOCKFILES = exports.BUN_TEXT_LOCK_FILE = exports.BUN_LOCK_FILE = exports.PNPM_LOCK_FILE = exports.NPM_LOCK_FILE = exports.YARN_LOCK_FILE = void 0;
|
|
5
|
+
exports.YARN_LOCK_FILE = 'yarn.lock';
|
|
6
|
+
exports.NPM_LOCK_FILE = 'package-lock.json';
|
|
7
|
+
exports.PNPM_LOCK_FILE = 'pnpm-lock.yaml';
|
|
8
|
+
exports.BUN_LOCK_FILE = 'bun.lockb';
|
|
9
|
+
exports.BUN_TEXT_LOCK_FILE = 'bun.lock';
|
|
10
|
+
exports.LOCKFILES = [
|
|
11
|
+
exports.YARN_LOCK_FILE,
|
|
12
|
+
exports.NPM_LOCK_FILE,
|
|
13
|
+
exports.PNPM_LOCK_FILE,
|
|
14
|
+
exports.BUN_LOCK_FILE,
|
|
15
|
+
exports.BUN_TEXT_LOCK_FILE,
|
|
16
|
+
];
|
|
@@ -7,18 +7,27 @@ import { CreateDependenciesContext, CreateNodesContext } from '../../../project-
|
|
|
7
7
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
|
8
8
|
import { PackageJson } from '../../../utils/package-json';
|
|
9
9
|
import { PackageManager } from '../../../utils/package-manager';
|
|
10
|
-
export
|
|
10
|
+
export { LOCKFILES } from './lock-file-names';
|
|
11
11
|
export declare const AUTO_AFFECTED_LOCK_FILES: readonly ["yarn.lock", "package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml", "bun.lockb", "bun.lock"];
|
|
12
12
|
/**
|
|
13
13
|
* Parses the lockfile into external nodes, plus the keyMap that getLockFileDependencies reads.
|
|
14
|
+
* `bunPatchFileHashes` are the patch files of a bun.lock that `lockFileHash` covers.
|
|
15
|
+
* `localPathSources` lists the workspace-relative sources of the nodes installed
|
|
16
|
+
* from the local file tree, whose contents the node hashes do not cover.
|
|
17
|
+
* `installedLocalPathNodes` names the local-path node each importer installs
|
|
18
|
+
* per dependency name, keyed by the importer's path ('.' for the root).
|
|
14
19
|
*/
|
|
15
|
-
export declare function getLockFileNodes(packageManager: PackageManager, lockFile: string, contents: string, lockFileHash: string, context: CreateNodesContext): {
|
|
20
|
+
export declare function getLockFileNodes(packageManager: PackageManager, lockFile: string, contents: string, lockFileHash: string, context: CreateNodesContext, bunPatchFileHashes?: Map<string, string>): {
|
|
16
21
|
nodes: Record<string, ProjectGraphExternalNode>;
|
|
17
22
|
keyMap: Map<string, any>;
|
|
23
|
+
localPathSources?: Record<string, string[]>;
|
|
24
|
+
installedLocalPathNodes: Record<string, Record<string, string>>;
|
|
18
25
|
};
|
|
19
|
-
export declare function getLockFileNodesForName(lockFile: string, contents: string, lockFileHash: string, packageJson?: PackageJson): {
|
|
26
|
+
export declare function getLockFileNodesForName(lockFile: string, contents: string, lockFileHash: string, packageJson?: PackageJson, bunPatchFileHashes?: Map<string, string>): {
|
|
20
27
|
nodes: Record<string, ProjectGraphExternalNode>;
|
|
21
28
|
keyMap: Map<string, any>;
|
|
29
|
+
localPathSources?: Record<string, string[]>;
|
|
30
|
+
installedLocalPathNodes: Record<string, Record<string, string>>;
|
|
22
31
|
};
|
|
23
32
|
/**
|
|
24
33
|
* Parses the lockfile into dependencies between external nodes.
|
|
@@ -32,6 +41,7 @@ export declare function lockFileExists(packageManager: PackageManager): boolean;
|
|
|
32
41
|
*/
|
|
33
42
|
export declare function getLockFileName(packageManager: PackageManager): string;
|
|
34
43
|
export declare function getLockFilePath(packageManager: PackageManager): string;
|
|
44
|
+
export declare function hasTextBunLockfile(workspaceRootPath: string): boolean;
|
|
35
45
|
/**
|
|
36
46
|
* Create lock file based on the root level lock file and (pruned) package.json
|
|
37
47
|
*
|
|
@@ -42,13 +52,18 @@ export declare function getLockFilePath(packageManager: PackageManager): string;
|
|
|
42
52
|
* An inherited `pnpm.patchedDependencies` goes with it, since the prune scopes
|
|
43
53
|
* the lockfile's patches to the packages that survive it and rewrites their
|
|
44
54
|
* paths onto the output.
|
|
45
|
-
* The
|
|
46
|
-
*
|
|
55
|
+
* The block stays in the manifest for npm, yarn and bun, which never read it.
|
|
56
|
+
* For Bun, a dependency whose spec the pruned bun.lock replaces with its locked
|
|
57
|
+
* version takes that version too, since a frozen install rejects the pair
|
|
58
|
+
* otherwise.
|
|
59
|
+
* Since this mutates the manifest, callers must write or emit it after this
|
|
60
|
+
* returns.
|
|
47
61
|
*
|
|
48
62
|
* The lockfile alone does not make a complete pnpm output. A workspace
|
|
49
63
|
* declaring build-script approvals, patches or vendored local paths also needs
|
|
50
64
|
* the artifacts `generatePrunedDeployOutput` ships, and this warns when that is
|
|
51
|
-
* the case.
|
|
65
|
+
* the case. A Bun workspace needs its patch files and vendored local paths the
|
|
66
|
+
* same way.
|
|
52
67
|
*
|
|
53
68
|
* On a pruning error the root lockfile is returned as a fail-open fallback,
|
|
54
69
|
* with the manifest left as authored.
|
|
@@ -65,21 +80,25 @@ type PrunedDeploySink = {
|
|
|
65
80
|
};
|
|
66
81
|
/**
|
|
67
82
|
* Generates the standalone deploy output a generate-package-json flow ships
|
|
68
|
-
* alongside its manifest: the pruned lockfile and
|
|
69
|
-
*
|
|
70
|
-
* `pnpm patch` files, and the vendored non-workspace local-path
|
|
83
|
+
* alongside its manifest: the pruned lockfile and the install-time artifacts
|
|
84
|
+
* that lockfile needs. For pnpm those are the settings-only pnpm-workspace.yaml,
|
|
85
|
+
* the `pnpm patch` files, and the vendored non-workspace local-path
|
|
86
|
+
* dependencies; for Bun, the `bun patch` files and the vendored local-path
|
|
87
|
+
* dependencies.
|
|
71
88
|
* `options` carries either an `outputDirectory` to write into or an `emit` sink
|
|
72
89
|
* for a bundler's asset pipeline, never both.
|
|
73
90
|
*
|
|
74
91
|
* Mutates `packageJson` into the form the output must ship (the relocated
|
|
75
|
-
* local-path specifiers, the pnpm config strip, the pnpm <=10 build settings
|
|
76
|
-
*
|
|
92
|
+
* local-path specifiers, the pnpm config strip, the pnpm <=10 build settings,
|
|
93
|
+
* the Bun root `trustedDependencies`, pruned `patchedDependencies`, override
|
|
94
|
+
* strip and pinned versions), so write or emit the manifest after this returns.
|
|
77
95
|
*
|
|
78
|
-
* Bun
|
|
79
|
-
*
|
|
96
|
+
* A Bun workspace without the text bun.lock, on the binary bun.lockb or with no
|
|
97
|
+
* lockfile at all, gets no lockfile: it warns and ships nothing, leaving the
|
|
98
|
+
* manifest as authored. A Bun manifest without
|
|
99
|
+
* dependencies also ships no lockfile, as Bun writes none for it.
|
|
80
100
|
*/
|
|
81
101
|
export declare function generatePrunedDeployOutput(packageJson: PackageJson, graph: ProjectGraph, projectRoot: string, options: PrunedDeploySink & {
|
|
82
102
|
packageManager: PackageManager;
|
|
83
103
|
workspaceRoot?: string;
|
|
84
104
|
}): void;
|
|
85
|
-
export {};
|
|
@@ -11,6 +11,7 @@ exports.getLockFileDependencies = getLockFileDependencies;
|
|
|
11
11
|
exports.lockFileExists = lockFileExists;
|
|
12
12
|
exports.getLockFileName = getLockFileName;
|
|
13
13
|
exports.getLockFilePath = getLockFilePath;
|
|
14
|
+
exports.hasTextBunLockfile = hasTextBunLockfile;
|
|
14
15
|
exports.createLockFile = createLockFile;
|
|
15
16
|
exports.generatePrunedDeployOutput = generatePrunedDeployOutput;
|
|
16
17
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -24,44 +25,42 @@ const package_manager_1 = require("../../../utils/package-manager");
|
|
|
24
25
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
25
26
|
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
|
26
27
|
const bun_parser_1 = require("./bun-parser");
|
|
28
|
+
const lock_file_names_1 = require("./lock-file-names");
|
|
27
29
|
const npm_parser_1 = require("./npm-parser");
|
|
28
30
|
const pnpm_parser_1 = require("./pnpm-parser");
|
|
29
31
|
const project_graph_pruning_1 = require("./project-graph-pruning");
|
|
30
32
|
const package_json_1 = require("./utils/package-json");
|
|
31
33
|
const yarn_parser_1 = require("./yarn-parser");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const PNPM_LOCK_FILE = 'pnpm-lock.yaml';
|
|
34
|
+
var lock_file_names_2 = require("./lock-file-names");
|
|
35
|
+
Object.defineProperty(exports, "LOCKFILES", { enumerable: true, get: function () { return lock_file_names_2.LOCKFILES; } });
|
|
35
36
|
const PNPM_LOCK_FILE_LEGACY = 'pnpm-lock.yml';
|
|
36
|
-
exports.LOCKFILES = [
|
|
37
|
-
YARN_LOCK_FILE,
|
|
38
|
-
NPM_LOCK_FILE,
|
|
39
|
-
PNPM_LOCK_FILE,
|
|
40
|
-
bun_parser_1.BUN_LOCK_FILE,
|
|
41
|
-
bun_parser_1.BUN_TEXT_LOCK_FILE,
|
|
42
|
-
];
|
|
43
37
|
exports.AUTO_AFFECTED_LOCK_FILES = [
|
|
44
|
-
YARN_LOCK_FILE,
|
|
45
|
-
NPM_LOCK_FILE,
|
|
46
|
-
PNPM_LOCK_FILE,
|
|
38
|
+
lock_file_names_1.YARN_LOCK_FILE,
|
|
39
|
+
lock_file_names_1.NPM_LOCK_FILE,
|
|
40
|
+
lock_file_names_1.PNPM_LOCK_FILE,
|
|
47
41
|
PNPM_LOCK_FILE_LEGACY,
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
lock_file_names_1.BUN_LOCK_FILE,
|
|
43
|
+
lock_file_names_1.BUN_TEXT_LOCK_FILE,
|
|
50
44
|
];
|
|
51
|
-
const YARN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, YARN_LOCK_FILE);
|
|
52
|
-
const NPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, NPM_LOCK_FILE);
|
|
53
|
-
const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, PNPM_LOCK_FILE);
|
|
54
|
-
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot,
|
|
55
|
-
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot,
|
|
45
|
+
const YARN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, lock_file_names_1.YARN_LOCK_FILE);
|
|
46
|
+
const NPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, lock_file_names_1.NPM_LOCK_FILE);
|
|
47
|
+
const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, lock_file_names_1.PNPM_LOCK_FILE);
|
|
48
|
+
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, lock_file_names_1.BUN_LOCK_FILE);
|
|
49
|
+
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, lock_file_names_1.BUN_TEXT_LOCK_FILE);
|
|
56
50
|
/**
|
|
57
51
|
* Parses the lockfile into external nodes, plus the keyMap that getLockFileDependencies reads.
|
|
52
|
+
* `bunPatchFileHashes` are the patch files of a bun.lock that `lockFileHash` covers.
|
|
53
|
+
* `localPathSources` lists the workspace-relative sources of the nodes installed
|
|
54
|
+
* from the local file tree, whose contents the node hashes do not cover.
|
|
55
|
+
* `installedLocalPathNodes` names the local-path node each importer installs
|
|
56
|
+
* per dependency name, keyed by the importer's path ('.' for the root).
|
|
58
57
|
*/
|
|
59
|
-
function getLockFileNodes(packageManager, lockFile, contents, lockFileHash, context) {
|
|
58
|
+
function getLockFileNodes(packageManager, lockFile, contents, lockFileHash, context, bunPatchFileHashes) {
|
|
60
59
|
try {
|
|
61
60
|
const packageJson = packageManager === 'yarn' || packageManager === 'bun'
|
|
62
61
|
? (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'))
|
|
63
62
|
: undefined;
|
|
64
|
-
return getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson);
|
|
63
|
+
return getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson, bunPatchFileHashes);
|
|
65
64
|
}
|
|
66
65
|
catch (e) {
|
|
67
66
|
if (!isPostInstallProcess()) {
|
|
@@ -74,22 +73,31 @@ function getLockFileNodes(packageManager, lockFile, contents, lockFileHash, cont
|
|
|
74
73
|
}
|
|
75
74
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
|
76
75
|
}
|
|
77
|
-
function getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson) {
|
|
78
|
-
if (lockFile === YARN_LOCK_FILE || lockFile ===
|
|
76
|
+
function getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson, bunPatchFileHashes) {
|
|
77
|
+
if (lockFile === lock_file_names_1.YARN_LOCK_FILE || lockFile === lock_file_names_1.BUN_LOCK_FILE) {
|
|
79
78
|
// yarn-parser only reads optional fields plus an unused `name` for the
|
|
80
79
|
// synthetic root workspace node, which is identical across base/head and
|
|
81
80
|
// therefore irrelevant for affected diffing.
|
|
82
|
-
return
|
|
81
|
+
return {
|
|
82
|
+
...(0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson ?? {}),
|
|
83
|
+
// No record for Yarn or bun.lockb; imports resolve by version and name
|
|
84
|
+
installedLocalPathNodes: {},
|
|
85
|
+
};
|
|
83
86
|
}
|
|
84
|
-
if (lockFile === PNPM_LOCK_FILE || lockFile === PNPM_LOCK_FILE_LEGACY) {
|
|
87
|
+
if (lockFile === lock_file_names_1.PNPM_LOCK_FILE || lockFile === PNPM_LOCK_FILE_LEGACY) {
|
|
85
88
|
return (0, pnpm_parser_1.getPnpmLockfileNodes)(contents, lockFileHash);
|
|
86
89
|
}
|
|
87
|
-
if (lockFile === NPM_LOCK_FILE) {
|
|
90
|
+
if (lockFile === lock_file_names_1.NPM_LOCK_FILE) {
|
|
88
91
|
return (0, npm_parser_1.getNpmLockfileNodes)(contents, lockFileHash);
|
|
89
92
|
}
|
|
90
|
-
if (lockFile ===
|
|
91
|
-
const nodes = (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
|
|
92
|
-
return {
|
|
93
|
+
if (lockFile === lock_file_names_1.BUN_TEXT_LOCK_FILE) {
|
|
94
|
+
const nodes = (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash, bunPatchFileHashes);
|
|
95
|
+
return {
|
|
96
|
+
nodes,
|
|
97
|
+
keyMap: new Map(),
|
|
98
|
+
localPathSources: (0, bun_parser_1.getBunLocalPathNodeSources)(contents, lockFileHash, nodes),
|
|
99
|
+
installedLocalPathNodes: (0, bun_parser_1.getBunInstalledLocalPathNodes)(contents, lockFileHash, nodes),
|
|
100
|
+
};
|
|
93
101
|
}
|
|
94
102
|
throw new Error(`Unknown lock file: ${lockFile}`);
|
|
95
103
|
}
|
|
@@ -108,7 +116,7 @@ function getLockFileDependencies(packageManager, lockFile, contents, lockFileHas
|
|
|
108
116
|
return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context, keyMap);
|
|
109
117
|
}
|
|
110
118
|
if (packageManager === 'bun') {
|
|
111
|
-
if (lockFile ===
|
|
119
|
+
if (lockFile === lock_file_names_1.BUN_TEXT_LOCK_FILE) {
|
|
112
120
|
// Bun parser doesn't use keyMap
|
|
113
121
|
return (0, bun_parser_1.getBunTextLockfileDependencies)(contents, lockFileHash, context);
|
|
114
122
|
}
|
|
@@ -151,19 +159,19 @@ function lockFileExists(packageManager) {
|
|
|
151
159
|
*/
|
|
152
160
|
function getLockFileName(packageManager) {
|
|
153
161
|
if (packageManager === 'yarn') {
|
|
154
|
-
return YARN_LOCK_FILE;
|
|
162
|
+
return lock_file_names_1.YARN_LOCK_FILE;
|
|
155
163
|
}
|
|
156
164
|
if (packageManager === 'pnpm') {
|
|
157
|
-
return PNPM_LOCK_FILE;
|
|
165
|
+
return lock_file_names_1.PNPM_LOCK_FILE;
|
|
158
166
|
}
|
|
159
167
|
if (packageManager === 'npm') {
|
|
160
|
-
return NPM_LOCK_FILE;
|
|
168
|
+
return lock_file_names_1.NPM_LOCK_FILE;
|
|
161
169
|
}
|
|
162
170
|
if (packageManager === 'bun') {
|
|
163
171
|
const lockFilePath = getLockFilePath(packageManager);
|
|
164
|
-
return lockFilePath.endsWith(
|
|
165
|
-
?
|
|
166
|
-
:
|
|
172
|
+
return lockFilePath.endsWith(lock_file_names_1.BUN_TEXT_LOCK_FILE)
|
|
173
|
+
? lock_file_names_1.BUN_TEXT_LOCK_FILE
|
|
174
|
+
: lock_file_names_1.BUN_LOCK_FILE;
|
|
167
175
|
}
|
|
168
176
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
|
169
177
|
}
|
|
@@ -202,6 +210,41 @@ function getLockFilePath(packageManager) {
|
|
|
202
210
|
}
|
|
203
211
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
|
204
212
|
}
|
|
213
|
+
const BUN_TEXT_LOCKFILE_HINT = 'Run `bun install --save-text-lockfile` at the workspace root to switch to bun.lock.';
|
|
214
|
+
// Only the text bun.lock can be pruned. Without it, a Bun deploy output ships
|
|
215
|
+
// the manifest alone.
|
|
216
|
+
function hasTextBunLockfile(workspaceRootPath) {
|
|
217
|
+
return (0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRootPath, lock_file_names_1.BUN_TEXT_LOCK_FILE));
|
|
218
|
+
}
|
|
219
|
+
// Same precedence as getLockFilePath, against the root the caller prunes from.
|
|
220
|
+
function usesBinaryBunLockfile(workspaceRootPath) {
|
|
221
|
+
return (!hasTextBunLockfile(workspaceRootPath) &&
|
|
222
|
+
(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRootPath, lock_file_names_1.BUN_LOCK_FILE)));
|
|
223
|
+
}
|
|
224
|
+
// A pruned Bun lockfile is always the text bun.lock.
|
|
225
|
+
function getPrunedLockFileName(packageManager) {
|
|
226
|
+
return packageManager === 'bun'
|
|
227
|
+
? lock_file_names_1.BUN_TEXT_LOCK_FILE
|
|
228
|
+
: getLockFileName(packageManager);
|
|
229
|
+
}
|
|
230
|
+
// Bun trusts the install scripts of the packages the install root lists, and a
|
|
231
|
+
// list replaces Bun's default one, so the output carries the workspace root's.
|
|
232
|
+
function mergeRootTrustedDependencies(packageJson, workspaceRootPath) {
|
|
233
|
+
const rootPackageJsonPath = (0, node_path_1.join)(workspaceRootPath, 'package.json');
|
|
234
|
+
if (!(0, node_fs_1.existsSync)(rootPackageJsonPath)) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const { trustedDependencies } = (0, fileutils_1.readJsonFile)(rootPackageJsonPath);
|
|
238
|
+
if (!trustedDependencies) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
packageJson.trustedDependencies = [
|
|
242
|
+
...new Set([
|
|
243
|
+
...trustedDependencies,
|
|
244
|
+
...(packageJson.trustedDependencies ?? []),
|
|
245
|
+
]),
|
|
246
|
+
];
|
|
247
|
+
}
|
|
205
248
|
/**
|
|
206
249
|
* Create lock file based on the root level lock file and (pruned) package.json
|
|
207
250
|
*
|
|
@@ -212,13 +255,18 @@ function getLockFilePath(packageManager) {
|
|
|
212
255
|
* An inherited `pnpm.patchedDependencies` goes with it, since the prune scopes
|
|
213
256
|
* the lockfile's patches to the packages that survive it and rewrites their
|
|
214
257
|
* paths onto the output.
|
|
215
|
-
* The
|
|
216
|
-
*
|
|
258
|
+
* The block stays in the manifest for npm, yarn and bun, which never read it.
|
|
259
|
+
* For Bun, a dependency whose spec the pruned bun.lock replaces with its locked
|
|
260
|
+
* version takes that version too, since a frozen install rejects the pair
|
|
261
|
+
* otherwise.
|
|
262
|
+
* Since this mutates the manifest, callers must write or emit it after this
|
|
263
|
+
* returns.
|
|
217
264
|
*
|
|
218
265
|
* The lockfile alone does not make a complete pnpm output. A workspace
|
|
219
266
|
* declaring build-script approvals, patches or vendored local paths also needs
|
|
220
267
|
* the artifacts `generatePrunedDeployOutput` ships, and this warns when that is
|
|
221
|
-
* the case.
|
|
268
|
+
* the case. A Bun workspace needs its patch files and vendored local paths the
|
|
269
|
+
* same way.
|
|
222
270
|
*
|
|
223
271
|
* On a pruning error the root lockfile is returned as a fail-open fallback,
|
|
224
272
|
* with the manifest left as authored.
|
|
@@ -227,18 +275,50 @@ function getLockFilePath(packageManager) {
|
|
|
227
275
|
*/
|
|
228
276
|
function createLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot)) {
|
|
229
277
|
let pruned = true;
|
|
278
|
+
const pinnedSpecs = [];
|
|
230
279
|
const lockFileContent = buildLockFile(packageJson, graph, packageManager, {
|
|
231
280
|
onPruneFallback: () => {
|
|
232
281
|
pruned = false;
|
|
233
282
|
},
|
|
283
|
+
onPinnedSpec: (pin) => pinnedSpecs.push(pin),
|
|
234
284
|
});
|
|
235
285
|
if (pruned && packageManager === 'pnpm') {
|
|
236
286
|
(0, pruned_output_1.stripPrunedLockfilePnpmConfig)(packageJson);
|
|
237
287
|
(0, pruned_output_1.dropInheritedPnpmPatchedDependencies)(packageJson);
|
|
238
288
|
(0, pruned_output_1.warnIncompletePrunedPnpmOutput)(lockFileContent);
|
|
239
289
|
}
|
|
290
|
+
if (pruned && packageManager === 'bun') {
|
|
291
|
+
applyPinnedSpecs(packageJson, pinnedSpecs);
|
|
292
|
+
warnIncompletePrunedBunOutput(lockFileContent);
|
|
293
|
+
}
|
|
240
294
|
return lockFileContent;
|
|
241
295
|
}
|
|
296
|
+
function applyPinnedSpecs(packageJson, pinnedSpecs) {
|
|
297
|
+
for (const { depType, name, spec } of pinnedSpecs) {
|
|
298
|
+
packageJson[depType][name] = spec;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// The pieces a pruned bun.lock needs beside it, which only
|
|
302
|
+
// `generatePrunedDeployOutput` ships.
|
|
303
|
+
function warnIncompletePrunedBunOutput(lockFileContent) {
|
|
304
|
+
const missing = [];
|
|
305
|
+
if ((0, bun_parser_1.getBunLockfilePatchKeys)(lockFileContent).length) {
|
|
306
|
+
missing.push('the patch files and the patchedDependencies they need');
|
|
307
|
+
}
|
|
308
|
+
if ((0, bun_parser_1.getPrunedBunLocalPathTargets)(lockFileContent).length) {
|
|
309
|
+
missing.push('the vendored file:/link: dependencies it references');
|
|
310
|
+
}
|
|
311
|
+
if (!missing.length) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
output_1.output.warn({
|
|
315
|
+
title: 'The pruned bun.lock needs artifacts this call does not return',
|
|
316
|
+
bodyLines: [
|
|
317
|
+
`A standalone install of the output will be missing ${missing.join(', and ')}.`,
|
|
318
|
+
'Use generatePrunedDeployOutput to ship them.',
|
|
319
|
+
],
|
|
320
|
+
});
|
|
321
|
+
}
|
|
242
322
|
/**
|
|
243
323
|
* `createLockFile` without the manifest reconciliation, for callers that own
|
|
244
324
|
* that step themselves. `options.onPruneFallback` fires just before the
|
|
@@ -246,25 +326,31 @@ function createLockFile(packageJson, graph, packageManager = (0, package_manager
|
|
|
246
326
|
* sense for an actually pruned lockfile (e.g. link-closure validation and
|
|
247
327
|
* local-path artifact shipping). Every root-relative read resolves from
|
|
248
328
|
* `options.workspaceRootPath`, so a caller passing one cannot end up with the
|
|
249
|
-
* lockfile read from one root and the catalogs resolved from another.
|
|
329
|
+
* lockfile read from one root and the catalogs resolved from another. Without
|
|
330
|
+
* `options.projectRoot`, a manifest dependency named like a workspace package
|
|
331
|
+
* is taken to be that package.
|
|
250
332
|
*/
|
|
251
333
|
function buildLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot), options) {
|
|
252
334
|
const workspaceRootPath = options?.workspaceRootPath ?? workspace_root_1.workspaceRoot;
|
|
335
|
+
if (packageManager === 'bun' && usesBinaryBunLockfile(workspaceRootPath)) {
|
|
336
|
+
output_1.output.log({
|
|
337
|
+
title: 'Unable to create a pruned lockfile from the binary bun.lockb',
|
|
338
|
+
bodyLines: [BUN_TEXT_LOCKFILE_HINT],
|
|
339
|
+
});
|
|
340
|
+
return '';
|
|
341
|
+
}
|
|
253
342
|
const normalizedPackageJson = (0, package_json_1.normalizePackageJson)(packageJson);
|
|
254
|
-
const content = (0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceRootPath,
|
|
343
|
+
const content = (0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceRootPath, getPrunedLockFileName(packageManager)), 'utf8');
|
|
255
344
|
try {
|
|
256
345
|
if (packageManager === 'bun') {
|
|
257
|
-
|
|
258
|
-
title: "Unable to create bun lock files. Run bun install it's just as quick",
|
|
259
|
-
});
|
|
260
|
-
return '';
|
|
346
|
+
return (0, bun_parser_1.stringifyBunLockfile)(graph, content, normalizedPackageJson, workspaceRootPath, options?.projectRoot, options?.onPinnedSpec);
|
|
261
347
|
}
|
|
262
348
|
const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson, workspaceRootPath, packageManager);
|
|
263
349
|
if (packageManager === 'yarn') {
|
|
264
350
|
return (0, yarn_parser_1.stringifyYarnLockfile)(prunedGraph, content, normalizedPackageJson);
|
|
265
351
|
}
|
|
266
352
|
if (packageManager === 'pnpm') {
|
|
267
|
-
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson, workspaceRootPath);
|
|
353
|
+
return (0, pnpm_parser_1.stringifyPnpmLockfile)(prunedGraph, content, normalizedPackageJson, workspaceRootPath, options?.projectRoot);
|
|
268
354
|
}
|
|
269
355
|
if (packageManager === 'npm') {
|
|
270
356
|
return (0, npm_parser_1.stringifyNpmLockfile)(prunedGraph, content, normalizedPackageJson);
|
|
@@ -292,12 +378,12 @@ function buildLockFile(packageJson, graph, packageManager = (0, package_manager_
|
|
|
292
378
|
}
|
|
293
379
|
/**
|
|
294
380
|
* Creates the pruned lockfile for a generate-package-json flow, running the
|
|
295
|
-
* steps such a flow needs around `createLockFile`. For pnpm, the
|
|
296
|
-
* `file:`/`link:` local-path specifiers are relocated to their
|
|
297
|
-
* first (
|
|
298
|
-
* the manifest's form), and the local-path dependency closure
|
|
299
|
-
* after pruning so a shipped `link:` target that requires an
|
|
300
|
-
* dependency fails the build instead of the deploy. After a successful prune,
|
|
381
|
+
* steps such a flow needs around `createLockFile`. For pnpm and Bun, the
|
|
382
|
+
* manifest's `file:`/`link:` local-path specifiers are relocated to their
|
|
383
|
+
* shipped location first (both re-resolve them on a non-frozen install, and the
|
|
384
|
+
* lockfile copies the manifest's form), and the local-path dependency closure
|
|
385
|
+
* is validated after pruning so a shipped `link:` target that requires an
|
|
386
|
+
* unresolvable dependency fails the build instead of the deploy. After a successful prune,
|
|
301
387
|
* the manifest's pnpm config block is stripped for every package manager:
|
|
302
388
|
* re-declaring config a pruned pnpm lockfile bakes into its snapshots trips
|
|
303
389
|
* ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, and npm and yarn never read the block at
|
|
@@ -312,32 +398,47 @@ function buildLockFile(packageJson, graph, packageManager = (0, package_manager_
|
|
|
312
398
|
* the closure validation is skipped, and the remaining install-time pieces must
|
|
313
399
|
* not ship local-path artifacts for it (see `getPrunedPnpmInstallArtifacts`).
|
|
314
400
|
*
|
|
315
|
-
* Mutates `packageJson` (the pnpm
|
|
316
|
-
* strip
|
|
317
|
-
*
|
|
401
|
+
* Mutates `packageJson` (the pnpm and Bun specifier relocation, the config
|
|
402
|
+
* strip, and for Bun the `overrides`/`resolutions` strip and the locked version
|
|
403
|
+
* of each dependency an override installed outside its range or in place of
|
|
404
|
+
* its local path), so write or emit the manifest after calling this.
|
|
318
405
|
*/
|
|
319
406
|
function createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath = workspace_root_1.workspaceRoot, packageManager = (0, package_manager_1.detectPackageManager)(workspaceRootPath)) {
|
|
320
407
|
const originalPackageJson = structuredClone(packageJson);
|
|
321
|
-
if (packageManager === 'pnpm') {
|
|
322
|
-
(0, pruned_output_1.rewritePrunedLocalPathSpecifiers)(packageJson, projectRoot, workspaceRootPath,
|
|
408
|
+
if (packageManager === 'pnpm' || packageManager === 'bun') {
|
|
409
|
+
(0, pruned_output_1.rewritePrunedLocalPathSpecifiers)(packageJson, projectRoot, workspaceRootPath, (0, get_workspace_packages_from_graph_1.getWorkspacePackagesFromGraph)(graph), packageManager);
|
|
323
410
|
}
|
|
411
|
+
if (packageManager === 'bun') {
|
|
412
|
+
// Bun reads these only from the workspace root, whose effect the pruned
|
|
413
|
+
// bun.lock already locks, so a project's own block never applied.
|
|
414
|
+
delete packageJson.overrides;
|
|
415
|
+
delete packageJson.resolutions;
|
|
416
|
+
}
|
|
417
|
+
const pinnedSpecs = [];
|
|
324
418
|
let pruneError;
|
|
325
419
|
const lockFileContent = buildLockFile(packageJson, graph, packageManager, {
|
|
326
420
|
onPruneFallback: (error) => {
|
|
327
421
|
pruneError = error;
|
|
328
422
|
},
|
|
329
423
|
workspaceRootPath,
|
|
424
|
+
projectRoot,
|
|
425
|
+
onPinnedSpec: (pin) => pinnedSpecs.push(pin),
|
|
330
426
|
});
|
|
331
427
|
const pruned = pruneError === undefined;
|
|
332
428
|
if (pruned) {
|
|
429
|
+
applyPinnedSpecs(packageJson, pinnedSpecs);
|
|
333
430
|
(0, pruned_output_1.stripPrunedLockfilePnpmConfig)(packageJson);
|
|
334
431
|
if (packageManager === 'pnpm') {
|
|
335
432
|
(0, pruned_output_1.validatePrunedLocalPathClosure)(packageJson, workspaceRootPath, lockFileContent);
|
|
336
433
|
}
|
|
434
|
+
else if (packageManager === 'bun') {
|
|
435
|
+
(0, bun_parser_1.validatePrunedBunLocalPathClosure)(packageJson, workspaceRootPath, lockFileContent);
|
|
436
|
+
}
|
|
337
437
|
}
|
|
338
438
|
else {
|
|
339
439
|
// The root lockfile matches the manifest as authored, so undo the
|
|
340
|
-
// specifier relocation and
|
|
440
|
+
// specifier relocation and the Bun override strip, and keep the pnpm
|
|
441
|
+
// config it still declares.
|
|
341
442
|
for (const key of Object.keys(packageJson)) {
|
|
342
443
|
delete packageJson[key];
|
|
343
444
|
}
|
|
@@ -349,6 +450,9 @@ function createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath
|
|
|
349
450
|
if (packageManager === 'pnpm') {
|
|
350
451
|
bodyLines.push('The emitted package.json keeps its resolution-time pnpm config (`overrides`, `packageExtensions`), its vendored local-path specifiers point at their original workspace locations, and no local-path artifacts are shipped for it.');
|
|
351
452
|
}
|
|
453
|
+
else if (packageManager === 'bun') {
|
|
454
|
+
bodyLines.push('The vendored local-path specifiers of the emitted package.json point at their original workspace locations, and no local-path artifacts are shipped for it.');
|
|
455
|
+
}
|
|
352
456
|
bodyLines.push(packageManager === 'npm'
|
|
353
457
|
? '`npm ci` in the output will fail; run `npm install` instead.'
|
|
354
458
|
: packageManager === 'yarn'
|
|
@@ -364,42 +468,77 @@ function createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath
|
|
|
364
468
|
}
|
|
365
469
|
/**
|
|
366
470
|
* Generates the standalone deploy output a generate-package-json flow ships
|
|
367
|
-
* alongside its manifest: the pruned lockfile and
|
|
368
|
-
*
|
|
369
|
-
* `pnpm patch` files, and the vendored non-workspace local-path
|
|
471
|
+
* alongside its manifest: the pruned lockfile and the install-time artifacts
|
|
472
|
+
* that lockfile needs. For pnpm those are the settings-only pnpm-workspace.yaml,
|
|
473
|
+
* the `pnpm patch` files, and the vendored non-workspace local-path
|
|
474
|
+
* dependencies; for Bun, the `bun patch` files and the vendored local-path
|
|
475
|
+
* dependencies.
|
|
370
476
|
* `options` carries either an `outputDirectory` to write into or an `emit` sink
|
|
371
477
|
* for a bundler's asset pipeline, never both.
|
|
372
478
|
*
|
|
373
479
|
* Mutates `packageJson` into the form the output must ship (the relocated
|
|
374
|
-
* local-path specifiers, the pnpm config strip, the pnpm <=10 build settings
|
|
375
|
-
*
|
|
480
|
+
* local-path specifiers, the pnpm config strip, the pnpm <=10 build settings,
|
|
481
|
+
* the Bun root `trustedDependencies`, pruned `patchedDependencies`, override
|
|
482
|
+
* strip and pinned versions), so write or emit the manifest after this returns.
|
|
376
483
|
*
|
|
377
|
-
* Bun
|
|
378
|
-
*
|
|
484
|
+
* A Bun workspace without the text bun.lock, on the binary bun.lockb or with no
|
|
485
|
+
* lockfile at all, gets no lockfile: it warns and ships nothing, leaving the
|
|
486
|
+
* manifest as authored. A Bun manifest without
|
|
487
|
+
* dependencies also ships no lockfile, as Bun writes none for it.
|
|
379
488
|
*/
|
|
380
489
|
function generatePrunedDeployOutput(packageJson, graph, projectRoot, options) {
|
|
381
490
|
const workspaceRootPath = options.workspaceRoot ?? workspace_root_1.workspaceRoot;
|
|
382
491
|
const { packageManager } = options;
|
|
383
|
-
if (packageManager === 'bun') {
|
|
492
|
+
if (packageManager === 'bun' && !hasTextBunLockfile(workspaceRootPath)) {
|
|
384
493
|
output_1.output.warn({
|
|
385
|
-
title: 'Bun lockfile generation
|
|
386
|
-
bodyLines:
|
|
387
|
-
|
|
388
|
-
|
|
494
|
+
title: 'Bun lockfile generation requires the text bun.lock',
|
|
495
|
+
bodyLines: usesBinaryBunLockfile(workspaceRootPath)
|
|
496
|
+
? [
|
|
497
|
+
'The workspace uses the binary bun.lockb, so only the package.json is generated.',
|
|
498
|
+
BUN_TEXT_LOCKFILE_HINT,
|
|
499
|
+
]
|
|
500
|
+
: [
|
|
501
|
+
'The workspace has no bun.lock, so only the package.json is generated.',
|
|
502
|
+
],
|
|
389
503
|
});
|
|
390
504
|
return;
|
|
391
505
|
}
|
|
506
|
+
if (packageManager === 'bun') {
|
|
507
|
+
mergeRootTrustedDependencies(packageJson, workspaceRootPath);
|
|
508
|
+
}
|
|
392
509
|
const { lockFileContent, pruned } = createPrunedLockfile(packageJson, graph, projectRoot, workspaceRootPath, packageManager);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
510
|
+
// A pruned bun.lock is empty for a manifest without dependencies, which
|
|
511
|
+
// ships without one.
|
|
512
|
+
const shipsLockFile = !(packageManager === 'bun' && lockFileContent === '');
|
|
513
|
+
const artifacts = shipsLockFile
|
|
514
|
+
? [
|
|
515
|
+
{
|
|
516
|
+
path: getPrunedLockFileName(packageManager),
|
|
517
|
+
content: lockFileContent,
|
|
518
|
+
},
|
|
519
|
+
]
|
|
520
|
+
: [];
|
|
396
521
|
if (packageManager === 'pnpm') {
|
|
397
522
|
artifacts.push(...(0, pruned_output_1.getPrunedPnpmInstallArtifacts)(workspaceRootPath, lockFileContent, packageJson, { includeLocalPathArtifacts: pruned }));
|
|
398
523
|
}
|
|
524
|
+
if (packageManager === 'bun') {
|
|
525
|
+
artifacts.push(...(0, bun_parser_1.getPrunedBunPatchArtifacts)(workspaceRootPath, lockFileContent, packageJson));
|
|
526
|
+
// The root-lockfile fallback references the whole workspace.
|
|
527
|
+
if (pruned) {
|
|
528
|
+
artifacts.push(...(0, pruned_output_1.getLocalPathArtifacts)(workspaceRootPath, (0, bun_parser_1.getPrunedBunLocalPathTargets)(lockFileContent)));
|
|
529
|
+
}
|
|
530
|
+
}
|
|
399
531
|
// Discriminate on the value, not key presence: options built by spread can
|
|
400
532
|
// carry an explicitly-present `outputDirectory: undefined` beside `emit`.
|
|
401
533
|
if (options.outputDirectory !== undefined) {
|
|
402
534
|
const { outputDirectory } = options;
|
|
535
|
+
// Bun rejects a frozen install when a lockfile from a prior deploy sits
|
|
536
|
+
// beside a manifest without dependencies.
|
|
537
|
+
if (!shipsLockFile) {
|
|
538
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(outputDirectory, getPrunedLockFileName(packageManager)), {
|
|
539
|
+
force: true,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
403
542
|
// Directory trees flow through here one file at a time, so dedupe the
|
|
404
543
|
// recursive mkdir per destination directory.
|
|
405
544
|
const createdDirs = new Set();
|
|
@@ -5,6 +5,7 @@ import { CreateDependenciesContext } from '../../../project-graph/plugins';
|
|
|
5
5
|
export declare function getNpmLockfileNodes(lockFileContent: string, lockFileHash: string): {
|
|
6
6
|
nodes: Record<string, ProjectGraphExternalNode>;
|
|
7
7
|
keyMap: Map<string, ProjectGraphExternalNode>;
|
|
8
|
+
installedLocalPathNodes: Record<string, Record<string, string>>;
|
|
8
9
|
};
|
|
9
10
|
export declare function getNpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext, keyMap: Map<string, ProjectGraphExternalNode>): RawProjectGraphDependency[];
|
|
10
11
|
export declare function stringifyNpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
|