@lunora/config 1.0.0-alpha.7 → 1.0.0-alpha.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/index.d.mts +466 -10
- package/dist/index.d.ts +466 -10
- package/dist/index.mjs +17 -9
- package/dist/packem_shared/AGENT_MODE_ENV-B5R7jpY7.mjs +17 -0
- package/dist/packem_shared/DEV_DAEMON_ENV-FIEtW7Fz.mjs +163 -0
- package/dist/packem_shared/{PACKAGE_SECRETS_REGISTRY-CySy5vR_.mjs → PACKAGE_SECRETS_REGISTRY-BeRSvrl5.mjs} +45 -1
- package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-CiC2IGKx.mjs → POLICY_SCAFFOLD_ENDPOINT-CvTZpaZF.mjs} +7 -10
- package/dist/packem_shared/{REMOTE_ELIGIBLE_KEYS-BC7_e9Bz.mjs → REMOTE_ELIGIBLE_KEYS-C-F_Flgy.mjs} +1 -6
- package/dist/packem_shared/{REQUIRED_COMPATIBILITY_DATE-ycqievRl.mjs → REQUIRED_COMPATIBILITY_DATE-DP0SFVy9.mjs} +135 -4
- package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-Df-Wrix-.mjs → SCHEMA_EDIT_ENDPOINT-Bt2SNkpV.mjs} +4 -8
- package/dist/packem_shared/{SEED_ENDPOINT-DVCjaGO-.mjs → SEED_ENDPOINT-7izz_Jao.mjs} +1 -1
- package/dist/packem_shared/WORKERS_CACHE_MIN_DATE-CaXbS7CX.mjs +11 -0
- package/dist/packem_shared/assetContentType-ByZjeV3D.mjs +72 -0
- package/dist/packem_shared/{buildPackageSecretsBlock-S74dgmwy.mjs → buildPackageSecretsBlock-B-dWb-Sa.mjs} +115 -21
- package/dist/packem_shared/collectWranglerSecretVariables-p4ezBYQ4.mjs +56 -0
- package/dist/packem_shared/{createConfirm-fvpdgJ9s.mjs → createConfirm-BMikeJC9.mjs} +22 -5
- package/dist/packem_shared/{detectFramework-Br-BcPBq.mjs → detectFramework-U08038Yp.mjs} +3 -3
- package/dist/packem_shared/discoverAgentInfo-eXA3hF4v.mjs +19 -0
- package/dist/packem_shared/{discoverSchemaInfo-DWtypqpP.mjs → discoverSchemaInfo-BB-CKlTK.mjs} +1 -1
- package/dist/packem_shared/{inferLunoraBindings-XNJH4pup.mjs → inferLunoraBindings-BcvvtpSG.mjs} +146 -51
- package/dist/packem_shared/jsonc-edit-SbcD7MAe.mjs +9 -0
- package/dist/packem_shared/parseDevVariable-B0FEvfHC.mjs +21 -0
- package/dist/packem_shared/{reconcileWranglerBindings-DTHmqTbL.mjs → reconcileWranglerBindings-2Cww5VLa.mjs} +114 -29
- package/dist/packem_shared/reconcileWranglerCompatibilityDate-C8c497ag.mjs +31 -0
- package/dist/packem_shared/reconcileWranglerCrons-DvsceVFz.mjs +29 -0
- package/dist/packem_shared/{serveJsonHandler-B4OLTGLS.mjs → serveJsonHandler-Cl2Wqkv8.mjs} +2 -2
- package/dist/packem_shared/streamContainerLogs-BZ4cOZwH.mjs +157 -0
- package/dist/packem_shared/write-atomic-B2REqapi.mjs +14 -0
- package/dist/studio-host/index.d.mts +45 -3
- package/dist/studio-host/index.d.ts +45 -3
- package/dist/studio-host/index.mjs +6 -6
- package/package.json +11 -8
- package/dist/packem_shared/loadStudioAssets-Csk5RS4E.mjs +0 -28
- package/dist/packem_shared/parseDevVariable-CJiq2IwE.mjs +0 -30
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
2
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
3
|
+
|
|
4
|
+
const DEV_CONTAINER_IMAGE_PREFIX = "cloudflare-dev/";
|
|
5
|
+
const DEFAULT_POLL_INTERVAL_MS = 1500;
|
|
6
|
+
const createDefaultDocker = async () => {
|
|
7
|
+
const { default: Dockerode } = await import('dockerode');
|
|
8
|
+
return new Dockerode();
|
|
9
|
+
};
|
|
10
|
+
const classFromImage = (image) => {
|
|
11
|
+
if (!image.startsWith(DEV_CONTAINER_IMAGE_PREFIX)) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
const [segment] = image.slice(DEV_CONTAINER_IMAGE_PREFIX.length).split(":");
|
|
15
|
+
return segment !== void 0 && segment.length > 0 ? segment : void 0;
|
|
16
|
+
};
|
|
17
|
+
const lineBufferWritable = (emit) => {
|
|
18
|
+
const decoder = new StringDecoder("utf8");
|
|
19
|
+
let buffer = "";
|
|
20
|
+
const flushLine = (line) => {
|
|
21
|
+
emit(line.endsWith("\r") ? line.slice(0, -1) : line);
|
|
22
|
+
};
|
|
23
|
+
return new Writable({
|
|
24
|
+
final(callback) {
|
|
25
|
+
buffer += decoder.end();
|
|
26
|
+
if (buffer.length > 0) {
|
|
27
|
+
flushLine(buffer);
|
|
28
|
+
buffer = "";
|
|
29
|
+
}
|
|
30
|
+
callback();
|
|
31
|
+
},
|
|
32
|
+
write(chunk, _encoding, callback) {
|
|
33
|
+
buffer += decoder.write(chunk);
|
|
34
|
+
const lines = buffer.split("\n");
|
|
35
|
+
buffer = lines.pop() ?? "";
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
flushLine(line);
|
|
38
|
+
}
|
|
39
|
+
callback();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const streamContainerLogs = (options) => {
|
|
44
|
+
const classToExport = new Map(options.containers.map((source) => [source.className.toLowerCase(), source.exportName]));
|
|
45
|
+
if (classToExport.size === 0) {
|
|
46
|
+
return { close: () => {
|
|
47
|
+
} };
|
|
48
|
+
}
|
|
49
|
+
const interval = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
50
|
+
const attached = /* @__PURE__ */ new Map();
|
|
51
|
+
let closed = false;
|
|
52
|
+
let unavailableNotified = false;
|
|
53
|
+
let timer;
|
|
54
|
+
let dockerPromise;
|
|
55
|
+
const getDocker = async () => {
|
|
56
|
+
dockerPromise ??= options.docker ? Promise.resolve(options.docker) : createDefaultDocker();
|
|
57
|
+
return dockerPromise;
|
|
58
|
+
};
|
|
59
|
+
const attach = async (docker, id, exportName) => {
|
|
60
|
+
try {
|
|
61
|
+
const stream = await docker.getContainer(id).logs({ follow: true, stderr: true, stdout: true, tail: "all", timestamps: false });
|
|
62
|
+
if (closed) {
|
|
63
|
+
stream.destroy();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const stdout = lineBufferWritable((text) => {
|
|
67
|
+
options.onLine({ level: "info", name: exportName, text });
|
|
68
|
+
});
|
|
69
|
+
const stderr = lineBufferWritable((text) => {
|
|
70
|
+
options.onLine({ level: "error", name: exportName, text });
|
|
71
|
+
});
|
|
72
|
+
docker.modem.demuxStream(stream, stdout, stderr);
|
|
73
|
+
stream.on("end", () => {
|
|
74
|
+
stdout.end();
|
|
75
|
+
stderr.end();
|
|
76
|
+
attached.delete(id);
|
|
77
|
+
});
|
|
78
|
+
stream.on("error", () => {
|
|
79
|
+
attached.delete(id);
|
|
80
|
+
});
|
|
81
|
+
attached.set(id, stream);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const listRunning = async () => {
|
|
86
|
+
try {
|
|
87
|
+
const docker = await getDocker();
|
|
88
|
+
const running = await docker.listContainers({ filters: { status: ["running"] } });
|
|
89
|
+
unavailableNotified = false;
|
|
90
|
+
return running;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (!unavailableNotified) {
|
|
93
|
+
unavailableNotified = true;
|
|
94
|
+
options.onUnavailable?.(error instanceof Error ? error.message : String(error));
|
|
95
|
+
}
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const reconcile = async (docker, running) => {
|
|
100
|
+
const live = /* @__PURE__ */ new Set();
|
|
101
|
+
for (const summary of running) {
|
|
102
|
+
const className = classFromImage(summary.Image);
|
|
103
|
+
const exportName = className === void 0 ? void 0 : classToExport.get(className);
|
|
104
|
+
if (exportName === void 0) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
live.add(summary.Id);
|
|
108
|
+
if (!attached.has(summary.Id)) {
|
|
109
|
+
await attach(docker, summary.Id, exportName);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const [id, stream] of attached) {
|
|
113
|
+
if (!live.has(id)) {
|
|
114
|
+
stream.destroy();
|
|
115
|
+
attached.delete(id);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const poll = async () => {
|
|
120
|
+
if (closed) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const running = await listRunning();
|
|
124
|
+
if (running === void 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
await reconcile(await getDocker(), running);
|
|
128
|
+
};
|
|
129
|
+
let polling = false;
|
|
130
|
+
const onTick = () => {
|
|
131
|
+
if (polling || closed) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
polling = true;
|
|
135
|
+
poll().finally(() => {
|
|
136
|
+
polling = false;
|
|
137
|
+
}).catch(() => void 0);
|
|
138
|
+
};
|
|
139
|
+
timer = setInterval(onTick, interval);
|
|
140
|
+
timer.unref();
|
|
141
|
+
onTick();
|
|
142
|
+
return {
|
|
143
|
+
close: () => {
|
|
144
|
+
closed = true;
|
|
145
|
+
if (timer) {
|
|
146
|
+
clearInterval(timer);
|
|
147
|
+
timer = void 0;
|
|
148
|
+
}
|
|
149
|
+
for (const [id, stream] of attached) {
|
|
150
|
+
stream.destroy();
|
|
151
|
+
attached.delete(id);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export { streamContainerLogs };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { writeFileSync, renameSync, rmSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
const writeFileAtomic = (path, text) => {
|
|
4
|
+
const temporaryPath = `${path}.lunora-tmp`;
|
|
5
|
+
try {
|
|
6
|
+
writeFileSync(temporaryPath, text, "utf8");
|
|
7
|
+
renameSync(temporaryPath, path);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
rmSync(temporaryPath, { force: true });
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { writeFileAtomic as w };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-DCmwn7zQ.mjs";
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Parse a single `KEY=value` (optionally quoted) out of a `.dev.vars` body,
|
|
5
|
+
* returning `undefined` when the key is absent or its value is empty. A thin
|
|
6
|
+
* wrapper over {@link parseDevVariableEntries} — the single owner of the
|
|
7
|
+
* `.dev.vars` line grammar — so the key-validation, comment-skip, and quote-strip
|
|
8
|
+
* rules can't drift from every other reader/writer of the file.
|
|
9
|
+
*/
|
|
4
10
|
declare const parseDevVariable: (contents: string, key: string) => string | undefined;
|
|
5
11
|
/**
|
|
6
12
|
* Resolve the worker's admin token so the studio can auto-authenticate in
|
|
@@ -81,6 +87,38 @@ declare const loadStudioAssets: (logger?: WarnLogger, resolveFrom?: string) => S
|
|
|
81
87
|
*/
|
|
82
88
|
declare const studioAssetsStamp: (resolveFrom?: string) => number | undefined;
|
|
83
89
|
/**
|
|
90
|
+
* Absolute path of the built standalone directory — `@lunora/studio`'s
|
|
91
|
+
* `dist/standalone`, where the `studio.js` entry and its code-split `chunk-*.js`
|
|
92
|
+
* siblings live — or `undefined` when the studio isn't installed/built. The
|
|
93
|
+
* standalone bundle is emitted with esbuild `splitting`, so the hosts must serve
|
|
94
|
+
* the whole directory (not two fixed paths); this resolves its root.
|
|
95
|
+
*/
|
|
96
|
+
declare const resolveStandaloneDirectory: (resolveFrom?: string) => string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Read a single file from the standalone directory by its plain filename (the
|
|
99
|
+
* `studio.js` entry, a `chunk-*.js`, or a `.map`). **Path-traversal-safe** via
|
|
100
|
+
* {@link resolveContainedFile}: only a lone filename resolving to a direct child
|
|
101
|
+
* of the standalone directory is served — any separator, `..`, NUL, or absolute
|
|
102
|
+
* path is rejected — so a request like `../../etc/passwd` can never escape it.
|
|
103
|
+
* Returns the bytes, or `undefined` when the studio isn't built or the name
|
|
104
|
+
* doesn't resolve to a file inside the directory (the host answers that 404).
|
|
105
|
+
*/
|
|
106
|
+
declare const readStandaloneAsset: (fileName: string, resolveFrom?: string) => Buffer | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* True when `pathname` addresses a standalone JS module — the `studio.js` entry
|
|
109
|
+
* or one of its code-split `chunk-*.js` siblings (and their `.map`s). Shared by
|
|
110
|
+
* the CLI and Vite hosts so both route the same request shapes to the directory
|
|
111
|
+
* server; the stylesheet is matched separately at each host's own style path.
|
|
112
|
+
*/
|
|
113
|
+
declare const isStandaloneModulePath: (pathname: string) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Content-Type for a served standalone asset, by extension: `.css` → CSS,
|
|
116
|
+
* `.map` → JSON (a source map), everything else (the `.js` entry + chunks) →
|
|
117
|
+
* JavaScript. Shared by the CLI and Vite hosts so the MIME decision lives in one
|
|
118
|
+
* place.
|
|
119
|
+
*/
|
|
120
|
+
declare const assetContentType: (fileName: string) => string;
|
|
121
|
+
/**
|
|
84
122
|
* Endpoint path both dev hosts mount the handler at. A sibling of the schema
|
|
85
123
|
* editor's `/__lunora/schema-edit`; the double underscore keeps it clear of the
|
|
86
124
|
* CLI's `/_lunora/*` worker proxy (single underscore).
|
|
@@ -222,6 +260,10 @@ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResp
|
|
|
222
260
|
* schema); every other method has its body read + JSON-parsed first. The
|
|
223
261
|
* handler's `{ status, body }` is serialised back as JSON. A malformed body is a
|
|
224
262
|
* `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
|
|
263
|
+
*
|
|
264
|
+
* `schemaDirectory` (when the host configures a custom `schemaDir`) is forwarded
|
|
265
|
+
* to the handler so the schema/seed/policy endpoints target the right directory
|
|
266
|
+
* instead of always defaulting to `"lunora"`.
|
|
225
267
|
*/
|
|
226
|
-
declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string) => void;
|
|
227
|
-
export { type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, loadStudioAssets, parseDevVariable, renderStudioHtml, resolveAdminToken, serveJsonHandler, studioAssetsStamp };
|
|
268
|
+
declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, schemaDirectory?: string) => void;
|
|
269
|
+
export { type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, isStandaloneModulePath, loadStudioAssets, parseDevVariable, readStandaloneAsset, renderStudioHtml, resolveAdminToken, resolveStandaloneDirectory, serveJsonHandler, studioAssetsStamp };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { D as DestructivePolicyEdit, S as ScaffoldPolicyEdit, W as WireRlsEdit } from "../packem_shared/policy-scaffold.d-DCmwn7zQ.js";
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Parse a single `KEY=value` (optionally quoted) out of a `.dev.vars` body,
|
|
5
|
+
* returning `undefined` when the key is absent or its value is empty. A thin
|
|
6
|
+
* wrapper over {@link parseDevVariableEntries} — the single owner of the
|
|
7
|
+
* `.dev.vars` line grammar — so the key-validation, comment-skip, and quote-strip
|
|
8
|
+
* rules can't drift from every other reader/writer of the file.
|
|
9
|
+
*/
|
|
4
10
|
declare const parseDevVariable: (contents: string, key: string) => string | undefined;
|
|
5
11
|
/**
|
|
6
12
|
* Resolve the worker's admin token so the studio can auto-authenticate in
|
|
@@ -81,6 +87,38 @@ declare const loadStudioAssets: (logger?: WarnLogger, resolveFrom?: string) => S
|
|
|
81
87
|
*/
|
|
82
88
|
declare const studioAssetsStamp: (resolveFrom?: string) => number | undefined;
|
|
83
89
|
/**
|
|
90
|
+
* Absolute path of the built standalone directory — `@lunora/studio`'s
|
|
91
|
+
* `dist/standalone`, where the `studio.js` entry and its code-split `chunk-*.js`
|
|
92
|
+
* siblings live — or `undefined` when the studio isn't installed/built. The
|
|
93
|
+
* standalone bundle is emitted with esbuild `splitting`, so the hosts must serve
|
|
94
|
+
* the whole directory (not two fixed paths); this resolves its root.
|
|
95
|
+
*/
|
|
96
|
+
declare const resolveStandaloneDirectory: (resolveFrom?: string) => string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Read a single file from the standalone directory by its plain filename (the
|
|
99
|
+
* `studio.js` entry, a `chunk-*.js`, or a `.map`). **Path-traversal-safe** via
|
|
100
|
+
* {@link resolveContainedFile}: only a lone filename resolving to a direct child
|
|
101
|
+
* of the standalone directory is served — any separator, `..`, NUL, or absolute
|
|
102
|
+
* path is rejected — so a request like `../../etc/passwd` can never escape it.
|
|
103
|
+
* Returns the bytes, or `undefined` when the studio isn't built or the name
|
|
104
|
+
* doesn't resolve to a file inside the directory (the host answers that 404).
|
|
105
|
+
*/
|
|
106
|
+
declare const readStandaloneAsset: (fileName: string, resolveFrom?: string) => Buffer | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* True when `pathname` addresses a standalone JS module — the `studio.js` entry
|
|
109
|
+
* or one of its code-split `chunk-*.js` siblings (and their `.map`s). Shared by
|
|
110
|
+
* the CLI and Vite hosts so both route the same request shapes to the directory
|
|
111
|
+
* server; the stylesheet is matched separately at each host's own style path.
|
|
112
|
+
*/
|
|
113
|
+
declare const isStandaloneModulePath: (pathname: string) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Content-Type for a served standalone asset, by extension: `.css` → CSS,
|
|
116
|
+
* `.map` → JSON (a source map), everything else (the `.js` entry + chunks) →
|
|
117
|
+
* JavaScript. Shared by the CLI and Vite hosts so the MIME decision lives in one
|
|
118
|
+
* place.
|
|
119
|
+
*/
|
|
120
|
+
declare const assetContentType: (fileName: string) => string;
|
|
121
|
+
/**
|
|
84
122
|
* Endpoint path both dev hosts mount the handler at. A sibling of the schema
|
|
85
123
|
* editor's `/__lunora/schema-edit`; the double underscore keeps it clear of the
|
|
86
124
|
* CLI's `/_lunora/*` worker proxy (single underscore).
|
|
@@ -222,6 +260,10 @@ type LocalEndpointHandler = (request: LocalEndpointRequest) => LocalEndpointResp
|
|
|
222
260
|
* schema); every other method has its body read + JSON-parsed first. The
|
|
223
261
|
* handler's `{ status, body }` is serialised back as JSON. A malformed body is a
|
|
224
262
|
* `400`; an unexpected throw (e.g. the body-size guard) is a `500`.
|
|
263
|
+
*
|
|
264
|
+
* `schemaDirectory` (when the host configures a custom `schemaDir`) is forwarded
|
|
265
|
+
* to the handler so the schema/seed/policy endpoints target the right directory
|
|
266
|
+
* instead of always defaulting to `"lunora"`.
|
|
225
267
|
*/
|
|
226
|
-
declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string) => void;
|
|
227
|
-
export { type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, loadStudioAssets, parseDevVariable, renderStudioHtml, resolveAdminToken, serveJsonHandler, studioAssetsStamp };
|
|
268
|
+
declare const serveJsonHandler: (request: IncomingMessage, response: ServerResponse, handle: LocalEndpointHandler, projectRoot: string, schemaDirectory?: string) => void;
|
|
269
|
+
export { type LocalEndpointHandler, type LocalEndpointRequest, type LocalEndpointResponse, POLICY_SCAFFOLD_ENDPOINT, type PolicyScaffoldBody, type PolicyScaffoldRequest, type PolicyScaffoldResponse, SCHEMA_EDIT_ENDPOINT, SEED_ENDPOINT, type SchemaEditRequest, type SchemaEditResponse, type SeedRequest, type SeedRequestBody, type SeedResponse, type StudioAssets, type StudioHtmlConfig, type WarnLogger, type WirePolicyEdit, assetContentType, handlePolicyScaffoldRequest, handleSchemaEditRequest, handleSeedRequest, isStandaloneModulePath, loadStudioAssets, parseDevVariable, readStandaloneAsset, renderStudioHtml, resolveAdminToken, resolveStandaloneDirectory, serveJsonHandler, studioAssetsStamp };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { parseDevVariable, resolveAdminToken } from '../packem_shared/parseDevVariable-
|
|
2
|
-
export {
|
|
3
|
-
export { POLICY_SCAFFOLD_ENDPOINT, handlePolicyScaffoldRequest } from '../packem_shared/POLICY_SCAFFOLD_ENDPOINT-
|
|
1
|
+
export { parseDevVariable, resolveAdminToken } from '../packem_shared/parseDevVariable-B0FEvfHC.mjs';
|
|
2
|
+
export { assetContentType, isStandaloneModulePath, loadStudioAssets, readStandaloneAsset, resolveStandaloneDirectory, studioAssetsStamp } from '../packem_shared/assetContentType-ByZjeV3D.mjs';
|
|
3
|
+
export { POLICY_SCAFFOLD_ENDPOINT, handlePolicyScaffoldRequest } from '../packem_shared/POLICY_SCAFFOLD_ENDPOINT-CvTZpaZF.mjs';
|
|
4
4
|
export { default as renderStudioHtml } from '../packem_shared/renderStudioHtml-449Ysn75.mjs';
|
|
5
|
-
export { SCHEMA_EDIT_ENDPOINT, handleSchemaEditRequest } from '../packem_shared/SCHEMA_EDIT_ENDPOINT-
|
|
6
|
-
export { SEED_ENDPOINT, handleSeedRequest } from '../packem_shared/SEED_ENDPOINT-
|
|
7
|
-
export { serveJsonHandler } from '../packem_shared/serveJsonHandler-
|
|
5
|
+
export { SCHEMA_EDIT_ENDPOINT, handleSchemaEditRequest } from '../packem_shared/SCHEMA_EDIT_ENDPOINT-Bt2SNkpV.mjs';
|
|
6
|
+
export { SEED_ENDPOINT, handleSeedRequest } from '../packem_shared/SEED_ENDPOINT-7izz_Jao.mjs';
|
|
7
|
+
export { serveJsonHandler } from '../packem_shared/serveJsonHandler-Cl2Wqkv8.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.70",
|
|
4
4
|
"description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bindings",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"directory": "packages/config"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"dist",
|
|
28
|
+
"./dist",
|
|
29
29
|
"__assets__",
|
|
30
30
|
"README.md",
|
|
31
31
|
"LICENSE.md"
|
|
@@ -50,16 +50,19 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
54
|
-
"@lunora/container": "1.0.0-alpha.
|
|
55
|
-
"@lunora/
|
|
56
|
-
"@
|
|
57
|
-
"
|
|
53
|
+
"@lunora/codegen": "1.0.0-alpha.46",
|
|
54
|
+
"@lunora/container": "1.0.0-alpha.12",
|
|
55
|
+
"@lunora/errors": "1.0.0-alpha.5",
|
|
56
|
+
"@lunora/seed": "1.0.0-alpha.26",
|
|
57
|
+
"@visulima/colorize": "2.0.0",
|
|
58
|
+
"@visulima/find-ai-runner": "1.0.0",
|
|
59
|
+
"dockerode": "^5.0.1",
|
|
60
|
+
"es-module-lexer": "^2.3.0",
|
|
58
61
|
"jsonc-parser": "^3.3.1",
|
|
59
62
|
"ts-morph": "^28.0.0"
|
|
60
63
|
},
|
|
61
64
|
"peerDependencies": {
|
|
62
|
-
"@lunora/studio": "1.0.0-alpha.
|
|
65
|
+
"@lunora/studio": ">=1.0.0-alpha.50 <2.0.0-0"
|
|
63
66
|
},
|
|
64
67
|
"peerDependenciesMeta": {
|
|
65
68
|
"@lunora/studio": {
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { readFileSync, statSync } from 'node:fs';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
|
|
4
|
-
const loadStudioAssets = (logger, resolveFrom = import.meta.url) => {
|
|
5
|
-
try {
|
|
6
|
-
const require = createRequire(resolveFrom);
|
|
7
|
-
return {
|
|
8
|
-
script: readFileSync(require.resolve("@lunora/studio/standalone/studio.js")),
|
|
9
|
-
styles: readFileSync(require.resolve("@lunora/studio/styles.css"))
|
|
10
|
-
};
|
|
11
|
-
} catch (error) {
|
|
12
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
13
|
-
logger?.warnOnce?.(`[lunora] studio assets unavailable (build @lunora/studio?): ${message}`);
|
|
14
|
-
return void 0;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const studioAssetsStamp = (resolveFrom = import.meta.url) => {
|
|
18
|
-
try {
|
|
19
|
-
const require = createRequire(resolveFrom);
|
|
20
|
-
const scriptMtime = statSync(require.resolve("@lunora/studio/standalone/studio.js")).mtimeMs;
|
|
21
|
-
const stylesMtime = statSync(require.resolve("@lunora/studio/styles.css")).mtimeMs;
|
|
22
|
-
return Math.max(scriptMtime, stylesMtime);
|
|
23
|
-
} catch {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { loadStudioAssets as default, studioAssetsStamp };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const LINE_BREAK = /\r?\n/u;
|
|
5
|
-
const parseDevVariable = (contents, key) => {
|
|
6
|
-
for (const raw of contents.split(LINE_BREAK)) {
|
|
7
|
-
const line = raw.trim();
|
|
8
|
-
const eq = line.indexOf("=");
|
|
9
|
-
if (line === "" || line.startsWith("#") || eq === -1 || line.slice(0, eq).trim() !== key) {
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
const value = line.slice(eq + 1).trim();
|
|
13
|
-
const unquoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'") ? value.slice(1, -1) : value;
|
|
14
|
-
return unquoted === "" ? void 0 : unquoted;
|
|
15
|
-
}
|
|
16
|
-
return void 0;
|
|
17
|
-
};
|
|
18
|
-
const resolveAdminToken = (root) => {
|
|
19
|
-
const fromEnv = process.env["LUNORA_ADMIN_TOKEN"];
|
|
20
|
-
if (typeof fromEnv === "string" && fromEnv !== "") {
|
|
21
|
-
return fromEnv;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
return parseDevVariable(readFileSync(join(root, ".dev.vars"), "utf8"), "LUNORA_ADMIN_TOKEN");
|
|
25
|
-
} catch {
|
|
26
|
-
return void 0;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { parseDevVariable, resolveAdminToken };
|