devflare 1.0.0-next.1 → 1.0.0-next.10

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 (123) hide show
  1. package/LLM.md +775 -637
  2. package/R2.md +200 -0
  3. package/README.md +285 -514
  4. package/bin/devflare.js +8 -8
  5. package/dist/{account-rvrj687w.js → account-8psavtg6.js} +27 -4
  6. package/dist/bridge/miniflare.d.ts +6 -0
  7. package/dist/bridge/miniflare.d.ts.map +1 -1
  8. package/dist/bridge/proxy.d.ts +5 -6
  9. package/dist/bridge/proxy.d.ts.map +1 -1
  10. package/dist/bridge/server.d.ts.map +1 -1
  11. package/dist/browser.d.ts +50 -0
  12. package/dist/browser.d.ts.map +1 -0
  13. package/dist/{build-mnf6v8gd.js → build-k36xrzvy.js} +26 -7
  14. package/dist/bundler/do-bundler.d.ts +7 -0
  15. package/dist/bundler/do-bundler.d.ts.map +1 -1
  16. package/dist/cli/commands/account.d.ts.map +1 -1
  17. package/dist/cli/commands/build.d.ts.map +1 -1
  18. package/dist/cli/commands/deploy.d.ts.map +1 -1
  19. package/dist/cli/commands/dev.d.ts.map +1 -1
  20. package/dist/cli/commands/doctor.d.ts.map +1 -1
  21. package/dist/cli/commands/init.d.ts.map +1 -1
  22. package/dist/cli/commands/types.d.ts.map +1 -1
  23. package/dist/cli/config-path.d.ts +5 -0
  24. package/dist/cli/config-path.d.ts.map +1 -0
  25. package/dist/cli/index.d.ts.map +1 -1
  26. package/dist/cli/package-metadata.d.ts +16 -0
  27. package/dist/cli/package-metadata.d.ts.map +1 -0
  28. package/dist/config/compiler.d.ts +7 -0
  29. package/dist/config/compiler.d.ts.map +1 -1
  30. package/dist/config/index.d.ts +1 -1
  31. package/dist/config/index.d.ts.map +1 -1
  32. package/dist/config/schema.d.ts +2575 -1221
  33. package/dist/config/schema.d.ts.map +1 -1
  34. package/dist/{deploy-nhceck39.js → deploy-dbvfq8vq.js} +33 -15
  35. package/dist/{dev-qnxet3j9.js → dev-rk8p6pse.js} +900 -234
  36. package/dist/dev-server/miniflare-log.d.ts +12 -0
  37. package/dist/dev-server/miniflare-log.d.ts.map +1 -0
  38. package/dist/dev-server/runtime-stdio.d.ts +8 -0
  39. package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
  40. package/dist/dev-server/server.d.ts +2 -0
  41. package/dist/dev-server/server.d.ts.map +1 -1
  42. package/dist/dev-server/vite-utils.d.ts +37 -0
  43. package/dist/dev-server/vite-utils.d.ts.map +1 -0
  44. package/dist/{doctor-e8fy6fj5.js → doctor-06y8nxd4.js} +73 -50
  45. package/dist/{durable-object-t4kbb0yt.js → durable-object-yt8v1dyn.js} +1 -1
  46. package/dist/index-05fyzwne.js +195 -0
  47. package/dist/index-1p814k7s.js +227 -0
  48. package/dist/{index-hcex3rgh.js → index-1phx14av.js} +84 -7
  49. package/dist/{index-tk6ej9dj.js → index-2q3pmzrx.js} +12 -16
  50. package/dist/{index-pf5s73n9.js → index-59df49vn.js} +11 -281
  51. package/dist/index-5yxg30va.js +304 -0
  52. package/dist/index-62b3gt2g.js +12 -0
  53. package/dist/index-6h8xbs75.js +44 -0
  54. package/dist/{index-67qcae0f.js → index-6v3wjg1r.js} +16 -1
  55. package/dist/index-8gtqgb3q.js +529 -0
  56. package/dist/{index-gz1gndna.js → index-9wt9x09k.js} +42 -62
  57. package/dist/index-fef08w43.js +231 -0
  58. package/dist/{index-ep3445yc.js → index-jht2j546.js} +393 -170
  59. package/dist/index-k7r18na8.js +0 -0
  60. package/dist/{index-m2q41jwa.js → index-n932ytmq.js} +9 -1
  61. package/dist/index-pwgyy2q9.js +39 -0
  62. package/dist/{index-07q6yxyc.js → index-v8vvsn9x.js} +1 -0
  63. package/dist/index-vky23txa.js +70 -0
  64. package/dist/index-vs49yxn4.js +322 -0
  65. package/dist/{index-z14anrqp.js → index-wfbfz02q.js} +14 -15
  66. package/dist/index-ws68xvq2.js +311 -0
  67. package/dist/index-y1d8za14.js +196 -0
  68. package/dist/{init-f9mgmew3.js → init-na2atvz2.js} +42 -55
  69. package/dist/router/types.d.ts +24 -0
  70. package/dist/router/types.d.ts.map +1 -0
  71. package/dist/runtime/context.d.ts +249 -8
  72. package/dist/runtime/context.d.ts.map +1 -1
  73. package/dist/runtime/exports.d.ts +50 -55
  74. package/dist/runtime/exports.d.ts.map +1 -1
  75. package/dist/runtime/index.d.ts +8 -1
  76. package/dist/runtime/index.d.ts.map +1 -1
  77. package/dist/runtime/middleware.d.ts +77 -60
  78. package/dist/runtime/middleware.d.ts.map +1 -1
  79. package/dist/runtime/router.d.ts +7 -0
  80. package/dist/runtime/router.d.ts.map +1 -0
  81. package/dist/runtime/validation.d.ts +1 -1
  82. package/dist/runtime/validation.d.ts.map +1 -1
  83. package/dist/src/browser.js +150 -0
  84. package/dist/src/cli/index.js +10 -0
  85. package/dist/{cloudflare → src/cloudflare}/index.js +3 -3
  86. package/dist/{decorators → src/decorators}/index.js +2 -2
  87. package/dist/src/index.js +132 -0
  88. package/dist/src/runtime/index.js +111 -0
  89. package/dist/{sveltekit → src/sveltekit}/index.js +14 -6
  90. package/dist/{test → src/test}/index.js +22 -13
  91. package/dist/{vite → src/vite}/index.js +128 -59
  92. package/dist/sveltekit/platform.d.ts.map +1 -1
  93. package/dist/test/bridge-context.d.ts +5 -2
  94. package/dist/test/bridge-context.d.ts.map +1 -1
  95. package/dist/test/cf.d.ts +25 -11
  96. package/dist/test/cf.d.ts.map +1 -1
  97. package/dist/test/email.d.ts +16 -7
  98. package/dist/test/email.d.ts.map +1 -1
  99. package/dist/test/queue.d.ts.map +1 -1
  100. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  101. package/dist/test/scheduled.d.ts.map +1 -1
  102. package/dist/test/simple-context.d.ts +1 -1
  103. package/dist/test/simple-context.d.ts.map +1 -1
  104. package/dist/test/tail.d.ts +2 -1
  105. package/dist/test/tail.d.ts.map +1 -1
  106. package/dist/test/worker.d.ts +6 -0
  107. package/dist/test/worker.d.ts.map +1 -1
  108. package/dist/transform/durable-object.d.ts.map +1 -1
  109. package/dist/transform/worker-entrypoint.d.ts.map +1 -1
  110. package/dist/{types-5nyrz1sz.js → types-x9q7t491.js} +30 -16
  111. package/dist/utils/entrypoint-discovery.d.ts +6 -3
  112. package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
  113. package/dist/utils/send-email.d.ts +15 -0
  114. package/dist/utils/send-email.d.ts.map +1 -0
  115. package/dist/vite/plugin.d.ts.map +1 -1
  116. package/dist/worker-entry/composed-worker.d.ts +13 -0
  117. package/dist/worker-entry/composed-worker.d.ts.map +1 -0
  118. package/dist/worker-entry/routes.d.ts +22 -0
  119. package/dist/worker-entry/routes.d.ts.map +1 -0
  120. package/dist/{worker-entrypoint-m9th0rg0.js → worker-entrypoint-c259fmfs.js} +1 -1
  121. package/package.json +21 -19
  122. package/dist/index.js +0 -298
  123. package/dist/runtime/index.js +0 -111
