@weasel-js/forge 1.10.0 → 1.10.1

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.
@@ -1,6 +1,6 @@
1
- import { StoryTrial } from '../chunk-ENXU34PI.js';
1
+ import { StoryTrial } from '../chunk-E2FHBDNQ.js';
2
2
  import '../chunk-DFKCLZKS.js';
3
- import { loadStories } from '../chunk-4NM3RTYK.js';
3
+ import { loadStories } from '../chunk-AP3DRQLI.js';
4
4
  import '../chunk-L5XM5VKB.js';
5
5
  import '../chunk-ZAWXMUGZ.js';
6
6
  import '../chunk-GB6PRJET.js';
@@ -49,4 +49,16 @@ interface ForgeTestOptions {
49
49
  */
50
50
  declare function forgeTest(options: ForgeTestOptions): Plugin[];
51
51
 
52
- export { type ForgeOptions, type ForgeTestOptions, type PropControlsOptions, forge, forgeTest };
52
+ /** Options for the `watchProbe` vite plugin. */
53
+ interface WatchProbeOptions {
54
+ /**
55
+ * Answers whether the OS is reporting file changes: false makes the plugin log its warning. Called once, as the
56
+ * dev server starts, and not at all where the server polls or does not watch. Default: {@link fileEventsArrive},
57
+ * which writes a temp file and waits five seconds for the report.
58
+ */
59
+ probe?: () => Promise<boolean>;
60
+ }
61
+ /** A plugin giving any dev server the warning forge's own gives when the OS reports no file changes. */
62
+ declare function watchProbe({ probe }?: WatchProbeOptions): Plugin;
63
+
64
+ export { type ForgeOptions, type ForgeTestOptions, type PropControlsOptions, type WatchProbeOptions, forge, forgeTest, watchProbe };
@@ -1248,12 +1248,21 @@ function fileEventsArrive({ waitMs = WAIT_MS, watch = watchDir } = {}) {
1248
1248
  deadline.unref();
1249
1249
  });
1250
1250
  }
1251
- var SILENT = `[forge] a file written ${WAIT_MS / 1e3} s ago has not been reported by the OS file watcher, so an edit will not reach the page until file events arrive again. \`server.watch: { usePolling: true }\` serves edits without them. On macOS, look for \`fseventsd\` held at 100% CPU.`;
1251
+ var SILENT = `[watch] a file written ${WAIT_MS / 1e3} s ago has not been reported by the OS file watcher, so an edit will not reach the page until file events arrive again. \`server.watch: { usePolling: true }\` serves edits without them. On macOS, look for \`fseventsd\` held at 100% CPU.`;
1252
1252
  async function warnWhenWatchIsSilent(server, probe = fileEventsArrive) {
1253
1253
  const { watch } = server.config.server;
1254
1254
  if (watch === null || watch?.usePolling) return;
1255
1255
  if (!await probe()) server.config.logger.warn(SILENT);
1256
1256
  }
1257
+ function watchProbe({ probe } = {}) {
1258
+ return {
1259
+ name: "weasel-watch-probe",
1260
+ apply: "serve",
1261
+ configureServer(server) {
1262
+ void warnWhenWatchIsSilent(server, probe);
1263
+ }
1264
+ };
1265
+ }
1257
1266
 
1258
1267
  // src/vite/plugin.ts
1259
1268
  var PREFIX = "virtual:forge/";
@@ -1558,6 +1567,6 @@ ${lines.join("\n")}
1558
1567
  ];
1559
1568
  }
1560
1569
 
1561
- export { forge, forgeTest };
1570
+ export { forge, forgeTest, watchProbe };
1562
1571
  //# sourceMappingURL=index.js.map
1563
1572
  //# sourceMappingURL=index.js.map