@lunora/config 1.0.0-alpha.47 → 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/LICENSE.md +336 -104
- package/README.md +6 -6
- package/dist/celld/index.d.mts +77 -0
- package/dist/celld/index.d.ts +77 -0
- package/dist/celld/index.mjs +1 -0
- package/dist/celld-names/index.d.mts +57 -0
- package/dist/celld-names/index.d.ts +57 -0
- package/dist/celld-names/index.mjs +1 -0
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.mjs +1 -0
- package/dist/cloudflare/index.d.mts +941 -0
- package/dist/cloudflare/index.d.ts +941 -0
- package/dist/cloudflare/index.mjs +1 -0
- package/dist/index.d.mts +1068 -1044
- package/dist/index.d.ts +1068 -1044
- package/dist/index.mjs +1 -25
- package/dist/packem_shared/ACCENT-CotPTfv7.mjs +7 -0
- package/dist/packem_shared/ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs +1 -0
- package/dist/packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs +1 -0
- package/dist/packem_shared/AGENT_RULES_DIR-Bd6JPtNa.mjs +1 -0
- package/dist/packem_shared/ALLOW_FORWARDED_ENV-BUndghJx.mjs +1 -0
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
- package/dist/packem_shared/BUILD_ROOT_ENV-Dg4MV3wY.mjs +1 -0
- package/dist/packem_shared/CELLD_RELEASE_ASSETS_DIRECTORY-YBhEotjs.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_DRIVER-DbmpoIcg.mjs +1 -0
- package/dist/packem_shared/CLOUDFLARE_TOOLCHAIN_VERSIONS-DWyZ_2QM.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs +1 -0
- package/dist/packem_shared/D1_PLACEHOLDER_ID-ZnDjVymH.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs +1 -0
- package/dist/packem_shared/DEFAULT_OBSERVABILITY-CPLADr5u.mjs +1 -0
- package/dist/packem_shared/DEV_BINDINGS_FILE-BUTedHwq.mjs +4 -0
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
- package/dist/packem_shared/DEV_WORKER_ENV_VALUE-FoysLtF0.mjs +1 -0
- package/dist/packem_shared/GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG-f8CnJha3.mjs +1 -0
- package/dist/packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs +2 -0
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
- package/dist/packem_shared/LUNORA_IGNORED_PATHS-U93uPxrW.mjs +19 -0
- package/dist/packem_shared/LUNORA_TAG-DQTGPqcJ.mjs +1 -0
- package/dist/packem_shared/LunoraReporter-f277GLNT.mjs +6 -0
- package/dist/packem_shared/MissingBuildOutputError-BAyekzof.mjs +1 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs +1 -0
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-DgmXfSuu.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs +1 -0
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs +1 -0
- package/dist/packem_shared/SEED_ENDPOINT-C1fhrehH.mjs +1 -0
- package/dist/packem_shared/STUDIO_PATH-CvVcvTbQ.mjs +1 -0
- package/dist/packem_shared/STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs +1 -0
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
- package/dist/packem_shared/acceptsConnection-DHhUYGjT.mjs +2 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/applyAdditiveEdit-DEwPKcJg.mjs +6 -0
- package/dist/packem_shared/applyModify-DKP2l6S9.mjs +1 -0
- package/dist/packem_shared/assertBuildTargetMatches-D11J7F38.mjs +1 -0
- package/dist/packem_shared/assertWranglerSatisfiesSchema-_70vhvqk.mjs +3 -0
- package/dist/packem_shared/asset-headers-CPuEX21i.mjs +4 -0
- package/dist/packem_shared/assetContentType-CUb5bpbI.mjs +1 -0
- package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.mts +593 -0
- package/dist/packem_shared/binding-manifest.d-BRdoMhGE.d.ts +593 -0
- package/dist/packem_shared/bindingsNeedingDatabase-3KyGflIq.mjs +3 -0
- package/dist/packem_shared/blockingFindingsMessage-BQ9z7cie.mjs +1 -0
- package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
- package/dist/packem_shared/canonicalPath-DrfMiT3U.mjs +1 -0
- package/dist/packem_shared/celld-binding-id-9MiUoteo.mjs +1 -0
- package/dist/packem_shared/celld-config-Ef1RZ02t.mjs +3 -0
- package/dist/packem_shared/checkDevEnv-BwZSVBbB.mjs +3 -0
- package/dist/packem_shared/classifyPolicyEdit-DJi9Fk8G.mjs +24 -0
- package/dist/packem_shared/clearApiSpecMarker-DMGpP41V.mjs +2 -0
- package/dist/packem_shared/collectExportGaps-DvirOIVB.mjs +2 -0
- package/dist/packem_shared/createConfirm-D5mKTMHj.mjs +7 -0
- package/dist/packem_shared/createDiscoveryCache-npJI4uej.mjs +1 -0
- package/dist/packem_shared/createStudioDocumentCache-XBG1aWbl.mjs +1 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.mts +190 -0
- package/dist/packem_shared/deploy-driver.d-CHVNQFV2.d.ts +190 -0
- package/dist/packem_shared/describePreservedCrons-i5XT6rtl.mjs +1 -0
- package/dist/packem_shared/describeWithheld-CN3D-4pU.mjs +1 -0
- package/dist/packem_shared/detectFramework-Dfpvu6rD.mjs +1 -0
- package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
- package/dist/packem_shared/devVariablesStamp-BQkGEn9d.mjs +1 -0
- package/dist/packem_shared/discover-info-DC2MrAIM.mjs +1 -0
- package/dist/packem_shared/discoverAgentInfo-pqFMJBtJ.mjs +1 -0
- package/dist/packem_shared/discoverContainerInfo-DzXr7Vm3.mjs +1 -0
- package/dist/packem_shared/discoverSchemaInfo-DRPnqgif.mjs +1 -0
- package/dist/packem_shared/discoverWorkflowInfo-zW7Tt0Tn.mjs +1 -0
- package/dist/packem_shared/emitProjectAssetHeaders-BdqdTVN3.mjs +1 -0
- package/dist/packem_shared/ensureGitignoreEntries-Tsk8Qkw7.mjs +7 -0
- package/dist/packem_shared/env-flag-u4B05gLp.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
- package/dist/packem_shared/index.d-BoUSSRrk.d.mts +270 -0
- package/dist/packem_shared/index.d-C1nVDcie.d.ts +270 -0
- package/dist/packem_shared/inferLunoraBindings-BUk28bSQ.mjs +1 -0
- package/dist/packem_shared/is-plain-object-CWxHeOY1.mjs +1 -0
- package/dist/packem_shared/is-within-directory-DRMw89rK.mjs +1 -0
- package/dist/packem_shared/isOwnedStudioAssets-CHII-uIX.mjs +1 -0
- package/dist/packem_shared/materializeServiceDevConfigs-CdmKflBp.mjs +1 -0
- package/dist/packem_shared/mergeWranglerEnvironment-CxT2PV1N.mjs +1 -0
- package/dist/packem_shared/parseSchema-D1Wbr1qv.mjs +1 -0
- package/dist/packem_shared/pendingBindingChanges-DkVojIQe.mjs +1 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.mts +338 -0
- package/dist/packem_shared/placeholder-ids.d-DvGHP6bl.d.ts +338 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.mts +86 -0
- package/dist/packem_shared/policy-scaffold.d-D2H4_G01.d.ts +86 -0
- package/dist/packem_shared/probeCelldToolchain-DxDttfHy.mjs +1 -0
- package/dist/packem_shared/process-tree-once-Ou4SfxKM.mjs +1 -0
- package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
- package/dist/packem_shared/readManifest-Cighz3WC.mjs +6 -0
- package/dist/packem_shared/readProjectDependencies-l3uhUKjo.mjs +1 -0
- package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerBindings-D6B81UKU.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-Cj94osA-.mjs +1 -0
- package/dist/packem_shared/renderStudioHtml-CRDTNivi.mjs +15 -0
- package/dist/packem_shared/resolveLocalWorkerEnv-C1s-quRt.mjs +1 -0
- package/dist/packem_shared/resolveSchemaDirectory-Ca5P6KuP.mjs +1 -0
- package/dist/packem_shared/runPostCodegenHook-Dx3yTsYZ.mjs +1 -0
- package/dist/packem_shared/scanWranglerVariablesForSecrets-DmdOBmwn.mjs +1 -0
- package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
- package/dist/packem_shared/sendStudioAsset-B81Pex91.mjs +1 -0
- package/dist/packem_shared/serveJsonHandler-B8_GE6QC.mjs +1 -0
- package/dist/packem_shared/spa-assets-wX8rTPEQ.mjs +1 -0
- package/dist/packem_shared/startCelldDevSession-DfuDVsha.mjs +1 -0
- package/dist/packem_shared/streamContainerLogs-0nko1qpv.mjs +2 -0
- package/dist/packem_shared/studio-assets-BKWx838V.mjs +1 -0
- package/dist/packem_shared/validate-bindings-DSMH8bRQ.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-BXOIqXxv.mjs +1 -0
- package/dist/packem_shared/wranglerCodegenInputs-B8iRZZZw.mjs +1 -0
- package/dist/packem_shared/wranglerToAlchemy-ClIdvJFu.mjs +5 -0
- package/dist/packem_shared/write-atomic-9sY2z8DB.mjs +3 -0
- package/dist/packem_shared/writeAssetHeaders-C5igmezc.mjs +1 -0
- package/dist/studio-host/index.d.mts +371 -136
- package/dist/studio-host/index.d.ts +371 -136
- package/dist/studio-host/index.mjs +1 -7
- package/package.json +43 -10
- package/dist/packem_shared/ACCENT-DW1XJn8i.mjs +0 -40
- package/dist/packem_shared/AGENT_MODE_ENV-DM1Siczo.mjs +0 -17
- package/dist/packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs +0 -40
- package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +0 -163
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs +0 -37
- package/dist/packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs +0 -52
- package/dist/packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs +0 -34
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs +0 -86
- package/dist/packem_shared/LunoraReporter-Ci-bDCK9.mjs +0 -70
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs +0 -70
- package/dist/packem_shared/POLICY_SCAFFOLD_ENDPOINT-8bNMHGiu.mjs +0 -104
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs +0 -105
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs +0 -561
- package/dist/packem_shared/SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs +0 -99
- package/dist/packem_shared/SEED_ENDPOINT-DVCjaGO-.mjs +0 -61
- package/dist/packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs +0 -25
- package/dist/packem_shared/applyAdditiveEdit-C-snTFEV.mjs +0 -228
- package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +0 -72
- package/dist/packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs +0 -281
- package/dist/packem_shared/classifyPolicyEdit-BHeAqF8P.mjs +0 -99
- package/dist/packem_shared/createConfirm-fvpdgJ9s.mjs +0 -100
- package/dist/packem_shared/detectFramework-U08038Yp.mjs +0 -41
- package/dist/packem_shared/discoverContainerInfo-BXFs6Wav.mjs +0 -19
- package/dist/packem_shared/discoverSchemaInfo-BB-CKlTK.mjs +0 -25
- package/dist/packem_shared/discoverWorkflowInfo-CedvR0mn.mjs +0 -19
- package/dist/packem_shared/inferLunoraBindings-ByMwG-gH.mjs +0 -352
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
- package/dist/packem_shared/parseSchema-DSeyktvG.mjs +0 -107
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.mts +0 -74
- package/dist/packem_shared/policy-scaffold.d-DCmwn7zQ.d.ts +0 -74
- package/dist/packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs +0 -334
- package/dist/packem_shared/renderStudioHtml-449Ysn75.mjs +0 -37
- package/dist/packem_shared/serveJsonHandler-B4OLTGLS.mjs +0 -86
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +0 -157
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
export { AGENT_MODE_ENV, detectAiAgent } from './packem_shared/AGENT_MODE_ENV-DM1Siczo.mjs';
|
|
2
|
-
export { AGENT_RULES_DIR, AGENT_RULES_HINT, AGENT_RULES_HINT_ENV, LUNORA_SKILL_NAMES, ROOT_SKILL_NAME, claimAgentRulesHint, detectAgentRules } from './packem_shared/AGENT_RULES_DIR-lcgC08aE.mjs';
|
|
3
|
-
export { discoverContainerInfo } from './packem_shared/discoverContainerInfo-BXFs6Wav.mjs';
|
|
4
|
-
export { streamContainerLogs } from './packem_shared/streamContainerLogs-BZ4cOZwH.mjs';
|
|
5
|
-
export { detectFramework, readProjectDependencyNames } from './packem_shared/detectFramework-U08038Yp.mjs';
|
|
6
|
-
export { DEV_DAEMON_ENV, DEV_HANDOFF_ENV, DEV_LOG_FILE, DEV_LOG_FILE_ENV, DEV_STATE_DIR, DEV_STATE_FILE, claimDevServerState, clearDevServerState, isProcessAlive, isRecordedProcessCurrent, readDevServerState, readLiveDevServerState, updateDevServerState, writeDevServerState } from './packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs';
|
|
7
|
-
export { DEV_VARS_EXAMPLE_FILE, DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, parseDevVariableEntries } from './packem_shared/DEV_VARS_EXAMPLE_FILE-dJPNTEnK.mjs';
|
|
8
|
-
export { inferLunoraBindings, packageNamesFromBindings } from './packem_shared/inferLunoraBindings-ByMwG-gH.mjs';
|
|
9
|
-
export { LINKED_PROJECT_DIR, LINKED_PROJECT_FILE, readLinkedProject, writeLinkedProject } from './packem_shared/LINKED_PROJECT_DIR-CXwXzV_C.mjs';
|
|
10
|
-
export { LUNORA_EVENT_SOURCE, formatLunoraEvent } from './packem_shared/LUNORA_EVENT_SOURCE-D2fDeGB6.mjs';
|
|
11
|
-
export { default as LunoraReporter } from './packem_shared/LunoraReporter-Ci-bDCK9.mjs';
|
|
12
|
-
export { PACKAGE_SECRETS_REGISTRY, secretsForPackages } from './packem_shared/PACKAGE_SECRETS_REGISTRY-B8t_SdoZ.mjs';
|
|
13
|
-
export { LUNORA_CONFIG_FILE, interpretRemote, readProjectRemotePreference } from './packem_shared/LUNORA_CONFIG_FILE-CtcIcB5-.mjs';
|
|
14
|
-
export { createConfirm, isInteractive, promptMultiSelect, promptSelect, promptYesNo } from './packem_shared/createConfirm-fvpdgJ9s.mjs';
|
|
15
|
-
export { reconcileWranglerBindings } from './packem_shared/reconcileWranglerBindings-Cruwwx1M.mjs';
|
|
16
|
-
export { REMOTE_ELIGIBLE_KEYS, injectRemoteFlags, isRemoteEnvEnabled, materializeRemoteWranglerConfig, planRemoteBindings, resolveRemoteEnabled } from './packem_shared/REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs';
|
|
17
|
-
export { buildPackageSecretsBlock, ensureDevVariables, ensureDevVarsExample, fillDevSecrets, generateSecretValue, isMintableSecretKey, isPlaceholderValue, planDevSecretsFill, planDevVariablesAugment, planDevVariablesScaffold, requiredSecrets } from './packem_shared/buildPackageSecretsBlock-B8iSX1Zo.mjs';
|
|
18
|
-
export { applyAdditiveEdit, classifyEdit } from './packem_shared/applyAdditiveEdit-C-snTFEV.mjs';
|
|
19
|
-
export { parseSchema } from './packem_shared/parseSchema-DSeyktvG.mjs';
|
|
20
|
-
export { classifyPolicyEdit, scaffoldPolicyFile, wireRlsIntoProcedure } from './packem_shared/classifyPolicyEdit-BHeAqF8P.mjs';
|
|
21
|
-
export { discoverSchemaInfo } from './packem_shared/discoverSchemaInfo-BB-CKlTK.mjs';
|
|
22
|
-
export { ACCENT, BADGES, BADGE_COLUMN_WIDTH, LUNA_ART, LUNA_BUNNY, LUNA_NAME, LUNA_SIGNOFF, STEP_BADGE_NAMES, badgeLead, badgeWidth, padBadge, paintAnswer, paintBadge } from './packem_shared/ACCENT-DW1XJn8i.mjs';
|
|
23
|
-
export { discoverWorkflowInfo } from './packem_shared/discoverWorkflowInfo-CedvR0mn.mjs';
|
|
24
|
-
export { WRANGLER_FILES, findWranglerFile, readWranglerJsonc } from './packem_shared/WRANGLER_FILES-DwSuC-Kn.mjs';
|
|
25
|
-
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWrangler, validateWranglerConfig, validateWranglerProject, withTailConsumer } from './packem_shared/REQUIRED_COMPATIBILITY_DATE-2YYyWJUq.mjs';
|
|
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,7 @@
|
|
|
1
|
+
import o from"@visulima/colorize";const g="#a855f7",e="#0b0b0b",s=["lunora","dir","tmpl","add","deps","git","next"],x={add:{bg:g,fg:e,text:"add"},debug:{bg:"#6b7280",fg:"#f3f4f6",text:"debug"},deps:{bg:g,fg:e,text:"deps"},dir:{bg:g,fg:e,text:"dir"},error:{bg:"#ef4444",fg:e,text:"error"},git:{bg:"#f59e0b",fg:e,text:"git"},info:{bg:"#3b82f6",fg:e,text:"info"},lunora:{bg:"#22c55e",fg:e,text:"lunora"},next:{bg:"#06b6d4",fg:e,text:"next"},success:{bg:"#22c55e",fg:e,text:"ok"},tmpl:{bg:g,fg:e,text:"tmpl"},warn:{bg:"#f59e0b",fg:e,text:"warn"}},c="Luna",i="Safe travels, voyager.",n=String.raw`
|
|
2
|
+
.-"""""-.
|
|
3
|
+
/ (\(\ \
|
|
4
|
+
| ( -.-) |
|
|
5
|
+
\ o(")(") /
|
|
6
|
+
'-._____.-'`,_=n.startsWith(`
|
|
7
|
+
`)?n.slice(1):n,b=6,a=t=>` ${t} `,f=t=>" ".repeat(Math.max(0,b-t.length)),r=b+2,A=t=>r,N=t=>f(t.text)+o.bgHex(t.bg).hex(t.fg).bold(a(t.text)),l=t=>o.dim(t);export{g as ACCENT,x as BADGES,r as BADGE_COLUMN_WIDTH,_ as LUNA_ART,n as LUNA_BUNNY,c as LUNA_NAME,i as LUNA_SIGNOFF,s as STEP_BADGE_NAMES,f as badgeLead,A as badgeWidth,a as padBadge,l as paintAnswer,N as paintBadge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFile as a}from"node:fs/promises";import{join as u}from"node:path";const f="/__lunora/advisor-procedures",d="advisor-procedures.json",c=new Set(["action","mutation","query"]),i=new Set(["internal","public"]),l=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return typeof r.exportName=="string"&&typeof r.file=="string"&&c.has(r.kind)&&i.has(r.visibility)&&["usesCaptcha","usesEmailGate","usesMask","usesRateLimit","usesRls"].every(s=>typeof r[s]=="boolean")},E=async e=>{if(e.method!=="GET")return{body:{error:"GET only"},status:405};const r=u(e.projectRoot,e.schemaDirectory??"lunora","_generated",d);let s;try{s=await a(r,"utf8")}catch(t){return t.code==="ENOENT"?{body:{error:"advisor-procedures.json is not generated yet; run `lunora codegen`."},status:404}:(console.error(`@lunora/config: could not read ${r}`,t),{body:{error:"advisor-procedures.json could not be read; see the dev server log."},status:500})}let o;try{o=JSON.parse(s)}catch{return{body:{error:"advisor-procedures.json is not valid JSON; re-run `lunora codegen`."},status:500}}const n=typeof o=="object"&&o!==null?o.procedures:void 0;return Array.isArray(n)?n.every(t=>l(t))?{body:o,status:200}:{body:{error:"advisor-procedures.json has a malformed procedure entry; re-run `lunora codegen`."},status:500}:{body:{error:"advisor-procedures.json has no procedures array; re-run `lunora codegen`."},status:500}};export{f as ADVISOR_PROCEDURES_ENDPOINT,E as handleAdvisorProceduresRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{detectAiSession as n}from"@visulima/find-ai-runner";const i="LUNORA_AGENT_MODE",r=o=>{const e=o.trim().toLowerCase();return e==="0"||e==="false"},a=(o=process.env)=>{const e=o[i];if(e!==void 0&&e!=="")return r(e)?void 0:{name:"agent (forced)",variable:i};const t=n(o);return t===void 0?void 0:{name:t.agent,variable:t.signal}};export{i as AGENT_MODE_ENV,a as detectAiAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as s}from"node:fs";import{join as t}from"node:path";import{c as a}from"./process-tree-once-Ou4SfxKM.mjs";const u=".agents/skills",i="LUNORA_RULES_HINT_SHOWN",c=["lunora","lunora-quickstart","lunora-functions","lunora-realtime","lunora-setup-auth","lunora-setup-hyperdrive","lunora-setup-hyperdrive-global","lunora-setup-mail","lunora-setup-scheduler","lunora-setup-storage","lunora-create-package","lunora-migration-helper","lunora-deploy","lunora-performance-audit","lunora-cloudflare-audit"],p="lunora",d="Lunora AI rules not installed — run `lunora rules install` so your coding agent knows how to use Lunora.",N=()=>a(i),l=(n,o)=>t(n,u,o,"SKILL.md"),g=n=>{const o=[],r=[];for(const e of c)s(l(n,e))?o.push(e):r.push(e);return{installed:s(l(n,p)),missing:r,present:o}};export{u as AGENT_RULES_DIR,d as AGENT_RULES_HINT,i as AGENT_RULES_HINT_ENV,c as LUNORA_SKILL_NAMES,p as ROOT_SKILL_NAME,N as claimAgentRulesHint,g as detectAgentRules};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=e=>{const o=Array.isArray(e)?e[0]:e;return typeof o=="string"?o.trim().toLowerCase():void 0},d=e=>{if(e===void 0||e==="")return!0;const o=e.toLowerCase(),r=o.startsWith("::ffff:")?o.slice(7):o;return r==="::1"?!0:r.startsWith("127.")},a=e=>{if(e===void 0)return;if(e.startsWith("[")){const r=e.indexOf("]");return r===-1?e.slice(1):e.slice(1,r)}const o=e.indexOf(":");return o===-1?e:e.slice(0,o)},c=new Set(["0.0.0.0","127.0.0.1","::1","localhost"]),u=["x-forwarded-for","x-forwarded-host","x-forwarded-proto","forwarded"],n="LUNORA_STUDIO_ALLOW_FORWARDED",l=()=>process.env[n]==="1",f=(e,o)=>{if(!d(e.socket?.remoteAddress??void 0))return"Lunora studio is only available on loopback connections in dev.";const r=a(i(e.headers?.host));if(r!==void 0&&!c.has(r))return"Lunora studio rejects a non-localhost Host header in dev.";const t=u.find(s=>e.headers?.[s]!==void 0);if(t!==void 0&&!l())return o?.warnOnce?.(`[lunora] studio: refusing a request carrying the "${t}" header — this dev server is being reached through a proxy/tunnel (Codespaces, devcontainers, Gitpod, Cloud Workstations, ngrok, and Docker reverse proxies all add this). If this is YOUR trusted dev tunnel, set ${n}=1 to allow it.`),`Lunora studio refuses a proxied request in dev (saw the "${t}" header). If you're intentionally running behind a trusted dev tunnel/proxy (e.g. Codespaces, devcontainers, Gitpod, ngrok), set ${n}=1 to allow it.`};export{n as ALLOW_FORWARDED_ENV,i as headerValue,d as isLoopbackAddress,f as transportRejectionReason};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const B=1,N=new Set(["$schema","account_id","compatibility_date","compatibility_flags","keep_vars","main","migrations","minify","name","observability","placement","routes","rules","secrets","triggers","upload_source_maps","vars","workers_dev"]),q=e=>Object.fromEntries(Object.entries(e).filter(([,i])=>i!==void 0)),K=[{bindingKey:"binding",field:"ai_search",resourceKey:"instance_name",type:"ai_search"},{bindingKey:"binding",field:"ai_search_namespaces",resourceKey:"namespace",type:"ai_search_namespace"},{bindingKey:"binding",field:"analytics_engine_datasets",resourceKey:"dataset",type:"analytics_engine"},{bindingKey:"binding",field:"artifacts",resourceKey:"namespace",type:"artifacts"},{bindingKey:"class_name",field:"containers",resourceKey:"image",type:"container"},{bindingKey:"binding",field:"d1_databases",resourceIdKey:"database_id",resourceKey:"database_name",type:"d1"},{bindingKey:"binding",field:"hyperdrive",resourceIdKey:"id",type:"hyperdrive"},{bindingKey:"binding",field:"kv_namespaces",resourceIdKey:"id",type:"kv"},{bindingKey:"binding",field:"pipelines",resourceKey:["stream","pipeline"],type:"pipeline"},{bindingKey:"binding",field:"r2_buckets",resourceKey:"bucket_name",type:"r2"},{bindingKey:"binding",field:"services",resourceKey:"service",type:"service"},{bindingKey:"binding",field:"vectorize",resourceKey:"index_name",type:"vectorize"},{bindingKey:"binding",field:"vpc_networks",resourceIdKey:["tunnel_id","network_id"],type:"vpc_network"},{bindingKey:"binding",field:"vpc_services",resourceIdKey:"service_id",type:"vpc_service"},{bindingKey:"binding",field:"workflows",resourceKey:"name",type:"workflow"}],w=[{field:"ai",type:"ai"},{field:"analytics",type:"analytics_sql"},{field:"assets",type:"assets"},{field:"browser",type:"browser"},{field:"images",type:"images"},{field:"media",type:"media"},{field:"stream",type:"stream"}],S=new Set([...K.map(e=>e.field),...w.map(e=>e.field),"durable_objects","exports","queues"]),u=(e,i)=>(typeof i=="string"?[i]:i??[]).map(n=>e[n]).find(n=>typeof n=="string"&&n!==""),b=(e,i,t,n)=>{const s=u(e,i);if(s!==void 0)return{name:s,wrongType:!1};const o=(typeof i=="string"?[i]:i??[]).find(r=>{const c=e[r];return c!=null&&typeof c!="string"});return o!==void 0&&n.add(`${t}.${o}`),{wrongType:o!==void 0}},_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),g=(e,i,t)=>{if(e==null)return[];if(!Array.isArray(e))return t.add(i),[];const n=e.filter(s=>_(s));return n.length!==e.length&&t.add(i),n},f=(e,i,t)=>{if(e==null)return[];if(!Array.isArray(e))return t.add(i),[];const n=e.filter(s=>typeof s=="string");return n.length!==e.length&&t.add(i),n},p=(e,i,t)=>_(e)?e:(e!=null&&t.add(i),{}),v=(e,i,t)=>{if(typeof e=="string")return e;e!=null&&t.add(i)},O=(e,i,t)=>{const n=[];for(const s of K)for(const o of g(e[s.field],s.field,t)){const{name:r,wrongType:c}=b(o,s.bindingKey,s.field,t);if(!c){if(r===void 0){i.push(s.field);continue}n.push({binding:r,className:u(o,"class_name"),resource:u(o,s.resourceKey),resourceId:u(o,s.resourceIdKey),type:s.type})}}return n},j=(e,i,t)=>{const n=new Set(g(e.migrations,"migrations",t).flatMap(r=>f(r.new_sqlite_classes,"migrations.new_sqlite_classes",t))),s=p(e.durable_objects,"durable_objects",t),o=[];for(const r of g(s.bindings,"durable_objects.bindings",t)){const{name:c,wrongType:y}=b(r,"name","durable_objects.bindings",t);if(y)continue;if(c===void 0){i.push("durable_objects");continue}const l=u(r,"class_name");o.push({binding:c,className:l,sqlite:r.script_name===void 0&&l!==void 0?n.has(l):void 0,type:"durable_object"})}return o},T=(e,i,t)=>{const n=p(e.queues,"queues",t),s=[];for(const o of g(n.producers,"queues.producers",t)){const{name:r,wrongType:c}=b(o,"binding","queues.producers",t);if(!c){if(r===void 0){i.push("queues.producers");continue}s.push({binding:r,resource:u(o,"queue"),type:"queue_producer"})}}for(const o of g(n.consumers,"queues.consumers",t)){const{name:r,wrongType:c}=b(o,"queue","queues.consumers",t);if(!c){if(r===void 0){i.push("queues.consumers");continue}s.push({binding:r,resource:r,type:"queue_consumer"})}}return s},A=(e,i,t)=>Object.entries(p(e.exports,"exports",t)).flatMap(([n,s])=>!_(s)||s.type!=="workflow"?(i.push(`exports.${n}`),[]):[{binding:n,className:n,resource:u(s,"name"),type:"workflow"}]),E=(e,i)=>w.flatMap(t=>{const{binding:n}=p(e[t.field],t.field,i);return n===void 0?[]:typeof n!="string"?(i.add(`${t.field}.binding`),[]):[{binding:n,type:t.type}]}),k=(e,i,t,n)=>[...A(e,t,n),...O(e,i,n),...j(e,i,n),...T(e,i,n),...E(e,n)],D=e=>{const i=[],t=[],n=new Set,s=p(e,"(wrangler config)",n),o=k(s,i,t,n).map(d=>q(d)).toSorted((d,a)=>d.type.localeCompare(a.type)||d.binding.localeCompare(a.binding)),r=[...Object.keys(s).filter(d=>!N.has(d)&&!S.has(d)),...i.map(d=>`${d} (entry with no binding name)`),...t].toSorted((d,a)=>d.localeCompare(a)),c=v(s.compatibility_date,"compatibility_date",n),y=s.compatibility_flags,l=y==null?void 0:f(y,"compatibility_flags",n),h=f(p(s.triggers,"triggers",n).crons,"triggers.crons",n),m=v(s.name,"name",n),I=Object.keys(p(s.vars,"vars",n)).toSorted((d,a)=>d.localeCompare(a));return{bindings:o,...c===void 0?{}:{compatibilityDate:c},...l===void 0?{}:{compatibilityFlags:l},crons:h,malformed:[...n].toSorted((d,a)=>d.localeCompare(a)),...m===void 0?{}:{name:m},unknown:r,vars:I,version:1}};export{B as BINDING_MANIFEST_VERSION,D as buildBindingManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as _}from"node:path";const E="LUNORA_CODEGEN",N="LUNORA_STRICT_ADVISORIES",t="LUNORA_LAZY_FUNCTIONS",L="LUNORA_BUILD_ROOT",A="LUNORA_BUILD_TARGET",T="LUNORA_BUNDLE_META_PATH",r=_(".lunora","vite-bundle-meta.json"),O=o=>{const n=o?.trim().toLowerCase();return n==="0"||n==="false"},s=o=>{const n=o?.trim().toLowerCase();return n==="1"||n==="true"},U=o=>o===!0||s(process.env[t]);export{L as BUILD_ROOT_ENV,A as BUILD_TARGET_ENV,T as BUNDLE_META_PATH_ENV,E as CODEGEN_ENV,r as DEFAULT_BUNDLE_META_PATH,t as LAZY_FUNCTIONS_ENV,N as STRICT_ADVISORIES_ENV,O as isCodegenDisabled,s as isLazyFunctionsEnabled,U as resolveLazyFunctions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CelldReleaseConfigError as b,CELLD_RELEASE_BINDING_TYPES as _,releaseResourceName as d}from"../celld-names/index.mjs";import{CELLD_RELEASE_BINDINGS as C,MAX_RELEASE_ALIAS_LENGTH as j,MAX_RESOURCE_NAME as v,RELEASE_ALIAS_PATTERN as k,isReleaseAlias as I}from"../celld-names/index.mjs";import{b as u}from"./celld-config-Ef1RZ02t.mjs";const E="worker.js",p="assets",A="lunora-v1",h=["nodejs_compat"],f=s=>{if(!_.has(s.type))return`${s.type} bindings do not run on celld`;if(s.type==="durable_object"){if(s.className===void 0)return"a Durable Object binding must name its class";if(s.sqlite!==!0)return s.sqlite===!1?`class ${s.className} is KV-backed, and celld creates only SQLite-backed classes`:`class ${s.className} belongs to another Worker; a celld fleet runs one`}if(s.type==="workflow"&&s.className===void 0)return"a workflow binding must name its class"},c=(s,n)=>s.bindings.filter(i=>i.type===n),m=(s,n)=>{const i=c(n,"queue_producer"),o=c(n,"queue_consumer");if(i.length===0&&o.length===0)return;const l=new Map(i.map(a=>[a.resource??a.binding,d(s,a.binding)]));return{...i.length===0?{}:{producers:i.map(a=>({binding:a.binding,queue:d(s,a.binding)}))},...o.length===0?{}:{consumers:o.map(a=>({queue:l.get(a.resource??a.binding)??d(s,a.binding)}))}}},L=(s,n,i)=>{const o=c(n,"durable_object"),l=[...new Set(o.map(e=>e.className))].toSorted((e,t)=>e.localeCompare(t)),a=c(n,"assets")[0],r={assets:i.hasAssets?{...a===void 0?{}:{binding:a.binding},directory:`./${p}`,...i.assetsConfig}:void 0,d1_databases:c(n,"d1").map(e=>{const t=d(s,e.binding);return{binding:e.binding,database_id:t,database_name:t}}),durable_objects:o.length===0?void 0:{bindings:o.map(e=>({class_name:e.className,name:e.binding}))},kv_namespaces:c(n,"kv").map(e=>({binding:e.binding,id:d(s,e.binding)})),migrations:l.length===0?[]:[{new_sqlite_classes:l,tag:A}],queues:m(s,n),r2_buckets:c(n,"r2").map(e=>({binding:e.binding,bucket_name:d(s,e.binding)})),workflows:c(n,"workflow").map(e=>({binding:e.binding,class_name:e.className,name:e.resource??e.binding}))};return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))},w=(s,n)=>{const i=s.bindings.flatMap(t=>{const g=f(t);return g===void 0?[]:[{binding:t.binding,reason:g,type:t.type}]});if(i.length>0)throw new b(`this release cannot run on celld: ${i.map(t=>`${t.binding} (${t.type}): ${t.reason}`).join("; ")}`,i);if(s.bindings.some(t=>t.type==="assets")!==n.hasAssets)throw new b(n.hasAssets?"the release carries assets but its manifest has no assets binding":"the manifest has an assets binding but the release carries no assets");const l=n.compatibilityDate??s.compatibilityDate,a={name:n.alias,main:E,no_bundle:!0,...l===void 0?{}:{compatibility_date:l},compatibility_flags:[...n.compatibilityFlags??s.compatibilityFlags??h],...Object.keys(n.vars).length===0?{}:{vars:{...n.vars}},...n.crons.length===0?{}:{triggers:{crons:[...n.crons]}},...L(n.alias,s,n)},{config:r,dropped:e}=u(a);if(e.length>0)throw new b(`celld would refuse ${e.join(", ")}`);return r};export{p as CELLD_RELEASE_ASSETS_DIRECTORY,C as CELLD_RELEASE_BINDINGS,_ as CELLD_RELEASE_BINDING_TYPES,E as CELLD_RELEASE_MAIN,b as CelldReleaseConfigError,j as MAX_RELEASE_ALIAS_LENGTH,v as MAX_RESOURCE_NAME,k as RELEASE_ALIAS_PATTERN,w as celldConfigFromRelease,I as isReleaseAlias,d as releaseResourceName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as c}from"node:fs";import{join as t,basename as f}from"node:path";import{i as l,c as d}from"./process-tree-once-Ou4SfxKM.mjs";import{findWranglerFile as u}from"./WRANGLER_FILES-BF8PUjuo.mjs";const m=["cloudflare.config.ts","cloudflare.config.mts","cloudflare.config.js","cloudflare.config.mjs"],g="https://github.com/anolilab/lunora/issues/964",s="LUNORA_CF_CONFIG_WARNING_SHOWN",C=o=>{const n=m.find(a=>c(t(o,a)));if(n===void 0)return;const e=u(o),r=e===void 0?void 0:f(e),i=r===void 0?"in the project root":`next to ${r}`;return{fix:`\`cf\` resource commands (zones, DNS, KV, …) are fine. Don't use \`cf dev\` / \`cf build\` / \`cf deploy\` on a Lunora project until Lunora supports \`cf\` — see ${g}.`,message:`${n} found ${i}. Lunora manages ${r??"the wrangler config"} and never updates a Cloudflare CLI (\`cf\`) config, so \`cf dev\` / \`cf build\` / \`cf deploy\` would run from a stale config, silently missing the bindings, Durable Object classes and migrations Lunora adds.`}},I=(o,n)=>{if(l(s))return!1;const e=C(o);return e===void 0||!d(s)?!1:(n(`${e.message} ${e.fix}`),!0)};export{s as CLOUDFLARE_CLI_CONFIG_WARNING_ENV,C as detectCloudflareCliConfig,I as warnCloudflareCliConfigOnce};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i={devServer:"workerd",prebuildsContainerImages:!0,deploy:o=>{if(o.preview===!0)throw new Error("the Cloudflare driver cannot build a preview upload; deploy an isolated preview with `lunora preview deploy`");const r=["deploy"];return o.entry!==void 0&&r.push(o.entry),o.configPath!==void 0&&r.push("--config",o.configPath),o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),o.dryRun===!0&&r.push("--dry-run"),o.secretsFile!==void 0&&r.push("--secrets-file",o.secretsFile),o.outDir!==void 0&&r.push("--outdir",o.outDir,"--metafile"),o.outFile!==void 0&&r.push("--outfile",o.outFile),{args:r,tool:"wrangler"}},dev:o=>{const r=["dev"];return o.configPath!==void 0&&r.push("--config",o.configPath),o.environment!==void 0&&r.push("--env",o.environment),r.push(...o.extraArgs??[]),{args:r,tool:"wrangler"}},secretList:o=>{const r=["secret","list","--format","json"];return o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},secretBulk:o=>{const r=["secret","bulk"];return o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},secretPut:o=>{const r=["secret","put",o.key??""];return o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},tail:o=>{const r=["tail"];return o.worker!==void 0&&r.push(o.worker),o.environment!==void 0&&r.push("--env",o.environment),o.format!==void 0&&r.push("--format",o.format),o.status!==void 0&&r.push("--status",o.status),o.search!==void 0&&r.push("--search",o.search),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}}},n={id:"cloudflare",name:"Cloudflare",toolchain:i};export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={"@cloudflare/vite-plugin":"^1.63.1","@cloudflare/workers-types":"^5.20261004.1",wrangler:"^4.156.1"};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as E,readFileSync as O}from"node:fs";import{parse as u}from"es-module-lexer";import{WRANGLER_FILES as b,readWranglerJsonc as f}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{escapeRegExp as S}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{join as c}from"node:path";const g="_generated",x=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],h=new Set(["build","coverage","dist",g,"node_modules","out","target"]),w=new Set([".client",".server"]),A=/[/\\]/u,T=t=>{const e=[];for(const r of t.split(A))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},L=t=>T(t).slice(0,-1).some(e=>h.has(e)||e.startsWith(".")&&!w.has(e)),i={AdminRevocationDO:"ADMIN_REVOCATIONS",LunoraDO:"SHARD",SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD",ShardRegistryDO:"SHARD_REGISTRY"},l=Object.keys(i),$=t=>Object.hasOwn(i,t),C="virtual:lunora/worker",d=["ShardDO"],J=["adminRevocations","agents","containers","scheduler","shardRegistry","workflows"],R={adminRevocations:"AdminRevocationDO",scheduler:"SchedulerDO",shardRegistry:"ShardRegistryDO"},D="LunoraDO",I=new Set([...d,...Object.values(R)]),N="durableObjects",y=t=>E(c(t,`${N}.ts`)),W=t=>Object.hasOwn(R,t),F=t=>y(t)?[D]:[...d,...Object.entries(R).filter(([e])=>E(c(t,`${e}.ts`))).map(([,e])=>e)],B=t=>t.includes(D)?t.filter(e=>!I.has(e)):[...t],U="src/worker.ts",Y=t=>{for(const e of b){const r=c(t,e);if(!E(r))continue;const{parsed:s}=f(r),o=s?.main;if(o===C)return{composed:!0};const a=c(t,U);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!L(o)&&E(c(t,o)))return{composed:!1,path:c(t,o)};break}for(const e of x){const r=c(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},v=/(?:^|[\s,{])type$/u,m=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return v.test(t.slice(0,r).trimEnd())},_=(t,e)=>{const r=S(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},H=t=>{const e=O(t,"utf8");let r;try{const[,s]=u(e);r=new Set(s.filter(o=>!m(e,o)).map(o=>o.n))}catch{r=new Set(l.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!_(e,s)))}return B(l.filter(s=>r.has(s))).map(s=>({binding:i[s],className:s}))},K=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=O(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=u(s);a=new Set(n.filter(p=>!m(s,p)).map(p=>p.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${S(n)}\b`,"u").test(s)&&!_(s,n)))}return e.map(n=>{const p=o||a.has(n.className);return{...n,exported:p}})};export{d as COMPOSED_ENTRY_DURABLE_OBJECTS,U as COMPOSED_WORKER_ENTRY,i as DURABLE_OBJECT_BINDINGS,J as GENERATED_CLASS_MODULES,g as GENERATED_DIRECTORY,R as GENERATED_MODULE_DURABLE_OBJECTS,C as LUNORA_WORKER_VIRTUAL_ID,D as MERGED_DURABLE_OBJECT,N as MERGED_DURABLE_OBJECTS_MODULE,I as MERGED_ROLE_DURABLE_OBJECTS,h as NON_SOURCE_DIRECTORIES,w as SOURCE_DOT_DIRECTORIES,x as WORKER_ENTRY_FALLBACKS,B as collapseMergedDurableObjects,F as composedEntryDurableObjects,K as detectClassExports,H as detectExportedDurableObjects,$ as isFrameworkDurableObject,L as isGeneratedOutput,y as isMergedProject,W as isMergedRoleModule,Y as resolveWorkerEntry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="<replace-with-d1-create-id>",r="<replace-with-hyperdrive-create-id>";export{e as D1_PLACEHOLDER_ID,r as HYPERDRIVE_PLACEHOLDER_ID};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as a}from"./celld-config-Ef1RZ02t.mjs";import s from"./CLOUDFLARE_DRIVER-DbmpoIcg.mjs";const p=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["secretsFile","celld has no secret store — a value the app reads from env is a `vars` entry in the deployed config"],["outFile","`celld deploy` does not write its upload artifact to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],l=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},v={deploy:e=>{const o=p.find(([r])=>e[r]!==void 0&&e[r]!==!1);if(o!==void 0)throw new Error(o[1]);return{args:["deploy",l(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",l(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},f={id:"celld",name:"celld",projectConfig:a,toolchain:v},h={id:"node",name:"Node"},m="cloudflare",t={celld:f,cloudflare:s,node:h},d=()=>Object.keys(t).toSorted((e,o)=>e.localeCompare(o)),i=(e=m)=>{const o=t[e];if(o===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${d().join(", ")}`);return o},g=e=>Object.hasOwn(t,e)&&i(e).toolchain!==void 0,E=()=>d().filter(e=>g(e)),D=e=>i(e).toolchain?.devServer==="own",O=(e,o,r,c)=>{const n=e.projectConfig?.(o,r);return{command:c(n?.configPath),commit:()=>n?.write(),projection:n===void 0?void 0:{configPath:n.configPath,dropped:n.dropped}}};export{m as DEFAULT_DEPLOY_TARGET,d as deployTargetIds,g as isRunnableTarget,O as planToolchainInvocation,i as resolveDeployDriver,E as runnableTargetIds,D as targetRunsOwnDevServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=Object.freeze({enabled:!0,head_sampling_rate:1,redact_query_string:!0}),t=1,l=n=>{const e=n??a;return{logs:{enabled:e.logs?.enabled??e.enabled??a.enabled,headSamplingRate:e.logs?.head_sampling_rate??e.head_sampling_rate??t},traces:{enabled:e.traces?.enabled===!0,headSamplingRate:e.traces?.head_sampling_rate??t}}};export{a as DEFAULT_OBSERVABILITY,l as resolveObservabilitySampling};
|
|
@@ -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,6 @@
|
|
|
1
|
+
import{readFileSync as p}from"node:fs";import{parse as u}from"dotenv";const $=".dev.vars",f=".dev.vars.example",m=/^[A-Za-z_]\w*$/u,A=/\r?\n/u,l=e=>Object.entries(u(e)).map(([r,t])=>({key:r,value:t})),h=e=>{let r;try{r=p(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}return Object.fromEntries(l(r).map(({key:t,value:n})=>[t,n]))},L=e=>e===void 0?[".env",".env.local"]:[".env",".env.local",`.env.${e}`,`.env.${e}.local`],d=e=>l(e)[0],R=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`),V=/(\r?\n)/u,v=(e,r,t)=>{const n=e.split(V),o=[];let a=!1;for(let s=0;s<n.length;s+=2){const c=n[s]??"",i=n[s+1]??"";if(d(c)?.key!==r){o.push(c,i);continue}const E=!a;a=!0,t!==void 0&&E&&o.push(t,i)}return{content:o.join(""),matched:a}},b=(e,r,t)=>{const n=`${r}="${t}"`,o=v(e,r,n);return o.matched?o.content:e===""?`${n}
|
|
2
|
+
`:e.endsWith(`
|
|
3
|
+
`)?`${e}${n}
|
|
4
|
+
`:`${e}
|
|
5
|
+
${n}
|
|
6
|
+
`},N=(e,r)=>v(e,r,void 0).content;export{f as DEV_VARS_EXAMPLE_FILE,$ as DEV_VARS_FILE,m as DEV_VARS_KEY_PATTERN,A as DEV_VARS_NEWLINE,R as escapeRegExp,l as parseDevVariableEntries,d as parseDevVariableLine,h as readDevVariablesRecord,N as removeDevVariableLine,b as upsertDevVariableLine,L as wranglerDotenvFiles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as l}from"node:fs";import{findWranglerFile as m,readWranglerJsonc as E}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{DEV_VARS_FILE as i,parseDevVariableEntries as V,upsertDevVariableLine as c}from"./DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs";import{writeDevVariablesFileAtomically as p}from"./buildPackageSecretsBlock-DrSD60vH.mjs";import{join as v}from"node:path";const n="WORKER_ENV",a="development",d=e=>{const r=m(e);return r===void 0?{}:E(r).parsed?.vars??{}},W=(e,r)=>{const o=v(e,i);let t;try{t=l(o,"utf8")}catch{return}V(t).some(s=>s.key===n)||n in d(e)||(p(o,c(t,n,a)),r(`set ${n}=${a} in ${i} so the dev worker runs in development mode`))};export{a as DEV_WORKER_ENV_VALUE,n as DEV_WORKER_ENV_VAR,W as ensureDevWorkerEnv};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _="global_fetch_strictly_public";export{_ as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as u,readFileSync as f,mkdirSync as k,writeFileSync as m}from"node:fs";import{parse as p}from"jsonc-parser";import{join as i}from"node:path";const l=".lunora",d=i(l,"project.json"),v=r=>r!==null&&typeof r=="object",c=(r,o)=>{const e=r[o];return typeof e=="string"&&e.length>0?e:void 0},j=r=>{const o=i(r,d);if(!u(o))return;let e;try{e=f(o,"utf8")}catch{return}const n=[],t=p(e,n,{allowTrailingComma:!0});if(!(n.length>0||!v(t)))return{account:c(t,"account"),env:c(t,"env"),linkedAt:c(t,"linkedAt"),workerName:c(t,"workerName"),workerUrl:c(t,"workerUrl")}},E=(r,o)=>{const e=i(r,l);k(e,{recursive:!0});const n={};for(const a of["account","env","linkedAt","workerName","workerUrl"]){const s=o[a];s!==void 0&&s!==""&&(n[a]=s)}const t=i(r,d);return m(t,`${JSON.stringify(n,void 0,2)}
|
|
2
|
+
`,"utf8"),t};export{l as LINKED_PROJECT_DIR,d as LINKED_PROJECT_FILE,j as readLinkedProject,E as writeLinkedProject};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const R=t=>{const r=String(t.name),s=String(t.message);return s===""?r:`${r}: ${s}`},u=t=>{if(typeof t=="string")return t;if(t instanceof Error)return R(t);try{return JSON.stringify(t)??String(t)}catch{return String(t)}};const E=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),$=t=>E(t)&&typeof t.name=="string"&&typeof t.message=="string"?t:void 0,m=t=>{let r=t;if(typeof t=="string"){if(!t.startsWith("{")||!t.endsWith("}"))return;try{r=JSON.parse(t)}catch{return}}const s=$(r);return s!==void 0&&(typeof s.stack=="string"||s.cause!==void 0||Array.isArray(s.errors))?s:void 0},d=t=>t.message===""?t.name:`${t.name}: ${t.message}`,A=/^[\w$.]+$/u,_=t=>{if(typeof t.stack!="string")return[];let r=t.stack;const s=t.message===""?-1:r.indexOf(t.message),n=s===-1?"":r.slice(0,s);return s>0&&n.endsWith(": ")&&!n.includes(`
|
|
2
|
+
`)?r=r.slice(s+t.message.length):t.message===""&&A.test(r.split(`
|
|
3
|
+
`,1)[0]??"")&&(r=r.slice((r.split(`
|
|
4
|
+
`,1)[0]??"").length)),r.split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(e=>e!=="")},h=(t,r,s=0)=>{const n=`${r} `,e=[d(t),..._(t).map(o=>`${n}${o}`)],i=(o,a)=>{const f=$(a);return f===void 0?`${r}${o}: ${u(a)}`:`${r}${o}: ${s>=4?d(f):h(f,n,s+1).join(`
|
|
6
|
+
`)}`};return Array.isArray(t.errors)&&t.errors.slice(0,10).forEach((o,a)=>{e.push(i(`errors[${String(a)}]`,o))}),t.cause!==void 0&&e.push(i("caused by",t.cause)),e},l=(t,r="")=>t.map(([s,n])=>`${r}${s}: ${h(n,`${r} `).join(`
|
|
7
|
+
`)}`).join(`
|
|
8
|
+
`);const S=t=>{if(typeof t!="string")return t;if(!(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]"))))try{return JSON.parse(t)}catch{return}},g=(t,r,s,n)=>{if(n.length>=10||s>=8||typeof t!="object"||t===null)return;const e=m(t);if(e!==void 0){n.push([r,e]);return}if(Array.isArray(t)){t.forEach((i,o)=>{g(i,`${r}[${String(o)}]`,s+1,n)});return}for(const[i,o]of Object.entries(t))g(o,`${r}.${i}`,s+1,n)},O=t=>{if(!E(t))return{errors:[],text:""};const r=[],s=[];for(const[n,e]of Object.entries(t)){const i=m(e);if(i===void 0){s.push(`${n}=${u(e)}`);const o=[];g(S(e),n,0,o),r.push(...o)}else r.push([n,i]),s.push(`${n}=${d(i)}`)}return{errors:r,text:s.join(" ")}},j="lunora",N="__root__",c=t=>typeof t=="string"?t:"",p=t=>Array.isArray(t)?t.filter(r=>typeof r=="string"):[],k=t=>typeof t=="number"&&Number.isFinite(t)?`${String(Math.round(t))}ms`:"?ms",M=t=>t==="error"||t==="fatal"?"error":t==="warn"?"warn":"info",b=t=>{const r=t.trim();if(!r.startsWith("{")||!r.endsWith("}"))return;let s;try{s=JSON.parse(r)}catch{return}if(typeof s!="object"||s===null)return;const n=s;return n.source===j?n:void 0},y=(t,r)=>{const s=c(r.shard);return s===""||s===N?t:`${t}@${s}`},D=(t,r)=>{const s=t.outcome==="error",n=[y(r,t),s?"error":"ok",k(t.durationMs)],e=p(t.tablesRead),i=p(t.tablesWritten);e.length>0&&n.push(`read[${e.join(",")}]`),i.length>0&&n.push(`write[${i.join(",")}]`),t.cacheHit===!0&&n.push("cached");const o=c(t.error);return s&&o!==""&&n.push(o),{kind:"rpc",level:s?"error":"info",text:n.join(" ")}},G=t=>{const r=c(t.container)||"<unknown>",s=c(t.instance),n=c(t.event)||"event",e=s===""||s==="unknown"?"":`#${s.slice(0,8)}`,i=c(t.message),o=[`container:${r}${e}`,n];return i!==""&&o.push(i),{kind:"log",level:t.event==="error"?"error":"info",text:o.join(" ")}},T=t=>{const r=b(t);if(!r)return;const s=c(r.function)||"<unknown>";if(r.type==="log"){const n=[`${y(s,r)} ${c(r.message)}`.trimEnd()],e=O(r.fields);e.text!==""&&n.push(e.text);const i=c(r.traceId);i!==""&&n.push(`trace=${i.slice(0,8)}`);const o=e.errors.length===0?"":`
|
|
9
|
+
${l(e.errors," ")}`;return{kind:"log",level:M(c(r.level)),text:n.join(" ")+o}}if(r.type==="request")return D(r,s);if(r.type==="container")return G(r)};export{j as LUNORA_EVENT_SOURCE,T as formatLunoraEvent};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{existsSync as g,readFileSync as h,writeFileSync as d}from"node:fs";import{join as p,dirname as x}from"node:path";import{parse as v}from"jsonc-parser";import{applyModify as $}from"./applyModify-DKP2l6S9.mjs";import{readProjectDependencyNames as S,readProjectManifest as w}from"./readProjectDependencies-l3uhUKjo.mjs";const c=["lunora/_generated/","lunora/.lunora-schema.json","lunora.advisor.map.json",".lunora/",".wrangler/"],f={biome:{configFiles:["biome.json","biome.jsonc"],packages:["@biomejs/biome"],shadowable:!0},eslint:{configFiles:["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],packages:["eslint"],shadowable:!0},oxlint:{configFiles:[".oxlintrc.json"],packages:["oxlint"],shadowable:!0},prettier:{configFiles:[".prettierrc",".prettierrc.json",".prettierrc.js",".prettierrc.mjs",".prettierrc.cjs","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],packages:["prettier"],shadowable:!1}},L=Object.keys(f),y=(e,n)=>f[n].configFiles.map(t=>p(e,t)).find(t=>g(t)),k=(e,n)=>{let t=e;for(;;){const i=y(t,n);if(i!==void 0)return i;if(g(p(t,".git")))return;const s=x(t);if(s===t)return;t=s}},j=(e,n)=>{const t=y(e,n);if(t!==void 0)return{action:"extend",path:t};const i=g(p(e,".git")),s=f[n].shadowable&&!i?k(x(e),n):void 0,[a=""]=f[n].configFiles;return s===void 0?{action:"create",path:p(e,a)}:{action:"report",path:s}},U=e=>{const n=S(e),t=()=>w(e)?.prettier!==void 0;return L.filter(i=>f[i].packages.some(s=>n.has(s))||y(e,i)!==void 0||i==="prettier"&&t())},O="# Lunora generated + derived artifacts",I=e=>{const n=p(e,".prettierignore"),t=g(n)?h(n,"utf8"):void 0,i=t===void 0?[]:t.split(`
|
|
2
|
+
`).map(o=>o.trim()),s=c.filter(o=>!i.includes(o));if(s.length===0)return{path:n,status:t===void 0?"created":"unchanged",tool:"prettier"};const a=`${O}
|
|
3
|
+
${s.join(`
|
|
4
|
+
`)}
|
|
5
|
+
`;return t===void 0?(d(n,a,"utf8"),{path:n,status:"created",tool:"prettier"}):(d(n,`${t.endsWith(`
|
|
6
|
+
`)?t:`${t}
|
|
7
|
+
`}
|
|
8
|
+
${a}`,"utf8"),{path:n,status:"updated",tool:"prettier"})},A=(e,n,t,i)=>{const s=g(e),a=s?h(e,"utf8"):`{}
|
|
9
|
+
`;let r=v(a)??{};for(const l of n)r=r!==null&&typeof r=="object"?r[l]:void 0;const m=Array.isArray(r)?r:[],b=t.filter(l=>!m.includes(l));return b.length===0&&s?{path:e,status:"unchanged",tool:i}:(d(e,$(a,n,[...m,...b]),"utf8"),{path:e,status:s?"updated":"created",tool:i})},F=(e,n)=>`"${e}": [${n.map(t=>`"${t}"`).join(", ")}]`,P=()=>F("files.includes",c.map(e=>`!${e.endsWith("/")?`${e}**`:e}`)),E=e=>{const{action:n,path:t}=j(e,"oxlint");return n==="report"?{path:t,snippet:F("ignorePatterns",c),status:"manual",tool:"oxlint"}:A(t,["ignorePatterns"],c,"oxlint")},T=e=>{const{action:n,path:t}=j(e,"biome");if(n==="report")return{path:t,snippet:P(),status:"manual",tool:"biome"};const i=n==="extend",s=i?h(t,"utf8"):`{}
|
|
10
|
+
`,o=(v(s)??{}).files??{};if(Array.isArray(o.ignore))return A(t,["files","ignore"],c,"biome");const r=Array.isArray(o.includes)?o.includes:[],m=r.length===0?["**"]:r,l=c.map(u=>`!${u.endsWith("/")?`${u}**`:u}`).filter(u=>!r.includes(u));return l.length===0&&i?{path:t,status:"unchanged",tool:"biome"}:(d(t,$(s,["files","includes"],[...m,...l]),"utf8"),{path:t,status:i?"updated":"created",tool:"biome"})},W=()=>`{
|
|
11
|
+
// Lunora generated + derived artifacts.
|
|
12
|
+
ignores: [${c.map(e=>`"${e.endsWith("/")?`${e}**`:e}"`).join(", ")}],
|
|
13
|
+
}`,_=e=>{const{action:n,path:t}=j(e,"eslint"),i=W();if(n!=="create"){const a=h(t,"utf8"),o=c.every(r=>a.includes(r))?"unchanged":"manual";return{path:t,...o==="manual"?{snippet:i}:{},status:o,tool:"eslint"}}const s=p(e,"eslint.config.mjs");return d(s,`// Flat config. Add your own entries alongside the ignores below.
|
|
14
|
+
export default [
|
|
15
|
+
${i.replaceAll(`
|
|
16
|
+
`,`
|
|
17
|
+
`)},
|
|
18
|
+
];
|
|
19
|
+
`,"utf8"),{path:s,status:"created",tool:"eslint"}},C={biome:T,eslint:_,oxlint:E,prettier:I},G=(e,n)=>n.map(t=>{try{return C[t](e)}catch(i){return{message:i instanceof Error?i.message:String(i),path:e,status:"failed",tool:t}}});export{c as LUNORA_IGNORED_PATHS,G as applyLintIgnores,U as detectLintTools};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{paintBadge as r,BADGES as o}from"./ACCENT-CotPTfv7.mjs";const A=r(o.lunora),e=n=>`${A} ${n}`,R={ERROR:o.error,INFO:o.info,WARN:o.warn},s=(n,t,a,i)=>`${r(R[n])} ${t}: ${a} — ${i}`;export{A as LUNORA_TAG,s as advisoryLine,e as lunoraLine};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{paintBadge as d,badgeWidth as g,BADGES as s}from"./ACCENT-CotPTfv7.mjs";const p={informational:"info",warning:"warn"},f=new Set(["alert","critical","emergency","error","warn","warning"]),l=t=>{if(t in s)return s[t];const e=p[t];return e===void 0?void 0:s[e]},m=t=>{if(t instanceof Error)return`
|
|
2
|
+
${t.stack??t.message}`;if(typeof t=="object"&&t!==null)try{return` ${JSON.stringify(t)}`}catch{return" [unserializable]"}return` ${String(t)}`},S=t=>{const e=typeof t.message=="string"?t.message:String(t.message),r=t.context??[];return r.length===0?e:e+r.map(n=>m(n)).join("")};class i{#t=process.stdout;#e=process.stderr;setStdout(e){this.#t=e}setStderr(e){this.#e=e}log(e){const r=e,n=l(r.type.name);(f.has(r.type.level??r.type.name)?this.#e:this.#t).write(i.#r(n,S(r)))}static#r(e,r){if(e===void 0)return`${r}
|
|
3
|
+
`;const[n="",...o]=r.split(`
|
|
4
|
+
`),c=" ".repeat(g()+1);return`${[`${d(e)} ${n}`,...o.map(a=>`${c}${a}`)].join(`
|
|
5
|
+
`)}
|
|
6
|
+
`}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class s extends Error{}export{s as MissingBuildOutputError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i}from"./secret-key-xi4VK8Jw.mjs";const p=[{description:"Bearer token the local Lunora Studio uses to call the worker's admin endpoints (data browser, schema edits) in dev. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/studio",key:"LUNORA_ADMIN_TOKEN",placeholderValue:"replace-with-openssl-rand-hex-32"}],o="LUNORA_RELAY_SECRET",r="replace-with-openssl-rand-hex-32",d=new Set(["@lunora/do:shardRegistry","@lunora/replica:eventLog"]),h="@lunora/replica:eventLogClient",u=["BETTER_AUTH_SECRET","STORAGE_SIGNING_SECRET"],l={"@lunora/auth":[{description:"32-byte random secret used to sign sessions and tokens. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_SECRET",placeholderValue:"replace-with-openssl-rand-hex-32"},{description:"Public base URL of your worker (used by better-auth for redirects and cookie domain). For local dev this is typically http://localhost:8787",docsUrl:"https://lunora.sh/docs/packages/auth#secrets",key:"AUTH_URL",placeholderValue:"http://localhost:8787"}],"@lunora/agent:requestSecretTool":[{description:"AES-256 key that seals secret values held for one agent step, base64 of 32 bytes. Generate with: openssl rand -base64 32. Rotate by moving the old value to LUNORA_SECRET_VALUE_KEY_PREVIOUS first.",docsUrl:"https://lunora.sh/docs/packages/agent#secret-values",key:"LUNORA_SECRET_VALUE_KEY",placeholderValue:"<your-base64-32-byte-key>"}],"@lunora/do:shardRegistry":[{description:"Signs every request to ShardRegistryDO, which refuses unsigned ones, and the shard-to-shard control channel. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/concepts/sharding#the-shard-registry",key:o,placeholderValue:r}],"@lunora/bindings/r2sql":[{description:"Cloudflare API token with R2 SQL read access, for `ctx.r2sql`. Create at https://dash.cloudflare.com/profile/api-tokens with the R2 SQL permission.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_TOKEN",placeholderValue:"<your-r2-sql-api-token>"},{description:"Cloudflare account id the R2 SQL queries run against. Falls back to CLOUDFLARE_ACCOUNT_ID when unset.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_ACCOUNT_ID",placeholderValue:"<your-cloudflare-account-id>"},{description:"Name of the R2 bucket holding the Iceberg tables `ctx.r2sql` queries.",docsUrl:"https://lunora.sh/docs/packages/bindings#r2-sql",key:"R2_SQL_BUCKET",placeholderValue:"<your-r2-sql-bucket>"}],"@lunora/mail":[{description:"Resend API key for sending transactional email via @lunora/mail. Obtain at https://resend.com/api-keys",docsUrl:"https://lunora.sh/docs/packages/mail#secrets",key:"RESEND_API_KEY",placeholderValue:"<your-resend-api-key>"}],"@lunora/replica:eventLog":[{description:"Signs every request to EventLogDO, which refuses unsigned ones, and the calls from the worker that reads or appends the log. Set the same value on the worker and every Durable Object. Generate with: openssl rand -hex 32",docsUrl:"https://lunora.sh/docs/packages/replica#eventlogdo",key:o,placeholderValue:r}],"@lunora/replica:eventLogClient":[{description:"The LUNORA_RELAY_SECRET of the worker that hosts EventLogDO. EventLogDOClient throws at construction without it, and the log refuses every request signed with another value.",docsUrl:"https://lunora.sh/docs/packages/replica#eventlogdo",key:o,placeholderValue:"<your-eventlogdo-host-relay-secret>"}],"@lunora/notify:fcm":[{description:"Google service-account key file for FCM HTTP v1, base64-encoded on one line for .dev.vars (.dev.vars cannot hold its JSON quotes); in production use: wrangler secret put FCM_SERVICE_ACCOUNT < key.json. fcmFromEnv mints access tokens from it and reads the project id from it. Download it from the Firebase console (Project settings → Service accounts).",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_SERVICE_ACCOUNT",placeholderValue:"<base64-of-your-service-account-key-json>"}],"@lunora/notify:fcmTokenSource":[{description:"Firebase project id for FCM HTTP v1. Your fcm channel supplies its own getAccessToken, so only the project id comes from env. Find it in the Firebase console (Project settings).",docsUrl:"https://lunora.sh/docs/packages/notify#fcm",key:"FCM_PROJECT_ID",placeholderValue:"<your-firebase-project-id>"}],"@lunora/notify:webPush":[{description:"Public VAPID key (base64url) for Web Push. Generate a keypair once with: npx web-push generate-vapid-keys — the public key is also shipped to the browser to subscribe.",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PUBLIC_KEY",placeholderValue:"<your-vapid-public-key>"},{description:"Private VAPID key (base64url) for Web Push — the application-server signing key. Generate with: npx web-push generate-vapid-keys",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_PRIVATE_KEY",placeholderValue:"<your-vapid-private-key>"},{description:"VAPID `sub` contact — a mailto: or https: URL identifying the application server (e.g. mailto:you@example.com).",docsUrl:"https://lunora.sh/docs/packages/notify#web-push",key:"VAPID_SUBJECT",placeholderValue:"mailto:you@example.com"}],"@lunora/payment/autumn":[{description:"Autumn secret key (am_sk_…) for the Autumn payment adapter. Obtain at https://app.useautumn.com/dev",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_SECRET_KEY",placeholderValue:"<your-autumn-secret-key>"},{description:"Autumn webhook signing secret for verifying Standard Webhooks event payloads. Obtain from your Autumn dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#autumn",key:"AUTUMN_WEBHOOK_SECRET",placeholderValue:"<your-autumn-webhook-secret>"}],"@lunora/payment/creem":[{description:"Creem API key for the Creem payment adapter. Obtain at https://www.creem.io/dashboard/developers",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_API_KEY",placeholderValue:"<your-creem-api-key>"},{description:"Creem webhook signing secret for verifying the creem-signature header. Obtain from your Creem dashboard webhook settings.",docsUrl:"https://lunora.sh/docs/packages/payment#creem",key:"CREEM_WEBHOOK_SECRET",placeholderValue:"<your-creem-webhook-secret>"}],"@lunora/payment/dodopayments":[{description:"Dodo Payments API key (bearer token) for the Dodo Payments adapter. Obtain at https://app.dodopayments.com/developer/api-keys",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_API_KEY",placeholderValue:"<your-dodo-payments-api-key>"},{description:"Dodo Payments webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://app.dodopayments.com/developer/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#dodo-payments",key:"DODO_PAYMENTS_WEBHOOK_KEY",placeholderValue:"<your-dodo-payments-webhook-secret>"}],"@lunora/payment/polar":[{description:"Polar access token for the Polar payment adapter. Obtain at https://polar.sh/settings/tokens",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_ACCESS_TOKEN",placeholderValue:"<your-polar-access-token>"},{description:"Polar webhook secret for verifying event payloads from Polar. Obtain at https://polar.sh/settings/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#polar",key:"POLAR_WEBHOOK_SECRET",placeholderValue:"<your-polar-webhook-secret>"}],"@lunora/payment/stripe":[{description:"Stripe secret key (sk_test_…). Required when using the Stripe adapter. Obtain at https://dashboard.stripe.com/apikeys",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_SECRET_KEY",placeholderValue:"<your-stripe-secret-key>"},{description:"Stripe webhook signing secret (whsec_…) for verifying event payloads. Obtain at https://dashboard.stripe.com/webhooks",docsUrl:"https://lunora.sh/docs/packages/payment#stripe",key:"STRIPE_WEBHOOK_SECRET",placeholderValue:"<your-stripe-webhook-secret>"}]},n=new Set([...u,...[...p,...Object.values(l).flat()].filter(e=>i(e.key)&&!e.placeholderValue.startsWith("<")&&e.key!==o).map(e=>e.key)]),k=e=>e.includes(h)&&!e.some(t=>d.has(t))?n:new Set([...n,o]),E=e=>{const s=[];for(const t of e)for(const a of l[t]??[])s.some(c=>c.key===a.key)||s.push(a);return s};export{p as CORE_SECRETS,n as MINTABLE_SECRET_KEYS,l as PACKAGE_SECRETS_REGISTRY,r as SHARD_RELAY_HOST_PLACEHOLDER,o as SHARD_RELAY_SECRET_KEY,k as mintableSecretKeysFor,E as secretsForPackages};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as d,readFileSync as y}from"node:fs";import{join as s,isAbsolute as a,relative as m}from"node:path";import{LunoraError as p}from"@lunora/errors";import{classifyPolicyEdit as k,scaffoldPolicyFile as h,resolveServerModule as l,wireRlsIntoProcedure as v}from"./classifyPolicyEdit-DJi9Fk8G.mjs";import{w as c,r as b}from"./write-atomic-9sY2z8DB.mjs";const D="/__lunora/policy-scaffold",u=r=>r==="unknown-procedure"?404:r==="already-wired"||r==="destructive"?409:422,f=(r,o,e)=>{let t;try{t=b(r,o)}catch(n){return{body:{error:n instanceof Error?n.message:String(n),ok:!1},status:500}}return{body:{...e,diagnostics:t,ok:!0},status:200}},g=r=>({body:{edit:r,message:"Rewriting an existing policy predicate changes evaluation semantics and must be done by hand. The scaffolder only adds new, deny-by-default rules.",needsManualEdit:!0,ok:!1},status:409}),w=(r,o)=>{const e=h(o,l(r.projectRoot));if(!e.ok)return{body:{error:e.reason,ok:!1},status:u(e.reason)};const t=r.schemaDirectory??"lunora",n=s(r.projectRoot,t,e.fileName);return d(n)?{body:{error:"file-exists",fileName:e.fileName,ok:!1},status:409}:(c(n,e.source),f(r,{path:n,text:e.source},{fileName:e.fileName}))},R=(r,o,e)=>{if(typeof e!="string"||e.length===0||a(e)||e.includes("\\"))return;const t=s(r,o),n=s(t,`${e}.ts`),i=m(t,n);if(!(i.startsWith("..")||a(i)))return n},N=(r,o)=>{const e=R(r.projectRoot,r.schemaDirectory??"lunora",o.filePath);if(e===void 0||!d(e))return{body:{error:"unknown-procedure",ok:!1},status:404};const t=v(y(e,"utf8"),o,l(r.projectRoot));return t.ok?(c(e,t.text),f(r,{path:e,text:t.text},{exportName:o.exportName})):{body:{error:t.reason,ok:!1},status:u(t.reason)}},E=r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:o}=r;if(o==null||typeof o!="object"||typeof o.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};const e=o;if(k(e)==="destructive")return g(e);if(e.kind==="scaffoldPolicy")return w(r,e);if(e.kind==="wireRls")return N(r,e);throw new p("INTERNAL",`unhandled additive policy edit kind: ${String(e.kind)}`)};export{D as POLICY_SCAFFOLD_ENDPOINT,E as handlePolicyScaffoldRequest};
|
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MERGED_DURABLE_OBJECT as p}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{o as R,v as S,b as I,c as j,d as A,e as L,g as f,h as k,i as B,H as C,j as N,R as T,S as w,k as q,l as U,W as G,m as P}from"./validate-bindings-DSMH8bRQ.mjs";import{b as u,p as g,c as _}from"./studio-assets-BKWx838V.mjs";import{validateTailConsumers as W,validateSendEmail as K,validateSecretsRequired as M,validateLogpush as V,validateLimits as x,validatePlacement as H,validateObservability as Q,validateAssets as F,validateCache as Y,validateExports as J,validateCorsVariables as z,validateSchedulerOrigin as X}from"./withTailConsumer-BXOIqXxv.mjs";import{isCacheEnabled as Z,WORKERS_CACHE_MIN_DATE as E}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as ee}from"./mergeWranglerEnvironment-CxT2PV1N.mjs";const v=t=>u(t)?new Set([...g(t.producers).map(i=>i.queue),...g(t.consumers).flatMap(i=>[i.queue,i.dead_letter_queue])].filter(i=>_(i))):new Set,b=(t,i,n)=>{const e=u(t)?t.account_id:void 0;return _(e)?e:_(i.account_id)?i.account_id:_(n)?n:void 0},te=(t,i,n,e=process.env.CLOUDFLARE_ACCOUNT_ID)=>{if(i===void 0||!u(t.env))return;const a=t.env[i],r=v(u(a)?a.queues:void 0);if(r.size===0)return;const s=b(a,t,e),m=[{account:b(void 0,t,e),names:v(t.queues),scope:"the top level"},...Object.entries(t.env).filter(([c])=>c!==i).map(([c,o])=>({account:b(o,t,e),names:v(u(o)?o.queues:void 0),scope:`env.${c}`}))].filter(c=>s===void 0||c.account===void 0||c.account===s);for(const c of r){const o=m.filter(({names:l})=>l.has(c)).map(({scope:l})=>l);o.length>0&&n.push(`env.${i}.queues names queue "${c}", which ${o.join(" and ")} also ${o.length===1?"names":"name"}. Queue names are unique per Cloudflare account, so deployed to one account the environments share that queue: messages produced in one are consumed by the other. Give env.${i} its own name (e.g. "${c}-${i}") unless the sharing is intended — the renamed queue starts empty, and messages already in "${c}" stay there.`)}},ie=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),O=t=>Array.isArray(t)?t.flatMap((i,n)=>ie(i)?[[n,i]]:[]):[],y=t=>typeof t.binding=="string"?t.binding:"",se=(t,i,n)=>{for(const[e,a]of O(t.kv_namespaces))typeof a.id=="string"&&a.id!==""||n.push(`kv_namespaces[${String(e)}] ("${y(a)}") is not created yet and the schema pins data to "${i}" — create it with \`wrangler kv namespace create <name> --jurisdiction=${i}\`; a namespace's jurisdiction cannot be changed afterwards`)},ae=(t,i,n)=>{for(const[e,a]of O(t.r2_buckets)){const r=a.jurisdiction;if(r===i)continue;const s=typeof r=="string"?`names the "${r}" jurisdiction`:"names no jurisdiction";n.push(`r2_buckets[${String(e)}] ("${y(a)}") ${s}, but the schema pins data to "${i}" — create the bucket with \`wrangler r2 bucket create <name> --jurisdiction=${i}\` and set "jurisdiction": "${i}" on the binding`)}},ne=(t,i,n)=>{const e=i?.jurisdiction;e!==void 0&&(se(t,e,n),ae(t,e,n))},D="2026-04-07",me="web_socket_auto_reply_to_close",h="2026-10-01",$="durable_object_io_tasks_prevent_eviction",oe="durable_object_io_tasks_do_not_prevent_eviction",re=/^\d{4}-\d{2}-\d{2}$/,ce=(t,i,n)=>{t>=h||i.includes($)||i.includes(oe)||n.push(`compatibility_date "${t}" predates "${h}", so pending I/O (waitUntil, cross-Durable-Object RPC, service-binding calls, timers) does not keep a Durable Object alive once its last client disconnects — live-query refreshes and durable streams can be cut off mid-flight. Set compatibility_date >= "${h}" or add the "${$}" compatibility flag`)},de=(t,i,n)=>{const{error:e,merged:a,unverifiedKeys:r}=ee(t,i);return e!==void 0?{error:e,wrangler:a}:(r.length>0&&n.push(`env.${String(i)} overrides ${r.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${r.length===1?"it":"them"} by hand for "${String(i)}".`),{wrangler:a})},le=(t,i,n)=>{const e=[],a=[];if(!t||typeof t!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:a};const{error:r,wrangler:s}=de(t,n,a);if(r!==void 0)return e.push(r),{errors:e,valid:!1,warnings:a};R(s.durable_objects?.bindings).find(d=>d.name==="SHARD"&&(d.class_name==="ShardDO"||d.class_name===p))||e.push(`durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } (or "${p}" when the app merges its Durable Objects) — your dev server auto-reconciles this on startup, or add the binding manually`),S(s,e);const o=s.compatibility_date??"",l=re.test(o);o&&!l?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${o}")`):o<D&&e.push(`compatibility_date must be >= "${D}" (got "${o||"<missing>"}")`),Z(s)&&l&&o<E&&e.push(`cache.enabled requires compatibility_date >= "${E}" (got "${o||"<missing>"}")`),l&&ce(o,s.compatibility_flags??[],a),I(s,i,e),ne(s,i,a),j(s,e),A(s,i?.vectorIndexNames??[],e),W(s,e),L(s,e,a),f(s.workflows,"workflows",G,e),k(s,e),B(s,e),te(t,n,a),f(s.secrets_store_secrets,"secrets_store_secrets",P,e);for(const d of C)N(s,d,e,a);for(const d of T)f(s[d.key],d.key,d,e);for(const d of w)q(s,d,e);return U(s,e),K(s,e,a),M(s,e),V(s,e),x(s,e),H(s,e),Q(s,e,a),F(s,e),Y(s,e),J(s,e),z(s,e),X(s,n,a),{errors:e,valid:e.length===0,warnings:a}},pe=le;export{D as REQUIRED_COMPATIBILITY_DATE,me as REQUIRED_FLAG,pe as validateWrangler,le as validateWranglerConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as a,readFileSync as d}from"node:fs";import{classifyEdit as l,applyAdditiveEdit as c}from"./applyAdditiveEdit-DEwPKcJg.mjs";import{parseSchema as u}from"./parseSchema-D1Wbr1qv.mjs";import{w as f,r as p}from"./write-atomic-9sY2z8DB.mjs";import{join as m}from"node:path";const F="/__lunora/schema-edit",b=t=>t==="destructive"||t==="duplicate-table"||t==="duplicate-column"||t==="duplicate-index"?409:t==="unknown-table"?404:t==="invalid-identifier"||t==="invalid-validator"?400:422,y=t=>({body:{error:t.reason,ok:!1},status:422}),k=t=>{if(!a(t))return{response:{body:{error:"no-schema-file",ok:!1},status:404}};const e=u(d(t,"utf8"));return e.ok?{tables:e.tables}:{response:y(e)}},g=t=>({body:{edit:t,message:"This edit changes stored data and must go through a migration. Review the migration before applying.",needsMigration:!0,ok:!1},status:409}),h=(t,e)=>{const r=t.body;if(r==null||typeof r!="object"||typeof r.kind!="string")return{body:{error:"invalid-edit",ok:!1},status:400};if(l(r)==="destructive")return g(r);if(!a(e))return{body:{error:"no-schema-file",ok:!1},status:404};const o=c(d(e,"utf8"),r);if(!o.ok)return{body:{error:o.reason,ok:!1},status:b(o.reason)};f(e,o.text);let i;try{i=p(t,{path:e,text:o.text})}catch(s){return{body:{error:s instanceof Error?s.message:String(s),ok:!1},status:500}}const n=u(o.text);return{body:{diagnostics:i,ok:!0,tables:n.ok?n.tables:[]},status:200}},R=t=>{const e=m(t.projectRoot,t.schemaDirectory??"lunora","schema.ts");if(t.method==="GET"){const r=k(e);return"response"in r?r.response:{body:{ok:!0,tables:r.tables},status:200}}return t.method==="POST"?h(t,e):{body:{error:"method-not-allowed",ok:!1},status:405}};export{F as SCHEMA_EDIT_ENDPOINT,R as handleSchemaEditRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as p}from"node:fs";import{discoverSchema as h,schemaFromIr as g}from"@lunora/codegen";import{LunoraError as k}from"@lunora/errors";import{Project as S}from"ts-morph";import{join as w}from"node:path";const P="/__lunora/seed",j=1e3,E=(r,t)=>typeof t=="bigint"?Number(t):t instanceof ArrayBuffer?[...new Uint8Array(t)]:t,R=r=>typeof r!="number"||!Number.isFinite(r)?10:Math.min(Math.max(1,Math.floor(r)),j),F=async r=>{if(r.method!=="POST")return{body:{error:"method-not-allowed",ok:!1},status:405};const{body:t}=r;if(t==null||typeof t!="object")return{body:{error:"invalid-request",ok:!1},status:400};const{count:f,existingIds:c,seed:m,table:o}=t;if(typeof o!="string"||o.length===0)return{body:{error:"missing-table",ok:!1},status:400};const d=r.schemaDirectory??"lunora",n=w(r.projectRoot,d,"schema.ts");if(!p(n))return{body:{error:"schema-not-found",ok:!1},status:404};const l=new S({skipAddingFilesFromTsConfig:!0}),a=h(l,n);if(!a.tables.some(e=>e.name===o))return{body:{error:"unknown-table",ok:!1,table:o},status:404};const u=g(a),{seedPlan:y}=await import("@lunora/seed");let s;try{s=y(u,{existingIds:c??{},defaultCount:R(f),only:[o],seed:m??0})}catch(e){if(e instanceof k&&e.code==="BAD_REQUEST")return{body:{error:"seed-refused",message:e.message,ok:!1},status:409};throw e}const i=s.filter(e=>e.table!==o).map(e=>e.table);if(i.length>0)return{body:{error:"fk-parents-empty",ok:!1,tables:i},status:409};const b=s.find(e=>e.table===o)?.rows??[];return{body:{ok:!0,rows:JSON.parse(JSON.stringify(b,E))},status:200}};export{P as SEED_ENDPOINT,F as handleSeedRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveAdminToken as A}from"./devVariablesStamp-BQkGEn9d.mjs";import{handleAdvisorProceduresRequest as I,ADVISOR_PROCEDURES_ENDPOINT as O}from"./ADVISOR_PROCEDURES_ENDPOINT-BPnqzAgT.mjs";import{sendStudioDocument as _,sendStudioAsset as h}from"./sendStudioAsset-B81Pex91.mjs";import{isStandaloneModulePath as y,studioAssetsStamp as N,loadStudioAssets as E,readStandaloneAsset as H,assetContentType as R}from"./assetContentType-CUb5bpbI.mjs";import v from"./createStudioDocumentCache-XBG1aWbl.mjs";import{detectAgentRules as C}from"./AGENT_RULES_DIR-Bd6JPtNa.mjs";import{handlePolicyScaffoldRequest as L,POLICY_SCAFFOLD_ENDPOINT as b}from"./POLICY_SCAFFOLD_ENDPOINT-BiQ1zNsR.mjs";import x from"./renderStudioHtml-CRDTNivi.mjs";import{handleSchemaEditRequest as $,SCHEMA_EDIT_ENDPOINT as k}from"./SCHEMA_EDIT_ENDPOINT-D296PlpV.mjs";import{handleSeedRequest as U,SEED_ENDPOINT as g}from"./SEED_ENDPOINT-C1fhrehH.mjs";import{serveJsonHandler as j}from"./serveJsonHandler-B8_GE6QC.mjs";import{transportRejectionReason as F}from"./ALLOW_FORWARDED_ENV-BUndghJx.mjs";import"./STUDIO_WRITE_TEMP_SUFFIX-BTTELz3K.mjs";const i="/__lunora",M=`${i}/studio.js`,m=`${i}/styles.css`,P=/\/$/,q={[b]:L,[k]:$,[g]:U,[O]:I},w=new Set(["127.0.0.1","::1","localhost"]),st=t=>t!==void 0&&t!==!1&&!w.has(t),T=t=>t===void 0||t==="/"?"":t.replace(P,""),nt=t=>`${T(t)}${i}`,B=t=>{try{return new URL(t,"http://localhost").pathname}catch{const d=t.indexOf("?");return d===-1?t:t.slice(0,d)}},at=t=>{const{logger:d,projectRoot:c}=t,u=T(t.base);let l,S;const p=v(c,()=>x({adminToken:A(c),advisorProcedures:!0,basePath:i,dataEditable:!0,rulesInstalled:C(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:M,styleHref:m})),D=(s,o,e)=>{const n=N();if((l===void 0||n!==S)&&(l=E(d),S=n),l===void 0){e.statusCode=501,e.setHeader("Content-Type","text/plain"),e.end("Lunora studio assets not found — install and build @lunora/studio.");return}const a=s===m,r=s.slice(s.lastIndexOf("/")+1);if(a){h(o,e,l.styles,"text/css; charset=utf-8",r,n);return}const f=H(r);if(f===void 0){e.statusCode=404,e.setHeader("Content-Type","text/plain"),e.end("Not found");return}h(o,e,f,R(r),r,n)};return(s,o,e)=>{const n=B(s.url??"").replace(P,""),a=u!==""&&n.startsWith(u)?n.slice(u.length):n;if(a!==i&&!a.startsWith(`${i}/`)){e();return}if(t.isNonLoopbackBind||F(s,d)!==void 0){o.statusCode=403,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio is only available on loopback hosts in dev.");return}const r=q[a];if(r!==void 0){j(s,o,r,c,{apiSpec:t.apiSpec,lazyFunctions:t.lazyFunctions,schemaDirectory:t.schemaDirectory});return}if(a===m||y(a)){D(a,s,o);return}_(o,p())}};export{i as STUDIO_PATH,M as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,at as createStudioMiddleware,st as isNonLoopbackHost,B as requestPathname,nt as studioMountPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as c}from"node:fs";import{resolve as i}from"node:path";const f=5e3,r=new Map,u=".lunora-tmp",d=(o,n,e=Date.now())=>{for(const[t,s]of r)s.expiresAt<e&&r.delete(t);r.set(i(o),{expiresAt:e+f,text:n})},l=(o,n=Date.now())=>{const e=i(o),t=r.get(e);if(t===void 0||(r.delete(e),t.expiresAt<n))return!1;try{return c(e,"utf8")===t.text}catch{return!1}};export{u as STUDIO_WRITE_TEMP_SUFFIX,l as consumeStudioWrite,d as recordStudioWrite};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as d}from"node:fs";import{dirname as y,join as h}from"node:path";import{discoverSchemaInfo as v}from"./discoverSchemaInfo-DRPnqgif.mjs";import{MERGED_DURABLE_OBJECT as i,GENERATED_DIRECTORY as w,MERGED_ROLE_DURABLE_OBJECTS as u,COMPOSED_ENTRY_DURABLE_OBJECTS as E,GENERATED_CLASS_MODULES as $,isFrameworkDurableObject as k}from"./COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs";import{l as D,r as R,a as j,i as x}from"./studio-assets-BKWx838V.mjs";import{o as O,f as A}from"./validate-bindings-DSMH8bRQ.mjs";import{validateSchedulerOrigin as _}from"./withTailConsumer-BXOIqXxv.mjs";import{mergeWranglerEnvironment as S}from"./mergeWranglerEnvironment-CxT2PV1N.mjs";import{findWranglerFile as W,readWranglerJsonc as C}from"./WRANGLER_FILES-BF8PUjuo.mjs";import{validateWranglerConfig as T}from"./REQUIRED_COMPATIBILITY_DATE-BqFeetpX.mjs";const b=r=>Array.isArray(r)?r:[],L=(r,o,t)=>Object.entries(r?.images??{}).flatMap(([s,n])=>{const e=n?.dockerfile;return typeof e!="string"||d(e.startsWith("/")?e:h(o,e))?[]:[`containers images["${s}"] dockerfile "${e}" does not exist (resolved relative to ${t}); create the Dockerfile`]}),I=(r,o)=>{const t=r?.directory;if(typeof t!="string"||t.length===0||d(t.startsWith("/")?t:h(o,t)))return[];const s=x(r)?"it holds the Studio documents `lunora codegen` writes; run codegen before deploy":"it is created by the client build; run the build before deploy";return[`assets.directory "${t}" does not exist yet — ${s}`]},P=(r,o,t)=>{const s=[];for(const n of b(r)){const e=n?.image;typeof e=="string"&&(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes("Dockerfile"))&&!d(e.startsWith("/")?e:h(o,e))&&s.push(`containers image "${e}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`),s.push(...L(n,o,t))}return s},B=(r,o)=>{const t=r?.vectorIndexNames??[],s=[];if(t.length>0&&s.push({message:e=>`schema declares vector index(es) ${t.map(l=>`"${l}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${e}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),r?.hasD1GlobalTable&&s.push({message:e=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),r?.hasHyperdriveGlobalTable&&s.push({message:e=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${e}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(async () => (await import("postgres")).default(env.HYPERDRIVE.connectionString, { fetch_types: false, max: 5 }))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),s.length===0)return[];const n=j(o,new Set(s.map(e=>e.method)));return n===void 0?[]:s.filter(e=>!n.chained.has(e.method)).map(e=>e.message(n.site))},G="does not export it",M=(r,o)=>{if(o.exports?.has(i)===!0&&u.has(r))return`This app merges its Durable Objects (\`durableObjects.merge\` in lunora.config), so ${i} hosts ${r}: bind only \`SHARD\` to "${i}" and drop the SCHEDULER / SHARD_REGISTRY bindings. Do that only if this Worker has never been deployed — a deployed ${r} namespace keeps its data, which the merged class cannot reach; turn \`durableObjects.merge\` off to keep it.`;if(r===i)return`${i} is the merged class (\`durableObjects.merge\` in lunora.config), and merging cannot be undone once deployed: the shard data lives in ${i}. Turn \`durableObjects.merge\` back on. Only a Worker that has never been deployed may rebind SHARD to "ShardDO".`;if(o.kind!=="composed")return`Re-export it from the module that defines it (\`export { ${r} } from "./…";\`), or add it to the app builder's own export (\`export const { ${r} } = app;\`).`;const t=`it exports ${E.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${$.map(s=>`${s}.ts`).join(" / ")} declarations`;return k(r)?`\`@lunora/vite\` generates that entry — ${t}, and ${r} is not among them. Class-A composition does not carry ${r}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${r}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},N=(r,o)=>{const t=o.exports;if(t===void 0)return[];const s=[];for(const e of O(r.durable_objects?.bindings))typeof e.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"durable_objects.bindings"});for(const e of b(r.workflows))typeof e?.class_name=="string"&&e.class_name.length>0&&e.script_name===void 0&&s.push({className:e.class_name,label:"workflows"});for(const[e,l]of Object.entries(r.exports??{}))l?.type==="workflow"&&s.push({className:e,label:"workflows"});return s.filter(e=>!t.has(e.className)).map(e=>`${e.label} declares class "${e.className}" but the ${o.kind==="composed"?"composed class-A worker entry":"worker entry"} (${o.path}) ${G} — wrangler refuses to bundle a Worker whose ${e.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${M(e.className,o)}`)},U=r=>[...A(r.migrations)].filter(o=>u.has(o)).map(o=>`migrations create class "${o}", which this app hosts in ${i} because it merges its Durable Objects (\`durableObjects.merge\`). Before the first deploy, replace "${o}" with "${i}" in new_sqlite_classes; a Worker already deployed with "${o}" keeps its data there and cannot merge — turn \`durableObjects.merge\` off.`),H=r=>r?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${r.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],ee=r=>{const o=r.schemaDir??"lunora",t=W(r.projectRoot);if(!t){const c=`wrangler.jsonc not found in ${r.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:s}=C(t);if(s===void 0){const c=`failed to parse ${t} as JSONC.`;return{problems:[c],report:{errors:[c],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:e}=S(s,r.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:l,info:m}=v(r.projectRoot,o,r.cache),a=T(s,m,r.environment);l!==void 0&&a.warnings.push(`schema parse failed in ${o}/schema.ts: ${l}`);const g=y(t),f=D(e.main,r.projectRoot,t),p=R(f,r.projectRoot,o);return a.errors.push(...P(e.containers??[],g,t)),a.warnings.push(...H(f)),p!==void 0&&a.errors.push(...N(e,p)),p?.exports?.has(i)===!0&&(a.errors.push(...U(e)),d(h(r.projectRoot,o,w,"scheduler.ts"))&&_(e,r.environment,a.warnings,"the merged LunoraDO hosts the scheduler")),a.errors.push(...B(m,r.projectRoot)),a.warnings.push(...I(e.assets,g)),a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{G as UNEXPORTED_CLASS_MARKER,ee as validateWranglerProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l="2026-05-01",n=e=>{if(!e)return!1;const c=typeof e.cache=="object"&&e.cache!==null&&e.cache.enabled===!0,o=typeof e.exports=="object"&&e.exports!==null&&Object.values(e.exports).some(t=>typeof t=="object"&&t!==null&&t.cache?.enabled===!0);return c||o};export{l as WORKERS_CACHE_MIN_DATE,n as isCacheEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as n,readFileSync as a}from"node:fs";import{parse as s}from"jsonc-parser";import{join as c}from"node:path";const i=["wrangler.jsonc","wrangler.json"],d=t=>{for(const r of i){const e=c(t,r);if(n(e))return e}},l=t=>{const r=a(t,"utf8"),e=[],o=s(r,e,{allowTrailingComma:!0});return e.length>0||o===null||typeof o!="object"?{parsed:void 0,text:r}:{parsed:o,text:r}},m=t=>{const r=d(t);if(r!==void 0)try{return{parsed:l(r).parsed,path:r}}catch{return{parsed:void 0,path:r}}};export{i as WRANGLER_FILES,d as findWranglerFile,m as readProjectWrangler,l as readWranglerJsonc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{spawn as f}from"node:child_process";import{connect as h}from"node:net";const m=150,p=5e3,E=(e,t,r)=>f(e,[...t],{cwd:r.cwd,shell:r.shell,stdio:["ignore","pipe","pipe"]}),x=async e=>new Promise(t=>{const r=h({host:"127.0.0.1",port:e}),o=s=>{r.destroy(),t(s)};r.once("connect",()=>{o(!0)}),r.once("error",()=>{o(!1)})}),d=(e,t)=>{let r="";e?.setEncoding("utf8"),e?.on("data",o=>{r+=o;const s=r.split(`
|
|
2
|
+
`);r=s.pop()??"";for(const a of s)t(a)}),e?.once("end",()=>{r!==""&&(t(r),r="")})},w=e=>e.exitCode!==null||e.signalCode!==null,L=async e=>{const t=(e.spawn??E)(e.command,e.args,{cwd:e.cwd,shell:e.shell===!0});let r=!1,o,s;d(t.stdout,n=>{e.onLine(n,"stdout")}),d(t.stderr,n=>{e.onLine(n,"stderr")}),t.once("error",n=>{o=n.code==="ENOENT"?new Error(e.notFound):n}),t.once("exit",n=>{s??=new Error(`${e.label} exited with code ${String(n)} before it was ready`)});const a=new Promise(n=>{t.once("exit",i=>{r||n(i??1)})}),l=()=>{t.kill("SIGKILL")};process.once("exit",l);const c=async()=>{r=!0,process.removeListener("exit",l),!w(t)&&await new Promise(n=>{const i=setTimeout(()=>{t.kill("SIGKILL")},p);t.once("exit",()=>{clearTimeout(i),n()}),t.kill("SIGTERM")})},u=Date.now()+e.readyTimeoutMs;for(;Date.now()<u;){const n=o??s;if(n!==void 0)throw process.removeListener("exit",l),n;if(e.signal?.aborted===!0)throw await c(),new Error(`${e.label} was stopped before it was ready`);if(await x(e.port)){if(w(t))throw await c(),new Error(`the server on port ${String(e.port)} is not the ${e.label} started here — it exited while something else took the port`);return{crashed:a,stop:c}}await new Promise(i=>{setTimeout(i,m)})}throw await c(),new Error(`${e.label} did not accept connections on port ${String(e.port)} within ${String(e.readyTimeoutMs/1e3)}s`)};export{x as acceptsConnection,L as startDevProcess};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawnSync as o}from"node:child_process";import{LunoraError as s}from"@lunora/errors";import{findPackageManagerSync as i,identifyInitiatingPackageManager as c}from"@visulima/package/package-manager";const a=["pnpm","bun","yarn","npm"],u=new Set(a),d=r=>u.has(r),l=r=>{try{return o(r,["--version"],{shell:process.platform==="win32",stdio:"ignore",timeout:5e3}).status===0}catch{return!1}},m=(r=l)=>a.filter(n=>r(n)),y=r=>({args:["install"],command:r}),E=(r,n,t={})=>{const e=t.dev===!0;return r==="npm"?{args:["install",...e?["--save-dev"]:[],...n],command:"npm"}:r==="bun"?{args:["add",...e?["-d"]:[],...n],command:"bun"}:{args:["add",...e?["-D"]:[],...n],command:r}},M=r=>{try{return i(r).packageManager}catch{}const n=c();if(n!==void 0){const e=n.name==="cnpm"?"npm":n.name;if(d(e))return e}const[t]=m();if(t!==void 0)return t;throw new s("INTERNAL","Could not detect a package manager: no lock file or `packageManager` field was found, and none (pnpm, bun, yarn, npm) is installed on PATH.")},g=(r,n,t)=>r==="yarn"?{args:[n,...t],command:"yarn"}:r==="bun"?{args:["x",n,...t],command:"bun"}:r==="npm"?{args:["--",n,...t],command:"npx"}:{args:["exec",n,...t],command:"pnpm"},b=(r,n)=>n.onPath===!0?{args:[...n.args],command:n.tool}:g(r,n.tool,n.args),P=(r,n)=>({args:["run",n],command:r}),h=(r,n)=>r==="npm"?`npm run ${n}`:r==="bun"?`bun run ${n}`:`${r} ${n}`;export{E as addArgsFor,m as detectInstalledManagers,M as detectPackageManager,g as execArgsFor,y as installArgsFor,P as runScriptArgsFor,h as runScriptCommand,b as toolchainExecArgs};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{Project as p,SyntaxKind as i}from"ts-morph";import{collectCalls as m}from"./parseSchema-D1Wbr1qv.mjs";const b=/^[A-Za-z_$][\w$]*$/u,v=new Set(["any","array","bigint","boolean","bytes","date","id","literal","null","number","object","optional","record","storage","string","timestamp","union"]),u=e=>{if(e.getKind()===i.ParenthesizedExpression)return u(e.asKindOrThrow(i.ParenthesizedExpression).getExpression());if(e.getKind()!==i.CallExpression)return!1;const t=e.asKindOrThrow(i.CallExpression),r=t.getExpression();if(r.getKind()!==i.PropertyAccessExpression)return!1;const n=r.asKindOrThrow(i.PropertyAccessExpression);return n.getExpression().getKind()!==i.Identifier||n.getExpression().getText()!=="v"||!v.has(n.getName())?!1:t.getArguments().every(s=>c(s))},c=e=>{const t=e.getKind();return t===i.ParenthesizedExpression?c(e.asKindOrThrow(i.ParenthesizedExpression).getExpression()):t===i.StringLiteral||t===i.NumericLiteral||t===i.TrueKeyword||t===i.FalseKeyword||t===i.NullKeyword?!0:t===i.PrefixUnaryExpression?e.asKindOrThrow(i.PrefixUnaryExpression).getOperand().getKind()===i.NumericLiteral:t===i.ObjectLiteralExpression?e.asKindOrThrow(i.ObjectLiteralExpression).getProperties().every(r=>{if(r.getKind()!==i.PropertyAssignment)return!1;const n=r.getInitializer();return n!==void 0&&c(n)}):t===i.ArrayLiteralExpression?e.asKindOrThrow(i.ArrayLiteralExpression).getElements().every(r=>c(r)):u(e)},y=e=>{if(typeof e!="string"||e.trim().length===0)return!1;const t=new p({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),r=t.createSourceFile("validator.ts",`const __v = (${e});`,{overwrite:!0});if(t.getProgram().getSyntacticDiagnostics(r).length>0||r.getStatements().length!==1)return!1;const s=r.getVariableDeclaration("__v")?.getInitializer();return s!==void 0&&u(s)},E=new Set(["addIndex","addOptionalColumn","addTable"]),A=new Set(["d1","hyperdrive"]),T=e=>E.has(e.kind)?"additive":"destructive",d=e=>typeof e=="string"&&b.test(e),h=e=>{if(!d(e.table)||e.kind==="addTable"&&e.global?.backend!==void 0&&!A.has(e.global.backend))return"invalid-identifier";if(e.kind==="addOptionalColumn"){if(!d(e.column))return"invalid-identifier";if(!y(e.validator))return"invalid-validator"}if(e.kind==="addIndex"&&(!d(e.name)||!Array.isArray(e.fields)||!e.fields.every(t=>d(t))))return"invalid-identifier"},O=e=>{const r=new p({compilerOptions:{allowJs:!0},useInMemoryFileSystem:!0}).createSourceFile("schema.ts",e,{overwrite:!0});let n;for(const o of r.getDescendantsOfKind(i.CallExpression))if(o.getExpression().getText()==="defineSchema"){n=o;break}if(n===void 0)return{reason:r.getImportDeclarations().some(l=>l.getNamedImports().some(a=>a.getName()==="defineSchema"&&a.getAliasNode()!==void 0))?"aliased-define-schema":"no-define-schema"};const s=n.getArguments()[0];return s?.getKind()!==i.ObjectLiteralExpression?{reason:"non-object-argument"}:{object:s.asKindOrThrow(i.ObjectLiteralExpression),sourceFile:r}},g=(e,t)=>{for(const r of e.getProperties())if(r.getKind()===i.PropertyAssignment&&r.getNameNode().getText().replaceAll(/["']/gu,"")===t)return r},K=e=>{const t=e.getInitializer(),n=(t===void 0?void 0:m(t).find(s=>s.getExpression().getText()==="defineTable"))?.getArguments()[0];return n?.getKind()===i.ObjectLiteralExpression?n.asKindOrThrow(i.ObjectLiteralExpression):void 0},w=(e,t)=>{if(g(e,t.table)!==void 0)return"duplicate-table";const r=t.global?.backend,n=r===void 0?"":`{ backend: ${JSON.stringify(r)} }`,s=t.global===void 0?"":`.global(${n})`;e.addPropertyAssignment({initializer:`defineTable({
|
|
2
|
+
// Add your column validators here.
|
|
3
|
+
// Example:
|
|
4
|
+
// text: v.string(),
|
|
5
|
+
// createdAt: v.number(),
|
|
6
|
+
})${s}`,name:t.table})},k=(e,t)=>{const r=g(e,t.table);if(r===void 0)return"unknown-table";const n=K(r);if(n===void 0)return"unknown-table";if(n.getProperties().some(o=>o.getKind()===i.PropertyAssignment&&o.getNameNode().getText().replaceAll(/["']/gu,"")===t.column))return"duplicate-column";n.addPropertyAssignment({initializer:`v.optional(${t.validator})`,name:t.column})},S=(e,t)=>{if(e===void 0)return"unknown-table";const r=e.getInitializer();if(r===void 0)return"unknown-table";if(m(r).some(l=>{const a=l.getExpression();if(a.getKind()!==i.PropertyAccessExpression)return!1;const x=a.asKindOrThrow(i.PropertyAccessExpression),[f]=l.getArguments();return x.getName()==="index"&&f?.getKind()===i.StringLiteral&&f.asKindOrThrow(i.StringLiteral).getLiteralText()===t.name}))return"duplicate-index";const s=t.fields.map(l=>JSON.stringify(l)).join(", "),o=t.unique===!0?", { unique: true }":"";e.setInitializer(`${r.getText()}.index(${JSON.stringify(t.name)}, [${s}]${o})`)},L=(e,t)=>{if(T(t)==="destructive")return{ok:!1,reason:"destructive"};const r=t,n=h(r);if(n!==void 0)return{ok:!1,reason:n};const s=O(e);if("reason"in s)return{ok:!1,reason:s.reason};const{object:o,sourceFile:l}=s;let a;return r.kind==="addTable"?a=w(o,r):r.kind==="addOptionalColumn"?a=k(o,r):a=S(g(o,r.table),r),a!==void 0?{ok:!1,reason:a}:{ok:!0,text:l.getFullText()}};export{L as applyAdditiveEdit,T as classifyEdit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{modify as p,applyEdits as r}from"jsonc-parser";const s={formattingOptions:{insertSpaces:!0,tabSize:4}},a=(t,i,n)=>{const o=p(t,[...i],n,s);return o.length>0?r(t,o):t};export{s as FORMATTING,a as applyModify};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readProjectConfigLiterals as s,readProjectTarget as c}from"@lunora/codegen";import n from"./canonicalPath-DrfMiT3U.mjs";import{BUILD_TARGET_ENV as i,BUILD_ROOT_ENV as a}from"./BUILD_ROOT_ENV-Dg4MV3wY.mjs";import{DEFAULT_DEPLOY_TARGET as p,resolveDeployDriver as f}from"./DEFAULT_DEPLOY_TARGET-BlvZ242-.mjs";const d=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},P=e=>d(s(e).remote),T=e=>c(e),g=(e,t)=>t??T(e)??p,j=(e,t)=>{const r=g(e,t);return f(r),r},v=(e,t)=>{const r=process.env[i],o=process.env[a];if(!(o===void 0||o===""||n(o)!==n(t))&&r!==void 0&&r!==""&&r!==e)throw new Error(`the plugin resolves target "${e}" but the CLI resolved "${r}" for this run; set the same target in the plugin options and the project config`)};export{v as assertBuildTargetMatches,d as interpretRemote,P as readProjectRemotePreference,T as readProjectTarget,g as resolveProjectTarget,j as resolveTargetOrThrow};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-DQTGPqcJ.mjs";import{validateWranglerProject as c}from"./UNEXPORTED_CLASS_MARKER-BZEXldUo.mjs";const m=(e,o,t)=>{const r=c({cache:e.cache,projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
|
|
2
|
+
`));for(const a of r.report.warnings)o(i(`wrangler validator: ${a}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(a=>` - ${a}`),"",` ${t}`].join(`
|
|
3
|
+
`))};export{m as assertWranglerSatisfiesSchema};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{existsSync as D,readFileSync as k,rmSync as x,writeFileSync as L}from"node:fs";import{LunoraError as E}from"@lunora/errors";import{a as C}from"./env-flag-u4B05gLp.mjs";import{i as w}from"./is-plain-object-CWxHeOY1.mjs";import{join as I}from"node:path";const R="default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",j="accelerometer=(), autoplay=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()",H=31536e3,F={coop:void 0,csp:void 0,enabled:!1,frameOptions:void 0,hsts:void 0,permissionsPolicy:void 0,referrerPolicy:void 0},M=s=>{if(s===!1)return;const e=s===void 0||s===!0?{}:s,r=e.maxAge??H,t=e.includeSubDomains??!0;return`max-age=${String(r)}${t?"; includeSubDomains":""}${e.preload===!0?"; preload":""}`},T=(s,e)=>e!==void 0?["frame-ancestors 'self'",...e].join(" "):s==="DENY"?"frame-ancestors 'none'":s==="SAMEORIGIN"?"frame-ancestors 'self'":void 0,U=/^[a-z][\d+.a-z-]*:\/\/(?:\*\.)?[\d.a-z-]+(?::\d{1,5})?$/iu,$=s=>[...s].every(e=>e===" "||e>=" "&&e!==""&&e<="ÿ"),G=["same-origin","same-origin-allow-popups","unsafe-none"],Y=["DENY","SAMEORIGIN"],S=["includeSubDomains","maxAge","preload"],_=["csp","permissionsPolicy","referrerPolicy"],b=[..._,"crossOriginOpenerPolicy","frameAncestors","frameOptions","hsts"],p=s=>s.map(e=>JSON.stringify(e)).join(", "),W=(s,e)=>{if(typeof s=="boolean")return s;if(!w(s)){e.push("security.headers.hsts must be a boolean or an object { maxAge?, includeSubDomains?, preload? }");return}for(const n of Object.keys(s).filter(i=>!S.includes(i)))e.push(`security.headers.hsts.${n} is not an option (expected ${p(S)})`);const{includeSubDomains:r,maxAge:t,preload:o}=s;t!==void 0&&!(typeof t=="number"&&Number.isSafeInteger(t)&&t>=0)&&e.push(`security.headers.hsts.maxAge must be a whole number of seconds (got ${JSON.stringify(t)})`);for(const[n,i]of[["includeSubDomains",r],["preload",o]])i!==void 0&&typeof i!="boolean"&&e.push(`security.headers.hsts.${n} must be a boolean`);return{...r===void 0?{}:{includeSubDomains:r},...t===void 0?{}:{maxAge:t},...o===void 0?{}:{preload:o}}},v=(s,e,r,t)=>{if(e===void 0||e===!1||r.includes(e))return e;t.push(`security.headers.${s} must be one of ${p(r)} or false (got ${JSON.stringify(e)})`)},B=(s,e)=>{if(s!==void 0){if(!Array.isArray(s)){e.push('security.headers.frameAncestors must be an array of origins like ["https://partner.example"]');return}for(const r of s)(typeof r!="string"||!U.test(r)||!$(r))&&e.push(`security.headers.frameAncestors entry ${JSON.stringify(r)} is not an origin like "https://partner.example"`);return[...s]}},X=s=>{if(s===void 0||typeof s=="boolean")return{ok:!0,value:s};if(!w(s))return{ok:!1,problems:[`security.headers must be a boolean or an object (got ${Array.isArray(s)?"an array":JSON.stringify(s)})`]};const e=Object.keys(s).filter(t=>!b.includes(t)).map(t=>`security.headers.${t} is not an option (expected ${p(b)})`),r={};for(const t of _){const o=s[t];o===void 0||o===!1?r[t]=o:typeof o!="string"?e.push(`security.headers.${t} must be a string or false`):$(o)?r[t]=o:e.push(`security.headers.${t} contains a line break or control character`)}return r.crossOriginOpenerPolicy=v("crossOriginOpenerPolicy",s.crossOriginOpenerPolicy,G,e),r.frameOptions=v("frameOptions",s.frameOptions,Y,e),r.frameAncestors=B(s.frameAncestors,e),r.hsts=s.hsts===void 0?void 0:W(s.hsts,e),r.frameAncestors!==void 0&&typeof r.csp=="string"&&e.push("security.headers.frameAncestors cannot be combined with a csp string: put the frame-ancestors directive in the csp"),r.frameAncestors!==void 0&&r.frameOptions==="DENY"&&e.push('security.headers.frameAncestors cannot be combined with frameOptions: "DENY"'),r.frameAncestors!==void 0&&r.csp===!1&&e.push("security.headers.frameAncestors needs the Content-Security-Policy that carries it; it cannot be combined with csp: false"),e.length>0?{ok:!1,problems:e}:{ok:!0,value:Object.fromEntries(Object.entries(r).filter(([,t])=>t!==void 0))}},ge=(s,e)=>s??(C(e)?!1:void 0),V=s=>{if(s===!1)return F;const e=s===void 0||s===!0?{}:s,r=e.frameAncestors!==void 0||e.frameOptions===!1?void 0:e.frameOptions??"SAMEORIGIN",t=["base-uri 'none'","object-src 'none'",T(r,e.frameAncestors)].filter(n=>n!==void 0).join("; ");let o;return typeof e.csp=="string"?o={htmlValue:e.csp,value:e.csp}:e.csp!==!1&&(o={htmlValue:t,value:R}),{coop:e.crossOriginOpenerPolicy===!1?void 0:e.crossOriginOpenerPolicy??"same-origin-allow-popups",csp:o,enabled:!0,frameOptions:r,hsts:M(e.hsts),permissionsPolicy:e.permissionsPolicy===!1?void 0:e.permissionsPolicy??j,referrerPolicy:e.referrerPolicy===!1?void 0:e.referrerPolicy??"strict-origin-when-cross-origin"}},J="_headers",h="# BEGIN lunora-managed: rewritten on every build. Put your own rules outside this block.",m="# END lunora-managed",d=100,O=2e3,K=s=>{const e=X(s);if(!e.ok)throw new E("CONFIG_INVALID",`[lunora] cannot write _headers: ${e.problems.join("; ")}`);const r=V(e.value);return r.enabled?[["Strict-Transport-Security",r.hsts],["X-Content-Type-Options","nosniff"],["X-Frame-Options",r.frameOptions],["Referrer-Policy",r.referrerPolicy],["Permissions-Policy",r.permissionsPolicy],["Cross-Origin-Opener-Policy",r.coop],["Content-Security-Policy",r.csp?.htmlValue]].filter(o=>o[1]!==void 0):[]},z="public, max-age=31536000, immutable",q=s=>s.split(`
|
|
2
|
+
`).map(e=>e.endsWith("\r")?e.slice(0,-1):e),A=s=>{let e=0,r=s.length;for(;e<r&&s[e]?.trim()==="";)e+=1;for(;r>e&&s[r-1]?.trim()==="";)r-=1;return s.slice(e,r)},Q=s=>{const e=q(s),r=e.indexOf(h);if(r===-1)return A(e);const t=e.indexOf(m,r);return t===-1?void 0:A([...e.slice(0,r),...e.slice(t+1)])},P=s=>s.startsWith(" ")||s.startsWith(" "),Z=s=>s!==""&&!P(s)&&!s.startsWith("#"),ee=s=>{if(!s.startsWith("https://"))return s;const e=s.indexOf("/",8);return e===-1?"/":s.slice(e)},se=s=>{const e=[];let r=new Set;for(const t of s){if(Z(t)){e.push({rule:t.trim(),sets:[]}),r=new Set;continue}const o=e.at(-1),n=t.trim();if(o===void 0||!P(t)||n.startsWith("#"))continue;if(n.startsWith("!")){r.add(n.slice(1).trim().toLowerCase());continue}const i=n.indexOf(":");if(i>0){const a=n.slice(0,i).trim().toLowerCase();o.sets.push({detached:r.has(a),name:a})}}return e},re=s=>{const e=new Set,r=[];for(const{rule:t,sets:o}of s)for(const{detached:n,name:i}of o)t==="/*"?e.add(i):n||r.push({name:i,rule:t});return{stacked:r,taken:e}},te=(s,e)=>{const r=ee(s).split("/").slice(1),t=e.split("/");for(const[o,n]of r.entries()){const i=t[o];if(n.includes("*")||i===void 0)return!0;if(!n.startsWith(":")&&n!==i)return!1}return!1},oe=(s,e)=>s.some(({rule:r,sets:t})=>t.some(({name:o})=>o==="cache-control")&&te(r,e)),ne=s=>[h,...s.flatMap(e=>[e.path,...e.headers.map(([r,t])=>` ${r}: ${t}`)]),m],N=/^frame-ancestors(?:\s|$)/iu,ie=s=>s.split(";").map(e=>e.trim()).filter(e=>e!==""&&!N.test(e)).join("; "),ae=(s,e,r)=>e?ie(s):(s.split(";").some(t=>N.test(t.trim()))&&r.push("your _headers rule for /* sets X-Frame-Options, but the csp in lunora.config carries a frame-ancestors directive, which browsers apply instead of X-Frame-Options; make the two agree"),s),ce=(s,e)=>{const r=` ${s}: ${e}`;if(r.length>O)throw new E("INTERNAL",`[lunora] the _headers line for ${s} would be ${String(r.length)} characters; Cloudflare ignores a line longer than ${String(O)}, which would leave every static page without it. Shorten security.headers in lunora.config: list fewer frameAncestors origins (one *.example.com entry covers its subdomains), or a shorter csp.`)},le=(s,e,r)=>{const t=[],o=[],n=[];for(const[i,a]of s){for(const l of e.stacked.filter(f=>f.name===i.toLowerCase()))o.push(`_headers rule "${l.rule}" sets ${i} on top of Lunora's default, so both values are sent; add "! ${i}" above it in that rule to replace the default`);if(e.taken.has(i.toLowerCase())){t.push(i);continue}const c=i==="Content-Security-Policy"&&e.taken.has("x-frame-options")?ae(a,r,o):a;ce(i,c),n.push([i,c])}return{deferred:t,rule:n.length===0?void 0:{headers:n,path:"/*"},warnings:o}},fe=(s,e,r)=>{const t=Math.max(0,d-e),o=s.slice(0,t),n=s.slice(t);return n.length>0&&r.push(`_headers already has ${String(e)} of your rules, and Cloudflare applies at most ${String(d)}; Lunora left out its ${n.map(i=>i.path).join(", ")} rule so yours still apply. Merge some of your rules to make room`),e>d&&r.push(`_headers has ${String(e)} rules of your own; Cloudflare ignores every rule past the ${String(d)}th`),o},de=(s,e)=>{const r=Q(s??"");if(r===void 0)return{deferred:[],text:s,warnings:[`_headers has "${h}" but no "${m}" line, so Lunora cannot tell its rules from yours and left the file as it is; put the END line back after the managed rules, or delete the managed block`]};const t=se(r),o=[],n=[],i=[],a=typeof e.headers!="object"||typeof e.headers.csp!="string",c=le(K(e.headers),re(t),a);o.push(...c.deferred),n.push(...c.warnings),c.rule!==void 0&&i.push(c.rule);const l=e.immutableDirectory?.replaceAll("\\","/").split("/").filter(g=>g!==""&&g!==".").join("/");l!==void 0&&l!==""&&(oe(t,l)?o.push("Cache-Control"):i.push({headers:[["Cache-Control",z]],path:`/${l}/*`}));const f=fe(i,t.length,n),u=f.length===0?[]:ne(f),y=r.length>0&&u.length>0?[...u,"",...r]:[...u,...r];return{deferred:o,text:y.length===0?void 0:`${y.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`,warnings:n}},Se=(s,e)=>{const r=I(s,J),t=D(r)?k(r,"utf8"):void 0,o=de(t,e);return o.text===void 0?(t!==void 0&&x(r,{force:!0}),{deferred:o.deferred,path:void 0,warnings:o.warnings}):(o.text!==t&&L(r,o.text,"utf8"),{deferred:o.deferred,path:r,warnings:o.warnings})};export{ge as e,de as m,Se as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as o,statSync as i}from"node:fs";import{createRequire as n}from"node:module";import{normalize as u,join as a,relative as c,isAbsolute as d,dirname as l}from"node:path";const j=(t,s=import.meta.url)=>{try{const r=n(s);return{script:o(r.resolve("@lunora/studio/standalone/studio.js")),styles:o(r.resolve("@lunora/studio/styles.css"))}}catch(r){const e=r instanceof Error?r.message:String(r);t?.warnOnce?.(`[lunora] studio assets unavailable (build @lunora/studio?): ${e}`);return}},S=(t=import.meta.url)=>{try{const s=n(t),r=i(s.resolve("@lunora/studio/standalone/studio.js")).mtimeMs,e=i(s.resolve("@lunora/studio/styles.css")).mtimeMs;return Math.max(r,e)}catch{return}},v=(t=import.meta.url)=>{try{return l(n(t).resolve("@lunora/studio/standalone/studio.js"))}catch{return}},m=(t,s)=>{if(s===""||s==="."||s===".."||s.includes("/")||s.includes("\\")||s.includes("\0"))return;const r=u(a(t,s)),e=c(t,r);if(!(e===""||e.startsWith("..")||d(e)||e.includes("/")||e.includes("\\")))return r},f=(t,s=import.meta.url)=>{const r=v(s);if(r===void 0)return;const e=m(r,t);if(e!==void 0)try{return o(e)}catch{return}},M=t=>t.endsWith(".js")||t.endsWith(".js.map"),W=t=>t.endsWith(".css")?"text/css; charset=utf-8":t.endsWith(".map")?"application/json; charset=utf-8":"text/javascript; charset=utf-8";export{W as assetContentType,M as isStandaloneModulePath,j as loadStudioAssets,f as readStandaloneAsset,m as resolveContainedFile,v as resolveStandaloneDirectory,S as studioAssetsStamp};
|