@@ -0,0 +1,227 @@
1
+ import {
2
+ findFiles
3
+ } from "./index-rbht7m9r.js";
4
+ import {
5
+ __require
6
+ } from "./index-37x76zdn.js";
7
+
8
+ // src/worker-entry/routes.ts
9
+ import { relative, resolve } from "pathe";
10
+ var DEFAULT_ROUTE_DIR = "src/routes";
11
+ var DEFAULT_ROUTE_FILE_PATTERNS = [
12
+ "**/*.ts",
13
+ "**/*.tsx",
14
+ "**/*.js",
15
+ "**/*.jsx",
16
+ "**/*.mts",
17
+ "**/*.mjs"
18
+ ];
19
+ function normalizeRoutePrefix(prefix) {
20
+ if (!prefix || prefix === "/") {
21
+ return "";
22
+ }
23
+ const normalized = prefix.startsWith("/") ? prefix : `/${prefix}`;
24
+ return normalized.replace(/\/+$/g, "");
25
+ }
26
+ function createStaticSegmentsFromPrefix(prefix) {
27
+ if (!prefix) {
28
+ return [];
29
+ }
30
+ return prefix.split("/").filter(Boolean).map((value) => ({
31
+ type: "static",
32
+ value
33
+ }));
34
+ }
35
+ function shouldIgnoreRouteFile(relativePath) {
36
+ return relativePath.split("/").some((segment) => segment.startsWith("_"));
37
+ }
38
+ function toRoutePath(segments) {
39
+ if (segments.length === 0) {
40
+ return "/";
41
+ }
42
+ return `/${segments.map((segment) => {
43
+ if (segment.type === "static") {
44
+ return segment.value;
45
+ }
46
+ if (segment.type === "param") {
47
+ return `[${segment.name}]`;
48
+ }
49
+ if (segment.type === "rest") {
50
+ return `[...${segment.name}]`;
51
+ }
52
+ return `[[...${segment.name}]]`;
53
+ }).join("/")}`;
54
+ }
55
+ function getRouteSignature(segments) {
56
+ if (segments.length === 0) {
57
+ return "/";
58
+ }
59
+ return segments.map((segment) => {
60
+ if (segment.type === "static") {
61
+ return `static:${segment.value}`;
62
+ }
63
+ if (segment.type === "param") {
64
+ return "param";
65
+ }
66
+ if (segment.type === "rest") {
67
+ return "rest";
68
+ }
69
+ return "optional-rest";
70
+ }).join("/");
71
+ }
72
+ function getSegmentPriority(segment) {
73
+ if (segment.type === "static") {
74
+ return 4;
75
+ }
76
+ if (segment.type === "param") {
77
+ return 3;
78
+ }
79
+ if (segment.type === "rest") {
80
+ return 1;
81
+ }
82
+ return 0;
83
+ }
84
+ function compareRoutes(a, b) {
85
+ const maxLength = Math.max(a.segments.length, b.segments.length);
86
+ for (let index = 0;index < maxLength; index += 1) {
87
+ const left = a.segments[index];
88
+ const right = b.segments[index];
89
+ if (!left && !right) {
90
+ break;
91
+ }
92
+ if (!left) {
93
+ return 1;
94
+ }
95
+ if (!right) {
96
+ return -1;
97
+ }
98
+ const priorityDifference = getSegmentPriority(right) - getSegmentPriority(left);
99
+ if (priorityDifference !== 0) {
100
+ return priorityDifference;
101
+ }
102
+ if (left.type === "static" && right.type === "static") {
103
+ const lexicalDifference = left.value.localeCompare(right.value);
104
+ if (lexicalDifference !== 0) {
105
+ return lexicalDifference;
106
+ }
107
+ }
108
+ }
109
+ return a.filePath.localeCompare(b.filePath);
110
+ }
111
+ function parseRouteSegments(relativePath, prefixSegments) {
112
+ const withoutExtension = relativePath.replace(/\.[^.]+$/u, "");
113
+ const rawSegments = withoutExtension.split("/").filter(Boolean);
114
+ const routeSegments = [...prefixSegments];
115
+ for (let index = 0;index < rawSegments.length; index += 1) {
116
+ const segment = rawSegments[index];
117
+ const isLastSegment = index === rawSegments.length - 1;
118
+ if (segment === "index" && isLastSegment) {
119
+ continue;
120
+ }
121
+ const optionalRestMatch = segment.match(/^\[\[\.\.\.(.+)\]\]$/u);
122
+ if (optionalRestMatch) {
123
+ if (!isLastSegment) {
124
+ throw new Error(`Optional rest segment must be the final segment: ${relativePath}`);
125
+ }
126
+ routeSegments.push({
127
+ type: "optional-rest",
128
+ name: optionalRestMatch[1]
129
+ });
130
+ continue;
131
+ }
132
+ const restMatch = segment.match(/^\[\.\.\.(.+)\]$/u);
133
+ if (restMatch) {
134
+ if (!isLastSegment) {
135
+ throw new Error(`Rest segment must be the final segment: ${relativePath}`);
136
+ }
137
+ routeSegments.push({
138
+ type: "rest",
139
+ name: restMatch[1]
140
+ });
141
+ continue;
142
+ }
143
+ const dynamicMatch = segment.match(/^\[(.+)\]$/u);
144
+ if (dynamicMatch) {
145
+ routeSegments.push({
146
+ type: "param",
147
+ name: dynamicMatch[1]
148
+ });
149
+ continue;
150
+ }
151
+ routeSegments.push({
152
+ type: "static",
153
+ value: segment
154
+ });
155
+ }
156
+ return routeSegments;
157
+ }
158
+ async function directoryExists(dirPath) {
159
+ const fs = await import("node:fs/promises");
160
+ try {
161
+ const stat = await fs.stat(dirPath);
162
+ return stat.isDirectory();
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
167
+ function getRouteDirectoryCandidate(cwd, config) {
168
+ const routesConfig = config.files?.routes;
169
+ if (routesConfig === false) {
170
+ return null;
171
+ }
172
+ const dir = routesConfig?.dir ?? DEFAULT_ROUTE_DIR;
173
+ return {
174
+ dir,
175
+ absoluteDir: resolve(cwd, dir),
176
+ prefix: normalizeRoutePrefix(routesConfig?.prefix)
177
+ };
178
+ }
179
+ async function discoverRoutes(cwd, config) {
180
+ const routeDirectory = getRouteDirectoryCandidate(cwd, config);
181
+ if (!routeDirectory) {
182
+ return null;
183
+ }
184
+ if (!await directoryExists(routeDirectory.absoluteDir)) {
185
+ return null;
186
+ }
187
+ const prefixSegments = createStaticSegmentsFromPrefix(routeDirectory.prefix);
188
+ const files = await findFiles(DEFAULT_ROUTE_FILE_PATTERNS, {
189
+ cwd: routeDirectory.absoluteDir,
190
+ absolute: true
191
+ });
192
+ const discoveredRoutes = [];
193
+ const routeSignatures = new Map;
194
+ for (const absolutePath of files) {
195
+ const relativeToRouteDir = relative(routeDirectory.absoluteDir, absolutePath).replace(/\\/g, "/");
196
+ if (shouldIgnoreRouteFile(relativeToRouteDir)) {
197
+ continue;
198
+ }
199
+ const segments = parseRouteSegments(relativeToRouteDir, prefixSegments);
200
+ const routePath = toRoutePath(segments);
201
+ const filePath = relative(cwd, absolutePath).replace(/\\/g, "/");
202
+ const signature = getRouteSignature(segments);
203
+ const existingFilePath = routeSignatures.get(signature);
204
+ if (existingFilePath) {
205
+ throw new Error(`Conflicting file routes detected for "${routePath}". Both "${existingFilePath}" and "${filePath}" resolve to the same route.`);
206
+ }
207
+ routeSignatures.set(signature, filePath);
208
+ discoveredRoutes.push({
209
+ absolutePath,
210
+ filePath,
211
+ routePath,
212
+ segments
213
+ });
214
+ }
215
+ if (discoveredRoutes.length === 0) {
216
+ return null;
217
+ }
218
+ discoveredRoutes.sort(compareRoutes);
219
+ return {
220
+ dir: routeDirectory.dir,
221
+ absoluteDir: routeDirectory.absoluteDir,
222
+ prefix: routeDirectory.prefix,
223
+ routes: discoveredRoutes
224
+ };
225
+ }
226
+
227
+ export { getRouteDirectoryCandidate, discoverRoutes };
@@ -70,7 +70,14 @@ var analyticsBindingSchema = z.object({
70
70
  dataset: z.string()
71
71
  });
72
72
  var sendEmailBindingSchema = z.object({
73
- destinationAddress: z.string().optional()
73
+ destinationAddress: z.string().optional(),
74
+ allowedDestinationAddresses: z.array(z.string()).optional(),
75
+ allowedSenderAddresses: z.array(z.string()).optional()
76
+ }).refine((binding) => {
77
+ return !(binding.destinationAddress && binding.allowedDestinationAddresses);
78
+ }, {
79
+ message: "sendEmail bindings must use either destinationAddress or allowedDestinationAddresses, not both",
80
+ path: ["allowedDestinationAddresses"]
74
81
  });
75
82
  var bindingsSchema = z.object({
76
83
  kv: z.record(z.string(), z.string()).optional(),
@@ -115,12 +122,43 @@ var observabilitySchema = z.object({
115
122
  var limitsSchema = z.object({
116
123
  cpu_ms: z.number().optional()
117
124
  }).optional();
125
+ var rolldownOptionsSchema = z.custom((value) => {
126
+ return typeof value === "object" && value !== null && !Array.isArray(value);
127
+ }, {
128
+ message: "Expected Rolldown options object"
129
+ });
130
+ var rolldownConfigSchema = z.object({
131
+ target: z.string().optional(),
132
+ minify: z.boolean().optional(),
133
+ sourcemap: z.boolean().optional(),
134
+ options: rolldownOptionsSchema.optional()
135
+ }).optional();
136
+ var viteConfigSchema = z.object({
137
+ plugins: z.array(z.unknown()).optional()
138
+ }).catchall(z.unknown()).optional();
118
139
  var buildConfigSchema = z.object({
119
140
  target: z.string().optional(),
120
141
  minify: z.boolean().optional(),
121
142
  sourcemap: z.boolean().optional(),
122
- rolldownOptions: z.record(z.string(), z.unknown()).optional()
143
+ rolldownOptions: rolldownOptionsSchema.optional()
123
144
  }).optional();
145
+ function normalizeViteConfig(vite, plugins) {
146
+ const normalizedVite = {
147
+ ...plugins !== undefined ? { plugins } : {},
148
+ ...vite ?? {}
149
+ };
150
+ return Object.keys(normalizedVite).length > 0 ? normalizedVite : undefined;
151
+ }
152
+ function normalizeRolldownConfig(rolldown, build) {
153
+ const normalizedRolldown = {
154
+ ...build?.target !== undefined ? { target: build.target } : {},
155
+ ...build?.minify !== undefined ? { minify: build.minify } : {},
156
+ ...build?.sourcemap !== undefined ? { sourcemap: build.sourcemap } : {},
157
+ ...build?.rolldownOptions !== undefined ? { options: build.rolldownOptions } : {},
158
+ ...rolldown ?? {}
159
+ };
160
+ return Object.keys(normalizedRolldown).length > 0 ? normalizedRolldown : undefined;
161
+ }
124
162
  var migrationSchema = z.object({
125
163
  tag: z.string(),
126
164
  new_classes: z.array(z.string()).optional(),
@@ -134,7 +172,7 @@ var migrationSchema = z.object({
134
172
  var wranglerConfigSchema = z.object({
135
173
  passthrough: z.record(z.string(), z.unknown()).optional()
136
174
  }).optional();
137
- var envConfigSchemaInner = z.object({
175
+ var envConfigSchema = z.object({
138
176
  name: z.string().optional(),
139
177
  compatibilityDate: compatibilityDateSchema.optional(),
140
178
  compatibilityFlags: z.array(z.string()).optional(),
@@ -148,15 +186,35 @@ var envConfigSchemaInner = z.object({
148
186
  limits: limitsSchema,
149
187
  observability: observabilitySchema,
150
188
  migrations: z.array(migrationSchema).optional(),
151
- build: buildConfigSchema,
189
+ rolldown: rolldownConfigSchema,
190
+ vite: viteConfigSchema,
152
191
  wrangler: wranglerConfigSchema
153
192
  }).partial();
193
+ var envConfigSchemaInner = envConfigSchema.extend({
194
+ build: buildConfigSchema,
195
+ plugins: z.array(z.unknown()).optional()
196
+ }).transform((config) => {
197
+ const normalizedVite = normalizeViteConfig(config.vite, config.plugins);
198
+ const normalizedRolldown = normalizeRolldownConfig(config.rolldown, config.build);
199
+ const {
200
+ build: _legacyBuild,
201
+ plugins: _legacyPlugins,
202
+ vite: _vite,
203
+ rolldown: _rolldown,
204
+ ...rest
205
+ } = config;
206
+ return {
207
+ ...rest,
208
+ ...normalizedVite ? { vite: normalizedVite } : {},
209
+ ...normalizedRolldown ? { rolldown: normalizedRolldown } : {}
210
+ };
211
+ });
154
212
  function getCurrentDate() {
155
213
  const now = new Date;
156
214
  return now.toISOString().split("T")[0];
157
215
  }
158
216
  var FORCED_COMPATIBILITY_FLAGS = ["nodejs_compat", "nodejs_als"];
159
- var configSchema = z.object({
217
+ var canonicalConfigSchema = z.object({
160
218
  name: z.string({
161
219
  required_error: "Worker name is required"
162
220
  }),
@@ -177,11 +235,30 @@ var configSchema = z.object({
177
235
  limits: limitsSchema,
178
236
  observability: observabilitySchema,
179
237
  migrations: z.array(migrationSchema).optional(),
180
- build: buildConfigSchema,
181
- plugins: z.array(z.unknown()).optional(),
238
+ rolldown: rolldownConfigSchema,
239
+ vite: viteConfigSchema,
182
240
  env: z.record(z.string(), envConfigSchemaInner).optional(),
183
241
  wrangler: wranglerConfigSchema
184
242
  });
243
+ var configSchema = canonicalConfigSchema.extend({
244
+ build: buildConfigSchema,
245
+ plugins: z.array(z.unknown()).optional()
246
+ }).transform((config) => {
247
+ const normalizedVite = normalizeViteConfig(config.vite, config.plugins);
248
+ const normalizedRolldown = normalizeRolldownConfig(config.rolldown, config.build);
249
+ const {
250
+ build: _legacyBuild,
251
+ plugins: _legacyPlugins,
252
+ vite: _vite,
253
+ rolldown: _rolldown,
254
+ ...rest
255
+ } = config;
256
+ return {
257
+ ...rest,
258
+ ...normalizedVite ? { vite: normalizedVite } : {},
259
+ ...normalizedRolldown ? { rolldown: normalizedRolldown } : {}
260
+ };
261
+ });
185
262
  function normalizeDOBinding(config) {
186
263
  if (typeof config === "string") {
187
264
  return { className: config };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  DEFAULT_ENTRYPOINT_PATTERN,
3
- findFiles
3
+ findFiles,
4
+ findFilesSync
4
5
  } from "./index-rbht7m9r.js";
5
6
  import {
6
7
  __require
7
8
  } from "./index-37x76zdn.js";
8
9
 
9
10
  // src/utils/entrypoint-discovery.ts
10
- import { readdirSync, readFileSync } from "fs";
11
- import { join } from "path";
11
+ import { readFileSync } from "fs";
12
12
  var ENTRYPOINT_CLASS_PATTERN = /export\s+class\s+(\w+)\s+extends\s+WorkerEntrypoint/g;
13
13
  function findEntrypointClasses(code) {
14
14
  const classes = [];
@@ -19,22 +19,18 @@ function findEntrypointClasses(code) {
19
19
  }
20
20
  return classes;
21
21
  }
22
- var EP_FILE_PATTERN = /^ep\.[^.]+\.ts$/;
23
- function discoverEntrypointsSync(dir) {
22
+ function discoverEntrypointsSync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
24
23
  const discovered = [];
25
24
  try {
26
- const files = readdirSync(dir, { withFileTypes: true });
25
+ const files = findFilesSync(pattern, { cwd });
27
26
  for (const file of files) {
28
- if (file.isFile() && EP_FILE_PATTERN.test(file.name)) {
29
- const filePath = join(dir, file.name);
30
- try {
31
- const code = readFileSync(filePath, "utf-8");
32
- const classNames = findEntrypointClasses(code);
33
- for (const className of classNames) {
34
- discovered.push({ className, filePath });
35
- }
36
- } catch {}
37
- }
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 {}
38
34
  }
39
35
  } catch {}
40
36
  return discovered;