@lunora/config 1.0.0-alpha.470 → 1.0.0-alpha.471
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/cloudflare/index.mjs +1 -1
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs +4 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs +1 -0
- package/dist/packem_shared/{collectExportGaps-DHUtghqe.mjs → collectExportGaps-DvirOIVB.mjs} +1 -1
- package/dist/packem_shared/describeWithheld-CN3D-4pU.mjs +1 -0
- package/dist/packem_shared/inferLunoraBindings-BUk28bSQ.mjs +1 -0
- package/dist/packem_shared/is-within-directory-DRMw89rK.mjs +1 -0
- package/dist/packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs +1 -0
- package/dist/packem_shared/{pendingBindingChanges-DqP40pSQ.mjs → pendingBindingChanges-DkVojIQe.mjs} +1 -1
- package/dist/packem_shared/{reconcileWranglerBindings-DAdI2Z-R.mjs → reconcileWranglerBindings-D6B81UKU.mjs} +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs +0 -4
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D66_hwjD.mjs +0 -1
- package/dist/packem_shared/describeWithheld-CbyzZjZF.mjs +0 -1
- package/dist/packem_shared/inferLunoraBindings-Biq1OW9V.mjs +0 -1
- package/dist/packem_shared/materializeServiceDevConfigs-CI1HXv7f.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{reconcileWranglerBindings as a}from"../packem_shared/reconcileWranglerBindings-
|
|
1
|
+
import{applyModify as o}from"../packem_shared/applyModify-DKP2l6S9.mjs";import{reconcileWranglerBindings as a}from"../packem_shared/reconcileWranglerBindings-D6B81UKU.mjs";import{assertWranglerSatisfiesSchema as n}from"../packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs";import{w as s}from"../packem_shared/asset-headers-CPuEX21i.mjs";import{BINDING_MANIFEST_VERSION as m,buildBindingManifest as p}from"../packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs";import{CLOUDFLARE_CLI_CONFIG_WARNING_ENV as E,detectCloudflareCliConfig as g,warnCloudflareCliConfigOnce as x}from"../packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs";import{default as c}from"../packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs";import{default as _}from"../packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs";import{hasCloudflareCredentials as L}from"../packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs";import{describeWithheld as S,withheldBindings as D}from"../packem_shared/describeWithheld-CN3D-4pU.mjs";import{bindingsNeedingDatabase as W,startLocalHyperdrive as T}from"../packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs";import{readManifest as v,recordManifestKey as B}from"../packem_shared/readManifest-Cighz3WC.mjs";import{HYPERDRIVE_PLACEHOLDER_ID as b}from"../packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{emitProjectAssetHeaders as h}from"../packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs";import{collectExportGaps as M}from"../packem_shared/collectExportGaps-DvirOIVB.mjs";import{reconcileWranglerCompatibilityDate as w}from"../packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{describePreservedCrons as H,reconcileWranglerCrons as U}from"../packem_shared/describePreservedCrons-i5XT6rtl.mjs";import{pendingBindingChanges as Y,reconcileBindingsSafely as K,reconcileStudioAssets as j,reconcileWranglerExtras as z}from"../packem_shared/pendingBindingChanges-DkVojIQe.mjs";import{REMOTE_ELIGIBLE_KEYS as J,injectRemoteFlags as X,isRemoteEnvEnabled as k,materializeDevWranglerConfig as q,planRemoteBindings as Z,resolveRemoteEnabled as $,toRemotePlan as ee}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs";import{materializeServiceDevConfigs as oe}from"../packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs";import{i as ae}from"../packem_shared/studio-assets-BKWx838V.mjs";import{default as ne}from"../packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs";import{withTailConsumer as se}from"../packem_shared/withTailConsumer-BXOIqXxv.mjs";import{WORKERS_CACHE_MIN_DATE as me,isCacheEnabled as pe}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{wranglerCodegenInputs as Ee}from"../packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs";import{DEFAULT_OBSERVABILITY as xe,resolveObservabilitySampling as Ce}from"../packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{mergeWranglerEnvironment as Re}from"../packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs";import{WRANGLER_FILES as Ie,findWranglerFile as Le,readWranglerJsonc as Ae}from"../packem_shared/WRANGLER_FILES-BF8PUjuo.mjs";import{UNEXPORTED_CLASS_MARKER as De,validateWranglerProject as Oe}from"../packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs";import{scanWranglerVariablesForSecrets as Te}from"../packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs";import{wranglerToAlchemy as ve}from"../packem_shared/wranglerToAlchemy-ClIdvJFu.mjs";import{REQUIRED_COMPATIBILITY_DATE as Fe,REQUIRED_FLAG as be,validateWrangler as ue,validateWranglerConfig as he}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs";export{m as BINDING_MANIFEST_VERSION,E as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,c as CLOUDFLARE_DRIVER,ne as CLOUDFLARE_TOOLCHAIN_VERSIONS,xe as DEFAULT_OBSERVABILITY,_ as GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG,b as HYPERDRIVE_PLACEHOLDER_ID,J as REMOTE_ELIGIBLE_KEYS,Fe as REQUIRED_COMPATIBILITY_DATE,be as REQUIRED_FLAG,De as UNEXPORTED_CLASS_MARKER,me as WORKERS_CACHE_MIN_DATE,Ie as WRANGLER_FILES,o as applyModify,n as assertWranglerSatisfiesSchema,W as bindingsNeedingDatabase,p as buildBindingManifest,M as collectExportGaps,H as describePreservedCrons,S as describeWithheld,g as detectCloudflareCliConfig,h as emitProjectAssetHeaders,Le as findWranglerFile,L as hasCloudflareCredentials,X as injectRemoteFlags,pe as isCacheEnabled,ae as isOwnedStudioAssets,k as isRemoteEnvEnabled,q as materializeDevWranglerConfig,oe as materializeServiceDevConfigs,Re as mergeWranglerEnvironment,Y as pendingBindingChanges,Z as planRemoteBindings,v as readManifest,Ae as readWranglerJsonc,K as reconcileBindingsSafely,j as reconcileStudioAssets,a as reconcileWranglerBindings,w as reconcileWranglerCompatibilityDate,U as reconcileWranglerCrons,z as reconcileWranglerExtras,B as recordManifestKey,Ce as resolveObservabilitySampling,$ as resolveRemoteEnabled,Te as scanWranglerVariablesForSecrets,T as startLocalHyperdrive,ee as toRemotePlan,ue as validateWrangler,he as validateWranglerConfig,Oe as validateWranglerProject,x as warnCloudflareCliConfigOnce,se as withTailConsumer,D as withheldBindings,Ee as wranglerCodegenInputs,ve as wranglerToAlchemy,s as writeAssetHeaders};
|
package/dist/index.d.mts
CHANGED
|
@@ -456,12 +456,27 @@ type DevServerMode = "cli" | "vite";
|
|
|
456
456
|
interface DevServerState {
|
|
457
457
|
/** Whether the server was detached into the background (`lunora dev --background`). */
|
|
458
458
|
background?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* PID of the background launcher that wrote a provisional record. It stays when
|
|
461
|
+
* the launcher re-points `pid` at its child, so only that launcher's handoff
|
|
462
|
+
* (see {@link DEV_HANDOFF_ENV}) replaces the record, never another launch's child.
|
|
463
|
+
*/
|
|
464
|
+
launcherPid?: number;
|
|
459
465
|
/** Absolute path of the log file capturing the server's output, when captured. */
|
|
460
466
|
logFile?: string;
|
|
461
467
|
/** `"cli"` for the `lunora dev` wrangler orchestration, `"vite"` for a Vite dev server. */
|
|
462
468
|
mode: DevServerMode;
|
|
463
469
|
/** PID of the process to signal for shutdown (the orchestrating CLI or the Vite process). */
|
|
464
470
|
pid: number;
|
|
471
|
+
/**
|
|
472
|
+
* `true` while the record is the background launcher's placeholder: `pid` is
|
|
473
|
+
* the launcher (or, after the launcher stopped waiting, the detached child it
|
|
474
|
+
* spawned) and `url` is the origin it guessed before anything listened. The
|
|
475
|
+
* server replaces the whole record with its own pid and resolved URL once it
|
|
476
|
+
* starts, which drops this flag. A provisional record never means a server
|
|
477
|
+
* is serving.
|
|
478
|
+
*/
|
|
479
|
+
provisional?: boolean;
|
|
465
480
|
/**
|
|
466
481
|
* ISO-8601 stamp marking when the server at {@link DevServerState.url} was
|
|
467
482
|
* first observed accepting requests — absent until then.
|
|
@@ -550,6 +565,14 @@ declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServ
|
|
|
550
565
|
* output, and any future reader cannot each invent their own answer.
|
|
551
566
|
*/
|
|
552
567
|
declare const isDevServerReady: (state: Pick<DevServerState, "readyAt"> | undefined) => boolean;
|
|
568
|
+
/** Where a recorded dev server is in its start, as {@link devServerPhase} names it. */
|
|
569
|
+
type DevServerPhase = "launching" | "ready" | "starting";
|
|
570
|
+
/**
|
|
571
|
+
* `launching` while the record is still the background launcher's placeholder
|
|
572
|
+
* (its pid and URL change once the server starts), `starting` once the server
|
|
573
|
+
* recorded itself but has not answered, `ready` once it has.
|
|
574
|
+
*/
|
|
575
|
+
declare const devServerPhase: (state: Pick<DevServerState, "provisional" | "readyAt">) => DevServerPhase;
|
|
553
576
|
/**
|
|
554
577
|
* Remove `.lunora/dev.json`. Idempotent and never throws. When `expectedPid`
|
|
555
578
|
* is given, the file is only removed while it still records that PID — so a
|
|
@@ -1450,4 +1473,4 @@ type ParseSchemaResult = {
|
|
|
1450
1473
|
* message per failure mode without throwing.
|
|
1451
1474
|
*/
|
|
1452
1475
|
declare const parseSchema: (source: string) => ParseSchemaResult;
|
|
1453
|
-
export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
|
|
1476
|
+
export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
|
package/dist/index.d.ts
CHANGED
|
@@ -456,12 +456,27 @@ type DevServerMode = "cli" | "vite";
|
|
|
456
456
|
interface DevServerState {
|
|
457
457
|
/** Whether the server was detached into the background (`lunora dev --background`). */
|
|
458
458
|
background?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* PID of the background launcher that wrote a provisional record. It stays when
|
|
461
|
+
* the launcher re-points `pid` at its child, so only that launcher's handoff
|
|
462
|
+
* (see {@link DEV_HANDOFF_ENV}) replaces the record, never another launch's child.
|
|
463
|
+
*/
|
|
464
|
+
launcherPid?: number;
|
|
459
465
|
/** Absolute path of the log file capturing the server's output, when captured. */
|
|
460
466
|
logFile?: string;
|
|
461
467
|
/** `"cli"` for the `lunora dev` wrangler orchestration, `"vite"` for a Vite dev server. */
|
|
462
468
|
mode: DevServerMode;
|
|
463
469
|
/** PID of the process to signal for shutdown (the orchestrating CLI or the Vite process). */
|
|
464
470
|
pid: number;
|
|
471
|
+
/**
|
|
472
|
+
* `true` while the record is the background launcher's placeholder: `pid` is
|
|
473
|
+
* the launcher (or, after the launcher stopped waiting, the detached child it
|
|
474
|
+
* spawned) and `url` is the origin it guessed before anything listened. The
|
|
475
|
+
* server replaces the whole record with its own pid and resolved URL once it
|
|
476
|
+
* starts, which drops this flag. A provisional record never means a server
|
|
477
|
+
* is serving.
|
|
478
|
+
*/
|
|
479
|
+
provisional?: boolean;
|
|
465
480
|
/**
|
|
466
481
|
* ISO-8601 stamp marking when the server at {@link DevServerState.url} was
|
|
467
482
|
* first observed accepting requests — absent until then.
|
|
@@ -550,6 +565,14 @@ declare const updateDevServerState: (projectRoot: string, patch: Partial<DevServ
|
|
|
550
565
|
* output, and any future reader cannot each invent their own answer.
|
|
551
566
|
*/
|
|
552
567
|
declare const isDevServerReady: (state: Pick<DevServerState, "readyAt"> | undefined) => boolean;
|
|
568
|
+
/** Where a recorded dev server is in its start, as {@link devServerPhase} names it. */
|
|
569
|
+
type DevServerPhase = "launching" | "ready" | "starting";
|
|
570
|
+
/**
|
|
571
|
+
* `launching` while the record is still the background launcher's placeholder
|
|
572
|
+
* (its pid and URL change once the server starts), `starting` once the server
|
|
573
|
+
* recorded itself but has not answered, `ready` once it has.
|
|
574
|
+
*/
|
|
575
|
+
declare const devServerPhase: (state: Pick<DevServerState, "provisional" | "readyAt">) => DevServerPhase;
|
|
553
576
|
/**
|
|
554
577
|
* Remove `.lunora/dev.json`. Idempotent and never throws. When `expectedPid`
|
|
555
578
|
* is given, the file is only removed while it still records that PID — so a
|
|
@@ -1450,4 +1473,4 @@ type ParseSchemaResult = {
|
|
|
1450
1473
|
* message per failure mode without throwing.
|
|
1451
1474
|
*/
|
|
1452
1475
|
declare const parseSchema: (source: string) => ParseSchemaResult;
|
|
1453
|
-
export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
|
|
1476
|
+
export { AGENT_MODE_ENV, type AddIndexEdit, type AddOptionalColumnEdit, type AddTableEdit, type AdditiveEdit, type AgentDetection, type ApplyEditResult, type ApplyFailureReason, type AugmentPlan, BUILD_ROOT_ENV, BUILD_TARGET_ENV, BUNDLE_META_PATH_ENV, CODEGEN_ENV, type CelldDevSession, type CelldDevSessionOptions, type CelldLineOrigin, type CelldToolchainProbe, type CelldToolchainProbeOptions, type ClaimDevServerStateResult, type ContainerLogLevel, type ContainerLogLine, type ContainerLogSource, type ContainerLogStreamHandle, type ContainerLogStreamOptions, DEFAULT_BUNDLE_META_PATH, DEV_BINDINGS_FILE, DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, type DestructiveEdit, type DetectedFramework, type DevEnvCheck, type DevEnvCheckOptions, type DevProcess, type DevProcessOptions, type DevProcessSpawner, type DevSecretsFillPlan, type DevServerMode, type DevServerPhase, type DevServerState, type DevTriggerHint, type DevTriggerHintOptions, type DiscoverAgentInfoResult, type DiscoverContainerInfoResult, type DiscoverWorkflowInfoResult, type DiscoveryCache, type DockerLike, type EnsureDevVariablesDeps, type EnsureDevVariablesResult, type EnsureDevVariablesStatus, type EnvKeyFailure, type FillDevSecretsResult, type FindingLogger, type FrameworkClass, type FrameworkDetection, type HookLogger, type HookSpawnDescriptor, type HookSpawner, LAZY_FUNCTIONS_ENV, LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, LUNORA_EVENT_SOURCE, LUNORA_IGNORED_PATHS, type LinkedProject, type LintIgnoreOutcome, type LintIgnoreStatus, type LintTool, type LocalWorkerEnv, type LocalWorkerEnvOptions, type LunoraFormattedLine, type LunoraLineLevel, type MarkedApiSpec, MissingBuildOutputError, type MultiSelectOption, PACKAGE_SECRETS_REGISTRY, type ParseSchemaResult, type PostCodegenHookResult, type RemotePreference, STRICT_ADVISORIES_ENV, type ScaffoldPlan, type SchemaColumn, type SchemaEdit, type SchemaIndex, type SchemaTable, type SecretEntry, type SelectOption, acceptsConnection, applyAdditiveEdit, applyLintIgnores, assertBuildTargetMatches, blockingFindingsMessage, buildPackageSecretsBlock, canonicalPath, checkDevEnv, claimDevServerState, classifyEdit, clearApiSpecMarker, clearDevServerState, createConfirm, describeDevEnvCheck, detectAiAgent, detectFramework, detectLintTools, devServerPhase, devTriggerHints, discoverAgentInfo, discoverContainerInfo, discoverWorkflowInfo, ensureDevVariables, ensureDevVariablesExample as ensureDevVarsExample, ensureDevWorkerEnv, ensureGitignoreEntries, escapeRegExp, fillDevSecrets, formatDevBannerRow, formatLunoraEvent, generateSecretValue, interpretRemote, isCodegenDisabled, isDevServerReady, isInteractive, isLazyFunctionsEnabled, isMintableSecretKey, isPlaceholderValue, isProcessAlive, isRecordedProcessCurrent, mintableSecretKeysFor, parseDevVariableEntries, parseSchema, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, probeCelldToolchain, projectUsesUmbrella, promptMultiSelect, promptSelect, promptText, promptYesNo, readApiSpecMarker, readDevServerState, readDevVariablesRecord, readLinkedProject, readLiveDevServerState, readProjectRemotePreference, readProjectTarget, removeDevVariableLine, reportCodegenFindings, requiredSecrets, resolveLazyFunctions, resolveLocalWorkerEnv, resolveProjectTarget, resolveSchemaDirectory, resolveTargetOrThrow, runPostCodegenHook, secretsForPackages, startCelldDevSession, startDevProcess, streamContainerLogs, updateDevServerState, upsertDevVariableLine, wranglerDotenvFiles, writeApiSpecMarker, writeCelldDevProjection, writeDevServerState, writeDevVariablesFileAtomically, writeLinkedProject };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as c,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as _,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as m,readApiSpecMarker as A,writeApiSpecMarker as f}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as L}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as N}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as T}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as V}from"./packem_shared/startCelldDevSession-DfuDVsha.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as F,CODEGEN_ENV as M,DEFAULT_BUNDLE_META_PATH as U,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as w}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as H}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{checkDevEnv as z,describeDevEnvCheck as q}from"./packem_shared/checkDevEnv-BwZSVBbB.mjs";import{acceptsConnection as Z,startDevProcess as Q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as ee,DEV_DAEMON_ENV as re,DEV_HANDOFF_ENV as oe,DEV_LOG_FILE as te,DEV_LOG_FILE_ENV as ae,DEV_STATE_DIR as Ee,DEV_STATE_FILE as ie,claimDevServerState as se,clearDevServerState as ne,isDevServerReady as ce,isProcessAlive as le,isRecordedProcessCurrent as _e,readDevServerState as pe,readLiveDevServerState as De,updateDevServerState as de,writeDevServerState as me}from"./packem_shared/DEV_BINDINGS_FILE-C0ZN_XlP.mjs";import{devTriggerHints as fe,formatDevBannerRow as Se}from"./packem_shared/devTriggerHints-CN_RJxWW.mjs";import{DEV_VARS_EXAMPLE_FILE as ve,DEV_VARS_FILE as Ne,DEV_VARS_KEY_PATTERN as Re,escapeRegExp as Te,parseDevVariableEntries as xe,readDevVariablesRecord as ge,removeDevVariableLine as Ve,upsertDevVariableLine as Ie,wranglerDotenvFiles as ue}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{DEV_WORKER_ENV_VALUE as Pe,DEV_WORKER_ENV_VAR as Ce,ensureDevWorkerEnv as Fe}from"./packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs";import{createDiscoveryCache as Ue}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as Ge,deployTargetIds as be,isRunnableTarget as ye,planToolchainInvocation as ke,resolveDeployDriver as he,runnableTargetIds as we,targetRunsOwnDevServer as je}from"./packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";import{default as Ke}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as Ye,secretSourcesFromBindings as Je}from"./packem_shared/inferLunoraBindings-Biq1OW9V.mjs";import{LINKED_PROJECT_DIR as qe,LINKED_PROJECT_FILE as Xe,readLinkedProject as Ze,writeLinkedProject as Qe}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as er,applyLintIgnores as rr,detectLintTools as or}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{resolveLocalWorkerEnv as ar}from"./packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs";import{blockingFindingsMessage as ir,reportCodegenFindings as sr}from"./packem_shared/blockingFindingsMessage-BQ9z7cie.mjs";import{LUNORA_EVENT_SOURCE as cr,formatLunoraEvent as lr}from"./packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs";import{LUNORA_TAG as pr,advisoryLine as Dr,lunoraLine as dr}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as Ar}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Sr,detectInstalledManagers as Lr,detectPackageManager as vr,execArgsFor as Nr,installArgsFor as Rr,runScriptArgsFor as Tr,runScriptCommand as xr,toolchainExecArgs as gr}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{PACKAGE_SECRETS_REGISTRY as Ir,mintableSecretKeysFor as ur,secretsForPackages as Or}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{runPostCodegenHook as Cr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as Mr,interpretRemote as Ur,readProjectRemotePreference as Br,readProjectTarget as Gr,resolveProjectTarget as br,resolveTargetOrThrow as yr}from"./packem_shared/assertBuildTargetMatches-D11J7F38.mjs";import{readProjectDependencies as hr,readProjectDependencyNames as wr,readProjectManifest as jr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Kr,isInteractive as Wr,promptMultiSelect as Yr,promptSelect as Jr,promptText as zr,promptYesNo as qr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Zr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as $r,ensureDevVariables as eo,ensureDevVarsExample as ro,fillDevSecrets as oo,generateSecretValue as to,isMintableSecretKey as ao,isPlaceholderValue as Eo,planDevSecretsFill as io,planDevVariablesAugment as so,planDevVariablesScaffold as no,requiredSecrets as co,writeDevVariablesFileAtomically as lo}from"./packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs";import{applyAdditiveEdit as po,classifyEdit as Do}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as Ao}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as So,resolveServerModule as Lo,scaffoldPolicyFile as vo,wireRlsIntoProcedure as No}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as To}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as go,BADGES as Vo,BADGE_COLUMN_WIDTH as Io,LUNA_ART as uo,LUNA_BUNNY as Oo,LUNA_NAME as Po,LUNA_SIGNOFF as Co,STEP_BADGE_NAMES as Fo,badgeLead as Mo,badgeWidth as Uo,padBadge as Bo,paintAnswer as Go,paintBadge as bo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as ko,DURABLE_OBJECT_BINDINGS as ho,GENERATED_CLASS_MODULES as wo,GENERATED_MODULE_DURABLE_OBJECTS as jo,MERGED_DURABLE_OBJECTS_MODULE as Ho,isMergedProject as Ko,isMergedRoleModule as Wo}from"./packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as Jo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";import{ENV_FILENAME as qo}from"@lunora/codegen";export{go as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,c as AGENT_RULES_HINT_ENV,Vo as BADGES,Io as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,F as BUNDLE_META_PATH_ENV,M as CODEGEN_ENV,ko as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,U as DEFAULT_BUNDLE_META_PATH,Ge as DEFAULT_DEPLOY_TARGET,ee as DEV_BINDINGS_FILE,re as DEV_DAEMON_ENV,oe as DEV_HANDOFF_ENV,te as DEV_LOG_FILE,ae as DEV_LOG_FILE_ENV,Ee as DEV_STATE_DIR,ie as DEV_STATE_FILE,ve as DEV_VARS_EXAMPLE_FILE,Ne as DEV_VARS_FILE,Re as DEV_VARS_KEY_PATTERN,Pe as DEV_WORKER_ENV_VALUE,Ce as DEV_WORKER_ENV_VAR,ho as DURABLE_OBJECT_BINDINGS,qo as ENV_FILENAME,wo as GENERATED_CLASS_MODULES,jo as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,qe as LINKED_PROJECT_DIR,Xe as LINKED_PROJECT_FILE,uo as LUNA_ART,Oo as LUNA_BUNNY,Po as LUNA_NAME,Co as LUNA_SIGNOFF,cr as LUNORA_EVENT_SOURCE,er as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,pr as LUNORA_TAG,Ar as LunoraReporter,Ho as MERGED_DURABLE_OBJECTS_MODULE,L as MissingBuildOutputError,Ir as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Fo as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,Z as acceptsConnection,Sr as addArgsFor,Dr as advisoryLine,po as applyAdditiveEdit,rr as applyLintIgnores,Mr as assertBuildTargetMatches,Mo as badgeLead,Uo as badgeWidth,ir as blockingFindingsMessage,$r as buildPackageSecretsBlock,N as canonicalPath,z as checkDevEnv,p as claimAgentRulesHint,se as claimDevServerState,Do as classifyEdit,So as classifyPolicyEdit,m as clearApiSpecMarker,ne as clearDevServerState,Kr as createConfirm,Ue as createDiscoveryCache,be as deployTargetIds,q as describeDevEnvCheck,D as detectAgentRules,t as detectAiAgent,W as detectFramework,Lr as detectInstalledManagers,or as detectLintTools,vr as detectPackageManager,fe as devTriggerHints,E as discoverAgentInfo,w as discoverContainerInfo,To as discoverSchemaInfo,Jo as discoverWorkflowInfo,eo as ensureDevVariables,ro as ensureDevVarsExample,Fe as ensureDevWorkerEnv,Ke as ensureGitignoreEntries,Te as escapeRegExp,Nr as execArgsFor,oo as fillDevSecrets,Se as formatDevBannerRow,lr as formatLunoraEvent,to as generateSecretValue,Ye as inferLunoraBindings,Rr as installArgsFor,Ur as interpretRemote,b as isCodegenDisabled,ce as isDevServerReady,Wr as isInteractive,y as isLazyFunctionsEnabled,Ko as isMergedProject,Wo as isMergedRoleModule,ao as isMintableSecretKey,Eo as isPlaceholderValue,le as isProcessAlive,_e as isRecordedProcessCurrent,ye as isRunnableTarget,dr as lunoraLine,ur as mintableSecretKeysFor,Bo as padBadge,Go as paintAnswer,bo as paintBadge,xe as parseDevVariableEntries,Ao as parseSchema,io as planDevSecretsFill,so as planDevVariablesAugment,no as planDevVariablesScaffold,ke as planToolchainInvocation,T as probeCelldToolchain,Y as projectUsesUmbrella,Yr as promptMultiSelect,Jr as promptSelect,zr as promptText,qr as promptYesNo,A as readApiSpecMarker,pe as readDevServerState,ge as readDevVariablesRecord,Ze as readLinkedProject,De as readLiveDevServerState,hr as readProjectDependencies,wr as readProjectDependencyNames,jr as readProjectManifest,Br as readProjectRemotePreference,Gr as readProjectTarget,Ve as removeDevVariableLine,sr as reportCodegenFindings,co as requiredSecrets,he as resolveDeployDriver,k as resolveLazyFunctions,ar as resolveLocalWorkerEnv,br as resolveProjectTarget,Zr as resolveSchemaDirectory,Lo as resolveServerModule,yr as resolveTargetOrThrow,Cr as runPostCodegenHook,Tr as runScriptArgsFor,xr as runScriptCommand,we as runnableTargetIds,vo as scaffoldPolicyFile,Je as secretSourcesFromBindings,Or as secretsForPackages,g as startCelldDevSession,Q as startDevProcess,H as streamContainerLogs,je as targetRunsOwnDevServer,gr as toolchainExecArgs,de as updateDevServerState,Ie as upsertDevVariableLine,No as wireRlsIntoProcedure,ue as wranglerDotenvFiles,f as writeApiSpecMarker,V as writeCelldDevProjection,me as writeDevServerState,lo as writeDevVariablesFileAtomically,Qe as writeLinkedProject};
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-pqFMJBtJ.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as c,LUNORA_SKILL_NAMES as l,ROOT_SKILL_NAME as _,claimAgentRulesHint as p,detectAgentRules as D}from"./packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs";import{clearApiSpecMarker as m,readApiSpecMarker as A,writeApiSpecMarker as f}from"./packem_shared/clearApiSpecMarker-DMGpP41V.mjs";import{MissingBuildOutputError as v}from"./packem_shared/MissingBuildOutputError-BAyekzof.mjs";import{default as N}from"./packem_shared/canonicalPath-DrfMiT3U.mjs";import{probeCelldToolchain as T}from"./packem_shared/probeCelldToolchain-DxDttfHy.mjs";import{startCelldDevSession as g,writeCelldDevProjection as V}from"./packem_shared/startCelldDevSession-DfuDVsha.mjs";import{D1_PLACEHOLDER_ID as u}from"./packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{BUILD_ROOT_ENV as P,BUILD_TARGET_ENV as C,BUNDLE_META_PATH_ENV as F,CODEGEN_ENV as M,DEFAULT_BUNDLE_META_PATH as U,LAZY_FUNCTIONS_ENV as B,STRICT_ADVISORIES_ENV as G,isCodegenDisabled as b,isLazyFunctionsEnabled as y,resolveLazyFunctions as k}from"./packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{discoverContainerInfo as w}from"./packem_shared/discoverContainerInfo-DzXr7Vm3.mjs";import{streamContainerLogs as H}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as W,projectUsesUmbrella as Y}from"./packem_shared/detectFramework-Dfpvu6rD.mjs";import{checkDevEnv as z,describeDevEnvCheck as q}from"./packem_shared/checkDevEnv-BwZSVBbB.mjs";import{acceptsConnection as Z,startDevProcess as Q}from"./packem_shared/acceptsConnection-DHhUYGjT.mjs";import{DEV_BINDINGS_FILE as ee,DEV_DAEMON_ENV as re,DEV_HANDOFF_ENV as oe,DEV_LOG_FILE as te,DEV_LOG_FILE_ENV as ae,DEV_STATE_DIR as Ee,DEV_STATE_FILE as ie,claimDevServerState as se,clearDevServerState as ne,devServerPhase as ce,isDevServerReady as le,isProcessAlive as _e,isRecordedProcessCurrent as pe,readDevServerState as De,readLiveDevServerState as de,updateDevServerState as me,writeDevServerState as Ae}from"./packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs";import{devTriggerHints as Se,formatDevBannerRow as ve}from"./packem_shared/devTriggerHints-CN_RJxWW.mjs";import{DEV_VARS_EXAMPLE_FILE as Ne,DEV_VARS_FILE as Re,DEV_VARS_KEY_PATTERN as Te,escapeRegExp as xe,parseDevVariableEntries as ge,readDevVariablesRecord as Ve,removeDevVariableLine as Ie,upsertDevVariableLine as ue,wranglerDotenvFiles as Oe}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{DEV_WORKER_ENV_VALUE as Ce,DEV_WORKER_ENV_VAR as Fe,ensureDevWorkerEnv as Me}from"./packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs";import{createDiscoveryCache as Be}from"./packem_shared/createDiscoveryCache-npJI4uej.mjs";import{DEFAULT_DEPLOY_TARGET as be,deployTargetIds as ye,isRunnableTarget as ke,planToolchainInvocation as he,resolveDeployDriver as we,runnableTargetIds as je,targetRunsOwnDevServer as He}from"./packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";import{default as We}from"./packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs";import{inferLunoraBindings as Je,secretSourcesFromBindings as ze}from"./packem_shared/inferLunoraBindings-BUk28bSQ.mjs";import{LINKED_PROJECT_DIR as Xe,LINKED_PROJECT_FILE as Ze,readLinkedProject as Qe,writeLinkedProject as $e}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as rr,applyLintIgnores as or,detectLintTools as tr}from"./packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs";import{resolveLocalWorkerEnv as Er}from"./packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs";import{blockingFindingsMessage as sr,reportCodegenFindings as nr}from"./packem_shared/blockingFindingsMessage-BQ9z7cie.mjs";import{LUNORA_EVENT_SOURCE as lr,formatLunoraEvent as _r}from"./packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs";import{LUNORA_TAG as Dr,advisoryLine as dr,lunoraLine as mr}from"./packem_shared/LUNORA_TAG-DQTGPqcJ.mjs";import{default as fr}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as vr,detectInstalledManagers as Lr,detectPackageManager as Nr,execArgsFor as Rr,installArgsFor as Tr,runScriptArgsFor as xr,runScriptCommand as gr,toolchainExecArgs as Vr}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{PACKAGE_SECRETS_REGISTRY as ur,mintableSecretKeysFor as Or,secretsForPackages as Pr}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{runPostCodegenHook as Fr}from"./packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs";import{assertBuildTargetMatches as Ur,interpretRemote as Br,readProjectRemotePreference as Gr,readProjectTarget as br,resolveProjectTarget as yr,resolveTargetOrThrow as kr}from"./packem_shared/assertBuildTargetMatches-D11J7F38.mjs";import{readProjectDependencies as wr,readProjectDependencyNames as jr,readProjectManifest as Hr}from"./packem_shared/readProjectDependencies-l3uhUKjo.mjs";import{createConfirm as Wr,isInteractive as Yr,promptMultiSelect as Jr,promptSelect as zr,promptText as qr,promptYesNo as Xr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{default as Qr}from"./packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs";import{buildPackageSecretsBlock as eo,ensureDevVariables as ro,ensureDevVarsExample as oo,fillDevSecrets as to,generateSecretValue as ao,isMintableSecretKey as Eo,isPlaceholderValue as io,planDevSecretsFill as so,planDevVariablesAugment as no,planDevVariablesScaffold as co,requiredSecrets as lo,writeDevVariablesFileAtomically as _o}from"./packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs";import{applyAdditiveEdit as Do,classifyEdit as mo}from"./packem_shared/applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as fo}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as vo,resolveServerModule as Lo,scaffoldPolicyFile as No,wireRlsIntoProcedure as Ro}from"./packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs";import{discoverSchemaInfo as xo}from"./packem_shared/discoverSchemaInfo-DRPnqgif.mjs";import{ACCENT as Vo,BADGES as Io,BADGE_COLUMN_WIDTH as uo,LUNA_ART as Oo,LUNA_BUNNY as Po,LUNA_NAME as Co,LUNA_SIGNOFF as Fo,STEP_BADGE_NAMES as Mo,badgeLead as Uo,badgeWidth as Bo,padBadge as Go,paintAnswer as bo,paintBadge as yo}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as ho,DURABLE_OBJECT_BINDINGS as wo,GENERATED_CLASS_MODULES as jo,GENERATED_MODULE_DURABLE_OBJECTS as Ho,MERGED_DURABLE_OBJECTS_MODULE as Ko,isMergedProject as Wo,isMergedRoleModule as Yo}from"./packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as zo}from"./packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs";import{ENV_FILENAME as Xo}from"@lunora/codegen";export{Vo as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,c as AGENT_RULES_HINT_ENV,Io as BADGES,uo as BADGE_COLUMN_WIDTH,P as BUILD_ROOT_ENV,C as BUILD_TARGET_ENV,F as BUNDLE_META_PATH_ENV,M as CODEGEN_ENV,ho as COMPOSED_WORKER_ENTRY,u as D1_PLACEHOLDER_ID,U as DEFAULT_BUNDLE_META_PATH,be as DEFAULT_DEPLOY_TARGET,ee as DEV_BINDINGS_FILE,re as DEV_DAEMON_ENV,oe as DEV_HANDOFF_ENV,te as DEV_LOG_FILE,ae as DEV_LOG_FILE_ENV,Ee as DEV_STATE_DIR,ie as DEV_STATE_FILE,Ne as DEV_VARS_EXAMPLE_FILE,Re as DEV_VARS_FILE,Te as DEV_VARS_KEY_PATTERN,Ce as DEV_WORKER_ENV_VALUE,Fe as DEV_WORKER_ENV_VAR,wo as DURABLE_OBJECT_BINDINGS,Xo as ENV_FILENAME,jo as GENERATED_CLASS_MODULES,Ho as GENERATED_MODULE_DURABLE_OBJECTS,B as LAZY_FUNCTIONS_ENV,Xe as LINKED_PROJECT_DIR,Ze as LINKED_PROJECT_FILE,Oo as LUNA_ART,Po as LUNA_BUNNY,Co as LUNA_NAME,Fo as LUNA_SIGNOFF,lr as LUNORA_EVENT_SOURCE,rr as LUNORA_IGNORED_PATHS,l as LUNORA_SKILL_NAMES,Dr as LUNORA_TAG,fr as LunoraReporter,Ko as MERGED_DURABLE_OBJECTS_MODULE,v as MissingBuildOutputError,ur as PACKAGE_SECRETS_REGISTRY,_ as ROOT_SKILL_NAME,Mo as STEP_BADGE_NAMES,G as STRICT_ADVISORIES_ENV,Z as acceptsConnection,vr as addArgsFor,dr as advisoryLine,Do as applyAdditiveEdit,or as applyLintIgnores,Ur as assertBuildTargetMatches,Uo as badgeLead,Bo as badgeWidth,sr as blockingFindingsMessage,eo as buildPackageSecretsBlock,N as canonicalPath,z as checkDevEnv,p as claimAgentRulesHint,se as claimDevServerState,mo as classifyEdit,vo as classifyPolicyEdit,m as clearApiSpecMarker,ne as clearDevServerState,Wr as createConfirm,Be as createDiscoveryCache,ye as deployTargetIds,q as describeDevEnvCheck,D as detectAgentRules,t as detectAiAgent,W as detectFramework,Lr as detectInstalledManagers,tr as detectLintTools,Nr as detectPackageManager,ce as devServerPhase,Se as devTriggerHints,E as discoverAgentInfo,w as discoverContainerInfo,xo as discoverSchemaInfo,zo as discoverWorkflowInfo,ro as ensureDevVariables,oo as ensureDevVarsExample,Me as ensureDevWorkerEnv,We as ensureGitignoreEntries,xe as escapeRegExp,Rr as execArgsFor,to as fillDevSecrets,ve as formatDevBannerRow,_r as formatLunoraEvent,ao as generateSecretValue,Je as inferLunoraBindings,Tr as installArgsFor,Br as interpretRemote,b as isCodegenDisabled,le as isDevServerReady,Yr as isInteractive,y as isLazyFunctionsEnabled,Wo as isMergedProject,Yo as isMergedRoleModule,Eo as isMintableSecretKey,io as isPlaceholderValue,_e as isProcessAlive,pe as isRecordedProcessCurrent,ke as isRunnableTarget,mr as lunoraLine,Or as mintableSecretKeysFor,Go as padBadge,bo as paintAnswer,yo as paintBadge,ge as parseDevVariableEntries,fo as parseSchema,so as planDevSecretsFill,no as planDevVariablesAugment,co as planDevVariablesScaffold,he as planToolchainInvocation,T as probeCelldToolchain,Y as projectUsesUmbrella,Jr as promptMultiSelect,zr as promptSelect,qr as promptText,Xr as promptYesNo,A as readApiSpecMarker,De as readDevServerState,Ve as readDevVariablesRecord,Qe as readLinkedProject,de as readLiveDevServerState,wr as readProjectDependencies,jr as readProjectDependencyNames,Hr as readProjectManifest,Gr as readProjectRemotePreference,br as readProjectTarget,Ie as removeDevVariableLine,nr as reportCodegenFindings,lo as requiredSecrets,we as resolveDeployDriver,k as resolveLazyFunctions,Er as resolveLocalWorkerEnv,yr as resolveProjectTarget,Qr as resolveSchemaDirectory,Lo as resolveServerModule,kr as resolveTargetOrThrow,Fr as runPostCodegenHook,xr as runScriptArgsFor,gr as runScriptCommand,je as runnableTargetIds,No as scaffoldPolicyFile,ze as secretSourcesFromBindings,Pr as secretsForPackages,g as startCelldDevSession,Q as startDevProcess,H as streamContainerLogs,He as targetRunsOwnDevServer,Vr as toolchainExecArgs,me as updateDevServerState,ue as upsertDevVariableLine,Ro as wireRlsIntoProcedure,Oe as wranglerDotenvFiles,f as writeApiSpecMarker,V as writeCelldDevProjection,Ae as writeDevServerState,_o as writeDevVariablesFileAtomically,$e as writeLinkedProject};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as p,readFileSync as a}from"node:fs";import{join as n}from"node:path";const c=".lunora",v=n(c,"dev.json"),k=n(c,"dev.log"),T=n(c,"dev-bindings.json"),U="LUNORA_DEV_DAEMON",P="LUNORA_DEV_LOG_FILE",x="LUNORA_DEV_HANDOFF_PID",D=r=>r!==null&&typeof r=="object",s=(r,t)=>{const e=r[t];return typeof e=="string"&&e.length>0?e:void 0},m=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const t=a(`/proc/${String(r)}/stat`,"utf8"),e=t.slice(t.lastIndexOf(")")+2).split(" "),i=Number(e[19]),o=a("/proc/stat","utf8").split(`
|
|
2
|
+
`).find(l=>l.startsWith("btime ")),d=Number(o?.slice(6));return!Number.isFinite(i)||!Number.isFinite(d)?void 0:d*1e3+i/g*1e3}catch{return}},b=r=>{if(!m(r.pid))return!1;const t=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(t))return!0;const e=A(r.pid);return e===void 0||e<=t+y},f=r=>{const t=n(r,v);if(!p(t))return;let e;try{e=JSON.parse(a(t,"utf8"))}catch{return}if(!D(e)||typeof e.pid!="number")return;const i=s(e,"url");if(i!==void 0)return{background:e.background===!0,launcherPid:typeof e.launcherPid=="number"?e.launcherPid:void 0,logFile:s(e,"logFile"),mode:e.mode==="vite"?"vite":"cli",pid:e.pid,provisional:e.provisional===!0?!0:void 0,readyAt:s(e,"readyAt"),startedAt:s(e,"startedAt"),studioUrl:s(e,"studioUrl"),tunnelUrl:s(e,"tunnelUrl"),url:i}},u=(r,t)=>{try{_(n(r,c),{recursive:!0});const e=n(r,v);return E(e,`${JSON.stringify(t,void 0,2)}
|
|
3
|
+
`,"utf8"),e}catch{return}},C=(r,t,e)=>{const i=f(r);if(i===void 0||e?.expectedPid!==void 0&&i.pid!==e.expectedPid)return;const o={...i,...t};return u(r,o),o},h=r=>r?.readyAt!==void 0,M=r=>r.provisional===!0?"launching":h(r)?"ready":"starting",O=(r,t)=>{try{if(t!==void 0){const e=f(r);if(e!==void 0&&e.pid!==t)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const t=f(r);if(t!==void 0){if(b(t))return t;O(r,t.pid)}},I=(r,t,e)=>{const i=F(r);if(i!==void 0)return e!==void 0&&(i.pid===e||i.provisional===!0&&i.launcherPid===e)?{ok:u(r,t)!==void 0}:i.pid!==t.pid?{existing:i,ok:!1}:{ok:u(r,{...t,tunnelUrl:t.tunnelUrl??i.tunnelUrl})!==void 0}},G=(r,t,e)=>{const i=n(r,v),o=`${JSON.stringify(t,void 0,2)}
|
|
4
|
+
`;for(let d=0;d<2;d+=1)try{return _(n(r,c),{recursive:!0}),E(i,o,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:u(r,t)!==void 0};const S=I(r,t,e?.supersedePid);if(S!==void 0)return S}return{ok:u(r,t)!==void 0}};export{T as DEV_BINDINGS_FILE,U as DEV_DAEMON_ENV,x as DEV_HANDOFF_ENV,k as DEV_LOG_FILE,P as DEV_LOG_FILE_ENV,c as DEV_STATE_DIR,v as DEV_STATE_FILE,G as claimDevServerState,O as clearDevServerState,M as devServerPhase,h as isDevServerReady,m as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,C as updateDevServerState,u as writeDevServerState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as v}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as y,writeDevConfig as E,noopCleanup as R}from"./describeWithheld-CN3D-4pU.mjs";import{readManifest as j}from"./readManifest-Cighz3WC.mjs";import{o as w}from"./reconcile-services-CjgIJKim.mjs";import{findWranglerFile as S,readWranglerJsonc as _}from"./WRANGLER_FILES-BF8PUjuo.mjs";const h={ai:{label:"AI",shape:"object"},ai_search:{label:"AI Search",shape:"array"},ai_search_namespaces:{label:"AI Search namespace",shape:"array"},analytics:{label:"Analytics SQL",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},B=Object.keys(h),m=(e,r)=>typeof e.binding=="string"?e.binding:r,f=(e,r,n,t)=>{const i=[];for(const[s,o]of r.entries())o!=null&&(e==="kv_namespaces"&&(typeof o.id!="string"||o.id==="")||i.push({binding:m(o,`#${String(s)}`),kind:n,path:[...t,s],section:e}));return i},u=(e,r)=>h[e].shape===r,C=(e,r)=>{const{label:n}=h[e];if(u(e,"array"))return f(e,r[e]??[],n,[]);if(u(e,"object")){const t=r[e];return t==null?[]:[{binding:m(t,e),kind:n,path:[],section:e}]}return f(e,r.queues?.producers??[],n,["producers"])},I=e=>B.flatMap(r=>C(r,e)),k=(e,r)=>{let n=e;for(const t of r)n=g(n,[t.section,...t.path,"remote"],!0);return n},W=(e,r)=>({bindings:e.remoteBindings.map(n=>`${n.binding} (${n.kind})`),cleanup:e.cleanup,configPath:e.configPath,enabled:r,reason:e.reason,withheld:e.withheld}),$=e=>{const r=a=>({cleanup:R,reason:a,remoteBindings:[],withheld:[]}),n=S(e.projectRoot);if(!n)return r("wrangler.jsonc not found");const{parsed:t,text:i}=_(n);if(t===void 0)return r(`failed to parse ${n} as JSONC`);const s=w(j(e.projectRoot)),o=e.remote?I(t).filter(a=>a.section!=="services"||!s.has(a.binding)):[],l=y(t,e.hasCredentials??(()=>v({projectRoot:e.projectRoot}))),c=l.some(({kind:a})=>a==="ai")?o.filter(a=>a.section!=="ai"):o;if(c.length===0&&l.length===0)return r(e.remote?"no remote-eligible bindings to proxy":void 0);let d=i;for(const{kind:a}of l)d=g(d,[a],void 0);const b=c.length>0?k(d,c):d,p=E(e.projectRoot,"dev",b,e.projectRoot);return{cleanup:p.cleanup,configPath:p.configPath,remoteBindings:c,withheld:l}},L=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},D=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,k as injectRemoteFlags,L as isRemoteEnvEnabled,$ as materializeDevWranglerConfig,I as planRemoteBindings,D as resolveRemoteEnabled,W as toRemotePlan};
|
package/dist/packem_shared/{collectExportGaps-DHUtghqe.mjs → collectExportGaps-DvirOIVB.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as ee}from"node:module";import{join as V}from"node:path";import{containerBuildTag as ne}from"@lunora/container";import{readJsonSync as se}from"@visulima/fs";import{c as te}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{s as F,d as k,a as ie}from"./studio-assets-BKWx838V.mjs";import{recordManifestKey as oe,readManifest as ae}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as Y,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{n as de,w as ce,p as le,s as Q,o as D,q as C,t as ue}from"./validate-bindings-DSMH8bRQ.mjs";import{parseTree as ge,findNodeAtLocation as me}from"jsonc-parser";import{r as pe,a as fe,p as be,b as he}from"./reconcile-services-CjgIJKim.mjs";import{readFileSync as ve}from"node:fs";import{DEV_VARS_FILE as we,parseDevVariableEntries as _e}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{secretSourcesFromBindings as ye}from"./inferLunoraBindings-
|
|
1
|
+
import{createRequire as ee}from"node:module";import{join as V}from"node:path";import{containerBuildTag as ne}from"@lunora/container";import{readJsonSync as se}from"@visulima/fs";import{c as te}from"./celld-binding-id-9MiUoteo.mjs";import{applyModify as w}from"./applyModify-DKP2l6S9.mjs";import{s as F,d as k,a as ie}from"./studio-assets-BKWx838V.mjs";import{recordManifestKey as oe,readManifest as ae}from"./readManifest-Cighz3WC.mjs";import{D1_PLACEHOLDER_ID as Y,HYPERDRIVE_PLACEHOLDER_ID as re}from"./D1_PLACEHOLDER_ID-ZnDjVymH.mjs";import{n as de,w as ce,p as le,s as Q,o as D,q as C,t as ue}from"./validate-bindings-DSMH8bRQ.mjs";import{parseTree as ge,findNodeAtLocation as me}from"jsonc-parser";import{r as pe,a as fe,p as be,b as he}from"./reconcile-services-CjgIJKim.mjs";import{readFileSync as ve}from"node:fs";import{DEV_VARS_FILE as we,parseDevVariableEntries as _e}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{secretSourcesFromBindings as ye}from"./inferLunoraBindings-BUk28bSQ.mjs";import{requiredSecrets as Se}from"./buildPackageSecretsBlock-DrSD60vH.mjs";import{a as xe}from"./spa-assets-wX8rTPEQ.mjs";import{DEFAULT_OBSERVABILITY as Ee}from"./DEFAULT_OBSERVABILITY-CPLADr5u.mjs";import{findWranglerFile as Ae,readWranglerJsonc as Oe}from"./WRANGLER_FILES-BF8PUjuo.mjs";const ke=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxConcurrency","max_concurrency"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],q=e=>Object.fromEntries(ke.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),P="queueTuning",$e=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,Ne=/^[\t ]*,/u,Ce=(e,n)=>{const s=ge(e),t=s===void 0?void 0:me(s,[...n])?.parent;if(t?.type==="property"){const o=t.offset+t.length,i=e.lastIndexOf(`
|
|
2
2
|
`,t.offset-1)+1,a=$e.exec(e.slice(o));if(a!==null&&e.slice(i,t.offset).trim()===""){const m=t.parent?.children??[],u=m.indexOf(t),d=u===m.length-1&&u>0?m[u-1]:void 0,c=d===void 0?void 0:Ne.exec(e.slice(d.offset+d.length))??void 0;return(c===void 0||d===void 0?e.slice(0,i):e.slice(0,d.offset+d.length)+e.slice(d.offset+d.length+c[0].length,i))+e.slice(o+a[0].length)}}return w(e,n,void 0)},U=(e,n,s,t,o,i=new Set)=>{const a=s.join("."),m={},u=[],d=[];let c=e;return{entries:n.map((l,v)=>{const g=t(l);if(g===void 0||l.queue===void 0)return l;const f=Object.fromEntries(Object.entries(q(g)).filter(([h])=>!i.has(h))),b=Object.entries(o[l.queue]??{}).filter(([h])=>!Object.hasOwn(f,h)),_=Object.entries(f).filter(([h,y])=>l[h]!==y),x=b.filter(([h,y])=>l[h]===y).map(([h])=>h),E=Object.fromEntries(Object.entries({...l,...f}).filter(([h])=>!x.includes(h)));for(const[h,y]of _)c=w(c,[...s,v,h],y);for(const h of x)c=Ce(c,[...s,v,h]);for(const[h,y]of b){const A=l[h];A!==void 0&&A!==y&&d.push(`${a}/${l.queue}: ${h} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(A)} from the declared ${JSON.stringify(y)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(_.length>0||x.length>0)&&u.push(`${a}/${l.queue} (${[..._.map(([h])=>h),...x.map(h=>`removed ${h}`)].join(", ")})`),Object.keys(f).length>0&&(m[l.queue]=f),E}),owned:m,text:c,updated:u,warnings:d}},Re=(e,n,s,t)=>{const o=n.queues??{},i=o.producers??[],a=o.consumers??[],m=new Set(i.map(g=>g?.binding)),u=new Set(a.map(g=>g.queue)),d=s.filter(g=>!m.has(g.bindingName)),c=s.filter(g=>!u.has(g.name)),p=U(e,a,["queues","consumers"],g=>s.find(f=>f.name===g.queue),t);let l=p.text;const v={...p.owned};if(d.length>0||c.length>0){const g=[...i,...d.map(b=>({binding:b.bindingName,queue:b.name}))],f=[...p.entries,...c.map(b=>({queue:b.name,...b.mode==="pull"?{type:"http_pull"}:{},...q(b)}))];for(const b of c){const _=q(b);Object.keys(_).length>0&&(v[b.name]=_)}l=w(l,["queues"],{consumers:f,producers:g})}return{added:[...d.map(g=>`queues.producers/${g.bindingName}`),...c.map(g=>`queues.consumers/${g.name}`)],owned:v,text:l,updated:p.updated,warnings:p.warnings}},Te=(e,n,s,t,o)=>{const i=n.env?.[t],a=i?.queues?.consumers??[],m=i?.queues?.producers??[],u=l=>{const v=m.find(g=>g?.queue===l.queue)?.binding;return v!==void 0?s.find(g=>g.bindingName===v):s.find(g=>g.name===l.queue&&!m.some(f=>f?.binding===g.bindingName))},d=U(e,a,["env",t,"queues","consumers"],u,o,new Set(["dead_letter_queue"])),c=a.filter(l=>l.queue!==void 0&&u(l)===void 0).map(l=>`env.${t}.queues.consumers/${String(l.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(l.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),p=a.flatMap(l=>{const v=u(l)?.tuning.deadLetterQueue;return v===void 0||l.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(l.queue)}: defineQueue declares deadLetterQueue "${v}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:d.owned,text:d.text,updated:d.updated,warnings:[...d.warnings,...p,...c]}},Ie=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[P],t=o=>typeof o=="object"&&o!==null&&!Array.isArray(o);return s===void 0?{}:!t(s)||!Object.values(s).every(o=>t(o)&&Object.values(o).every(i=>t(i)))?(n.push(`${e?.path??"package.json"}: \`lunora.${P}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},je=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,o])=>Object.keys(o).length>0));oe(e,P,Object.keys(t).length===0?void 0:t)},De="https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/namespaces",qe=e=>{const n='add an "artifacts" binding ({ binding: "ARTIFACTS", namespace }) — codegen reads env.ARTIFACTS unless `.artifacts()` on defineApp points ctx.artifacts at another binding';return e===void 0?`ctx.artifacts is used; ${n}. The namespace is created by the first repo create() if it does not exist yet.`:`ctx.artifacts is used and the schema pins data to "${e}"; create the namespace in that jurisdiction BEFORE the first repo, with POST ${De} and body { "namespace": "<name>", "jurisdiction": "${e}" }, then ${n}. A namespace's jurisdiction cannot be changed, and one created implicitly by the first repo create() is unrestricted. With CLOUDFLARE_API_TOKEN set, \`lunora deploy\` creates a missing namespace in that jurisdiction for a binding you have added.`},R="PIPELINES",T="ARTIFACTS",Pe=(e,n,s)=>{const t=n!==void 0&&(s===void 0||s==="cloudflare"),o=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(d=>d.binding===e.flagshipBinding),i=e.usesPipelines&&!(n?.pipelines??[]).some(d=>d.binding===R),a=e.usesArtifacts?n?.artifacts??[]:[],m=a.some(d=>d.binding===T)?[]:a.flatMap(d=>d.binding===void 0?[]:[d.binding]);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0&&(!t||e.jurisdiction!==void 0),e.jurisdiction===void 0?'ctx.kv is used but no kv_namespaces binding exists; add one ({ binding: "KV" }) — wrangler creates the namespace on the first deploy.':`ctx.kv is used and the schema pins data to "${e.jurisdiction}"; run \`wrangler kv namespace create <name> --jurisdiction ${e.jurisdiction}\` and add a kv_namespaces entry ({ binding: "KV", id }) — a namespace wrangler creates on deploy is unrestricted.`],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0&&!t,'@lunora/hyperdrive is used but no hyperdrive binding exists; add one ({ binding: "HYPERDRIVE", id }) — on a Cloudflare target `lunora deploy` creates the Hyperdrive config from a connection string.'],[e.usesArtifacts&&a.length===0&&(!t||e.jurisdiction!==void 0),qe(e.jurisdiction)],[i,`ctx.pipelines is used but no "${R}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${R}", stream }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[m.length>0,`ctx.artifacts is used and ${m.map(d=>`"${d}"`).join(", ")} ${m.length===1?"is":"are"} bound, but none is named "${T}"; make sure \`.artifacts()\` on defineApp points ctx.artifacts at it — otherwise it reads env.${T} and throws.`],[o,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([d])=>d).map(([,d])=>d)},Be=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),I=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),Le=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(i=>i.className));if(s.size===0)return[];const t=Object.entries(n.exports??{}).flatMap(([i,a])=>a?.type==="workflow"?[i]:[]),o=(n.workflows??[]).flatMap(i=>i.class_name===void 0||i.script_name!==void 0?[]:[i.class_name]);return[...new Set([...t,...o])].filter(i=>!s.has(i)).map(i=>`wrangler.jsonc declares workflow "${i}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class the worker does not export). Remove it if it is not hand-wired.`)},We=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(o=>o.name)),t=new Set(e.queues.map(o=>o.bindingName));return[...(n.queues?.consumers??[]).flatMap(o=>{const{queue:i}=o;return i===void 0||s.has(i)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${i}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(o=>{const i=o?.binding;return i===void 0||t.has(i)?[]:[`wrangler.jsonc declares queues.producers[] binding "${i}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},Me=(e,n)=>[...Le(e,n),...We(e,n)],G=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],Ke=()=>G.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),Fe=e=>{let n;try{n=ve(V(e,we),"utf8")}catch{return!1}const s=new Map(_e(n).map(t=>[t.key,t.value]));return G.some(({keys:t})=>t.every(o=>(s.get(o)??"")!==""))},He=(e,n)=>{const s=n?.secrets?.required;if(!Array.isArray(s))return[];const t=new Set(s),o=Se(ye(e)).map(i=>i.key).filter(i=>!t.has(i));return o.length===0?[]:[`wrangler.jsonc declares secrets.required without ${o.join(", ")}, which this app needs — wrangler dev loads only the listed keys from .dev.vars, so add ${o.length===1?"it":"them"} to secrets.required.`]},j=(e,n,s,t)=>{const o=new Set(e.durableObjects.map(u=>u.className)),i=[],a=(s?.r2_buckets?.length??0)>0,m=(s?.d1_databases?.some(u=>u.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!a&&i.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!o.has("SessionDO")&&!m&&i.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!o.has("SchedulerDO")&&i.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),i.push(...I("container","containers",e.containers),...I("workflow","workflows",e.workflows),...I("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&i.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayments&&!Fe(n)&&i.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${Ke()}.`),i.push(...Be(e),...Pe(e,s,t),...He(e,s)),s!==void 0&&i.push(...Me(e,s)),i},Ve=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,o])=>o.filter(i=>!i.exported).map(({className:i,exportName:a})=>({className:i,exportName:a,kind:s,module:t}))),Ye=e=>{const n=new Set(D(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},Qe=e=>{const n=new Set;for(const s of D(e)){for(const t of C(s.deleted_classes))n.delete(t);for(const{from:t,to:o}of D(s.renamed_classes))t!==void 0&&n.delete(t),o!==void 0&&n.add(o);for(const t of[...C(s.new_classes),...C(s.new_sqlite_classes)])n.add(t)}return n},Ue=(e,n,s)=>{const t=n.durable_objects?.bindings??[],o=new Set(t.map(c=>c.name)),i=s.filter(c=>!o.has(c.binding));let a=e;const m=[];if(i.length>0){const c=[...t,...i.map(p=>({class_name:p.className,name:p.binding}))];a=w(a,["durable_objects","bindings"],c),m.push(...i.map(p=>`${p.binding}/${p.className}`))}const u=n.migrations??[],d=s.map(c=>c.className).filter(c=>!Qe(u).has(c));if(d.length>0){const c=[...u,{new_sqlite_classes:d,tag:Ye(u)}];a=w(a,["migrations"],c)}return{added:m,text:a}},B=e=>e===void 0||e==="cloudflare",Ge=(e,n)=>e.includes("DB (D1)")&&B(n)?[`wrote a DB binding with a placeholder database_id ("${Y}") — run \`wrangler d1 create <name>\` and replace it before deploying.`]:[],Je=(e,n)=>{const s=n.d1_databases??[];if(s.some(i=>i.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",o=[...s,{binding:"DB",database_id:Y,database_name:t}];return{added:["DB (D1)"],text:w(e,["d1_databases"],o)}},Xe={ai:{binding:"AI",label:"AI (Workers AI)"},analytics:{binding:"ANALYTICS_SQL",label:"ANALYTICS_SQL (Analytics SQL)"},browser:{binding:"BROWSER",label:"BROWSER (Browser Rendering)"},images:{binding:"IMAGES",label:"IMAGES (Cloudflare Images)"}},ze=(e,n)=>e.usesAnalyticsSql&&ie(n,new Set(["analyticsSql"]))?.chained.has("analyticsSql")!==!0,$=(e,n,s)=>{const{binding:t,label:o}=Xe[s],i=n[s]?.binding;if(typeof i=="string"&&i.length>0)return{added:[],text:e};const a=k(n,t);return a!==void 0?{added:[],text:e,warnings:[`${s}: not adding the ${o} binding — the name "${t}" is already bound by \`${a}\` in wrangler.jsonc. Rename that binding, then set ${s}.binding by hand.`]}:{added:[o],text:w(e,[s],{binding:t})}},L=(e,n,s)=>`${e}: not adding "${n}" — the name is already bound by \`${s}\` in wrangler.jsonc. Add a ${e} entry under another binding name and point the matching \`defineApp()\` override at it.`,Ze=(e,n,s)=>{if(!B(s)||(n.hyperdrive?.length??0)>0)return{added:[],text:e};const t=k(n,"HYPERDRIVE");return t!==void 0?{added:[],text:e,warnings:[L("hyperdrive","HYPERDRIVE",t)]}:{added:["HYPERDRIVE (Hyperdrive, created on deploy)"],text:w(e,["hyperdrive"],[{binding:"HYPERDRIVE",id:re}])}},en=new Set(["celld","cloudflare"]),nn=(e,n,s,t)=>{if(t!==void 0&&!en.has(t)||s!==void 0||(n.kv_namespaces?.length??0)>0)return{added:[],text:e};const o=k(n,"KV");return o!==void 0?{added:[],text:e,warnings:[L("kv_namespaces","KV",o)]}:{added:[t==="celld"?`KV (Workers KV, celld namespace ${te(n.name,"KV")})`:"KV (Workers KV, created on deploy)"],text:w(e,["kv_namespaces"],[{binding:"KV"}])}},sn=(e,n,s,t)=>{if(!B(t)||s!==void 0||(n.artifacts?.length??0)>0)return{added:[],text:e};const o=k(n,"ARTIFACTS");if(o!==void 0)return{added:[],text:e,warnings:[L("artifacts","ARTIFACTS",o)]};const i=typeof n.name=="string"&&n.name.length>0?n.name:"lunora";return{added:["ARTIFACTS (Cloudflare Artifacts)"],text:w(e,["artifacts"],[{binding:"ARTIFACTS",namespace:i}])}},H=(e,n,s,t,o)=>{if((n[s]?.length??0)>0)return{added:[],text:e};const i=k(n,t.binding);return i!==void 0?{added:[],text:e,warnings:[`${s}: not adding ${JSON.stringify(t)} — the name "${t.binding}" is already bound by \`${i}\` in wrangler.jsonc. Add a ${s} entry under another binding name and point the matching \`defineApp()\` override at it.`]}:{added:[o],text:w(e,[s],[t])}},tn=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:w(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},on=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},an=e=>{const{image:n}=e;return n.kind==="dockerfile"?n.dockerfilePath:n.kind==="registry"?n.reference:ne(e.exportName)},J=e=>{const n={};for(const[s,t]of Object.entries(e.images??{}))n[s]=t.kind==="registry"?{image:t.reference}:{build_context:t.buildContext,dockerfile:t.dockerfilePath,...e.buildArgs===void 0?{}:{build_vars:e.buildArgs}};return{class_name:e.className,scheduling_policy:"durable_object",...Object.keys(n).length>0?{images:n}:{},...e.name===void 0?{}:{name:e.name}}},rn=e=>{if(e.schedulingPolicy==="durable_object")return J(e);const{image:n}=e,s={class_name:e.className,image:an(e)};return n.kind==="dockerfile"&&(s.image_build_context=n.buildContext),e.buildArgs!==void 0&&n.kind!=="registry"&&(s.image_vars=e.buildArgs),e.instanceType!==void 0&&(s.instance_type=on(e.instanceType)),e.maxInstances!==void 0&&(s.max_instances=e.maxInstances),e.name!==void 0&&(s.name=e.name),e.rollout?.stepPercentage!==void 0&&(s.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(s.rollout_active_grace_period=e.rollout.gracePeriodSeconds),s},dn=(e,n,s)=>{const t=n.containers??[],o=new Set(t.map(d=>d.class_name)),i=s.filter(d=>!o.has(d.className));let a=i.length===0?e:w(e,["containers"],[...t,...i.map(d=>rn(d))]);const m=[],u=[];for(const[d,c]of t.entries()){const p=s.find(g=>g.className===c.class_name);if(p===void 0)continue;const l=p.schedulingPolicy??"default";if((c.scheduling_policy??"default")!==l){u.push(`containers/${p.className} has scheduling_policy "${c.scheduling_policy??"default"}" in wrangler.jsonc but defineContainer "${p.exportName}" declares "${l}" — the policy is immutable, so replace the entry (and its container application) by hand.`);continue}const v=p.schedulingPolicy==="durable_object"?J(p).images:void 0;v!==void 0&&JSON.stringify(c.images)!==JSON.stringify(v)&&(a=w(a,["containers",d,"images"],v),m.push(`containers/${p.className}.images`))}return{added:i.map(d=>`containers/${d.className}`),text:a,updated:m,warnings:u}},cn=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=w(e,["observability"],{...Ee});return{added:["observability"],text:s}},ln=(e,n)=>n.upload_source_maps!==void 0?{added:[],text:e}:{added:["upload_source_maps"],text:w(e,["upload_source_maps"],!0)},X=[{minimum:[4,142],name:"wrangler"},{minimum:[1,61],name:"@cloudflare/vite-plugin"}],un=X.map(({minimum:e,name:n})=>`${n}@^${e.join(".")}.0`).join(" "),gn=(e,n)=>{try{const s=ee(V(e,"package.json")).resolve(`${n}/package.json`),[t=0,o=0]=String(se(s).version).split(".").map(Number);return[t,o]}catch{return}},mn=e=>{const n=X.flatMap(({minimum:s,name:t})=>{const o=gn(e,t);return o!==void 0&&(o[0]<s[0]||o[0]===s[0]&&o[1]<s[1])?[`${t} ${o.join(".")} (needs >= ${s.join(".")})`]:[]});return n.length===0?void 0:`workflows are declared in wrangler \`exports\`, which ${n.join(" and ")} cannot run — reconcile left workflows[] untouched. Upgrade (\`pnpm add -D ${un}\`) and re-run.`},pn=e=>Object.entries(e.env??{}).flatMap(([n,s])=>Array.isArray(s?.workflows)?[`env.${n}.workflows declares workflow bindings, but Lunora now declares workflows in \`exports\` and resolves them on ctx.exports — move them to that environment's own \`exports\` by hand.`]:[]),fn=(e,n,s)=>{let t=e;const o=[],i=[];for(const a of s){const m=n[a.className];if(m?.type==="workflow")for(const{of:u,path:d}of ue){const c=u(a),p=Q(m,d),l=`exports/${a.className}.${d.join(".")}`;if(c===void 0){p!==void 0&&i.push(`${l} is set in wrangler.jsonc but defineWorkflow "${a.exportName}" does not declare it — reconcile leaves it in place. Remove it by hand if it was dropped from the definition.`);continue}JSON.stringify(p)!==JSON.stringify(c)&&(t=w(t,["exports",a.className,...d],c),o.push(l))}}return{text:t,updated:o,warnings:i}},bn=(e,n,s,t,o)=>{if(o!==void 0)return{added:[],text:e,warnings:[o]};const i=[...s.map(f=>({settings:ce(f),workflow:f})),...t.map(f=>({settings:{},workflow:f}))],a=new Set(i.map(({workflow:f})=>f.className)),m=n.workflows??[],u=m.filter(f=>f.script_name===void 0&&f.class_name!==void 0&&a.has(f.class_name)),d=n.exports??{},c=[],p=[],l=[];let v=e;for(const{settings:f,workflow:b}of i){if(d[b.className]!==void 0&&d[b.className]!==null)continue;const _=u.find(h=>h.class_name===b.className),x=Object.fromEntries(le.flatMap(h=>{const y=Q(_,[h]);return y===void 0?[]:[[h,y]]})),E=_?.name??b.name;_?.name!==void 0&&_.name!==b.name&&l.push(`workflows/${b.className} is deployed as "${_.name}" but declared as "${b.name}" — its export keeps "${_.name}" so running instances survive. Change the declaration to match, or rename deliberately (it starts a new, empty workflow).`),v=w(v,["exports",b.className],{type:"workflow",...x,...f,name:E}),(_===void 0?c:p).push(`exports/${b.className}`)}if(u.length>0){const f=m.filter(b=>!u.includes(b));v=w(v,["workflows"],f.length===0?void 0:f),p.push(...u.map(b=>`workflows/${String(b.class_name)} → exports`))}l.push(...pn(n));const g=fn(v,d,s);return{added:c,text:g.text,updated:[...p,...g.updated],warnings:[...l,...g.warnings]}},qn=(e,n,{environment:s,target:t}={})=>{const o=Ae(e),i=Ve(n);if(!o)return{added:[],exportGaps:i,reason:"wrangler.jsonc not found",updated:[],warnings:j(n,e)};const{parsed:a,text:m}=Oe(o);if(a===void 0)return{added:[],exportGaps:i,reason:`failed to parse ${o} as JSONC`,updated:[],warnings:j(n,e),wranglerPath:o};const u=j(n,e,a,t);if(s!==void 0){const r=a.env?.[s]!==void 0;u.push(r?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const d=n.containers.filter(r=>r.exported),c=n.agents.filter(r=>r.exported&&r.voice===!0&&r.voiceBindingName!==void 0&&r.voiceClassName!==void 0),p=[...n.durableObjects,...d.map(r=>({binding:r.bindingName,className:r.className})),...c.map(r=>({binding:r.voiceBindingName,className:r.voiceClassName}))],l=n.workflows.filter(r=>r.exported),v=n.agents.filter(r=>r.exported),g=ae(e),f=Ie(g,u),b={},_=pe(g);let x,E={unwritten:{},written:{}};const h=[{enabled:!0,run:r=>Ue(r,a,p)},{enabled:n.needsD1,run:r=>Je(r,a)},{enabled:n.usesKv,run:r=>nn(r,a,n.jurisdiction,t)},{enabled:n.usesHyperdrive,run:r=>Ze(r,a,t)},{enabled:n.usesArtifacts,run:r=>sn(r,a,n.jurisdiction,t)},{enabled:n.usesAi,run:r=>$(r,a,"ai")},{enabled:n.usesAiSearch,run:r=>H(r,a,"ai_search_namespaces",{binding:"AI_SEARCH",namespace:"default"},"AI_SEARCH (AI Search namespace)")},{enabled:ze(n,e),run:r=>$(r,a,"analytics")},{enabled:n.usesBrowser,run:r=>$(r,a,"browser")},{enabled:n.usesImages,run:r=>$(r,a,"images")},{enabled:n.usesAnalytics,run:r=>H(r,a,"analytics_engine_datasets",{binding:"ANALYTICS",dataset:"ANALYTICS"},"ANALYTICS (Analytics Engine)")},{enabled:n.usesWorkerLoader,run:r=>tn(r,a)},{enabled:!0,run:r=>cn(r,a)},{enabled:t===void 0||t==="cloudflare",run:r=>ln(r,a)},{enabled:(t===void 0||t==="cloudflare")&&n.workerRoutes!==void 0,run:r=>de(r,a,n.workerRoutes??[],g,xe(e),F(e,a,t))},{enabled:d.length>0,run:r=>dn(r,a,d)},{enabled:l.length>0||v.length>0,run:r=>bn(r,a,l,v,mn(e))},{enabled:n.queues.length>0,run:r=>{const S=Re(r,a,n.queues,f.queues??{});return b.queues=S.owned,{...S,record:{consequence:"an option removed from defineQueue stays deployed",key:"queueTuning",label:"queue tuning",write:N=>{je(N,f,b)}}}}},{enabled:n.services!==void 0&&(n.services.length>0||Object.keys(_).length>0),run:r=>{const S=fe(r,a,n.services??[],_);return x=S.owned,{...S,record:{consequence:"a service removed from lunora.config stays bound",key:"services",label:"service bindings",write:(N,{devConfigWritten:Z})=>{he(N,{...x,...Z?E.written:E.unwritten})}}}}},...s===void 0||a.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:r=>{const S=`env.${s}.queues`,O=Te(r,a,n.queues,s,f[S]??{});return b[S]=O.owned,O}}]];let y=m;const A=[],W=[],M=[];for(const r of h){if(!r.enabled)continue;const S=r.run(y);y=S.text,A.push(...S.added),W.push(...S.updated??[]),u.push(...S.warnings??[]),M.push(...[S.record].filter(O=>O!==void 0))}let K;if(n.services!==void 0){const r=be(e,n.services,_);u.push(...r.warnings),E={unwritten:r.previouslyOwned,written:r.owned},K=r}u.push(...Ge(A,t));const z=F(e,a,t)?.directory;return{added:A,devConfig:K,edit:{assetsDirectory:z,manifest:g,original:m,records:M,text:y},exportGaps:i,updated:W,warnings:u,wranglerPath:o}};export{Ve as collectExportGaps,qn as planWranglerBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawnSync as u}from"node:child_process";import{rmSync as a,readdirSync as f,writeFileSync as d,lstatSync as g}from"node:fs";import{join as s,dirname as l}from"node:path";import m from"./ensureGitignoreEntries-Tsk8Qkw7.mjs";import{i as y}from"./is-within-directory-DRMw89rK.mjs";const h=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/,p=".wrangler.lunora-*.jsonc";let c=0;const w=n=>(c+=1,`.wrangler.lunora-${n}.${String(process.pid)}.${String(c)}.jsonc`),A=n=>{try{return process.kill(n,0),!0}catch(r){return r.code==="EPERM"}},I=n=>{let r;try{r=f(n)}catch{return}for(const t of r){const e=h.exec(t);if(!(e===null||Number(e[1])===process.pid||A(Number(e[1]))))try{a(s(n,t),{force:!0})}catch{}}},N=()=>{},b=n=>{let r=!1;return()=>{if(!r){r=!0;try{a(n,{force:!0})}catch{}}}},C=n=>u("git",["check-ignore","-q","--no-index",n],{cwd:l(n),stdio:"ignore",timeout:5e3}).status,E=(n,r)=>{const t=l(n),e=t!==r&&y(t,r)?[r,t]:[t];try{for(const o of e){if(C(n)!==1)return;g(s(o,".gitignore"),{throwIfNoEntry:!1})?.isSymbolicLink()!==!0&&m(o,[p])}}catch{}},O=(n,r,t,e)=>{I(n);const o=s(n,w(r));return E(o,e),d(o,t,"utf8"),{cleanup:b(o),configPath:o}},L=(n,r)=>{const t=n?.ai,e=n?.artifacts,o=(Array.isArray(e)?e:[]).flatMap(i=>typeof i?.binding=="string"?[i.binding]:[]);return t==null&&o.length===0?[]:r()?[]:[...t==null?[]:[{binding:typeof t.binding=="string"?t.binding:"AI",kind:"ai"}],...o.map(i=>({binding:i,kind:"artifacts"}))]},R=({binding:n,kind:r})=>r==="ai"?`Workers AI is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`:`Artifacts is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Artifacts only runs remotely. \`ctx.artifacts\` will throw. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{p as DEV_CONFIG_IGNORE,h as STALE_DEV_CONFIG,b as createCleanup,R as describeWithheld,w as devConfigBasename,N as noopCleanup,I as sweepStaleDevConfigs,L as withheldBindings,O as writeDevConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{statSync as j,readFileSync as k,existsSync as B,readdirSync as ue}from"node:fs";import{join as E,dirname as $,resolve as pe}from"node:path";import{discoverFlags as me,FLAGS_FILENAME as fe,CAPABILITY_PROBES as Q,COMPANION_BINDING as z,ALL_NOTIFY_CHANNELS as ge,readBoundServiceBindings as he,discoverHttpRoutes as Se,discoverNotifyChannels as Ee,NOTIFY_FILENAME as xe,createTargetScope as ye,mayReadCapabilityContext as ve,sourceCapabilitySignals as Ne,foldCapabilitySignals as V,capabilitiesUsedBy as Te}from"@lunora/codegen";import{init as be}from"es-module-lexer";import{ts as n,Node as m,Project as Z}from"ts-morph";import{discoverAgentInfo as Ce}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Re}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as Ae}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{d as M}from"./discover-info-DC2MrAIM.mjs";import{i as ee}from"./is-within-directory-DRMw89rK.mjs";import{PACKAGE_SECRETS_REGISTRY as Ie}from"./PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{d as Oe}from"./queue-info-D38n7YdX.mjs";import{discoverSchemaInfo as _e}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as we,composedEntryDurableObjects as De,GENERATED_DIRECTORY as _,DURABLE_OBJECT_BINDINGS as Le,detectExportedDurableObjects as Pe,detectClassExports as L,isMergedProject as te}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as $e}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const Fe="/api/auth",je="/.well-known/oauth-protected-resource",ke="/.well-known/oauth-authorization-server",Be=String.raw`\/\*[\s\S]*?\*\/`,Me=String.raw`\/\/[^\n]*`,Ke=String.raw`"(?:[^"\\\n]|\\.)*"`,Ge=String.raw`'(?:[^'\\\n]|\\.)*'`,Ue=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,We=new RegExp([Be,Me,Ke,Ge,Ue].join("|"),"gu"),Ve=/[^\n]/gu,He=e=>e.replaceAll(Ve," "),Ye=e=>e.replaceAll(We,t=>t.startsWith("//")||t.startsWith("/*")?He(t):t),Xe=(e,t)=>{const{error:o,value:s}=M(e,t,fe,me);return o===void 0?{flags:s}:{error:o}},b="@lunora/replica",h="EventLogDOClient",qe=/\.[cm]?[jt]sx?$/u,H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],Y=new Map,K=e=>{const{mtimeMs:t}=j(e),o=Y.get(e);if(o?.mtimeMs===t)return o.source;const s=n.createSourceFile(e,k(e,"utf8"),n.ScriptTarget.Latest);return Y.set(e,{mtimeMs:t,source:s}),s},X=new WeakMap,Je=e=>{const t=X.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const o=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return X.set(e,o),o},q=e=>n.sys.fileExists(e)?j(e).mtimeMs:-1,J=new Map,Qe=e=>{const t=n.findConfigFile($(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const o=J.get(t);if(o!==void 0&&[...o.mtimes].every(([i,c])=>q(i)===c))return o.options;const s=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(s,n.sys,$(t)),a=new Map([t,...s.extendedSourceFiles??[]].map(i=>[i,q(i)]));return J.set(t,{mtimes:a,options:r}),r},G=(e,t)=>{if(t===b)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...Qe(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const o=E($(e),t.replace(qe,"")),s=H.map(a=>`${o}${a}`),r=H.map(a=>E(o,`index${a}`));return[...s,...r].find(a=>B(a))},ze=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings,r=s!==void 0&&n.isNamedImports(s)?s.elements:[];for(const a of r)a.isTypeOnly||t.set(a.name.text,{module:o.moduleSpecifier.text,name:(a.propertyName??a.name).text})}return t},Ze=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings;s!==void 0&&n.isNamespaceImport(s)&&t.set(s.name.text,o.moduleSpecifier.text)}return t},w=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),et=e=>n.isVariableStatement(e)?w(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&w(e)?e.name===void 0?[]:[e.name.text]:n.isExportDeclaration(e)&&e.moduleSpecifier===void 0&&!e.isTypeOnly&&e.exportClause!==void 0&&n.isNamedExports(e.exportClause)?e.exportClause.elements.map(t=>t.name.text):[],tt=e=>new Set(e.statements.flatMap(t=>et(t))),st=(e,t,o)=>{if(n.isIdentifier(e))return t.get(e.text);if(n.isPropertyAccessExpression(e)&&n.isIdentifier(e.expression)){const s=o.get(e.expression.text);return s===void 0?void 0:{module:s,name:e.name.text}}},ot=(e,t,o)=>w(e)?e.declarationList.declarations.flatMap(s=>{if(!n.isIdentifier(s.name)||s.initializer===void 0)return[];const r=st(s.initializer,t,o);return r===void 0?[]:[{exported:s.name.text,module:r.module,name:r.name}]}):[],rt=(e,t)=>{const o=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!w(e)||e.name===void 0||o===void 0||!n.isIdentifier(o))return[];const s=t.get(o.text);return s===void 0?[]:[{exported:e.name.text,module:s.module,name:s.name}]},nt=e=>{const t=ze(e),o=Ze(e);return e.statements.flatMap(s=>{if(n.isVariableStatement(s))return ot(s,t,o);if(n.isClassDeclaration(s))return rt(s,t);if(!n.isExportDeclaration(s)||s.isTypeOnly)return[];const{exportClause:r,moduleSpecifier:a}=s,i=a!==void 0&&n.isStringLiteral(a)?a.text:void 0;return r===void 0?i===void 0?[]:[{exported:void 0,module:i,name:void 0}]:n.isNamedExports(r)?r.elements.flatMap(c=>{if(c.isTypeOnly)return[];const d=c.name.text,l=(c.propertyName??c.name).text;if(i!==void 0)return[{exported:d,module:i,name:l}];const u=t.get(l);return u===void 0?[]:[{exported:d,module:u.module,name:u.name}]}):[]})},U=(e,t,o,s,r=new Set)=>{const a=JSON.stringify([e,o,[...r]]);if(s.has(a))return!1;s.add(a);const i=K(e),c=nt(i),d=new Set([...r,...tt(i),...c.flatMap(l=>l.exported===void 0?[]:[l.exported])]);return c.some(l=>{if(o!==void 0&&l.exported!==void 0&&l.exported!==o||l.exported!==void 0&&r.has(l.exported))return!1;if(l.exported===void 0){const g=o??(l.module===b?t:void 0);if(g!==void 0&&d.has(g))return!1}const u=l.exported===void 0?o:l.name;if(l.module===b)return u===void 0||u===t;const v=G(e,l.module);return v!==void 0&&U(v,t,u,s,l.exported===void 0?d:r)})},F=(e,t)=>Je(e).some(o=>{const s=o.getParent();return o.getText()!==t||m.isNamespaceImport(s)||m.isPropertyAccessExpression(s)&&s.getNameNode()===o||m.isQualifiedName(s)&&s.getRight()===o?!1:m.isPropertyAccessExpression(s)?s.getName()===h:m.isQualifiedName(s)?!m.isTypeReference(s.getParent())&&s.getRight().getText()===h:!0}),it=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===b},at=e=>{const t=e.getPropertyNameNode();if(t===void 0)return e.getNameNode().getText();const o=m.isComputedPropertyName(t)?t.getExpression():t;return m.isStringLiteral(o)||m.isNoSubstitutionTemplateLiteral(o)?o.getLiteralValue():t.getText()},ct=e=>{let t=e,o=!1;for(let r=e.getParent();m.isParenthesizedExpression(r)||m.isAwaitExpression(r);r=t.getParent())o||=m.isAwaitExpression(r),t=r;if(!o)return!0;const s=t.getParent();if(m.isVariableDeclaration(s)){const r=s.getNameNode();return!m.isObjectBindingPattern(r)||r.getElements().some(a=>a.getDotDotDotToken()!==void 0||at(a)===h)}return m.isPropertyAccessExpression(s)&&s.getExpression()===t?s.getName()===h:!0},dt=(e,t)=>K(e).statements.some(o=>n.isExportDeclaration(o)&&o.moduleSpecifier!==void 0&&n.isStringLiteral(o.moduleSpecifier)&&o.moduleSpecifier.text===b&&o.exportClause!==void 0&&n.isNamespaceExport(o.exportClause)&&o.exportClause.name.text===t),lt=e=>e.getImportDeclarations().some(t=>{const o=t.getNamespaceImport(),s=t.isTypeOnly()?[]:t.getNamedImports().filter(d=>!d.isTypeOnly()),r=s.some(d=>d.getNameNode().getText()===h),a=s.filter(d=>F(e,(d.getAliasNode()??d.getNameNode()).getText())),i=o!==void 0&&F(e,o.getText());if(!r&&!i&&a.length===0)return!1;const c=G(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&U(c,h,h,new Set)||a.some(d=>dt(c,d.getNameNode().getText()))}),se=e=>{const t=e.getImportDeclarations().filter(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly());return t.some(o=>o.getNamedImports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||t.some(o=>{const s=o.getNamespaceImport();return s!==void 0&&F(e,s.getText())})||e.getExportDeclarations().some(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly()&&o.getNamedExports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||lt(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(o=>it(o)&&ct(o))},ut=e=>{const t=[],o=s=>{if(n.isImportDeclaration(s)&&s.importClause?.phaseModifier!==n.SyntaxKind.TypeKeyword&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isExportDeclaration(s)&&!s.isTypeOnly&&s.moduleSpecifier!==void 0&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isCallExpression(s)&&s.expression.kind===n.SyntaxKind.ImportKeyword){const[r]=s.arguments;r!==void 0&&(n.isStringLiteral(r)||n.isNoSubstitutionTemplateLiteral(r))&&t.push(r.text)}n.forEachChild(s,o)};return o(e),t},pt=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),mt=new Set([".git",".lunora-cache",".wrangler","dist",_,"node_modules"]),ft=["lunora","src"],gt=/\benv\s*\.\s*DB\b/,ht=/\benv\s*\.\s*AI\b/,oe=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],re=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,ne=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],ie=[...oe.map(e=>[re(e),Q[e].moduleSpecifier]),...ne].toSorted(([e],[t])=>e.localeCompare(t)),St=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyFcmTokenSource","@lunora/notify:fcmTokenSource"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],Et=["@lunora/agent","@lunora/agent/sandbox"],ae=new RegExp(String.raw`["'\x60](?:${[...ie.map(([,e])=>e),...Et,b].map(e=>Ae(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:o}=Q[e];return t===void 0?`${o} is imported`:`${o} is imported or ctx.${t} is read`},xt="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",yt=/\b(authBasePath|basePath):\s*(["'`])(\/[^"'`$\s]*)\2/gu,vt=/["']@lunora\/auth(?:\/[^"']*)?["']/u,Nt=/[Bb]asePath/u,Tt=e=>{const t=new Set;for(const o of e){const s=k(o,"utf8");if(!Nt.test(s))continue;const r=Ye(s),a=vt.test(r);for(const[,i,,c]of r.matchAll(yt)){const d=c?.endsWith("/")===!0?c.slice(0,-1):c??"";d!==""&&(i==="authBasePath"||a)&&t.add(d)}}return t.size===0?[Fe]:[...t].toSorted((o,s)=>o.localeCompare(s))},bt=(e,t,o,s)=>{const{error:r,value:a}=M(e,t,void 0,Se);if(r!==void 0)return;const i=o?[...Tt(s),je,ke].map(c=>`${c}/*`):[];return[...(a??[]).map(c=>c.path),...i]},Ct=/\bfrom\s+["']\.{1,2}\//u,ce=(e,t)=>{let o;try{o=ue(e,{withFileTypes:!0})}catch{return}for(const s of o){if(s.isDirectory()){mt.has(s.name)||ce(E(e,s.name),t);continue}const r=s.name.lastIndexOf(".");r!==-1&&pt.has(s.name.slice(r))&&t.push(E(e,s.name))}},Rt=(e,t,o)=>{const s=he(e,t);return o?{...s,services:s.services.filter(r=>r.binding!==z)}:s},At=(e,t,o)=>{const{info:s}=_e(e,t,o);return{jurisdiction:s?.jurisdiction,needsD1:s?.hasD1GlobalTable??!1}};let P;const It=e=>{const t=pe(e);return P?.root!==t&&(P={project:new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),P.project},Ot=(e,t,o)=>{e.getSourceFile(t)?.getFullText()!==o&&e.createSourceFile(t,o,{overwrite:!0})},_t=(e,t)=>{for(const o of e.getSourceFiles())t.has(o)||e.removeSourceFile(o)},wt=(e,t,o)=>{const s=E(e,o),r=It(e),a=[],i=new Set,c=[],d=[],l=ye();let u=!1,v=!1;for(const f of t){const S=E(e,f);if(!B(S)||!j(S).isDirectory())continue;const O=[];ce(S,O);for(const R of O){i.add(R);const x=k(R,"utf8"),T=ee(R,s);u||=ht.test(x),v||=gt.test(x),(ae.test(x)||x.includes(h)||T&&(ve(x)||Ct.test(x)))&&(Ot(r,R,x),a.push({file:R,inLunora:T}))}}_t(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:S}of a)(S?c:d).push(Ne(r.getSourceFileOrThrow(f),l));const g=V(c),C=V([g,...d]),I=new Set([...C.valueImports,...C.dynamicImports]),N=Te({contextReads:g.contextReads,valueImports:I});return{...Object.fromEntries([...oe.map(f=>[re(f),N.has(f)]),...ne.map(([f,S])=>[f,I.has(S)])]),needsD1:v,usesEventLogClient:a.some(({file:f})=>se(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:N.has("ai")||u,usesBrowser:N.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},Dt=(e,t,o)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...t.map(s=>s.exported?`exports.${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(s=>s.exported?`exports.${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Lt=(e,t,o)=>[[e.usesAi,`AI (${p("ai")}, env.AI is used, or an agent is declared)`],[e.usesAuth&&!t.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!t.has("SchedulerDO"),`hint: ${p("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${p("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${p("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${p("payments")}; set the provider secrets in .dev.vars — ${xt}`],[e.usesBrowser,`browser (${p("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${p("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${p("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${p("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${p("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,o.jurisdiction===void 0?`kv_namespaces (${p("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${p("kv")} and the schema pins "${o.jurisdiction}"; create the namespace with --jurisdiction ${o.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${p("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${p("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,o.jurisdiction===void 0?`artifacts (${p("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${p("artifacts")}; the schema pins data to "${o.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${p("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([r])=>r).map(([,r])=>r),Pt=(e,t,o,s=[],r=[],a=[])=>{const i=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return t.needsD1&&c.push("DB (.global() table declared)"),c.push(...Dt(s,r,a),...Lt(o,i,t)),c},$t=(e,t)=>e.some(o=>o.binding==="SHARD_REGISTRY")||te(t)&&B(E(t,"shardRegistry.ts")),Ft=(e,t,o)=>{const s=new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),r=[e],a=new Set;for(let i=r.pop();i!==void 0;i=r.pop()){if(a.has(i))continue;a.add(i);const c=K(i),d=c.text;if((ae.test(d)||d.includes(h))&&se(s.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of ut(c)){const u=G(i,l);u!==void 0&&!t.has(u)&&!ee(u,o)&&r.push(u)}}return!1},jt=e=>!e.composed&&e.path!==void 0&&U(e.path,"EventLogDO",void 0,new Set),kt=e=>({usesNotifyFcm:e?.fcm==="env",usesNotifyFcmTokenSource:e?.fcm==="ownToken",usesNotifyWebPush:e?.hasWebPush??!1}),es=async e=>{await be;const t=e.schemaDir??"lunora",o=e.scanDirs??ft,s=()=>wt(e.projectRoot,o,t),{scannedFiles:r,...a}=e.cache===void 0?s():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${o.join(",")}`,s),i=we(e.projectRoot);let c;i.composed?c=De(E(e.projectRoot,t,_)).map(W=>({binding:Le[W],className:W})):c=i.path===void 0?[]:Pe(i.path);const d=At(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=L(i,Re(e.projectRoot,t,e.cache).containers,"containers"),v=L(i,$e(e.projectRoot,t).workflows,"workflows"),g=L(i,Ce(e.projectRoot,t).agents,"agents"),C={...a,usesAi:a.usesAi||g.length>0},I=[...Oe(e.projectRoot,t).queues],{flags:N}=Xe(e.projectRoot,t),D=M(e.projectRoot,t,xe,Ee),f=N?.provider==="flagship"&&N.mode==="binding"?N.bindingName:void 0,S=E(e.projectRoot,t,_),O=$t(c,S),R=jt(i),x=!i.composed&&i.path!==void 0&&Ft(i.path,r,S),T=Pt(c,l,C,u,v,g);!i.composed&&te(E(e.projectRoot,t,_))&&!c.some(y=>y.className==="LunoraDO")&&T.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&T.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const A=Rt(e.projectRoot,t,e.skipCompanion===!0),de=A.error===void 0?A.services:void 0;A.error!==void 0&&T.push(`hint: lunora.config \`services\` not reconciled — ${A.error}`),T.push(...A.services.map(y=>y.binding===z?`${y.binding} → ${y.worker} (studio.companion)`:`${y.binding} → ${y.worker} (lunora.config services.${y.name})`));const le=bt(e.projectRoot,t,C.usesAuth,r);return{...C,usesEventLogClient:C.usesEventLogClient||x,agents:g,containers:u,durableObjects:c,flagshipBinding:f,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:I,services:de,signals:T,usesFlags:N!==void 0,...kt(D.error===void 0?D.value:ge),hostsEventLog:R,hostsShardRegistry:O,workerRoutes:le,workflows:v}},ts=e=>[...ie,...St].filter(([t,o])=>e[t]&&Ie[o]!==void 0).map(([,t])=>t);export{es as inferLunoraBindings,ts as secretSourcesFromBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{relative as s,sep as e,isAbsolute as o}from"node:path";const n=(i,r)=>{const t=s(r,i);return t!==""&&t!==".."&&!t.startsWith(`..${e}`)&&!o(t)};export{n as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-CN3D-4pU.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-BF8PUjuo.mjs";const C=(e,i)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,i.hasCredentials??(()=>u({projectRoot:i.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let n=c;for(const{kind:f}of r)n=l(n,[f],void 0);s&&(n=l(n,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",n,i.projectRoot);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},R=(e,i)=>{const t=e.map(o=>C(o,i)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{R as materializeServiceDevConfigs};
|
package/dist/packem_shared/{pendingBindingChanges-DqP40pSQ.mjs → pendingBindingChanges-DkVojIQe.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdirSync as l,writeFileSync as $,rmSync as w}from"node:fs";import{basename as h,join as d,dirname as p}from"node:path";import{inferLunoraBindings as u}from"./inferLunoraBindings-
|
|
1
|
+
import{mkdirSync as l,writeFileSync as $,rmSync as w}from"node:fs";import{basename as h,join as d,dirname as p}from"node:path";import{inferLunoraBindings as u}from"./inferLunoraBindings-BUk28bSQ.mjs";import{LUNORA_TAG as a}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{applyWranglerBindings as v}from"./reconcileWranglerBindings-D6B81UKU.mjs";import{r as y}from"./validate-bindings-DSMH8bRQ.mjs";import{planWranglerBindings as S}from"./collectExportGaps-DvirOIVB.mjs";import{reconcileWranglerCompatibilityDate as j}from"./reconcileWranglerCompatibilityDate-Cj94osA-.mjs";import{reconcileWranglerCrons as b,describePreservedCrons as C}from"./describePreservedCrons-i5XT6rtl.mjs";import{s as x,S as E}from"./studio-assets-BKWx838V.mjs";import{findWranglerFile as k,readWranglerJsonc as P}from"./WRANGLER_FILES-BF8PUjuo.mjs";const m=async r=>S(r.projectRoot,await u({cache:r.cache,projectRoot:r.projectRoot,schemaDir:r.schemaDir}),{target:r.target}),L=async(r,o,t)=>{try{const n=v(r.projectRoot,await m(r)),e=n.wranglerPath??"wrangler.jsonc";if(n.added.length>0&&o.info?.(`${a} inferred bindings → ${n.added.join(", ")} (written to ${e})`),n.updated.length>0&&o.info?.(`${a} updated bindings → ${n.updated.join(", ")} (written to ${e})`),n.devConfig!==void 0){const{added:i,path:s,updated:c}=n.devConfig;o.info?.(`${a} dev sidecar bindings → ${[...i,...c].join(", ")} (written to ${s})`)}for(const i of n.warnings)o.warn(`${a} ${i}`);n.exportGaps.length>0&&t?.(n.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);o.warn(`${a} binding inference skipped: ${e}`)}},M=async r=>{try{const{added:o,devConfig:t,updated:n}=await m(r),e=t===void 0?[]:[...t.added,...t.updated].map(i=>`${h(t.path)} ${i}`);return[...new Set([...o,...n,...e])]}catch{return[]}},f=new Map,N=(r,o,t)=>{try{const n=b(r,o);n.changed&&t.info?.(`${a} synced ${o.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${a} ${s}`);const e=n.preserved.join("\0"),i=C(n.preserved);i!==void 0&&(n.changed||f.get(r)!==e)&&t.info?.(`${a} ${i}`),f.set(r,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} cron trigger sync skipped: ${e}`)}try{const n=j(r);n.changed&&t.info?.(`${a} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${a} compatibility date sync skipped: ${e}`)}},W=["architecture.json","openapi.json","openrpc.json"],J=(r,o,t)=>{const n=k(r),e=n===void 0?void 0:P(n);if(n===void 0||e?.parsed===void 0)return;const i=x(r,e.parsed,o),s=y(e.text,e.parsed,i);if(i!==void 0&&l(d(p(n),i.directory),{recursive:!0}),s.text!==e.text&&($(n,s.text,"utf8"),t.info?.(`${a} ${[...s.added,...s.updated].join(", ")} → ${n}`)),i===void 0){const c=d(p(n),E,"_lunora","studio");for(const g of W)w(d(c,g),{force:!0})}};export{M as pendingBindingChanges,L as reconcileBindingsSafely,J as reconcileStudioAssets,N as reconcileWranglerExtras};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mkdirSync as g,writeFileSync as c}from"node:fs";import{join as u,dirname as l}from"node:path";import{readManifest as h}from"./readManifest-Cighz3WC.mjs";import{planWranglerBindings as f}from"./collectExportGaps-
|
|
1
|
+
import{mkdirSync as g,writeFileSync as c}from"node:fs";import{join as u,dirname as l}from"node:path";import{readManifest as h}from"./readManifest-Cighz3WC.mjs";import{planWranglerBindings as f}from"./collectExportGaps-DvirOIVB.mjs";const d=r=>r===void 0||r.added.length===0&&r.updated.length===0?void 0:{added:r.added,path:r.path,updated:r.updated},w=(r,e,{devConfigWritten:t,wranglerChanged:s})=>{const{manifest:o}=e;if(o===void 0)return[];const n=[];for(const i of e.records)try{i.write(h(r)??o,{devConfigWritten:t})}catch(a){n.push(`${s?"wrangler.jsonc was updated, but ":""}recording the ${i.label} reconcile owns in ${o.path} (lunora.${i.key}) failed: ${a instanceof Error?a.message:String(a)}. Until it is recorded, ${i.consequence}.`)}return n},p=(r,e)=>{if(!(r===void 0||r.text===r.original))try{c(r.path,r.text,"utf8");return}catch(t){return`${e?"wrangler.jsonc was updated, but ":""}writing ${r.path} failed: ${t instanceof Error?t.message:String(t)}. The dev sidecar keeps its previous service bindings until the next reconcile writes it.`}},v=(r,e)=>{const{edit:t,...s}=e;if(t===void 0||e.wranglerPath===void 0)return{...s,changed:!1,devConfig:d(e.devConfig)};const o=[...e.warnings],n=t.text!==t.original;t.assetsDirectory!==void 0&&g(u(l(e.wranglerPath),t.assetsDirectory),{recursive:!0}),n&&c(e.wranglerPath,t.text,"utf8");const i=p(e.devConfig,n);return i!==void 0&&o.push(i),o.push(...w(r,t,{devConfigWritten:i===void 0,wranglerChanged:n})),{...s,changed:n,devConfig:i===void 0?d(e.devConfig):void 0,...n?{}:{reason:"bindings already in sync"},warnings:o}},x=(r,e,t={})=>v(r,f(r,e,t));export{v as applyWranglerBindings,x as reconcileWranglerBindings};
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{mkdirSync as _,writeFileSync as E,rmSync as N,existsSync as D,readFileSync as a}from"node:fs";import{join as n}from"node:path";const u=".lunora",v=n(u,"dev.json"),h=n(u,"dev.log"),k=n(u,"dev-bindings.json"),T="LUNORA_DEV_DAEMON",U="LUNORA_DEV_LOG_FILE",x="LUNORA_DEV_HANDOFF_PID",m=r=>r!==null&&typeof r=="object",o=(r,e)=>{const t=r[e];return typeof t=="string"&&t.length>0?t:void 0},p=r=>{if(!Number.isInteger(r)||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}},y=1e4,g=100,A=r=>{if(process.platform==="linux")try{const e=a(`/proc/${String(r)}/stat`,"utf8"),t=e.slice(e.lastIndexOf(")")+2).split(" "),i=Number(t[19]),s=a("/proc/stat","utf8").split(`
|
|
2
|
-
`).find(l=>l.startsWith("btime ")),d=Number(s?.slice(6));return!Number.isFinite(i)||!Number.isFinite(d)?void 0:d*1e3+i/g*1e3}catch{return}},b=r=>{if(!p(r.pid))return!1;const e=r.startedAt===void 0?Number.NaN:Date.parse(r.startedAt);if(Number.isNaN(e))return!0;const t=A(r.pid);return t===void 0||t<=e+y},f=r=>{const e=n(r,v);if(!D(e))return;let t;try{t=JSON.parse(a(e,"utf8"))}catch{return}if(!m(t)||typeof t.pid!="number")return;const i=o(t,"url");if(i!==void 0)return{background:t.background===!0,logFile:o(t,"logFile"),mode:t.mode==="vite"?"vite":"cli",pid:t.pid,readyAt:o(t,"readyAt"),startedAt:o(t,"startedAt"),studioUrl:o(t,"studioUrl"),tunnelUrl:o(t,"tunnelUrl"),url:i}},c=(r,e)=>{try{_(n(r,u),{recursive:!0});const t=n(r,v);return E(t,`${JSON.stringify(e,void 0,2)}
|
|
3
|
-
`,"utf8"),t}catch{return}},C=(r,e,t)=>{const i=f(r);if(i===void 0||t?.expectedPid!==void 0&&i.pid!==t.expectedPid)return;const s={...i,...e};return c(r,s),s},M=r=>r?.readyAt!==void 0,O=(r,e)=>{try{if(e!==void 0){const t=f(r);if(t!==void 0&&t.pid!==e)return}N(n(r,v),{force:!0})}catch{}},F=r=>{const e=f(r);if(e!==void 0){if(b(e))return e;O(r,e.pid)}},I=(r,e,t)=>{const i=F(r);if(i!==void 0)return t!==void 0&&i.pid===t?{ok:c(r,e)!==void 0}:i.pid!==e.pid?{existing:i,ok:!1}:{ok:c(r,{...e,tunnelUrl:e.tunnelUrl??i.tunnelUrl})!==void 0}},P=(r,e,t)=>{const i=n(r,v),s=`${JSON.stringify(e,void 0,2)}
|
|
4
|
-
`;for(let d=0;d<2;d+=1)try{return _(n(r,u),{recursive:!0}),E(i,s,{encoding:"utf8",flag:"wx"}),{ok:!0}}catch(l){if(l.code!=="EEXIST")return{ok:c(r,e)!==void 0};const S=I(r,e,t?.supersedePid);if(S!==void 0)return S}return{ok:c(r,e)!==void 0}};export{k as DEV_BINDINGS_FILE,T as DEV_DAEMON_ENV,x as DEV_HANDOFF_ENV,h as DEV_LOG_FILE,U as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,v as DEV_STATE_FILE,P as claimDevServerState,O as clearDevServerState,M as isDevServerReady,p as isProcessAlive,b as isRecordedProcessCurrent,f as readDevServerState,F as readLiveDevServerState,C as updateDevServerState,c as writeDevServerState};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{applyModify as g}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as v}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as y,writeDevConfig as E,noopCleanup as R}from"./describeWithheld-CbyzZjZF.mjs";import{readManifest as w}from"./readManifest-Cighz3WC.mjs";import{o as S}from"./reconcile-services-CjgIJKim.mjs";import{findWranglerFile as _,readWranglerJsonc as j}from"./WRANGLER_FILES-BF8PUjuo.mjs";const h={ai:{label:"AI",shape:"object"},ai_search:{label:"AI Search",shape:"array"},ai_search_namespaces:{label:"AI Search namespace",shape:"array"},analytics:{label:"Analytics SQL",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},B=Object.keys(h),m=(e,n)=>typeof e.binding=="string"?e.binding:n,f=(e,n,r,t)=>{const i=[];for(const[s,o]of n.entries())o!=null&&(e==="kv_namespaces"&&(typeof o.id!="string"||o.id==="")||i.push({binding:m(o,`#${String(s)}`),kind:r,path:[...t,s],section:e}));return i},u=(e,n)=>h[e].shape===n,C=(e,n)=>{const{label:r}=h[e];if(u(e,"array"))return f(e,n[e]??[],r,[]);if(u(e,"object")){const t=n[e];return t==null?[]:[{binding:m(t,e),kind:r,path:[],section:e}]}return f(e,n.queues?.producers??[],r,["producers"])},I=e=>B.flatMap(n=>C(n,e)),k=(e,n)=>{let r=e;for(const t of n)r=g(r,[t.section,...t.path,"remote"],!0);return r},W=(e,n)=>({bindings:e.remoteBindings.map(r=>`${r.binding} (${r.kind})`),cleanup:e.cleanup,configPath:e.configPath,enabled:n,reason:e.reason,withheld:e.withheld}),$=e=>{const n=a=>({cleanup:R,reason:a,remoteBindings:[],withheld:[]}),r=_(e.projectRoot);if(!r)return n("wrangler.jsonc not found");const{parsed:t,text:i}=j(r);if(t===void 0)return n(`failed to parse ${r} as JSONC`);const s=S(w(e.projectRoot)),o=e.remote?I(t).filter(a=>a.section!=="services"||!s.has(a.binding)):[],l=y(t,e.hasCredentials??(()=>v({projectRoot:e.projectRoot}))),c=l.some(({kind:a})=>a==="ai")?o.filter(a=>a.section!=="ai"):o;if(c.length===0&&l.length===0)return n(e.remote?"no remote-eligible bindings to proxy":void 0);let d=i;for(const{kind:a}of l)d=g(d,[a],void 0);const b=c.length>0?k(d,c):d,p=E(e.projectRoot,"dev",b);return{cleanup:p.cleanup,configPath:p.configPath,remoteBindings:c,withheld:l}},L=e=>{if(e===void 0)return!1;const n=e.trim().toLowerCase();return n==="1"||n==="true"},D=e=>e.flag===!0||L(e.envValue)?!0:e.configPreference??!1;export{h as REMOTE_ELIGIBLE_KEYS,k as injectRemoteFlags,L as isRemoteEnvEnabled,$ as materializeDevWranglerConfig,I as planRemoteBindings,D as resolveRemoteEnabled,W as toRemotePlan};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{rmSync as l,readdirSync as c,writeFileSync as u}from"node:fs";import{join as a}from"node:path";const d=/^\.wrangler\.lunora-(?:dev|service)\.(\d+)\.\d+\.jsonc$/;let s=0;const f=n=>(s+=1,`.wrangler.lunora-${n}.${String(process.pid)}.${String(s)}.jsonc`),g=n=>{try{return process.kill(n,0),!0}catch(r){return r.code==="EPERM"}},p=n=>{let r;try{r=c(n)}catch{return}for(const t of r){const e=d.exec(t);if(!(e===null||Number(e[1])===process.pid||g(Number(e[1]))))try{l(a(n,t),{force:!0})}catch{}}},w=()=>{},m=n=>{let r=!1;return()=>{if(!r){r=!0;try{l(n,{force:!0})}catch{}}}},y=(n,r,t)=>{p(n);const e=a(n,f(r));return u(e,t,"utf8"),{cleanup:m(e),configPath:e}},b=(n,r)=>{const t=n?.ai,e=n?.artifacts,i=(Array.isArray(e)?e:[]).flatMap(o=>typeof o?.binding=="string"?[o.binding]:[]);return t==null&&i.length===0?[]:r()?[]:[...t==null?[]:[{binding:typeof t.binding=="string"?t.binding:"AI",kind:"ai"}],...i.map(o=>({binding:o,kind:"artifacts"}))]},v=({binding:n,kind:r})=>r==="ai"?`Workers AI is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Workers AI only runs remotely. \`@cf/…\` models will throw; AI SDK models and \`LUNORA_AI_PROXY_URL\` slugs still work. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`:`Artifacts is off in this dev session (${n} binding left out): no usable Cloudflare login found, and Artifacts only runs remotely. \`ctx.artifacts\` will throw. Run \`wrangler login\` or set CLOUDFLARE_API_TOKEN to turn it on.`;export{d as STALE_DEV_CONFIG,m as createCleanup,v as describeWithheld,f as devConfigBasename,w as noopCleanup,p as sweepStaleDevConfigs,b as withheldBindings,y as writeDevConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{statSync as j,readFileSync as k,existsSync as B,readdirSync as ue}from"node:fs";import{relative as pe,sep as me,isAbsolute as fe,join as E,dirname as $,resolve as ge}from"node:path";import{discoverFlags as he,FLAGS_FILENAME as Se,CAPABILITY_PROBES as Q,COMPANION_BINDING as z,ALL_NOTIFY_CHANNELS as Ee,readBoundServiceBindings as xe,discoverHttpRoutes as ye,discoverNotifyChannels as ve,NOTIFY_FILENAME as Ne,createTargetScope as Te,mayReadCapabilityContext as be,sourceCapabilitySignals as Ce,foldCapabilitySignals as V,capabilitiesUsedBy as Ae}from"@lunora/codegen";import{init as Re}from"es-module-lexer";import{ts as n,Node as m,Project as Z}from"ts-morph";import{discoverAgentInfo as Ie}from"./discoverAgentInfo-pqFMJBtJ.mjs";import{discoverContainerInfo as Oe}from"./discoverContainerInfo-DzXr7Vm3.mjs";import{escapeRegExp as _e}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{d as M}from"./discover-info-DC2MrAIM.mjs";import{PACKAGE_SECRETS_REGISTRY as we}from"./PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs";import{d as De}from"./queue-info-D38n7YdX.mjs";import{discoverSchemaInfo as Le}from"./discoverSchemaInfo-DRPnqgif.mjs";import{resolveWorkerEntry as Pe,composedEntryDurableObjects as $e,GENERATED_DIRECTORY as _,DURABLE_OBJECT_BINDINGS as Fe,detectExportedDurableObjects as je,detectClassExports as L,isMergedProject as ee}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{discoverWorkflowInfo as ke}from"./discoverWorkflowInfo-zW7Tt0Tn.mjs";const Be="/api/auth",Me="/.well-known/oauth-protected-resource",Ke="/.well-known/oauth-authorization-server",Ge=String.raw`\/\*[\s\S]*?\*\/`,Ue=String.raw`\/\/[^\n]*`,We=String.raw`"(?:[^"\\\n]|\\.)*"`,Ve=String.raw`'(?:[^'\\\n]|\\.)*'`,He=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,Ye=new RegExp([Ge,Ue,We,Ve,He].join("|"),"gu"),Xe=/[^\n]/gu,qe=e=>e.replaceAll(Xe," "),Je=e=>e.replaceAll(Ye,t=>t.startsWith("//")||t.startsWith("/*")?qe(t):t),Qe=(e,t)=>{const{error:o,value:s}=M(e,t,Se,he);return o===void 0?{flags:s}:{error:o}},te=(e,t)=>{const o=pe(t,e);return o!==""&&o!==".."&&!o.startsWith(`..${me}`)&&!fe(o)},b="@lunora/replica",h="EventLogDOClient",ze=/\.[cm]?[jt]sx?$/u,H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],Y=new Map,K=e=>{const{mtimeMs:t}=j(e),o=Y.get(e);if(o?.mtimeMs===t)return o.source;const s=n.createSourceFile(e,k(e,"utf8"),n.ScriptTarget.Latest);return Y.set(e,{mtimeMs:t,source:s}),s},X=new WeakMap,Ze=e=>{const t=X.get(e);if(t!==void 0&&t[0]?.wasForgotten()!==!0)return t;const o=e.getDescendantsOfKind(n.SyntaxKind.Identifier);return X.set(e,o),o},q=e=>n.sys.fileExists(e)?j(e).mtimeMs:-1,J=new Map,et=e=>{const t=n.findConfigFile($(e),i=>n.sys.fileExists(i));if(t===void 0)return{};const o=J.get(t);if(o!==void 0&&[...o.mtimes].every(([i,c])=>q(i)===c))return o.options;const s=n.readJsonConfigFile(t,i=>n.sys.readFile(i)),{options:r}=n.parseJsonSourceFileConfigFileContent(s,n.sys,$(t)),a=new Map([t,...s.extendedSourceFiles??[]].map(i=>[i,q(i)]));return J.set(t,{mtimes:a,options:r}),r},G=(e,t)=>{if(t===b)return;if(!t.startsWith("./")&&!t.startsWith("../")){const a={moduleResolution:n.ModuleResolutionKind.Bundler,...et(e)},i=n.resolveModuleName(t,e,a,n.sys).resolvedModule;return i?.isExternalLibraryImport===!0?void 0:i?.resolvedFileName}const o=E($(e),t.replace(ze,"")),s=H.map(a=>`${o}${a}`),r=H.map(a=>E(o,`index${a}`));return[...s,...r].find(a=>B(a))},tt=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings,r=s!==void 0&&n.isNamedImports(s)?s.elements:[];for(const a of r)a.isTypeOnly||t.set(a.name.text,{module:o.moduleSpecifier.text,name:(a.propertyName??a.name).text})}return t},st=e=>{const t=new Map;for(const o of e.statements){if(!n.isImportDeclaration(o)||o.importClause?.phaseModifier===n.SyntaxKind.TypeKeyword||!n.isStringLiteral(o.moduleSpecifier))continue;const s=o.importClause?.namedBindings;s!==void 0&&n.isNamespaceImport(s)&&t.set(s.name.text,o.moduleSpecifier.text)}return t},w=e=>n.canHaveModifiers(e)&&(n.getModifiers(e)??[]).some(t=>t.kind===n.SyntaxKind.ExportKeyword),ot=e=>n.isVariableStatement(e)?w(e)?e.declarationList.declarations.flatMap(t=>n.isIdentifier(t.name)?[t.name.text]:[]):[]:(n.isClassDeclaration(e)||n.isFunctionDeclaration(e))&&w(e)?e.name===void 0?[]:[e.name.text]:n.isExportDeclaration(e)&&e.moduleSpecifier===void 0&&!e.isTypeOnly&&e.exportClause!==void 0&&n.isNamedExports(e.exportClause)?e.exportClause.elements.map(t=>t.name.text):[],rt=e=>new Set(e.statements.flatMap(t=>ot(t))),nt=(e,t,o)=>{if(n.isIdentifier(e))return t.get(e.text);if(n.isPropertyAccessExpression(e)&&n.isIdentifier(e.expression)){const s=o.get(e.expression.text);return s===void 0?void 0:{module:s,name:e.name.text}}},it=(e,t,o)=>w(e)?e.declarationList.declarations.flatMap(s=>{if(!n.isIdentifier(s.name)||s.initializer===void 0)return[];const r=nt(s.initializer,t,o);return r===void 0?[]:[{exported:s.name.text,module:r.module,name:r.name}]}):[],at=(e,t)=>{const o=e.heritageClauses?.find(r=>r.token===n.SyntaxKind.ExtendsKeyword)?.types[0]?.expression;if(!w(e)||e.name===void 0||o===void 0||!n.isIdentifier(o))return[];const s=t.get(o.text);return s===void 0?[]:[{exported:e.name.text,module:s.module,name:s.name}]},ct=e=>{const t=tt(e),o=st(e);return e.statements.flatMap(s=>{if(n.isVariableStatement(s))return it(s,t,o);if(n.isClassDeclaration(s))return at(s,t);if(!n.isExportDeclaration(s)||s.isTypeOnly)return[];const{exportClause:r,moduleSpecifier:a}=s,i=a!==void 0&&n.isStringLiteral(a)?a.text:void 0;return r===void 0?i===void 0?[]:[{exported:void 0,module:i,name:void 0}]:n.isNamedExports(r)?r.elements.flatMap(c=>{if(c.isTypeOnly)return[];const d=c.name.text,l=(c.propertyName??c.name).text;if(i!==void 0)return[{exported:d,module:i,name:l}];const u=t.get(l);return u===void 0?[]:[{exported:d,module:u.module,name:u.name}]}):[]})},U=(e,t,o,s,r=new Set)=>{const a=JSON.stringify([e,o,[...r]]);if(s.has(a))return!1;s.add(a);const i=K(e),c=ct(i),d=new Set([...r,...rt(i),...c.flatMap(l=>l.exported===void 0?[]:[l.exported])]);return c.some(l=>{if(o!==void 0&&l.exported!==void 0&&l.exported!==o||l.exported!==void 0&&r.has(l.exported))return!1;if(l.exported===void 0){const g=o??(l.module===b?t:void 0);if(g!==void 0&&d.has(g))return!1}const u=l.exported===void 0?o:l.name;if(l.module===b)return u===void 0||u===t;const v=G(e,l.module);return v!==void 0&&U(v,t,u,s,l.exported===void 0?d:r)})},F=(e,t)=>Ze(e).some(o=>{const s=o.getParent();return o.getText()!==t||m.isNamespaceImport(s)||m.isPropertyAccessExpression(s)&&s.getNameNode()===o||m.isQualifiedName(s)&&s.getRight()===o?!1:m.isPropertyAccessExpression(s)?s.getName()===h:m.isQualifiedName(s)?!m.isTypeReference(s.getParent())&&s.getRight().getText()===h:!0}),dt=e=>{const[t]=e.getArguments();return e.getExpression().getKind()===n.SyntaxKind.ImportKeyword&&t!==void 0&&(m.isStringLiteral(t)||m.isNoSubstitutionTemplateLiteral(t))&&t.getLiteralValue()===b},lt=e=>{const t=e.getPropertyNameNode();if(t===void 0)return e.getNameNode().getText();const o=m.isComputedPropertyName(t)?t.getExpression():t;return m.isStringLiteral(o)||m.isNoSubstitutionTemplateLiteral(o)?o.getLiteralValue():t.getText()},ut=e=>{let t=e,o=!1;for(let r=e.getParent();m.isParenthesizedExpression(r)||m.isAwaitExpression(r);r=t.getParent())o||=m.isAwaitExpression(r),t=r;if(!o)return!0;const s=t.getParent();if(m.isVariableDeclaration(s)){const r=s.getNameNode();return!m.isObjectBindingPattern(r)||r.getElements().some(a=>a.getDotDotDotToken()!==void 0||lt(a)===h)}return m.isPropertyAccessExpression(s)&&s.getExpression()===t?s.getName()===h:!0},pt=(e,t)=>K(e).statements.some(o=>n.isExportDeclaration(o)&&o.moduleSpecifier!==void 0&&n.isStringLiteral(o.moduleSpecifier)&&o.moduleSpecifier.text===b&&o.exportClause!==void 0&&n.isNamespaceExport(o.exportClause)&&o.exportClause.name.text===t),mt=e=>e.getImportDeclarations().some(t=>{const o=t.getNamespaceImport(),s=t.isTypeOnly()?[]:t.getNamedImports().filter(d=>!d.isTypeOnly()),r=s.some(d=>d.getNameNode().getText()===h),a=s.filter(d=>F(e,(d.getAliasNode()??d.getNameNode()).getText())),i=o!==void 0&&F(e,o.getText());if(!r&&!i&&a.length===0)return!1;const c=G(e.getFilePath(),t.getModuleSpecifierValue());return c===void 0?!1:(r||i)&&U(c,h,h,new Set)||a.some(d=>pt(c,d.getNameNode().getText()))}),se=e=>{const t=e.getImportDeclarations().filter(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly());return t.some(o=>o.getNamedImports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||t.some(o=>{const s=o.getNamespaceImport();return s!==void 0&&F(e,s.getText())})||e.getExportDeclarations().some(o=>o.getModuleSpecifierValue()===b&&!o.isTypeOnly()&&o.getNamedExports().some(s=>!s.isTypeOnly()&&s.getNameNode().getText()===h))||mt(e)||e.getDescendantsOfKind(n.SyntaxKind.CallExpression).some(o=>dt(o)&&ut(o))},ft=e=>{const t=[],o=s=>{if(n.isImportDeclaration(s)&&s.importClause?.phaseModifier!==n.SyntaxKind.TypeKeyword&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isExportDeclaration(s)&&!s.isTypeOnly&&s.moduleSpecifier!==void 0&&n.isStringLiteral(s.moduleSpecifier))t.push(s.moduleSpecifier.text);else if(n.isCallExpression(s)&&s.expression.kind===n.SyntaxKind.ImportKeyword){const[r]=s.arguments;r!==void 0&&(n.isStringLiteral(r)||n.isNoSubstitutionTemplateLiteral(r))&&t.push(r.text)}n.forEachChild(s,o)};return o(e),t},gt=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ht=new Set([".git",".lunora-cache",".wrangler","dist",_,"node_modules"]),St=["lunora","src"],Et=/\benv\s*\.\s*DB\b/,xt=/\benv\s*\.\s*AI\b/,oe=["ai","aiSearch","analytics","analyticsSql","artifacts","browser","hyperdrive","images","kv","mail","notify","payments","pipelines","r2sql","scheduler","storage","x402"],re=e=>`uses${e.charAt(0).toUpperCase()}${e.slice(1)}`,ne=[["usesAuth","@lunora/auth"],["usesCimdWorkers","@lunora/auth/cimd/workers"],["usesX402Charge","@lunora/x402/charge"],["usesPaymentAutumn","@lunora/payment/autumn"],["usesPaymentCreem","@lunora/payment/creem"],["usesPaymentDodopayments","@lunora/payment/dodopayments"],["usesPaymentPolar","@lunora/payment/polar"],["usesPaymentStripe","@lunora/payment/stripe"]],ie=[...oe.map(e=>[re(e),Q[e].moduleSpecifier]),...ne].toSorted(([e],[t])=>e.localeCompare(t)),yt=[["usesNotifyFcm","@lunora/notify:fcm"],["usesNotifyFcmTokenSource","@lunora/notify:fcmTokenSource"],["usesNotifyWebPush","@lunora/notify:webPush"],["hostsShardRegistry","@lunora/do:shardRegistry"],["hostsEventLog","@lunora/replica:eventLog"],["usesEventLogClient","@lunora/replica:eventLogClient"],["usesRequestSecretTool","@lunora/agent:requestSecretTool"]],vt=["@lunora/agent","@lunora/agent/sandbox"],ae=new RegExp(String.raw`["'\x60](?:${[...ie.map(([,e])=>e),...vt,b].map(e=>_e(e)).join("|")})["'\x60]`,"u"),p=e=>{const{contextProperty:t,moduleSpecifier:o}=Q[e];return t===void 0?`${o} is imported`:`${o} is imported or ctx.${t} is read`},Nt="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",Tt=/\b(authBasePath|basePath):\s*(["'`])(\/[^"'`$\s]*)\2/gu,bt=/["']@lunora\/auth(?:\/[^"']*)?["']/u,Ct=/[Bb]asePath/u,At=e=>{const t=new Set;for(const o of e){const s=k(o,"utf8");if(!Ct.test(s))continue;const r=Je(s),a=bt.test(r);for(const[,i,,c]of r.matchAll(Tt)){const d=c?.endsWith("/")===!0?c.slice(0,-1):c??"";d!==""&&(i==="authBasePath"||a)&&t.add(d)}}return t.size===0?[Be]:[...t].toSorted((o,s)=>o.localeCompare(s))},Rt=(e,t,o,s)=>{const{error:r,value:a}=M(e,t,void 0,ye);if(r!==void 0)return;const i=o?[...At(s),Me,Ke].map(c=>`${c}/*`):[];return[...(a??[]).map(c=>c.path),...i]},It=/\bfrom\s+["']\.{1,2}\//u,ce=(e,t)=>{let o;try{o=ue(e,{withFileTypes:!0})}catch{return}for(const s of o){if(s.isDirectory()){ht.has(s.name)||ce(E(e,s.name),t);continue}const r=s.name.lastIndexOf(".");r!==-1&>.has(s.name.slice(r))&&t.push(E(e,s.name))}},Ot=(e,t,o)=>{const s=xe(e,t);return o?{...s,services:s.services.filter(r=>r.binding!==z)}:s},_t=(e,t,o)=>{const{info:s}=Le(e,t,o);return{jurisdiction:s?.jurisdiction,needsD1:s?.hasD1GlobalTable??!1}};let P;const wt=e=>{const t=ge(e);return P?.root!==t&&(P={project:new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),root:t}),P.project},Dt=(e,t,o)=>{e.getSourceFile(t)?.getFullText()!==o&&e.createSourceFile(t,o,{overwrite:!0})},Lt=(e,t)=>{for(const o of e.getSourceFiles())t.has(o)||e.removeSourceFile(o)},Pt=(e,t,o)=>{const s=E(e,o),r=wt(e),a=[],i=new Set,c=[],d=[],l=Te();let u=!1,v=!1;for(const f of t){const S=E(e,f);if(!B(S)||!j(S).isDirectory())continue;const O=[];ce(S,O);for(const A of O){i.add(A);const x=k(A,"utf8"),T=te(A,s);u||=xt.test(x),v||=Et.test(x),(ae.test(x)||x.includes(h)||T&&(be(x)||It.test(x)))&&(Dt(r,A,x),a.push({file:A,inLunora:T}))}}Lt(r,new Set(a.map(({file:f})=>r.getSourceFileOrThrow(f))));for(const{file:f,inLunora:S}of a)(S?c:d).push(Ce(r.getSourceFileOrThrow(f),l));const g=V(c),C=V([g,...d]),I=new Set([...C.valueImports,...C.dynamicImports]),N=Ae({contextReads:g.contextReads,valueImports:I});return{...Object.fromEntries([...oe.map(f=>[re(f),N.has(f)]),...ne.map(([f,S])=>[f,I.has(S)])]),needsD1:v,usesEventLogClient:a.some(({file:f})=>se(r.getSourceFileOrThrow(f))),usesRequestSecretTool:g.requestSecretTool,usesAi:N.has("ai")||u,usesBrowser:N.has("browser")||g.sandboxTools.usesSandboxBrowser,usesWorkerLoader:g.sandboxTools.usesSandboxLoader,scannedFiles:i}},$t=(e,t,o)=>[...e.map(s=>s.exported?`${s.bindingName}/${s.className} (container "${s.exportName}" declared and exported)`:`hint: container "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...t.map(s=>s.exported?`exports.${s.className} (workflow "${s.exportName}" declared and exported)`:`hint: workflow "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(s=>s.exported?`exports.${s.className} (agent "${s.exportName}" declared and exported)`:`hint: agent "${s.exportName}" is declared but ${s.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Ft=(e,t,o)=>[[e.usesAi,`AI (${p("ai")}, env.AI is used, or an agent is declared)`],[e.usesAuth&&!t.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!t.has("SchedulerDO"),`hint: ${p("scheduler")}, but no SchedulerDO is exported by the worker entry`],[e.usesStorage,`hint: ${p("storage")}; add an r2_buckets binding (bucket binding names are user-defined)`],[e.usesMail,`hint: ${p("mail")}; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)`],[e.usesPayments,`hint: ${p("payments")}; set the provider secrets in .dev.vars — ${Nt}`],[e.usesBrowser,`browser (${p("browser")}, or a sandbox browserTool imported in lunora/) — self-describing { binding: BROWSER }`],[e.usesImages,`images (${p("images")}) — self-describing { binding: IMAGES }`],[e.usesAnalytics,`analytics_engine_datasets (${p("analytics")}) — self-describing { binding: ANALYTICS, dataset }`],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesAiSearch,`ai_search_namespaces (${p("aiSearch")}) — self-describing { binding: AI_SEARCH, namespace: "default" }; remote-only, so \`lunora dev\` reaches the deployed AI Search service`],[e.usesAnalyticsSql,`analytics (${p("analyticsSql")}) — self-describing { binding: ANALYTICS_SQL }; needs wrangler >= 4.145.0, and is remote-only, so \`lunora dev\` queries the account's live analytics`],[e.usesKv,o.jurisdiction===void 0?`kv_namespaces (${p("kv")}) — { binding: KV } with no id; wrangler creates the namespace on the first deploy`:`hint: ${p("kv")} and the schema pins "${o.jurisdiction}"; create the namespace with --jurisdiction ${o.jurisdiction} and add a kv_namespaces binding ({ binding, id })`],[e.usesHyperdrive,`hyperdrive (${p("hyperdrive")}) — { binding: HYPERDRIVE } with a placeholder id; dev uses an embedded Postgres and \`lunora deploy\` creates the config`],[e.usesPipelines,`hint: ${p("pipelines")}; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, stream }) — the pipeline resource can't be auto-provisioned`],[e.usesArtifacts,o.jurisdiction===void 0?`artifacts (${p("artifacts")}) — { binding: ARTIFACTS, namespace }`:`hint: ${p("artifacts")}; the schema pins data to "${o.jurisdiction}", so create the namespace in that jurisdiction first and add { binding: ARTIFACTS, namespace } yourself — \`lunora deploy\` then checks it (a first create() in dev would make it unrestricted)`],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402,`hint: ${p("x402")} (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned`]].filter(([r])=>r).map(([,r])=>r),jt=(e,t,o,s=[],r=[],a=[])=>{const i=new Set(e.map(d=>d.className)),c=e.map(d=>`${d.binding}/${d.className} (exported by worker entry)`);return t.needsD1&&c.push("DB (.global() table declared)"),c.push(...$t(s,r,a),...Ft(o,i,t)),c},kt=(e,t)=>e.some(o=>o.binding==="SHARD_REGISTRY")||ee(t)&&B(E(t,"shardRegistry.ts")),Bt=(e,t,o)=>{const s=new Z({compilerOptions:{allowJs:!0},skipAddingFilesFromTsConfig:!0}),r=[e],a=new Set;for(let i=r.pop();i!==void 0;i=r.pop()){if(a.has(i))continue;a.add(i);const c=K(i),d=c.text;if((ae.test(d)||d.includes(h))&&se(s.createSourceFile(i,d,{overwrite:!0})))return!0;for(const l of ft(c)){const u=G(i,l);u!==void 0&&!t.has(u)&&!te(u,o)&&r.push(u)}}return!1},Mt=e=>!e.composed&&e.path!==void 0&&U(e.path,"EventLogDO",void 0,new Set),Kt=e=>({usesNotifyFcm:e?.fcm==="env",usesNotifyFcmTokenSource:e?.fcm==="ownToken",usesNotifyWebPush:e?.hasWebPush??!1}),ss=async e=>{await Re;const t=e.schemaDir??"lunora",o=e.scanDirs??St,s=()=>Pt(e.projectRoot,o,t),{scannedFiles:r,...a}=e.cache===void 0?s():e.cache.memo(`capabilities:${e.projectRoot}:${t}:${o.join(",")}`,s),i=Pe(e.projectRoot);let c;i.composed?c=$e(E(e.projectRoot,t,_)).map(W=>({binding:Fe[W],className:W})):c=i.path===void 0?[]:je(i.path);const d=_t(e.projectRoot,t,e.cache),l={...d,needsD1:a.needsD1||d.needsD1},u=L(i,Oe(e.projectRoot,t,e.cache).containers,"containers"),v=L(i,ke(e.projectRoot,t).workflows,"workflows"),g=L(i,Ie(e.projectRoot,t).agents,"agents"),C={...a,usesAi:a.usesAi||g.length>0},I=[...De(e.projectRoot,t).queues],{flags:N}=Qe(e.projectRoot,t),D=M(e.projectRoot,t,Ne,ve),f=N?.provider==="flagship"&&N.mode==="binding"?N.bindingName:void 0,S=E(e.projectRoot,t,_),O=kt(c,S),A=Mt(i),x=!i.composed&&i.path!==void 0&&Bt(i.path,r,S),T=jt(c,l,C,u,v,g);!i.composed&&ee(E(e.projectRoot,t,_))&&!c.some(y=>y.className==="LunoraDO")&&T.push("hint: durableObjects.merge is set, but the worker entry exports no LunoraDO — export one built with mergeDurableObjects, or the classes stay separate"),f!==void 0&&T.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${f}", app_id }) — the app_id can't be auto-provisioned`);const R=Ot(e.projectRoot,t,e.skipCompanion===!0),de=R.error===void 0?R.services:void 0;R.error!==void 0&&T.push(`hint: lunora.config \`services\` not reconciled — ${R.error}`),T.push(...R.services.map(y=>y.binding===z?`${y.binding} → ${y.worker} (studio.companion)`:`${y.binding} → ${y.worker} (lunora.config services.${y.name})`));const le=Rt(e.projectRoot,t,C.usesAuth,r);return{...C,usesEventLogClient:C.usesEventLogClient||x,agents:g,containers:u,durableObjects:c,flagshipBinding:f,...l.jurisdiction===void 0?{}:{jurisdiction:l.jurisdiction},needsD1:l.needsD1,queues:I,services:de,signals:T,usesFlags:N!==void 0,...Kt(D.error===void 0?D.value:Ee),hostsEventLog:A,hostsShardRegistry:O,workerRoutes:le,workflows:v}},os=e=>[...ie,...yt].filter(([t,o])=>e[t]&&we[o]!==void 0).map(([,t])=>t);export{ss as inferLunoraBindings,os as secretSourcesFromBindings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isAbsolute as p,dirname as m,resolve as h}from"node:path";import{applyModify as l}from"./applyModify-DKP2l6S9.mjs";import{hasCloudflareCredentials as u}from"./hasCloudflareCredentials-ByCrwaLT.mjs";import{withheldBindings as g,writeDevConfig as w}from"./describeWithheld-CbyzZjZF.mjs";import{readWranglerJsonc as v}from"./WRANGLER_FILES-BF8PUjuo.mjs";const C=(e,n)=>{const{parsed:t,text:c}=v(e),o=t?.build,r=g(t,n.hasCredentials??(()=>u({projectRoot:n.projectRoot}))),s=typeof o?.command=="string"&&o.command!==""&&!(typeof o.cwd=="string"&&p(o.cwd));if(!s&&r.length===0)return{configPath:e,withheld:r};const d=m(e);let i=c;for(const{kind:f}of r)i=l(i,[f],void 0);s&&(i=l(i,["build","cwd"],h(d,typeof o.cwd=="string"?o.cwd:".")));const a=w(d,"service",i);return{cleanup:a.cleanup,configPath:a.configPath,withheld:r}},x=(e,n)=>{const t=e.map(o=>C(o,n)),c=t.flatMap(o=>o.cleanup===void 0?[]:[o.cleanup]);return{cleanup:()=>{for(const o of c)o()},configPaths:t.map(o=>o.configPath),withheld:t.flatMap(o=>o.withheld)}};export{x as materializeServiceDevConfigs};
|