@3sln/create-trove 0.0.16 → 0.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3sln/create-trove",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "description": "Scaffold a Trove deployment — Bun, Node, or Cloudflare Workers — with the bindings, environment and secrets each one needs.",
6
6
  "repository": {
package/src/plan.js CHANGED
@@ -348,7 +348,7 @@ export async function askPlan(prompter, { name, version, runtime: preset, genera
348
348
  */
349
349
  async function askWorkers(prompter, { embeddingDim }) {
350
350
  const w = {
351
- d1: null, pluginDb: null, vectorize: null, ai: false, tasks: true,
351
+ d1: null, pluginDb: null, vectorize: null, ai: false, tasks: true, workerLoader: false,
352
352
  // nodejs_compat v2 needs 2024-09-23 or later; that exact floor was also the hardcoded
353
353
  // value, which made it two years stale on the day it shipped.
354
354
  compatibilityDate: '2026-07-01',
@@ -369,6 +369,18 @@ async function askWorkers(prompter, { embeddingDim }) {
369
369
  }
370
370
  }
371
371
 
372
+ // Default FALSE, and the wording says why: running dynamic Workers on Cloudflare needs
373
+ // the closed beta, so for most people the honest answer today is "not yet". Declaring
374
+ // the binding without access makes the deploy fail, which is a worse first experience
375
+ // than an install that refuses a plugin with a clear message.
376
+ w.workerLoader = await prompter.confirm(
377
+ ' Bind a Worker Loader so plugin indexers can run?',
378
+ { key: 'workers.loader.enabled', default: false,
379
+ hint: 'without it, plugin indexers are skipped — a plugin still installs and its '
380
+ + 'viewers work, but nothing it would have contributed to search appears. '
381
+ + 'Needs the Dynamic Workers closed beta; works in `wrangler dev` regardless' },
382
+ );
383
+
372
384
  if (await prompter.section('Vectorize (semantic search)', { key: 'workers.vectorize.enabled',
373
385
  blurb: 'sqlite-vec is a native artifact and cannot load here, so semantic search needs Vectorize.',
374
386
  })) {
package/src/render.js CHANGED
@@ -434,6 +434,29 @@ function wranglerToml(plan) {
434
434
  L.push('');
435
435
  }
436
436
 
437
+ // Where PLUGIN INDEXERS run. A plugin's indexer is somebody else's code executing on
438
+ // the server, and a Worker cannot simply import it: the in-process runner loads code
439
+ // through a `data:` URL, which workerd refuses outright — so without this binding every
440
+ // plugin indexer fails on every file. (It used to fail SILENTLY; the install now
441
+ // refuses up front and says why.)
442
+ //
443
+ // A Worker Loader gives that code a real isolate with no bindings and no network beyond
444
+ // the one presigned URL the host hands it. Commented out because running dynamic
445
+ // Workers on Cloudflare needs the closed beta — it works in `wrangler dev` today, so
446
+ // uncommenting it locally is how you try plugin indexers before you have access.
447
+ if (w?.workerLoader) {
448
+ L.push('# Isolates for plugin indexers. See "Server indexers" in the README.');
449
+ L.push('[[worker_loaders]]');
450
+ L.push('binding = "LOADER"');
451
+ L.push('');
452
+ } else {
453
+ L.push('# [[worker_loaders]] # plugin indexers run in isolates loaded through this');
454
+ L.push('# binding = "LOADER" # works in `wrangler dev`; on Cloudflare needs the');
455
+ L.push('# # Dynamic Workers closed beta. Without it, installing');
456
+ L.push('# # a plugin that ships a server indexer is refused.');
457
+ L.push('');
458
+ }
459
+
437
460
  if (w?.vectorize) {
438
461
  L.push('[[vectorize]]');
439
462
  L.push('binding = "VECTORIZE"');