@olegkuibar/plunk 0.2.3 → 0.3.0-canary.0807dec

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.
Files changed (78) hide show
  1. package/dist/add-4LHIITHV.mjs +14 -0
  2. package/dist/chokidar-LVDD2IK4.mjs +4 -0
  3. package/dist/chunk-2VCW5RWI.mjs +3 -0
  4. package/dist/chunk-4QWBGXB5.mjs +15 -0
  5. package/dist/chunk-4TNTNSAB.mjs +4 -0
  6. package/dist/chunk-6YX2BGO2.mjs +3 -0
  7. package/dist/chunk-7JG555TZ.mjs +3 -0
  8. package/dist/chunk-AR7AKSKG.mjs +3 -0
  9. package/dist/chunk-HW7AEGI3.mjs +3 -0
  10. package/dist/chunk-KVVUZ6KL.mjs +4 -0
  11. package/dist/chunk-LI4HG26F.mjs +4 -0
  12. package/dist/chunk-MBKCCWSD.mjs +3 -0
  13. package/dist/chunk-OL7SNXMX.mjs +7 -0
  14. package/dist/chunk-QUI5JAIH.mjs +3 -0
  15. package/dist/chunk-RITKSDMP.mjs +3 -0
  16. package/dist/chunk-UAGG5WMD.mjs +3 -0
  17. package/dist/chunk-UDONDVIM.mjs +7 -0
  18. package/dist/chunk-ZAUWE3N7.mjs +12 -0
  19. package/dist/chunk-ZIXSXQRE.mjs +3 -0
  20. package/dist/chunk-ZJMZKJNW.mjs +3 -0
  21. package/dist/clean-EWBL6FW2.mjs +3 -0
  22. package/dist/cli.mjs +2 -56
  23. package/dist/dev-NCLIWE2E.mjs +3 -0
  24. package/dist/doctor-PXC45S34.mjs +4 -0
  25. package/dist/index.d.ts +19 -2
  26. package/dist/index.mjs +572 -244
  27. package/dist/init-TZ76GAWN.mjs +7 -0
  28. package/dist/list-CCR7QD7N.mjs +5 -0
  29. package/dist/migrate-6RZ3SEU5.mjs +8 -0
  30. package/dist/publish-4TDT6TTS.mjs +3 -0
  31. package/dist/push-M4RSFETI.mjs +3 -0
  32. package/dist/remove-R55FIXPL.mjs +3 -0
  33. package/dist/restore-XBFOHISI.mjs +11 -0
  34. package/dist/status-GCATYK2I.mjs +4 -0
  35. package/dist/tailwind-source-VPNLLSRJ.mjs +5 -0
  36. package/dist/update-6PLGM37S.mjs +3 -0
  37. package/dist/vite-config-ZMDIOTXC.mjs +10 -0
  38. package/dist/vite-plugin.mjs +2 -1
  39. package/dist/workspace-VREEJZ76.mjs +3 -0
  40. package/package.json +2 -8
  41. package/dist/add-5ZRFUL6Z.mjs +0 -258
  42. package/dist/chokidar-XGAEDN45.mjs +0 -1746
  43. package/dist/chunk-34UXZ622.mjs +0 -98
  44. package/dist/chunk-4O2QOKVO.mjs +0 -1958
  45. package/dist/chunk-CSMZ6DZA.mjs +0 -367
  46. package/dist/chunk-CZM4TNAI.mjs +0 -292
  47. package/dist/chunk-EDUXIQ5W.mjs +0 -1729
  48. package/dist/chunk-GAAB2TLH.mjs +0 -160
  49. package/dist/chunk-HKNM3UWU.mjs +0 -496
  50. package/dist/chunk-I6SN7BBN.mjs +0 -1131
  51. package/dist/chunk-KYDBD2KQ.mjs +0 -39
  52. package/dist/chunk-LKQINKH4.mjs +0 -130
  53. package/dist/chunk-PUSXMPOF.mjs +0 -82
  54. package/dist/chunk-S4HJSJ32.mjs +0 -69
  55. package/dist/chunk-W3C72UKC.mjs +0 -113
  56. package/dist/chunk-WSECI6M7.mjs +0 -85
  57. package/dist/chunk-XMIZ7OUZ.mjs +0 -26
  58. package/dist/chunk-XZK5T4GK.mjs +0 -23
  59. package/dist/chunk-ZOYNYK5Y.mjs +0 -23
  60. package/dist/chunk-ZQCGJUBJ.mjs +0 -92
  61. package/dist/clean-LTR5MZTY.mjs +0 -84
  62. package/dist/dev-LFXQP6SA.mjs +0 -194
  63. package/dist/dist-DUFCZSIL.mjs +0 -813
  64. package/dist/doctor-R7ZVR7PY.mjs +0 -230
  65. package/dist/hash-worker.mjs +0 -65
  66. package/dist/init-SWCNRISY.mjs +0 -310
  67. package/dist/list-B77L2F34.mjs +0 -119
  68. package/dist/migrate-X5TIC5SS.mjs +0 -124
  69. package/dist/prompt-HTPH6HQ7.mjs +0 -756
  70. package/dist/publish-UXCLPNM6.mjs +0 -63
  71. package/dist/push-JI6HGCFG.mjs +0 -197
  72. package/dist/remove-DCR7KKD5.mjs +0 -149
  73. package/dist/restore-SUN3WGSW.mjs +0 -124
  74. package/dist/status-MESRBH54.mjs +0 -103
  75. package/dist/tailwind-source-JBBEIXIJ.mjs +0 -89
  76. package/dist/update-SKDSA673.mjs +0 -100
  77. package/dist/vite-config-BAK67JHB.mjs +0 -128
  78. package/dist/workspace-76HJPAK2.mjs +0 -97
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
3
- import {
4
- cleanStaleConsumers,
5
- readConsumerState,
6
- readConsumersRegistry
7
- } from "./chunk-GAAB2TLH.mjs";
8
- import {
9
- listStoreEntries,
10
- removeStoreEntry
11
- } from "./chunk-W3C72UKC.mjs";
12
- import {
13
- Timer
14
- } from "./chunk-XZK5T4GK.mjs";
15
- import "./chunk-EDUXIQ5W.mjs";
16
- import {
17
- output,
18
- suppressHumanOutput
19
- } from "./chunk-ZOYNYK5Y.mjs";
20
- import {
21
- defineCommand
22
- } from "./chunk-CSMZ6DZA.mjs";
23
- import "./chunk-HKNM3UWU.mjs";
24
- import {
25
- consola,
26
- verbose
27
- } from "./chunk-I6SN7BBN.mjs";
28
- import "./chunk-KYDBD2KQ.mjs";
29
-
30
- // src/commands/clean.ts
31
- var clean_default = defineCommand({
32
- meta: {
33
- name: "clean",
34
- description: "Remove unreferenced store entries and stale consumer registrations"
35
- },
36
- async run() {
37
- suppressHumanOutput();
38
- const timer = new Timer();
39
- consola.start("Checking consumer registrations...");
40
- const { removedConsumers, removedPackages } = await cleanStaleConsumers();
41
- if (removedConsumers > 0) {
42
- consola.success(
43
- `Removed ${removedConsumers} stale consumer registration(s) across ${removedPackages} package(s)`
44
- );
45
- }
46
- const registry = await readConsumersRegistry();
47
- const referenced = /* @__PURE__ */ new Set();
48
- for (const [, consumers] of Object.entries(registry)) {
49
- for (const consumerPath of consumers) {
50
- const state = await readConsumerState(consumerPath);
51
- for (const [pkgName, link] of Object.entries(state.links)) {
52
- referenced.add(`${pkgName}@${link.version}`);
53
- }
54
- }
55
- }
56
- verbose(`[clean] Referenced entries: ${[...referenced].join(", ") || "(none)"}`);
57
- const storeEntries = await listStoreEntries();
58
- let removedEntries = 0;
59
- for (const entry of storeEntries) {
60
- const key = `${entry.name}@${entry.version}`;
61
- if (!referenced.has(key)) {
62
- verbose(`[clean] Removing unreferenced store entry: ${key}`);
63
- await removeStoreEntry(entry.name, entry.version);
64
- removedEntries++;
65
- }
66
- }
67
- if (removedEntries > 0) {
68
- consola.success(`Removed ${removedEntries} unreferenced store entry(ies)`);
69
- }
70
- if (removedConsumers === 0 && removedEntries === 0) {
71
- consola.info("Nothing to clean up");
72
- }
73
- consola.info(`Clean complete in ${timer.elapsed()}`);
74
- output({
75
- removedConsumers,
76
- removedPackages,
77
- removedEntries,
78
- elapsed: timer.elapsedMs()
79
- });
80
- }
81
- });
82
- export {
83
- clean_default as default
84
- };
@@ -1,194 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire as __cr}from"node:module";globalThis.require=__cr(import.meta.url);
3
- import {
4
- startWatcher
5
- } from "./chunk-LKQINKH4.mjs";
6
- import {
7
- inject
8
- } from "./chunk-CZM4TNAI.mjs";
9
- import {
10
- detectBuildCommand
11
- } from "./chunk-XMIZ7OUZ.mjs";
12
- import {
13
- detectPackageManager
14
- } from "./chunk-34UXZ622.mjs";
15
- import {
16
- addLink,
17
- getConsumers,
18
- getLink
19
- } from "./chunk-GAAB2TLH.mjs";
20
- import {
21
- publish
22
- } from "./chunk-4O2QOKVO.mjs";
23
- import {
24
- errorWithSuggestion
25
- } from "./chunk-S4HJSJ32.mjs";
26
- import {
27
- getStoreEntry
28
- } from "./chunk-W3C72UKC.mjs";
29
- import {
30
- Timer
31
- } from "./chunk-XZK5T4GK.mjs";
32
- import "./chunk-PUSXMPOF.mjs";
33
- import "./chunk-EDUXIQ5W.mjs";
34
- import {
35
- output,
36
- suppressHumanOutput
37
- } from "./chunk-ZOYNYK5Y.mjs";
38
- import {
39
- defineCommand
40
- } from "./chunk-CSMZ6DZA.mjs";
41
- import {
42
- pLimit
43
- } from "./chunk-HKNM3UWU.mjs";
44
- import {
45
- consola,
46
- verbose
47
- } from "./chunk-I6SN7BBN.mjs";
48
- import "./chunk-KYDBD2KQ.mjs";
49
-
50
- // src/commands/dev.ts
51
- import { readFile } from "fs/promises";
52
- import { resolve, join } from "path";
53
- var consumerLimit = pLimit(4);
54
- var dev_default = defineCommand({
55
- meta: {
56
- name: "dev",
57
- description: "Watch, rebuild, and push to all consumers. Auto-detects build command."
58
- },
59
- args: {
60
- build: {
61
- type: "string",
62
- description: "Override build command (default: auto-detect from package.json)"
63
- },
64
- "skip-build": {
65
- type: "boolean",
66
- description: "Watch output dirs directly, skip build command detection",
67
- default: false
68
- },
69
- debounce: {
70
- type: "string",
71
- description: "Debounce delay in ms (default: 100)"
72
- }
73
- },
74
- async run({ args }) {
75
- suppressHumanOutput();
76
- const packageDir = resolve(".");
77
- const doPush = async () => {
78
- const timer = new Timer();
79
- const result = await publish(packageDir);
80
- if (result.skipped) {
81
- consola.info("No changes to push");
82
- return;
83
- }
84
- const entry = await getStoreEntry(result.name, result.version);
85
- if (!entry) {
86
- errorWithSuggestion("Failed to read store entry after publish");
87
- return;
88
- }
89
- const consumers = await getConsumers(result.name);
90
- if (consumers.length === 0) {
91
- consola.info(
92
- "No consumers registered. Use 'plunk add' in a consumer project first."
93
- );
94
- return;
95
- }
96
- let totalCopied = 0;
97
- let totalSkipped = 0;
98
- let pushCount = 0;
99
- const results = await Promise.all(
100
- consumers.map(
101
- (consumerPath) => consumerLimit(async () => {
102
- const link = await getLink(consumerPath, result.name);
103
- if (!link) {
104
- verbose(
105
- `[push] No link found for ${result.name} in ${consumerPath}, skipping`
106
- );
107
- return null;
108
- }
109
- try {
110
- const injectResult = await inject(
111
- entry,
112
- consumerPath,
113
- link.packageManager
114
- );
115
- if (injectResult.copied > 0 || injectResult.removed > 0) {
116
- await addLink(consumerPath, result.name, {
117
- ...link,
118
- contentHash: entry.meta.contentHash,
119
- linkedAt: (/* @__PURE__ */ new Date()).toISOString(),
120
- buildId: entry.meta.buildId ?? ""
121
- });
122
- }
123
- return injectResult;
124
- } catch (err) {
125
- consola.warn(`Failed to push to ${consumerPath}: ${err}`);
126
- return null;
127
- }
128
- })
129
- )
130
- );
131
- for (const r of results) {
132
- if (r) {
133
- totalCopied += r.copied;
134
- totalSkipped += r.skipped;
135
- pushCount++;
136
- }
137
- }
138
- const buildTag = result.buildId ? ` [${result.buildId}]` : "";
139
- consola.success(
140
- `Pushed ${result.name}@${result.version}${buildTag} to ${pushCount} consumer(s) in ${timer.elapsed()} (${totalCopied} files changed, ${totalSkipped} unchanged)`
141
- );
142
- output({
143
- name: result.name,
144
- version: result.version,
145
- buildId: result.buildId,
146
- consumers: pushCount,
147
- copied: totalCopied,
148
- skipped: totalSkipped,
149
- elapsed: timer.elapsedMs()
150
- });
151
- };
152
- let buildCmd = args.build;
153
- let patterns;
154
- if (args.build) {
155
- } else if (args["skip-build"]) {
156
- } else {
157
- const pm = await detectPackageManager(packageDir);
158
- const detected = await detectBuildCommand(packageDir, pm);
159
- if (detected) {
160
- buildCmd = detected;
161
- consola.info(`Auto-detected build command: ${detected}`);
162
- }
163
- }
164
- if (!buildCmd) {
165
- try {
166
- const pkg = JSON.parse(
167
- await readFile(join(packageDir, "package.json"), "utf-8")
168
- );
169
- if (pkg.files && pkg.files.length > 0) {
170
- patterns = pkg.files;
171
- verbose(
172
- `[watch] Using package.json files field: ${patterns.join(", ")}`
173
- );
174
- }
175
- } catch {
176
- }
177
- }
178
- await doPush();
179
- await startWatcher(
180
- packageDir,
181
- {
182
- patterns,
183
- buildCmd,
184
- debounce: args.debounce ? parseInt(args.debounce, 10) : void 0
185
- },
186
- doPush
187
- );
188
- await new Promise(() => {
189
- });
190
- }
191
- });
192
- export {
193
- dev_default as default
194
- };