@astrale-os/adapter-cloudflare 0.5.0-beta.4 → 0.5.0-beta.41
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/README.md +11 -0
- package/dist/adapter.d.ts +17 -0
- package/dist/adapter.js +178 -0
- package/dist/build/artifact.d.ts +7 -0
- package/dist/build/artifact.js +151 -0
- package/dist/build/bundle/admit.d.ts +1 -0
- package/dist/build/bundle/admit.js +9 -0
- package/dist/build/closure.d.ts +2 -0
- package/dist/build/closure.js +22 -0
- package/dist/build/codegen/execution.d.ts +3 -0
- package/dist/build/codegen/execution.js +2 -0
- package/dist/build/codegen/gateway.d.ts +1 -0
- package/dist/build/codegen/gateway.js +1 -0
- package/dist/build/codegen/merge.d.ts +0 -1
- package/dist/build/codegen/merge.js +0 -1
- package/dist/build/codegen/wrangler.d.ts +18 -1
- package/dist/build/codegen/wrangler.js +36 -17
- package/dist/build/configuration/addressing.d.ts +2 -0
- package/dist/build/configuration/addressing.js +11 -0
- package/dist/build/configuration/request-limit.d.ts +2 -0
- package/dist/build/configuration/request-limit.js +9 -0
- package/dist/build/configuration/router.d.ts +7 -0
- package/dist/build/configuration/router.js +11 -0
- package/dist/build/configuration/worker-name.d.ts +2 -0
- package/dist/build/configuration/worker-name.js +18 -0
- package/dist/build/configuration.d.ts +4 -0
- package/dist/build/configuration.js +4 -0
- package/dist/build/direct.d.ts +4 -0
- package/dist/build/direct.js +91 -0
- package/dist/build/frontend/routes.d.ts +2 -0
- package/dist/build/frontend/routes.js +11 -0
- package/dist/build/frontend-v1.d.ts +16 -0
- package/dist/build/frontend-v1.js +133 -0
- package/dist/build/gateway/prepare.d.ts +8 -0
- package/dist/build/gateway/prepare.js +33 -0
- package/dist/build/gateway/source.d.ts +1 -0
- package/dist/build/gateway/source.js +7 -0
- package/dist/build/index.d.ts +10 -16
- package/dist/build/index.js +9 -16
- package/dist/build/materialize.d.ts +4 -0
- package/dist/build/materialize.js +10 -0
- package/dist/build/metafile.d.ts +5 -0
- package/dist/build/metafile.js +14 -0
- package/dist/build/parse-output.d.ts +0 -1
- package/dist/build/parse-output.js +0 -1
- package/dist/build/qualification.d.ts +5 -0
- package/dist/build/qualification.js +7 -0
- package/dist/build/roots.d.ts +2 -0
- package/dist/build/roots.js +34 -0
- package/dist/build/worker/artifact.d.ts +39 -0
- package/dist/build/worker/artifact.js +1 -0
- package/dist/build/worker/artifact.load.d.ts +3 -0
- package/dist/build/worker/artifact.load.js +277 -0
- package/dist/build/worker/artifact.manifest.d.ts +47 -0
- package/dist/build/worker/artifact.manifest.js +87 -0
- package/dist/build/worker/artifact.paths.d.ts +4 -0
- package/dist/build/worker/artifact.paths.js +25 -0
- package/dist/build/worker/codegen/entry.d.ts +2 -0
- package/dist/build/worker/codegen/entry.js +28 -0
- package/dist/build/worker/codegen/service.d.ts +15 -0
- package/dist/build/worker/codegen/service.js +46 -0
- package/dist/build/worker/execution.prepare.d.ts +18 -0
- package/dist/build/worker/execution.prepare.js +108 -0
- package/dist/build/worker/index.d.ts +2 -0
- package/dist/build/worker/index.js +1 -0
- package/dist/build/worker/modules.d.ts +11 -0
- package/dist/build/worker/modules.js +26 -0
- package/dist/build/worker/runtime.d.ts +10 -0
- package/dist/build/worker/runtime.js +35 -0
- package/dist/build/worker/specifier.d.ts +1 -0
- package/dist/build/worker/specifier.js +5 -0
- package/dist/build/wrangler/bundle.d.ts +10 -0
- package/dist/build/wrangler/bundle.js +29 -0
- package/dist/build/wrangler/deploy.d.ts +23 -0
- package/dist/build/wrangler/deploy.js +35 -0
- package/dist/build/wrangler/development.d.ts +15 -0
- package/dist/build/wrangler/development.js +135 -0
- package/dist/build/wrangler/namespace.d.ts +10 -0
- package/dist/build/wrangler/namespace.js +26 -0
- package/dist/build/wrangler/process.d.ts +17 -0
- package/dist/build/wrangler/process.js +115 -0
- package/dist/build/wrangler/release.d.ts +11 -0
- package/dist/build/wrangler/release.js +27 -0
- package/dist/build/wrangler/secrets.d.ts +6 -0
- package/dist/build/wrangler/secrets.js +58 -0
- package/dist/build/wrangler/status.d.ts +14 -0
- package/dist/build/wrangler/status.js +56 -0
- package/dist/build/wrangler/type-generation.d.ts +6 -0
- package/dist/build/wrangler/type-generation.js +19 -0
- package/dist/build/wrangler-cli.d.ts +8 -86
- package/dist/build/wrangler-cli.js +8 -275
- package/dist/cloudflare.d.ts +1 -34
- package/dist/cloudflare.js +1 -205
- package/dist/deploy/deploy.d.ts +17 -0
- package/dist/deploy/deploy.js +234 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.js +1 -0
- package/dist/identity/binding.d.ts +2 -0
- package/dist/identity/binding.js +2 -0
- package/dist/identity/material.d.ts +7 -0
- package/dist/identity/material.js +42 -0
- package/dist/identity/secret.d.ts +3 -0
- package/dist/identity/secret.js +7 -0
- package/dist/identity/source.d.ts +26 -0
- package/dist/identity/source.js +98 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/params.d.ts +24 -5
- package/dist/params.js +0 -1
- package/dist/release/index.d.ts +2 -0
- package/dist/release/index.js +2 -0
- package/dist/release/namespace.d.ts +2 -0
- package/dist/release/namespace.js +6 -0
- package/dist/release/target.d.ts +2 -0
- package/dist/release/target.js +9 -0
- package/dist/worker/entry.d.ts +39 -0
- package/dist/worker/entry.js +162 -0
- package/dist/worker/fetch.d.ts +11 -0
- package/dist/worker/fetch.js +31 -0
- package/dist/worker/gateway.d.ts +15 -0
- package/dist/worker/gateway.js +26 -0
- package/dist/worker/identity.d.ts +7 -0
- package/dist/worker/identity.js +23 -0
- package/dist/worker/index.d.ts +3 -59
- package/dist/worker/index.js +3 -209
- package/package.json +21 -18
- package/template/astrale.config.ts +19 -11
- package/dist/build/codegen/identity.d.ts +0 -10
- package/dist/build/codegen/identity.d.ts.map +0 -1
- package/dist/build/codegen/identity.js +0 -32
- package/dist/build/codegen/identity.js.map +0 -1
- package/dist/build/codegen/merge.d.ts.map +0 -1
- package/dist/build/codegen/merge.js.map +0 -1
- package/dist/build/codegen/worker.d.ts +0 -12
- package/dist/build/codegen/worker.d.ts.map +0 -1
- package/dist/build/codegen/worker.js +0 -40
- package/dist/build/codegen/worker.js.map +0 -1
- package/dist/build/codegen/wrangler.d.ts.map +0 -1
- package/dist/build/codegen/wrangler.js.map +0 -1
- package/dist/build/frontend.d.ts +0 -26
- package/dist/build/frontend.d.ts.map +0 -1
- package/dist/build/frontend.js +0 -263
- package/dist/build/frontend.js.map +0 -1
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js.map +0 -1
- package/dist/build/parse-output.d.ts.map +0 -1
- package/dist/build/parse-output.js.map +0 -1
- package/dist/build/prepare.d.ts +0 -18
- package/dist/build/prepare.d.ts.map +0 -1
- package/dist/build/prepare.js +0 -117
- package/dist/build/prepare.js.map +0 -1
- package/dist/build/worker.d.ts +0 -15
- package/dist/build/worker.d.ts.map +0 -1
- package/dist/build/worker.js +0 -21
- package/dist/build/worker.js.map +0 -1
- package/dist/build/wrangler-cli.d.ts.map +0 -1
- package/dist/build/wrangler-cli.js.map +0 -1
- package/dist/cloudflare.d.ts.map +0 -1
- package/dist/cloudflare.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/params.d.ts.map +0 -1
- package/dist/params.js.map +0 -1
- package/dist/worker/index.d.ts.map +0 -1
- package/dist/worker/index.js.map +0 -1
- package/src/build/codegen/identity.ts +0 -40
- package/src/build/codegen/merge.ts +0 -92
- package/src/build/codegen/worker.ts +0 -53
- package/src/build/codegen/wrangler.ts +0 -127
- package/src/build/frontend.ts +0 -324
- package/src/build/index.ts +0 -29
- package/src/build/parse-output.ts +0 -60
- package/src/build/prepare.ts +0 -161
- package/src/build/worker.ts +0 -37
- package/src/build/wrangler-cli.ts +0 -362
- package/src/cloudflare.ts +0 -251
- package/src/index.ts +0 -21
- package/src/params.ts +0 -92
- package/src/worker/index.ts +0 -314
- package/src/worker/tsconfig.json +0 -10
package/dist/worker/index.js
CHANGED
|
@@ -1,209 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const MAXIMUM_CACHED_APPLICATIONS = 4;
|
|
5
|
-
const APPLICATION_CLOSE_TIMEOUT_MS = 5_000;
|
|
6
|
-
/**
|
|
7
|
-
* Compose one Cloudflare module Worker without request-global mutation.
|
|
8
|
-
* Environment bindings are captured once per immutable serving URL/version generation.
|
|
9
|
-
*/
|
|
10
|
-
export function cloudflareWorkerEntry() {
|
|
11
|
-
return function (config) {
|
|
12
|
-
const applications = new Map();
|
|
13
|
-
let resolvedDefinition = config.definition;
|
|
14
|
-
let pendingDefinition;
|
|
15
|
-
const definitionFor = async (bindings) => {
|
|
16
|
-
if (resolvedDefinition !== undefined)
|
|
17
|
-
return resolvedDefinition;
|
|
18
|
-
if (pendingDefinition !== undefined)
|
|
19
|
-
return pendingDefinition;
|
|
20
|
-
const resolve = config.resolveDefinition;
|
|
21
|
-
if (resolve === undefined)
|
|
22
|
-
throw new TypeError('Cloudflare Worker Domain definition is unavailable.');
|
|
23
|
-
const current = Promise.resolve().then(() => resolve(bindings));
|
|
24
|
-
pendingDefinition = current;
|
|
25
|
-
try {
|
|
26
|
-
const definition = await current;
|
|
27
|
-
resolvedDefinition = definition;
|
|
28
|
-
return definition;
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
if (pendingDefinition === current)
|
|
32
|
-
pendingDefinition = undefined;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const applicationFor = async (url, bindings, definition) => {
|
|
36
|
-
const version = deploymentVersion(bindings);
|
|
37
|
-
const key = `${url}\u0000${version}`;
|
|
38
|
-
const cached = applications.get(key);
|
|
39
|
-
if (cached !== undefined)
|
|
40
|
-
return cached;
|
|
41
|
-
const environment = config.resolveEnvironment === undefined
|
|
42
|
-
? bindings
|
|
43
|
-
: await config.resolveEnvironment(bindings);
|
|
44
|
-
const routedFetch = async (input, init) => {
|
|
45
|
-
const request = new Request(input, init);
|
|
46
|
-
const destination = new URL(request.url);
|
|
47
|
-
if (destination.origin === new URL(url).origin) {
|
|
48
|
-
const self = config.selfBinding?.(bindings);
|
|
49
|
-
if (self !== null && self !== undefined)
|
|
50
|
-
return self.fetch(request);
|
|
51
|
-
return serving.app.fetch(request, environment);
|
|
52
|
-
}
|
|
53
|
-
const route = config.routeSubrequest?.(destination, bindings);
|
|
54
|
-
return route === null || route === undefined ? fetch(request) : route.fetch(request);
|
|
55
|
-
};
|
|
56
|
-
const deploymentQuery = `deployment=${encodeURIComponent(version)}`;
|
|
57
|
-
const issuerId = issuer.accept(url);
|
|
58
|
-
const host = new HonoApplication();
|
|
59
|
-
host.get('/meta', (context) => context.json({
|
|
60
|
-
origin: definition.schema.origin,
|
|
61
|
-
issuer: issuerId,
|
|
62
|
-
schemaRevision: definition.domain.$.revision,
|
|
63
|
-
deploymentVersion: version,
|
|
64
|
-
}));
|
|
65
|
-
const serving = createRemoteApplication({
|
|
66
|
-
definition,
|
|
67
|
-
environment,
|
|
68
|
-
identity: {
|
|
69
|
-
issuer: issuerId,
|
|
70
|
-
subject: definition.schema.origin,
|
|
71
|
-
privateKey: typeof config.privateKey === 'function'
|
|
72
|
-
? config.privateKey(bindings)
|
|
73
|
-
: config.privateKey,
|
|
74
|
-
fetch: routedFetch,
|
|
75
|
-
...(new URL(url).protocol === 'http:' ? { allowInsecureHttp: true } : {}),
|
|
76
|
-
},
|
|
77
|
-
deployment: {
|
|
78
|
-
bundleHref: `${url}/.well-known/astrale/domain.bundle.json?${deploymentQuery}`,
|
|
79
|
-
endpoint: { http: `${url}/invoke` },
|
|
80
|
-
...(definition.frontend === undefined
|
|
81
|
-
? {}
|
|
82
|
-
: { frontendBaseHref: url, frontendCacheKey: version }),
|
|
83
|
-
...(config.manifest === undefined ? {} : { manifest: config.manifest }),
|
|
84
|
-
installation: {
|
|
85
|
-
href: `${url}/install`,
|
|
86
|
-
method: 'POST',
|
|
87
|
-
authentication: { kind: 'public' },
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
app: host,
|
|
91
|
-
server: {
|
|
92
|
-
path: '/invoke',
|
|
93
|
-
health: { probe: { check: () => true } },
|
|
94
|
-
limits: {
|
|
95
|
-
maximumRequestBytes: 1024 * 1024,
|
|
96
|
-
maximumPublicationBytes: 1024 * 1024,
|
|
97
|
-
maximumBundleBytes: 8 * 1024 * 1024,
|
|
98
|
-
maximumInstallationBytes: 8 * 1024 * 1024,
|
|
99
|
-
invocationTimeoutMs: 30_000,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
const created = Object.freeze({
|
|
104
|
-
origin: new URL(url).origin,
|
|
105
|
-
application: serving,
|
|
106
|
-
environment,
|
|
107
|
-
});
|
|
108
|
-
if (applications.size >= MAXIMUM_CACHED_APPLICATIONS) {
|
|
109
|
-
const oldest = applications.keys().next().value;
|
|
110
|
-
if (oldest !== undefined) {
|
|
111
|
-
const evicted = applications.get(oldest);
|
|
112
|
-
applications.delete(oldest);
|
|
113
|
-
if (evicted !== undefined) {
|
|
114
|
-
try {
|
|
115
|
-
await closeEvictedApplication(evicted.application);
|
|
116
|
-
}
|
|
117
|
-
catch (cause) {
|
|
118
|
-
await serving
|
|
119
|
-
.close({ deadline: Date.now() + APPLICATION_CLOSE_TIMEOUT_MS })
|
|
120
|
-
.catch(() => undefined);
|
|
121
|
-
throw cause;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
applications.set(key, created);
|
|
127
|
-
return created;
|
|
128
|
-
};
|
|
129
|
-
return Object.freeze({
|
|
130
|
-
async fetch(request, bindings, executionContext) {
|
|
131
|
-
const requestUrl = new URL(request.url);
|
|
132
|
-
const definition = await definitionFor(bindings);
|
|
133
|
-
if (definition.frontend !== undefined) {
|
|
134
|
-
const asset = await frontendAsset(definition, bindings, requestUrl, request);
|
|
135
|
-
if (asset !== undefined)
|
|
136
|
-
return asset;
|
|
137
|
-
}
|
|
138
|
-
const publicUrl = canonicalServingUrl(config.resolveUrl?.(bindings, requestOrigin(requestUrl, request)) ??
|
|
139
|
-
bindings.WORKER_URL ??
|
|
140
|
-
requestOrigin(requestUrl, request));
|
|
141
|
-
const serving = await applicationFor(publicUrl, bindings, definition);
|
|
142
|
-
return serving.application.app.fetch(request, serving.environment, executionContext);
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
/** Close an evicted Application before its environment bindings leave the cache. */
|
|
148
|
-
export function closeEvictedApplication(application, now = Date.now) {
|
|
149
|
-
return application.close({ deadline: now() + APPLICATION_CLOSE_TIMEOUT_MS });
|
|
150
|
-
}
|
|
151
|
-
async function frontendAsset(definition, environment, url, request) {
|
|
152
|
-
const frontend = definition.frontend;
|
|
153
|
-
if (frontend === undefined || frontend.source.kind === 'external')
|
|
154
|
-
return undefined;
|
|
155
|
-
const routes = frontend.routes;
|
|
156
|
-
const route = Object.values(routes).find((candidate) => candidate.path === url.pathname);
|
|
157
|
-
const staticAsset = url.pathname.startsWith('/assets/');
|
|
158
|
-
if (route === undefined && !staticAsset)
|
|
159
|
-
return undefined;
|
|
160
|
-
if (request.method !== 'GET' && request.method !== 'HEAD')
|
|
161
|
-
return undefined;
|
|
162
|
-
const binding = environment.ASSETS;
|
|
163
|
-
if (binding === undefined)
|
|
164
|
-
return undefined;
|
|
165
|
-
const dev = environment.FRONTEND_DEV_URL?.replace(/\/+$/u, '');
|
|
166
|
-
if (dev !== undefined && dev.length > 0) {
|
|
167
|
-
return fetch(new Request(`${dev}${url.pathname}${url.search}`, request));
|
|
168
|
-
}
|
|
169
|
-
const path = route === undefined ? `${url.pathname}${url.search}` : `/${route.document}${url.search}`;
|
|
170
|
-
return binding.fetch(new Request(new URL(path, url.origin), request));
|
|
171
|
-
}
|
|
172
|
-
function requestOrigin(url, request) {
|
|
173
|
-
if (url.protocol !== 'http:')
|
|
174
|
-
return url.origin;
|
|
175
|
-
const forwarded = request.headers.get('x-forwarded-proto')?.split(',')[0]?.trim().toLowerCase();
|
|
176
|
-
return forwarded === 'https' ? `https://${url.host}` : url.origin;
|
|
177
|
-
}
|
|
178
|
-
function canonicalServingUrl(input) {
|
|
179
|
-
let url;
|
|
180
|
-
try {
|
|
181
|
-
url = new URL(input);
|
|
182
|
-
}
|
|
183
|
-
catch (cause) {
|
|
184
|
-
throw new TypeError('Cloudflare Worker serving URL is invalid.', { cause });
|
|
185
|
-
}
|
|
186
|
-
if ((url.protocol !== 'https:' && url.protocol !== 'http:') ||
|
|
187
|
-
url.username !== '' ||
|
|
188
|
-
url.password !== '' ||
|
|
189
|
-
url.pathname !== '/' ||
|
|
190
|
-
url.search !== '' ||
|
|
191
|
-
url.hash !== '') {
|
|
192
|
-
throw new TypeError('Cloudflare Worker serving URL must be one HTTP(S) origin.');
|
|
193
|
-
}
|
|
194
|
-
return url.origin;
|
|
195
|
-
}
|
|
196
|
-
function deploymentVersion(environment) {
|
|
197
|
-
const input = environment.ASTRALE_VERSION_METADATA;
|
|
198
|
-
if (input !== null &&
|
|
199
|
-
typeof input === 'object' &&
|
|
200
|
-
typeof input.id === 'string' &&
|
|
201
|
-
input.id.length > 0) {
|
|
202
|
-
return input.id;
|
|
203
|
-
}
|
|
204
|
-
const fallback = environment.ASTRALE_DEPLOYMENT_VERSION;
|
|
205
|
-
if (typeof fallback === 'string' && fallback.length > 0)
|
|
206
|
-
return fallback;
|
|
207
|
-
throw new TypeError('Cloudflare Worker deployment version is unavailable.');
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './entry.js';
|
|
2
|
+
export { decodeSigningIdentity, runtimeBindings } from './identity.js';
|
|
3
|
+
export * from './gateway.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/adapter-cloudflare",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
4
|
-
"description": "Deploy an Astrale
|
|
3
|
+
"version": "0.5.0-beta.41",
|
|
4
|
+
"description": "Deploy an Astrale application through Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
7
7
|
"astrale",
|
|
@@ -11,16 +11,21 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"author": "Astrale",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/astrale-os/sdk.git"
|
|
17
|
+
},
|
|
14
18
|
"files": [
|
|
15
19
|
"dist",
|
|
16
|
-
"
|
|
20
|
+
"!dist/**/*.map",
|
|
17
21
|
"template",
|
|
18
|
-
"!template
|
|
19
|
-
"!template
|
|
22
|
+
"!template/**/node_modules",
|
|
23
|
+
"!template/**/node_modules/**",
|
|
24
|
+
"!template/**/pnpm-lock.yaml"
|
|
20
25
|
],
|
|
21
26
|
"type": "module",
|
|
22
|
-
"main": "./
|
|
23
|
-
"types": "./
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
24
29
|
"exports": {
|
|
25
30
|
".": {
|
|
26
31
|
"types": "./dist/index.d.ts",
|
|
@@ -37,31 +42,29 @@
|
|
|
37
42
|
"./package.json": "./package.json"
|
|
38
43
|
},
|
|
39
44
|
"dependencies": {
|
|
40
|
-
"@astrale-os/kernel-core": "0.9.0-beta.1",
|
|
41
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.1",
|
|
42
45
|
"hono": "^4.6.20",
|
|
43
46
|
"jose": "^6.1.3",
|
|
44
|
-
"
|
|
47
|
+
"wrangler": "4.123.0",
|
|
48
|
+
"@astrale-os/sdk": "^0.5.0-beta.38"
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|
|
47
51
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|
|
48
52
|
"@types/node": "^22.0.0",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"wrangler": "4.121.0"
|
|
53
|
+
"oxfmt": "0.63.0",
|
|
54
|
+
"oxlint": "1.78.0",
|
|
55
|
+
"typescript": "7.0.2",
|
|
56
|
+
"vitest": "^4.1.10",
|
|
57
|
+
"zod": "^4.4.3"
|
|
55
58
|
},
|
|
56
59
|
"engines": {
|
|
57
60
|
"node": ">=22"
|
|
58
61
|
},
|
|
59
62
|
"scripts": {
|
|
60
|
-
"typecheck": "
|
|
63
|
+
"typecheck": "tsc --noEmit",
|
|
61
64
|
"test": "vitest run",
|
|
62
65
|
"lint": "oxlint --disable-nested-config .",
|
|
63
66
|
"format": "pnpm exec oxfmt --write .",
|
|
64
67
|
"format:check": "pnpm exec oxfmt --check .",
|
|
65
|
-
"build": "rm -rf dist &&
|
|
68
|
+
"build": "rm -rf dist && tsc && node ../scripts/verify-no-source-maps.mjs dist"
|
|
66
69
|
}
|
|
67
70
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* astrale.config.ts — binds the
|
|
2
|
+
* astrale.config.ts — binds the authored Application and independently importable Runtime to its
|
|
3
|
+
* deploy
|
|
3
4
|
* adapter for the `astrale-domain` CLI. This is a NODE-only module: it imports
|
|
4
5
|
* the adapter (wrangler + filesystem). The generated worker never imports this
|
|
5
|
-
* file — it imports `
|
|
6
|
+
* file — it imports `runtime.ts` directly — so the adapter stays out of the bundle.
|
|
6
7
|
*
|
|
7
8
|
* This variant deploys to YOUR OWN Cloudflare account (the `cloudflare` adapter).
|
|
8
9
|
*
|
|
@@ -11,27 +12,34 @@
|
|
|
11
12
|
* pnpm prod # deploy to your Cloudflare account
|
|
12
13
|
*/
|
|
13
14
|
import { cloudflare } from '@astrale-os/adapter-cloudflare'
|
|
14
|
-
import { deploy } from '@astrale-os/sdk'
|
|
15
|
+
import { deploy, runtime } from '@astrale-os/sdk/deployment'
|
|
15
16
|
// No Cloudflare account? Swap the adapter for the Astrale-managed one — it
|
|
16
17
|
// publishes the same bundle THROUGH the platform and installs it on your
|
|
17
18
|
// instance (auth = your `astrale auth login` session):
|
|
18
19
|
//
|
|
19
20
|
// import { astrale } from '@astrale-os/adapter-astrale'
|
|
20
|
-
// export default deploy(
|
|
21
|
+
// export default deploy({ application, entrypoint: runtime('./runtime.ts'), adapter: astrale({
|
|
21
22
|
// dev: { secrets: '.env.dev' }, // local wrangler dev
|
|
22
23
|
// prod: { instance: '<your-instance-slug>' }, // managed deploy
|
|
23
|
-
// }))
|
|
24
|
+
// }) })
|
|
24
25
|
|
|
25
|
-
import {
|
|
26
|
+
import { application } from './application.js'
|
|
26
27
|
|
|
27
|
-
export default deploy(
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
export default deploy({
|
|
29
|
+
application,
|
|
30
|
+
entrypoint: runtime('./runtime.ts'),
|
|
31
|
+
adapter: cloudflare({
|
|
30
32
|
// Local dev: `wrangler dev`. No route → URL is http://localhost:8787.
|
|
31
33
|
dev: { secrets: '.env.dev' },
|
|
32
34
|
// Custom-domain prod. Drop `route` to ship to *.workers.dev instead.
|
|
33
|
-
|
|
35
|
+
// The scaffold creates this identity once. Retain it in managed secret
|
|
36
|
+
// storage and restore it at this path in CI before every remote deploy.
|
|
37
|
+
prod: {
|
|
38
|
+
route: 'astrale-domain.example.dev',
|
|
39
|
+
secrets: '.env.prod',
|
|
40
|
+
signingIdentity: '.astrale/identity.json',
|
|
41
|
+
},
|
|
34
42
|
// Author secrets ship via `secrets: '.env.prod'` on any env. Extra bindings
|
|
35
43
|
// (KV, R2, D1, queues, …) ride a `wrangler` block on any env (deep-merged).
|
|
36
44
|
}),
|
|
37
|
-
)
|
|
45
|
+
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensure the domain has a stable Ed25519 signing identity at
|
|
3
|
-
* `.astrale/identity.ts`. Generated ONCE (first `dev`/`deploy` or by the
|
|
4
|
-
* scaffolder) and never regenerated — the private key IS the domain's identity,
|
|
5
|
-
* so rotating it would orphan every instance that installed the old key. The
|
|
6
|
-
* file is gitignored; for real production this key should graduate to a managed
|
|
7
|
-
* secret.
|
|
8
|
-
*/
|
|
9
|
-
export declare function ensureIdentity(astraleDir: string, origin: string): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/build/codegen/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBtF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensure the domain has a stable Ed25519 signing identity at
|
|
3
|
-
* `.astrale/identity.ts`. Generated ONCE (first `dev`/`deploy` or by the
|
|
4
|
-
* scaffolder) and never regenerated — the private key IS the domain's identity,
|
|
5
|
-
* so rotating it would orphan every instance that installed the old key. The
|
|
6
|
-
* file is gitignored; for real production this key should graduate to a managed
|
|
7
|
-
* secret.
|
|
8
|
-
*/
|
|
9
|
-
import { exportJWK, generateKeyPair } from 'jose';
|
|
10
|
-
import { existsSync } from 'node:fs';
|
|
11
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
12
|
-
import { join } from 'node:path';
|
|
13
|
-
export async function ensureIdentity(astraleDir, origin) {
|
|
14
|
-
const file = join(astraleDir, 'identity.ts');
|
|
15
|
-
if (existsSync(file))
|
|
16
|
-
return;
|
|
17
|
-
const { privateKey } = await generateKeyPair('EdDSA', { extractable: true });
|
|
18
|
-
const jwk = (await exportJWK(privateKey));
|
|
19
|
-
jwk.alg = 'EdDSA';
|
|
20
|
-
jwk.kid = `${origin}-key`;
|
|
21
|
-
await mkdir(astraleDir, { recursive: true });
|
|
22
|
-
await writeFile(file, `// AUTO-GENERATED stable signing identity for "${origin}" — do not edit, do not commit.\n` +
|
|
23
|
-
`export const PRIVATE_JWK = ${JSON.stringify(jwk, null, 2)} as const\n`);
|
|
24
|
-
// Loud on purpose: the file is gitignored, so a fresh clone / CI runner
|
|
25
|
-
// silently mints a NEW key — and a redeploy with a new key breaks JWKS
|
|
26
|
-
// verification on every instance that installed the old one, with no hint
|
|
27
|
-
// why. Make the lifecycle visible the one time it happens.
|
|
28
|
-
process.stderr.write(`\x1b[33m!\x1b[0m new signing identity generated at .astrale/identity.ts (kid ${String(jwk.kid)}).\n` +
|
|
29
|
-
` This key IS "${origin}"'s identity: back it up (or move it to a managed secret) —\n` +
|
|
30
|
-
` deploying from another machine without it re-keys the domain and breaks existing installs.\n`);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/build/codegen/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAkB,EAAE,MAAc;IACrE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAA;IAC5C,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,OAAM;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5E,MAAM,GAAG,GAAG,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,CAA4B,CAAA;IACpE,GAAG,CAAC,GAAG,GAAG,OAAO,CAAA;IACjB,GAAG,CAAC,GAAG,GAAG,GAAG,MAAM,MAAM,CAAA;IAEzB,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5C,MAAM,SAAS,CACb,IAAI,EACJ,kDAAkD,MAAM,mCAAmC;QACzF,8BAA8B,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAC1E,CAAA;IAED,wEAAwE;IACxE,uEAAuE;IACvE,0EAA0E;IAC1E,2DAA2D;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gFAAgF,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM;QACnG,kBAAkB,MAAM,+DAA+D;QACvF,gGAAgG,CACnG,CAAA;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/build/codegen/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/build/codegen/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAC7B,IAA6B,EAC7B,OAAgC;IAEhC,MAAM,GAAG,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAA;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;QACrB,IAAI,aAAa,CAAC,I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GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAa;IAChC,MAAM,GAAG,GAAG,IAA+B,CAAA;IAC3C,KAAK,MAAM,KAAK,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;QAC5D,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,QAAQ;YAAE,OAAO,GAAG,KAAK,IAAI,GAAG,CAAC,KAAK,CAAW,EAAE,CAAA;IAC/E,CAAC;IACD,IAAI,CAAC;QACH,OAAO,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,WAAW,CAAC,CAAU;IAC7B,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,UAAU,CAAC,CAAA;AACzE,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** Codegen for the Cloudflare module entry owned by the adapter. */
|
|
2
|
-
export interface WorkerCodegenOptions {
|
|
3
|
-
readonly origin: string;
|
|
4
|
-
/** Optional same-zone routing service selected by the adapter environment. */
|
|
5
|
-
readonly router?: {
|
|
6
|
-
readonly binding: string;
|
|
7
|
-
readonly hostSuffix: string;
|
|
8
|
-
readonly minLabels: number;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare function generateWorkerEntry(options: WorkerCodegenOptions): string;
|
|
12
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/build/codegen/worker.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAC3B,CAAA;CACF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAwCzE"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/** Codegen for the Cloudflare module entry owned by the adapter. */
|
|
2
|
-
export function generateWorkerEntry(options) {
|
|
3
|
-
const router = options.router;
|
|
4
|
-
const routerPredicate = router === undefined
|
|
5
|
-
? ''
|
|
6
|
-
: `
|
|
7
|
-
function isInstanceHost(host: string): boolean {
|
|
8
|
-
return host.endsWith('${router.hostSuffix}') && host.split('.').length >= ${router.minLabels}
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
const routeSubrequest = router === undefined
|
|
12
|
-
? ''
|
|
13
|
-
: `
|
|
14
|
-
routeSubrequest: (url, env) => {
|
|
15
|
-
const labels = url.hostname.split('.')
|
|
16
|
-
if (env.DISPATCHER && labels[1] === 'svc') return env.DISPATCHER.get(labels[0]!)
|
|
17
|
-
if (env.${router.binding} && isInstanceHost(url.hostname)) return env.${router.binding}
|
|
18
|
-
return null
|
|
19
|
-
},`;
|
|
20
|
-
return `// AUTO-GENERATED by @astrale-os/adapter-cloudflare — do not edit.
|
|
21
|
-
// Regenerated by every Astrale Domain build, dev, and deploy operation.
|
|
22
|
-
// Domain origin: ${options.origin}
|
|
23
|
-
import type { CloudflareAdapterBindings } from '@astrale-os/adapter-cloudflare/worker'
|
|
24
|
-
import type { ApplicationEnvironment } from '../implementation.js'
|
|
25
|
-
|
|
26
|
-
import { cloudflareWorkerEntry } from '@astrale-os/adapter-cloudflare/worker'
|
|
27
|
-
import { domain } from '../implementation.js'
|
|
28
|
-
import { PRIVATE_JWK } from './identity.js'
|
|
29
|
-
|
|
30
|
-
type WorkerEnv = CloudflareEnv & ApplicationEnvironment & CloudflareAdapterBindings
|
|
31
|
-
${routerPredicate}
|
|
32
|
-
export default cloudflareWorkerEntry<WorkerEnv>()({
|
|
33
|
-
definition: domain,
|
|
34
|
-
privateKey: PRIVATE_JWK,
|
|
35
|
-
resolveUrl: (env, requestOrigin) => env.WORKER_URL ?? requestOrigin,
|
|
36
|
-
selfBinding: (env) => env.SELF,${routeSubrequest}
|
|
37
|
-
})
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/build/codegen/worker.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAYpE,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC7B,MAAM,eAAe,GACnB,MAAM,KAAK,SAAS;QAClB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;;0BAEkB,MAAM,CAAC,UAAU,mCAAmC,MAAM,CAAC,SAAS;;CAE7F,CAAA;IACC,MAAM,eAAe,GACnB,MAAM,KAAK,SAAS;QAClB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;;;;cAIM,MAAM,CAAC,OAAO,gDAAgD,MAAM,CAAC,OAAO;;KAErF,CAAA;IAEH,OAAO;;oBAEW,OAAO,CAAC,MAAM;;;;;;;;;EAShC,eAAe;;;;;mCAKkB,eAAe;;CAEjD,CAAA;AACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrangler.d.ts","sourceRoot":"","sources":["../../../src/build/codegen/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KACnC,CAAA;IACD,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAKD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAgD3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrangler.js","sourceRoot":"","sources":["../../../src/build/codegen/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA+B5C,sEAAsE;AACtE,MAAM,kBAAkB,GAAG,YAAY,CAAA;AAEvC,MAAM,UAAU,sBAAsB,CAAC,IAA4B;IACjE,MAAM,MAAM,GAA4B;QACtC,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,IAAI,EAAE,iBAAiB;QACv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IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACzB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAC9E,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAA;AAC/C,CAAC;AAED,qEAAqE;AACrE,MAAM,kBAAkB,GAAG;IACzB,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,oBAAoB;IACpB,kBAAkB;CACnB,CAAA;AAED;;;;GAIG;AACH,SAAS,eAAe,CACtB,IAA6B,EAC7B,IAA6B;IAE7B,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;IAC9D,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,qDAAqD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC5E,gEAAgE;YAChE,mDAAmD,CACtD,CAAA;IACH,CAAC;IACD,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC"}
|
package/dist/build/frontend.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { CompiledFrontendArtifact, DomainDefinition } from '@astrale-os/sdk';
|
|
2
|
-
export declare const FRONTEND_STAGE_DIR = ".astrale/frontend";
|
|
3
|
-
/** Materialize one Domain-owned frontend recipe into an immutable adapter artifact. */
|
|
4
|
-
export declare function buildFrontend(input: {
|
|
5
|
-
readonly definition: DomainDefinition;
|
|
6
|
-
readonly projectDir: string;
|
|
7
|
-
readonly onLog?: (line: string) => void;
|
|
8
|
-
}): Promise<CompiledFrontendArtifact | undefined>;
|
|
9
|
-
export interface FrontendWatchHandle {
|
|
10
|
-
stop(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export interface FrontendWatchSubscription {
|
|
13
|
-
close(): void;
|
|
14
|
-
}
|
|
15
|
-
export type FrontendWatchSubscribe = (root: string, onChange: (path?: string) => void, onError: (error: Error) => void) => FrontendWatchSubscription;
|
|
16
|
-
/** Keep Wrangler's materialized frontend stage current without owning config regeneration. */
|
|
17
|
-
export declare function watchFrontend(input: {
|
|
18
|
-
readonly definition: DomainDefinition;
|
|
19
|
-
readonly projectDir: string;
|
|
20
|
-
readonly onLog?: (line: string) => void;
|
|
21
|
-
readonly onRebuild?: () => void;
|
|
22
|
-
readonly delayMs?: number;
|
|
23
|
-
readonly build?: typeof buildFrontend;
|
|
24
|
-
readonly subscribe?: FrontendWatchSubscribe;
|
|
25
|
-
}): FrontendWatchHandle | undefined;
|
|
26
|
-
//# sourceMappingURL=frontend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../src/build/frontend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAgB,MAAM,iBAAiB,CAAA;AAU/F,eAAO,MAAM,kBAAkB,sBAAsB,CAAA;AAKrD,uFAAuF;AACvF,wBAAsB,aAAa,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAgBhD;AAgED,MAAM,WAAW,mBAAmB;IAClC,IAAI,IAA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