@olegkuibar/plunk 0.2.0-canary.04ff96f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/add-5ZRFUL6Z.mjs +258 -0
- package/dist/chokidar-XGAEDN45.mjs +1746 -0
- package/dist/chunk-34UXZ622.mjs +98 -0
- package/dist/chunk-4O2QOKVO.mjs +1958 -0
- package/dist/chunk-CSMZ6DZA.mjs +367 -0
- package/dist/chunk-CZM4TNAI.mjs +292 -0
- package/dist/chunk-EDUXIQ5W.mjs +1729 -0
- package/dist/chunk-GAAB2TLH.mjs +160 -0
- package/dist/chunk-HKNM3UWU.mjs +496 -0
- package/dist/chunk-I6SN7BBN.mjs +1131 -0
- package/dist/chunk-KYDBD2KQ.mjs +39 -0
- package/dist/chunk-LKQINKH4.mjs +130 -0
- package/dist/chunk-PUSXMPOF.mjs +82 -0
- package/dist/chunk-S4HJSJ32.mjs +69 -0
- package/dist/chunk-W3C72UKC.mjs +113 -0
- package/dist/chunk-WSECI6M7.mjs +85 -0
- package/dist/chunk-XMIZ7OUZ.mjs +26 -0
- package/dist/chunk-XZK5T4GK.mjs +23 -0
- package/dist/chunk-ZOYNYK5Y.mjs +23 -0
- package/dist/chunk-ZQCGJUBJ.mjs +92 -0
- package/dist/clean-LTR5MZTY.mjs +84 -0
- package/dist/cli.mjs +57 -0
- package/dist/dev-LFXQP6SA.mjs +194 -0
- package/dist/dist-DUFCZSIL.mjs +813 -0
- package/dist/doctor-R7ZVR7PY.mjs +230 -0
- package/dist/hash-worker.mjs +65 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.mjs +9486 -0
- package/dist/init-SWCNRISY.mjs +310 -0
- package/dist/list-B77L2F34.mjs +119 -0
- package/dist/migrate-X5TIC5SS.mjs +124 -0
- package/dist/prompt-HTPH6HQ7.mjs +756 -0
- package/dist/publish-UXCLPNM6.mjs +63 -0
- package/dist/push-JI6HGCFG.mjs +197 -0
- package/dist/remove-DCR7KKD5.mjs +149 -0
- package/dist/restore-SUN3WGSW.mjs +124 -0
- package/dist/status-MESRBH54.mjs +103 -0
- package/dist/tailwind-source-JBBEIXIJ.mjs +89 -0
- package/dist/update-SKDSA673.mjs +100 -0
- package/dist/vite-config-BAK67JHB.mjs +128 -0
- package/dist/vite-plugin.d.ts +5 -0
- package/dist/vite-plugin.mjs +42 -0
- package/dist/workspace-76HJPAK2.mjs +97 -0
- package/package.json +96 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
detectBundler,
|
|
5
|
+
detectPackageManager,
|
|
6
|
+
detectYarnNodeLinker,
|
|
7
|
+
hasYarnrcYml
|
|
8
|
+
} from "./chunk-34UXZ622.mjs";
|
|
9
|
+
import {
|
|
10
|
+
readConsumerState,
|
|
11
|
+
readConsumersRegistry
|
|
12
|
+
} from "./chunk-GAAB2TLH.mjs";
|
|
13
|
+
import {
|
|
14
|
+
getStoreEntry,
|
|
15
|
+
listStoreEntries
|
|
16
|
+
} from "./chunk-W3C72UKC.mjs";
|
|
17
|
+
import {
|
|
18
|
+
require_picocolors
|
|
19
|
+
} from "./chunk-PUSXMPOF.mjs";
|
|
20
|
+
import {
|
|
21
|
+
getConsumersPath,
|
|
22
|
+
getStorePath
|
|
23
|
+
} from "./chunk-EDUXIQ5W.mjs";
|
|
24
|
+
import {
|
|
25
|
+
output,
|
|
26
|
+
suppressHumanOutput
|
|
27
|
+
} from "./chunk-ZOYNYK5Y.mjs";
|
|
28
|
+
import {
|
|
29
|
+
defineCommand
|
|
30
|
+
} from "./chunk-CSMZ6DZA.mjs";
|
|
31
|
+
import {
|
|
32
|
+
exists
|
|
33
|
+
} from "./chunk-HKNM3UWU.mjs";
|
|
34
|
+
import {
|
|
35
|
+
consola
|
|
36
|
+
} from "./chunk-I6SN7BBN.mjs";
|
|
37
|
+
import {
|
|
38
|
+
__toESM
|
|
39
|
+
} from "./chunk-KYDBD2KQ.mjs";
|
|
40
|
+
|
|
41
|
+
// src/commands/doctor.ts
|
|
42
|
+
import { resolve, join } from "path";
|
|
43
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
44
|
+
var doctor_default = defineCommand({
|
|
45
|
+
meta: {
|
|
46
|
+
name: "doctor",
|
|
47
|
+
description: "Run diagnostic checks on your plunk setup"
|
|
48
|
+
},
|
|
49
|
+
async run() {
|
|
50
|
+
suppressHumanOutput();
|
|
51
|
+
const consumerPath = resolve(".");
|
|
52
|
+
const results = [];
|
|
53
|
+
consola.info("Running plunk diagnostics...\n");
|
|
54
|
+
const storePath = getStorePath();
|
|
55
|
+
if (await exists(storePath)) {
|
|
56
|
+
const entries = await listStoreEntries();
|
|
57
|
+
results.push({
|
|
58
|
+
name: "Store directory",
|
|
59
|
+
status: "pass",
|
|
60
|
+
message: `${entries.length} entries in ${storePath}`
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
results.push({
|
|
64
|
+
name: "Store directory",
|
|
65
|
+
status: "warn",
|
|
66
|
+
message: `Store not found at ${storePath}. Run 'plunk publish' to create it.`
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const consumersPath = getConsumersPath();
|
|
70
|
+
if (await exists(consumersPath)) {
|
|
71
|
+
const registry = await readConsumersRegistry();
|
|
72
|
+
const total = Object.values(registry).flat().length;
|
|
73
|
+
results.push({
|
|
74
|
+
name: "Global registry",
|
|
75
|
+
status: "pass",
|
|
76
|
+
message: `${Object.keys(registry).length} packages, ${total} consumer registrations`
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
results.push({
|
|
80
|
+
name: "Global registry",
|
|
81
|
+
status: "warn",
|
|
82
|
+
message: "No consumers registered yet. Use 'plunk add' to link packages."
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const state = await readConsumerState(consumerPath);
|
|
86
|
+
const links = Object.entries(state.links);
|
|
87
|
+
if (links.length > 0) {
|
|
88
|
+
results.push({
|
|
89
|
+
name: "Consumer state",
|
|
90
|
+
status: "pass",
|
|
91
|
+
message: `${links.length} linked package(s)`
|
|
92
|
+
});
|
|
93
|
+
for (const [name, link] of links) {
|
|
94
|
+
const entry = await getStoreEntry(name, link.version);
|
|
95
|
+
if (!entry) {
|
|
96
|
+
results.push({
|
|
97
|
+
name: `Store: ${name}`,
|
|
98
|
+
status: "fail",
|
|
99
|
+
message: `Store entry missing for ${name}@${link.version}. Re-publish it.`
|
|
100
|
+
});
|
|
101
|
+
} else if (entry.meta.contentHash !== link.contentHash) {
|
|
102
|
+
results.push({
|
|
103
|
+
name: `Store: ${name}`,
|
|
104
|
+
status: "warn",
|
|
105
|
+
message: `Store has newer content. Run 'plunk update' to sync.`
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
results.push({
|
|
109
|
+
name: `Store: ${name}`,
|
|
110
|
+
status: "pass",
|
|
111
|
+
message: `${name}@${link.version} in sync`
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const nmPath = join(consumerPath, "node_modules", name);
|
|
115
|
+
if (!await exists(nmPath)) {
|
|
116
|
+
results.push({
|
|
117
|
+
name: `node_modules: ${name}`,
|
|
118
|
+
status: "fail",
|
|
119
|
+
message: `Missing from node_modules. Run 'plunk restore'.`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
results.push({
|
|
125
|
+
name: "Consumer state",
|
|
126
|
+
status: "warn",
|
|
127
|
+
message: "No packages linked. Use 'plunk add' to link a package."
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const pm = await detectPackageManager(consumerPath);
|
|
131
|
+
results.push({
|
|
132
|
+
name: "Package manager",
|
|
133
|
+
status: "pass",
|
|
134
|
+
message: pm
|
|
135
|
+
});
|
|
136
|
+
if (pm === "yarn") {
|
|
137
|
+
const linker = await detectYarnNodeLinker(consumerPath);
|
|
138
|
+
const yarnrcExists = await hasYarnrcYml(consumerPath);
|
|
139
|
+
if (!yarnrcExists) {
|
|
140
|
+
results.push({
|
|
141
|
+
name: "Yarn linker",
|
|
142
|
+
status: "pass",
|
|
143
|
+
message: "Yarn Classic, node_modules mode"
|
|
144
|
+
});
|
|
145
|
+
} else if (linker === "node-modules") {
|
|
146
|
+
results.push({
|
|
147
|
+
name: "Yarn linker",
|
|
148
|
+
status: "pass",
|
|
149
|
+
message: "Yarn Berry with node-modules linker"
|
|
150
|
+
});
|
|
151
|
+
} else if (linker === "pnpm") {
|
|
152
|
+
results.push({
|
|
153
|
+
name: "Yarn linker",
|
|
154
|
+
status: "pass",
|
|
155
|
+
message: "Yarn pnpm linker mode (plunk handles this)"
|
|
156
|
+
});
|
|
157
|
+
} else if (linker === "pnp") {
|
|
158
|
+
results.push({
|
|
159
|
+
name: "Yarn linker",
|
|
160
|
+
status: "fail",
|
|
161
|
+
message: "Yarn PnP is not compatible. Set `nodeLinker: node-modules` in .yarnrc.yml"
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
results.push({
|
|
165
|
+
name: "Yarn linker",
|
|
166
|
+
status: "warn",
|
|
167
|
+
message: "Yarn Berry defaults to PnP. Add `nodeLinker: node-modules` to .yarnrc.yml"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const bundler = await detectBundler(consumerPath);
|
|
172
|
+
if (bundler.type) {
|
|
173
|
+
results.push({
|
|
174
|
+
name: "Bundler",
|
|
175
|
+
status: "pass",
|
|
176
|
+
message: `${bundler.type}${bundler.configFile ? ` (${bundler.configFile})` : ""}`
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
results.push({
|
|
180
|
+
name: "Bundler",
|
|
181
|
+
status: "warn",
|
|
182
|
+
message: "No bundler config detected"
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const gitignorePath = join(consumerPath, ".gitignore");
|
|
186
|
+
if (await exists(gitignorePath)) {
|
|
187
|
+
const { readFile } = await import("fs/promises");
|
|
188
|
+
const content = await readFile(gitignorePath, "utf-8");
|
|
189
|
+
if (content.includes(".plunk")) {
|
|
190
|
+
results.push({
|
|
191
|
+
name: ".gitignore",
|
|
192
|
+
status: "pass",
|
|
193
|
+
message: ".plunk/ is ignored"
|
|
194
|
+
});
|
|
195
|
+
} else {
|
|
196
|
+
results.push({
|
|
197
|
+
name: ".gitignore",
|
|
198
|
+
status: "warn",
|
|
199
|
+
message: ".plunk/ not in .gitignore. Run 'plunk init' to fix."
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const icons = {
|
|
204
|
+
pass: import_picocolors.default.green("PASS"),
|
|
205
|
+
fail: import_picocolors.default.red("FAIL"),
|
|
206
|
+
warn: import_picocolors.default.yellow("WARN")
|
|
207
|
+
};
|
|
208
|
+
for (const r of results) {
|
|
209
|
+
console.log(` ${icons[r.status]} ${r.name}: ${import_picocolors.default.dim(r.message)}`);
|
|
210
|
+
}
|
|
211
|
+
const failCount = results.filter((r) => r.status === "fail").length;
|
|
212
|
+
const warnCount = results.filter((r) => r.status === "warn").length;
|
|
213
|
+
console.log("");
|
|
214
|
+
if (failCount > 0) {
|
|
215
|
+
consola.error(`${failCount} issue(s) found that need attention`);
|
|
216
|
+
} else if (warnCount > 0) {
|
|
217
|
+
consola.warn(`${warnCount} warning(s), but no critical issues`);
|
|
218
|
+
} else {
|
|
219
|
+
consola.success("All checks passed!");
|
|
220
|
+
}
|
|
221
|
+
output({
|
|
222
|
+
results: results.map(({ name, status, message }) => ({ name, status, message })),
|
|
223
|
+
failures: failCount,
|
|
224
|
+
warnings: warnCount
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
export {
|
|
229
|
+
doctor_default as default
|
|
230
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/utils/hash-worker.ts
|
|
4
|
+
import { readFile } from "fs/promises";
|
|
5
|
+
import { createHash } from "crypto";
|
|
6
|
+
import { createReadStream } from "fs";
|
|
7
|
+
|
|
8
|
+
// node_modules/.pnpm/xxhash-wasm@1.1.0/node_modules/xxhash-wasm/esm/xxhash-wasm.js
|
|
9
|
+
var 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]);
|
|
10
|
+
async function e() {
|
|
11
|
+
return (function(t2) {
|
|
12
|
+
const { exports: { mem: e2, xxh32: n, xxh64: r, init32: i, update32: a, digest32: o, init64: s, update64: u, digest64: c } } = t2;
|
|
13
|
+
let h = new Uint8Array(e2.buffer);
|
|
14
|
+
function g(t3, n2) {
|
|
15
|
+
if (e2.buffer.byteLength < t3 + n2) {
|
|
16
|
+
const r2 = Math.ceil((t3 + n2 - e2.buffer.byteLength) / 65536);
|
|
17
|
+
e2.grow(r2), h = new Uint8Array(e2.buffer);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function f(t3, e3, n2, r2, i2, a2) {
|
|
21
|
+
g(t3);
|
|
22
|
+
const o2 = new Uint8Array(t3);
|
|
23
|
+
return h.set(o2), n2(0, e3), o2.set(h.subarray(0, t3)), { update(e4) {
|
|
24
|
+
let n3;
|
|
25
|
+
return h.set(o2), "string" == typeof e4 ? (g(3 * e4.length, t3), n3 = w.encodeInto(e4, h.subarray(t3)).written) : (g(e4.byteLength, t3), h.set(e4, t3), n3 = e4.byteLength), r2(0, t3, n3), o2.set(h.subarray(0, t3)), this;
|
|
26
|
+
}, digest: () => (h.set(o2), a2(i2(0))) };
|
|
27
|
+
}
|
|
28
|
+
function y(t3) {
|
|
29
|
+
return t3 >>> 0;
|
|
30
|
+
}
|
|
31
|
+
const b = 2n ** 64n - 1n;
|
|
32
|
+
function d(t3) {
|
|
33
|
+
return t3 & b;
|
|
34
|
+
}
|
|
35
|
+
const w = new TextEncoder(), l = 0, p = 0n;
|
|
36
|
+
function x(t3, e3 = l) {
|
|
37
|
+
return g(3 * t3.length, 0), y(n(0, w.encodeInto(t3, h).written, e3));
|
|
38
|
+
}
|
|
39
|
+
function L(t3, e3 = p) {
|
|
40
|
+
return g(3 * t3.length, 0), d(r(0, w.encodeInto(t3, h).written, e3));
|
|
41
|
+
}
|
|
42
|
+
return { h32: x, h32ToString: (t3, e3 = l) => x(t3, e3).toString(16).padStart(8, "0"), h32Raw: (t3, e3 = l) => (g(t3.byteLength, 0), h.set(t3), y(n(0, t3.byteLength, e3))), create32: (t3 = l) => f(48, t3, i, a, o, y), h64: L, h64ToString: (t3, e3 = p) => L(t3, e3).toString(16).padStart(16, "0"), h64Raw: (t3, e3 = p) => (g(t3.byteLength, 0), h.set(t3), d(r(0, t3.byteLength, e3))), create64: (t3 = p) => f(88, t3, s, u, c, d) };
|
|
43
|
+
})((await WebAssembly.instantiate(t)).instance);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/utils/hash-worker.ts
|
|
47
|
+
var STREAM_THRESHOLD = 1024 * 1024;
|
|
48
|
+
var xxhReady = e();
|
|
49
|
+
async function hashFileWorker(filePath, size) {
|
|
50
|
+
if (size > STREAM_THRESHOLD) {
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
const hash = createHash("sha256");
|
|
53
|
+
const stream = createReadStream(filePath);
|
|
54
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
55
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
56
|
+
stream.on("error", reject);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const { h64Raw } = await xxhReady;
|
|
60
|
+
const content = await readFile(filePath);
|
|
61
|
+
return h64Raw(content).toString(16);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
hashFileWorker as default
|
|
65
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
interface PublishOptions {
|
|
2
|
+
allowPrivate?: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface PublishResult {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
fileCount: number;
|
|
8
|
+
/** True if content was unchanged and publish was skipped */
|
|
9
|
+
skipped: boolean;
|
|
10
|
+
contentHash: string;
|
|
11
|
+
/** 8-char hex identifier generated on each successful publish */
|
|
12
|
+
buildId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Publish a package from a directory to the plunk store.
|
|
16
|
+
*
|
|
17
|
+
* 1. Read package.json, validate name and version
|
|
18
|
+
* 2. Resolve publishable files
|
|
19
|
+
* 3. Compute content hash
|
|
20
|
+
* 4. Skip if hash matches existing store entry
|
|
21
|
+
* 5. Copy files to temp dir, then atomic rename to store
|
|
22
|
+
* 6. Write .plunk-meta.json
|
|
23
|
+
*/
|
|
24
|
+
declare function publish(packageDir: string, options?: PublishOptions): Promise<PublishResult>;
|
|
25
|
+
|
|
26
|
+
/** Metadata stored alongside each package in the plunk store */
|
|
27
|
+
interface PlunkMeta {
|
|
28
|
+
contentHash: string;
|
|
29
|
+
publishedAt: string;
|
|
30
|
+
sourcePath: string;
|
|
31
|
+
buildId: string;
|
|
32
|
+
}
|
|
33
|
+
/** A store entry representing a published package */
|
|
34
|
+
interface StoreEntry {
|
|
35
|
+
name: string;
|
|
36
|
+
version: string;
|
|
37
|
+
packageDir: string;
|
|
38
|
+
meta: PlunkMeta;
|
|
39
|
+
}
|
|
40
|
+
/** Tracks a single linked package in a consumer project */
|
|
41
|
+
interface LinkEntry {
|
|
42
|
+
version: string;
|
|
43
|
+
contentHash: string;
|
|
44
|
+
linkedAt: string;
|
|
45
|
+
sourcePath: string;
|
|
46
|
+
backupExists: boolean;
|
|
47
|
+
packageManager: PackageManager;
|
|
48
|
+
buildId: string;
|
|
49
|
+
}
|
|
50
|
+
/** Consumer project state file (.plunk/state.json) */
|
|
51
|
+
interface ConsumerState {
|
|
52
|
+
version: "1";
|
|
53
|
+
packageManager?: PackageManager;
|
|
54
|
+
role?: "consumer" | "library";
|
|
55
|
+
links: Record<string, LinkEntry>;
|
|
56
|
+
}
|
|
57
|
+
/** Global consumers registry (~/.plunk/consumers.json) */
|
|
58
|
+
interface ConsumersRegistry {
|
|
59
|
+
/** Maps package name → array of consumer project paths */
|
|
60
|
+
[packageName: string]: string[];
|
|
61
|
+
}
|
|
62
|
+
type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
|
63
|
+
/** Options for the watch mode */
|
|
64
|
+
interface WatchOptions {
|
|
65
|
+
/** Glob patterns to watch (default: src, lib, dist) */
|
|
66
|
+
patterns?: string[];
|
|
67
|
+
/** Build command to run before publishing */
|
|
68
|
+
buildCmd?: string;
|
|
69
|
+
/** Debounce delay in ms (default: 300) */
|
|
70
|
+
debounce?: number;
|
|
71
|
+
/** Enable awaitWriteFinish for large/slow writes (auto-enabled when no buildCmd) */
|
|
72
|
+
awaitWriteFinish?: boolean | {
|
|
73
|
+
stabilityThreshold: number;
|
|
74
|
+
pollInterval: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Package.json fields we care about */
|
|
78
|
+
interface PackageJson {
|
|
79
|
+
name: string;
|
|
80
|
+
version: string;
|
|
81
|
+
files?: string[];
|
|
82
|
+
bin?: string | Record<string, string>;
|
|
83
|
+
dependencies?: Record<string, string>;
|
|
84
|
+
devDependencies?: Record<string, string>;
|
|
85
|
+
peerDependencies?: Record<string, string>;
|
|
86
|
+
peerDependenciesMeta?: Record<string, {
|
|
87
|
+
optional?: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
main?: string;
|
|
90
|
+
module?: string;
|
|
91
|
+
exports?: unknown;
|
|
92
|
+
type?: string;
|
|
93
|
+
private?: boolean;
|
|
94
|
+
scripts?: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface InjectResult {
|
|
98
|
+
copied: number;
|
|
99
|
+
removed: number;
|
|
100
|
+
skipped: number;
|
|
101
|
+
binLinks: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Inject a package from the store into a consumer's node_modules.
|
|
105
|
+
* Strategy depends on the package manager:
|
|
106
|
+
* - npm/yarn/bun: direct node_modules/<pkg>/
|
|
107
|
+
* - pnpm: follow .pnpm/ structure
|
|
108
|
+
*/
|
|
109
|
+
declare function inject(storeEntry: StoreEntry, consumerPath: string, pm: PackageManager): Promise<InjectResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Back up the existing installed version of a package before overwriting.
|
|
112
|
+
*/
|
|
113
|
+
declare function backupExisting(consumerPath: string, packageName: string, pm: PackageManager): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* Restore a backed-up package to node_modules.
|
|
116
|
+
*/
|
|
117
|
+
declare function restoreBackup(consumerPath: string, packageName: string, pm: PackageManager): Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Remove an injected package from node_modules.
|
|
120
|
+
*/
|
|
121
|
+
declare function removeInjected(consumerPath: string, packageName: string, pm: PackageManager): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Check for missing transitive dependencies.
|
|
124
|
+
* Returns a list of dependency names that are in the linked package's
|
|
125
|
+
* dependencies but not installed in the consumer's node_modules.
|
|
126
|
+
*/
|
|
127
|
+
declare function checkMissingDeps(storeEntry: StoreEntry, consumerPath: string): Promise<string[]>;
|
|
128
|
+
|
|
129
|
+
/** Get a store entry if it exists */
|
|
130
|
+
declare function getStoreEntry(name: string, version: string): Promise<StoreEntry | null>;
|
|
131
|
+
/** Find a store entry by name (any version). Returns the latest by publishedAt. */
|
|
132
|
+
declare function findStoreEntry(name: string): Promise<StoreEntry | null>;
|
|
133
|
+
/** List all entries in the store */
|
|
134
|
+
declare function listStoreEntries(): Promise<StoreEntry[]>;
|
|
135
|
+
|
|
136
|
+
/** Read the consumer state file, or return an empty state if not found */
|
|
137
|
+
declare function readConsumerState(consumerPath: string): Promise<ConsumerState>;
|
|
138
|
+
/** Add or update a link entry in the consumer state */
|
|
139
|
+
declare function addLink(consumerPath: string, packageName: string, entry: LinkEntry): Promise<void>;
|
|
140
|
+
/** Remove a link entry from the consumer state */
|
|
141
|
+
declare function removeLink(consumerPath: string, packageName: string): Promise<void>;
|
|
142
|
+
/** Register a consumer for a package */
|
|
143
|
+
declare function registerConsumer(packageName: string, consumerPath: string): Promise<void>;
|
|
144
|
+
/** Unregister a consumer for a package */
|
|
145
|
+
declare function unregisterConsumer(packageName: string, consumerPath: string): Promise<void>;
|
|
146
|
+
/** Get all consumers for a package */
|
|
147
|
+
declare function getConsumers(packageName: string): Promise<string[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Clean stale consumers — remove registrations for directories that no longer exist.
|
|
150
|
+
* Returns the number of stale entries removed.
|
|
151
|
+
*/
|
|
152
|
+
declare function cleanStaleConsumers(): Promise<{
|
|
153
|
+
removedConsumers: number;
|
|
154
|
+
removedPackages: number;
|
|
155
|
+
}>;
|
|
156
|
+
|
|
157
|
+
/** Kill the active build process if one is running */
|
|
158
|
+
declare function killActiveBuild(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Start watching a directory for changes and trigger a callback.
|
|
161
|
+
*
|
|
162
|
+
* Uses a "debounce effects, not detection" strategy (inspired by Vite):
|
|
163
|
+
* - File changes are detected immediately
|
|
164
|
+
* - The push callback is coalesced: rapid changes within `debounceMs` are batched
|
|
165
|
+
* - If a push is already running when new changes arrive, a re-push is queued
|
|
166
|
+
* so the final state is always pushed
|
|
167
|
+
*/
|
|
168
|
+
declare function startWatcher(watchDir: string, options: WatchOptions, onChange: () => Promise<void>): Promise<{
|
|
169
|
+
close: () => Promise<void>;
|
|
170
|
+
}>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Detect the package manager used in a project directory
|
|
174
|
+
* by checking for lockfile presence.
|
|
175
|
+
* Probes all lockfiles in parallel, returns the highest-priority match.
|
|
176
|
+
* Falls back to "npm" if no lockfile is found.
|
|
177
|
+
*/
|
|
178
|
+
declare function detectPackageManager(projectDir: string): Promise<PackageManager>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Simple timer for measuring command execution time.
|
|
182
|
+
*/
|
|
183
|
+
declare class Timer {
|
|
184
|
+
private start;
|
|
185
|
+
/** Return elapsed time in ms */
|
|
186
|
+
elapsedMs(): number;
|
|
187
|
+
/** Return human-readable elapsed time (e.g., "1.2s" or "150ms") */
|
|
188
|
+
elapsed(): string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Type guard for Node.js system errors with an error code */
|
|
192
|
+
declare function isNodeError(err: unknown): err is NodeJS.ErrnoException;
|
|
193
|
+
|
|
194
|
+
export { type ConsumerState, type ConsumersRegistry, type LinkEntry, type PackageJson, type PackageManager, type PlunkMeta, type PublishOptions, type PublishResult, type StoreEntry, Timer, type WatchOptions, addLink, backupExisting, checkMissingDeps, cleanStaleConsumers, detectPackageManager, findStoreEntry, getConsumers, getStoreEntry, inject, isNodeError, killActiveBuild, listStoreEntries, publish, readConsumerState, registerConsumer, removeInjected, removeLink, restoreBackup, startWatcher, unregisterConsumer };
|