@sandboxpm/linker 0.1.0
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/LICENSE +21 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +231 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sandboxpm contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sandboxpm/linker
|
|
3
|
+
*
|
|
4
|
+
* Builds pnpm-style non-flat node_modules using hard links from the CAS store.
|
|
5
|
+
*/
|
|
6
|
+
import type { CASStore } from '@sandboxpm/store';
|
|
7
|
+
import type { ResolvedTree } from '@sandboxpm/resolver';
|
|
8
|
+
import type { FetchResult } from '@sandboxpm/fetcher';
|
|
9
|
+
export interface LinkOptions {
|
|
10
|
+
projectDir: string;
|
|
11
|
+
includeDevDependencies: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface LinkResult {
|
|
14
|
+
linkedPackages: number;
|
|
15
|
+
hardLinksCreated: number;
|
|
16
|
+
symlinksCreated: number;
|
|
17
|
+
bytesFromStore: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class Linker {
|
|
20
|
+
private readonly store;
|
|
21
|
+
constructor(store: CASStore);
|
|
22
|
+
link(tree: ResolvedTree, fetchResults: Map<string, FetchResult>, opts: LinkOptions): Promise<LinkResult>;
|
|
23
|
+
unlink(projectDir: string): Promise<void>;
|
|
24
|
+
private _findVersion;
|
|
25
|
+
private _ensureSymlink;
|
|
26
|
+
private _linkBins;
|
|
27
|
+
private _readPackageJson;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB,EAAE,OAAO,CAAA;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAEpB,KAAK,EAAE,QAAQ;IAIrB,IAAI,CACR,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,UAAU,CAAC;IA2HhB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B/C,OAAO,CAAC,YAAY;YAQN,cAAc;YAkBd,SAAS;YA8CT,gBAAgB;CAQ/B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sandboxpm/linker
|
|
3
|
+
*
|
|
4
|
+
* Builds pnpm-style non-flat node_modules using hard links from the CAS store.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs/promises';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
export class Linker {
|
|
9
|
+
store;
|
|
10
|
+
constructor(store) {
|
|
11
|
+
this.store = store;
|
|
12
|
+
}
|
|
13
|
+
async link(tree, fetchResults, opts) {
|
|
14
|
+
const { projectDir } = opts;
|
|
15
|
+
const nodeModules = path.join(projectDir, 'node_modules');
|
|
16
|
+
const sandboxpmDir = path.join(nodeModules, '.sandboxpm');
|
|
17
|
+
// Clean .sandboxpm directory if it exists
|
|
18
|
+
await fs.rm(sandboxpmDir, { recursive: true, force: true });
|
|
19
|
+
await fs.mkdir(sandboxpmDir, { recursive: true });
|
|
20
|
+
await fs.mkdir(path.join(nodeModules, '.bin'), { recursive: true });
|
|
21
|
+
const result = {
|
|
22
|
+
linkedPackages: 0,
|
|
23
|
+
hardLinksCreated: 0,
|
|
24
|
+
symlinksCreated: 0,
|
|
25
|
+
bytesFromStore: 0,
|
|
26
|
+
};
|
|
27
|
+
const directDepNames = new Set(tree.directDeps.map(d => d.name));
|
|
28
|
+
// Step 1: For each resolved package, create its directory and hard-link files
|
|
29
|
+
for (const [key, pkg] of tree.packages) {
|
|
30
|
+
const fetchResult = fetchResults.get(key);
|
|
31
|
+
if (!fetchResult)
|
|
32
|
+
continue;
|
|
33
|
+
const pkgDir = path.join(sandboxpmDir, key, 'node_modules', pkg.name);
|
|
34
|
+
await fs.mkdir(pkgDir, { recursive: true });
|
|
35
|
+
// Hard-link each file from the CAS store
|
|
36
|
+
for (const fileMapping of fetchResult.files) {
|
|
37
|
+
const destPath = path.join(pkgDir, fileMapping.relativePath);
|
|
38
|
+
await this.store.link(fileMapping.hash, destPath);
|
|
39
|
+
// Restore file mode bits
|
|
40
|
+
try {
|
|
41
|
+
await fs.chmod(destPath, fileMapping.mode);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// chmod may fail on some systems; non-fatal
|
|
45
|
+
}
|
|
46
|
+
result.hardLinksCreated++;
|
|
47
|
+
result.bytesFromStore += fileMapping.size;
|
|
48
|
+
}
|
|
49
|
+
result.linkedPackages++;
|
|
50
|
+
}
|
|
51
|
+
// Step 2: Symlink direct deps into root node_modules/
|
|
52
|
+
for (const dep of tree.directDeps) {
|
|
53
|
+
if (dep.type === 'dev' && !opts.includeDevDependencies)
|
|
54
|
+
continue;
|
|
55
|
+
const resolvedVersion = this._findVersion(tree, dep.name);
|
|
56
|
+
if (!resolvedVersion)
|
|
57
|
+
continue;
|
|
58
|
+
const key = `${dep.name}@${resolvedVersion}`;
|
|
59
|
+
// A direct dep resolved into the tree but never fetched (e.g. an optional
|
|
60
|
+
// platform package that doesn't match this host — see resolver/fetcher) has
|
|
61
|
+
// nothing under sandboxpmDir to point at; skip it rather than create a symlink
|
|
62
|
+
// dangling at a target that was never created.
|
|
63
|
+
if (!fetchResults.has(key))
|
|
64
|
+
continue;
|
|
65
|
+
const targetDir = path.join(sandboxpmDir, key, 'node_modules', dep.name);
|
|
66
|
+
const symlinkPath = path.join(nodeModules, dep.name);
|
|
67
|
+
await this._ensureSymlink(targetDir, symlinkPath);
|
|
68
|
+
result.symlinksCreated++;
|
|
69
|
+
}
|
|
70
|
+
// Step 3: Symlink transitive deps (including optionalDependencies — e.g. a
|
|
71
|
+
// platform binary package like @swc/core-win32-x64-msvc — inside each package's
|
|
72
|
+
// own node_modules/
|
|
73
|
+
for (const [key, pkg] of tree.packages) {
|
|
74
|
+
const pkgNodeModules = path.join(sandboxpmDir, key, 'node_modules');
|
|
75
|
+
const allDeps = { ...pkg.dependencies, ...pkg.optionalDependencies };
|
|
76
|
+
for (const [depName, depVersion] of Object.entries(allDeps)) {
|
|
77
|
+
const depKey = `${depName}@${depVersion}`;
|
|
78
|
+
if (!tree.packages.has(depKey))
|
|
79
|
+
continue;
|
|
80
|
+
// Same "was it actually fetched" guard as Step 2 — an unfetched platform
|
|
81
|
+
// sibling must not get a dangling symlink.
|
|
82
|
+
if (!fetchResults.has(depKey))
|
|
83
|
+
continue;
|
|
84
|
+
const targetDir = path.join(sandboxpmDir, depKey, 'node_modules', depName);
|
|
85
|
+
const symlinkPath = path.join(pkgNodeModules, depName);
|
|
86
|
+
// Don't create if it's the package itself (can happen with peer deps)
|
|
87
|
+
if (symlinkPath === path.join(pkgNodeModules, pkg.name))
|
|
88
|
+
continue;
|
|
89
|
+
await this._ensureSymlink(targetDir, symlinkPath);
|
|
90
|
+
result.symlinksCreated++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Step 4: Bin links for direct project deps into the root node_modules/.bin
|
|
94
|
+
for (const [key, pkg] of tree.packages) {
|
|
95
|
+
if (!directDepNames.has(pkg.name))
|
|
96
|
+
continue;
|
|
97
|
+
const fetchResult = fetchResults.get(key);
|
|
98
|
+
if (!fetchResult)
|
|
99
|
+
continue;
|
|
100
|
+
const pkgDir = path.join(sandboxpmDir, key, 'node_modules', pkg.name);
|
|
101
|
+
await this._linkBins(pkgDir, pkg, nodeModules, result);
|
|
102
|
+
}
|
|
103
|
+
// Step 4b: Per-package bin links — populate each package's sibling
|
|
104
|
+
// node_modules/.bin with its direct deps' executables.
|
|
105
|
+
// Required so lifecycle scripts (node-pre-gyp, prebuild-install, node-gyp)
|
|
106
|
+
// are found when running install scripts inside the package directory.
|
|
107
|
+
for (const [key, pkg] of tree.packages) {
|
|
108
|
+
const pkgNodeModules = path.join(sandboxpmDir, key, 'node_modules');
|
|
109
|
+
const allDeps = { ...pkg.dependencies, ...pkg.optionalDependencies };
|
|
110
|
+
for (const [depName, depVersion] of Object.entries(allDeps)) {
|
|
111
|
+
const depKey = `${depName}@${depVersion}`;
|
|
112
|
+
if (!fetchResults.has(depKey))
|
|
113
|
+
continue;
|
|
114
|
+
const depPkg = tree.packages.get(depKey);
|
|
115
|
+
if (!depPkg)
|
|
116
|
+
continue;
|
|
117
|
+
const depPkgDir = path.join(sandboxpmDir, depKey, 'node_modules', depPkg.name);
|
|
118
|
+
await this._linkBins(depPkgDir, depPkg, pkgNodeModules, result);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
async unlink(projectDir) {
|
|
124
|
+
const nodeModules = path.join(projectDir, 'node_modules');
|
|
125
|
+
// Remove .sandboxpm/ dir
|
|
126
|
+
await fs.rm(path.join(nodeModules, '.sandboxpm'), { recursive: true, force: true });
|
|
127
|
+
// Remove root-level symlinks that point into .sandboxpm
|
|
128
|
+
let entries;
|
|
129
|
+
try {
|
|
130
|
+
entries = await fs.readdir(nodeModules, { withFileTypes: true });
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
for (const entry of entries) {
|
|
136
|
+
if (entry.name.startsWith('.'))
|
|
137
|
+
continue;
|
|
138
|
+
if (!entry.isSymbolicLink())
|
|
139
|
+
continue;
|
|
140
|
+
const symlinkPath = path.join(nodeModules, entry.name);
|
|
141
|
+
try {
|
|
142
|
+
const target = await fs.readlink(symlinkPath);
|
|
143
|
+
if (target.includes('.sandboxpm')) {
|
|
144
|
+
await fs.rm(symlinkPath, { force: true });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// ignore
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
_findVersion(tree, name) {
|
|
153
|
+
for (const key of tree.packages.keys()) {
|
|
154
|
+
const pkg = tree.packages.get(key);
|
|
155
|
+
if (pkg?.name === name)
|
|
156
|
+
return pkg.version;
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
async _ensureSymlink(target, symlinkPath) {
|
|
161
|
+
await fs.mkdir(path.dirname(symlinkPath), { recursive: true });
|
|
162
|
+
try {
|
|
163
|
+
if (process.platform === 'win32') {
|
|
164
|
+
// Junctions don't require elevated privileges on Windows (unlike symlinks).
|
|
165
|
+
// Use junction for directories; file type for everything else.
|
|
166
|
+
let isDir = false;
|
|
167
|
+
try {
|
|
168
|
+
isDir = (await fs.stat(target)).isDirectory();
|
|
169
|
+
}
|
|
170
|
+
catch { /* target may not exist yet */ }
|
|
171
|
+
await fs.symlink(target, symlinkPath, isDir ? 'junction' : 'file');
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
await fs.symlink(target, symlinkPath);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
if (err.code === 'EEXIST')
|
|
179
|
+
return;
|
|
180
|
+
throw err;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async _linkBins(pkgDir, pkg, nodeModules, result) {
|
|
184
|
+
const pkgJson = await this._readPackageJson(pkgDir);
|
|
185
|
+
if (!pkgJson)
|
|
186
|
+
return;
|
|
187
|
+
const bin = pkgJson.bin;
|
|
188
|
+
if (!bin)
|
|
189
|
+
return;
|
|
190
|
+
const binDir = path.join(nodeModules, '.bin');
|
|
191
|
+
const binEntries = typeof bin === 'string'
|
|
192
|
+
? { [pkg.name]: bin }
|
|
193
|
+
: bin;
|
|
194
|
+
for (const [binName, binFile] of Object.entries(binEntries)) {
|
|
195
|
+
const target = path.resolve(pkgDir, binFile);
|
|
196
|
+
const symlinkPath = path.join(binDir, binName);
|
|
197
|
+
try {
|
|
198
|
+
await this._ensureSymlink(target, symlinkPath);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
if (process.platform === 'win32' && err.code === 'EPERM') {
|
|
202
|
+
// File symlinks require Developer Mode or admin on Windows; create a .cmd shim instead.
|
|
203
|
+
try {
|
|
204
|
+
await fs.writeFile(`${symlinkPath}.cmd`, `@node "${target.replace(/\//g, '\\')}" %*\r\n`, 'utf8');
|
|
205
|
+
}
|
|
206
|
+
catch { /* non-fatal */ }
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
throw err;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
await fs.chmod(target, 0o755);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// chmod may fail on some systems; non-fatal
|
|
217
|
+
}
|
|
218
|
+
result.symlinksCreated++;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async _readPackageJson(pkgDir) {
|
|
222
|
+
try {
|
|
223
|
+
const content = await fs.readFile(path.join(pkgDir, 'package.json'), 'utf8');
|
|
224
|
+
return JSON.parse(content);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAiB5B,MAAM,OAAO,MAAM;IACA,KAAK,CAAU;IAEhC,YAAY,KAAe;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,C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EAAE,CAAC,SAAS,CAChB,GAAG,WAAW,MAAM,EACpB,UAAU,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAC/C,MAAM,CACP,CAAA;oBACH,CAAC;oBAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAA;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,4CAA4C;YAC9C,CAAC;YACD,MAAM,CAAC,eAAe,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,MAAc;QAC3C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAA;YAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAA;QACvD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sandboxpm/linker",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Builds non-flat node_modules from the sandboxpm content-addressable store",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/daviddaco1/sandboxpm.git",
|
|
9
|
+
"directory": "packages/linker"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"!dist/**/*.tsbuildinfo"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@sandboxpm/store": "0.1.0",
|
|
23
|
+
"@sandboxpm/config": "0.1.0",
|
|
24
|
+
"@sandboxpm/fetcher": "0.1.0",
|
|
25
|
+
"@sandboxpm/resolver": "0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc --build",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
}
|
|
31
|
+
}
|