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.
Files changed (58) hide show
  1. package/LLM.md +9 -4
  2. package/README.md +10 -2
  3. package/dist/browser.js +3 -3
  4. package/dist/build-b1z6wqet.js +54 -0
  5. package/dist/build-x7maz3eb.js +54 -0
  6. package/dist/cli/commands/config.d.ts.map +1 -1
  7. package/dist/cli/commands/dev.d.ts +1 -0
  8. package/dist/cli/commands/dev.d.ts.map +1 -1
  9. package/dist/cli/commands/doctor.d.ts.map +1 -1
  10. package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
  11. package/dist/cli/index.js +1 -1
  12. package/dist/config-qj5jw8km.js +93 -0
  13. package/dist/deploy-jf3yczsz.js +1055 -0
  14. package/dist/deploy-xqm869nf.js +1055 -0
  15. package/dist/dev-bgpxrwms.js +2551 -0
  16. package/dist/dev-kzs65xcr.js +2551 -0
  17. package/dist/dev-server/dev-server-state.d.ts +2 -0
  18. package/dist/dev-server/dev-server-state.d.ts.map +1 -1
  19. package/dist/dev-server/miniflare-dev-config.d.ts +4 -0
  20. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
  21. package/dist/dev-server/server.d.ts.map +1 -1
  22. package/dist/dev-zgx7fhe9.js +2553 -0
  23. package/dist/doctor-0a2brpyz.js +259 -0
  24. package/dist/index-05pbj4hy.js +1193 -0
  25. package/dist/index-3edvz3hs.js +124 -0
  26. package/dist/index-50em8s6c.js +898 -0
  27. package/dist/index-666tdx14.js +895 -0
  28. package/dist/index-8p7rxkbs.js +1426 -0
  29. package/dist/index-aqrwyy57.js +288 -0
  30. package/dist/index-bj5avaba.js +109 -0
  31. package/dist/index-dgww0ewn.js +574 -0
  32. package/dist/index-f1yshy4s.js +412 -0
  33. package/dist/index-hpwa6vsw.js +239 -0
  34. package/dist/index-kxc4gtyt.js +574 -0
  35. package/dist/index-nxkesg55.js +68 -0
  36. package/dist/index-p7q23nce.js +1031 -0
  37. package/dist/index-pt49cgjv.js +1426 -0
  38. package/dist/index-rp0aye39.js +1426 -0
  39. package/dist/index-tknbyxzn.js +2202 -0
  40. package/dist/index.js +4 -4
  41. package/dist/runtime/index.js +4 -4
  42. package/dist/sveltekit/index.js +2 -2
  43. package/dist/test/index.js +62 -440
  44. package/dist/test/resolve-service-bindings.d.ts +63 -3
  45. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  46. package/dist/types-vhvt4hvm.js +693 -0
  47. package/dist/utils/send-email.d.ts.map +1 -1
  48. package/dist/utils/send-email.js +1 -1
  49. package/dist/vite/index.js +4 -3
  50. package/dist/vite/plugin-context.d.ts +3 -1
  51. package/dist/vite/plugin-context.d.ts.map +1 -1
  52. package/dist/vite/plugin-programmatic.d.ts.map +1 -1
  53. package/dist/vite/plugin-service-bindings.d.ts +13 -0
  54. package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
  55. package/dist/vite/plugin.d.ts +4 -2
  56. package/dist/vite/plugin.d.ts.map +1 -1
  57. package/dist/worker-entrypoint-3rmzd4c1.js +15 -0
  58. package/package.json +1 -1
