knarr 0.1.2 → 0.2.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/README.md +1 -1
- package/dist/add-Clbi3vJ2.mjs +3 -0
- package/dist/add-flow-DdDziP5M.mjs +5 -0
- package/dist/batch-push-pVkjhRbp.mjs +3 -0
- package/dist/bell-BJuCym_5.mjs +11 -0
- package/dist/bell-CIzHg0kw.mjs +3 -0
- package/dist/bell-UNNirKkz.mjs +3 -0
- package/dist/build-detect-mSo9jKXK.mjs +3 -0
- package/dist/bundler-detect-Cx8_R2hT.mjs +3 -0
- package/dist/check-Boh8WU_W.mjs +3 -0
- package/dist/chokidar-BkIWf7Ix.mjs +3 -0
- package/dist/clean-DHh6fpmR.mjs +3 -0
- package/dist/cli.mjs +4 -4
- package/dist/config-CQpgsGyL.mjs +4 -0
- package/dist/console-BxhMcj-D.mjs +81 -0
- package/dist/console-X31Y_QS5.mjs +3 -0
- package/dist/dev-DeOwxr_7.mjs +3 -0
- package/dist/dist-CFkjiIqD.mjs +7 -0
- package/dist/doctor-XEdsr84Q.mjs +6 -0
- package/dist/dry-run-BxVjpNqJ.mjs +3 -0
- package/dist/errors-CV7G61Hr.mjs +3 -0
- package/dist/explain-BBv3U-D3.mjs +3 -0
- package/dist/format-DRqD29u-.mjs +3 -0
- package/dist/fs-BjaNhdzt.mjs +683 -0
- package/dist/fs-Cf1JTFyh.mjs +3 -0
- package/dist/fs-DUcoWJ1g.mjs +3 -0
- package/dist/hints-Hz3V4h3A.mjs +3 -0
- package/dist/history-BZS2YUIt.mjs +3 -0
- package/dist/history-C5ehozRy.mjs +3 -0
- package/dist/index.d.ts +242 -260
- package/dist/index.mjs +3361 -4521
- package/dist/init-Dwf-EIG3.mjs +4 -0
- package/dist/init-helpers-BfDosqvf.mjs +15 -0
- package/dist/injector-XwK_LBUh.mjs +3 -0
- package/dist/json-C6XtcMC4.mjs +46 -0
- package/dist/json-CWzEb9Rt.mjs +3 -0
- package/dist/list-DcREV9JM.mjs +3 -0
- package/dist/logger-DlikgOlh.mjs +3 -0
- package/dist/migrate-DW5KQeDq.mjs +5 -0
- package/dist/nextjs-config-BfHv8mBE.mjs +3 -0
- package/dist/nextjs-config-CA4N_9VY.mjs +4 -0
- package/dist/output-BxyRer_F.mjs +3 -0
- package/dist/package-manager-DBBQ0XtZ.mjs +13 -0
- package/dist/picomatch-B0_Pxgms.mjs +3 -0
- package/dist/preflight-B17VQJs0.mjs +3 -0
- package/dist/preflight-B8ypfoKV.mjs +3 -0
- package/dist/publish-BLk5_qx1.mjs +3 -0
- package/dist/publisher-Br4Od-iL.mjs +4 -0
- package/dist/push-C6UFcNGO.mjs +3 -0
- package/dist/push-engine-D3rfg2Tj.mjs +3 -0
- package/dist/remove-Bz9dNgDM.mjs +3 -0
- package/dist/remove-DMj6k2PK.mjs +3 -0
- package/dist/reset--AuvAPTc.mjs +3 -0
- package/dist/restore-CIBe2F1d.mjs +3 -0
- package/dist/rollback-CFLIncnW.mjs +3 -0
- package/dist/rolldown-runtime-BZbIAPMk.mjs +3 -0
- package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
- package/dist/shell-RQ7Hf1kp.mjs +3 -0
- package/dist/status-Dy-e_RtI.mjs +3 -0
- package/dist/store-BNeGfW_b.mjs +3 -0
- package/dist/tailwind-source-Cgva0Hte.mjs +5 -0
- package/dist/timer-DqgB175x.mjs +3 -0
- package/dist/topo-sort-DOCpHjT7.mjs +3 -0
- package/dist/topo-sort-yd4jxr_E.mjs +3 -0
- package/dist/tracker-DXSo5wXO.mjs +3 -0
- package/dist/tracker-DofCXLTP.mjs +3 -0
- package/dist/update-Dacjzw4f.mjs +3 -0
- package/dist/use-BSCV4IQ5.mjs +3 -0
- package/dist/vite-config-CbYEhn5K.mjs +3 -0
- package/dist/vite-config-DqxvL5TW.mjs +12 -0
- package/dist/vite-plugin.d.ts +6 -5
- package/dist/vite-plugin.mjs +206 -211
- package/dist/watch-orchestrator-CghvwrNS.mjs +3 -0
- package/dist/watcher-Bw_qcI0M.mjs +3 -0
- package/dist/webpack-plugin.d.ts +29 -30
- package/dist/webpack-plugin.mjs +140 -138
- package/dist/workspace-D4vhzpO4.mjs +3 -0
- package/dist/workspace-DVY5o1g8.mjs +3 -0
- package/dist/xxhash-wasm-D_QjdUuv.mjs +3 -0
- package/package.json +21 -30
- package/dist/add-4Z3V5722.mjs +0 -3
- package/dist/bell-SIN4ERLS.mjs +0 -2
- package/dist/check-7CJHAF6Y.mjs +0 -6
- package/dist/chokidar-2G63V464.mjs +0 -4
- package/dist/chunk-3SXN6MQL.mjs +0 -4
- package/dist/chunk-7GCKCCHU.mjs +0 -3
- package/dist/chunk-7ROQJISX.mjs +0 -15
- package/dist/chunk-ABG6UD3X.mjs +0 -22
- package/dist/chunk-BH2WXCLS.mjs +0 -4
- package/dist/chunk-C4TZJOCB.mjs +0 -3
- package/dist/chunk-COI7GWH3.mjs +0 -4
- package/dist/chunk-E3HZCU3S.mjs +0 -5
- package/dist/chunk-FSVETLZK.mjs +0 -4
- package/dist/chunk-G7HFTV5Y.mjs +0 -3
- package/dist/chunk-HVN6HBWZ.mjs +0 -3
- package/dist/chunk-ICU4V73X.mjs +0 -3
- package/dist/chunk-IP5ROSRE.mjs +0 -3
- package/dist/chunk-IZC5ORVG.mjs +0 -3
- package/dist/chunk-J6HZHQVL.mjs +0 -3
- package/dist/chunk-L7O2RSTN.mjs +0 -3
- package/dist/chunk-M3TRMEJV.mjs +0 -3
- package/dist/chunk-MN4DV2NO.mjs +0 -3
- package/dist/chunk-N3B2JO4H.mjs +0 -13
- package/dist/chunk-NGPAGRK4.mjs +0 -7
- package/dist/chunk-OQDZJP55.mjs +0 -3
- package/dist/chunk-QEH5VHRO.mjs +0 -13
- package/dist/chunk-QFHYSC3K.mjs +0 -3
- package/dist/chunk-QHNHLR6T.mjs +0 -3
- package/dist/chunk-RJSBXX2Q.mjs +0 -3
- package/dist/chunk-SPHWZS5P.mjs +0 -3
- package/dist/chunk-U6O35NZ7.mjs +0 -3
- package/dist/chunk-UCSYKFEZ.mjs +0 -3
- package/dist/chunk-W2MMKBWU.mjs +0 -3
- package/dist/chunk-WBTSRLB6.mjs +0 -7
- package/dist/chunk-WN3DOKIM.mjs +0 -3
- package/dist/chunk-XDWZZBCM.mjs +0 -3
- package/dist/chunk-Z5K6DFA6.mjs +0 -3
- package/dist/clean-EJIYYQZM.mjs +0 -3
- package/dist/dev-RHCNJNQE.mjs +0 -3
- package/dist/doctor-ZK4OPSD4.mjs +0 -6
- package/dist/explain-BDTONX7H.mjs +0 -5
- package/dist/fs-NU36NNEG.mjs +0 -2
- package/dist/history-MLJHRV3Q.mjs +0 -2
- package/dist/init-X4F3XKVC.mjs +0 -16
- package/dist/list-4PTHMIQ4.mjs +0 -5
- package/dist/migrate-VHDLW6I7.mjs +0 -8
- package/dist/nextjs-config-T5D6LOJE.mjs +0 -2
- package/dist/preflight-IXICTR6G.mjs +0 -2
- package/dist/publish-UGDDG6OT.mjs +0 -3
- package/dist/push-NADBGWI6.mjs +0 -3
- package/dist/remove-EPVDMWCS.mjs +0 -2
- package/dist/reset-5M6AU4FU.mjs +0 -3
- package/dist/restore-QPISOGEK.mjs +0 -12
- package/dist/rollback-ECXCFOD3.mjs +0 -3
- package/dist/status-3ZXM3CRH.mjs +0 -4
- package/dist/tailwind-source-HCTY2XDU.mjs +0 -5
- package/dist/topo-sort-ZNGR6D7M.mjs +0 -2
- package/dist/tracker-QAKEXYUJ.mjs +0 -2
- package/dist/update-RSPDDAJK.mjs +0 -12
- package/dist/use-LZ2GIXYZ.mjs +0 -3
- package/dist/vite-config-XOGAKYGQ.mjs +0 -2
- package/dist/watch-orchestrator-SFFGME6W.mjs +0 -3
- package/dist/watcher-ES2APFH4.mjs +0 -3
- package/dist/workspace-T6PNO4L3.mjs +0 -2
- package/dist/xxhash-wasm-I6Q3T2SL.mjs +0 -3
package/dist/webpack-plugin.mjs
CHANGED
|
@@ -1,143 +1,145 @@
|
|
|
1
|
+
import { join, normalize } from "node:path";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
// src/utils/json.ts
|
|
4
|
+
function isJsonObject(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** Parse JSON to `unknown`; callers must validate before use. */
|
|
8
|
+
function parseJson(text) {
|
|
9
|
+
return JSON.parse(text);
|
|
10
|
+
}
|
|
11
|
+
/** Parse JSON that must be an object (package.json, state files). Throws otherwise. */
|
|
12
|
+
function parseJsonObject(text, label = "JSON") {
|
|
13
|
+
const value = parseJson(text);
|
|
14
|
+
if (!isJsonObject(value)) throw new Error(`${label} must contain a JSON object`);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
/** `obj[key]` when it is a JSON object. */
|
|
18
|
+
function objectField(obj, key) {
|
|
19
|
+
const value = obj[key];
|
|
20
|
+
return isJsonObject(value) ? value : void 0;
|
|
21
|
+
}
|
|
1
22
|
// src/webpack-plugin.ts
|
|
2
|
-
|
|
3
|
-
import { readFileSync } from "fs";
|
|
23
|
+
/** Synchronously read linked package names from state.json */
|
|
4
24
|
function readLinkedPackagesSync(stateFile) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
25
|
+
try {
|
|
26
|
+
const links = objectField(parseJsonObject(readFileSync(stateFile, "utf-8"), stateFile), "links");
|
|
27
|
+
return links ? Object.keys(links) : [];
|
|
28
|
+
} catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
12
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Webpack/rspack plugin for knarr.
|
|
34
|
+
*
|
|
35
|
+
* - Excludes linked packages from webpack's snapshot cache (managedPaths)
|
|
36
|
+
* - Watches .knarr/state.json and linked package directories
|
|
37
|
+
* - Invalidates the compiler on changes to trigger a rebuild
|
|
38
|
+
* - Works with webpack 5 and rspack (uses loose typing, no webpack import)
|
|
39
|
+
*/
|
|
13
40
|
var KnarrWebpackPlugin = class {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
async (compilation) => {
|
|
118
|
-
for (const pkg of watchedPackages) {
|
|
119
|
-
compilation.contextDependencies.add(join(nodeModulesDir, pkg));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
compiler.hooks.watchClose.tap("KnarrWebpackPlugin", () => {
|
|
124
|
-
if (debounceTimer) {
|
|
125
|
-
clearTimeout(debounceTimer);
|
|
126
|
-
debounceTimer = null;
|
|
127
|
-
}
|
|
128
|
-
if (pollTimer) {
|
|
129
|
-
clearInterval(pollTimer);
|
|
130
|
-
pollTimer = void 0;
|
|
131
|
-
}
|
|
132
|
-
if (watcher) {
|
|
133
|
-
watcher.close();
|
|
134
|
-
watcher = null;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var webpack_plugin_default = KnarrWebpackPlugin;
|
|
140
|
-
export {
|
|
141
|
-
KnarrWebpackPlugin,
|
|
142
|
-
webpack_plugin_default as default
|
|
41
|
+
options;
|
|
42
|
+
constructor(options = {}) {
|
|
43
|
+
this.options = options;
|
|
44
|
+
}
|
|
45
|
+
apply(compiler) {
|
|
46
|
+
const root = this.options.root ?? compiler.options.context ?? process.cwd();
|
|
47
|
+
const stateFile = normalize(join(root, ".knarr", "state.json"));
|
|
48
|
+
const nodeModulesDir = join(root, "node_modules");
|
|
49
|
+
let watcher = null;
|
|
50
|
+
let pollTimer;
|
|
51
|
+
let debounceTimer = null;
|
|
52
|
+
let lastStateContent = "";
|
|
53
|
+
const watchedPackages = /* @__PURE__ */ new Set();
|
|
54
|
+
const invalidate = () => {
|
|
55
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
56
|
+
debounceTimer = setTimeout(() => {
|
|
57
|
+
debounceTimer = null;
|
|
58
|
+
if (compiler.watching) compiler.watching.invalidate();
|
|
59
|
+
}, 200);
|
|
60
|
+
};
|
|
61
|
+
const syncPackages = () => {
|
|
62
|
+
let changed = false;
|
|
63
|
+
for (const pkg of readLinkedPackagesSync(stateFile)) if (!watchedPackages.has(pkg)) {
|
|
64
|
+
watchedPackages.add(pkg);
|
|
65
|
+
changed = true;
|
|
66
|
+
}
|
|
67
|
+
return changed;
|
|
68
|
+
};
|
|
69
|
+
compiler.hooks.afterEnvironment.tap("KnarrWebpackPlugin", () => {
|
|
70
|
+
syncPackages();
|
|
71
|
+
if (watchedPackages.size === 0) return;
|
|
72
|
+
const snapshot = compiler.options.snapshot ??= {};
|
|
73
|
+
const managedPaths = snapshot.managedPaths ??= [];
|
|
74
|
+
const escaped = [...watchedPackages].sort((a, b) => b.length - a.length).map((p) => p.replace(/[/\\.*+?^${}()|[\]]/g, "\\$&")).join("|");
|
|
75
|
+
const excludeRegex = new RegExp(`node_modules[\\\\/](?!(?:${escaped})(?:[\\\\/]|$))`);
|
|
76
|
+
const filtered = managedPaths.filter((p) => {
|
|
77
|
+
if (typeof p === "string") return !p.includes("node_modules");
|
|
78
|
+
return !p.source?.includes("node_modules");
|
|
79
|
+
});
|
|
80
|
+
filtered.push(excludeRegex);
|
|
81
|
+
snapshot.managedPaths = filtered;
|
|
82
|
+
});
|
|
83
|
+
compiler.hooks.watchRun.tapPromise("KnarrWebpackPlugin", async () => {
|
|
84
|
+
if (watcher) return;
|
|
85
|
+
const usePolling = !!process.versions?.webcontainer;
|
|
86
|
+
if (usePolling) {
|
|
87
|
+
try {
|
|
88
|
+
lastStateContent = readFileSync(stateFile, "utf-8");
|
|
89
|
+
} catch {}
|
|
90
|
+
pollTimer = setInterval(() => {
|
|
91
|
+
try {
|
|
92
|
+
const content = readFileSync(stateFile, "utf-8");
|
|
93
|
+
if (lastStateContent && content !== lastStateContent) {
|
|
94
|
+
lastStateContent = content;
|
|
95
|
+
syncPackages();
|
|
96
|
+
invalidate();
|
|
97
|
+
}
|
|
98
|
+
if (!lastStateContent) lastStateContent = content;
|
|
99
|
+
} catch {}
|
|
100
|
+
}, 1e3);
|
|
101
|
+
}
|
|
102
|
+
const { watch } = await import("chokidar");
|
|
103
|
+
const watchPaths = [stateFile];
|
|
104
|
+
for (const pkg of watchedPackages) watchPaths.push(join(nodeModulesDir, pkg));
|
|
105
|
+
const chokidarWatcher = watch(watchPaths, {
|
|
106
|
+
ignoreInitial: true,
|
|
107
|
+
ignored: [/[/\\]\.git[/\\]/],
|
|
108
|
+
backend: usePolling ? "polling" : "auto",
|
|
109
|
+
...usePolling && { pollingInterval: 1e3 }
|
|
110
|
+
});
|
|
111
|
+
let chokidarClosed = false;
|
|
112
|
+
chokidarWatcher.on("change", (changedPath) => {
|
|
113
|
+
if (normalize(changedPath) === stateFile) {
|
|
114
|
+
if (syncPackages() && !chokidarClosed) for (const pkg of watchedPackages) chokidarWatcher.add(join(nodeModulesDir, pkg));
|
|
115
|
+
}
|
|
116
|
+
invalidate();
|
|
117
|
+
});
|
|
118
|
+
chokidarWatcher.on("add", () => invalidate());
|
|
119
|
+
chokidarWatcher.on("unlink", () => invalidate());
|
|
120
|
+
watcher = { close: () => {
|
|
121
|
+
chokidarClosed = true;
|
|
122
|
+
return chokidarWatcher.close();
|
|
123
|
+
} };
|
|
124
|
+
});
|
|
125
|
+
compiler.hooks.afterCompile.tapPromise("KnarrWebpackPlugin", (compilation) => {
|
|
126
|
+
for (const pkg of watchedPackages) compilation.contextDependencies.add(join(nodeModulesDir, pkg));
|
|
127
|
+
return Promise.resolve();
|
|
128
|
+
});
|
|
129
|
+
compiler.hooks.watchClose.tap("KnarrWebpackPlugin", () => {
|
|
130
|
+
if (debounceTimer) {
|
|
131
|
+
clearTimeout(debounceTimer);
|
|
132
|
+
debounceTimer = null;
|
|
133
|
+
}
|
|
134
|
+
if (pollTimer) {
|
|
135
|
+
clearInterval(pollTimer);
|
|
136
|
+
pollTimer = void 0;
|
|
137
|
+
}
|
|
138
|
+
if (watcher) {
|
|
139
|
+
watcher.close().catch(() => {});
|
|
140
|
+
watcher = null;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
143
144
|
};
|
|
145
|
+
export { KnarrWebpackPlugin, KnarrWebpackPlugin as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
|
|
3
|
+
export{t as buildReverseAdjacency,n as buildWorkspaceGraph,r as filterPublishableWorkspaceGraph,i as findWorkspacePackageRoot,a as findWorkspacePackages,s as parseCatalogs}from"./workspace-DVY5o1g8.mjs";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
|
|
3
|
+
import{r as e}from"./rolldown-runtime-BZbIAPMk.mjs";import{t}from"./picomatch-B0_Pxgms.mjs";import{O as n,c as r}from"./fs-Cf1JTFyh.mjs";import{r as i,s as a,t as o}from"./json-CWzEb9Rt.mjs";import{readFile as s,readdir as c}from"node:fs/promises";import{dirname as l,join as u,relative as d,resolve as f}from"node:path";var p=/* @__PURE__ */ e(t(),1);async function findWorkspaceRoot(e){let t=e;for(;;){if(await r(u(t,`pnpm-workspace.yaml`)))return t;let e=l(t);if(e===t)return null;t=e}}async function findWorkspacePackageRoot(e){return await findWorkspaceRoot(e)??await findPackageJsonWorkspaceRoot(e)}async function parseCatalogs(e){let t={default:Object.create(null),named:Object.create(null)},n=u(e,`pnpm-workspace.yaml`),r;try{r=await s(n,`utf-8`)}catch{return t}let i=r.split(/\r?\n/),a=`top`,o=``;for(let e of i){if(e.trim()===``||e.trim().startsWith(`#`))continue;let n=e.length-e.trimStart().length;if(n===0){if(e.startsWith(`catalog:`)){a=`default-catalog`;continue}if(e.startsWith(`catalogs:`)){a=`named-catalogs`;continue}a=`top`}else if(a===`default-catalog`&&n>=2){let n=parseKeyValue(e);n&&(t.default[n[0]]=n[1])}else if(a===`named-catalogs`&&n>=2&&n<4){let n=e.trim();n.endsWith(`:`)&&(o=n.slice(0,-1),t.named[o]=Object.create(null),a=`named-catalog-entries`)}else if(a===`named-catalog-entries`&&n>=4){let n=parseKeyValue(e),r=o?t.named[o]:void 0;n&&r&&(r[n[0]]=n[1])}else if(a===`named-catalog-entries`&&n>=2&&n<4){let n=e.trim();n.endsWith(`:`)?(o=n.slice(0,-1),t.named[o]=Object.create(null)):a=`named-catalogs`}}return t}async function findWorkspacePackages(e){let t=await findWorkspaceRoot(e);if(t){let e=await parsePnpmWorkspacePackages(t),n=e.filter(e=>!e.startsWith(`!`)),r=e.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1));if(n.length>0)return resolveWorkspaceGlobs(t,n,r)}let n=t??await findPackageJsonWorkspaceRoot(e);if(!n)return[];try{let e=(await a(u(n,`package.json`))).workspaces,t=Array.isArray(e)?e:i(e)?e.packages:[],r=Array.isArray(t)?t.filter(e=>typeof e==`string`):[];return r.length===0?[]:resolveWorkspaceGlobs(n,r.filter(e=>!e.startsWith(`!`)),r.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1)))}catch{return[]}}async function parsePnpmWorkspacePackages(e){let t=u(e,`pnpm-workspace.yaml`),n;try{n=await s(t,`utf-8`)}catch{return[]}let r=[],i=!1;for(let e of n.split(/\r?\n/)){let t=e.trim();if(t===``||t.startsWith(`#`))continue;let n=e.length-e.trimStart().length;if(n===0)i=t===`packages:`;else if(i&&n>=2){let e=t.match(/^-\s+["']?([^"']+)["']?$/);e?.[1]&&r.push(e[1])}}return r}async function findPackageJsonWorkspaceRoot(e){let t=e;for(;;){try{if((await a(u(t,`package.json`))).workspaces)return t}catch{}let e=l(t);if(e===t)return null;t=e}}async function resolveWorkspaceGlobs(e,t,i=[]){let a=[];for(let i of t)if(i.includes(`*`)){let t=i.split(`/`),o=e,s=[],l=!1;for(let e of t)l||e.includes(`*`)?(l=!0,s.push(e)):o=u(o,e);if(s.length===1&&s[0]===`*`)try{let e=await c(o,{withFileTypes:!0});for(let t of e)if(t.isDirectory()){let e=u(o,t.name);await r(u(e,`package.json`))&&a.push(e)}}catch{}else{let t=(0,p.default)(i),o=await collectDirs(e,8);for(let i of o)t(n(d(e,i)))&&await r(u(i,`package.json`))&&a.push(i)}}else{let t=f(e,i);await r(u(t,`package.json`))&&a.push(t)}let o=[...new Set(a)];if(i.length===0)return o;let s=(0,p.default)(i);return o.filter(t=>{let r=n(d(e,t));return!s(r)})}async function collectDirs(e,t){if(t<=0)return[];let n=[];try{let r=await c(e,{withFileTypes:!0});for(let i of r){if(!i.isDirectory()||i.name===`node_modules`||i.name===`.git`)continue;let r=u(e,i.name);n.push(r),n.push(...await collectDirs(r,t-1))}}catch{}return n}async function buildWorkspaceGraph(e){let t=await findWorkspacePackages(e),n=[];for(let e of t)try{let t=o(await a(u(e,`package.json`)));t?.name&&t.version&&n.push({name:t.name,version:t.version,dir:e,pkg:t})}catch{}let r=new Set(n.map(e=>e.name)),i=/* @__PURE__ */ new Map;for(let e of n){let t=/* @__PURE__ */ new Set;for(let n of[`dependencies`,`devDependencies`]){let i=e.pkg[n];if(i)for(let e of Object.keys(i))r.has(e)&&t.add(e)}i.set(e.name,t)}return{packages:n,adjacency:i}}function filterPublishableWorkspaceGraph(e){let t=e.packages.filter(e=>!e.pkg.private),n=new Set(t.map(e=>e.name)),r=/* @__PURE__ */ new Map;for(let i of t){let t=e.adjacency.get(i.name)??/* @__PURE__ */ new Set;r.set(i.name,new Set([...t].filter(e=>n.has(e))))}return{packages:t,adjacency:r}}function buildReverseAdjacency(e){let t=/* @__PURE__ */ new Map;for(let n of e.keys())t.set(n,/* @__PURE__ */ new Set);for(let[n,r]of e)for(let e of r){let r=t.get(e);r||(r=/* @__PURE__ */ new Set,t.set(e,r)),r.add(n)}return t}function parseKeyValue(e){let t=e.trim(),n=t.indexOf(`:`);if(n<=0)return null;let r=t.slice(0,n).trim(),i=stripYamlInlineComment(t.slice(n+1)).trim();return!r||!i?null:[r.replace(/^["']|["']$/g,``),i.replace(/^["']|["']$/g,``)]}function stripYamlInlineComment(e){let t=null;for(let n=0;n<e.length;n++){let r=e[n];if((r===`"`||r===`'`)&&e[n-1]!==`\\`)t=t===r?null:t??r;else if(!t&&r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return e.slice(0,n)}return e}export{findWorkspacePackages as a,findWorkspacePackageRoot as i,buildWorkspaceGraph as n,findWorkspaceRoot as o,filterPublishableWorkspaceGraph as r,parseCatalogs as s,buildReverseAdjacency as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
|
|
3
|
+
import"./rolldown-runtime-BZbIAPMk.mjs";const t=new Uint8Array([0,97,115,109,1,0,0,0,1,48,8,96,3,127,127,127,1,127,96,3,127,127,127,0,96,2,127,127,0,96,1,127,1,127,96,3,127,127,126,1,126,96,3,126,127,127,1,126,96,2,127,126,0,96,1,127,1,126,3,11,10,0,0,2,1,3,4,5,6,1,7,5,3,1,0,1,7,85,9,3,109,101,109,2,0,5,120,120,104,51,50,0,0,6,105,110,105,116,51,50,0,2,8,117,112,100,97,116,101,51,50,0,3,8,100,105,103,101,115,116,51,50,0,4,5,120,120,104,54,52,0,5,6,105,110,105,116,54,52,0,7,8,117,112,100,97,116,101,54,52,0,8,8,100,105,103,101,115,116,54,52,0,9,10,251,22,10,242,1,1,4,127,32,0,32,1,106,33,3,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,3,32,2,65,137,235,208,208,7,107,33,4,32,2,65,207,140,162,142,6,106,33,5,3,64,32,3,32,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,5,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,6,32,0,65,4,106,34,0,79,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,3,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,32,1,106,32,0,32,1,65,15,113,16,1,11,146,1,0,32,1,32,2,106,33,2,3,64,32,1,65,4,106,32,2,75,69,4,64,32,0,32,1,40,2,0,65,189,220,202,149,124,108,106,65,17,119,65,175,214,211,190,2,108,33,0,32,1,65,4,106,33,1,12,1,11,11,3,64,32,1,32,2,79,69,4,64,32,0,32,1,45,0,0,65,177,207,217,178,1,108,106,65,11,119,65,177,243,221,241,121,108,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,65,15,118,115,65,247,148,175,175,120,108,34,0,65,13,118,32,0,115,65,189,220,202,149,124,108,34,0,65,16,118,32,0,115,11,63,0,32,0,65,8,106,32,1,65,168,136,141,161,2,106,54,2,0,32,0,65,12,106,32,1,65,137,235,208,208,7,107,54,2,0,32,0,65,16,106,32,1,54,2,0,32,0,65,20,106,32,1,65,207,140,162,142,6,106,54,2,0,11,195,4,1,6,127,32,1,32,2,106,33,6,32,0,65,24,106,33,4,32,0,65,40,106,40,2,0,33,3,32,0,32,0,40,2,0,32,2,106,54,2,0,32,0,65,4,106,34,5,32,5,40,2,0,32,2,65,16,79,32,0,40,2,0,65,16,79,114,114,54,2,0,32,2,32,3,106,65,16,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,40,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,16,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,40,2,0,32,4,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,12,106,34,3,32,3,40,2,0,32,4,65,4,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,16,106,34,3,32,3,40,2,0,32,4,65,8,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,20,106,34,3,32,3,40,2,0,32,4,65,12,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,40,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,32,6,65,16,107,77,4,64,32,6,65,16,107,33,8,32,0,65,8,106,40,2,0,33,2,32,0,65,12,106,40,2,0,33,3,32,0,65,16,106,40,2,0,33,5,32,0,65,20,106,40,2,0,33,7,3,64,32,2,32,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,3,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,5,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,7,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,7,32,8,32,1,65,4,106,34,1,79,13,0,11,32,0,65,8,106,32,2,54,2,0,32,0,65,12,106,32,3,54,2,0,32,0,65,16,106,32,5,54,2,0,32,0,65,20,106,32,7,54,2,0,11,32,1,32,6,73,4,64,32,4,32,1,32,6,32,1,107,34,1,252,10,0,0,32,0,65,40,106,32,1,54,2,0,11,11,97,1,1,127,32,0,65,16,106,40,2,0,33,1,32,0,65,4,106,40,2,0,4,127,32,1,65,12,119,32,0,65,20,106,40,2,0,65,18,119,106,32,0,65,12,106,40,2,0,65,7,119,106,32,0,65,8,106,40,2,0,65,1,119,106,5,32,1,65,177,207,217,178,1,106,11,32,0,40,2,0,106,32,0,65,24,106,32,0,65,40,106,40,2,0,16,1,11,255,3,2,3,126,1,127,32,0,32,1,106,33,6,32,1,65,32,79,4,126,32,6,65,32,107,33,6,32,2,66,214,235,130,238,234,253,137,245,224,0,124,33,3,32,2,66,177,169,172,193,173,184,212,166,61,125,33,4,32,2,66,249,234,208,208,231,201,161,228,225,0,124,33,5,3,64,32,3,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,3,32,4,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,2,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,5,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,6,32,0,65,8,106,34,0,79,13,0,11,32,2,66,12,137,32,5,66,18,137,124,32,4,66,7,137,124,32,3,66,1,137,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,2,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,32,0,32,1,65,31,113,16,6,11,134,2,0,32,1,32,2,106,33,2,3,64,32,2,32,1,65,8,106,79,4,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,33,0,32,1,65,8,106,33,1,12,1,11,11,32,1,65,4,106,32,2,77,4,64,32,0,32,1,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,0,32,1,65,4,106,33,1,11,3,64,32,1,32,2,73,4,64,32,0,32,1,49,0,0,66,197,207,217,178,241,229,186,234,39,126,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,66,33,136,133,66,207,214,211,190,210,199,171,217,66,126,34,0,32,0,66,29,136,133,66,249,243,221,241,153,246,153,171,22,126,34,0,32,0,66,32,136,133,11,77,0,32,0,65,8,106,32,1,66,214,235,130,238,234,253,137,245,224,0,124,55,3,0,32,0,65,16,106,32,1,66,177,169,172,193,173,184,212,166,61,125,55,3,0,32,0,65,24,106,32,1,55,3,0,32,0,65,32,106,32,1,66,249,234,208,208,231,201,161,228,225,0,124,55,3,0,11,244,4,2,3,127,4,126,32,1,32,2,106,33,5,32,0,65,40,106,33,4,32,0,65,200,0,106,40,2,0,33,3,32,0,32,0,41,3,0,32,2,173,124,55,3,0,32,2,32,3,106,65,32,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,200,0,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,32,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,41,3,0,32,4,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,16,106,34,3,32,3,41,3,0,32,4,65,8,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,24,106,34,3,32,3,41,3,0,32,4,65,16,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,32,106,34,3,32,3,41,3,0,32,4,65,24,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,200,0,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,65,32,106,32,5,77,4,64,32,5,65,32,107,33,2,32,0,65,8,106,41,3,0,33,6,32,0,65,16,106,41,3,0,33,7,32,0,65,24,106,41,3,0,33,8,32,0,65,32,106,41,3,0,33,9,3,64,32,6,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,7,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,8,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,8,32,9,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,9,32,2,32,1,65,8,106,34,1,79,13,0,11,32,0,65,8,106,32,6,55,3,0,32,0,65,16,106,32,7,55,3,0,32,0,65,24,106,32,8,55,3,0,32,0,65,32,106,32,9,55,3,0,11,32,1,32,5,73,4,64,32,4,32,1,32,5,32,1,107,34,1,252,10,0,0,32,0,65,200,0,106,32,1,54,2,0,11,11,188,2,1,5,126,32,0,65,24,106,41,3,0,33,1,32,0,41,3,0,34,2,66,32,90,4,126,32,0,65,8,106,41,3,0,34,3,66,1,137,32,0,65,16,106,41,3,0,34,4,66,7,137,124,32,1,66,12,137,32,0,65,32,106,41,3,0,34,5,66,18,137,124,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,1,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,1,66,197,207,217,178,241,229,186,234,39,124,11,32,2,124,32,0,65,40,106,32,2,66,31,131,167,16,6,11]);async function e(){return function(t){let{exports:{mem:n,xxh32:r,xxh64:i,init32:a,update32:o,digest32:s,init64:c,update64:l,digest64:u}}=t,p=new Uint8Array(n.buffer);function g(t,r){if(n.buffer.byteLength<t+r){let i=Math.ceil((t+r-n.buffer.byteLength)/65536);n.grow(i),p=new Uint8Array(n.buffer)}}function f(t,n,r,i,a,o){g(t);let s=new Uint8Array(t);return p.set(s),r(0,n),s.set(p.subarray(0,t)),{update(n){let r;return p.set(s),typeof n==`string`?(g(3*n.length,t),r=h.encodeInto(n,p.subarray(t)).written):(g(n.byteLength,t),p.set(n,t),r=n.byteLength),i(0,t,r),s.set(p.subarray(0,t)),this},digest:()=>(p.set(s),o(a(0)))}}function y(t){return t>>>0}let m=2n**64n-1n;function d(t){return t&m}let h=new TextEncoder,_=0n;function x(t,n=0){return g(3*t.length,0),y(r(0,h.encodeInto(t,p).written,n))}function L(t,n=_){return g(3*t.length,0),d(i(0,h.encodeInto(t,p).written,n))}return{h32:x,h32ToString:(t,n=0)=>x(t,n).toString(16).padStart(8,`0`),h32Raw:(t,n=0)=>(g(t.byteLength,0),p.set(t),y(r(0,t.byteLength,n))),create32:(t=0)=>f(48,t,a,o,s,y),h64:L,h64ToString:(t,n=_)=>L(t,n).toString(16).padStart(16,`0`),h64Raw:(t,n=_)=>(g(t.byteLength,0),p.set(t),d(i(0,t.byteLength,n))),create64:(t=_)=>f(88,t,c,l,u,d)}}((await WebAssembly.instantiate(t)).instance)}export{e as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knarr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Copy local npm package builds into consumer node_modules with incremental sync and watch mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -39,14 +39,16 @@
|
|
|
39
39
|
],
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
-
"dev": "
|
|
42
|
+
"build": "tsdown",
|
|
43
|
+
"dev": "tsdown --watch",
|
|
44
44
|
"test": "vitest run",
|
|
45
45
|
"test:watch": "vitest",
|
|
46
46
|
"compat:smoke": "node scripts/compat-smoke.mjs",
|
|
47
|
-
"bench": "vitest bench",
|
|
48
|
-
"lint": "
|
|
49
|
-
"prepublishOnly": "pnpm build"
|
|
47
|
+
"bench": "vitest bench --reporter=verbose",
|
|
48
|
+
"lint": "pnpm typecheck && oxlint",
|
|
49
|
+
"prepublishOnly": "pnpm build",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.dts.json",
|
|
51
|
+
"lint:fix": "oxlint --fix"
|
|
50
52
|
},
|
|
51
53
|
"keywords": [
|
|
52
54
|
"npm",
|
|
@@ -81,22 +83,24 @@
|
|
|
81
83
|
"url": "https://github.com/oleg-kuibar/knarr/issues"
|
|
82
84
|
},
|
|
83
85
|
"author": "Oleg Kuibar (https://github.com/oleg-kuibar)",
|
|
84
|
-
"packageManager": "pnpm@
|
|
86
|
+
"packageManager": "pnpm@12.18.0",
|
|
85
87
|
"engines": {
|
|
86
|
-
"node": ">=22.
|
|
88
|
+
"node": ">=22.22.0"
|
|
87
89
|
},
|
|
88
90
|
"devDependencies": {
|
|
89
|
-
"@types/node": "^26.
|
|
91
|
+
"@types/node": "^26.6.6",
|
|
90
92
|
"@types/picomatch": "^4.0.3",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
93
|
+
"oxlint": "^1.92.0",
|
|
94
|
+
"oxlint-tsgolint": "^7.0.2006",
|
|
95
|
+
"tsdown": "^0.23.7",
|
|
96
|
+
"typescript": "^7.0.2",
|
|
97
|
+
"vite": "^8.3.6",
|
|
98
|
+
"vitest": "^5.1.0"
|
|
95
99
|
},
|
|
96
100
|
"peerDependencies": {
|
|
101
|
+
"@rspack/core": ">=0.5.0",
|
|
97
102
|
"vite": ">=5.0.0",
|
|
98
|
-
"webpack": ">=5.0.0"
|
|
99
|
-
"@rspack/core": ">=0.5.0"
|
|
103
|
+
"webpack": ">=5.0.0"
|
|
100
104
|
},
|
|
101
105
|
"peerDependenciesMeta": {
|
|
102
106
|
"vite": {
|
|
@@ -110,23 +114,10 @@
|
|
|
110
114
|
}
|
|
111
115
|
},
|
|
112
116
|
"dependencies": {
|
|
113
|
-
"chokidar": "^
|
|
117
|
+
"chokidar": "^6.0.0",
|
|
114
118
|
"citty": "^0.2.2",
|
|
115
119
|
"picocolors": "^1.1.1",
|
|
116
|
-
"picomatch": "^4.0.
|
|
120
|
+
"picomatch": "^4.0.7",
|
|
117
121
|
"xxhash-wasm": "^1.1.0"
|
|
118
|
-
},
|
|
119
|
-
"pnpm": {
|
|
120
|
-
"overrides": {
|
|
121
|
-
"dompurify": "^3.4.1",
|
|
122
|
-
"esbuild": "^0.28.1",
|
|
123
|
-
"fast-uri": "^3.1.2",
|
|
124
|
-
"picomatch": "^4.0.4",
|
|
125
|
-
"postcss": "^8.5.10",
|
|
126
|
-
"rollup": "^4.59.0"
|
|
127
|
-
},
|
|
128
|
-
"onlyBuiltDependencies": [
|
|
129
|
-
"esbuild"
|
|
130
|
-
]
|
|
131
122
|
}
|
|
132
123
|
}
|
package/dist/add-4Z3V5722.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-7ROQJISX.mjs';import'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import'./chunk-UCSYKFEZ.mjs';import'./chunk-N3B2JO4H.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import {a as a$1}from'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {b}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var s={meta:{name:"add",description:"Link a package from the Knarr store into this project"},args:{package:{type:"positional",description:"Package name to add",required:true},from:{type:"string",description:"Path to package source (will publish first)"},build:{type:"string",description:"Build command to run before publishing --from"},"skip-build":{type:"boolean",description:"Skip build detection before publishing --from",default:false},yes:{type:"boolean",alias:"y",description:"Auto-accept prompts (install missing deps, etc.)",default:false}},async run({args:e}){b(),await a({packageArg:e.package,from:e.from,build:e.build,skipBuild:e["skip-build"],yes:e.yes,timer:new a$1});}};export{s as default};
|
package/dist/bell-SIN4ERLS.mjs
DELETED
package/dist/check-7CJHAF6Y.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-IP5ROSRE.mjs';import {b,a as a$2}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import {a,b as b$1}from'./chunk-OQDZJP55.mjs';import {c}from'./chunk-L7O2RSTN.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var o=c(a(),1);var y={meta:{name:"check",description:"Validate package configuration (exports, types, entry points)"},args:{dir:{type:"positional",description:"Package directory (default: current directory)",required:false}},async run({args:l}){b();let p=resolve(l.dir||"."),s=await a$1(p);if(s.length===0){b$1.success("All pre-flight checks passed"),a$2({issues:[],passed:true});return}let t=s.filter(e=>e.severity==="error"),i=s.filter(e=>e.severity==="warn");b$1.info(`Found ${s.length} issue(s):
|
|
4
|
-
`);for(let e of t)b$1.log(` ${o.default.red("ERROR")} ${o.default.dim(`[${e.code}]`)} ${e.message}`);for(let e of i)b$1.log(` ${o.default.yellow("WARN")} ${o.default.dim(`[${e.code}]`)} ${e.message}`);t.length>0?b$1.error(`
|
|
5
|
-
${t.length} error(s), ${i.length} warning(s)`):b$1.warn(`
|
|
6
|
-
${i.length} warning(s)`),a$2({issues:s,passed:t.length===0});}};export{y as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-L7O2RSTN.mjs';import {EventEmitter}from'events';import {unwatchFile,watchFile,watch,stat as stat$1}from'fs';import {lstat,stat,readdir,realpath,open}from'fs/promises';import*as u from'path';import {resolve,join,relative,sep}from'path';import {Readable}from'stream';import {type}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var g={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},k={root:".",fileFilter:a(r=>true,"fileFilter"),directoryFilter:a(r=>true,"directoryFilter"),type:g.FILE_TYPE,lstat:false,depth:2147483648,alwaysStat:false,highWaterMark:4096};Object.freeze(k);var J="READDIRP_RECURSIVE_ERROR",gt=new Set(["ENOENT","EPERM","EACCES","ELOOP",J]),B=[g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE],yt=new Set([g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE]),Pt=new Set([g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE]),Rt=a(r=>gt.has(r.code),"isNormalFlowError"),bt=process.platform==="win32",$=a(r=>true,"emptyFn"),q=a(r=>{if(r===void 0)return $;if(typeof r=="function")return r;if(typeof r=="string"){let t=r.trim();return e=>e.basename===t}if(Array.isArray(r)){let t=r.map(e=>e.trim());return e=>t.some(i=>e.basename===i)}return $},"normalizeFilter"),L=class extends Readable{static{a(this,"ReaddirpStream");}parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(t={}){super({objectMode:true,autoDestroy:true,highWaterMark:t.highWaterMark});let e={...k,...t},{root:i,type:s}=e;this._fileFilter=q(e.fileFilter),this._directoryFilter=q(e.directoryFilter);let n=e.lstat?lstat:stat;bt?this._stat=h=>n(h,{bigint:true}):this._stat=n,this._maxDepth=e.depth!=null&&Number.isSafeInteger(e.depth)?e.depth:k.depth,this._wantsDir=s?yt.has(s):false,this._wantsFile=s?Pt.has(s):false,this._wantsEverything=s===g.EVERYTHING_TYPE,this._root=resolve(i),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=false,this.parent=void 0;}async _read(t){if(!this.reading){this.reading=true;try{for(;!this.destroyed&&t>0;){let e=this.parent,i=e&&e.files;if(i&&i.length>0){let{path:s,depth:n}=e,h=i.splice(0,t).map(a=>this._formatEntry(a,s)),o=await Promise.all(h);for(let a of o){if(!a)continue;if(this.destroyed)return;let c=await this._getEntryType(a);c==="directory"&&this._directoryFilter(a)?(n<=this._maxDepth&&this.parents.push(this._exploreDir(a.fullPath,n+1)),this._wantsDir&&(this.push(a),t--)):(c==="file"||this._includeAsFile(a))&&this._fileFilter(a)&&this._wantsFile&&(this.push(a),t--);}}else {let s=this.parents.pop();if(!s){this.push(null);break}if(this.parent=await s,this.destroyed)return}}}catch(e){this.destroy(e);}finally{this.reading=false;}}}async _exploreDir(t,e){let i;try{i=await readdir(t,this._rdOptions);}catch(s){this._onError(s);}return {files:i,depth:e,path:t}}async _formatEntry(t,e){let i,s=this._isDirent?t.name:t;try{let n=resolve(join(e,s));i={path:relative(this._root,n),fullPath:n,basename:s},i[this._statsProp]=this._isDirent?t:await this._stat(n);}catch(n){this._onError(n);return}return i}_onError(t){Rt(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t);}async _getEntryType(t){if(!t&&this._statsProp in t)return "";let e=t[this._statsProp];if(e.isFile())return "file";if(e.isDirectory())return "directory";if(e&&e.isSymbolicLink()){let i=t.fullPath;try{let s=await realpath(i),n=await lstat(s);if(n.isFile())return "file";if(n.isDirectory()){let h=s.length;if(i.startsWith(s)&&i.substr(h,1)===sep){let o=new Error(`Circular symlink detected: "${i}" points to "${s}"`);return o.code=J,this._onError(o)}return "directory"}}catch(s){return this._onError(s),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}};function Q(r,t={}){let e=t.entryType||t.type;if(e==="both"&&(e=g.FILE_DIR_TYPE),e&&(t.type=e),r){if(typeof r!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(e&&!B.includes(e))throw new Error(`readdirp: Invalid type passed. Use one of ${B.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=r,new L(t)}a(Q,"readdirp");var Ft="data",z="end",et="close",S=a(()=>{},"EMPTY_FN");var A=process.platform,H=A==="win32",St=A==="darwin",At=A==="linux",Wt=A==="freebsd",st=type()==="OS400",m={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},y=m,Nt="watch",kt={lstat:lstat,stat:stat},R="listeners",T="errHandlers",b="rawEmitters",Lt=[R,T,b],Ct=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Ot=a(r=>Ct.has(u.extname(r).slice(1).toLowerCase()),"isBinaryPath"),M=a((r,t)=>{r instanceof Set?r.forEach(t):t(r);},"foreach"),D=a((r,t,e)=>{let i=r[t];i instanceof Set||(r[t]=i=new Set([i])),i.add(e);},"addAndConvert"),Mt=a(r=>t=>{let e=r[t];e instanceof Set?e.clear():delete r[t];},"clearItem"),I=a((r,t,e)=>{let i=r[t];i instanceof Set?i.delete(e):i===e&&delete r[t];},"delFromSet"),it=a(r=>r instanceof Set?r.size===0:!r,"isEmptySet"),v=new Map;function Z(r,t,e,i,s){let n=a((h,o)=>{e(r),s(h,o,{watchedPath:r}),o&&r!==o&&x(u.resolve(r,o),R,u.join(r,o));},"handleEvent");try{return watch(r,{persistent:t.persistent},n)}catch(h){i(h);return}}a(Z,"createFsWatchInstance");var x=a((r,t,e,i,s)=>{let n=v.get(r);n&&M(n[t],h=>{h(e,i,s);});},"fsWatchBroadcast"),zt=a((r,t,e,i)=>{let{listener:s,errHandler:n,rawEmitter:h}=i,o=v.get(t),a;if(!e.persistent)return a=Z(r,e,s,n,h),a?a.close.bind(a):void 0;if(o)D(o,R,s),D(o,T,n),D(o,b,h);else {if(a=Z(r,e,x.bind(null,t,R),n,x.bind(null,t,b)),!a)return;a.on(y.ERROR,async c=>{let d=x.bind(null,t,T);if(o&&(o.watcherUnusable=true),H&&c.code==="EPERM")try{await(await open(r,"r")).close(),d(c);}catch{}else d(c);}),o={listeners:s,errHandlers:n,rawEmitters:h,watcher:a},v.set(t,o);}return ()=>{I(o,R,s),I(o,T,n),I(o,b,h),it(o.listeners)&&(o.watcher.close(),v.delete(t),Lt.forEach(Mt(o)),o.watcher=void 0,Object.freeze(o));}},"setFsWatchListener"),O=new Map,Ht=a((r,t,e,i)=>{let{listener:s,rawEmitter:n}=i,h=O.get(t),o=h&&h.options;return o&&(o.persistent<e.persistent||o.interval>e.interval)&&(unwatchFile(t),h=void 0),h?(D(h,R,s),D(h,b,n)):(h={listeners:s,rawEmitters:n,options:e,watcher:watchFile(t,e,(a,c)=>{M(h.rawEmitters,_=>{_(y.CHANGE,t,{curr:a,prev:c});});let d=a.mtimeMs;(a.size!==c.size||d>c.mtimeMs||d===0)&&M(h.listeners,_=>_(r,a));})},O.set(t,h)),()=>{I(h,R,s),I(h,b,n),it(h.listeners)&&(O.delete(t),unwatchFile(t),h.options=h.watcher=void 0,Object.freeze(h));}},"setFsWatchFileListener"),F=class{static{a(this,"NodeFsHandler");}fsw;_boundHandleError;constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e);}_watchWithNodeFs(t,e){let i=this.fsw.options,s=u.dirname(t),n=u.basename(t);this.fsw._getWatchedDir(s).add(n);let o=u.resolve(t),a={persistent:i.persistent};e||(e=S);let c;if(i.usePolling){let d=i.interval!==i.binaryInterval;a.interval=d&&Ot(n)?i.binaryInterval:i.interval,c=Ht(t,o,a,{listener:e,rawEmitter:this.fsw._emitRaw});}else c=zt(t,o,a,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(t,e,i){if(this.fsw.closed)return;let s=u.dirname(t),n=u.basename(t),h=this.fsw._getWatchedDir(s),o=e;if(h.has(n))return;let a$1=a(async(d,_)=>{if(this.fsw._throttle(Nt,t,5)){if(!_||_.mtimeMs===0)try{let f=await stat(t);if(this.fsw.closed)return;let w=f.atimeMs,E=f.mtimeMs;if((!w||w<=E||E!==o.mtimeMs)&&this.fsw._emit(y.CHANGE,t,f),(St||At||Wt)&&o.ino!==f.ino){this.fsw._closeFile(d),o=f;let P=this._watchWithNodeFs(t,a$1);P&&this.fsw._addPathCloser(d,P);}else o=f;}catch{this.fsw._remove(s,n);}else if(h.has(n)){let f=_.atimeMs,w=_.mtimeMs;(!f||f<=w||w!==o.mtimeMs)&&this.fsw._emit(y.CHANGE,t,_),o=_;}}},"listener"),c=this._watchWithNodeFs(t,a$1);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(y.ADD,t,0))return;this.fsw._emit(y.ADD,t,e);}return c}async _handleSymlink(t,e,i,s){if(this.fsw.closed)return;let n=t.fullPath,h=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let o;try{o=await realpath(i);}catch{return this.fsw._emitReady(),true}return this.fsw.closed?void 0:(h.has(s)?this.fsw._symlinkPaths.get(n)!==o&&(this.fsw._symlinkPaths.set(n,o),this.fsw._emit(y.CHANGE,i,t.stats)):(h.add(s),this.fsw._symlinkPaths.set(n,o),this.fsw._emit(y.ADD,i,t.stats)),this.fsw._emitReady(),true)}if(this.fsw._symlinkPaths.has(n))return true;this.fsw._symlinkPaths.set(n,true);}_handleRead(t,e,i,s,n,h,o){t=u.join(t,"");let a$1=s?`${t}:${s}`:t;if(o=this.fsw._throttle("readdir",a$1,1e3),!o)return;let c=this.fsw._getWatchedDir(i.path),d=new Set,_=this.fsw._readdirp(t,{fileFilter:a(f=>i.filterPath(f),"fileFilter"),directoryFilter:a(f=>i.filterDir(f),"directoryFilter")});if(_)return _.on(Ft,async f=>{if(this.fsw.closed){_=void 0;return}let w=f.path,E=u.join(t,w);if(d.add(w),!(f.stats.isSymbolicLink()&&await this._handleSymlink(f,t,E,w))){if(this.fsw.closed){_=void 0;return}(w===s||!s&&!c.has(w))&&(this.fsw._incrReadyCount(),E=u.join(n,u.relative(n,E)),this._addToNodeFs(E,e,i,h+1));}}).on(y.ERROR,this._boundHandleError),new Promise((f,w)=>{if(!_)return w();_.once(z,()=>{if(this.fsw.closed){_=void 0;return}let E=o?o.clear():false;f(void 0),c.getChildren().filter(P=>P!==t&&!d.has(P)).forEach(P=>{this.fsw._remove(t,P);}),_=void 0,E&&this._handleRead(t,false,i,s,n,h,o);});})}async _handleDir(t,e,i,s,n,h,o){let a=this.fsw._getWatchedDir(u.dirname(t)),c=a.has(u.basename(t));!(i&&this.fsw.options.ignoreInitial)&&!n&&!c&&this.fsw._emit(y.ADD_DIR,t,e),a.add(u.basename(t)),this.fsw._getWatchedDir(t);let d,_,f=this.fsw.options.depth;if((f==null||s<=f)&&!this.fsw._symlinkPaths.has(o)){if(!n&&(await this._handleRead(t,i,h,n,t,s,d),this.fsw.closed))return;_=this._watchWithNodeFs(t,(w,E)=>{E&&E.mtimeMs===0||this._handleRead(w,false,h,n,t,s,d);});}return _}async _addToNodeFs(t,e,i,s,n){let h=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return h(),false;let o=this.fsw._getWatchHelpers(t);i&&(o.filterPath=a=>i.filterPath(a),o.filterDir=a=>i.filterDir(a));try{let a=await kt[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,a))return h(),!1;let c=this.fsw.options.followSymlinks,d;if(a.isDirectory()){let _=u.resolve(t),f=c?await realpath(t):t;if(this.fsw.closed||(d=await this._handleDir(o.watchPath,a,e,s,n,o,f),this.fsw.closed))return;_!==f&&f!==void 0&&this.fsw._symlinkPaths.set(_,f);}else if(a.isSymbolicLink()){let _=c?await realpath(t):t;if(this.fsw.closed)return;let f=u.dirname(o.watchPath);if(this.fsw._getWatchedDir(f).add(o.watchPath),this.fsw._emit(y.ADD,o.watchPath,a),d=await this._handleDir(f,a,e,s,t,o,_),this.fsw.closed)return;_!==void 0&&this.fsw._symlinkPaths.set(u.resolve(t),_);}else d=this._handleFile(o.watchPath,a,e);return h(),d&&this.fsw._addPathCloser(t,d),!1}catch(a){if(this.fsw._handleError(a))return h(),t}}};var j="/",Kt="//",ht=".",Vt="..",Bt="string",$t=/\\/g,lt=/\/\//g,qt=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Jt=/^\.[/\\]/;function W(r){return Array.isArray(r)?r:[r]}a(W,"arrify");var Y=a(r=>typeof r=="object"&&r!==null&&!(r instanceof RegExp),"isMatcherObject");function Qt(r){return typeof r=="function"?r:typeof r=="string"?t=>r===t:r instanceof RegExp?t=>r.test(t):typeof r=="object"&&r!==null?t=>{if(r.path===t)return true;if(r.recursive){let e=u.relative(r.path,t);return e?!e.startsWith("..")&&!u.isAbsolute(e):false}return false}:()=>false}a(Qt,"createPattern");function Xt(r){if(typeof r!="string")throw new Error("string expected");r=u.normalize(r),r=r.replace(/\\/g,"/");let t=false;return r.startsWith("//")&&(t=true),r=r.replace(lt,"/"),t&&(r="/"+r),r}a(Xt,"normalizePath");function rt(r,t,e){let i=Xt(t);for(let s=0;s<r.length;s++){let n=r[s];if(n(i,e))return true}return false}a(rt,"matchPatterns");function Zt(r,t){if(r==null)throw new TypeError("anymatch: specify first argument");let i=W(r).map(s=>Qt(s));return t==null?(s,n)=>rt(i,s,n):rt(i,t)}a(Zt,"anymatch");var nt=a(r=>{let t=W(r).flat();if(!t.every(e=>typeof e===Bt))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(ct)},"unifyPaths"),ot=a(r=>{let t=r.replace($t,j),e=false;return t.startsWith(Kt)&&(e=true),t=t.replace(lt,j),e&&(t=j+t),t},"toUnix"),ct=a(r=>ot(u.normalize(ot(r))),"normalizePathToUnix"),at=a((r="")=>t=>typeof t=="string"?ct(u.isAbsolute(t)?t:u.join(r,t)):t,"normalizeIgnored"),te=a((r,t)=>u.isAbsolute(r)?r:u.join(t,r),"getAbsolutePath"),ee=Object.freeze(new Set),U=class{static{a(this,"DirEntry");}path;_removeWatcher;items;constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set;}add(t){let{items:e}=this;e&&t!==ht&&t!==Vt&&e.add(t);}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let i=this.path;try{await readdir(i);}catch{this._removeWatcher&&this._removeWatcher(u.dirname(i),u.basename(i));}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=S,this.items=ee,Object.freeze(this);}},se="stat",ie="lstat",G=class{static{a(this,"WatchHelper");}fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,e,i){this.fsw=i;let s=t;this.path=t=t.replace(Jt,""),this.watchPath=s,this.fullWatchPath=u.resolve(s),this.dirParts=[],this.dirParts.forEach(n=>{n.length>1&&n.pop();}),this.followSymlinks=e,this.statMethod=e?se:ie;}entryPath(t){return u.join(this.watchPath,u.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},N=class extends EventEmitter{static{a(this,"FSWatcher");}closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(t={}){super(),this.closed=false,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=false;let e=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:true,ignoreInitial:false,ignorePermissionErrors:false,interval:100,binaryInterval:300,followSymlinks:true,usePolling:false,atomic:true,...t,ignored:t.ignored?W(t.ignored):W([]),awaitWriteFinish:e===true?i:typeof e=="object"?{...i,...e}:false};st&&(s.usePolling=true),s.atomic===void 0&&(s.atomic=!s.usePolling);let n=process.env.CHOKIDAR_USEPOLLING;if(n!==void 0){let a=n.toLowerCase();a==="false"||a==="0"?s.usePolling=false:a==="true"||a==="1"?s.usePolling=true:s.usePolling=!!a;}let h=process.env.CHOKIDAR_INTERVAL;h&&(s.interval=Number.parseInt(h,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=S,this._readyEmitted=true,process.nextTick(()=>this.emit(m.READY)));},this._emitRaw=(...a)=>this.emit(m.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new F(this),Object.freeze(s);}_addIgnoredPath(t){if(Y(t)){for(let e of this._ignoredPaths)if(Y(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t);}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let e of this._ignoredPaths)Y(e)&&e.path===t&&this._ignoredPaths.delete(e);}add(t,e,i){let{cwd:s}=this.options;this.closed=false,this._closePromise=void 0;let n=nt(t);return s&&(n=n.map(h=>te(h,s))),n.forEach(h=>{this._removeIgnoredPath(h);}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=n.length,Promise.all(n.map(async h=>{let o=await this._nodeFsHandler._addToNodeFs(h,!i,void 0,0,e);return o&&this._emitReady(),o})).then(h=>{this.closed||h.forEach(o=>{o&&this.add(u.dirname(o),u.basename(e||o));});}),this}unwatch(t){if(this.closed)return this;let e=nt(t),{cwd:i}=this.options;return e.forEach(s=>{!u.isAbsolute(s)&&!this._closers.has(s)&&(i&&(s=u.join(i,s)),s=u.resolve(s)),this._closePath(s),this._addIgnoredPath(s),this._watched.has(s)&&this._addIgnoredPath({path:s,recursive:true}),this._userIgnored=void 0;}),this}close(){if(this._closePromise)return this._closePromise;this.closed=true,this.removeAllListeners();let t=[];return this._closers.forEach(e=>e.forEach(i=>{let s=i();s instanceof Promise&&t.push(s);})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=false,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((e,i)=>{let n=(this.options.cwd?u.relative(this.options.cwd,i):i)||ht;t[n]=e.getChildren().sort();}),t}emitWithAll(t,e){this.emit(t,...e),t!==m.ERROR&&this.emit(m.ALL,t,...e);}async _emit(t,e,i){if(this.closed)return;let s=this.options;H&&(e=u.normalize(e)),s.cwd&&(e=u.relative(s.cwd,e));let n=[e];i!=null&&n.push(i);let h=s.awaitWriteFinish,o;if(h&&(o=this._pendingWrites.get(e)))return o.lastChange=new Date,this;if(s.atomic){if(t===m.UNLINK)return this._pendingUnlinks.set(e,[t,...n]),setTimeout(()=>{this._pendingUnlinks.forEach((a,c)=>{this.emit(...a),this.emit(m.ALL,...a),this._pendingUnlinks.delete(c);});},typeof s.atomic=="number"?s.atomic:100),this;t===m.ADD&&this._pendingUnlinks.has(e)&&(t=m.CHANGE,this._pendingUnlinks.delete(e));}if(h&&(t===m.ADD||t===m.CHANGE)&&this._readyEmitted){let a$1=a((c,d)=>{c?(t=m.ERROR,n[0]=c,this.emitWithAll(t,n)):d&&(n.length>1?n[1]=d:n.push(d),this.emitWithAll(t,n));},"awfEmit");return this._awaitWriteFinish(e,h.stabilityThreshold,t,a$1),this}if(t===m.CHANGE&&!this._throttle(m.CHANGE,e,50))return this;if(s.alwaysStat&&i===void 0&&(t===m.ADD||t===m.ADD_DIR||t===m.CHANGE)){let a=s.cwd?u.join(s.cwd,e):e,c;try{c=await stat(a);}catch{}if(!c||this.closed)return;n.push(c);}return this.emitWithAll(t,n),this}_handleError(t){let e=t&&t.code;return t&&e!=="ENOENT"&&e!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||e!=="EPERM"&&e!=="EACCES")&&this.emit(m.ERROR,t),t||this.closed}_throttle(t,e,i){this._throttled.has(t)||this._throttled.set(t,new Map);let s=this._throttled.get(t);if(!s)throw new Error("invalid throttle");let n=s.get(e);if(n)return n.count++,false;let h,o=a(()=>{let c=s.get(e),d=c?c.count:0;return s.delete(e),clearTimeout(h),c&&clearTimeout(c.timeoutObject),d},"clear");h=setTimeout(o,i);let a$1={timeoutObject:h,clear:o,count:0};return s.set(e,a$1),a$1}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,s){let n=this.options.awaitWriteFinish;if(typeof n!="object")return;let h=n.pollInterval,o,a$1=t;this.options.cwd&&!u.isAbsolute(t)&&(a$1=u.join(this.options.cwd,t));let c=new Date,d=this._pendingWrites;function _(f){stat$1(a$1,(w,E)=>{if(w||!d.has(t)){w&&w.code!=="ENOENT"&&s(w);return}let P=Number(new Date);f&&E.size!==f.size&&(d.get(t).lastChange=P);let dt=d.get(t);P-dt.lastChange>=e?(d.delete(t),s(void 0,E)):o=setTimeout(_,h,E);});}a(_,"awaitWriteFinishFn"),d.has(t)||(d.set(t,{lastChange:c,cancelWait:a(()=>(d.delete(t),clearTimeout(o),i),"cancelWait")}),o=setTimeout(_,h));}_isIgnored(t,e){if(this.options.atomic&&qt.test(t))return true;if(!this._userIgnored){let{cwd:i}=this.options,n=(this.options.ignored||[]).map(at(i)),o=[...[...this._ignoredPaths].map(at(i)),...n];this._userIgnored=Zt(o,void 0);}return this._userIgnored(t,e)}_isntIgnored(t,e){return !this._isIgnored(t,e)}_getWatchHelpers(t){return new G(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=u.resolve(t);return this._watched.has(e)||this._watched.set(e,new U(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?true:!!(Number(t.mode)&256)}_remove(t,e,i){let s=u.join(t,e),n=u.resolve(s);if(i=i??(this._watched.has(s)||this._watched.has(n)),!this._throttle("remove",s,100))return;!i&&this._watched.size===1&&this.add(t,e,true),this._getWatchedDir(s).getChildren().forEach(f=>this._remove(s,f));let a=this._getWatchedDir(t),c=a.has(e);a.remove(e),this._symlinkPaths.has(n)&&this._symlinkPaths.delete(n);let d=s;if(this.options.cwd&&(d=u.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===m.ADD)return;this._watched.delete(s),this._watched.delete(n);let _=i?m.UNLINK_DIR:m.UNLINK;c&&!this._isIgnored(s)&&this._emit(_,s),this._closePath(s);}_closePath(t){this._closeFile(t);let e=u.dirname(t);this._getWatchedDir(e).remove(u.basename(t));}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(i=>i()),this._closers.delete(t));}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e);}_readdirp(t,e){if(this.closed)return;let i={type:m.ALL,alwaysStat:true,lstat:true,...e,depth:0},s=Q(t,i);return this._streams.add(s),s.once(et,()=>{s=void 0;}),s.once(z,()=>{s&&(this._streams.delete(s),s=void 0);}),s}};function re(r,t={}){let e=new N(t);return e.add(r),e}a(re,"watch");var be={watch:re,FSWatcher:N};
|
|
4
|
-
export{N as FSWatcher,G as WatchHelper,be as default,re as watch};
|
package/dist/chunk-3SXN6MQL.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {G}from'./chunk-BH2WXCLS.mjs';import {d}from'./chunk-SPHWZS5P.mjs';import {a}from'./chunk-L7O2RSTN.mjs';import {readFile}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function l(o){try{let i=await readFile(join(o,"package.json"),"utf-8"),t=JSON.parse(i).knarr;if(!t||typeof t!="object")return {};let r={},n=t;return typeof n.buildCmd=="string"&&(r.buildCmd=n.buildCmd),Array.isArray(n.watchPatterns)&&(r.watchPatterns=n.watchPatterns.filter(u=>typeof u=="string")),typeof n.debounce=="number"&&Number.isFinite(n.debounce)&&(r.debounce=n.debounce),typeof n.cooldown=="number"&&Number.isFinite(n.cooldown)&&(r.cooldown=n.cooldown),typeof n.historyLimit=="number"&&Number.isFinite(n.historyLimit)&&(r.historyLimit=Math.max(0,Math.floor(n.historyLimit))),typeof n.notify=="boolean"&&(r.notify=n.notify),d(`[config] Loaded knarr config from package.json: ${JSON.stringify(r)}`),r}catch{return {}}}a(l,"loadKnarrConfig");async function g(o,i){if(!i)return false;let e=await readFile(o,"utf-8"),t=JSON.parse(e),r=t.knarr;if(r&&typeof r=="object"&&typeof r.buildCmd=="string")return false;t.knarr=r&&typeof r=="object"?r:{},t.knarr.buildCmd=i;let n=e.match(/^(\s+)"/m)?.[1]||" ";return await G(o,JSON.stringify(t,null,n)+`
|
|
4
|
-
`),true}a(g,"setKnarrBuildCmdIfMissing");export{l as a,g as b};
|
package/dist/chunk-7GCKCCHU.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-G7HFTV5Y.mjs';import {F,t}from'./chunk-BH2WXCLS.mjs';import {c,a as a$1}from'./chunk-L7O2RSTN.mjs';import {readFile,readdir}from'fs/promises';import {join,dirname,relative,resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var w=c(a(),1);async function v(n){let t=n;for(;;){if(await F(join(t,"pnpm-workspace.yaml")))return t;let e=dirname(t);if(e===t)return null;t=e;}}a$1(v,"findWorkspaceRoot");async function K(n){return await v(n)??await b(n)}a$1(K,"findWorkspacePackageRoot");async function T(n){let t={default:{},named:{}},e=join(n,"pnpm-workspace.yaml"),a;try{a=await readFile(e,"utf-8");}catch{return t}let i=a.split(/\r?\n/),s="top",r="";for(let o of i){if(o.trim()===""||o.trim().startsWith("#"))continue;let l=o.length-o.trimStart().length;if(l===0){if(o.startsWith("catalog:")){s="default-catalog";continue}if(o.startsWith("catalogs:")){s="named-catalogs";continue}s="top";continue}if(s==="default-catalog"&&l>=2){let c=S(o);c&&(t.default[c[0]]=c[1]);continue}if(s==="named-catalogs"&&l>=2&&l<4){let c=o.trim();c.endsWith(":")&&(r=c.slice(0,-1),t.named[r]={},s="named-catalog-entries");continue}if(s==="named-catalog-entries"&&l>=4){let c=S(o);c&&r&&(t.named[r][c[0]]=c[1]);continue}if(s==="named-catalog-entries"&&l>=2&&l<4){let c=o.trim();c.endsWith(":")?(r=c.slice(0,-1),t.named[r]={}):s="named-catalogs";continue}}return t}a$1(T,"parseCatalogs");async function N(n){let t=await v(n);if(t){let a=await O(t),i=a.filter(r=>!r.startsWith("!")),s=a.filter(r=>r.startsWith("!")).map(r=>r.slice(1));if(i.length>0)return W(t,i,s)}let e=t??await b(n);if(!e)return [];try{let a=JSON.parse(await readFile(join(e,"package.json"),"utf-8")),i=Array.isArray(a.workspaces)?a.workspaces:a.workspaces?.packages??[];if(i.length===0)return [];let s=i.filter(o=>!o.startsWith("!")),r=i.filter(o=>o.startsWith("!")).map(o=>o.slice(1));return W(e,s,r)}catch{return []}}a$1(N,"findWorkspacePackages");async function O(n){let t=join(n,"pnpm-workspace.yaml"),e;try{e=await readFile(t,"utf-8");}catch{return []}let a=[],i=false;for(let s of e.split(/\r?\n/)){let r=s.trim();if(r===""||r.startsWith("#"))continue;let o=s.length-s.trimStart().length;if(o===0){i=r==="packages:";continue}if(i&&o>=2){let l=r.match(/^-\s+["']?([^"']+)["']?$/);l&&a.push(l[1]);}}return a}a$1(O,"parsePnpmWorkspacePackages");async function b(n){let t=n;for(;;){try{if(JSON.parse(await readFile(join(t,"package.json"),"utf-8")).workspaces)return t}catch{}let e=dirname(t);if(e===t)return null;t=e;}}a$1(b,"findPackageJsonWorkspaceRoot");async function W(n,t$1,e=[]){let a=[];for(let r of t$1)if(r.includes("*")){let o=r.split("/"),l=n,c=[],y=false;for(let g of o)y||g.includes("*")?(y=true,c.push(g)):l=join(l,g);if(c.length===1&&c[0]==="*")try{let g=await readdir(l,{withFileTypes:!0});for(let k of g)if(k.isDirectory()){let u=join(l,k.name);await F(join(u,"package.json"))&&a.push(u);}}catch{}else {let g=(0, w.default)(r),k=await G(n,8);for(let u of k){let M=t(relative(n,u));g(M)&&await F(join(u,"package.json"))&&a.push(u);}}}else {let o=resolve(n,r);await F(join(o,"package.json"))&&a.push(o);}let i=[...new Set(a)];if(e.length===0)return i;let s=(0, w.default)(e);return i.filter(r=>{let o=t(relative(n,r));return !s(o)})}a$1(W,"resolveWorkspaceGlobs");async function G(n,t){if(t<=0)return [];let e=[];try{let a=await readdir(n,{withFileTypes:!0});for(let i of a){if(!i.isDirectory()||i.name==="node_modules"||i.name===".git")continue;let s=join(n,i.name);e.push(s),e.push(...await G(s,t-1));}}catch{}return e}a$1(G,"collectDirs");async function z(n){let t=await N(n),e=[];for(let s of t)try{let r=JSON.parse(await readFile(join(s,"package.json"),"utf-8"));r.name&&r.version&&e.push({name:r.name,version:r.version,dir:s,pkg:r});}catch{}let a=new Set(e.map(s=>s.name)),i=new Map;for(let s of e){let r=new Set;for(let o of ["dependencies","devDependencies"]){let l=s.pkg[o];if(l)for(let c of Object.keys(l))a.has(c)&&r.add(c);}i.set(s.name,r);}return {packages:e,adjacency:i}}a$1(z,"buildWorkspaceGraph");function E(n){let t=n.packages.filter(i=>!i.pkg.private),e=new Set(t.map(i=>i.name)),a=new Map;for(let i of t){let s=n.adjacency.get(i.name)??new Set;a.set(i.name,new Set([...s].filter(r=>e.has(r))));}return {packages:t,adjacency:a}}a$1(E,"filterPublishableWorkspaceGraph");function V(n){let t=new Map;for(let e of n.keys())t.set(e,new Set);for(let[e,a]of n)for(let i of a){let s=t.get(i);s||(s=new Set,t.set(i,s)),s.add(e);}return t}a$1(V,"buildReverseAdjacency");function S(n){let t=n.trim(),e=t.indexOf(":");if(e<=0)return null;let a=t.slice(0,e).trim(),i=q(t.slice(e+1)).trim();if(!a||!i)return null;let s=a.replace(/^["']|["']$/g,""),r=i.replace(/^["']|["']$/g,"");return [s,r]}a$1(S,"parseKeyValue");function q(n){let t=null;for(let e=0;e<n.length;e++){let a=n[e];if((a==='"'||a==="'")&&n[e-1]!=="\\"){t=t===a?null:t??a;continue}if(!t&&a==="#"&&(e===0||/\s/.test(n[e-1])))return n.slice(0,e)}return n}a$1(q,"stripYamlInlineComment");export{v as a,K as b,T as c,N as d,z as e,E as f,V as g};
|
package/dist/chunk-7ROQJISX.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$4}from'./chunk-COI7GWH3.mjs';import {b as b$2,c}from'./chunk-QHNHLR6T.mjs';import {b as b$3,a as a$5,e}from'./chunk-ABG6UD3X.mjs';import {a as a$2}from'./chunk-XDWZZBCM.mjs';import {b as b$6}from'./chunk-WBTSRLB6.mjs';import {b as b$5,a as a$9,c as c$2,d as d$3}from'./chunk-UCSYKFEZ.mjs';import {g as g$1}from'./chunk-N3B2JO4H.mjs';import {a as a$8}from'./chunk-WN3DOKIM.mjs';import {a as a$a}from'./chunk-MN4DV2NO.mjs';import {a as a$1}from'./chunk-HVN6HBWZ.mjs';import {a as a$3,g,h}from'./chunk-FSVETLZK.mjs';import {a as a$6}from'./chunk-U6O35NZ7.mjs';import {f,d,h as h$1}from'./chunk-QFHYSC3K.mjs';import {b,F,r,f as f$1,a as a$7}from'./chunk-BH2WXCLS.mjs';import {d as d$1,a as a$b}from'./chunk-E3HZCU3S.mjs';import {b as b$4,c as c$1,d as d$2}from'./chunk-SPHWZS5P.mjs';import {b as b$1}from'./chunk-OQDZJP55.mjs';import {a}from'./chunk-L7O2RSTN.mjs';import {spawn}from'child_process';import {resolve,join,basename}from'path';import {platform}from'os';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function Te(i){let a=i.timer??new a$1,e=resolve("."),{name:n,version:r$1}=de(i.packageArg),s,l=null,o=false,c$1=false;if(ae(n,i.packageArg),r$1)try{b(r$1);}catch{a$2(`Invalid package version "${r$1}" in "${i.packageArg}".`),process.exit(1);}let u=await a$3(e);if((await g(e)||u==="yarn"&&await h(e))&&(b$1.error(`Yarn PnP mode is not compatible with knarr.
|
|
4
|
-
|
|
5
|
-
knarr works by copying files into node_modules/, but PnP eliminates
|
|
6
|
-
node_modules/ entirely. To use knarr with Yarn Berry, add one of these
|
|
7
|
-
to .yarnrc.yml:
|
|
8
|
-
|
|
9
|
-
nodeLinker: node-modules
|
|
10
|
-
nodeLinker: pnpm
|
|
11
|
-
|
|
12
|
-
Then run: yarn install`),process.exit(1)),i.from){let b=resolve(i.from);s=b;let x=await ce(b,{build:i.build,skipBuild:i.skipBuild,yes:i.yes??false});l=x.buildCmd,o=x.ran,c$1=x.skipped,b$1.info(`Publishing from ${b}...`),await a$4(b);}let d$2=r$1?await b$2(n,r$1):await c(n);if(!d$2){let b=r$1?`@${r$1}`:"";a$2(`Package "${n}${b}" not found in store. Run 'knarr publish' in the package directory first, or use --from <path>.`),process.exit(1);}!await F(r(e))&&(await g$1(e,u),b$1.success("Auto-initialized knarr (consumer mode)")),b$1.info(`Detected package manager: ${u}`);let k=await f(e,n);k&&(k.version===d$2.version?b$1.info(`Updating ${n}@${d$2.version} (already linked)`):b$1.info(`Updating ${n}: ${k.version} -> ${d$2.version}`));let M=k?k.backupExists:await b$3(e,n,u);!k&&M&&b$1.info(`Backed up existing ${n} installation`),await f$1(e,n,d$2.version),await me(e,n,u),await ue(d$2,e,u,i.yes??false);let g$2=await a$5(d$2,e,u);b$1.success(`Linked ${n}@${d$2.version} -> node_modules/${n} (${g$2.copied} files copied, ${g$2.skipped} unchanged)`),g$2.binLinks>0&&b$1.info(`Created ${g$2.binLinks} bin link(s)`);let te={version:d$2.version,contentHash:d$2.meta.contentHash,linkedAt:new Date().toISOString(),sourcePath:d$2.meta.sourcePath,backupExists:M,packageManager:u,buildId:d$2.meta.buildId??""};await d(e,n,te),await h$1(n,e);let h$2=s?[`cd ${s} && knarr dev`]:[];h$2.length>0&&b$1.info(`Next: ${h$2[0]}`),b$1.info(`Done in ${a.elapsed()}`);let j={package:n,version:d$2.version,copied:g$2.copied,skipped:g$2.skipped,binLinks:g$2.binLinks,elapsed:a.elapsedMs(),buildCmd:l,buildRan:o,buildSkipped:c$1,nextSteps:h$2};return i.emitOutput!==false&&a$6(j),b$4()&&d$1(),j}a(Te,"addPackageToConsumer");async function We(i){let a=resolve(i);await F(a)||(a$2(`Source path not found: ${a}`),process.exit(1));let e=join(a,"package.json");await F(e)||(a$2(`No package.json found at ${e}. Pass a package directory to 'knarr use'.`),process.exit(1));let n;try{n=JSON.parse(await readFile(e,"utf-8"));}catch(s){a$2(`Could not read package.json at ${e}: ${s instanceof Error?s.message:String(s)}`),process.exit(1);}(!n||typeof n!="object"||typeof n.name!="string")&&(a$2(`package.json at ${e} must include a package name for 'knarr use'.`),process.exit(1));let r=n.name.trim();return ae(r,r),r}a(We,"readPackageNameFromSource");function de(i){if(i.startsWith("@")){let e=i.indexOf("/");if(e>0){let n=i.indexOf("@",e);if(n>e)return {name:i.slice(0,n),version:i.slice(n+1)}}return {name:i,version:null}}let a=i.lastIndexOf("@");return a>0?{name:i.slice(0,a),version:i.slice(a+1)}:{name:i,version:null}}a(de,"parsePackageArg");function ae(i,a){try{a$7(i);}catch{a$2(`Invalid package name "${a}". Use format: package-name or @scope/package-name.`),process.exit(1);}}a(ae,"validatePackageNameArg");async function ce(i,a){if(a.skipBuild)return a.build&&b$1.warn("--skip-build was provided; ignoring --build"),{buildCmd:null,ran:false,skipped:true};let e=a.build,n=!!e;if(!e){let s=await a$3(i);e=await a$8(i,s)??void 0;}if(!e)return {buildCmd:null,ran:false,skipped:false};if(!n&&!a.yes&&!c$1()){let s=await b$1.prompt(`Run detected build command before publishing? (${e})`,{type:"confirm",initial:true});if(!s||typeof s=="symbol")return b$1.info("Skipping build before publish"),{buildCmd:e,ran:false,skipped:true}}else if(!n&&c$1()&&!a.yes)return d$2(`[add] Detected build command but skipping in json mode: ${e}`),{buildCmd:e,ran:false,skipped:true};return b$1.info(b$4()?`[dry-run] Would run build command: ${e}`:`Running build command: ${e}`),await fe(e,i)||(a$2(`Build command failed: ${e}`),process.exit(1)),{buildCmd:e,ran:true,skipped:false}}a(ce,"maybeBuildSource");async function ue(i,a,e$1,n){let r=await e(i,a,e$1);if(r.length===0)return;if(c$1()){d$2(`[add] Missing transitive deps (json mode): ${r.join(", ")}`);return}if(n){let l=b$5(e$1,r),o=a$9(l);b$1.info(b$4()?`[dry-run] Would install missing dependencies: ${r.join(", ")}`:`Installing missing dependencies: ${r.join(", ")}`);let c=await A(l,a);c&&!b$4()?b$1.success("Installed missing dependencies"):c||b$1.warn(`Install failed. Run manually: ${o}`);return}if(await b$1.prompt(`Install ${r.length} missing dependencies? (${r.join(", ")})`,{type:"confirm",initial:true})){let l=b$5(e$1,r),o=a$9(l),c=await A(l,a);c&&!b$4()?b$1.success("Installed missing dependencies"):c||b$1.warn(`Install failed. Run manually: ${o}`);}else b$1.warn(`Missing transitive dependencies: ${r.join(", ")}
|
|
13
|
-
Run: ${a$9(b$5(e$1,r))}`);}a(ue,"handleMissingDeps");async function me(i,a,e){let n=await a$a(i);if(n.type==="next"&&n.configFile){let o=await b$6(n.configFile,a);o.modified?b$1.success(`Added ${a} to transpilePackages in ${basename(n.configFile)}`):o.error&&b$1.info(`Add to next.config manually: transpilePackages: ['${a}']`);}else if(n.type==="vite"&&n.configFile){let{addKnarrVitePlugin:o}=await import('./vite-config-XOGAKYGQ.mjs'),c=await o(n.configFile);if(c.modified){b$1.success(`Added knarr plugin to ${basename(n.configFile)}`);let u=c$2(e,"knarr"),d=a$9(u);b$1.info(b$4()?"[dry-run] Would install knarr as devDependency":"Installing knarr as devDependency...");let v=await A(u,i);v&&!b$4()?b$1.success("Installed knarr"):v||b$1.warn(`Install failed. Run manually: ${d}`);}else c.error&&b$1.info(`Add manually:
|
|
14
|
-
import knarr from "knarr/vite"
|
|
15
|
-
plugins: [knarr()]`);}let{findTailwindCss:r,addTailwindSource:s}=await import('./tailwind-source-HCTY2XDU.mjs'),l=await r(i);if(l){let o=await s(l,a,i);o.modified?b$1.success(`Added @source for ${a} to ${basename(l)}`):o.error&&b$1.info(`Add to your CSS manually: @source "../node_modules/${a}";`);}}a(me,"configureBundler");function A(i,a){return d$3(i,a)}a(A,"runInstallCommand");function fe(i,a){return b$4()?(a$b({type:"command-skip",path:a,detail:i}),Promise.resolve(true)):new Promise(e=>{let n=platform()==="win32",l=spawn(n?"cmd":"sh",[n?"/c":"-c",i],{cwd:a,stdio:"inherit"});l.on("close",o=>e(o===0)),l.on("error",()=>e(false));})}a(fe,"runShellCommand");export{Te as a,We as b};
|