@lunora/vite 1.0.0-alpha.3 → 1.0.0-alpha.5

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/index.d.mts CHANGED
@@ -198,7 +198,7 @@ declare const isAutoComposable: (context: LunoraPluginContext) => boolean;
198
198
  * virtual module id. Absolute paths are resolved correctly in all environments
199
199
  * (Vite 8 + rolldown 1.x confirmed).
200
200
  */
201
- declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean) => string;
201
+ declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean) => string;
202
202
  /**
203
203
  * Vite plugin that auto-composes a detected class-A meta-framework's SSR
204
204
  * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
package/dist/index.d.ts CHANGED
@@ -198,7 +198,7 @@ declare const isAutoComposable: (context: LunoraPluginContext) => boolean;
198
198
  * virtual module id. Absolute paths are resolved correctly in all environments
199
199
  * (Vite 8 + rolldown 1.x confirmed).
200
200
  */
201
- declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean) => string;
201
+ declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean) => string;
202
202
  /**
203
203
  * Vite plugin that auto-composes a detected class-A meta-framework's SSR
204
204
  * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
package/dist/index.mjs CHANGED
@@ -2,19 +2,20 @@ import { cloudflare } from '@cloudflare/vite-plugin';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { detectAgentRules, claimAgentRulesHint, AGENT_RULES_HINT, detectFramework } from '@lunora/config';
4
4
  export { detectFramework } from '@lunora/config';
5
- import codegenPlugin from './packem_shared/codegenPlugin-BAyt6iWS.mjs';
6
- import devVariablesPlugin from './packem_shared/devVariablesPlugin-BRWbWHhq.mjs';
5
+ import { l as lunoraLine } from './packem_shared/log-Bgkv6QhO.mjs';
6
+ import codegenPlugin from './packem_shared/codegenPlugin-CHzvXqK6.mjs';
7
+ import devVariablesPlugin from './packem_shared/devVariablesPlugin-DbDf7tmi.mjs';
7
8
  import { createCommandProbe, withDevWorkerEnv } from './packem_shared/DEV_WORKER_ENV_VALUE-Coo6bgVz.mjs';
8
9
  export { DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR } from './packem_shared/DEV_WORKER_ENV_VALUE-Coo6bgVz.mjs';
9
- import { frameworkComposePlugin } from './packem_shared/CLASS_A_WIRING-Cja0SF6x.mjs';
10
- export { CLASS_A_WIRING, LUNORA_WORKER_VIRTUAL_ID, buildWorkerEntrySource, isAutoComposable } from './packem_shared/CLASS_A_WIRING-Cja0SF6x.mjs';
10
+ import { frameworkComposePlugin } from './packem_shared/CLASS_A_WIRING-CZVcjgKo.mjs';
11
+ export { CLASS_A_WIRING, LUNORA_WORKER_VIRTUAL_ID, buildWorkerEntrySource, isAutoComposable } from './packem_shared/CLASS_A_WIRING-CZVcjgKo.mjs';
11
12
  import logStreamPlugin from './packem_shared/logStreamPlugin-CqvZ17kd.mjs';
12
13
  import { planViteRemoteBindings, remoteBindingsCleanupPlugin, withRemoteBindings } from './packem_shared/planViteRemoteBindings-QN5ncUS1.mjs';
13
14
  import { studioPlugin } from './packem_shared/STUDIO_PATH-5ppCdBHa.mjs';
14
15
  export { STUDIO_PATH, buildStudioUrl } from './packem_shared/STUDIO_PATH-5ppCdBHa.mjs';
15
16
  import { withWorkerStartupHint } from './packem_shared/WORKER_STARTUP_HINT-DhsXUW8k.mjs';
16
17
  export { WORKER_STARTUP_HINT, augmentWorkerStartupError, isWorkerEntryEvalError } from './packem_shared/WORKER_STARTUP_HINT-DhsXUW8k.mjs';
17
- import { wranglerValidatorPlugin } from './packem_shared/wranglerValidatorPlugin-Cf0nLP7-.mjs';
18
+ import { wranglerValidatorPlugin } from './packem_shared/wranglerValidatorPlugin-DggqUjxL.mjs';
18
19
  export { reconcileWranglerCrons } from './packem_shared/reconcileWranglerCrons-PxGwfCp_.mjs';
19
20
 
20
21
  const agentRulesHintPlugin = (options) => {
@@ -26,7 +27,7 @@ const agentRulesHintPlugin = (options) => {
26
27
  return;
27
28
  }
28
29
  server.config.logger.warn(`
29
- [lunora] ${AGENT_RULES_HINT}
30
+ ${lunoraLine(AGENT_RULES_HINT)}
30
31
  `);
31
32
  };
32
33
  },
@@ -50,12 +51,12 @@ const FRAMEWORK_LABELS = {
50
51
  const formatFrameworkDetection = (detection) => {
51
52
  const label = FRAMEWORK_LABELS[detection.framework];
52
53
  if (detection.framework === "none") {
53
- return "[lunora] no meta-framework detected — running standalone (class C).";
54
+ return lunoraLine("no meta-framework detected — running standalone.");
54
55
  }
55
56
  if (detection.class === "B") {
56
- return `[lunora] detected ${label} (class B) hook-injection composition is handled by the framework adapter (not yet wired here).`;
57
+ return lunoraLine(`detected ${label} — composition is handled by the framework adapter.`);
57
58
  }
58
- return `[lunora] detected ${label} (class ${detection.class}) — composing the Lunora worker into one Cloudflare Worker.`;
59
+ return lunoraLine(`detected ${label} — composing the Lunora worker into one Cloudflare Worker.`);
59
60
  };
60
61
  const frameworkDetectPlugin = (options, context) => {
61
62
  let logged = false;
@@ -1,4 +1,4 @@
1
- import { existsSync } from 'node:fs';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve, join } from 'node:path';
3
3
 
4
4
  const LUNORA_WORKER_VIRTUAL_ID = "virtual:lunora/worker";
@@ -36,18 +36,27 @@ const isAutoComposable = (context) => {
36
36
  return detected?.class === "A" && CLASS_A_WIRING[detected.framework] !== void 0;
37
37
  };
38
38
  const isWorkerVirtualActive = (context) => isAutoComposable(context);
39
- const buildWorkerEntrySource = (framework, generatedImportBase, hasContainers = false) => {
39
+ const projectUsesUmbrella = (projectRoot) => {
40
+ try {
41
+ const pkg = JSON.parse(readFileSync(join(projectRoot, "package.json"), "utf8"));
42
+ return ["dependencies", "devDependencies", "peerDependencies"].some((field) => pkg[field]?.["lunorash"] !== void 0);
43
+ } catch {
44
+ return false;
45
+ }
46
+ };
47
+ const buildWorkerEntrySource = (framework, generatedImportBase, hasContainers = false, useUmbrella = false) => {
40
48
  const wiring = CLASS_A_WIRING[framework];
41
49
  if (wiring === void 0) {
42
50
  throw new Error(`[lunora] no class-A worker wiring for framework "${framework}"`);
43
51
  }
52
+ const runtimeModule = useUmbrella ? "lunorash/runtime" : "@lunora/runtime";
44
53
  const containersReexport = hasContainers ? `
45
54
  export * from "${generatedImportBase}/containers";
46
55
  ` : "";
47
56
  return `// Generated by @lunora/vite — class-A worker composition (PLAN4 M2).
48
57
  // Do not edit: emitted from the detected framework (${framework}). Point your
49
58
  // wrangler \`main\` here (or re-export it) instead of hand-wiring createWorker.
50
- import { composeWorker } from "@lunora/runtime";
59
+ import { composeWorker } from "${runtimeModule}";
51
60
  ${wiring.imports}
52
61
  import { LUNORA_FUNCTIONS } from "${generatedImportBase}/functions";
53
62
  import { openApiSpec } from "${generatedImportBase}/openapi";
@@ -75,11 +84,12 @@ export default {
75
84
  };
76
85
  const frameworkComposePlugin = (options, context) => {
77
86
  const generatedImportBase = resolve(options.projectRoot, options.generatedDir.replace(TRAILING_SLASH, ""));
87
+ const useUmbrella = projectUsesUmbrella(options.projectRoot);
78
88
  return {
79
89
  load(id) {
80
90
  if (id === RESOLVED_LUNORA_WORKER_ID && isWorkerVirtualActive(context) && context.framework !== void 0) {
81
91
  const hasContainers = existsSync(join(generatedImportBase, "containers.ts"));
82
- return buildWorkerEntrySource(context.framework.framework, generatedImportBase, hasContainers);
92
+ return buildWorkerEntrySource(context.framework.framework, generatedImportBase, hasContainers, useUmbrella);
83
93
  }
84
94
  return void 0;
85
95
  },
@@ -3,6 +3,7 @@ import { resolve, sep, join } from 'node:path';
3
3
  import { createCodegenProject, refreshCodegenProject, runCodegen, CodegenDiagnosticError } from '@lunora/codegen';
4
4
  import { inferLunoraBindings, reconcileWranglerBindings } from '@lunora/config';
5
5
  import { reconcileWranglerCrons } from './reconcileWranglerCrons-PxGwfCp_.mjs';
6
+ import { L as LUNORA_TAG } from './log-Bgkv6QhO.mjs';
6
7
 
7
8
  const DEBOUNCE_MS = 100;
8
9
  const TSCONFIG_VARIANT_RE = /[/\\]tsconfig\..+\.json$/u;
@@ -22,23 +23,23 @@ const reconcileBindingsSafely = async (options, logger, onExportGaps) => {
22
23
  const inferred = await inferLunoraBindings({ projectRoot: options.projectRoot, schemaDir: options.schemaDir });
23
24
  const reconciled = reconcileWranglerBindings(options.projectRoot, inferred);
24
25
  if (reconciled.changed) {
25
- logger.info?.(`[lunora] inferred bindings → ${reconciled.added.join(", ")} (written to ${reconciled.wranglerPath ?? "wrangler.jsonc"})`);
26
+ logger.info?.(`${LUNORA_TAG} inferred bindings → ${reconciled.added.join(", ")} (written to ${reconciled.wranglerPath ?? "wrangler.jsonc"})`);
26
27
  }
27
28
  for (const warning of reconciled.warnings) {
28
- logger.warn(`[lunora] ${warning}`);
29
+ logger.warn(`${LUNORA_TAG} ${warning}`);
29
30
  }
30
31
  if (reconciled.exportGaps.length > 0) {
31
32
  onExportGaps?.(reconciled.exportGaps);
32
33
  }
33
34
  } catch (error) {
34
35
  const message = error instanceof Error ? error.message : String(error);
35
- logger.warn(`[lunora] binding inference skipped: ${message}`);
36
+ logger.warn(`${LUNORA_TAG} binding inference skipped: ${message}`);
36
37
  }
37
38
  };
38
39
  const runCodegenSafely = (options, logger, overlay, project) => {
39
40
  const schemaPath = join(options.projectRoot, options.schemaDir, "schema.ts");
40
41
  if (!existsSync(schemaPath)) {
41
- logger.warn(`[lunora] schema.ts not found at ${schemaPath} — codegen skipped`);
42
+ logger.warn(`${LUNORA_TAG} schema.ts not found at ${schemaPath} — codegen skipped`);
42
43
  return void 0;
43
44
  }
44
45
  try {
@@ -46,19 +47,21 @@ const runCodegenSafely = (options, logger, overlay, project) => {
46
47
  try {
47
48
  const reconciled = reconcileWranglerCrons(options.projectRoot, result.cronTriggers);
48
49
  if (reconciled.changed) {
49
- logger.info?.(`[lunora] synced ${result.cronTriggers.length.toFixed(0)} cron trigger(s) into ${reconciled.wranglerPath ?? "wrangler.jsonc"}`);
50
+ logger.info?.(
51
+ `${LUNORA_TAG} synced ${result.cronTriggers.length.toFixed(0)} cron trigger(s) into ${reconciled.wranglerPath ?? "wrangler.jsonc"}`
52
+ );
50
53
  }
51
54
  } catch (cronError) {
52
55
  const message = cronError instanceof Error ? cronError.message : String(cronError);
53
- logger.warn(`[lunora] cron trigger sync skipped: ${message}`);
56
+ logger.warn(`${LUNORA_TAG} cron trigger sync skipped: ${message}`);
54
57
  }
55
58
  for (const advisory of result.advisories) {
56
- logger.warn(`[lunora] schema advisory [${advisory.level}] ${advisory.name}: ${advisory.detail} — ${advisory.remediation}`);
59
+ logger.warn(`${LUNORA_TAG} schema advisory [${advisory.level}] ${advisory.name}: ${advisory.detail} — ${advisory.remediation}`);
57
60
  }
58
61
  return resolve(result.outputDirectory);
59
62
  } catch (error) {
60
63
  const message = error instanceof Error ? error.message : String(error);
61
- logger.error(`[lunora] codegen failed: ${message}`);
64
+ logger.error(`${LUNORA_TAG} codegen failed: ${message}`);
62
65
  overlay?.onError(error, message);
63
66
  return void 0;
64
67
  }
@@ -1,4 +1,5 @@
1
1
  import { ensureDevVariables, createConfirm } from '@lunora/config';
2
+ import { l as lunoraLine } from './log-Bgkv6QhO.mjs';
2
3
 
3
4
  const devVariablesPlugin = (options) => {
4
5
  return {
@@ -8,7 +9,7 @@ const devVariablesPlugin = (options) => {
8
9
  confirm: createConfirm("[lunora] "),
9
10
  cwd: options.projectRoot,
10
11
  info: (message) => {
11
- console.info(`[lunora] ${message}`);
12
+ console.info(lunoraLine(message));
12
13
  }
13
14
  });
14
15
  },
@@ -0,0 +1,6 @@
1
+ import { paintBadge, BADGES } from '@lunora/config';
2
+
3
+ const LUNORA_TAG = paintBadge(BADGES.lunora);
4
+ const lunoraLine = (message) => `${LUNORA_TAG} ${message}`;
5
+
6
+ export { LUNORA_TAG as L, lunoraLine as l };
@@ -1,5 +1,6 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  import { validateWranglerProject, readWranglerJsonc } from '@lunora/config';
3
+ import { l as lunoraLine } from './log-Bgkv6QhO.mjs';
3
4
 
4
5
  const isLocalImagePath = (image) => image.startsWith("./") || image.startsWith("../") || image.startsWith("/") || image.includes("Dockerfile");
5
6
  const probeDocker = () => {
@@ -16,7 +17,9 @@ const warnWhenDockerMissing = (wranglerPath, dockerAvailable = probeDocker) => {
16
17
  return;
17
18
  }
18
19
  console.warn(
19
- "[lunora] wrangler.jsonc declares containers built from a local Dockerfile, but no Docker-compatible engine is running. Start Docker (or Colima) before `vite dev`, or the container instances will fail to start."
20
+ lunoraLine(
21
+ "wrangler.jsonc declares containers built from a local Dockerfile, but no Docker-compatible engine is running. Start Docker (or Colima) before `vite dev`, or the container instances will fail to start."
22
+ )
20
23
  );
21
24
  };
22
25
  const formatError = (wranglerPath, problems) => {
@@ -48,7 +51,7 @@ const wranglerValidatorPlugin = (options) => {
48
51
  }
49
52
  if (result.report.warnings.length > 0) {
50
53
  for (const warning of result.report.warnings) {
51
- console.warn(`[lunora] wrangler validator: ${warning}`);
54
+ console.warn(lunoraLine(`wrangler validator: ${warning}`));
52
55
  }
53
56
  }
54
57
  if (result.problems.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vite",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "The Lunora Vite plugin: codegen, type sync, wrangler validation, and an error overlay over @cloudflare/vite-plugin",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@cloudflare/vite-plugin": "1.42.0",
49
49
  "@lunora/codegen": "1.0.0-alpha.3",
50
- "@lunora/config": "1.0.0-alpha.4",
50
+ "@lunora/config": "1.0.0-alpha.5",
51
51
  "@visulima/vite-overlay": "2.0.0-alpha.35",
52
52
  "jsonc-parser": "^3.3.1",
53
53
  "ts-morph": "^28.0.0"