anhedral 0.11.0 → 0.11.1
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 +73 -157
- package/assets/patches/LICENSE.braces +21 -0
- package/assets/patches/LICENSE.node-forge +50 -0
- package/assets/patches/audit-deps.mjs +167 -0
- package/assets/patches/braces@3.0.3.patch +127 -0
- package/assets/patches/node-forge@1.4.0.patch +41 -0
- package/dist/auth-schema.js +3 -3
- package/dist/bin.js +15 -11
- package/dist/capabilities.d.ts +4 -4
- package/dist/capabilities.js +6 -2
- package/dist/capability-contract.js +22 -5
- package/dist/catalog-model.d.ts +24 -0
- package/dist/catalog-model.js +1 -0
- package/dist/catalog-registration.d.ts +16 -0
- package/dist/catalog-registration.js +22 -0
- package/dist/catalog-snapshot.d.ts +5 -0
- package/dist/catalog-snapshot.js +97 -0
- package/dist/cli-arguments.js +1 -1
- package/dist/cli-output.js +27 -2
- package/dist/cloudflare.d.ts +7 -1
- package/dist/cloudflare.js +36 -6
- package/dist/command-schema.js +49 -5
- package/dist/delivery.d.ts +10 -3
- package/dist/delivery.js +154 -37
- package/dist/dependencies.d.ts +24 -0
- package/dist/dependencies.js +48 -0
- package/dist/dependency-patches.d.ts +7 -0
- package/dist/dependency-patches.js +125 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/inspector-model.d.ts +9 -1
- package/dist/integration-service-readers.d.ts +13 -0
- package/dist/integration-service-readers.js +173 -0
- package/dist/lifecycle.d.ts +0 -1
- package/dist/lifecycle.js +0 -1
- package/dist/neon-service-data.d.ts +8 -0
- package/dist/neon-service-data.js +117 -0
- package/dist/pnpm-policy.d.ts +2 -2
- package/dist/pnpm-policy.js +19 -45
- package/dist/project-catalog.d.ts +41 -0
- package/dist/project-catalog.js +288 -0
- package/dist/project-config.d.ts +14 -0
- package/dist/project-config.js +89 -0
- package/dist/project-inspector.js +73 -17
- package/dist/project-lifecycle.d.ts +25 -0
- package/dist/project-lifecycle.js +57 -0
- package/dist/project-state.d.ts +5 -1
- package/dist/project-state.js +122 -16
- package/dist/provider-auth.js +2 -3
- package/dist/provider-readiness.js +27 -10
- package/dist/providers/adapters.js +4 -1
- package/dist/providers/api.d.ts +1 -0
- package/dist/providers/api.js +1 -0
- package/dist/providers/config.js +6 -8
- package/dist/providers/provision.js +1 -1
- package/dist/providers/recovery.d.ts +1 -1
- package/dist/providers/runtime.d.ts +1 -1
- package/dist/providers/runtime.js +46 -23
- package/dist/providers/state.d.ts +1 -2
- package/dist/providers/state.js +14 -54
- package/dist/provision.d.ts +9 -0
- package/dist/provision.js +30 -1
- package/dist/r2-service-data.d.ts +2 -0
- package/dist/r2-service-data.js +136 -0
- package/dist/readiness.js +9 -13
- package/dist/registry/add.js +64 -21
- package/dist/registry/commands.js +7 -9
- package/dist/registry/options.d.ts +1 -1
- package/dist/registry/options.js +4 -4
- package/dist/registry/receipt.d.ts +1 -0
- package/dist/registry/receipt.js +19 -4
- package/dist/registry/resolve.js +5 -1
- package/dist/registry/usage.js +1 -5
- package/dist/render.d.ts +2 -0
- package/dist/render.js +6 -0
- package/dist/runtime-policy.d.ts +4 -0
- package/dist/runtime-policy.js +21 -0
- package/dist/scaffold/bootstrap.js +2 -2
- package/dist/scaffold/compose.js +9 -3
- package/dist/scaffold/database.js +107 -25
- package/dist/scaffold/documentation.js +18 -13
- package/dist/scaffold/lint.d.ts +4 -0
- package/dist/scaffold/lint.js +56 -0
- package/dist/scaffold/neon-realtime.d.ts +2 -0
- package/dist/scaffold/neon-realtime.js +97 -0
- package/dist/scaffold/stack-documentation.js +1 -1
- package/dist/scaffold/void.d.ts +4 -0
- package/dist/scaffold/void.js +256 -0
- package/dist/scaffold/web.js +7 -1
- package/dist/scaffold/workspace.js +120 -29
- package/dist/service-deletion.d.ts +29 -0
- package/dist/service-deletion.js +195 -0
- package/dist/service-descriptor.d.ts +10 -0
- package/dist/service-descriptor.js +78 -0
- package/dist/service-model.d.ts +49 -0
- package/dist/service-model.js +8 -0
- package/dist/service-operations.d.ts +29 -0
- package/dist/service-operations.js +78 -0
- package/dist/service-readers.d.ts +8 -0
- package/dist/service-readers.js +247 -0
- package/dist/services-command.d.ts +39 -0
- package/dist/services-command.js +100 -0
- package/dist/ship.d.ts +36 -8
- package/dist/ship.js +39 -13
- package/dist/stack-registry.d.ts +4 -2
- package/dist/stack-registry.js +41 -11
- package/dist/standard.js +23 -4
- package/dist/transaction.d.ts +2 -0
- package/dist/transaction.js +10 -0
- package/dist/util.js +17 -2
- package/dist/vercel.d.ts +2 -0
- package/dist/vercel.js +69 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/vinext.d.ts +1 -0
- package/dist/vinext.js +13 -1
- package/dist/void-execution.d.ts +10 -0
- package/dist/void-execution.js +94 -0
- package/dist/void-migrations.d.ts +6 -0
- package/dist/void-migrations.js +110 -0
- package/dist/void-state.d.ts +16 -0
- package/dist/void-state.js +65 -0
- package/dist/void.d.ts +3 -0
- package/dist/void.js +5 -0
- package/docs/cli-design.md +2 -2
- package/docs/delivery-workflow.md +8 -7
- package/docs/plugin-ui.md +51 -10
- package/docs/provider-configuration.md +10 -11
- package/docs/stack-standard.md +175 -0
- package/docs/void-verification.md +185 -0
- package/package.json +22 -20
- package/assets/anhedral-mark.svg +0 -4
- package/assets/anhedral-stack-technical.svg +0 -322
- package/assets/anhedral-stack.svg +0 -322
- package/assets/anhedral.svg +0 -4
- package/assets/favicon.ico +0 -0
- package/assets/security/LICENSES.txt +0 -63
- package/assets/security/audit-deps.mjs +0 -300
- package/assets/security/braces-regression.mjs +0 -102
- package/assets/security/braces@3.0.3.patch +0 -285
- package/assets/security/decode-uri-component@0.2.2.patch +0 -149
- package/assets/security/decoder-regression.mjs +0 -37
- package/assets/security/forge-regression.mjs +0 -46
- package/assets/security/manifest.json +0 -53
- package/assets/security/node-forge@1.4.0.patch +0 -26
- package/dist/security-backports.d.ts +0 -3
- package/dist/security-backports.js +0 -26
- package/docs/application-stack-standard.md +0 -75
package/dist/ship.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasProjectSection } from './project-config.js';
|
|
2
|
+
import { realpathSync, writeFileSync, rmSync } from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { tmpdir } from 'node:os';
|
|
4
5
|
import { randomUUID } from 'node:crypto';
|
|
@@ -6,23 +7,29 @@ import { defaultRunner } from './project-state.js';
|
|
|
6
7
|
import { withLifecycleOperation } from './lifecycle.js';
|
|
7
8
|
import { planDelivery, shipApplication } from './delivery.js';
|
|
8
9
|
import { planProvisioning, provisionApplication } from './provision.js';
|
|
10
|
+
import { syncVoidSecrets, voidServerSecrets } from './void-execution.js';
|
|
9
11
|
import { planProviderProvisioning, provisionSelectedProviders } from './providers/provision.js';
|
|
10
12
|
import { applicationRuntime, configuredRuntime, runtimeTargets, RUNTIME_KEYS, } from './providers/runtime.js';
|
|
11
13
|
import { CREDENTIALS } from './providers/api.js';
|
|
12
14
|
import { readApplication } from './project-state.js';
|
|
13
15
|
import { planVercelDelivery, configureVercelEnvironment, shipVercelApplication } from './vercel.js';
|
|
14
16
|
/** Provisioning can change tracked binding IDs; never silently commit that change. */
|
|
15
|
-
async function executeCloudflareApplication(root, dryRun = false, run = defaultRunner, request, send = fetch, providerEnvironment = process.env, session) {
|
|
17
|
+
async function executeCloudflareApplication(root, dryRun = false, run = defaultRunner, request, send = fetch, providerEnvironment = process.env, session, options = {}) {
|
|
16
18
|
root = realpathSync(root);
|
|
17
19
|
const deployment = planDelivery(root, true);
|
|
18
20
|
const provisioning = planProvisioning(root);
|
|
19
21
|
const integrations = planProviderProvisioning(root);
|
|
20
22
|
if (dryRun)
|
|
21
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
...deployment,
|
|
25
|
+
provisioning,
|
|
26
|
+
integrations,
|
|
27
|
+
mutation: false,
|
|
28
|
+
};
|
|
22
29
|
if (deployment.project.audience === 'unconfigured' || !deployment.project.accountId)
|
|
23
30
|
throw new Error('Connect the intended account and audience before shipping.');
|
|
24
31
|
const environment = runtimeEnvironment(providerEnvironment);
|
|
25
|
-
const providerRun = (command, args, cwd, env) => run(command, args, cwd, runtimeEnvironment(env));
|
|
32
|
+
const providerRun = (command, args, cwd, env, input) => run(command, args, cwd, runtimeEnvironment(env), input);
|
|
26
33
|
if (realpathSync((await run('git', ['rev-parse', '--show-toplevel'], root, environment)).trim()) !==
|
|
27
34
|
root ||
|
|
28
35
|
(await run('git', ['status', '--porcelain'], root, environment)).trim())
|
|
@@ -53,8 +60,26 @@ async function executeCloudflareApplication(root, dryRun = false, run = defaultR
|
|
|
53
60
|
const runtime = configuredRuntime(root);
|
|
54
61
|
const environments = mergeRuntimeTargets(runtimeTargets(root, runtime), application);
|
|
55
62
|
const buildRunner = async (command, args, cwd, env) => {
|
|
56
|
-
const
|
|
63
|
+
const relative = path.relative(root, cwd).split(path.sep).join('/');
|
|
64
|
+
const values = environments[`${relative}/.env`] ?? environments[`${relative}/.dev.vars`];
|
|
57
65
|
const environment = runtimeEnvironment(env, values);
|
|
66
|
+
if (deployment.project.deliveryEngine === 'void' &&
|
|
67
|
+
command === 'pnpm' &&
|
|
68
|
+
args.join(' ') === 'exec void deploy --platform cloudflare') {
|
|
69
|
+
if (values && Object.keys(values).length)
|
|
70
|
+
await syncVoidSecrets(cwd, voidServerSecrets(values), run, environment, async () => {
|
|
71
|
+
const dirty = await run('git', ['status', '--porcelain'], root, environment);
|
|
72
|
+
const changed = dirty
|
|
73
|
+
.split('\n')
|
|
74
|
+
.filter((line) => line.trim())
|
|
75
|
+
.some((line) => !([' M', '??'].includes(line.slice(0, 2)) &&
|
|
76
|
+
deployment.project.targets.some((target) => line.slice(3) === `${target.directory}/void.lock.json`)));
|
|
77
|
+
if (changed ||
|
|
78
|
+
(await run('git', ['rev-parse', 'HEAD'], root, environment)).trim() !== commit)
|
|
79
|
+
throw new Error('Source changed before Void secret upload; deployment was stopped.');
|
|
80
|
+
});
|
|
81
|
+
return run(command, args, cwd, environment);
|
|
82
|
+
}
|
|
58
83
|
if (command !== 'pnpm' ||
|
|
59
84
|
args.join(' ') !== 'run deploy' ||
|
|
60
85
|
!values ||
|
|
@@ -69,7 +94,7 @@ async function executeCloudflareApplication(root, dryRun = false, run = defaultR
|
|
|
69
94
|
rmSync(file, { force: true });
|
|
70
95
|
}
|
|
71
96
|
};
|
|
72
|
-
return phase(session, 'deployment', () => shipApplication(root, buildRunner, request));
|
|
97
|
+
return phase(session, 'deployment', () => shipApplication(root, buildRunner, request, options));
|
|
73
98
|
}
|
|
74
99
|
async function executeVercelApplication(root, dryRun = false, run = defaultRunner, send = fetch, providerEnvironment = process.env, session) {
|
|
75
100
|
const deployment = planVercelDelivery(root);
|
|
@@ -81,7 +106,7 @@ async function executeVercelApplication(root, dryRun = false, run = defaultRunne
|
|
|
81
106
|
deployment.project.audience === 'unconfigured')
|
|
82
107
|
throw new Error('Connect the intended Vercel account, plan and audience before shipping.');
|
|
83
108
|
const env = runtimeEnvironment(providerEnvironment);
|
|
84
|
-
const providerRun = (command, args, cwd, env) => run(command, args, cwd, runtimeEnvironment(env));
|
|
109
|
+
const providerRun = (command, args, cwd, env, input) => run(command, args, cwd, runtimeEnvironment(env), input);
|
|
85
110
|
if (realpathSync((await run('git', ['rev-parse', '--show-toplevel'], root, env)).trim()) !==
|
|
86
111
|
realpathSync(root) ||
|
|
87
112
|
(await run('git', ['status', '--porcelain'], root, env)).trim())
|
|
@@ -108,10 +133,10 @@ async function executeVercelApplication(root, dryRun = false, run = defaultRunne
|
|
|
108
133
|
function phase(session, name, action) {
|
|
109
134
|
return session ? session.phase(name, action) : action();
|
|
110
135
|
}
|
|
111
|
-
export async function shipCloudflareApplication(root, dryRun = false, run = defaultRunner, request, send = fetch, providerEnvironment = process.env) {
|
|
136
|
+
export async function shipCloudflareApplication(root, dryRun = false, run = defaultRunner, request, send = fetch, providerEnvironment = process.env, options = {}) {
|
|
112
137
|
if (dryRun)
|
|
113
|
-
return executeCloudflareApplication(root, true, run, request, send, providerEnvironment);
|
|
114
|
-
return withLifecycleOperation(root, 'cloudflare', run, (session) => executeCloudflareApplication(root, false, run, request, send, providerEnvironment, session));
|
|
138
|
+
return executeCloudflareApplication(root, true, run, request, send, providerEnvironment, undefined, options);
|
|
139
|
+
return withLifecycleOperation(root, 'cloudflare', run, (session) => executeCloudflareApplication(root, false, run, request, send, providerEnvironment, session, options));
|
|
115
140
|
}
|
|
116
141
|
export async function shipSelectedVercelApplication(root, dryRun = false, run = defaultRunner, send = fetch, providerEnvironment = process.env) {
|
|
117
142
|
if (dryRun)
|
|
@@ -136,11 +161,11 @@ function mergeRuntimeTargets(providers, application) {
|
|
|
136
161
|
/** Each mixed target keeps its own release receipt; this is not a provider transaction. */
|
|
137
162
|
export async function shipSelectedStack(root, dryRun = false, run = defaultRunner, request, send = fetch, providerEnvironment = process.env) {
|
|
138
163
|
root = realpathSync(root);
|
|
139
|
-
const mixed =
|
|
140
|
-
|
|
164
|
+
const mixed = hasProjectSection(root, 'vercel') &&
|
|
165
|
+
hasProjectSection(root, 'cloudflare') &&
|
|
141
166
|
readApplication(root).targets.length > 0;
|
|
142
167
|
if (!mixed)
|
|
143
|
-
return
|
|
168
|
+
return hasProjectSection(root, 'vercel')
|
|
144
169
|
? shipSelectedVercelApplication(root, dryRun, run, send, providerEnvironment)
|
|
145
170
|
: shipCloudflareApplication(root, dryRun, run, request, send, providerEnvironment);
|
|
146
171
|
const cloudflare = planDelivery(root, true);
|
|
@@ -170,6 +195,7 @@ export async function shipSelectedStack(root, dryRun = false, run = defaultRunne
|
|
|
170
195
|
});
|
|
171
196
|
const services = await executeCloudflareApplication(root, false, run, request, send, providerEnvironment, scoped('cloudflare'));
|
|
172
197
|
if ('state' in services &&
|
|
198
|
+
services.state !== undefined &&
|
|
173
199
|
['configuration-required', 'provider-configuration-required'].includes(services.state))
|
|
174
200
|
return {
|
|
175
201
|
state: services.state,
|
package/dist/stack-registry.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const PRODUCT_ITEMS: {
|
|
|
8
8
|
wxt: ItemDefinition;
|
|
9
9
|
hono: ItemDefinition;
|
|
10
10
|
neon: ItemDefinition;
|
|
11
|
+
'neon-realtime': ItemDefinition;
|
|
11
12
|
d1: ItemDefinition;
|
|
12
13
|
'local-data': ItemDefinition;
|
|
13
14
|
clerk: ItemDefinition;
|
|
@@ -30,7 +31,7 @@ declare const PRODUCT_ITEMS: {
|
|
|
30
31
|
styling: ItemDefinition;
|
|
31
32
|
};
|
|
32
33
|
export type StandardProduct = keyof typeof PRODUCT_ITEMS;
|
|
33
|
-
export declare const STANDARD_PRODUCTS: readonly ("
|
|
34
|
+
export declare const STANDARD_PRODUCTS: readonly ("next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog")[];
|
|
34
35
|
declare const DEFINITIONS: {
|
|
35
36
|
vinext: ItemDefinition;
|
|
36
37
|
next: ItemDefinition;
|
|
@@ -39,6 +40,7 @@ declare const DEFINITIONS: {
|
|
|
39
40
|
wxt: ItemDefinition;
|
|
40
41
|
hono: ItemDefinition;
|
|
41
42
|
neon: ItemDefinition;
|
|
43
|
+
'neon-realtime': ItemDefinition;
|
|
42
44
|
d1: ItemDefinition;
|
|
43
45
|
'local-data': ItemDefinition;
|
|
44
46
|
clerk: ItemDefinition;
|
|
@@ -67,7 +69,7 @@ declare const DEFINITIONS: {
|
|
|
67
69
|
export type StackItemId = keyof typeof DEFINITIONS;
|
|
68
70
|
export declare function getStackDefinition(name: string): ItemDefinition;
|
|
69
71
|
export declare function getStackItem(name: string): StackRegistryItem;
|
|
70
|
-
export declare const STACK_ITEMS: Record<"
|
|
72
|
+
export declare const STACK_ITEMS: Record<"next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "eslint" | "typescript" | "wxt" | "expo" | "ui" | "workspace" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog", StackRegistryItem>;
|
|
71
73
|
export declare const STACK_REGISTRY: {
|
|
72
74
|
schemaVersion: number;
|
|
73
75
|
name: string;
|
package/dist/stack-registry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { usesVoidSelection } from './runtime-policy.js';
|
|
1
2
|
import { scaffoldStyling } from './scaffold/styling.js';
|
|
2
3
|
import { resourceName } from './render.js';
|
|
3
4
|
import { STACK_DEPENDENCIES } from './dependencies.js';
|
|
@@ -6,6 +7,7 @@ import { GENERATOR_VERSION } from './version.js';
|
|
|
6
7
|
import { scaffoldWeb } from './scaffold/web.js';
|
|
7
8
|
import { scaffoldApi } from './scaffold/api.js';
|
|
8
9
|
import { scaffoldDatabase } from './scaffold/database.js';
|
|
10
|
+
import { scaffoldNeonRealtime } from './scaffold/neon-realtime.js';
|
|
9
11
|
import { scaffoldBetterAuth, scaffoldClerk } from './scaffold/auth.js';
|
|
10
12
|
import { scaffoldRealtime, scaffoldQueues, scaffoldCron, scaffoldWorkflows, } from './scaffold/services.js';
|
|
11
13
|
import { scaffoldExpo } from './platforms/mobile.js';
|
|
@@ -19,6 +21,10 @@ function requirements(purpose, tools, access, credentials, resources, verify) {
|
|
|
19
21
|
function packageSource(name, source, dependencies) {
|
|
20
22
|
return { name, source, dependencies };
|
|
21
23
|
}
|
|
24
|
+
function runtimeConfiguration({ runtimeApp, options }) {
|
|
25
|
+
const legacy = !usesVoidSelection(options.products, options.hosting);
|
|
26
|
+
return `apps/${runtimeApp}/${legacy ? 'wrangler.jsonc' : 'anhedral.cloudflare.json'}`;
|
|
27
|
+
}
|
|
22
28
|
function defineItems(configurations) {
|
|
23
29
|
return Object.fromEntries(Object.entries(configurations).map(([name, configuration]) => [
|
|
24
30
|
name,
|
|
@@ -87,18 +93,39 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
87
93
|
},
|
|
88
94
|
neon: {
|
|
89
95
|
type: 'package',
|
|
90
|
-
description: '
|
|
96
|
+
description: 'Reusable server database package with Neon HTTP, Drizzle and explicit migrations',
|
|
91
97
|
targets: ['packages/db'],
|
|
92
98
|
selection: { conflicts: ['d1'] },
|
|
93
99
|
registryDependencies: ['workspace', 'typescript', 'eslint'],
|
|
94
|
-
setup: requirements('PostgreSQL persistence through direct Neon HTTP and Drizzle', ['Neon integration or API'], ['Client-owned Neon project/branch access'], [
|
|
100
|
+
setup: requirements('PostgreSQL persistence through direct Neon HTTP and Drizzle', ['Neon integration or API'], ['Client-owned Neon project/branch access'], [
|
|
101
|
+
'Server-side DATABASE_URL; direct DATABASE_URL_UNPOOLED for migrations; separate environment roles',
|
|
102
|
+
], ['Neon project/branches, database roles and reviewed migrations'], ['Migration, runtime connectivity and authorization; HTTP has no interactive transactions']),
|
|
95
103
|
install: scaffoldDatabase,
|
|
96
|
-
environment: ['DATABASE_URL'],
|
|
104
|
+
environment: ['DATABASE_URL', 'DATABASE_URL_UNPOOLED'],
|
|
97
105
|
runtime: 'server',
|
|
106
|
+
resolveTargets: ({ runtimeApp }) => ['packages/db', `apps/${runtimeApp}`],
|
|
107
|
+
},
|
|
108
|
+
'neon-realtime': {
|
|
109
|
+
type: 'integration',
|
|
110
|
+
description: 'Neon live SQL with server-sealed Drizzle queries and a browser-safe subscription client (beta)',
|
|
111
|
+
targets: ['packages/neon-realtime'],
|
|
112
|
+
selection: { requiresAny: ['neon'] },
|
|
113
|
+
registryDependencies: ['workspace', 'typescript', 'eslint', 'neon'],
|
|
114
|
+
fallbackDependency: 'neon',
|
|
115
|
+
runtime: 'server',
|
|
116
|
+
environment: ['NEON_REALTIME_SECRET', 'NEON_REALTIME_URL'],
|
|
117
|
+
setup: requirements('Live PostgreSQL query results on the selected Neon branch', ['Neon Console or Neon CLI', 'Browser control'], ['Client-owned Neon project and branch with Realtime beta availability'], ['Server-only NEON_REALTIME_SECRET; public NEON_REALTIME_URL; existing server DATABASE_URL'], [
|
|
118
|
+
'Manually enable Realtime and logical replication on the selected branch; configure allowed browser origins',
|
|
119
|
+
'Tables with stable replica identity; authorized deterministic SELECT queries sealed on the server',
|
|
120
|
+
], [
|
|
121
|
+
'Authorized row isolation, access revocation, capability renewal, disconnect/reconnect and subscription cleanup',
|
|
122
|
+
'Beta has no RLS or performance guarantees; database compute and egress remain billable',
|
|
123
|
+
]),
|
|
124
|
+
install: scaffoldNeonRealtime,
|
|
98
125
|
},
|
|
99
126
|
d1: {
|
|
100
127
|
type: 'package',
|
|
101
|
-
description: 'Drizzle D1 database and migration tooling',
|
|
128
|
+
description: 'Reusable Drizzle D1 database package and explicit migration tooling',
|
|
102
129
|
targets: ['packages/db'],
|
|
103
130
|
selection: { conflicts: ['neon'] },
|
|
104
131
|
registryDependencies: ['workspace', 'typescript', 'eslint'],
|
|
@@ -110,11 +137,12 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
110
137
|
binding: 'DB',
|
|
111
138
|
database_name: resourceName(options.name, 'db'),
|
|
112
139
|
database_id: 'REPLACE_WITH_D1_ID',
|
|
113
|
-
migrations_dir: '../../packages/db/
|
|
140
|
+
migrations_dir: '../../packages/db/drizzle',
|
|
114
141
|
},
|
|
115
142
|
],
|
|
116
143
|
}),
|
|
117
144
|
runtime: 'worker',
|
|
145
|
+
resolveTargets: ({ runtimeApp }) => ['packages/db', `apps/${runtimeApp}`],
|
|
118
146
|
},
|
|
119
147
|
'local-data': {
|
|
120
148
|
type: 'package',
|
|
@@ -193,7 +221,7 @@ export interface LocalDataStore {
|
|
|
193
221
|
configure: () => ({ kv_namespaces: [{ binding: 'CONFIG', id: 'REPLACE_WITH_KV_ID' }] }),
|
|
194
222
|
installer: 'configuration',
|
|
195
223
|
runtime: 'worker',
|
|
196
|
-
resolveTargets: (
|
|
224
|
+
resolveTargets: (context) => [runtimeConfiguration(context)],
|
|
197
225
|
},
|
|
198
226
|
realtime: {
|
|
199
227
|
type: 'service',
|
|
@@ -214,9 +242,11 @@ export interface LocalDataStore {
|
|
|
214
242
|
queues: { producers: [{ binding: 'JOBS', queue: resourceName(options.name, 'jobs') }] },
|
|
215
243
|
}),
|
|
216
244
|
runtime: 'optional-worker',
|
|
217
|
-
resolveTargets: (
|
|
245
|
+
resolveTargets: (context) => [
|
|
218
246
|
'apps/jobs',
|
|
219
|
-
...(has('hono') || has('vinext') || has('next')
|
|
247
|
+
...(context.has('hono') || context.has('vinext') || context.has('next')
|
|
248
|
+
? [runtimeConfiguration(context)]
|
|
249
|
+
: []),
|
|
220
250
|
],
|
|
221
251
|
},
|
|
222
252
|
cron: {
|
|
@@ -264,7 +294,7 @@ export interface LocalDataStore {
|
|
|
264
294
|
configure: () => ({ ai: { binding: 'AI' } }),
|
|
265
295
|
installer: 'configuration',
|
|
266
296
|
runtime: 'worker',
|
|
267
|
-
resolveTargets: (
|
|
297
|
+
resolveTargets: (context) => [runtimeConfiguration(context)],
|
|
268
298
|
},
|
|
269
299
|
resend: {
|
|
270
300
|
type: 'package',
|
|
@@ -366,8 +396,8 @@ export const STANDARD_PRODUCTS = Object.freeze(Object.keys(PRODUCT_ITEMS));
|
|
|
366
396
|
const FOUNDATION_ITEMS = defineItems({
|
|
367
397
|
workspace: {
|
|
368
398
|
type: 'foundation',
|
|
369
|
-
description: 'pnpm
|
|
370
|
-
targets: ['package.json', 'pnpm-workspace.yaml', 'turbo.json'
|
|
399
|
+
description: 'pnpm workspace with one root lockfile, pinned Turborepo and shared checks',
|
|
400
|
+
targets: ['package.json', 'pnpm-workspace.yaml', 'turbo.json'],
|
|
371
401
|
registryDependencies: [],
|
|
372
402
|
},
|
|
373
403
|
typescript: {
|
package/dist/standard.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeProjectSection } from './project-config.js';
|
|
2
|
+
import { usesVoidSelection } from './runtime-policy.js';
|
|
3
|
+
import { configureDependencyPatches } from './dependency-patches.js';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { registerGeneratedProject } from './catalog-registration.js';
|
|
2
6
|
import { recordScaffoldFiles } from './registry/receipt.js';
|
|
3
7
|
import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, rmdirSync } from 'node:fs';
|
|
4
8
|
import path from 'node:path';
|
|
5
9
|
import { spawnSync } from 'node:child_process';
|
|
6
10
|
import { execFile } from './util.js';
|
|
11
|
+
import { supportsVoidRuntime } from './void.js';
|
|
7
12
|
import { registerVercelApplication } from './vercel.js';
|
|
8
13
|
import { registerApplication } from './delivery.js';
|
|
9
14
|
import { runStagedTransaction } from './transaction.js';
|
|
@@ -24,6 +29,9 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
24
29
|
}
|
|
25
30
|
assertBootstrapPlatform(run);
|
|
26
31
|
assertWorkspaceRuntime(run);
|
|
32
|
+
const voidWorkspace = usesVoidSelection(options.products, options.hosting);
|
|
33
|
+
if (voidWorkspace && run === execFile && !supportsVoidRuntime(process.versions.node))
|
|
34
|
+
throw new Error('New Cloudflare workspaces use Void and require Node.js 24.21.0 or newer. Planning remains available on older CLI-supported versions.');
|
|
27
35
|
const root = options.root;
|
|
28
36
|
const previousQuiet = process.env.ANHEDRAL_QUIET;
|
|
29
37
|
if (options.json)
|
|
@@ -53,13 +61,18 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
53
61
|
bootstrapWorkspace(stageRoot, options.name, run);
|
|
54
62
|
printProgress('Composing the selected stack…', display);
|
|
55
63
|
await composeStack(stageRoot, options, plan.registry);
|
|
64
|
+
writeProjectSection(stageRoot, 'identity', {
|
|
65
|
+
schemaVersion: 1,
|
|
66
|
+
id: randomUUID(),
|
|
67
|
+
});
|
|
56
68
|
if (options.products.includes('next') && options.hosting === 'vercel')
|
|
57
69
|
registerVercelApplication(stageRoot);
|
|
58
|
-
if (readdirSync(path.join(stageRoot, 'apps')).some((app) => existsSync(path.join(stageRoot, 'apps', app, 'wrangler.jsonc'))
|
|
70
|
+
if (readdirSync(path.join(stageRoot, 'apps')).some((app) => existsSync(path.join(stageRoot, 'apps', app, 'wrangler.jsonc')) ||
|
|
71
|
+
existsSync(path.join(stageRoot, 'apps', app, 'anhedral.cloudflare.json'))))
|
|
59
72
|
registerApplication(stageRoot);
|
|
60
73
|
printProgress('Resolving pinned dependencies…', display);
|
|
61
74
|
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
62
|
-
if (
|
|
75
|
+
if (configureDependencyPatches(stageRoot))
|
|
63
76
|
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
64
77
|
recordScaffoldFiles(stageRoot);
|
|
65
78
|
commitPaths.push(...readdirSync(stageRoot).filter((name) => name !== 'node_modules'));
|
|
@@ -79,7 +92,13 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
79
92
|
}
|
|
80
93
|
},
|
|
81
94
|
});
|
|
82
|
-
printResult('init', {
|
|
95
|
+
printResult('init', {
|
|
96
|
+
...plan,
|
|
97
|
+
generated: true,
|
|
98
|
+
catalog: run === execFile || process.env.ANHEDRAL_PLUGIN_DATA || process.env.PLUGIN_DATA
|
|
99
|
+
? registerGeneratedProject(root)
|
|
100
|
+
: { state: 'not-enabled' },
|
|
101
|
+
}, { ...output, json: options.json });
|
|
83
102
|
}
|
|
84
103
|
finally {
|
|
85
104
|
if (created && existsSync(root) && readdirSync(root).length === 0)
|
package/dist/transaction.d.ts
CHANGED
|
@@ -20,3 +20,5 @@ export declare function runStagedTransaction(root: string, options: {
|
|
|
20
20
|
onPlan?: (paths: readonly string[]) => void;
|
|
21
21
|
build: (stageRoot: string) => Promise<void>;
|
|
22
22
|
}): Promise<readonly string[]>;
|
|
23
|
+
/** Serialize short source updates with generation/add transactions as well as other writers. */
|
|
24
|
+
export declare function withSourceWriteLock<T>(root: string, write: () => T): T;
|
package/dist/transaction.js
CHANGED
|
@@ -883,3 +883,13 @@ export async function runStagedTransaction(root, options) {
|
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
+
/** Serialize short source updates with generation/add transactions as well as other writers. */
|
|
887
|
+
export function withSourceWriteLock(root, write) {
|
|
888
|
+
const lock = acquireTransactionLock(root);
|
|
889
|
+
try {
|
|
890
|
+
return write();
|
|
891
|
+
}
|
|
892
|
+
finally {
|
|
893
|
+
releaseTransactionLock(lock);
|
|
894
|
+
}
|
|
895
|
+
}
|
package/dist/util.js
CHANGED
|
@@ -4,6 +4,18 @@ import { spawnSync } from 'node:child_process';
|
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
const FAILURE_TAIL_BYTES = 128 * 1024;
|
|
7
|
+
function commandTimeout() {
|
|
8
|
+
const value = Number(process.env.ANHEDRAL_COMMAND_TIMEOUT_MS);
|
|
9
|
+
return Number.isSafeInteger(value) && value >= 1 && value <= 20 * 60 * 1000
|
|
10
|
+
? value
|
|
11
|
+
: 20 * 60 * 1000;
|
|
12
|
+
}
|
|
13
|
+
function commandFailure(cmd, status, error) {
|
|
14
|
+
const timedOut = error?.code === 'ETIMEDOUT';
|
|
15
|
+
return new Error(timedOut
|
|
16
|
+
? `Command timed out: ${cmd}. Check connectivity and local tooling before retrying.`
|
|
17
|
+
: `Command failed (exit ${status ?? '?'}): ${cmd}`, error ? { cause: error } : undefined);
|
|
18
|
+
}
|
|
7
19
|
export function writeFile(filePath, content) {
|
|
8
20
|
const existed = existsSync(filePath);
|
|
9
21
|
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
@@ -54,21 +66,23 @@ function dumpFailure(cmd, status, stdoutPath, stderrPath, spawnError) {
|
|
|
54
66
|
if (stderrText)
|
|
55
67
|
process.stderr.write(stderrText);
|
|
56
68
|
}
|
|
57
|
-
throw
|
|
69
|
+
throw commandFailure(cmd, status, spawnError);
|
|
58
70
|
}
|
|
59
71
|
export function execFile(executable, args, cwd) {
|
|
60
72
|
const invocation = resolveCommand(executable, args);
|
|
61
73
|
const quiet = process.env.ANHEDRAL_QUIET === '1';
|
|
62
74
|
const display = [executable, ...args].join(' ');
|
|
75
|
+
const deadline = { timeout: commandTimeout(), killSignal: 'SIGKILL' };
|
|
63
76
|
if (process.env.ANHEDRAL_VERBOSE === '1' && !quiet) {
|
|
64
77
|
console.log(` $ ${display}`);
|
|
65
78
|
const result = spawnSync(invocation.command, invocation.args, {
|
|
66
79
|
cwd,
|
|
67
80
|
stdio: 'inherit',
|
|
68
81
|
shell: false,
|
|
82
|
+
...deadline,
|
|
69
83
|
});
|
|
70
84
|
if (result.error || result.status !== 0) {
|
|
71
|
-
throw
|
|
85
|
+
throw commandFailure(display, result.status, result.error);
|
|
72
86
|
}
|
|
73
87
|
return;
|
|
74
88
|
}
|
|
@@ -82,6 +96,7 @@ export function execFile(executable, args, cwd) {
|
|
|
82
96
|
cwd,
|
|
83
97
|
shell: false,
|
|
84
98
|
stdio: ['ignore', stdout, stderr],
|
|
99
|
+
...deadline,
|
|
85
100
|
});
|
|
86
101
|
closeSync(stdout);
|
|
87
102
|
closeSync(stderr);
|
package/dist/vercel.d.ts
CHANGED
|
@@ -96,3 +96,5 @@ export declare function rollbackVercelApplication(root: string, releaseId: strin
|
|
|
96
96
|
nextAction: string;
|
|
97
97
|
}>;
|
|
98
98
|
export declare function writeVercelOverview(root: string, snapshot: Awaited<ReturnType<typeof vercelApplicationStatus>>): string;
|
|
99
|
+
/** Read-only Web Analytics query for the exact connected project/team. */
|
|
100
|
+
export declare function vercelServiceMetrics(root: string, hours?: number, run?: DeliveryRunner): Promise<import('./service-model.js').ServiceMetrics>;
|
package/dist/vercel.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { hasProjectSection, readProjectSection, writeProjectSection } from './project-config.js';
|
|
1
2
|
import { githubRepository } from './repository.js';
|
|
3
|
+
import { providerProjectName } from './render.js';
|
|
2
4
|
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
5
|
import { randomUUID } from 'node:crypto';
|
|
4
6
|
import path from 'node:path';
|
|
@@ -6,7 +8,7 @@ import { tmpdir } from 'node:os';
|
|
|
6
8
|
import { atomicJson, defaultRunner, withApplicationLock, } from './project-state.js';
|
|
7
9
|
// Keep provider commands reproducible independently of globally installed tooling.
|
|
8
10
|
const cli = ['dlx', 'vercel@62.7.0'];
|
|
9
|
-
const manifest = 'anhedral.
|
|
11
|
+
const manifest = 'anhedral.json';
|
|
10
12
|
function webDirectory(root) {
|
|
11
13
|
root = realpathSync(root);
|
|
12
14
|
const directory = realpathSync(path.join(root, 'apps/web'));
|
|
@@ -17,14 +19,15 @@ function webDirectory(root) {
|
|
|
17
19
|
export function registerVercelApplication(root) {
|
|
18
20
|
root = realpathSync(root);
|
|
19
21
|
webDirectory(root);
|
|
20
|
-
if (
|
|
22
|
+
if (hasProjectSection(root, 'vercel'))
|
|
21
23
|
return readWeb(root);
|
|
22
|
-
const setup =
|
|
24
|
+
const setup = readProjectSection(root, 'setup');
|
|
23
25
|
if (setup.hosting !== 'vercel')
|
|
24
26
|
throw new Error('This application did not select Vercel web hosting.');
|
|
25
|
-
const
|
|
26
|
-
if (typeof
|
|
27
|
-
throw new Error('
|
|
27
|
+
const packageName = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8')).name;
|
|
28
|
+
if (typeof packageName !== 'string' || !packageName)
|
|
29
|
+
throw new Error('A package name is required to register the Vercel project.');
|
|
30
|
+
const name = providerProjectName(packageName);
|
|
28
31
|
const project = {
|
|
29
32
|
schemaVersion: 1,
|
|
30
33
|
id: randomUUID(),
|
|
@@ -44,12 +47,12 @@ export function registerVercelApplication(root) {
|
|
|
44
47
|
if (!source.split(/\r?\n/).includes(entry))
|
|
45
48
|
source += (source && !source.endsWith('\n') ? '\n' : '') + entry + '\n';
|
|
46
49
|
writeFileSync(ignore, source);
|
|
47
|
-
|
|
50
|
+
writeProjectSection(root, 'vercel', project);
|
|
48
51
|
return project;
|
|
49
52
|
}
|
|
50
53
|
function readWeb(root) {
|
|
51
54
|
webDirectory(root);
|
|
52
|
-
const project =
|
|
55
|
+
const project = readProjectSection(root, 'vercel');
|
|
53
56
|
if (project.schemaVersion !== 1 ||
|
|
54
57
|
!/^[a-f0-9-]{36}$/.test(project.id) ||
|
|
55
58
|
project.provider !== 'vercel' ||
|
|
@@ -274,7 +277,7 @@ export async function connectVercelApplication(root, options, run = defaultRunne
|
|
|
274
277
|
const linkingEnv = env(connected);
|
|
275
278
|
delete linkingEnv.VERCEL_PROJECT_ID;
|
|
276
279
|
delete linkingEnv.VERCEL_ORG_ID;
|
|
277
|
-
|
|
280
|
+
writeProjectSection(root, 'vercel', connected);
|
|
278
281
|
await run('pnpm', [
|
|
279
282
|
...cli,
|
|
280
283
|
'link',
|
|
@@ -286,7 +289,7 @@ export async function connectVercelApplication(root, options, run = defaultRunne
|
|
|
286
289
|
'--non-interactive',
|
|
287
290
|
], root, linkingEnv);
|
|
288
291
|
const inspected = await inspect(root, connected, run);
|
|
289
|
-
|
|
292
|
+
writeProjectSection(root, 'vercel', connected);
|
|
290
293
|
if (repository) {
|
|
291
294
|
const matches = (link) => matchesRepository(link, repository);
|
|
292
295
|
if (inspected.link && !matches(inspected.link))
|
|
@@ -321,7 +324,7 @@ export async function connectVercelApplication(root, options, run = defaultRunne
|
|
|
321
324
|
...(linked?.productionBranch ? { productionBranch: linked.productionBranch } : {}),
|
|
322
325
|
};
|
|
323
326
|
}
|
|
324
|
-
|
|
327
|
+
writeProjectSection(root, 'vercel', connected);
|
|
325
328
|
return { project: connected, plan, planActivated: false };
|
|
326
329
|
});
|
|
327
330
|
}
|
|
@@ -406,7 +409,10 @@ async function committedManifest(root, project, run) {
|
|
|
406
409
|
const commit = await source(root, run);
|
|
407
410
|
let recorded;
|
|
408
411
|
try {
|
|
409
|
-
|
|
412
|
+
const configuration = JSON.parse(await run('git', ['show', `HEAD:${manifest}`], root, env(project)));
|
|
413
|
+
if (configuration.schemaVersion !== 1)
|
|
414
|
+
throw new Error('Invalid committed project configuration.');
|
|
415
|
+
recorded = configuration.vercel;
|
|
410
416
|
}
|
|
411
417
|
catch {
|
|
412
418
|
throw new Error('Commit the Vercel identity manifest before adoption or recovery.');
|
|
@@ -543,7 +549,7 @@ export function planVercelDelivery(root) {
|
|
|
543
549
|
project,
|
|
544
550
|
checks: ['pnpm run check'],
|
|
545
551
|
deployment: ['pnpm', ...cli, 'deploy', '--prod', '--yes'],
|
|
546
|
-
cloudflareServices:
|
|
552
|
+
cloudflareServices: hasProjectSection(root, 'cloudflare')
|
|
547
553
|
? 'Default ship deploys Cloudflare services first. Explicit --provider vercel ships only the web app; verify its service dependencies separately.'
|
|
548
554
|
: 'none',
|
|
549
555
|
mutation: false,
|
|
@@ -820,3 +826,53 @@ function renameOverview(temporary, file) {
|
|
|
820
826
|
renameSync(temporary, file);
|
|
821
827
|
return file;
|
|
822
828
|
}
|
|
829
|
+
/** Read-only Web Analytics query for the exact connected project/team. */
|
|
830
|
+
export async function vercelServiceMetrics(root, hours = 24, run = defaultRunner) {
|
|
831
|
+
if (![24, 168].includes(hours))
|
|
832
|
+
throw new Error('Vercel analytics uses complete UTC days.');
|
|
833
|
+
const project = readWeb(root);
|
|
834
|
+
await inspect(root, project, run);
|
|
835
|
+
if (!project.projectId || !project.teamId)
|
|
836
|
+
throw new Error('Connect the exact Vercel project and team before reading analytics.');
|
|
837
|
+
const end = new Date(new Date().toISOString().slice(0, 10) + 'T00:00:00.000Z').toISOString();
|
|
838
|
+
const start = new Date(Date.parse(end) - hours * 3600000).toISOString();
|
|
839
|
+
const query = new URLSearchParams({
|
|
840
|
+
teamId: project.teamId,
|
|
841
|
+
projectId: project.projectId,
|
|
842
|
+
since: start.slice(0, 10),
|
|
843
|
+
until: new Date(Date.parse(end) - 1).toISOString().slice(0, 10),
|
|
844
|
+
by: 'day',
|
|
845
|
+
limit: '100',
|
|
846
|
+
});
|
|
847
|
+
const value = await api(root, run, `/v1/query/web-analytics/visits/aggregate?${query}`, project.teamId);
|
|
848
|
+
if (value.version !== 1 ||
|
|
849
|
+
!Array.isArray(value.data) ||
|
|
850
|
+
value.data.length >= 100 ||
|
|
851
|
+
value.query?.since !== start.slice(0, 10))
|
|
852
|
+
throw new Error('Unsupported or truncated Vercel analytics output.');
|
|
853
|
+
const points = value.data.map((row) => {
|
|
854
|
+
if (!row || typeof row !== 'object')
|
|
855
|
+
throw new Error('Invalid analytics row.');
|
|
856
|
+
const value = row;
|
|
857
|
+
if (typeof value.timestamp !== 'string' ||
|
|
858
|
+
!Number.isFinite(Date.parse(value.timestamp)) ||
|
|
859
|
+
Date.parse(value.timestamp) < Date.parse(start) ||
|
|
860
|
+
Date.parse(value.timestamp) >= Date.parse(end) ||
|
|
861
|
+
[value.pageviews, value.visitors].some((count) => typeof count !== 'number' || !Number.isFinite(count) || count < 0))
|
|
862
|
+
throw new Error('Invalid Vercel analytics values.');
|
|
863
|
+
return {
|
|
864
|
+
time: value.timestamp,
|
|
865
|
+
values: { pageviews: Number(value.pageviews), visitors: Number(value.visitors) },
|
|
866
|
+
};
|
|
867
|
+
});
|
|
868
|
+
return {
|
|
869
|
+
fetchedAt: new Date().toISOString(),
|
|
870
|
+
start,
|
|
871
|
+
end,
|
|
872
|
+
timezone: 'UTC',
|
|
873
|
+
source: 'Vercel Web Analytics (daily buckets)',
|
|
874
|
+
sampled: false,
|
|
875
|
+
points,
|
|
876
|
+
units: { pageviews: 'count', visitors: 'daily bucket count' },
|
|
877
|
+
};
|
|
878
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "0.11.
|
|
1
|
+
export declare const GENERATOR_VERSION = "0.11.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const GENERATOR_VERSION = '0.11.
|
|
1
|
+
export const GENERATOR_VERSION = '0.11.1';
|
package/dist/vinext.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
+
export declare const VINEXT_SERVER_OUTPUT_PLUGIN = "{\n name: 'anhedral:vinext-server-modules',\n apply: 'build',\n enforce: 'post',\n outputOptions(output) {\n if (this.environment.name === 'rsc') {\n return { ...output, chunkFileNames: '[name]-[hash].js' };\n }\n },\n}";
|
|
1
2
|
export declare function configureVinext(root: string, workerName: string, bindings: Record<string, unknown>): void;
|
package/dist/vinext.js
CHANGED
|
@@ -2,6 +2,18 @@ import { VINEXT_DEPENDENCIES } from './dependencies.js';
|
|
|
2
2
|
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { writeFile } from './util.js';
|
|
5
|
+
// Vinext externalizes its generated manifests relative to each RSC chunk.
|
|
6
|
+
// Keep those chunks beside the real root modules, including Void's wrapper entry.
|
|
7
|
+
export const VINEXT_SERVER_OUTPUT_PLUGIN = `{
|
|
8
|
+
name: 'anhedral:vinext-server-modules',
|
|
9
|
+
apply: 'build',
|
|
10
|
+
enforce: 'post',
|
|
11
|
+
outputOptions(output) {
|
|
12
|
+
if (this.environment.name === 'rsc') {
|
|
13
|
+
return { ...output, chunkFileNames: '[name]-[hash].js' };
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}`;
|
|
5
17
|
// Official Vinext App Router integration using the supported Wrangler/Vite adapter.
|
|
6
18
|
// Wrangler's generated dist/server config preserves binding IDs and built assets.
|
|
7
19
|
export function configureVinext(root, workerName, bindings) {
|
|
@@ -25,7 +37,7 @@ export function configureVinext(root, workerName, bindings) {
|
|
|
25
37
|
put('vite.config.ts', `import { defineConfig } from 'vite';
|
|
26
38
|
import vinext from 'vinext';
|
|
27
39
|
import { cloudflare } from '@cloudflare/vite-plugin';
|
|
28
|
-
export default defineConfig({ plugins: [vinext(), cloudflare({ viteEnvironment: { name: 'rsc', childEnvironments: ['ssr'] } })] });
|
|
40
|
+
export default defineConfig({ plugins: [vinext(), cloudflare({ viteEnvironment: { name: 'rsc', childEnvironments: ['ssr'] } }), ${VINEXT_SERVER_OUTPUT_PLUGIN}] });
|
|
29
41
|
`);
|
|
30
42
|
put('wrangler.jsonc', JSON.stringify({
|
|
31
43
|
$schema: 'node_modules/wrangler/config-schema.json',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DeliveryRunner } from './project-state.js';
|
|
2
|
+
/** Bridge the already verified Wrangler identity into Void's separate cf process. */
|
|
3
|
+
export declare function voidCloudflareEnvironment(directory: string, run: DeliveryRunner, env: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv>;
|
|
4
|
+
export declare function voidServerSecrets(values: Record<string, string>): {
|
|
5
|
+
[k: string]: string;
|
|
6
|
+
};
|
|
7
|
+
/** Secret put is noninteractive with stdin; sync prompts even in CI in void@0.27. */
|
|
8
|
+
export declare function syncVoidSecrets(directory: string, values: Record<string, string>, run: DeliveryRunner, env: NodeJS.ProcessEnv, beforeMutation?: () => Promise<void>): Promise<void>;
|
|
9
|
+
export declare function deployVoidTarget(directory: string, run: DeliveryRunner, env: NodeJS.ProcessEnv): Promise<string>;
|
|
10
|
+
export declare function rollbackVoidTarget(directory: string, versionId: string, run: DeliveryRunner, env: NodeJS.ProcessEnv): Promise<string>;
|