clodable 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/.version CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
package/dist/clodable.mjs CHANGED
@@ -30372,7 +30372,7 @@ import { dirname as dirname10, join as join24, resolve as resolve7 } from "node:
30372
30372
 
30373
30373
  // ../preview/src/dev-server.ts
30374
30374
  init_src();
30375
- import { existsSync as existsSync21, readFileSync as readFileSync3, unwatchFile, watchFile } from "node:fs";
30375
+ import { existsSync as existsSync21, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
30376
30376
  import { dirname as dirname9, join as join23 } from "node:path";
30377
30377
  import { pathToFileURL } from "node:url";
30378
30378
 
@@ -47492,6 +47492,8 @@ function resolveProjectVite(root) {
47492
47492
  async function startDevServer(options) {
47493
47493
  if (process.cwd() !== options.root) process.chdir(options.root);
47494
47494
  const vite = await import(pathToFileURL(resolveProjectVite(options.root)).href);
47495
+ const backendMarker = options.backend?.watch ? markerWatch(options.backend.watch) : void 0;
47496
+ const settingsMarker = options.settings?.watch ? markerWatch(options.settings.watch) : void 0;
47495
47497
  let backend = await options.backend?.current();
47496
47498
  applyBackendEnv(backend);
47497
47499
  let settings2 = await options.settings?.current().catch(() => ({})) ?? {};
@@ -47509,11 +47511,10 @@ async function startDevServer(options) {
47509
47511
  }
47510
47512
  });
47511
47513
  await server.listen();
47512
- const watched = options.backend?.watch;
47513
47514
  let switching = Promise.resolve();
47514
- if (watched && options.backend) {
47515
+ if (backendMarker && options.backend) {
47515
47516
  const source = options.backend;
47516
- watchFile(watched, { interval: 1e3 }, () => {
47517
+ backendMarker.start(() => {
47517
47518
  switching = switching.then(async () => {
47518
47519
  let next;
47519
47520
  try {
@@ -47534,10 +47535,9 @@ async function startDevServer(options) {
47534
47535
  });
47535
47536
  });
47536
47537
  }
47537
- const settingsWatch = options.settings?.watch;
47538
- if (settingsWatch && options.settings) {
47538
+ if (settingsMarker && options.settings) {
47539
47539
  const source = options.settings;
47540
- watchFile(settingsWatch, { interval: 1e3 }, () => {
47540
+ settingsMarker.start(() => {
47541
47541
  switching = switching.then(async () => {
47542
47542
  const next = await source.current().catch(() => settings2);
47543
47543
  if (JSON.stringify(next) === JSON.stringify(settings2)) return;
@@ -47553,12 +47553,38 @@ async function startDevServer(options) {
47553
47553
  urls,
47554
47554
  backend: backend ? "copy" : "live",
47555
47555
  close: async () => {
47556
- if (watched) unwatchFile(watched);
47557
- if (settingsWatch) unwatchFile(settingsWatch);
47556
+ backendMarker?.stop();
47557
+ settingsMarker?.stop();
47558
47558
  await server.close();
47559
47559
  }
47560
47560
  };
47561
47561
  }
47562
+ function markerWatch(path2) {
47563
+ const look = () => {
47564
+ try {
47565
+ const s = statSync2(path2, { throwIfNoEntry: false });
47566
+ return s ? `${s.mtimeMs}:${s.ctimeMs}:${s.size}:${s.ino}` : "none";
47567
+ } catch {
47568
+ return "unreadable";
47569
+ }
47570
+ };
47571
+ let seen = look();
47572
+ let timer;
47573
+ return {
47574
+ start(onChange) {
47575
+ timer = setInterval(() => {
47576
+ const now2 = look();
47577
+ if (now2 === seen) return;
47578
+ seen = now2;
47579
+ onChange();
47580
+ }, 1e3);
47581
+ timer.unref();
47582
+ },
47583
+ stop() {
47584
+ if (timer) clearInterval(timer);
47585
+ }
47586
+ };
47587
+ }
47562
47588
 
47563
47589
  // src/commands/dev.ts
47564
47590
  var import_picocolors2 = __toESM(require_picocolors(), 1);
@@ -50101,7 +50127,7 @@ async function inboxCommand(ctx2, options) {
50101
50127
  }
50102
50128
 
50103
50129
  // src/index.ts
50104
- var version2 = true ? "0.1.1" : "0.1.0-dev";
50130
+ var version2 = true ? "0.1.2" : "0.1.0-dev";
50105
50131
  var cli = cac("clodable");
50106
50132
  cli.option("--json", "Print one JSON event per line (for programs)");
50107
50133
  cli.option("--cwd <dir>", "Run in another folder");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clodable",
3
- "version": "0.1.1",
4
- "description": "Shape your app with Claude, publish when you're happy. The Clodable command line: save, publish, undo, preview.",
3
+ "version": "0.1.2",
4
+ "description": "The AI app builder you own. The Clodable command line: save, publish, undo, preview.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/bworlds-co/clodable#readme",
7
7
  "repository": {
@@ -33,9 +33,9 @@
33
33
  "@clack/prompts": "^1.8.1",
34
34
  "cac": "^7.0.1",
35
35
  "picocolors": "^1.1.1",
36
- "@clodable/design": "0.1.1",
37
- "@clodable/core": "0.1.1",
38
- "@clodable/preview": "0.1.1"
36
+ "@clodable/core": "0.1.2",
37
+ "@clodable/design": "0.1.2",
38
+ "@clodable/preview": "0.1.2"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "node build.mjs",