@lunora/vite 1.0.0-alpha.69 → 1.0.0-alpha.70

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
@@ -2,7 +2,7 @@ import { CodegenOptions } from '@lunora/codegen';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { Plugin } from 'vite';
4
4
  import { FrameworkDetection, DetectedFramework, materializeRemoteWranglerConfig, readProjectRemotePreference } from '@lunora/config';
5
- export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, detectFramework } from '@lunora/config';
5
+ export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, type ReconcileCronsResult as ReconcileResult, detectFramework, reconcileWranglerCrons } from '@lunora/config';
6
6
  import { AddressInfo } from 'node:net';
7
7
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
8
8
  type CloudflarePluginOptions = Record<string, unknown>;
@@ -90,29 +90,6 @@ declare const codegenPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
90
90
  * engine degrades to a single warning rather than breaking dev.
91
91
  */
92
92
  declare const containerLogsPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
93
- interface ReconcileResult {
94
- /** `true` when `wrangler.jsonc` was rewritten. */
95
- changed: boolean;
96
- /** Human-readable reason when reconciliation was skipped (for logging). */
97
- reason?: string;
98
- /** Resolved wrangler path, or `undefined` when none was found. */
99
- wranglerPath?: string;
100
- }
101
- /**
102
- * Reconcile the codegen-derived cron schedules into the project's
103
- * `wrangler.jsonc` `triggers.crons` array, preserving comments and formatting
104
- * via `jsonc-parser`'s structural edits.
105
- *
106
- * When `triggers.crons` already matches `cronTriggers`, nothing is written (so
107
- * we don't churn the file or trip the dev server's file watcher). When the
108
- * project declares no crons, a stale non-empty array is cleared so removed
109
- * crons stop firing.
110
- *
111
- * This intentionally writes the SAME `triggers.crons` shape the
112
- * `@lunora/config` validator accepts, so the wrangler validator never fights
113
- * the generated value.
114
- */
115
- declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
116
93
  /** Vite plugin (serve-only) that writes the dev-server state record on listen and clears it on close. */
117
94
  declare const devStatePlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
118
95
  /**
@@ -485,4 +462,4 @@ declare const resolveOverlayOption: (overlay: LunoraPluginOptions["overlay"]) =>
485
462
  */
486
463
  declare const lunora: (options?: LunoraPluginOptions) => LunoraPlugins;
487
464
  declare const VERSION: string;
488
- export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type OverlayPluginOptions, type PlanViteRemoteOptions, type ReconcileResult, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, codegenPlugin, containerLogsPlugin, createCommandProbe, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, reconcileWranglerCrons, remoteBindingsCleanupPlugin, remoteBindingsConfigPlugin, resolveOverlayOption, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
465
+ export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, codegenPlugin, containerLogsPlugin, createCommandProbe, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, remoteBindingsCleanupPlugin, remoteBindingsConfigPlugin, resolveOverlayOption, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { CodegenOptions } from '@lunora/codegen';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { Plugin } from 'vite';
4
4
  import { FrameworkDetection, DetectedFramework, materializeRemoteWranglerConfig, readProjectRemotePreference } from '@lunora/config';
5
- export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, detectFramework } from '@lunora/config';
5
+ export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, type ReconcileCronsResult as ReconcileResult, detectFramework, reconcileWranglerCrons } from '@lunora/config';
6
6
  import { AddressInfo } from 'node:net';
7
7
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
8
8
  type CloudflarePluginOptions = Record<string, unknown>;
@@ -90,29 +90,6 @@ declare const codegenPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
90
90
  * engine degrades to a single warning rather than breaking dev.
91
91
  */
92
92
  declare const containerLogsPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
93
- interface ReconcileResult {
94
- /** `true` when `wrangler.jsonc` was rewritten. */
95
- changed: boolean;
96
- /** Human-readable reason when reconciliation was skipped (for logging). */
97
- reason?: string;
98
- /** Resolved wrangler path, or `undefined` when none was found. */
99
- wranglerPath?: string;
100
- }
101
- /**
102
- * Reconcile the codegen-derived cron schedules into the project's
103
- * `wrangler.jsonc` `triggers.crons` array, preserving comments and formatting
104
- * via `jsonc-parser`'s structural edits.
105
- *
106
- * When `triggers.crons` already matches `cronTriggers`, nothing is written (so
107
- * we don't churn the file or trip the dev server's file watcher). When the
108
- * project declares no crons, a stale non-empty array is cleared so removed
109
- * crons stop firing.
110
- *
111
- * This intentionally writes the SAME `triggers.crons` shape the
112
- * `@lunora/config` validator accepts, so the wrangler validator never fights
113
- * the generated value.
114
- */
115
- declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
116
93
  /** Vite plugin (serve-only) that writes the dev-server state record on listen and clears it on close. */
117
94
  declare const devStatePlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
118
95
  /**
@@ -485,4 +462,4 @@ declare const resolveOverlayOption: (overlay: LunoraPluginOptions["overlay"]) =>
485
462
  */
486
463
  declare const lunora: (options?: LunoraPluginOptions) => LunoraPlugins;
487
464
  declare const VERSION: string;
488
- export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type OverlayPluginOptions, type PlanViteRemoteOptions, type ReconcileResult, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, codegenPlugin, containerLogsPlugin, createCommandProbe, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, reconcileWranglerCrons, remoteBindingsCleanupPlugin, remoteBindingsConfigPlugin, resolveOverlayOption, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
465
+ export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, codegenPlugin, containerLogsPlugin, createCommandProbe, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, remoteBindingsCleanupPlugin, remoteBindingsConfigPlugin, resolveOverlayOption, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
package/dist/index.mjs CHANGED
@@ -2,9 +2,9 @@ import { createRequire } from 'node:module';
2
2
  import { cloudflare } from '@cloudflare/vite-plugin';
