devflare 1.0.0-next.20 → 1.0.0-next.21
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/LLM.md +9 -4
- package/README.md +10 -2
- package/dist/browser.js +3 -3
- package/dist/build-b1z6wqet.js +54 -0
- package/dist/build-x7maz3eb.js +54 -0
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +1 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/config-qj5jw8km.js +93 -0
- package/dist/deploy-jf3yczsz.js +1055 -0
- package/dist/deploy-xqm869nf.js +1055 -0
- package/dist/dev-bgpxrwms.js +2551 -0
- package/dist/dev-kzs65xcr.js +2551 -0
- package/dist/dev-server/dev-server-state.d.ts +2 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -1
- package/dist/dev-server/miniflare-dev-config.d.ts +4 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-zgx7fhe9.js +2553 -0
- package/dist/doctor-0a2brpyz.js +259 -0
- package/dist/index-05pbj4hy.js +1193 -0
- package/dist/index-3edvz3hs.js +124 -0
- package/dist/index-50em8s6c.js +898 -0
- package/dist/index-666tdx14.js +895 -0
- package/dist/index-8p7rxkbs.js +1426 -0
- package/dist/index-aqrwyy57.js +288 -0
- package/dist/index-bj5avaba.js +109 -0
- package/dist/index-dgww0ewn.js +574 -0
- package/dist/index-f1yshy4s.js +412 -0
- package/dist/index-hpwa6vsw.js +239 -0
- package/dist/index-kxc4gtyt.js +574 -0
- package/dist/index-nxkesg55.js +68 -0
- package/dist/index-p7q23nce.js +1031 -0
- package/dist/index-pt49cgjv.js +1426 -0
- package/dist/index-rp0aye39.js +1426 -0
- package/dist/index-tknbyxzn.js +2202 -0
- package/dist/index.js +4 -4
- package/dist/runtime/index.js +4 -4
- package/dist/sveltekit/index.js +2 -2
- package/dist/test/index.js +62 -440
- package/dist/test/resolve-service-bindings.d.ts +63 -3
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/types-vhvt4hvm.js +693 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/utils/send-email.js +1 -1
- package/dist/vite/index.js +4 -3
- package/dist/vite/plugin-context.d.ts +3 -1
- package/dist/vite/plugin-context.d.ts.map +1 -1
- package/dist/vite/plugin-programmatic.d.ts.map +1 -1
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +4 -2
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entrypoint-3rmzd4c1.js +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGeneratedArtifactPaths
|
|
3
|
+
} from "./index-aabgympv.js";
|
|
4
|
+
import {
|
|
5
|
+
formatSupportedConfigFilenames,
|
|
6
|
+
resolveConfigCandidatePath
|
|
7
|
+
} from "./index-jdzrvnfj.js";
|
|
8
|
+
import {
|
|
9
|
+
getDependencies
|
|
10
|
+
} from "./index-z9gy8w6b.js";
|
|
11
|
+
import {
|
|
12
|
+
detectViteProject
|
|
13
|
+
} from "./index-gn5wy09x.js";
|
|
14
|
+
import {
|
|
15
|
+
getPackageVersion
|
|
16
|
+
} from "./index-627srx16.js";
|
|
17
|
+
import {
|
|
18
|
+
bold,
|
|
19
|
+
createCliTheme,
|
|
20
|
+
dim,
|
|
21
|
+
green,
|
|
22
|
+
logLine,
|
|
23
|
+
red,
|
|
24
|
+
yellow
|
|
25
|
+
} from "./index-stgn34cr.js";
|
|
26
|
+
import"./index-3t6rypgc.js";
|
|
27
|
+
import"./index-qwgr4q7s.js";
|
|
28
|
+
import {
|
|
29
|
+
loadConfig
|
|
30
|
+
} from "./index-syscwrjp.js";
|
|
31
|
+
import"./index-1d4jg11n.js";
|
|
32
|
+
import"./index-mg8vwqxf.js";
|
|
33
|
+
import"./index-z40mjts9.js";
|
|
34
|
+
import"./index-37x76zdn.js";
|
|
35
|
+
|
|
36
|
+
// src/cli/commands/doctor.ts
|
|
37
|
+
import { basename, dirname, relative, resolve } from "pathe";
|
|
38
|
+
async function runDoctorCommand(parsed, logger, options) {
|
|
39
|
+
const cwd = options.cwd || process.cwd();
|
|
40
|
+
const theme = createCliTheme(parsed.options);
|
|
41
|
+
const requestedConfigOption = parsed.options.config;
|
|
42
|
+
const scope = parsed.options.scope ?? "all";
|
|
43
|
+
if (!["all", "local", "deploy"].includes(scope)) {
|
|
44
|
+
logger.error(`Unsupported doctor scope: ${scope}`);
|
|
45
|
+
logger.info("Supported scopes: all, local, deploy");
|
|
46
|
+
return { exitCode: 1 };
|
|
47
|
+
}
|
|
48
|
+
const requestedConfigPath = requestedConfigOption ? resolve(cwd, requestedConfigOption) : cwd;
|
|
49
|
+
const checks = [];
|
|
50
|
+
const { fs } = await getDependencies();
|
|
51
|
+
const viteProject = await detectViteProject(cwd, fs);
|
|
52
|
+
logLine(logger);
|
|
53
|
+
logLine(logger, `${bold("doctor", theme)} ${dim("Running diagnostics", theme)}`);
|
|
54
|
+
logLine(logger);
|
|
55
|
+
const configPath = await resolveConfigCandidatePath(requestedConfigPath);
|
|
56
|
+
if (configPath) {
|
|
57
|
+
checks.push({
|
|
58
|
+
name: "Config File",
|
|
59
|
+
status: "pass",
|
|
60
|
+
message: `Found: ${configPath}`
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
const config = requestedConfigOption ? await loadConfig({
|
|
64
|
+
cwd: dirname(configPath),
|
|
65
|
+
configFile: basename(configPath)
|
|
66
|
+
}) : await loadConfig({ cwd });
|
|
67
|
+
checks.push({
|
|
68
|
+
name: "Config Valid",
|
|
69
|
+
status: "pass",
|
|
70
|
+
message: `Project: ${config.name}`
|
|
71
|
+
});
|
|
72
|
+
} catch (error) {
|
|
73
|
+
checks.push({
|
|
74
|
+
name: "Config Valid",
|
|
75
|
+
status: "fail",
|
|
76
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
checks.push({
|
|
81
|
+
name: "Config File",
|
|
82
|
+
status: "fail",
|
|
83
|
+
message: `${formatSupportedConfigFilenames()} not found. Run \`devflare init\` to create one.`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const packageJsonPath = resolve(cwd, "package.json");
|
|
87
|
+
try {
|
|
88
|
+
await fs.access(packageJsonPath);
|
|
89
|
+
const content = await fs.readFile(packageJsonPath, "utf-8");
|
|
90
|
+
const pkg = JSON.parse(content);
|
|
91
|
+
checks.push({
|
|
92
|
+
name: "package.json",
|
|
93
|
+
status: "pass",
|
|
94
|
+
message: `Found: ${pkg.name || "unnamed"}`
|
|
95
|
+
});
|
|
96
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
97
|
+
if (deps.devflare) {
|
|
98
|
+
const resolvedVersion = await getPackageVersion();
|
|
99
|
+
checks.push({
|
|
100
|
+
name: "devflare dep",
|
|
101
|
+
status: "pass",
|
|
102
|
+
message: `package.json: ${deps.devflare}, resolved: ${resolvedVersion}`
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
checks.push({
|
|
106
|
+
name: "devflare dep",
|
|
107
|
+
status: "warn",
|
|
108
|
+
message: "devflare not in dependencies"
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
} catch {
|
|
112
|
+
checks.push({
|
|
113
|
+
name: "package.json",
|
|
114
|
+
status: "fail",
|
|
115
|
+
message: "package.json not found"
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (viteProject.wantsViteIntegration) {
|
|
119
|
+
checks.push({
|
|
120
|
+
name: "Vite Integration",
|
|
121
|
+
status: "pass",
|
|
122
|
+
message: "Enabled for this package"
|
|
123
|
+
});
|
|
124
|
+
if (viteProject.hasLocalViteDependency) {
|
|
125
|
+
checks.push({
|
|
126
|
+
name: "vite dep",
|
|
127
|
+
status: "pass",
|
|
128
|
+
message: "Found in package.json"
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
checks.push({
|
|
132
|
+
name: "vite dep",
|
|
133
|
+
status: "warn",
|
|
134
|
+
message: "Not declared in this package.json (workspace-hoisted installs may still work)"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (viteProject.hasLocalCloudflareVitePluginDependency) {
|
|
138
|
+
checks.push({
|
|
139
|
+
name: "@cloudflare/vite-plugin",
|
|
140
|
+
status: "pass",
|
|
141
|
+
message: "Found in package.json"
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
checks.push({
|
|
145
|
+
name: "@cloudflare/vite-plugin",
|
|
146
|
+
status: "pass",
|
|
147
|
+
message: "Optional: not declared in this package.json. Install it only when your Vite config calls the Cloudflare Vite plugin directly."
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (viteProject.viteConfigPath) {
|
|
151
|
+
checks.push({
|
|
152
|
+
name: "Vite Config",
|
|
153
|
+
status: "pass",
|
|
154
|
+
message: `Found: ${viteProject.viteConfigPath}`
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
checks.push({
|
|
158
|
+
name: "Vite Config",
|
|
159
|
+
status: "warn",
|
|
160
|
+
message: "No vite.config found. Create one with @cloudflare/vite-plugin"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
checks.push({
|
|
165
|
+
name: "Vite Integration",
|
|
166
|
+
status: "pass",
|
|
167
|
+
message: "Not enabled for this package (worker-only mode)"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
await fs.access(resolve(cwd, "tsconfig.json"));
|
|
172
|
+
checks.push({
|
|
173
|
+
name: "tsconfig.json",
|
|
174
|
+
status: "pass",
|
|
175
|
+
message: "Found"
|
|
176
|
+
});
|
|
177
|
+
} catch {
|
|
178
|
+
checks.push({
|
|
179
|
+
name: "tsconfig.json",
|
|
180
|
+
status: "warn",
|
|
181
|
+
message: "tsconfig.json not found"
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const artifactPaths = getGeneratedArtifactPaths(cwd);
|
|
185
|
+
if (scope === "all" || scope === "local") {
|
|
186
|
+
try {
|
|
187
|
+
await fs.access(artifactPaths.devWranglerConfigPath);
|
|
188
|
+
checks.push({
|
|
189
|
+
name: "Generated dev config",
|
|
190
|
+
status: "pass",
|
|
191
|
+
message: `Found: ${relative(cwd, artifactPaths.devWranglerConfigPath)}`
|
|
192
|
+
});
|
|
193
|
+
} catch {
|
|
194
|
+
checks.push({
|
|
195
|
+
name: "Generated dev config",
|
|
196
|
+
status: "warn",
|
|
197
|
+
message: "Local readiness: not found. Run `devflare dev` or start `devflare/vite` to populate `.devflare/wrangler.jsonc`."
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (scope === "all" || scope === "deploy") {
|
|
202
|
+
try {
|
|
203
|
+
await fs.access(artifactPaths.buildWranglerConfigPath);
|
|
204
|
+
checks.push({
|
|
205
|
+
name: "Generated deploy config",
|
|
206
|
+
status: "pass",
|
|
207
|
+
message: `Found: ${relative(cwd, artifactPaths.buildWranglerConfigPath)}`
|
|
208
|
+
});
|
|
209
|
+
} catch {
|
|
210
|
+
checks.push({
|
|
211
|
+
name: "Generated deploy config",
|
|
212
|
+
status: "warn",
|
|
213
|
+
message: "Deploy readiness: not found. Run `devflare build` or `devflare deploy` to generate `.devflare/build/wrangler.jsonc`."
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
await fs.access(artifactPaths.deployRedirectPath);
|
|
218
|
+
checks.push({
|
|
219
|
+
name: "Wrangler deploy redirect",
|
|
220
|
+
status: "pass",
|
|
221
|
+
message: `Found: ${relative(cwd, artifactPaths.deployRedirectPath)}`
|
|
222
|
+
});
|
|
223
|
+
} catch {
|
|
224
|
+
checks.push({
|
|
225
|
+
name: "Wrangler deploy redirect",
|
|
226
|
+
status: "warn",
|
|
227
|
+
message: "Deploy readiness: not found. Run `devflare build` or `devflare deploy` to generate `.wrangler/deploy/config.json`."
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
let hasFailures = false;
|
|
232
|
+
let hasWarnings = false;
|
|
233
|
+
for (const check of checks) {
|
|
234
|
+
const icon = check.status === "pass" ? "✓" : check.status === "warn" ? "⚠" : "✗";
|
|
235
|
+
if (check.status === "pass") {
|
|
236
|
+
logLine(logger, `${green(icon, theme)} ${bold(check.name, theme)}${dim(" — ", theme)}${check.message}`);
|
|
237
|
+
} else if (check.status === "warn") {
|
|
238
|
+
logLine(logger, `${yellow(icon, theme)} ${bold(check.name, theme)}${dim(" — ", theme)}${check.message}`);
|
|
239
|
+
hasWarnings = true;
|
|
240
|
+
} else {
|
|
241
|
+
logLine(logger, `${red(icon, theme)} ${bold(check.name, theme)}${dim(" — ", theme)}${check.message}`);
|
|
242
|
+
hasFailures = true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
logLine(logger);
|
|
246
|
+
if (hasFailures) {
|
|
247
|
+
logger.error("Some checks failed. Please fix the issues above.");
|
|
248
|
+
return { exitCode: 1 };
|
|
249
|
+
} else if (hasWarnings) {
|
|
250
|
+
logger.warn("All critical checks passed, but there are warnings.");
|
|
251
|
+
return { exitCode: 0 };
|
|
252
|
+
} else {
|
|
253
|
+
logger.success("All checks passed!");
|
|
254
|
+
return { exitCode: 0 };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export {
|
|
258
|
+
runDoctorCommand
|
|
259
|
+
};
|