@@ -0,0 +1,124 @@
1
+ import {
2
+ DEFAULT_ENTRYPOINT_PATTERN,
3
+ findFiles,
4
+ findFilesSync
5
+ } from "./index-qwgr4q7s.js";
6
+ import {
7
+ __require
8
+ } from "./index-37x76zdn.js";
9
+
10
+ // src/utils/entrypoint-discovery.ts
11
+ import { readFileSync } from "fs";
12
+ var ENTRYPOINT_CLASS_PATTERN = /export\s+class\s+(\w+)\s+extends\s+WorkerEntrypoint/g;
13
+ function findEntrypointClasses(code) {
14
+ const classes = [];
15
+ ENTRYPOINT_CLASS_PATTERN.lastIndex = 0;
16
+ let match;
17
+ while ((match = ENTRYPOINT_CLASS_PATTERN.exec(code)) !== null) {
18
+ classes.push(match[1]);
19
+ }
20
+ return classes;
21
+ }
22
+ function discoverEntrypointsSync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
23
+ const discovered = [];
24
+ try {
25
+ const files = findFilesSync(pattern, { cwd });
26
+ for (const file of files) {
27
+ try {
28
+ const code = readFileSync(file, "utf-8");
29
+ const classNames = findEntrypointClasses(code);
30
+ for (const className of classNames) {
31
+ discovered.push({ className, filePath: file });
32
+ }
33
+ } catch {}
34
+ }
35
+ } catch {}
36
+ return discovered;
37
+ }
38
+ async function discoverEntrypointsAsync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
39
+ const fs = await import("node:fs/promises");
40
+ const discovered = [];
41
+ const files = await findFiles(pattern, { cwd });
42
+ for (const filePath of files) {
43
+ try {
44
+ const code = await fs.readFile(filePath, "utf-8");
45
+ const classNames = findEntrypointClasses(code);
46
+ for (const className of classNames) {
47
+ discovered.push({ className, filePath });
48
+ }
49
+ } catch {}
50
+ }
51
+ return discovered;
52
+ }
53
+
54
+ // src/utils/resolve-package.ts
55
+ import { resolve, dirname } from "pathe";
56
+ import { readFileSync as readFileSync2, existsSync } from "node:fs";
57
+ import { fileURLToPath, pathToFileURL } from "node:url";
58
+ import { createRequire } from "node:module";
59
+ var NOT_FOUND_CODES = new Set(["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"]);
60
+ function isNotFoundError(error) {
61
+ if (!error || typeof error !== "object") {
62
+ return false;
63
+ }
64
+ const code = error.code;
65
+ return typeof code === "string" && NOT_FOUND_CODES.has(code);
66
+ }
67
+ function resolveSpecifier(specifier, fromDir) {
68
+ const fromFileUrl = pathToFileURL(resolve(fromDir, "package.json")).href;
69
+ const importMetaResolve = import.meta.resolve;
70
+ if (typeof importMetaResolve === "function") {
71
+ try {
72
+ const resolved = importMetaResolve(specifier, fromFileUrl);
73
+ if (typeof resolved === "string") {
74
+ return resolved.startsWith("file:") ? fileURLToPath(resolved) : resolved;
75
+ }
76
+ } catch (error) {
77
+ if (!isNotFoundError(error)) {
78
+ throw error;
79
+ }
80
+ }
81
+ }
82
+ try {
83
+ const require_ = createRequire(fromFileUrl);
84
+ return require_.resolve(specifier);
85
+ } catch (error) {
86
+ if (isNotFoundError(error)) {
87
+ return null;
88
+ }
89
+ throw error;
90
+ }
91
+ }
92
+ function resolvePackageSpecifier(specifier, fromDir) {
93
+ if (specifier.startsWith(".") || specifier.startsWith("/") || /^[A-Za-z]:/.test(specifier)) {
94
+ return resolve(fromDir, specifier);
95
+ }
96
+ const parts = specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
97
+ const subpath = specifier.startsWith("@") ? specifier.split("/").slice(2).join("/") : specifier.split("/").slice(1).join("/");
98
+ const pkgJsonPath = resolveSpecifier(`${parts}/package.json`, fromDir);
99
+ if (!pkgJsonPath) {
100
+ return resolve(fromDir, specifier);
101
+ }
102
+ const pkgDir = dirname(pkgJsonPath);
103
+ if (subpath) {
104
+ const pkgJson = JSON.parse(readFileSync2(pkgJsonPath, "utf-8"));
105
+ const exportPath = pkgJson.exports?.[`./${subpath}`];
106
+ if (exportPath) {
107
+ const targetPath = typeof exportPath === "string" ? exportPath : exportPath.default || exportPath.import;
108
+ return resolve(pkgDir, targetPath);
109
+ }
110
+ const directPath = resolve(pkgDir, `${subpath}.ts`);
111
+ if (existsSync(directPath))
112
+ return directPath;
113
+ const withExt = resolve(pkgDir, subpath);
114
+ if (existsSync(withExt))
115
+ return withExt;
116
+ if (existsSync(`${withExt}.ts`))
117
+ return `${withExt}.ts`;
118
+ if (existsSync(`${withExt}.js`))
119
+ return `${withExt}.js`;
120
+ }
121
+ return pkgDir;
122
+ }
123
+
124
+ export { discoverEntrypointsSync, discoverEntrypointsAsync, resolvePackageSpecifier };