3
3
  import errorOverlayPlugin from '@visulima/vite-overlay';
4
4
  import { detectAgentRules, claimAgentRulesHint, AGENT_RULES_HINT, detectFramework } from '@lunora/config';
5
- export { detectFramework } from '@lunora/config';
5
+ export { detectFramework, reconcileWranglerCrons } from '@lunora/config';
6
6
  import { l as lunoraLine } from './packem_shared/log-BjO9EWah.mjs';
7
- import codegenPlugin from './packem_shared/codegenPlugin-AvEbFKni.mjs';
7
+ import codegenPlugin from './packem_shared/codegenPlugin-B8c38rky.mjs';
8
8
  import containerLogsPlugin from './packem_shared/containerLogsPlugin-DMssU3wb.mjs';
9
9
  import devStatePlugin from './packem_shared/devStatePlugin-DdjfMrhx.mjs';
10
10
  import devVariablesPlugin from './packem_shared/devVariablesPlugin-CDNSnvOP.mjs';
@@ -22,7 +22,6 @@ export { STUDIO_PATH, buildStudioUrl } from './packem_shared/STUDIO_PATH-U0eIaW1
22
22
  import { withWorkerStartupHint } from './packem_shared/WORKER_STARTUP_HINT-DhsXUW8k.mjs';
23
23
  export { WORKER_STARTUP_HINT, augmentWorkerStartupError, isWorkerEntryEvalError } from './packem_shared/WORKER_STARTUP_HINT-DhsXUW8k.mjs';
24
24
  import { wranglerValidatorPlugin } from './packem_shared/wranglerValidatorPlugin-C5VWOD7N.mjs';
25
- export { reconcileWranglerCrons } from './packem_shared/reconcileWranglerCrons-PxGwfCp_.mjs';
26
25
  export { default as LUNORA_API_UPDATED_EVENT } from './packem_shared/LUNORA_API_UPDATED_EVENT-BrkWk3rr.mjs';
27
26
 
28
27
  const agentRulesHintPlugin = (options) => {
@@ -1,9 +1,8 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { join, resolve, sep, basename } from 'node:path';
3
3
  import { createCodegenProject, refreshCodegenProject, runCodegen, CodegenDiagnosticError } from '@lunora/codegen';
4
- import { findWranglerFile, LUNORA_CONFIG_FILE, readWranglerJsonc, WRANGLER_FILES, collectWranglerSecretVariables, inferLunoraBindings, reconcileWranglerBindings, reconcileWranglerCompatibilityDate } from '@lunora/config';
4
+ import { findWranglerFile, LUNORA_CONFIG_FILE, readWranglerJsonc, WRANGLER_FILES, collectWranglerSecretVariables, inferLunoraBindings, reconcileWranglerBindings, reconcileWranglerCrons, reconcileWranglerCompatibilityDate } from '@lunora/config';
5
5
  import { isRunnableDevEnvironment } from 'vite';
6
- import { reconcileWranglerCrons } from './reconcileWranglerCrons-PxGwfCp_.mjs';
7
6
  import LUNORA_API_UPDATED_EVENT from './LUNORA_API_UPDATED_EVENT-BrkWk3rr.mjs';
8
7
  import { L as LUNORA_TAG, a as advisoryLine } from './log-BjO9EWah.mjs';
9
8
  import { r as runPendingClose, a as registerDevServerClose } from './server-close-DKDp7YTU.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vite",
3
- "version": "1.0.0-alpha.69",
3
+ "version": "1.0.0-alpha.70",
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",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@cloudflare/vite-plugin": "1.43.0",
49
- "@lunora/codegen": "1.0.0-alpha.45",
50
- "@lunora/config": "1.0.0-alpha.69",
49
+ "@lunora/codegen": "1.0.0-alpha.46",
50
+ "@lunora/config": "1.0.0-alpha.70",
51
51
  "@lunora/errors": "1.0.0-alpha.5",
52
52
  "@visulima/vite-overlay": "2.0.0",
53
53
  "jsonc-parser": "^3.3.1",
@@ -1,29 +0,0 @@
1
- import { writeFileSync } from 'node:fs';
2
- import { findWranglerFile, readWranglerJsonc } from '@lunora/config';
3
- import { modify, applyEdits } from 'jsonc-parser';
4
-
5
- const sameTriggers = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
6
- const reconcileWranglerCrons = (projectRoot, cronTriggers) => {
7
- const wranglerPath = findWranglerFile(projectRoot);
8
- if (!wranglerPath) {
9
- return { changed: false, reason: "wrangler.jsonc not found" };
10
- }
11
- const { parsed, text } = readWranglerJsonc(wranglerPath);
12
- if (parsed === void 0) {
13
- return { changed: false, reason: `failed to parse ${wranglerPath} as JSONC`, wranglerPath };
14
- }
15
- const existing = Array.isArray(parsed.triggers?.crons) ? parsed.triggers.crons.filter((value) => typeof value === "string") : [];
16
- if (sameTriggers(existing, cronTriggers)) {
17
- return { changed: false, reason: "triggers.crons already in sync", wranglerPath };
18
- }
19
- const edits = modify(text, ["triggers", "crons"], [...cronTriggers], {
20
- formattingOptions: { insertSpaces: true, tabSize: 4 }
21
- });
22
- if (edits.length === 0) {
23
- return { changed: false, reason: "no structural edit produced", wranglerPath };
24
- }
25
- writeFileSync(wranglerPath, applyEdits(text, edits), "utf8");
26
- return { changed: true, wranglerPath };
27
- };
28
-
29
- export { reconcileWranglerCrons };