@metreeca/rack 0.2.0 → 0.4.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/dist/tool/cp.js +0 -0
- package/dist/tool/index.core.js +0 -0
- package/dist/tool/index.d.ts +11 -6
- package/dist/tool/index.d.ts.map +1 -1
- package/dist/tool/index.js +23 -1
- package/dist/tool/index.js.map +1 -1
- package/dist/tool/ln.d.ts +1 -1
- package/dist/tool/ln.d.ts.map +1 -1
- package/dist/tool/ln.js +20 -23
- package/dist/tool/ln.js.map +1 -1
- package/dist/tool/rm.js +0 -0
- package/dist/vite/symlinks.d.ts +5 -0
- package/dist/vite/symlinks.d.ts.map +1 -1
- package/dist/vite/symlinks.js +13 -3
- package/dist/vite/symlinks.js.map +1 -1
- package/package.json +7 -2
package/dist/tool/cp.js
CHANGED
|
File without changes
|
package/dist/tool/index.core.js
CHANGED
|
File without changes
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -7,13 +7,18 @@
|
|
|
7
7
|
* Every tool lists the paths it acts on to stdout, one per line, so that a script log shows what changed on disk. It
|
|
8
8
|
* prints its usage with `--help`, and exits with a non-zero status after printing an error message to stderr.
|
|
9
9
|
*
|
|
10
|
-
* |
|
|
11
|
-
*
|
|
12
|
-
* | `cp <target> <pattern>...` | Copies files matching glob patterns
|
|
13
|
-
* | `
|
|
14
|
-
* | `
|
|
10
|
+
* | Command | Purpose |
|
|
11
|
+
* |---------------------------------------|--------------------------------------------------------------------------|
|
|
12
|
+
* | {@link cp `cp <target> <pattern>...`} | Copies files matching glob patterns to a directory, keeping their layout |
|
|
13
|
+
* | {@link rm `rm <pattern>...`} | Removes files and directories matching glob patterns, with their content |
|
|
14
|
+
* | {@link ln `ln [<deps>]...`} | Links dependencies to their local checkouts instead of registry releases |
|
|
15
|
+
*
|
|
16
|
+
* Build scripts can call the same tools as functions, passing the command operands as arguments: a function throws on
|
|
17
|
+
* failure instead of printing an error message to stderr and setting a non-zero exit status for the process.
|
|
15
18
|
*
|
|
16
19
|
* @module
|
|
17
20
|
*/
|
|
18
|
-
export {};
|
|
21
|
+
export { cp } from "./cp.js";
|
|
22
|
+
export { ln } from "./ln.js";
|
|
23
|
+
export { rm } from "./rm.js";
|
|
19
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tool/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool/index.ts"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/tool/index.js
CHANGED
|
@@ -13,5 +13,27 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Unix-like command line tools for npm package scripts.
|
|
18
|
+
*
|
|
19
|
+
* Each tool is installed as a command alongside the package and behaves the same on every platform and shell. Inside
|
|
20
|
+
* npm scripts, these commands take precedence over system commands with the same name, such as the Unix `cp`.
|
|
21
|
+
*
|
|
22
|
+
* Every tool lists the paths it acts on to stdout, one per line, so that a script log shows what changed on disk. It
|
|
23
|
+
* prints its usage with `--help`, and exits with a non-zero status after printing an error message to stderr.
|
|
24
|
+
*
|
|
25
|
+
* | Command | Purpose |
|
|
26
|
+
* |---------------------------------------|--------------------------------------------------------------------------|
|
|
27
|
+
* | {@link cp `cp <target> <pattern>...`} | Copies files matching glob patterns to a directory, keeping their layout |
|
|
28
|
+
* | {@link rm `rm <pattern>...`} | Removes files and directories matching glob patterns, with their content |
|
|
29
|
+
* | {@link ln `ln [<deps>]...`} | Links dependencies to their local checkouts instead of registry releases |
|
|
30
|
+
*
|
|
31
|
+
* Build scripts can call the same tools as functions, passing the command operands as arguments: a function throws on
|
|
32
|
+
* failure instead of printing an error message to stderr and setting a non-zero exit status for the process.
|
|
33
|
+
*
|
|
34
|
+
* @module
|
|
35
|
+
*/
|
|
36
|
+
export { cp } from "./cp.js";
|
|
37
|
+
export { ln } from "./ln.js";
|
|
38
|
+
export { rm } from "./rm.js";
|
|
17
39
|
//# sourceMappingURL=index.js.map
|
package/dist/tool/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/tool/ln.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Links the local checkouts of the dependencies of the current
|
|
3
|
+
* Links the local checkouts of the dependencies of the package in the current folder into its `node_modules`.
|
|
4
4
|
*
|
|
5
5
|
* The current package, and in a monorepo each of its workspace members, then builds and runs against the working
|
|
6
6
|
* trees of its dependencies instead of their registry releases. Dependencies are matched to checkouts by package name.
|
package/dist/tool/ln.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ln.d.ts","sourceRoot":"","sources":["../../src/tool/ln.ts"],"names":[],"mappings":";AA0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"ln.d.ts","sourceRoot":"","sources":["../../src/tool/ln.ts"],"names":[],"mappings":";AA0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CA+LnD"}
|
package/dist/tool/ln.js
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { chmodSync, existsSync, globSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, symlinkSync } from "node:fs";
|
|
18
|
-
import { dirname, join, relative, resolve } from "node:path";
|
|
18
|
+
import { dirname, join, parse, relative, resolve, sep } from "node:path";
|
|
19
19
|
import { cli } from "./index.core.js";
|
|
20
20
|
if (import.meta.main) {
|
|
21
21
|
process.exitCode = cli(ln, "[<deps>]...");
|
|
22
22
|
}
|
|
23
23
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
24
24
|
/**
|
|
25
|
-
* Links the local checkouts of the dependencies of the current
|
|
25
|
+
* Links the local checkouts of the dependencies of the package in the current folder into its `node_modules`.
|
|
26
26
|
*
|
|
27
27
|
* The current package, and in a monorepo each of its workspace members, then builds and runs against the working
|
|
28
28
|
* trees of its dependencies instead of their registry releases. Dependencies are matched to checkouts by package name.
|
|
@@ -97,7 +97,7 @@ export function ln(...deps) {
|
|
|
97
97
|
commands(path, name).forEach(([command, script]) => {
|
|
98
98
|
replace(join(modules, ".bin", command), join(target, script));
|
|
99
99
|
if (existsSync(join(path, script))) {
|
|
100
|
-
chmodSync(join(path, script), 0o755); // as npm does, since
|
|
100
|
+
chmodSync(join(path, script), 0o755); // as npm does on install, since tsc emits no mode
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -108,15 +108,9 @@ export function ln(...deps) {
|
|
|
108
108
|
}
|
|
109
109
|
function commands(path, name) {
|
|
110
110
|
const { bin } = manifest(path);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
else if (typeof bin === "string") {
|
|
115
|
-
return [[name.replace(/^@[^/]+\//, ""), bin]];
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return Object.entries(bin ?? {});
|
|
119
|
-
}
|
|
111
|
+
return process.platform === "win32" ? []
|
|
112
|
+
: typeof bin === "string" ? [[name.replace(/^@[^/]+\//, ""), bin]]
|
|
113
|
+
: Object.entries(bin ?? {});
|
|
120
114
|
}
|
|
121
115
|
function copies(modules) {
|
|
122
116
|
return children(modules)
|
|
@@ -128,7 +122,11 @@ export function ln(...deps) {
|
|
|
128
122
|
const copy = join(modules, name);
|
|
129
123
|
const path = linked.get(name);
|
|
130
124
|
if (path !== undefined) {
|
|
131
|
-
return existsSync(copy) && realpathSync(copy) === realpathSync(path) ? [] : [{
|
|
125
|
+
return existsSync(copy) && realpathSync(copy) === realpathSync(path) ? [] : [{
|
|
126
|
+
modules,
|
|
127
|
+
name,
|
|
128
|
+
path
|
|
129
|
+
}];
|
|
132
130
|
}
|
|
133
131
|
else if (lstatSync(copy).isSymbolicLink()) {
|
|
134
132
|
return []; // a link into another checkout, inspected as a root of its own when linked
|
|
@@ -145,16 +143,15 @@ export function ln(...deps) {
|
|
|
145
143
|
.filter(member => existsSync(join(member, "package.json")))
|
|
146
144
|
] : [];
|
|
147
145
|
}
|
|
148
|
-
function checkout(path
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
146
|
+
function checkout(path) {
|
|
147
|
+
const parent = ancestors(path).find(ancestor => existsSync(join(ancestor, "package.json")));
|
|
148
|
+
return parent !== undefined && packages(parent).includes(path) ? parent : path;
|
|
149
|
+
}
|
|
150
|
+
function ancestors(path) {
|
|
151
|
+
const { root } = parse(path);
|
|
152
|
+
return relative(root, dirname(path)).split(sep).filter(Boolean)
|
|
153
|
+
.map((_, index, segments) => join(root, ...segments.slice(0, index + 1)))
|
|
154
|
+
.reverse();
|
|
158
155
|
}
|
|
159
156
|
function children(path) {
|
|
160
157
|
return folder(path) ? readdirSync(path) : [];
|
package/dist/tool/ln.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ln.js","sourceRoot":"","sources":["../../src/tool/ln.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ln.js","sourceRoot":"","sources":["../../src/tool/ln.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGtC,IAAK,MAAM,CAAC,IAAI,CAAC,IAAI,EAAG,CAAC;IACxB,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;AAC3C,CAAC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AG,gBAAgB;YACnB,GAAG,oBAAoB;SAEvB,CAAC,CAAC;IAEJ,CAAC;IAED,SAAS,QAAQ,CAAC,IAAY;QAa7B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,oCAAoC;IAE1G,CAAC;AAEF,CAAC"}
|
package/dist/tool/rm.js
CHANGED
|
File without changes
|
package/dist/vite/symlinks.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ import type { Plugin } from "vite";
|
|
|
8
8
|
* Packages are looked up as Node does, from the `node_modules` nearest to the importer up through its ancestors, so
|
|
9
9
|
* links hoisted to a workspace root are found from any member; imports with no importer start from the Vite root.
|
|
10
10
|
*
|
|
11
|
+
* The `peerDependencies` of linked packages are shared with the project: they resolve from the Vite root whoever the
|
|
12
|
+
* importer is, also from registry packages installed in a checkout, so that the project and its linked packages load a
|
|
13
|
+
* single copy of them, as libraries holding module state such as Preact hooks require. Only peers of packages already
|
|
14
|
+
* resolved through the plugin are shared; all other imports keep resolving from the checkout they are found in.
|
|
15
|
+
*
|
|
11
16
|
* The plugin replaces `resolve.conditions`, which breaks registry packages whose exports name a condition without
|
|
12
17
|
* publishing its target: Vite does not fall back to `default` when that target is missing from the installed files.
|
|
13
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symlinks.d.ts","sourceRoot":"","sources":["../../src/vite/symlinks.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"symlinks.d.ts","sourceRoot":"","sources":["../../src/vite/symlinks.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAQnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,QAAQ,CAAC,EAExB,UAAU,EAEV,EAAE;IAEF;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;CAEtC,GAAG,MAAM,CAiFT"}
|
package/dist/vite/symlinks.js
CHANGED
|
@@ -26,6 +26,11 @@ import { exports } from "resolve.exports";
|
|
|
26
26
|
* Packages are looked up as Node does, from the `node_modules` nearest to the importer up through its ancestors, so
|
|
27
27
|
* links hoisted to a workspace root are found from any member; imports with no importer start from the Vite root.
|
|
28
28
|
*
|
|
29
|
+
* The `peerDependencies` of linked packages are shared with the project: they resolve from the Vite root whoever the
|
|
30
|
+
* importer is, also from registry packages installed in a checkout, so that the project and its linked packages load a
|
|
31
|
+
* single copy of them, as libraries holding module state such as Preact hooks require. Only peers of packages already
|
|
32
|
+
* resolved through the plugin are shared; all other imports keep resolving from the checkout they are found in.
|
|
33
|
+
*
|
|
29
34
|
* The plugin replaces `resolve.conditions`, which breaks registry packages whose exports name a condition without
|
|
30
35
|
* publishing its target: Vite does not fall back to `default` when that target is missing from the installed files.
|
|
31
36
|
*
|
|
@@ -58,13 +63,15 @@ import { exports } from "resolve.exports";
|
|
|
58
63
|
*/
|
|
59
64
|
export function symlinks({ conditions }) {
|
|
60
65
|
const $conditions = typeof conditions === "string" ? [conditions] : conditions;
|
|
61
|
-
const manifests = new Map(); // memoised by link real path
|
|
66
|
+
const manifests = new Map(); // memoised by link real path, also tracking the peers to share
|
|
62
67
|
return {
|
|
63
68
|
name: "symlinks",
|
|
64
69
|
enforce: "pre",
|
|
65
|
-
resolveId(id, importer) {
|
|
70
|
+
resolveId(id, importer, options) {
|
|
71
|
+
const root = this.environment.config.root;
|
|
66
72
|
const name = id.match(/^(@[^/]+\/)?[^/]+/)?.[0];
|
|
67
|
-
const
|
|
73
|
+
const peer = name !== undefined && [...manifests.values()].some(({ peerDependencies }) => peerDependencies !== undefined && Object.hasOwn(peerDependencies, name));
|
|
74
|
+
const base = !peer && importer && isAbsolute(importer) ? dirname(importer) : root;
|
|
68
75
|
const link = name && lookup(name, base);
|
|
69
76
|
if (link) {
|
|
70
77
|
try {
|
|
@@ -76,6 +83,9 @@ export function symlinks({ conditions }) {
|
|
|
76
83
|
return null;
|
|
77
84
|
}
|
|
78
85
|
}
|
|
86
|
+
else if (peer) { // falls back to the default resolution if missing from the project
|
|
87
|
+
return this.resolve(id, join(root, "package.json"), { ...options, skipSelf: true });
|
|
88
|
+
}
|
|
79
89
|
else {
|
|
80
90
|
return null;
|
|
81
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symlinks.js","sourceRoot":"","sources":["../../src/vite/symlinks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,OAAO,EAAgB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"symlinks.js","sourceRoot":"","sources":["../../src/vite/symlinks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,OAAO,EAAgB,MAAM,iBAAiB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,QAAQ,CAAC,EAExB,UAAU,EAUV;IAEA,MAAM,WAAW,GAAG,OAAO,UAAU,KAAK,QA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AAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE5B,OAAO,MAAM,CAAC;QAEf,CAAC;aAAM,CAAC;YAEP,OAAO,MAAM,CAAC;QAEf,CAAC;IAEF,CAAC;AAEF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metreeca/rack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Everyday tooling for npm package development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"clean": "rm -rf dist docs node_modules",
|
|
46
46
|
"prime": "npm ci",
|
|
47
47
|
"setup": "npm ci",
|
|
48
|
-
"build": "rm -rf dist docs && tsc -p tsconfig.build.json && npx typedoc",
|
|
48
|
+
"build": "rm -rf dist docs && tsc -p tsconfig.build.json && chmod +x dist/tool/*.js && npx typedoc",
|
|
49
49
|
"check": "npx vitest --typecheck run",
|
|
50
50
|
"proof": "npx typedoc && (npx typedoc --watch & npx wds --root-dir docs --watch --open)"
|
|
51
51
|
},
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"vite": "^8.0.0"
|
|
65
65
|
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"vite": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
66
71
|
"allowScripts": {
|
|
67
72
|
"fsevents": false
|
|
68
73
|
}
|