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
|
@@ -114,10 +114,6 @@ export declare class HttpRemoteCache {
|
|
|
114
114
|
store(hash: string, cacheDirectory: string, terminalOutput: string, code: number): Promise<boolean>
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* The hasher's handle on an index: lists only after catching up with the
|
|
119
|
-
* watch behind it.
|
|
120
|
-
*/
|
|
121
117
|
export declare class IgnoredIndexReader {
|
|
122
118
|
|
|
123
119
|
}
|
|
@@ -149,11 +145,11 @@ export declare class NxCache {
|
|
|
149
145
|
getBatch(hashes: Array<string>): Array<CachedResult | undefined | null>
|
|
150
146
|
put(hash: string, terminalOutput: string, outputs: Array<string>, code: number): CachedOutputs
|
|
151
147
|
/**
|
|
152
|
-
* Restores and records a result fetched from a remote cache
|
|
153
|
-
*
|
|
154
|
-
* output it sits in.
|
|
148
|
+
* Restores and records a result fetched from a remote cache, returning
|
|
149
|
+
* its terminal output as stored for replay. Returns `None`, discarding
|
|
150
|
+
* the artifact, when it holds a link that leaves the output it sits in.
|
|
155
151
|
*/
|
|
156
|
-
applyRemoteCacheResults(hash: string, result: CachedResult, outputs?: Array<string> | undefined | null):
|
|
152
|
+
applyRemoteCacheResults(hash: string, result: CachedResult, outputs?: Array<string> | undefined | null): string | null
|
|
157
153
|
/**
|
|
158
154
|
* Register terminal outputs that were written without a cache entry —
|
|
159
155
|
* uncacheable tasks, and cacheable ones run with `--skip-nx-cache`.
|
|
@@ -1610,6 +1606,8 @@ export interface UltracacheReport {
|
|
|
1610
1606
|
resolution: UltracacheConfigurationResolution
|
|
1611
1607
|
}
|
|
1612
1608
|
|
|
1609
|
+
export declare function unmatchedProjectPatterns(projectGraph: ExternalObject<ProjectGraph>, patterns: Array<string>): Array<string>
|
|
1610
|
+
|
|
1613
1611
|
export interface UpdatedWorkspaceFiles {
|
|
1614
1612
|
fileMap: FileMap
|
|
1615
1613
|
externalReferences: NxWorkspaceFilesExternals
|
package/dist/src/native/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Node passes a stand-in require, without a cache, require.extensions or
|
|
2
|
+
// Module._load, when an ESM loader hook supplies this module's source, as
|
|
3
|
+
// Yarn PnP does.
|
|
4
|
+
if (!require.cache) require = require('module').createRequire(__filename);
|
|
5
|
+
|
|
1
6
|
const { join, basename } = require('path');
|
|
2
7
|
const {
|
|
3
8
|
chmodSync,
|
|
@@ -162,9 +167,12 @@ Module._load = function (request, parent, isMain) {
|
|
|
162
167
|
try {
|
|
163
168
|
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
|
164
169
|
} catch (e) {
|
|
170
|
+
// ENOENT: the resolver's realpath can lose the file to a concurrent
|
|
171
|
+
// `nx reset` after its stat found it.
|
|
165
172
|
if (
|
|
166
173
|
e.code === 'EACCES' ||
|
|
167
174
|
e.code === 'EPERM' ||
|
|
175
|
+
e.code === 'ENOENT' ||
|
|
168
176
|
e.code === 'MODULE_NOT_FOUND' ||
|
|
169
177
|
e.code === 'ERR_DLOPEN_FAILED'
|
|
170
178
|
) {
|
|
@@ -183,6 +191,10 @@ Module._load = function (request, parent, isMain) {
|
|
|
183
191
|
let cacheError = null;
|
|
184
192
|
for (let attempt = 1; attempt <= MAX_COPY_RETRIES; attempt++) {
|
|
185
193
|
attemptsMade = attempt;
|
|
194
|
+
// A concurrent `nx reset` or a tmp cleaner can remove the directory.
|
|
195
|
+
if (attempt > 1 && !ensureSecureNativeFileCacheLocation()) {
|
|
196
|
+
return originalLoad.apply(this, [nativeLocation, parent, isMain]);
|
|
197
|
+
}
|
|
186
198
|
// First copy to a unique location for each process
|
|
187
199
|
try {
|
|
188
200
|
copyFileSync(nativeLocation, tmpTmpFile);
|
|
@@ -192,6 +204,9 @@ Module._load = function (request, parent, isMain) {
|
|
|
192
204
|
// have left a partial file behind.
|
|
193
205
|
cacheError = e;
|
|
194
206
|
removeIfPresent(tmpTmpFile);
|
|
207
|
+
if (e.code === 'ENOENT') {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
195
210
|
break;
|
|
196
211
|
}
|
|
197
212
|
|
|
@@ -206,6 +221,9 @@ Module._load = function (request, parent, isMain) {
|
|
|
206
221
|
// reports it as a missing optional dependency, which it is not.
|
|
207
222
|
cacheError = e;
|
|
208
223
|
removeIfPresent(tmpTmpFile);
|
|
224
|
+
if (e.code === 'ENOENT') {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
209
227
|
break;
|
|
210
228
|
}
|
|
211
229
|
return loadFromCache();
|
|
@@ -659,5 +659,6 @@ module.exports.trackEvent = nativeBinding.trackEvent
|
|
|
659
659
|
module.exports.trackPageView = nativeBinding.trackPageView
|
|
660
660
|
module.exports.transferProjectGraph = nativeBinding.transferProjectGraph
|
|
661
661
|
module.exports.UltracacheMode = nativeBinding.UltracacheMode
|
|
662
|
+
module.exports.unmatchedProjectPatterns = nativeBinding.unmatchedProjectPatterns
|
|
662
663
|
module.exports.validateOutputs = nativeBinding.validateOutputs
|
|
663
664
|
module.exports.WorkspaceErrors = nativeBinding.WorkspaceErrors
|
|
Binary file
|
|
Binary file
|
|
@@ -8,5 +8,7 @@ export declare function transformProjectGraphForRust(graph: ProjectGraph): Exter
|
|
|
8
8
|
* what the locators themselves do on a large workspace.
|
|
9
9
|
*/
|
|
10
10
|
export declare function transformProjectGraphForLocators(graph: ProjectGraph): ExternalObject<RustProjectGraph>;
|
|
11
|
+
/** Only what project patterns match against: names, roots and tags. */
|
|
12
|
+
export declare function transformProjectGraphForProjectMatching(graph: ProjectGraph): ExternalObject<RustProjectGraph>;
|
|
11
13
|
/** The graph in Rust's shape, still a JS object. Uncached, so safe to edit. */
|
|
12
14
|
export declare function toRustProjectGraph(graph: ProjectGraph): RustProjectGraph;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformProjectGraphForRust = transformProjectGraphForRust;
|
|
4
4
|
exports.transformProjectGraphForLocators = transformProjectGraphForLocators;
|
|
5
|
+
exports.transformProjectGraphForProjectMatching = transformProjectGraphForProjectMatching;
|
|
5
6
|
exports.toRustProjectGraph = toRustProjectGraph;
|
|
6
7
|
const index_1 = require("./index");
|
|
7
8
|
/**
|
|
@@ -45,6 +46,20 @@ function transformProjectGraphForLocators(graph) {
|
|
|
45
46
|
}
|
|
46
47
|
return ref;
|
|
47
48
|
}
|
|
49
|
+
const transferredForProjectMatching = new WeakMap();
|
|
50
|
+
/** Only what project patterns match against: names, roots and tags. */
|
|
51
|
+
function transformProjectGraphForProjectMatching(graph) {
|
|
52
|
+
let ref = transferredForProjectMatching.get(graph);
|
|
53
|
+
if (!ref) {
|
|
54
|
+
const nodes = {};
|
|
55
|
+
for (const [name, node] of Object.entries(graph.nodes)) {
|
|
56
|
+
nodes[name] = { root: node.data.root, tags: node.data.tags, targets: {} };
|
|
57
|
+
}
|
|
58
|
+
ref = (0, index_1.transferProjectGraph)({ nodes, externalNodes: {}, dependencies: {} });
|
|
59
|
+
transferredForProjectMatching.set(graph, ref);
|
|
60
|
+
}
|
|
61
|
+
return ref;
|
|
62
|
+
}
|
|
48
63
|
/** The graph in Rust's shape, still a JS object. Uncached, so safe to edit. */
|
|
49
64
|
function toRustProjectGraph(graph) {
|
|
50
65
|
const dependencies = {};
|
|
@@ -15,6 +15,7 @@ const versions_1 = require("../../utils/versions");
|
|
|
15
15
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
16
16
|
const bun_parser_1 = require("./lock-file/bun-parser");
|
|
17
17
|
const lock_file_1 = require("./lock-file/lock-file");
|
|
18
|
+
const local_path_hashes_1 = require("./lock-file/utils/local-path-hashes");
|
|
18
19
|
const build_dependencies_1 = require("./project-graph/build-dependencies/build-dependencies");
|
|
19
20
|
const config_1 = require("./utils/config");
|
|
20
21
|
exports.name = 'nx/js/dependencies-and-lockfile';
|
|
@@ -22,16 +23,18 @@ exports.name = 'nx/js/dependencies-and-lockfile';
|
|
|
22
23
|
// createDependencies, so both parse the one createNodes read.
|
|
23
24
|
let cachedLockFile;
|
|
24
25
|
let cachedKeyMap;
|
|
26
|
+
let cachedInstalledLocalPathNodes;
|
|
25
27
|
exports.createNodes = [
|
|
26
28
|
(0, globs_1.combineGlobPatterns)(lock_file_1.LOCKFILES),
|
|
27
29
|
(files, _, context) => {
|
|
28
30
|
// A long-lived process must not reuse a lockfile this computation skipped.
|
|
29
31
|
cachedLockFile = undefined;
|
|
30
32
|
cachedKeyMap = undefined;
|
|
33
|
+
cachedInstalledLocalPathNodes = undefined;
|
|
31
34
|
return (0, plugins_1.createNodesFromFiles)(internalCreateNodes, files, _, context);
|
|
32
35
|
},
|
|
33
36
|
];
|
|
34
|
-
function internalCreateNodes(lockFile, _, context) {
|
|
37
|
+
async function internalCreateNodes(lockFile, _, context) {
|
|
35
38
|
const pluginConfig = (0, config_1.jsPluginConfig)(context.nxJsonConfiguration);
|
|
36
39
|
if (!pluginConfig.analyzeLockfile) {
|
|
37
40
|
return {};
|
|
@@ -45,23 +48,31 @@ function internalCreateNodes(lockFile, _, context) {
|
|
|
45
48
|
const lockFileContents = packageManager !== 'bun'
|
|
46
49
|
? (0, fs_1.readFileSync)(lockFilePath, 'utf-8')
|
|
47
50
|
: (0, bun_parser_1.readBunLockFile)(lockFilePath);
|
|
48
|
-
const
|
|
51
|
+
const bunPatchFileHashes = lockFile === bun_parser_1.BUN_TEXT_LOCK_FILE
|
|
52
|
+
? (0, bun_parser_1.getBunPatchFileHashes)(workspace_root_1.workspaceRoot)
|
|
53
|
+
: undefined;
|
|
54
|
+
const lockFileHash = getLockFileHash(lockFileContents, bunPatchFileHashes);
|
|
49
55
|
cachedLockFile = { packageManager, lockFile, lockFileContents, lockFileHash };
|
|
50
56
|
const cached = readCache(externalNodesCache, lockFileHash);
|
|
51
|
-
|
|
57
|
+
// An older build of the same version writes no record, so its entry misses
|
|
58
|
+
if (cached?.installedLocalPathNodes) {
|
|
52
59
|
cachedKeyMap = deserializeKeyMap(cached.keyMap, cached.nodes);
|
|
60
|
+
cachedInstalledLocalPathNodes = cached.installedLocalPathNodes;
|
|
53
61
|
return {
|
|
54
|
-
externalNodes: cached.nodes,
|
|
62
|
+
externalNodes: await (0, local_path_hashes_1.foldLocalPathHashes)(cached.nodes, cached.localPathSources ?? {}, workspace_root_1.workspaceRoot),
|
|
55
63
|
};
|
|
56
64
|
}
|
|
57
|
-
const { nodes: externalNodes, keyMap } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFile, lockFileContents, lockFileHash, context);
|
|
65
|
+
const { nodes: externalNodes, keyMap, localPathSources = {}, installedLocalPathNodes, } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFile, lockFileContents, lockFileHash, context, bunPatchFileHashes);
|
|
58
66
|
cachedKeyMap = keyMap;
|
|
67
|
+
cachedInstalledLocalPathNodes = installedLocalPathNodes;
|
|
59
68
|
writeCache(externalNodesCache, lockFileHash, {
|
|
60
69
|
nodes: externalNodes,
|
|
61
70
|
keyMap: serializeKeyMap(keyMap),
|
|
71
|
+
localPathSources,
|
|
72
|
+
installedLocalPathNodes,
|
|
62
73
|
});
|
|
63
74
|
return {
|
|
64
|
-
externalNodes,
|
|
75
|
+
externalNodes: await (0, local_path_hashes_1.foldLocalPathHashes)(externalNodes, localPathSources, workspace_root_1.workspaceRoot),
|
|
65
76
|
};
|
|
66
77
|
}
|
|
67
78
|
const createDependencies = (_, ctx) => {
|
|
@@ -88,14 +99,18 @@ const createDependencies = (_, ctx) => {
|
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
101
|
perf_hooks_1.performance.mark('build typescript dependencies - start');
|
|
91
|
-
const explicitProjectDependencies = (0, build_dependencies_1.buildExplicitDependencies)(pluginConfig, ctx);
|
|
102
|
+
const explicitProjectDependencies = (0, build_dependencies_1.buildExplicitDependencies)(pluginConfig, ctx, cachedInstalledLocalPathNodes);
|
|
92
103
|
perf_hooks_1.performance.mark('build typescript dependencies - end');
|
|
93
104
|
perf_hooks_1.performance.measure('build typescript dependencies', 'build typescript dependencies - start', 'build typescript dependencies - end');
|
|
94
105
|
return lockfileDependencies.concat(explicitProjectDependencies);
|
|
95
106
|
};
|
|
96
107
|
exports.createDependencies = createDependencies;
|
|
97
|
-
function getLockFileHash(lockFileContents) {
|
|
98
|
-
return (0, file_hasher_1.hashArray)([
|
|
108
|
+
function getLockFileHash(lockFileContents, bunPatchFileHashes = new Map()) {
|
|
109
|
+
return (0, file_hasher_1.hashArray)([
|
|
110
|
+
versions_1.nxVersion,
|
|
111
|
+
lockFileContents,
|
|
112
|
+
...[...bunPatchFileHashes].flat(),
|
|
113
|
+
]);
|
|
99
114
|
}
|
|
100
115
|
// Serialize keyMap to JSON-friendly format
|
|
101
116
|
function serializeKeyMap(keyMap) {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { type ProjectGraphExternalNode } from '../../../config/project-graph';
|
|
1
|
+
import { type ProjectGraph, type ProjectGraphExternalNode } from '../../../config/project-graph';
|
|
2
2
|
import type { CreateDependenciesContext } from '../../../project-graph/plugins';
|
|
3
3
|
import { type RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type { PackageJson } from '../../../utils/package-json';
|
|
5
|
+
import { type LocalPathArtifactTarget } from './pruned-output';
|
|
6
|
+
import type { NormalizedPackageJson } from './utils/package-json';
|
|
7
|
+
declare const DEPENDENCY_TYPES: readonly ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
8
|
+
export interface PinnedManifestSpec {
|
|
9
|
+
depType: (typeof DEPENDENCY_TYPES)[number];
|
|
10
|
+
name: string;
|
|
11
|
+
spec: string;
|
|
12
|
+
}
|
|
13
|
+
export { BUN_LOCK_FILE, BUN_TEXT_LOCK_FILE } from './lock-file-names';
|
|
6
14
|
export declare class BunLockfileParseError extends Error {
|
|
7
15
|
readonly cause?: Error;
|
|
8
16
|
constructor(message: string, cause?: Error);
|
|
@@ -11,4 +19,67 @@ export declare function readBunLockFile(lockFilePath: string): string;
|
|
|
11
19
|
export declare function getBunTextLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
|
12
20
|
/** @internal */
|
|
13
21
|
export declare function clearCache(): void;
|
|
14
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @param patchFileHashes the {@link getBunPatchFileHashes} that `lockFileHash`
|
|
24
|
+
* covers, folded into the hashes of the packages they patch. Omitted, patched
|
|
25
|
+
* packages hash like unpatched ones.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getBunTextLockfileNodes(lockFileContent: string, lockFileHash: string, patchFileHashes?: Map<string, string>): Record<string, ProjectGraphExternalNode>;
|
|
28
|
+
/**
|
|
29
|
+
* The workspace-relative sources of the `nodes` that install from the local
|
|
30
|
+
* file tree, keyed by node name. The lockfile records only their paths, so the
|
|
31
|
+
* contents of these sources are what change when the packages do.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getBunLocalPathNodeSources(lockFileContent: string, lockFileHash: string, nodes: Record<string, ProjectGraphExternalNode>): Record<string, string[]>;
|
|
34
|
+
/**
|
|
35
|
+
* The local-path node each workspace installs per dependency name, keyed by
|
|
36
|
+
* its path ('.' for the root). Aliases are left out.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBunInstalledLocalPathNodes(lockFileContent: string, lockFileHash: string, nodes: Record<string, ProjectGraphExternalNode>): Record<string, Record<string, string>>;
|
|
39
|
+
/**
|
|
40
|
+
* Writes the bun.lock for a standalone install of `packageJson`, with every
|
|
41
|
+
* package at the version the root lockfile installs for it. Dependencies are
|
|
42
|
+
* resolved through the root lockfile's keys, since the project graph records
|
|
43
|
+
* no dependencies of a nested package. The kept packages are laid out in a new
|
|
44
|
+
* tree rooted at the pruned manifest. Bun rebuilds its hoisting on install, so
|
|
45
|
+
* each dependency only has to resolve to the same package, except that a
|
|
46
|
+
* bundled tree stays under its bundler.
|
|
47
|
+
*
|
|
48
|
+
* Workspace modules become `file:./workspace_modules/<name>` dependencies.
|
|
49
|
+
* `projectRoot` is where the manifest's local-path specs resolve from, and it
|
|
50
|
+
* locates the project's own workspace entry, whose resolutions are kept for
|
|
51
|
+
* the specs it declares even where an override replaced them. `onPinnedSpec`
|
|
52
|
+
* receives the locked version the output declares for such a dependency.
|
|
53
|
+
* Returns an empty string for a manifest without dependencies, which gets no
|
|
54
|
+
* lockfile.
|
|
55
|
+
*/
|
|
56
|
+
export declare function stringifyBunLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson, workspaceRootPath: string, projectRoot?: string, onPinnedSpec?: (pin: PinnedManifestSpec) => void): string;
|
|
57
|
+
/**
|
|
58
|
+
* The `.patch` files a pruned Bun output ships for the patches its bun.lock
|
|
59
|
+
* keeps. Bun applies the patches the manifest declares, so the same entries
|
|
60
|
+
* replace any `patchedDependencies` the manifest inherited.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getPrunedBunPatchArtifacts(workspaceRootPath: string, lockFileContent: string, packageJson: PackageJson): Array<{
|
|
63
|
+
path: string;
|
|
64
|
+
content: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* The local packages a pruned bun.lock installs, which the output ships under
|
|
68
|
+
* `local_path_modules/` (see `getLocalPathArtifacts`). Copied workspace modules
|
|
69
|
+
* ship through copy-workspace-modules instead.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getPrunedBunLocalPathTargets(lockFileContent: string): LocalPathArtifactTarget[];
|
|
72
|
+
/**
|
|
73
|
+
* Fails the pruned build when a `link:` package of the pruned bun.lock requires
|
|
74
|
+
* a dependency the app does not install. Bun installs no dependencies of a
|
|
75
|
+
* link, which loads them from the install root.
|
|
76
|
+
*/
|
|
77
|
+
export declare function validatePrunedBunLocalPathClosure(packageJson: PackageJson, workspaceRootPath: string, lockFileContent: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Hashes the patch files the root package.json declares, keyed by the declared
|
|
80
|
+
* path. bun.lock records only the path, so these hashes are what change when a
|
|
81
|
+
* patch file does. A missing file gets its own hash, apart from an unpatched
|
|
82
|
+
* package's.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getBunPatchFileHashes(workspaceRootPath: string): Map<string, string>;
|
|
85
|
+
export declare function getBunLockfilePatchKeys(lockFileContent: string): string[];
|