@harlan-zw/nuxt-cloudflare 0.0.5 → 0.0.7
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 +20 -21
- package/dist/chunks/wrangler-reader.mjs +90 -0
- package/dist/cli/index.mjs +6 -90
- package/dist/d1.mjs +3 -6
- package/dist/module.d.mts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +78 -8
- package/dist/storage.mjs +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/wrangler.d.mts +18 -2
- package/dist/wrangler.mjs +257 -27
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,19 +7,20 @@ The module extracts production patterns already proven in Nuxt SEO and gscdump.
|
|
|
7
7
|
## Defaults
|
|
8
8
|
|
|
9
9
|
- Cloudflare module preset, generated Wrangler config, and Node compatibility
|
|
10
|
-
- Static assets remain asset first by default. Blanket `assets.run_worker_first: true`
|
|
10
|
+
- Static assets remain asset first by default. Blanket `assets.run_worker_first: true` warns because valid authentication and transform use cases exist
|
|
11
11
|
- Workers Logs sampled at 10%, traces at 1%, both overridable
|
|
12
12
|
- Preview URLs disabled unless explicitly enabled
|
|
13
13
|
- `workers_dev` disabled when a route proves the Worker remains reachable; workers without routes must choose explicitly
|
|
14
14
|
- Version metadata binding at `CF_VERSION_METADATA`
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- Smart Placement enabled unless the project chooses a placement
|
|
16
|
+
- Workers Caching enabled with version isolation
|
|
17
|
+
- Rendered HTML forced to `private, no-store`; explicit non-HTML cache policies remain intact
|
|
18
18
|
- Source-map upload when the Nitro build emits maps; explicit `false` is preserved
|
|
19
19
|
- Module-wide `secrets.required` names copied to each environment; source root secrets remain scoped to the root
|
|
20
20
|
- Version metadata is skipped when `CF_VERSION_METADATA` already names another binding
|
|
21
21
|
- Raw `cloudflare-kv-binding` on Nitro's `cache` mount upgraded to a 30-day physical expiry
|
|
22
|
-
- Final generated Wrangler config audited after production Nitro compiles
|
|
22
|
+
- Final generated Wrangler config validated through Wrangler, then audited after production Nitro compiles
|
|
23
|
+
- Production builds fail when server runtime config contains a value copied from a secret build environment variable. The error lists config paths only
|
|
23
24
|
- Complete defaults and diagnostics applied to every named Wrangler environment
|
|
24
25
|
|
|
25
26
|
Persistent KV mounts are never wrapped. The expiry policy applies only to cache data.
|
|
@@ -56,21 +57,11 @@ export default defineNuxtConfig({
|
|
|
56
57
|
})
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
Cloudflare KV requires TTLs of at least 60 seconds.
|
|
60
|
+
Cloudflare KV requires TTLs of at least 60 seconds. The cache wrapper raises shorter positive TTLs to 60 seconds.
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
Keep server runtime secret defaults empty. Nuxt reads matching `NUXT_*` values from Worker secret bindings at runtime. The production build guard rejects secret build environment values before Nitro can include them in the bundle. Nuxt Scripts proxy signing remains allowed because that module registers its security plugin during the build.
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
export default defineNuxtConfig({
|
|
67
|
-
nuxtCloudflare: {
|
|
68
|
-
workersCache: { _tag: 'disabled' },
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Smart Placement moves fetch handlers only when Cloudflare measures a faster location near upstream services. Assets-first delivery remains close to the user. Queue handlers, RPC methods, and named entrypoints are unaffected. An authored region, host, or hostname placement overrides the smart default.
|
|
64
|
+
Workers Caching is separate from Nitro's KV-backed cache. The module enables version-isolated caching by default. Rendered HTML always stays private. API and asset responses keep explicit cache policies. Set `workersCache: { _tag: 'disabled' }` to opt out. Choose cross-version caching only with an explicit purge path.
|
|
74
65
|
|
|
75
66
|
## Doctor
|
|
76
67
|
|
|
@@ -84,7 +75,7 @@ pnpm nuxt-cloudflare doctor --strict --allow-warning source-maps-disabled
|
|
|
84
75
|
|
|
85
76
|
The CLI reads Wrangler config through Wrangler itself, so JSON, JSONC, TOML, environments, upward lookup, and Nitro generated-config redirects follow deployment semantics. It separately inspects root authoring format. Existing TOML remains supported and receives non-blocking guidance because Cloudflare recommends JSONC for new projects. Shadowed root configs warn because they can silently drift.
|
|
86
77
|
|
|
87
|
-
Errors cover
|
|
78
|
+
Errors cover malformed asset patterns, invalid Durable Object lifecycles, invalid Container storage, queue limits, unsafe example bindings, and unflattened generated environments. Warnings cover blanket Worker-first assets, missing environment bindings, unrestricted email, local service fidelity, deprecated fields, telemetry gaps, and public endpoints. Secret values are never included.
|
|
88
79
|
|
|
89
80
|
Normal mode fails errors. `--strict` also fails warnings. Intentional exceptions remain visible and may be listed with `--allow-warning`. Module builds use the equivalent policy:
|
|
90
81
|
|
|
@@ -113,6 +104,14 @@ pnpm wrangler check startup --config .output/server/wrangler.json
|
|
|
113
104
|
|
|
114
105
|
Pass the final generated config explicitly to `types` and `check startup`; Nitro's `.wrangler/deploy/config.json` redirect does not apply to those commands.
|
|
115
106
|
|
|
107
|
+
### Product guidance
|
|
108
|
+
|
|
109
|
+
- Named environments do not inherit bindings. The doctor reports each omitted root binding.
|
|
110
|
+
- AI, Browser, Images, mTLS, Vectorize, and Flagship warn when local development omits `remote: true`.
|
|
111
|
+
- Every Container must match a local SQLite Durable Object. Legacy `dev` and `standard` instance types warn.
|
|
112
|
+
- Email bindings should restrict senders or destinations.
|
|
113
|
+
- Legacy module bindings and the old Pipeline `pipeline` field warn with their current replacements.
|
|
114
|
+
|
|
116
115
|
## Runtime primitives
|
|
117
116
|
|
|
118
117
|
### D1 sessions and safe retries
|
|
@@ -128,7 +127,7 @@ await retryIdempotentD1Write({
|
|
|
128
127
|
})
|
|
129
128
|
```
|
|
130
129
|
|
|
131
|
-
One `first-primary` session is cached per request and binding. D1 already retries read-only queries. Write retries require an explicit safety tag. `lock-only` retries SQLite lock contention; `replay-safe` also permits classified
|
|
130
|
+
One `first-primary` session is cached per request and binding. D1 already retries read-only queries. Write retries require an explicit safety tag. `lock-only` retries SQLite lock contention; `replay-safe` also permits classified network and storage reset failures. Resource pressure, queue delay, CPU, and memory errors are never retried.
|
|
132
131
|
|
|
133
132
|
### D1 parameter plans
|
|
134
133
|
|
|
@@ -190,7 +189,7 @@ The writer uses exclusive creation and mode 0600. It removes partial files after
|
|
|
190
189
|
|
|
191
190
|
## Deliberate boundaries
|
|
192
191
|
|
|
193
|
-
The module does not choose Worker names, routes, domains, resource IDs, CPU limits, queue jobs, R2 deletion policy, or deployment promotion. `@harlan-zw/nuxt-cf-jobs` continues to own queues, job durability, recovery, and outbox behavior.
|
|
192
|
+
The module does not choose Worker names, routes, domains, resource IDs, placement, CPU limits, queue jobs, R2 deletion policy, or deployment promotion. `@harlan-zw/nuxt-cf-jobs` continues to own queues, job durability, recovery, and outbox behavior.
|
|
194
193
|
|
|
195
194
|
Next high-value extractions from Nuxt SEO and gscdump:
|
|
196
195
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, dirname } from 'pathe';
|
|
3
|
+
import { unstable_readConfig } from 'wrangler';
|
|
4
|
+
|
|
5
|
+
function errorMessage(error) {
|
|
6
|
+
return error instanceof Error ? error.message : String(error);
|
|
7
|
+
}
|
|
8
|
+
function attempt(run) {
|
|
9
|
+
try {
|
|
10
|
+
return { _tag: "loaded", value: run() };
|
|
11
|
+
} catch (error) {
|
|
12
|
+
return { _tag: "invalid", reason: errorMessage(error) };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function findUpFile(cwd, relativePath) {
|
|
16
|
+
let directory = resolve(cwd);
|
|
17
|
+
while (true) {
|
|
18
|
+
const candidate = resolve(directory, relativePath);
|
|
19
|
+
if (existsSync(candidate))
|
|
20
|
+
return candidate;
|
|
21
|
+
const parent = dirname(directory);
|
|
22
|
+
if (parent === directory)
|
|
23
|
+
return void 0;
|
|
24
|
+
directory = parent;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function findUpWranglerConfig(cwd) {
|
|
28
|
+
let directory = resolve(cwd);
|
|
29
|
+
while (true) {
|
|
30
|
+
for (const name of ["wrangler.json", "wrangler.jsonc", "wrangler.toml"]) {
|
|
31
|
+
const candidate = resolve(directory, name);
|
|
32
|
+
if (existsSync(candidate))
|
|
33
|
+
return candidate;
|
|
34
|
+
}
|
|
35
|
+
const parent = dirname(directory);
|
|
36
|
+
if (parent === directory)
|
|
37
|
+
return void 0;
|
|
38
|
+
directory = parent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function resolveNitroDeployConfig(cwd) {
|
|
42
|
+
const redirectPath = findUpFile(cwd, ".wrangler/deploy/config.json");
|
|
43
|
+
if (!redirectPath)
|
|
44
|
+
return void 0;
|
|
45
|
+
const redirectProjectDirectory = dirname(dirname(dirname(redirectPath)));
|
|
46
|
+
const authoredConfigPath = findUpWranglerConfig(cwd);
|
|
47
|
+
if (authoredConfigPath && dirname(authoredConfigPath) !== redirectProjectDirectory)
|
|
48
|
+
return void 0;
|
|
49
|
+
const parsed = JSON.parse(readFileSync(redirectPath, "utf8"));
|
|
50
|
+
if (!parsed || typeof parsed !== "object" || !("configPath" in parsed) || typeof parsed.configPath !== "string")
|
|
51
|
+
throw new Error(`Invalid Nitro deploy config: ${redirectPath}`);
|
|
52
|
+
return resolve(dirname(redirectPath), parsed.configPath);
|
|
53
|
+
}
|
|
54
|
+
function readProjectWranglerConfig(options) {
|
|
55
|
+
const redirect = attempt(() => options.config ? void 0 : resolveNitroDeployConfig(options.cwd));
|
|
56
|
+
if (redirect._tag === "invalid") {
|
|
57
|
+
return {
|
|
58
|
+
_tag: "invalid",
|
|
59
|
+
generated: false,
|
|
60
|
+
path: findUpFile(options.cwd, ".wrangler/deploy/config.json") ?? resolve(options.cwd, ".wrangler/deploy/config.json"),
|
|
61
|
+
reason: redirect.reason
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const generatedConfigPath = redirect.value;
|
|
65
|
+
const configPath = options.config ? resolve(options.cwd, options.config) : generatedConfigPath;
|
|
66
|
+
const loaded = attempt(() => unstable_readConfig({
|
|
67
|
+
config: configPath,
|
|
68
|
+
env: options.environment,
|
|
69
|
+
script: resolve(options.cwd, "__nuxt-cloudflare-doctor.mjs")
|
|
70
|
+
}, {
|
|
71
|
+
hideWarnings: true,
|
|
72
|
+
useRedirectIfAvailable: false
|
|
73
|
+
}));
|
|
74
|
+
if (loaded._tag === "invalid") {
|
|
75
|
+
return {
|
|
76
|
+
_tag: "invalid",
|
|
77
|
+
generated: generatedConfigPath !== void 0,
|
|
78
|
+
path: configPath,
|
|
79
|
+
reason: loaded.reason
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
_tag: "loaded",
|
|
84
|
+
config: loaded.value,
|
|
85
|
+
generated: generatedConfigPath !== void 0,
|
|
86
|
+
path: loaded.value.configPath
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { readProjectWranglerConfig };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,97 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { defineCommand, runMain } from 'citty';
|
|
4
|
-
import { resolve
|
|
4
|
+
import { resolve } from 'pathe';
|
|
5
5
|
import { d as discoverWranglerSourceConfigs, a as diagnoseWranglerSourceConfigs, p as parseWranglerAllowedWarnings, e as evaluateWranglerDiagnostics } from '../shared/nuxt-cloudflare.6X-qzF_b.mjs';
|
|
6
6
|
import { diagnoseWranglerConfig, formatWranglerDiagnostics } from '../wrangler.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { readProjectWranglerConfig } from '../chunks/wrangler-reader.mjs';
|
|
8
|
+
import 'node:fs';
|
|
9
9
|
import 'node:fs/promises';
|
|
10
|
-
|
|
11
|
-
function errorMessage(error) {
|
|
12
|
-
return error instanceof Error ? error.message : String(error);
|
|
13
|
-
}
|
|
14
|
-
function attempt(run) {
|
|
15
|
-
try {
|
|
16
|
-
return { _tag: "loaded", value: run() };
|
|
17
|
-
} catch (error) {
|
|
18
|
-
return { _tag: "invalid", reason: errorMessage(error) };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function findUpFile(cwd, relativePath) {
|
|
22
|
-
let directory = resolve(cwd);
|
|
23
|
-
while (true) {
|
|
24
|
-
const candidate = resolve(directory, relativePath);
|
|
25
|
-
if (existsSync(candidate))
|
|
26
|
-
return candidate;
|
|
27
|
-
const parent = dirname(directory);
|
|
28
|
-
if (parent === directory)
|
|
29
|
-
return void 0;
|
|
30
|
-
directory = parent;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function findUpWranglerConfig(cwd) {
|
|
34
|
-
let directory = resolve(cwd);
|
|
35
|
-
while (true) {
|
|
36
|
-
for (const name of ["wrangler.json", "wrangler.jsonc", "wrangler.toml"]) {
|
|
37
|
-
const candidate = resolve(directory, name);
|
|
38
|
-
if (existsSync(candidate))
|
|
39
|
-
return candidate;
|
|
40
|
-
}
|
|
41
|
-
const parent = dirname(directory);
|
|
42
|
-
if (parent === directory)
|
|
43
|
-
return void 0;
|
|
44
|
-
directory = parent;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function resolveNitroDeployConfig(cwd) {
|
|
48
|
-
const redirectPath = findUpFile(cwd, ".wrangler/deploy/config.json");
|
|
49
|
-
if (!redirectPath)
|
|
50
|
-
return void 0;
|
|
51
|
-
const redirectProjectDirectory = dirname(dirname(dirname(redirectPath)));
|
|
52
|
-
const authoredConfigPath = findUpWranglerConfig(cwd);
|
|
53
|
-
if (authoredConfigPath && dirname(authoredConfigPath) !== redirectProjectDirectory)
|
|
54
|
-
return void 0;
|
|
55
|
-
const parsed = JSON.parse(readFileSync(redirectPath, "utf8"));
|
|
56
|
-
if (!parsed || typeof parsed !== "object" || !("configPath" in parsed) || typeof parsed.configPath !== "string")
|
|
57
|
-
throw new Error(`Invalid Nitro deploy config: ${redirectPath}`);
|
|
58
|
-
return resolve(dirname(redirectPath), parsed.configPath);
|
|
59
|
-
}
|
|
60
|
-
function readProjectWranglerConfig(options) {
|
|
61
|
-
const redirect = attempt(() => options.config ? void 0 : resolveNitroDeployConfig(options.cwd));
|
|
62
|
-
if (redirect._tag === "invalid") {
|
|
63
|
-
return {
|
|
64
|
-
_tag: "invalid",
|
|
65
|
-
generated: false,
|
|
66
|
-
path: findUpFile(options.cwd, ".wrangler/deploy/config.json") ?? resolve(options.cwd, ".wrangler/deploy/config.json"),
|
|
67
|
-
reason: redirect.reason
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const generatedConfigPath = redirect.value;
|
|
71
|
-
const configPath = options.config ? resolve(options.cwd, options.config) : generatedConfigPath;
|
|
72
|
-
const loaded = attempt(() => unstable_readConfig({
|
|
73
|
-
config: configPath,
|
|
74
|
-
env: options.environment,
|
|
75
|
-
script: resolve(options.cwd, "__nuxt-cloudflare-doctor.mjs")
|
|
76
|
-
}, {
|
|
77
|
-
hideWarnings: true,
|
|
78
|
-
useRedirectIfAvailable: false
|
|
79
|
-
}));
|
|
80
|
-
if (loaded._tag === "invalid") {
|
|
81
|
-
return {
|
|
82
|
-
_tag: "invalid",
|
|
83
|
-
generated: generatedConfigPath !== void 0,
|
|
84
|
-
path: configPath,
|
|
85
|
-
reason: loaded.reason
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
_tag: "loaded",
|
|
90
|
-
config: loaded.value,
|
|
91
|
-
generated: generatedConfigPath !== void 0,
|
|
92
|
-
path: loaded.value.configPath
|
|
93
|
-
};
|
|
94
|
-
}
|
|
10
|
+
import 'wrangler';
|
|
95
11
|
|
|
96
12
|
function diagnoseWranglerProject(options) {
|
|
97
13
|
const sourceConfigPaths = discoverWranglerSourceConfigs(options.cwd, options.config);
|
|
@@ -123,7 +39,7 @@ function diagnoseWranglerProject(options) {
|
|
|
123
39
|
return {
|
|
124
40
|
configPath: loaded.path,
|
|
125
41
|
diagnostics: [
|
|
126
|
-
...diagnoseWranglerConfig(loaded.config, { ...options, generated: loaded.generated }),
|
|
42
|
+
...diagnoseWranglerConfig(loaded.config, { ...options, generated: loaded.generated, normalized: true }),
|
|
127
43
|
...diagnoseWranglerSourceConfigs(sourceConfigPaths)
|
|
128
44
|
],
|
|
129
45
|
sourceConfigPaths
|
|
@@ -187,7 +103,7 @@ const doctor = defineCommand({
|
|
|
187
103
|
const main = defineCommand({
|
|
188
104
|
meta: {
|
|
189
105
|
name: "nuxt-cloudflare",
|
|
190
|
-
version: "0.0.
|
|
106
|
+
version: "0.0.7",
|
|
191
107
|
description: "Cloudflare deployment defaults and diagnostics for Nuxt"
|
|
192
108
|
},
|
|
193
109
|
subCommands: { doctor }
|
package/dist/d1.mjs
CHANGED
|
@@ -3,13 +3,10 @@ const D1_PARAMETER_PLAN = Symbol("@harlan-zw/nuxt-cloudflare:d1-parameter-plan")
|
|
|
3
3
|
const REQUEST_D1_SESSIONS = Symbol.for("@harlan-zw/nuxt-cloudflare:d1-sessions");
|
|
4
4
|
const TRANSIENT_D1_SIGNALS = [
|
|
5
5
|
"Network connection lost",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"exceeded its CPU time limit",
|
|
6
|
+
"D1 DB reset because its code was updated",
|
|
7
|
+
"Internal error while starting up D1 DB storage caused object to be reset",
|
|
8
|
+
"Internal error in D1 DB storage caused object to be reset",
|
|
10
9
|
"storage caused object to be reset",
|
|
11
|
-
"reset because its code was updated",
|
|
12
|
-
"Internal error in D1",
|
|
13
10
|
"cannot resolve d1 db due to transient issue on remote node"
|
|
14
11
|
];
|
|
15
12
|
function consistencyConstraint(consistency) {
|
package/dist/module.d.mts
CHANGED
|
@@ -39,9 +39,10 @@ interface NitroCloudflareShape {
|
|
|
39
39
|
sourceMap?: boolean;
|
|
40
40
|
storage?: Record<string, NitroStorageMount>;
|
|
41
41
|
}
|
|
42
|
+
declare function findPopulatedRuntimeSecretPaths(config: unknown, environment: Readonly<Record<string, string | undefined>>): string[];
|
|
42
43
|
declare function configureNitroCloudflare(nitro: NitroCloudflareShape, options: ModuleOptions, nuxtServerSourceMaps?: boolean): void;
|
|
43
44
|
declare function setupCloudflareModule(options: ModuleOptions, nuxt: Nuxt): void;
|
|
44
45
|
declare const _default: any;
|
|
45
46
|
|
|
46
|
-
export { configureNitroCloudflare, _default as default, setupCloudflareModule };
|
|
47
|
+
export { configureNitroCloudflare, _default as default, findPopulatedRuntimeSecretPaths, setupCloudflareModule };
|
|
47
48
|
export type { ModuleOptions, NitroCloudflareShape };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import { useLogger, defineNuxtModule } from '@nuxt/kit';
|
|
2
3
|
import { resolve } from 'pathe';
|
|
3
4
|
import { a as diagnoseWranglerSourceConfigs, d as discoverWranglerSourceConfigs, e as evaluateWranglerDiagnostics } from './shared/nuxt-cloudflare.6X-qzF_b.mjs';
|
|
@@ -6,14 +7,18 @@ import 'node:fs';
|
|
|
6
7
|
import 'node:fs/promises';
|
|
7
8
|
|
|
8
9
|
const NON_HTML_ROUTE_PREFIXES = [
|
|
10
|
+
"/.well-known",
|
|
9
11
|
"/api",
|
|
10
12
|
"/_ipx",
|
|
11
13
|
"/_nuxt",
|
|
14
|
+
"/_og",
|
|
12
15
|
"/assets",
|
|
13
16
|
"/fonts",
|
|
14
|
-
"/images"
|
|
17
|
+
"/images",
|
|
18
|
+
"/mcp"
|
|
15
19
|
];
|
|
16
20
|
const NON_HTML_EXTENSION_RE = /\.(?:avif|css|csv|gif|ico|jpe?g|js|json|map|md|mjs|pdf|png|svg|txt|webmanifest|webp|woff2?|xml)(?:$|[?*])/i;
|
|
21
|
+
const HTML_CONTENT_TYPE_RE = /^(?:application\/xhtml\+xml|text\/html)(?:\s*;|$)/i;
|
|
17
22
|
const CACHE_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
18
23
|
"cache-control",
|
|
19
24
|
"cdn-cache-control",
|
|
@@ -24,25 +29,47 @@ const PRIVATE_CACHE_DIRECTIVE_RE = /(?:^|,)\s*(?:no-store|private)\s*(?:,|$)/i;
|
|
|
24
29
|
function isRecord(value) {
|
|
25
30
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26
31
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
32
|
+
function findHeader(headers, name) {
|
|
33
|
+
const entry = Object.entries(headers).find(([header]) => header.toLowerCase() === name);
|
|
34
|
+
return entry?.[1];
|
|
35
|
+
}
|
|
36
|
+
function hasExplicitNonHtmlContentType(value) {
|
|
37
|
+
if (!isRecord(value.headers))
|
|
38
|
+
return false;
|
|
39
|
+
const contentType = findHeader(value.headers, "content-type");
|
|
40
|
+
return typeof contentType === "string" && !HTML_CONTENT_TYPE_RE.test(contentType);
|
|
41
|
+
}
|
|
42
|
+
function hasHtmlContentType(headers) {
|
|
43
|
+
if (!headers)
|
|
44
|
+
return false;
|
|
45
|
+
const contentType = findHeader(headers, "content-type");
|
|
46
|
+
return typeof contentType === "string" && HTML_CONTENT_TYPE_RE.test(contentType);
|
|
47
|
+
}
|
|
48
|
+
function isHtmlCapableRoute(route, value) {
|
|
49
|
+
if (NON_HTML_EXTENSION_RE.test(route) || hasExplicitNonHtmlContentType(value))
|
|
29
50
|
return false;
|
|
30
51
|
return !NON_HTML_ROUTE_PREFIXES.some((prefix) => route === prefix || route.startsWith(`${prefix}/`));
|
|
31
52
|
}
|
|
32
53
|
function isPrivateCachePolicy(value) {
|
|
33
54
|
return typeof value === "string" && PRIVATE_CACHE_DIRECTIVE_RE.test(value);
|
|
34
55
|
}
|
|
56
|
+
function resolveViolationSeverity(route, value) {
|
|
57
|
+
const definitelyHtml = value.prerender === true || /\.html(?:$|[?*])/i.test(route) || hasHtmlContentType(isRecord(value.headers) ? value.headers : void 0);
|
|
58
|
+
return definitelyHtml ? "error" : "warning";
|
|
59
|
+
}
|
|
35
60
|
function findHtmlCacheRouteRuleViolations(routeRules) {
|
|
36
61
|
if (!routeRules)
|
|
37
62
|
return [];
|
|
38
63
|
return Object.entries(routeRules).flatMap(([route, value]) => {
|
|
39
|
-
if (!
|
|
64
|
+
if (!isRecord(value) || !isHtmlCapableRoute(route, value))
|
|
40
65
|
return [];
|
|
66
|
+
const severity = resolveViolationSeverity(route, value);
|
|
41
67
|
const violations = [];
|
|
42
68
|
for (const name of CACHE_ROUTE_RULE_NAMES) {
|
|
43
69
|
if (value[name] !== void 0 && value[name] !== false) {
|
|
44
70
|
violations.push({
|
|
45
71
|
_tag: "html-cache-route-rule",
|
|
72
|
+
severity,
|
|
46
73
|
route,
|
|
47
74
|
configPath: `routeRules.${route}.${name}`
|
|
48
75
|
});
|
|
@@ -54,6 +81,7 @@ function findHtmlCacheRouteRuleViolations(routeRules) {
|
|
|
54
81
|
if (CACHE_HEADER_NAMES.has(name.toLowerCase()) && !isPrivateCachePolicy(value.headers[name])) {
|
|
55
82
|
violations.push({
|
|
56
83
|
_tag: "html-cache-header",
|
|
84
|
+
severity,
|
|
57
85
|
route,
|
|
58
86
|
configPath: `routeRules.${route}.headers.${name}`
|
|
59
87
|
});
|
|
@@ -63,7 +91,10 @@ function findHtmlCacheRouteRuleViolations(routeRules) {
|
|
|
63
91
|
});
|
|
64
92
|
}
|
|
65
93
|
function formatHtmlCacheRouteRuleViolations(violations) {
|
|
66
|
-
return violations.map((violation) =>
|
|
94
|
+
return violations.map((violation) => {
|
|
95
|
+
const subject = violation.severity === "error" ? "HTML route" : "Potential HTML route";
|
|
96
|
+
return `${violation.configPath}: ${subject} must remain private and no-store when Workers Cache is enabled.`;
|
|
97
|
+
}).join("\n");
|
|
67
98
|
}
|
|
68
99
|
|
|
69
100
|
const logger = useLogger("nuxt-cloudflare");
|
|
@@ -72,9 +103,34 @@ const workersCachePluginPath = resolve(
|
|
|
72
103
|
import.meta.dirname,
|
|
73
104
|
import.meta.url.endsWith(".ts") ? "runtime/server/plugins/workers-cache.ts" : "runtime/server/plugins/workers-cache.js"
|
|
74
105
|
);
|
|
106
|
+
const BUILD_SECRET_ENV_RE = /(?:^|_)(?:API_?KEY|AUTH_TOKEN|CLIENT_SECRET|CREDENTIALS?|ENCRYPTION_KEY|PASSWORD|PRIVATE_KEY|SECRET|SIGNING_KEY|TOKEN|SALT)(?:_|$)/i;
|
|
107
|
+
const REQUIRED_BUILD_SECRET_NAMES = /* @__PURE__ */ new Set(["NUXT_SCRIPTS_PROXY_SECRET"]);
|
|
75
108
|
function resolveModuleWorkersCachePolicy(options) {
|
|
76
109
|
return options.workersCache ?? { _tag: "enabled", crossVersion: false };
|
|
77
110
|
}
|
|
111
|
+
function findPopulatedRuntimeSecretPaths(config, environment) {
|
|
112
|
+
const paths = [];
|
|
113
|
+
const buildSecretValues = new Set(Object.entries(environment).flatMap(([name, value]) => {
|
|
114
|
+
return BUILD_SECRET_ENV_RE.test(name) && !REQUIRED_BUILD_SECRET_NAMES.has(name) && value && value.length >= 8 ? [value] : [];
|
|
115
|
+
}));
|
|
116
|
+
const visit = (value, parents) => {
|
|
117
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
118
|
+
return;
|
|
119
|
+
for (const [key, child] of Object.entries(value)) {
|
|
120
|
+
const path = [...parents, key];
|
|
121
|
+
if (path[0] === "public")
|
|
122
|
+
continue;
|
|
123
|
+
if (child && typeof child === "object" && !Array.isArray(child)) {
|
|
124
|
+
visit(child, path);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (typeof child === "string" && buildSecretValues.has(child))
|
|
128
|
+
paths.push(path.join("."));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
visit(config, []);
|
|
132
|
+
return paths;
|
|
133
|
+
}
|
|
78
134
|
function configureNitroCloudflare(nitro, options, nuxtServerSourceMaps) {
|
|
79
135
|
nitro.preset ??= "cloudflare-module";
|
|
80
136
|
nitro.cloudflare ??= {};
|
|
@@ -115,6 +171,10 @@ async function auditGeneratedWranglerConfig(nitro, options, rootDir) {
|
|
|
115
171
|
throw new Error(`[nuxt-cloudflare] Generated Wrangler config is missing: ${path}`);
|
|
116
172
|
if (result._tag === "invalid")
|
|
117
173
|
throw new Error(`[nuxt-cloudflare] Generated Wrangler config is invalid: ${result.reason}`);
|
|
174
|
+
const { readProjectWranglerConfig } = await import('./chunks/wrangler-reader.mjs');
|
|
175
|
+
const validated = readProjectWranglerConfig({ config: path, cwd: rootDir });
|
|
176
|
+
if (validated._tag === "invalid")
|
|
177
|
+
throw new Error("[nuxt-cloudflare] Generated Wrangler config fails Wrangler schema validation. Run Wrangler locally for validation details.");
|
|
118
178
|
const diagnostics = [
|
|
119
179
|
...diagnoseWranglerConfig(result.config, {
|
|
120
180
|
compatibilityMaxAgeDays: options.compatibilityMaxAgeDays,
|
|
@@ -147,15 +207,25 @@ function setupCloudflareModule(options, nuxt) {
|
|
|
147
207
|
configure();
|
|
148
208
|
nuxt.hook("modules:done", () => {
|
|
149
209
|
configure();
|
|
210
|
+
if (nuxt.options.dev)
|
|
211
|
+
return;
|
|
212
|
+
const populatedRuntimeSecrets = findPopulatedRuntimeSecretPaths(nuxt.options.runtimeConfig, process.env);
|
|
213
|
+
if (populatedRuntimeSecrets.length > 0) {
|
|
214
|
+
throw new Error(`[nuxt-cloudflare] Runtime config contains secret build environment values: ${populatedRuntimeSecrets.join(", ")}. Keep defaults empty and use Worker secret bindings.`);
|
|
215
|
+
}
|
|
150
216
|
});
|
|
151
217
|
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
152
218
|
if (resolveModuleWorkersCachePolicy(options)._tag === "disabled")
|
|
153
219
|
return;
|
|
154
220
|
const violations = findHtmlCacheRouteRuleViolations(nitroConfig.routeRules);
|
|
155
|
-
|
|
221
|
+
const warnings = violations.filter((violation) => violation.severity === "warning");
|
|
222
|
+
const errors = violations.filter((violation) => violation.severity === "error");
|
|
223
|
+
if (warnings.length > 0)
|
|
224
|
+
logger.warn(formatHtmlCacheRouteRuleViolations(warnings));
|
|
225
|
+
if (errors.length > 0) {
|
|
156
226
|
throw new Error(
|
|
157
227
|
`[nuxt-cloudflare] HTML route rules conflict with Workers Caching:
|
|
158
|
-
${formatHtmlCacheRouteRuleViolations(
|
|
228
|
+
${formatHtmlCacheRouteRuleViolations(errors)}`
|
|
159
229
|
);
|
|
160
230
|
}
|
|
161
231
|
});
|
|
@@ -183,4 +253,4 @@ const module$1 = defineNuxtModule({
|
|
|
183
253
|
setup: setupCloudflareModule
|
|
184
254
|
});
|
|
185
255
|
|
|
186
|
-
export { configureNitroCloudflare, module$1 as default, setupCloudflareModule };
|
|
256
|
+
export { configureNitroCloudflare, module$1 as default, findPopulatedRuntimeSecretPaths, setupCloudflareModule };
|
package/dist/storage.mjs
CHANGED
|
@@ -17,7 +17,7 @@ function withDefaultKvExpiration(driver, defaultTtl) {
|
|
|
17
17
|
flags: { ...driver.flags, ttl: true },
|
|
18
18
|
setItem(key, value, transactionOptions = {}) {
|
|
19
19
|
const requestedTtl = Number(transactionOptions.ttl);
|
|
20
|
-
const ttl = Number.isFinite(requestedTtl) && requestedTtl > 0 ? requestedTtl : parsedDefaultTtl;
|
|
20
|
+
const ttl = Number.isFinite(requestedTtl) && requestedTtl > 0 ? Math.max(requestedTtl, 60) : parsedDefaultTtl;
|
|
21
21
|
return setItem(key, value, { ...transactionOptions, ttl });
|
|
22
22
|
}
|
|
23
23
|
};
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { type configureNitroCloudflare, default, type setupCloudflareModule } from './module.mjs'
|
|
1
|
+
export { type configureNitroCloudflare, default, type findPopulatedRuntimeSecretPaths, type setupCloudflareModule } from './module.mjs'
|
|
2
2
|
|
|
3
3
|
export { type ModuleOptions, type NitroCloudflareShape } from './module.mjs'
|
package/dist/wrangler.d.mts
CHANGED
|
@@ -28,6 +28,15 @@ type WranglerPlacementInput = {
|
|
|
28
28
|
hostname?: never;
|
|
29
29
|
mode?: never;
|
|
30
30
|
};
|
|
31
|
+
interface WranglerRemoteBindingInput extends Record<string, unknown> {
|
|
32
|
+
binding?: string;
|
|
33
|
+
remote?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface WranglerContainerInput extends Record<string, unknown> {
|
|
36
|
+
class_name?: string;
|
|
37
|
+
image?: string;
|
|
38
|
+
instance_type?: string | Record<string, unknown>;
|
|
39
|
+
}
|
|
31
40
|
type WorkersCachePolicy = {
|
|
32
41
|
_tag: 'disabled';
|
|
33
42
|
} | {
|
|
@@ -48,12 +57,17 @@ interface WranglerObservabilityInput {
|
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
interface WranglerConfigInput extends Record<string, unknown> {
|
|
60
|
+
ai?: WranglerRemoteBindingInput;
|
|
51
61
|
assets?: WranglerAssetsInput;
|
|
62
|
+
browser?: WranglerRemoteBindingInput;
|
|
52
63
|
cache?: WranglerWorkersCacheInput;
|
|
53
64
|
compatibility_date?: string;
|
|
54
65
|
compatibility_flags?: string[];
|
|
66
|
+
containers?: WranglerContainerInput[];
|
|
55
67
|
env?: Record<string, WranglerConfigInput>;
|
|
68
|
+
images?: WranglerRemoteBindingInput;
|
|
56
69
|
keep_vars?: boolean;
|
|
70
|
+
mtls_certificates?: WranglerRemoteBindingInput[];
|
|
57
71
|
observability?: WranglerObservabilityInput;
|
|
58
72
|
placement?: WranglerPlacementInput;
|
|
59
73
|
preview_urls?: boolean;
|
|
@@ -66,6 +80,7 @@ interface WranglerConfigInput extends Record<string, unknown> {
|
|
|
66
80
|
secrets?: {
|
|
67
81
|
required?: string[];
|
|
68
82
|
};
|
|
83
|
+
vectorize?: WranglerRemoteBindingInput[];
|
|
69
84
|
upload_source_maps?: boolean;
|
|
70
85
|
vars?: Record<string, unknown>;
|
|
71
86
|
version_metadata?: {
|
|
@@ -82,7 +97,7 @@ interface CloudflareDefaultOptions {
|
|
|
82
97
|
versionMetadataBinding?: string;
|
|
83
98
|
workersCache?: WorkersCachePolicy;
|
|
84
99
|
}
|
|
85
|
-
declare const WRANGLER_DIAGNOSTIC_CODES: readonly ["assets-worker-first", "assets-worker-first-pattern-invalid", "compatibility-date-missing", "compatibility-date-invalid", "durable-object-binding-inactive", "durable-object-lifecycle-mixed", "durable-object-lifecycle-unmanaged", "generated-config-has-env", "keep-vars-enabled", "missing-nodejs-compat", "nodejs-compat-version-implicit", "observability-disabled", "observability-sampling-implicit", "observability-sampling-out-of-range", "plaintext-secret-var", "preview-urls-public", "queue-dlq-missing", "queue-retries-above-policy", "queue-retries-out-of-range", "queue-retry-delay-out-of-range", "secret-declared-as-var", "source-maps-disabled", "stale-compatibility-date", "traces-disabled", "version-metadata-missing", "workers-dev-enabled", "workers-dev-implicit", "workers-cache-cross-version-enabled", "workers-cache-policy-implicit", "wrangler-config-shadowed", "wrangler-config-missing", "wrangler-config-unreadable", "wrangler-jsonc-preferred"];
|
|
100
|
+
declare const WRANGLER_DIAGNOSTIC_CODES: readonly ["assets-worker-first", "assets-worker-first-pattern-invalid", "compatibility-date-missing", "compatibility-date-invalid", "container-durable-object-binding-missing", "container-durable-object-not-sqlite", "container-instance-type-deprecated", "durable-object-binding-inactive", "durable-object-lifecycle-mixed", "durable-object-lifecycle-unmanaged", "email-binding-unrestricted", "environment-binding-missing", "generated-config-has-env", "keep-vars-enabled", "legacy-module-binding", "missing-nodejs-compat", "nodejs-compat-version-implicit", "observability-disabled", "observability-sampling-implicit", "observability-sampling-out-of-range", "plaintext-secret-var", "preview-urls-public", "pipeline-binding-deprecated", "queue-dlq-missing", "queue-retries-above-policy", "queue-retries-out-of-range", "queue-retry-delay-out-of-range", "secret-declared-as-var", "source-maps-disabled", "stale-compatibility-date", "traces-disabled", "remote-binding-not-enabled", "unsafe-hello-world-binding", "version-metadata-missing", "workers-dev-enabled", "workers-dev-implicit", "workers-cache-cross-version-enabled", "workers-cache-policy-implicit", "wrangler-config-shadowed", "wrangler-config-missing", "wrangler-config-unreadable", "wrangler-jsonc-preferred"];
|
|
86
101
|
type WranglerDiagnosticCode = typeof WRANGLER_DIAGNOSTIC_CODES[number];
|
|
87
102
|
interface WranglerDiagnostic {
|
|
88
103
|
_tag: 'error' | 'info' | 'warning';
|
|
@@ -95,6 +110,7 @@ interface WranglerDiagnosticOptions {
|
|
|
95
110
|
compatibilityMaxAgeDays?: number;
|
|
96
111
|
generated?: boolean;
|
|
97
112
|
now?: Date;
|
|
113
|
+
normalized?: boolean;
|
|
98
114
|
publicVarNames?: readonly string[];
|
|
99
115
|
requireNodeCompat?: boolean;
|
|
100
116
|
}
|
|
@@ -116,4 +132,4 @@ declare function formatWranglerDiagnostics(diagnostics: readonly WranglerDiagnos
|
|
|
116
132
|
declare function readWranglerJsonFile(path: string): Promise<WranglerJsonFileResult>;
|
|
117
133
|
|
|
118
134
|
export { WRANGLER_DIAGNOSTIC_CODES, applyCloudflareDefaults, diagnoseWranglerConfig, formatWranglerDiagnostics, readWranglerJsonFile };
|
|
119
|
-
export type { CloudflareDefaultOptions, WorkersCachePolicy, WranglerAssetsInput, WranglerConfigInput, WranglerDiagnostic, WranglerDiagnosticCode, WranglerDiagnosticOptions, WranglerJsonFileResult, WranglerObservabilityInput, WranglerPlacementInput, WranglerWorkersCacheInput };
|
|
135
|
+
export type { CloudflareDefaultOptions, WorkersCachePolicy, WranglerAssetsInput, WranglerConfigInput, WranglerContainerInput, WranglerDiagnostic, WranglerDiagnosticCode, WranglerDiagnosticOptions, WranglerJsonFileResult, WranglerObservabilityInput, WranglerPlacementInput, WranglerRemoteBindingInput, WranglerWorkersCacheInput };
|
package/dist/wrangler.mjs
CHANGED
|
@@ -5,11 +5,17 @@ const WRANGLER_DIAGNOSTIC_CODES = [
|
|
|
5
5
|
"assets-worker-first-pattern-invalid",
|
|
6
6
|
"compatibility-date-missing",
|
|
7
7
|
"compatibility-date-invalid",
|
|
8
|
+
"container-durable-object-binding-missing",
|
|
9
|
+
"container-durable-object-not-sqlite",
|
|
10
|
+
"container-instance-type-deprecated",
|
|
8
11
|
"durable-object-binding-inactive",
|
|
9
12
|
"durable-object-lifecycle-mixed",
|
|
10
13
|
"durable-object-lifecycle-unmanaged",
|
|
14
|
+
"email-binding-unrestricted",
|
|
15
|
+
"environment-binding-missing",
|
|
11
16
|
"generated-config-has-env",
|
|
12
17
|
"keep-vars-enabled",
|
|
18
|
+
"legacy-module-binding",
|
|
13
19
|
"missing-nodejs-compat",
|
|
14
20
|
"nodejs-compat-version-implicit",
|
|
15
21
|
"observability-disabled",
|
|
@@ -17,6 +23,7 @@ const WRANGLER_DIAGNOSTIC_CODES = [
|
|
|
17
23
|
"observability-sampling-out-of-range",
|
|
18
24
|
"plaintext-secret-var",
|
|
19
25
|
"preview-urls-public",
|
|
26
|
+
"pipeline-binding-deprecated",
|
|
20
27
|
"queue-dlq-missing",
|
|
21
28
|
"queue-retries-above-policy",
|
|
22
29
|
"queue-retries-out-of-range",
|
|
@@ -25,6 +32,8 @@ const WRANGLER_DIAGNOSTIC_CODES = [
|
|
|
25
32
|
"source-maps-disabled",
|
|
26
33
|
"stale-compatibility-date",
|
|
27
34
|
"traces-disabled",
|
|
35
|
+
"remote-binding-not-enabled",
|
|
36
|
+
"unsafe-hello-world-binding",
|
|
28
37
|
"version-metadata-missing",
|
|
29
38
|
"workers-dev-enabled",
|
|
30
39
|
"workers-dev-implicit",
|
|
@@ -60,11 +69,6 @@ function resolveWorkersCachePolicy(policy) {
|
|
|
60
69
|
return { enabled: false, cross_version_cache: false };
|
|
61
70
|
return { enabled: true, cross_version_cache: policy.crossVersion };
|
|
62
71
|
}
|
|
63
|
-
function resolveAuthoredWorkersCache(cache) {
|
|
64
|
-
if (!cache)
|
|
65
|
-
return resolveWorkersCachePolicy({ _tag: "disabled" });
|
|
66
|
-
return { ...cache, cross_version_cache: cache.cross_version_cache ?? false };
|
|
67
|
-
}
|
|
68
72
|
const WRANGLER_BINDING_CATEGORIES = [
|
|
69
73
|
"data_blobs",
|
|
70
74
|
"durable_objects",
|
|
@@ -98,39 +102,142 @@ const WRANGLER_BINDING_CATEGORIES = [
|
|
|
98
102
|
"secrets_store_secrets",
|
|
99
103
|
"artifacts",
|
|
100
104
|
"ratelimits",
|
|
105
|
+
"worker_loaders",
|
|
106
|
+
"vpc_services",
|
|
107
|
+
"vpc_networks",
|
|
101
108
|
"assets",
|
|
102
109
|
"unsafe_hello_world",
|
|
103
110
|
"flagship"
|
|
104
111
|
];
|
|
105
|
-
|
|
112
|
+
const WRANGLER_RECORD_BINDING_CATEGORIES = /* @__PURE__ */ new Set([
|
|
113
|
+
"cloudchamber",
|
|
114
|
+
"data_blobs",
|
|
115
|
+
"define",
|
|
116
|
+
"text_blobs",
|
|
117
|
+
"vars",
|
|
118
|
+
"wasm_modules"
|
|
119
|
+
]);
|
|
120
|
+
const WRANGLER_NON_INHERITED_BINDING_CATEGORIES = [
|
|
121
|
+
"agent_memory",
|
|
122
|
+
"ai",
|
|
123
|
+
"ai_search",
|
|
124
|
+
"ai_search_namespaces",
|
|
125
|
+
"analytics_engine_datasets",
|
|
126
|
+
"artifacts",
|
|
127
|
+
"browser",
|
|
128
|
+
"cloudchamber",
|
|
129
|
+
"containers",
|
|
130
|
+
"d1_databases",
|
|
131
|
+
"data_blobs",
|
|
132
|
+
"define",
|
|
133
|
+
"dispatch_namespaces",
|
|
134
|
+
"durable_objects",
|
|
135
|
+
"flagship",
|
|
136
|
+
"hyperdrive",
|
|
137
|
+
"images",
|
|
138
|
+
"kv_namespaces",
|
|
139
|
+
"logfwdr",
|
|
140
|
+
"media",
|
|
141
|
+
"mtls_certificates",
|
|
142
|
+
"pipelines",
|
|
143
|
+
"queues",
|
|
144
|
+
"r2_buckets",
|
|
145
|
+
"ratelimits",
|
|
146
|
+
"secrets",
|
|
147
|
+
"secrets_store_secrets",
|
|
148
|
+
"send_email",
|
|
149
|
+
"services",
|
|
150
|
+
"stream",
|
|
151
|
+
"streaming_tail_consumers",
|
|
152
|
+
"tail_consumers",
|
|
153
|
+
"text_blobs",
|
|
154
|
+
"unsafe",
|
|
155
|
+
"unsafe_hello_world",
|
|
156
|
+
"vars",
|
|
157
|
+
"vectorize",
|
|
158
|
+
"version_metadata",
|
|
159
|
+
"vpc_networks",
|
|
160
|
+
"vpc_services",
|
|
161
|
+
"wasm_modules",
|
|
162
|
+
"websearch",
|
|
163
|
+
"worker_loaders",
|
|
164
|
+
"workflows"
|
|
165
|
+
];
|
|
166
|
+
function addBindingNames(names, value, category) {
|
|
106
167
|
if (Array.isArray(value)) {
|
|
107
168
|
value.forEach((entry) => {
|
|
108
|
-
if (isRecord(entry)
|
|
169
|
+
if (!isRecord(entry))
|
|
170
|
+
return;
|
|
171
|
+
if (typeof entry.binding === "string")
|
|
109
172
|
names.add(entry.binding);
|
|
173
|
+
else if (typeof entry.name === "string")
|
|
174
|
+
names.add(entry.name);
|
|
175
|
+
else if (category === "containers" && typeof entry.class_name === "string")
|
|
176
|
+
names.add(entry.class_name);
|
|
177
|
+
else if ((category === "tail_consumers" || category === "streaming_tail_consumers") && typeof entry.service === "string")
|
|
178
|
+
names.add(entry.service);
|
|
110
179
|
});
|
|
111
180
|
return;
|
|
112
181
|
}
|
|
113
182
|
if (!isRecord(value))
|
|
114
183
|
return;
|
|
115
|
-
if (Array.isArray(value.bindings)
|
|
116
|
-
value.bindings.forEach((binding) =>
|
|
184
|
+
if (Array.isArray(value.bindings)) {
|
|
185
|
+
value.bindings.forEach((binding) => {
|
|
186
|
+
if (isRecord(binding) && typeof binding.name === "string")
|
|
187
|
+
names.add(binding.name);
|
|
188
|
+
});
|
|
117
189
|
return;
|
|
118
190
|
}
|
|
119
191
|
if (typeof value.binding === "string") {
|
|
120
192
|
names.add(value.binding);
|
|
121
193
|
return;
|
|
122
194
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
195
|
+
if (category && WRANGLER_RECORD_BINDING_CATEGORIES.has(category)) {
|
|
196
|
+
Object.entries(value).forEach(([name, binding]) => {
|
|
197
|
+
if (binding !== void 0)
|
|
198
|
+
names.add(name);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
127
201
|
}
|
|
128
202
|
function collectBindingNames(config) {
|
|
129
203
|
const names = new Set(config.secrets?.required ?? []);
|
|
130
|
-
WRANGLER_BINDING_CATEGORIES.forEach((category) => addBindingNames(names, config[category]));
|
|
204
|
+
WRANGLER_BINDING_CATEGORIES.forEach((category) => addBindingNames(names, config[category], category));
|
|
131
205
|
addBindingNames(names, config.queues?.producers);
|
|
132
206
|
return names;
|
|
133
207
|
}
|
|
208
|
+
function collectCategoryBindingNames(config, category) {
|
|
209
|
+
if (category === "secrets")
|
|
210
|
+
return new Set(config.secrets?.required ?? []);
|
|
211
|
+
const names = /* @__PURE__ */ new Set();
|
|
212
|
+
if (category === "queues") {
|
|
213
|
+
addBindingNames(names, config.queues?.producers);
|
|
214
|
+
config.queues?.consumers?.forEach((consumer) => {
|
|
215
|
+
if (typeof consumer.queue === "string")
|
|
216
|
+
names.add(consumer.queue);
|
|
217
|
+
});
|
|
218
|
+
} else {
|
|
219
|
+
addBindingNames(names, config[category], category);
|
|
220
|
+
}
|
|
221
|
+
return names;
|
|
222
|
+
}
|
|
223
|
+
function configuredRemoteBindings(config) {
|
|
224
|
+
const bindings = [];
|
|
225
|
+
for (const category of ["ai", "browser", "images"]) {
|
|
226
|
+
const value = config[category];
|
|
227
|
+
if (isRecord(value) && typeof value.binding === "string")
|
|
228
|
+
bindings.push({ path: category, value });
|
|
229
|
+
}
|
|
230
|
+
for (const category of ["flagship", "mtls_certificates", "vectorize"]) {
|
|
231
|
+
const value = config[category];
|
|
232
|
+
if (!Array.isArray(value))
|
|
233
|
+
continue;
|
|
234
|
+
value.forEach((entry, index) => {
|
|
235
|
+
if (isRecord(entry) && typeof entry.binding === "string")
|
|
236
|
+
bindings.push({ path: `${category}.${index}`, value: entry });
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return bindings;
|
|
240
|
+
}
|
|
134
241
|
function applyCloudflareDefaults(config, options = {}) {
|
|
135
242
|
const root = applyEnvironmentDefaults(config, options);
|
|
136
243
|
const environments = config.env && Object.fromEntries(
|
|
@@ -144,7 +251,8 @@ function applyCloudflareDefaults(config, options = {}) {
|
|
|
144
251
|
function applyEnvironmentDefaults(config, options, inherited = {}) {
|
|
145
252
|
const compatibilityDate = config.compatibility_date ?? inherited.compatibility_date ?? options.compatibilityDate;
|
|
146
253
|
const compatibilityFlags = unique([...config.compatibility_flags ?? inherited.compatibility_flags ?? [], "nodejs_compat"]);
|
|
147
|
-
const
|
|
254
|
+
const authoredCache = config.cache ?? inherited.cache;
|
|
255
|
+
const cache = options.workersCache ? resolveWorkersCachePolicy(options.workersCache) : authoredCache ? { ...authoredCache, cross_version_cache: authoredCache.cross_version_cache ?? false } : resolveWorkersCachePolicy({ _tag: "disabled" });
|
|
148
256
|
const requiredSecrets = unique([...config.secrets?.required ?? [], ...options.requiredSecrets ?? []]);
|
|
149
257
|
const logs = config.observability?.logs;
|
|
150
258
|
const inheritedLogs = inherited.observability?.logs;
|
|
@@ -188,13 +296,13 @@ function applyEnvironmentDefaults(config, options, inherited = {}) {
|
|
|
188
296
|
...workersDev === void 0 ? {} : { workers_dev: workersDev }
|
|
189
297
|
};
|
|
190
298
|
}
|
|
191
|
-
function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
299
|
+
function diagnoseEnvironment(config, prefix, diagnostics, generated, normalized, publicVarNames) {
|
|
192
300
|
const workerFirst = config.assets?.run_worker_first;
|
|
193
301
|
if (workerFirst === true) {
|
|
194
302
|
diagnostics.push({
|
|
195
|
-
_tag: "
|
|
303
|
+
_tag: "warning",
|
|
196
304
|
code: "assets-worker-first",
|
|
197
|
-
message: "
|
|
305
|
+
message: "Blanket Worker-first routing invokes the Worker for every asset. Use it only when authentication or response transforms require it.",
|
|
198
306
|
configPath: `${prefix}assets.run_worker_first`
|
|
199
307
|
});
|
|
200
308
|
} else if (Array.isArray(workerFirst)) {
|
|
@@ -219,7 +327,9 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
219
327
|
}
|
|
220
328
|
const durableObjectExports = isRecord(config.exports) ? Object.entries(config.exports).filter(([, value]) => isRecord(value) && value.type === "durable-object") : [];
|
|
221
329
|
const migrations = Array.isArray(config.migrations) ? config.migrations : [];
|
|
222
|
-
|
|
330
|
+
const hasExports = normalized ? durableObjectExports.length > 0 : Object.hasOwn(config, "exports");
|
|
331
|
+
const hasMigrations = normalized ? migrations.length > 0 : Object.hasOwn(config, "migrations");
|
|
332
|
+
if (hasExports && hasMigrations) {
|
|
223
333
|
diagnostics.push({
|
|
224
334
|
_tag: "error",
|
|
225
335
|
code: "durable-object-lifecycle-mixed",
|
|
@@ -235,7 +345,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
235
345
|
return [binding.class_name];
|
|
236
346
|
});
|
|
237
347
|
const inactiveExportedClassNames = new Set(durableObjectExports.flatMap(([name, value]) => {
|
|
238
|
-
if (!isRecord(value) || value.state === void 0 || value.state === "created")
|
|
348
|
+
if (!isRecord(value) || value.state === void 0 || value.state === "created" || value.state === "expecting-transfer")
|
|
239
349
|
return [];
|
|
240
350
|
return [name];
|
|
241
351
|
}));
|
|
@@ -243,12 +353,18 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
243
353
|
diagnostics.push({
|
|
244
354
|
_tag: "error",
|
|
245
355
|
code: "durable-object-binding-inactive",
|
|
246
|
-
message: "A Durable Object binding may target only an active declarative export
|
|
356
|
+
message: "A Durable Object binding may target only an active declarative export.",
|
|
247
357
|
configPath: `${prefix}durable_objects.bindings`
|
|
248
358
|
});
|
|
249
359
|
}
|
|
250
360
|
const exportedClassNames = new Set(durableObjectExports.map(([name]) => name));
|
|
361
|
+
const exportedClassStorage = new Map(durableObjectExports.flatMap(([name, value]) => {
|
|
362
|
+
if (!isRecord(value) || value.storage !== "sqlite" && value.storage !== "legacy-kv")
|
|
363
|
+
return [];
|
|
364
|
+
return [[name, value.storage]];
|
|
365
|
+
}));
|
|
251
366
|
const migratedClassNames = /* @__PURE__ */ new Set();
|
|
367
|
+
const migratedClassStorage = /* @__PURE__ */ new Map();
|
|
252
368
|
for (const migration of migrations) {
|
|
253
369
|
if (!isRecord(migration))
|
|
254
370
|
continue;
|
|
@@ -257,6 +373,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
257
373
|
for (const className of migration[key]) {
|
|
258
374
|
if (typeof className === "string") {
|
|
259
375
|
migratedClassNames.add(className);
|
|
376
|
+
migratedClassStorage.set(className, key === "new_sqlite_classes" ? "sqlite" : "legacy-kv");
|
|
260
377
|
}
|
|
261
378
|
}
|
|
262
379
|
}
|
|
@@ -265,10 +382,16 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
265
382
|
for (const rename of migration.renamed_classes) {
|
|
266
383
|
if (!isRecord(rename))
|
|
267
384
|
continue;
|
|
268
|
-
|
|
385
|
+
const storage = typeof rename.from === "string" ? migratedClassStorage.get(rename.from) : void 0;
|
|
386
|
+
if (typeof rename.from === "string") {
|
|
269
387
|
migratedClassNames.delete(rename.from);
|
|
270
|
-
|
|
388
|
+
migratedClassStorage.delete(rename.from);
|
|
389
|
+
}
|
|
390
|
+
if (typeof rename.to === "string") {
|
|
271
391
|
migratedClassNames.add(rename.to);
|
|
392
|
+
if (storage)
|
|
393
|
+
migratedClassStorage.set(rename.to, storage);
|
|
394
|
+
}
|
|
272
395
|
}
|
|
273
396
|
}
|
|
274
397
|
if (Array.isArray(migration.transferred_classes)) {
|
|
@@ -281,6 +404,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
281
404
|
for (const className of migration.deleted_classes) {
|
|
282
405
|
if (typeof className === "string") {
|
|
283
406
|
migratedClassNames.delete(className);
|
|
407
|
+
migratedClassStorage.delete(className);
|
|
284
408
|
}
|
|
285
409
|
}
|
|
286
410
|
}
|
|
@@ -293,6 +417,91 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
293
417
|
configPath: `${prefix}durable_objects.bindings`
|
|
294
418
|
});
|
|
295
419
|
}
|
|
420
|
+
for (const [index, container] of (config.containers ?? []).entries()) {
|
|
421
|
+
if (typeof container.class_name !== "string")
|
|
422
|
+
continue;
|
|
423
|
+
const configPath = `${prefix}containers.${index}.class_name`;
|
|
424
|
+
if (!localClassNames.includes(container.class_name)) {
|
|
425
|
+
diagnostics.push({
|
|
426
|
+
_tag: "error",
|
|
427
|
+
code: "container-durable-object-binding-missing",
|
|
428
|
+
message: `Container class ${container.class_name} needs a matching local Durable Object binding.`,
|
|
429
|
+
configPath
|
|
430
|
+
});
|
|
431
|
+
} else if (exportedClassStorage.get(container.class_name) === "legacy-kv" || migratedClassStorage.get(container.class_name) === "legacy-kv") {
|
|
432
|
+
diagnostics.push({
|
|
433
|
+
_tag: "error",
|
|
434
|
+
code: "container-durable-object-not-sqlite",
|
|
435
|
+
message: `Container class ${container.class_name} needs SQLite Durable Object storage.`,
|
|
436
|
+
configPath
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
if (container.instance_type === "dev" || container.instance_type === "standard") {
|
|
440
|
+
diagnostics.push({
|
|
441
|
+
_tag: "warning",
|
|
442
|
+
code: "container-instance-type-deprecated",
|
|
443
|
+
message: `Container instance type ${container.instance_type} is deprecated. Choose a current instance type.`,
|
|
444
|
+
configPath: `${prefix}containers.${index}.instance_type`
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (!generated) {
|
|
449
|
+
for (const binding of configuredRemoteBindings(config)) {
|
|
450
|
+
if (binding.value.remote === true)
|
|
451
|
+
continue;
|
|
452
|
+
diagnostics.push({
|
|
453
|
+
_tag: "warning",
|
|
454
|
+
code: "remote-binding-not-enabled",
|
|
455
|
+
message: "Set remote to true when local development needs the real Cloudflare service.",
|
|
456
|
+
configPath: `${prefix}${binding.path}.remote`
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (Array.isArray(config.send_email)) {
|
|
461
|
+
config.send_email.forEach((binding, index) => {
|
|
462
|
+
if (!isRecord(binding))
|
|
463
|
+
return;
|
|
464
|
+
const isRestricted = typeof binding.destination_address === "string" || Array.isArray(binding.allowed_destination_addresses) && binding.allowed_destination_addresses.length > 0 || Array.isArray(binding.allowed_sender_addresses) && binding.allowed_sender_addresses.length > 0;
|
|
465
|
+
if (!isRestricted) {
|
|
466
|
+
diagnostics.push({
|
|
467
|
+
_tag: "warning",
|
|
468
|
+
code: "email-binding-unrestricted",
|
|
469
|
+
message: "Restrict this email binding to approved senders or destinations.",
|
|
470
|
+
configPath: `${prefix}send_email.${index}`
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (Array.isArray(config.pipelines)) {
|
|
476
|
+
config.pipelines.forEach((binding, index) => {
|
|
477
|
+
if (isRecord(binding) && typeof binding.pipeline === "string") {
|
|
478
|
+
diagnostics.push({
|
|
479
|
+
_tag: "warning",
|
|
480
|
+
code: "pipeline-binding-deprecated",
|
|
481
|
+
message: "Replace the deprecated pipeline field with stream.",
|
|
482
|
+
configPath: `${prefix}pipelines.${index}.pipeline`
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
for (const category of ["data_blobs", "text_blobs", "wasm_modules"]) {
|
|
488
|
+
if (isRecord(config[category]) && Object.keys(config[category]).length > 0) {
|
|
489
|
+
diagnostics.push({
|
|
490
|
+
_tag: "warning",
|
|
491
|
+
code: "legacy-module-binding",
|
|
492
|
+
message: `Replace legacy ${category} bindings with module rules and imports.`,
|
|
493
|
+
configPath: `${prefix}${category}`
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (Array.isArray(config.unsafe_hello_world) && config.unsafe_hello_world.length > 0) {
|
|
498
|
+
diagnostics.push({
|
|
499
|
+
_tag: "error",
|
|
500
|
+
code: "unsafe-hello-world-binding",
|
|
501
|
+
message: "Remove the explanatory unsafe_hello_world binding.",
|
|
502
|
+
configPath: `${prefix}unsafe_hello_world`
|
|
503
|
+
});
|
|
504
|
+
}
|
|
296
505
|
const requiredSecrets = new Set(config.secrets?.required ?? []);
|
|
297
506
|
for (const name of Object.keys(config.vars ?? {})) {
|
|
298
507
|
const configPath = `${prefix}vars.${name}`;
|
|
@@ -315,6 +524,9 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
315
524
|
}
|
|
316
525
|
}
|
|
317
526
|
const consumers = config.queues?.consumers ?? [];
|
|
527
|
+
const deadLetterQueues = new Set(consumers.flatMap((consumer) => {
|
|
528
|
+
return typeof consumer.dead_letter_queue === "string" && consumer.dead_letter_queue.length > 0 ? [consumer.dead_letter_queue] : [];
|
|
529
|
+
}));
|
|
318
530
|
consumers.forEach((consumer, index) => {
|
|
319
531
|
const retries = consumer.max_retries;
|
|
320
532
|
const retryDelay = consumer.retry_delay;
|
|
@@ -333,7 +545,8 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
|
|
|
333
545
|
configPath: `${prefix}queues.consumers.${index}.max_retries`
|
|
334
546
|
});
|
|
335
547
|
}
|
|
336
|
-
|
|
548
|
+
const drainsDeadLetterQueue = typeof consumer.queue === "string" && deadLetterQueues.has(consumer.queue);
|
|
549
|
+
if (!drainsDeadLetterQueue && (typeof consumer.dead_letter_queue !== "string" || consumer.dead_letter_queue.length === 0)) {
|
|
337
550
|
diagnostics.push({
|
|
338
551
|
_tag: "warning",
|
|
339
552
|
code: "queue-dlq-missing",
|
|
@@ -498,7 +711,7 @@ function diagnosePolicy(config, prefix, diagnostics, options, publicVarNames) {
|
|
|
498
711
|
configPath: `${prefix}workers_dev`
|
|
499
712
|
});
|
|
500
713
|
}
|
|
501
|
-
diagnoseEnvironment(config, prefix, diagnostics, publicVarNames);
|
|
714
|
+
diagnoseEnvironment(config, prefix, diagnostics, options.generated, options.normalized, publicVarNames);
|
|
502
715
|
}
|
|
503
716
|
function mergeObservability(inherited, environment) {
|
|
504
717
|
if (!inherited && !environment)
|
|
@@ -511,13 +724,15 @@ function mergeObservability(inherited, environment) {
|
|
|
511
724
|
};
|
|
512
725
|
}
|
|
513
726
|
function resolveEnvironmentPolicy(root, environment) {
|
|
727
|
+
const exports = environment.exports ?? root.exports;
|
|
728
|
+
const migrations = environment.migrations ?? root.migrations;
|
|
514
729
|
return {
|
|
515
730
|
...environment,
|
|
516
731
|
cache: environment.cache ?? root.cache,
|
|
517
732
|
compatibility_date: environment.compatibility_date ?? root.compatibility_date,
|
|
518
733
|
compatibility_flags: environment.compatibility_flags ?? root.compatibility_flags,
|
|
519
|
-
exports:
|
|
520
|
-
migrations:
|
|
734
|
+
...exports === void 0 ? {} : { exports },
|
|
735
|
+
...migrations === void 0 ? {} : { migrations },
|
|
521
736
|
observability: mergeObservability(root.observability, environment.observability),
|
|
522
737
|
placement: environment.placement ?? root.placement,
|
|
523
738
|
preview_urls: environment.preview_urls ?? root.preview_urls,
|
|
@@ -529,6 +744,8 @@ function diagnoseWranglerConfig(config, options = {}) {
|
|
|
529
744
|
const diagnostics = [];
|
|
530
745
|
const diagnosticOptions = {
|
|
531
746
|
compatibilityMaxAgeDays: options.compatibilityMaxAgeDays ?? 90,
|
|
747
|
+
generated: options.generated ?? false,
|
|
748
|
+
normalized: options.normalized ?? false,
|
|
532
749
|
now: options.now ?? /* @__PURE__ */ new Date(),
|
|
533
750
|
requireNodeCompat: options.requireNodeCompat ?? true
|
|
534
751
|
};
|
|
@@ -543,6 +760,19 @@ function diagnoseWranglerConfig(config, options = {}) {
|
|
|
543
760
|
const publicVarNames = new Set(options.publicVarNames ?? []);
|
|
544
761
|
diagnosePolicy(config, "", diagnostics, diagnosticOptions, publicVarNames);
|
|
545
762
|
for (const [name, environment] of Object.entries(config.env ?? {})) {
|
|
763
|
+
for (const category of WRANGLER_NON_INHERITED_BINDING_CATEGORIES) {
|
|
764
|
+
const rootNames = collectCategoryBindingNames(config, category);
|
|
765
|
+
const environmentNames = collectCategoryBindingNames(environment, category);
|
|
766
|
+
const missingNames = [...rootNames].filter((binding) => !environmentNames.has(binding));
|
|
767
|
+
if (missingNames.length > 0) {
|
|
768
|
+
diagnostics.push({
|
|
769
|
+
_tag: "warning",
|
|
770
|
+
code: "environment-binding-missing",
|
|
771
|
+
message: `Named environments do not inherit ${category}. Add bindings for: ${missingNames.join(", ")}.`,
|
|
772
|
+
configPath: `env.${name}.${category}`
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
546
776
|
diagnosePolicy(
|
|
547
777
|
resolveEnvironmentPolicy(config, environment),
|
|
548
778
|
`env.${name}.`,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harlan-zw/nuxt-cloudflare",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"description": "Opinionated Cloudflare deployment defaults and diagnostics for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@antfu/eslint-config": "^9.3.0",
|
|
97
97
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
98
|
-
"@cloudflare/workers-types": "^5.
|
|
98
|
+
"@cloudflare/workers-types": "^5.20260811.1",
|
|
99
99
|
"@nuxt/module-builder": "^1.0.2",
|
|
100
100
|
"@nuxt/schema": "^4.5.2",
|
|
101
101
|
"@types/node": "^26.1.1",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"typescript": "^5.9.3",
|
|
105
105
|
"unbuild": "^3.6.1",
|
|
106
106
|
"vitest": "^4.1.10",
|
|
107
|
-
"wrangler": "^4.120.
|
|
107
|
+
"wrangler": "^4.120.1"
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
110
|
"build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
|