devflare 1.0.0-next.34 → 1.0.0-next.35

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/bin/devflare.js +1 -1
  3. package/dist/{account-p9eywryw.js → account-4tgh03a8.js} +4 -6
  4. package/dist/browser.js +2340 -19
  5. package/dist/{build-8bn7frg8.js → build-rh7ghrgw.js} +7 -10
  6. package/dist/cli/index.js +1377 -6
  7. package/dist/cloudflare/index.js +2 -3
  8. package/dist/config-entry.js +1 -9
  9. package/dist/{config-gphd6wx7.js → config-ghk2bxj3.js} +3 -6
  10. package/dist/{deploy-vpcp41fw.js → deploy-6hzv76sh.js} +13 -17
  11. package/dist/{dev-9scy9gap.js → dev-mkhjdwh7.js} +971 -73
  12. package/dist/{doctor-swfeeqny.js → doctor-0ng5qrr1.js} +2 -3
  13. package/dist/{index-e7xn30bh.js → index-0cc05hzv.js} +1 -1
  14. package/dist/{index-t0r7evpw.js → index-293aqfy4.js} +7 -9
  15. package/dist/{index-3t0e51a0.js → index-2yv7w548.js} +1 -1
  16. package/dist/{index-ksqth51q.js → index-a8pnvg3r.js} +1 -1
  17. package/dist/{index-bhxj7ff6.js → index-e251zhns.js} +943 -117
  18. package/dist/{index-2xz4etye.js → index-hvtd936d.js} +3 -0
  19. package/dist/{index-13sfensw.js → index-kcp7y951.js} +2 -13
  20. package/dist/{index-w8c8tjc5.js → index-mek9msfv.js} +1 -4
  21. package/dist/{index-dem45895.js → index-mjvybn39.js} +1 -1
  22. package/dist/{index-x0wpeb3x.js → index-phcrvs6d.js} +112 -2
  23. package/dist/{index-b20xx2vk.js → index-se4kw8tm.js} +4 -6
  24. package/dist/{index-pd97hk2j.js → index-x8s9rwfh.js} +466 -19
  25. package/dist/index.js +1 -42
  26. package/dist/{login-7vyzeqy4.js → login-4h1sfsed.js} +4 -6
  27. package/dist/{previews-jfbectpc.js → previews-qr7c5j8h.js} +10 -14
  28. package/dist/{productions-49ct4kjm.js → productions-xpmd6bw8.js} +6 -9
  29. package/dist/{remote-6876k6mz.js → remote-kqcvhnfx.js} +100 -5
  30. package/dist/runtime/index.js +0 -63
  31. package/dist/{secrets-9ne7armr.js → secrets-6wbdsdek.js} +3 -5
  32. package/dist/sveltekit/index.js +0 -263
  33. package/dist/test/index.js +2 -4626
  34. package/dist/{types-zekmbebk.js → types-ahnnpphq.js} +6 -8
  35. package/dist/vite/index.js +7 -9
  36. package/dist/{worker-706g8qeh.js → worker-1yg72jxg.js} +6 -9
  37. package/package.json +5 -3
  38. package/dist/index-1trss579.js +0 -2299
  39. package/dist/index-34dejneh.js +0 -214
  40. package/dist/index-3z20d3kd.js +0 -1380
  41. package/dist/index-4xmtkg9g.js +0 -109
  42. package/dist/index-62b3gt2g.js +0 -12
  43. package/dist/index-97rfy7n2.js +0 -413
  44. package/dist/index-c4zd39tc.js +0 -155
  45. package/dist/index-dgx495pv.js +0 -1036
  46. package/dist/index-dm9q84c7.js +0 -360
  47. package/dist/index-pmnb7eke.js +0 -109
  48. package/dist/index-t23wq5js.js +0 -111
  49. package/dist/index-wxdcrzcp.js +0 -475
  50. package/dist/index-x2fd1361.js +0 -133
  51. package/dist/index-za0r01bx.js +0 -588
@@ -12,11 +12,269 @@ import {
12
12
  listR2Buckets,
13
13
  listVectorizeIndexes
14
14
  } from "./index-h7r11y4a.js";
15
- import {
16
- isEnvVarDescriptor,
17
- loadDevflareDotenvIntoProcess,
18
- materializePreviewScopedConfig
19
- } from "./index-wxdcrzcp.js";
15
+
16
+ // src/config/env-vars.ts
17
+ import { existsSync } from "node:fs";
18
+ import { readFile } from "node:fs/promises";
19
+ import { dirname, resolve } from "pathe";
20
+ var ENV_DESCRIPTOR_FLAG = "__devflareEnvDescriptor";
21
+ function createDescriptor(state) {
22
+ const descriptor = {
23
+ [ENV_DESCRIPTOR_FLAG]: true,
24
+ __state: state,
25
+ optional() {
26
+ return createDescriptor({
27
+ ...state,
28
+ optional: true
29
+ });
30
+ },
31
+ parse(parser) {
32
+ return createDescriptor({
33
+ ...state,
34
+ parser
35
+ });
36
+ },
37
+ parser(parser) {
38
+ return this.parse(parser);
39
+ },
40
+ default(value) {
41
+ return createDescriptor({
42
+ ...state,
43
+ defaultValue: value,
44
+ hasDefault: true,
45
+ optional: false
46
+ });
47
+ },
48
+ dev(value) {
49
+ return createDescriptor({
50
+ ...state,
51
+ devValue: value,
52
+ hasDevDefault: true
53
+ });
54
+ }
55
+ };
56
+ return descriptor;
57
+ }
58
+ function createEnvVarDescriptor(name) {
59
+ return createDescriptor({
60
+ name,
61
+ optional: false,
62
+ hasDefault: false,
63
+ hasDevDefault: false
64
+ });
65
+ }
66
+ var env = new Proxy({}, {
67
+ get(_target, prop) {
68
+ if (typeof prop !== "string") {
69
+ return;
70
+ }
71
+ return createEnvVarDescriptor(prop);
72
+ }
73
+ });
74
+ function isEnvVarDescriptor(value) {
75
+ return Boolean(value && typeof value === "object" && value[ENV_DESCRIPTOR_FLAG] === true);
76
+ }
77
+ function parseEnvValue(rawValue) {
78
+ const trimmed = rawValue.trim();
79
+ const quote = trimmed[0];
80
+ if ((quote === '"' || quote === "'" || quote === "`") && trimmed.endsWith(quote) && trimmed.length >= 2) {
81
+ const inner = trimmed.slice(1, -1);
82
+ if (quote !== '"') {
83
+ return inner;
84
+ }
85
+ return inner.replace(/\\n/g, `
86
+ `).replace(/\\r/g, "\r").replace(/\\t/g, "\t").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
87
+ }
88
+ return trimmed;
89
+ }
90
+ function parseDevflareEnvFile(contents) {
91
+ const values = {};
92
+ for (const line of contents.split(/\r?\n/)) {
93
+ const trimmed = line.trim();
94
+ if (!trimmed || trimmed.startsWith("#")) {
95
+ continue;
96
+ }
97
+ const assignment = trimmed.startsWith("export ") ? trimmed.slice("export ".length).trimStart() : trimmed;
98
+ const equalsIndex = assignment.indexOf("=");
99
+ if (equalsIndex <= 0) {
100
+ continue;
101
+ }
102
+ const key = assignment.slice(0, equalsIndex).trim();
103
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
104
+ continue;
105
+ }
106
+ values[key] = parseEnvValue(assignment.slice(equalsIndex + 1));
107
+ }
108
+ return values;
109
+ }
110
+ function collectAncestorDirectories(startDir) {
111
+ const directories = [];
112
+ let current = resolve(startDir);
113
+ while (true) {
114
+ directories.push(current);
115
+ const parent = dirname(current);
116
+ if (parent === current) {
117
+ break;
118
+ }
119
+ current = parent;
120
+ }
121
+ return directories.reverse();
122
+ }
123
+ function getDevflareDotenvPaths(startDir) {
124
+ return collectAncestorDirectories(startDir).flatMap((directory) => [
125
+ resolve(directory, ".env.dev"),
126
+ resolve(directory, ".env")
127
+ ]);
128
+ }
129
+ async function loadDevflareDotenv(startDir) {
130
+ const values = {};
131
+ const files = [];
132
+ for (const filePath of getDevflareDotenvPaths(startDir)) {
133
+ if (!existsSync(filePath)) {
134
+ continue;
135
+ }
136
+ Object.assign(values, parseDevflareEnvFile(await readFile(filePath, "utf8")));
137
+ files.push(filePath);
138
+ }
139
+ return { values, files };
140
+ }
141
+ async function loadDevflareDotenvIntoProcess(startDir) {
142
+ const loaded = await loadDevflareDotenv(startDir);
143
+ for (const [key, value] of Object.entries(loaded.values)) {
144
+ if (process.env[key] === undefined) {
145
+ process.env[key] = value;
146
+ }
147
+ }
148
+ return loaded;
149
+ }
150
+ function formatMissingEnvTree(missing) {
151
+ const root = {};
152
+ for (const item of missing) {
153
+ let current = root;
154
+ for (const segment of item.path.slice(0, -1)) {
155
+ const next = current[segment];
156
+ if (!next || typeof next !== "object") {
157
+ current[segment] = {};
158
+ }
159
+ current = current[segment];
160
+ }
161
+ current[item.path[item.path.length - 1] ?? item.name] = item.name;
162
+ }
163
+ const lines = [];
164
+ const writeNode = (node, depth) => {
165
+ const indent = "\t".repeat(depth);
166
+ for (const [key, value] of Object.entries(node)) {
167
+ if (value && typeof value === "object") {
168
+ lines.push(`${indent}${key}:`);
169
+ writeNode(value, depth + 1);
170
+ } else {
171
+ lines.push(`${indent}${key}: ${String(value)}`);
172
+ }
173
+ }
174
+ };
175
+ writeNode(root, 1);
176
+ return lines.join(`
177
+ `);
178
+ }
179
+
180
+ class EnvVarResolutionError extends Error {
181
+ missing;
182
+ mode;
183
+ code = "ENV_VARS_MISSING";
184
+ constructor(missing, mode) {
185
+ super(["These environment variables are missing:", "", formatMissingEnvTree(missing)].join(`
186
+ `));
187
+ this.missing = missing;
188
+ this.mode = mode;
189
+ this.name = "EnvVarResolutionError";
190
+ }
191
+ }
192
+
193
+ class EnvVarParseError extends Error {
194
+ variableName;
195
+ path;
196
+ code = "ENV_VAR_PARSE_FAILED";
197
+ constructor(variableName, path, cause) {
198
+ super(`Could not parse environment variable ${variableName} for vars.${path.join(".")}.
199
+ ` + `Parser error: ${cause instanceof Error ? cause.message : String(cause)}`);
200
+ this.variableName = variableName;
201
+ this.path = path;
202
+ this.name = "EnvVarParseError";
203
+ }
204
+ }
205
+ function isPlainObject(value) {
206
+ if (!value || typeof value !== "object" || Array.isArray(value) || isEnvVarDescriptor(value)) {
207
+ return false;
208
+ }
209
+ const prototype = Object.getPrototypeOf(value);
210
+ return prototype === Object.prototype || prototype === null;
211
+ }
212
+ var OMIT_VALUE = Symbol("omit optional env var");
213
+ function resolveDescriptorValue(descriptor, sources, path, mode, missing) {
214
+ const state = descriptor.__state;
215
+ const rawValue = sources[state.name];
216
+ if (rawValue !== undefined) {
217
+ try {
218
+ return state.parser ? state.parser(rawValue) : rawValue;
219
+ } catch (error) {
220
+ throw new EnvVarParseError(state.name, path, error);
221
+ }
222
+ }
223
+ if (mode === "dev" && state.hasDevDefault) {
224
+ return state.devValue;
225
+ }
226
+ if (state.hasDefault) {
227
+ return state.defaultValue;
228
+ }
229
+ if (state.optional) {
230
+ return OMIT_VALUE;
231
+ }
232
+ missing.push({ path, name: state.name });
233
+ return OMIT_VALUE;
234
+ }
235
+ function resolveVarValue(value, sources, path, mode, missing) {
236
+ if (isEnvVarDescriptor(value)) {
237
+ return resolveDescriptorValue(value, sources, path, mode, missing);
238
+ }
239
+ if (Array.isArray(value)) {
240
+ return value.map((item, index) => resolveVarValue(item, sources, [...path, String(index)], mode, missing)).filter((item) => item !== OMIT_VALUE);
241
+ }
242
+ if (isPlainObject(value)) {
243
+ const resolved = {};
244
+ for (const [key, childValue] of Object.entries(value)) {
245
+ const child = resolveVarValue(childValue, sources, [...path, key], mode, missing);
246
+ if (child !== OMIT_VALUE) {
247
+ resolved[key] = child;
248
+ }
249
+ }
250
+ return resolved;
251
+ }
252
+ return value;
253
+ }
254
+ function resolveVarsObject(vars, sources, mode, missing) {
255
+ if (!vars) {
256
+ return vars;
257
+ }
258
+ const resolved = resolveVarValue(vars, sources, [], mode, missing);
259
+ return resolved === OMIT_VALUE ? undefined : resolved;
260
+ }
261
+ async function resolveConfigEnvVars(config, options) {
262
+ const startDir = options.configPath ? dirname(resolve(options.cwd, options.configPath)) : options.cwd;
263
+ const dotenv = await loadDevflareDotenv(startDir);
264
+ const sources = {
265
+ ...dotenv.values,
266
+ ...process.env
267
+ };
268
+ const missing = [];
269
+ const vars = resolveVarsObject(config.vars, sources, options.mode, missing);
270
+ if (missing.length > 0) {
271
+ throw new EnvVarResolutionError(missing, options.mode);
272
+ }
273
+ return vars === config.vars ? config : {
274
+ ...config,
275
+ vars
276
+ };
277
+ }
20
278
 
21
279
  // src/config/schema-bindings.ts
22
280
  import { z } from "zod";
@@ -712,8 +970,197 @@ var canonicalConfigSchema = z5.object({
712
970
  });
713
971
  var configSchema = canonicalConfigSchema;
714
972
 
973
+ // src/config/preview.ts
974
+ var PREVIEW_SCOPED_NAME_PREFIX = "__DEVFLARE_PREVIEW_SCOPE__:";
975
+ function invalidPreviewScopedName(reason) {
976
+ throw new Error(`Invalid Devflare preview-scoped value: ${reason}. Recreate it with preview.scope(...) instead of constructing preview markers manually.`);
977
+ }
978
+ function decodePreviewScopedName(value) {
979
+ const payload = value.slice(PREVIEW_SCOPED_NAME_PREFIX.length);
980
+ let parsed;
981
+ try {
982
+ parsed = JSON.parse(payload);
983
+ } catch {
984
+ invalidPreviewScopedName("the encoded payload is not valid JSON");
985
+ }
986
+ const baseName = typeof parsed.baseName === "string" ? parsed.baseName : "";
987
+ if (!baseName.trim()) {
988
+ invalidPreviewScopedName("the encoded payload is missing a non-empty baseName");
989
+ }
990
+ return {
991
+ baseName,
992
+ separator: typeof parsed.separator === "string" && parsed.separator.length > 0 ? parsed.separator : "-"
993
+ };
994
+ }
995
+ function normalizePreviewFragment(rawValue) {
996
+ let normalized = rawValue.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
997
+ if (!normalized) {
998
+ normalized = "preview";
999
+ }
1000
+ if (!/^[a-z]/.test(normalized)) {
1001
+ normalized = `b-${normalized}`;
1002
+ }
1003
+ return normalized;
1004
+ }
1005
+ function getPreviewIdentifierFromEnv(env2) {
1006
+ const explicitIdentifier = env2.DEVFLARE_PREVIEW_IDENTIFIER?.trim();
1007
+ if (explicitIdentifier) {
1008
+ return {
1009
+ identifier: normalizePreviewFragment(explicitIdentifier),
1010
+ source: "env-identifier"
1011
+ };
1012
+ }
1013
+ const previewPr = env2.DEVFLARE_PREVIEW_PR?.trim();
1014
+ if (previewPr) {
1015
+ return {
1016
+ identifier: normalizePreviewFragment(`pr-${previewPr}`),
1017
+ source: "env-pr"
1018
+ };
1019
+ }
1020
+ const previewBranch = env2.DEVFLARE_PREVIEW_BRANCH?.trim();
1021
+ if (previewBranch) {
1022
+ return {
1023
+ identifier: normalizePreviewFragment(previewBranch),
1024
+ source: "env-branch"
1025
+ };
1026
+ }
1027
+ return {
1028
+ identifier: undefined,
1029
+ source: "none"
1030
+ };
1031
+ }
1032
+ function resolvePreviewIdentifier(options = {}) {
1033
+ if (options.identifier?.trim()) {
1034
+ return {
1035
+ identifier: normalizePreviewFragment(options.identifier),
1036
+ source: "identifier"
1037
+ };
1038
+ }
1039
+ const env2 = options.env ?? process.env;
1040
+ const envIdentifier = getPreviewIdentifierFromEnv(env2);
1041
+ if (envIdentifier.identifier) {
1042
+ return envIdentifier;
1043
+ }
1044
+ return options.environment === "preview" ? {
1045
+ identifier: "preview",
1046
+ source: "environment"
1047
+ } : {
1048
+ identifier: undefined,
1049
+ source: "none"
1050
+ };
1051
+ }
1052
+ function mapRecordValues(record, mapper) {
1053
+ return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, mapper(value)]));
1054
+ }
1055
+ function isPreviewScopedName(value) {
1056
+ return typeof value === "string" && value.startsWith(PREVIEW_SCOPED_NAME_PREFIX);
1057
+ }
1058
+ function materializePreviewScopedString(value, options = {}) {
1059
+ if (!isPreviewScopedName(value)) {
1060
+ return value;
1061
+ }
1062
+ const scoped = decodePreviewScopedName(value);
1063
+ const previewIdentifier = resolvePreviewIdentifier(options).identifier;
1064
+ return previewIdentifier ? `${scoped.baseName}${scoped.separator}${previewIdentifier}` : scoped.baseName;
1065
+ }
1066
+ function materializePreviewScopedConfig(config, options = {}) {
1067
+ if (!config.bindings) {
1068
+ return config;
1069
+ }
1070
+ const bindings = config.bindings;
1071
+ const hasPreviewIdentifier = Boolean(resolvePreviewIdentifier(options).identifier);
1072
+ return {
1073
+ ...config,
1074
+ bindings: {
1075
+ ...bindings,
1076
+ ...bindings.kv ? {
1077
+ kv: mapRecordValues(bindings.kv, (binding) => {
1078
+ return typeof binding === "string" ? materializePreviewScopedString(binding, options) : binding;
1079
+ })
1080
+ } : {},
1081
+ ...bindings.d1 ? {
1082
+ d1: mapRecordValues(bindings.d1, (binding) => {
1083
+ return typeof binding === "string" ? materializePreviewScopedString(binding, options) : binding;
1084
+ })
1085
+ } : {},
1086
+ ...bindings.r2 ? {
1087
+ r2: mapRecordValues(bindings.r2, (binding) => {
1088
+ return materializePreviewScopedString(binding, options);
1089
+ })
1090
+ } : {},
1091
+ ...bindings.queues ? {
1092
+ queues: {
1093
+ ...bindings.queues,
1094
+ ...bindings.queues.producers ? {
1095
+ producers: mapRecordValues(bindings.queues.producers, (queueName) => {
1096
+ return materializePreviewScopedString(queueName, options);
1097
+ })
1098
+ } : {},
1099
+ ...bindings.queues.consumers ? {
1100
+ consumers: bindings.queues.consumers.map((consumer) => ({
1101
+ ...consumer,
1102
+ queue: materializePreviewScopedString(consumer.queue, options),
1103
+ ...consumer.deadLetterQueue ? {
1104
+ deadLetterQueue: materializePreviewScopedString(consumer.deadLetterQueue, options)
1105
+ } : {}
1106
+ }))
1107
+ } : {}
1108
+ }
1109
+ } : {},
1110
+ ...bindings.services ? {
1111
+ services: mapRecordValues(bindings.services, (binding) => ({
1112
+ ...binding,
1113
+ service: materializePreviewScopedString(binding.service, options)
1114
+ }))
1115
+ } : {},
1116
+ ...bindings.vectorize ? {
1117
+ vectorize: mapRecordValues(bindings.vectorize, (binding) => ({
1118
+ ...binding,
1119
+ indexName: materializePreviewScopedString(binding.indexName, options)
1120
+ }))
1121
+ } : {},
1122
+ ...bindings.hyperdrive ? {
1123
+ hyperdrive: mapRecordValues(bindings.hyperdrive, (binding) => {
1124
+ if (typeof binding === "string") {
1125
+ return materializePreviewScopedString(binding, options);
1126
+ }
1127
+ if (binding && typeof binding === "object" && "name" in binding && typeof binding.name === "string") {
1128
+ if (hasPreviewIdentifier && binding.previewId) {
1129
+ return {
1130
+ id: binding.previewId,
1131
+ ...binding.localConnectionString && {
1132
+ localConnectionString: binding.localConnectionString
1133
+ },
1134
+ ...!binding.localConnectionString && binding.previewLocalConnectionString && {
1135
+ localConnectionString: binding.previewLocalConnectionString
1136
+ }
1137
+ };
1138
+ }
1139
+ return {
1140
+ ...binding,
1141
+ name: materializePreviewScopedString(binding.name, options)
1142
+ };
1143
+ }
1144
+ return binding;
1145
+ })
1146
+ } : {},
1147
+ ...bindings.browser ? {
1148
+ browser: mapRecordValues(bindings.browser, (binding) => {
1149
+ return typeof binding === "string" ? materializePreviewScopedString(binding, options) : binding;
1150
+ })
1151
+ } : {},
1152
+ ...bindings.analyticsEngine ? {
1153
+ analyticsEngine: mapRecordValues(bindings.analyticsEngine, (binding) => ({
1154
+ ...binding,
1155
+ dataset: materializePreviewScopedString(binding.dataset, options)
1156
+ }))
1157
+ } : {}
1158
+ }
1159
+ };
1160
+ }
1161
+
715
1162
  // src/config/resolve.ts
716
- function isPlainObject(value) {
1163
+ function isPlainObject2(value) {
717
1164
  if (!value || typeof value !== "object" || Array.isArray(value)) {
718
1165
  return false;
719
1166
  }
@@ -727,8 +1174,8 @@ function mergeEnvironmentValue(base, override) {
727
1174
  if (Array.isArray(override)) {
728
1175
  return [...override];
729
1176
  }
730
- if (isPlainObject(override)) {
731
- const baseObject = isPlainObject(base) ? base : {};
1177
+ if (isPlainObject2(override)) {
1178
+ const baseObject = isPlainObject2(base) ? base : {};
732
1179
  const mergedObject = {
733
1180
  ...baseObject
734
1181
  };
@@ -840,12 +1287,12 @@ function formatMissingBindings(missing) {
840
1287
  }
841
1288
 
842
1289
  // src/config/loader.ts
843
- import { existsSync } from "node:fs";
1290
+ import { existsSync as existsSync2 } from "node:fs";
844
1291
  import { createRequire } from "node:module";
845
- import { dirname, join as join2, resolve } from "pathe";
1292
+ import { dirname as dirname2, join as join2, resolve as resolve2 } from "pathe";
846
1293
 
847
1294
  // src/config/framework-providers.ts
848
- import { readFile } from "node:fs/promises";
1295
+ import { readFile as readFile2 } from "node:fs/promises";
849
1296
  import { join } from "pathe";
850
1297
  var SVELTE_CONFIG_FILES = [
851
1298
  "svelte.config.js",
@@ -855,7 +1302,7 @@ var SVELTE_CONFIG_FILES = [
855
1302
  ];
856
1303
  async function readTextIfExists(path) {
857
1304
  try {
858
- return await readFile(path, "utf-8");
1305
+ return await readFile2(path, "utf-8");
859
1306
  } catch {
860
1307
  return null;
861
1308
  }
@@ -965,24 +1412,24 @@ function resolveC12Module(cwd) {
965
1412
  }
966
1413
  }
967
1414
  async function resolveConfigDotenvDirectory(cwd, configFile) {
968
- const explicitConfigPath = resolve(cwd, configFile);
969
- if (existsSync(explicitConfigPath)) {
970
- return dirname(explicitConfigPath);
1415
+ const explicitConfigPath = resolve2(cwd, configFile);
1416
+ if (existsSync2(explicitConfigPath)) {
1417
+ return dirname2(explicitConfigPath);
971
1418
  }
972
1419
  const discoveredConfigPath = await resolveConfigPath(cwd);
973
- return discoveredConfigPath ? dirname(discoveredConfigPath) : cwd;
1420
+ return discoveredConfigPath ? dirname2(discoveredConfigPath) : cwd;
974
1421
  }
975
1422
  async function resolveConfigPath(cwd) {
976
1423
  for (const file of CONFIG_FILES) {
977
1424
  const path = join2(cwd, file);
978
- if (existsSync(path)) {
1425
+ if (existsSync2(path)) {
979
1426
  return path;
980
1427
  }
981
1428
  }
982
1429
  return;
983
1430
  }
984
1431
  async function loadConfig(options = {}) {
985
- const cwd = resolve(options.cwd ?? process.cwd());
1432
+ const cwd = resolve2(options.cwd ?? process.cwd());
986
1433
  const configFile = options.configFile ?? "devflare.config";
987
1434
  const { loadConfig: c12LoadConfig } = resolveC12Module(cwd);
988
1435
  await loadDevflareDotenvIntoProcess(await resolveConfigDotenvDirectory(cwd, configFile));
@@ -1570,4 +2017,4 @@ async function prepareConfigResourcesForDeploy(config, options = {}) {
1570
2017
  });
1571
2018
  }
1572
2019
 
1573
- export { normalizeCompatibilityFlags, browserBindingSchema, getSingleBrowserBindingName, normalizeDOBinding, normalizeD1Binding, normalizeKVBinding, normalizeHyperdriveBinding, normalizeMtlsCertificateBinding, normalizeDispatchNamespaceBinding, normalizeWorkflowBinding, normalizePipelineBinding, normalizeImagesBinding, normalizeMediaBinding, normalizeArtifactsBinding, normalizeSecretsStoreBinding, getLocalKVNamespaceIdentifier, getLocalD1DatabaseIdentifier, configSchema, mergeConfigForEnvironment, resolveConfigForEnvironment, prepareConfigResourcesForDeploy, resolveResources, ConfigResourceResolutionError, loadResolvedConfig, resolveConfigPath, loadConfig, ConfigNotFoundError, ConfigValidationError };
2020
+ export { getDevflareDotenvPaths, EnvVarResolutionError, resolveConfigEnvVars, normalizeCompatibilityFlags, browserBindingSchema, getSingleBrowserBindingName, normalizeDOBinding, normalizeD1Binding, normalizeKVBinding, normalizeHyperdriveBinding, normalizeMtlsCertificateBinding, normalizeDispatchNamespaceBinding, normalizeWorkflowBinding, normalizePipelineBinding, normalizeImagesBinding, normalizeMediaBinding, normalizeArtifactsBinding, normalizeSecretsStoreBinding, getLocalKVNamespaceIdentifier, getLocalD1DatabaseIdentifier, configSchema, resolvePreviewIdentifier, isPreviewScopedName, materializePreviewScopedString, materializePreviewScopedConfig, mergeConfigForEnvironment, resolveConfigForEnvironment, prepareConfigResourcesForDeploy, resolveResources, ConfigResourceResolutionError, loadResolvedConfig, resolveConfigPath, loadConfig, ConfigNotFoundError };
package/dist/index.js CHANGED
@@ -1,44 +1,3 @@
1
- import {
2
- workerName
3
- } from "./index-62b3gt2g.js";
4
- import {
5
- parseArgs,
6
- runCli
7
- } from "./index-3z20d3kd.js";
8
- import"./index-627srx16.js";
9
- import"./index-maw0jjnn.js";
10
- import"./index-3t6rypgc.js";
11
- import {
12
- env,
13
- vars
14
- } from "./index-t23wq5js.js";
15
- import {
16
- durableObject,
17
- getDurableObjectOptions
18
- } from "./index-y7w3x9p1.js";
19
- import"./index-1trss579.js";
20
- import"./index-n4xkaymm.js";
21
- import {
22
- compileConfig,
23
- stringifyConfig
24
- } from "./index-w8c8tjc5.js";
25
- import {
26
- ConfigNotFoundError,
27
- ConfigResourceResolutionError,
28
- ConfigValidationError,
29
- configSchema,
30
- loadConfig,
31
- loadResolvedConfig
32
- } from "./index-pd97hk2j.js";
33
- import"./index-h7r11y4a.js";
34
- import"./index-04wh9bxx.js";
35
- import {
36
- preview
37
- } from "./index-wxdcrzcp.js";
38
- import {
39
- defineConfig,
40
- ref
41
- } from "./index-34dejneh.js";
42
1
  import"./index-37x76zdn.js";
43
2
  export {
44
3
  workerName,
@@ -54,7 +13,7 @@ export {
54
13
  env,
55
14
  durableObject,
56
15
  defineConfig,
57
- defineConfig as default,
16
+ defineConfig2 as default,
58
17
  configSchema,
59
18
  compileConfig,
60
19
  ConfigValidationError,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getConfiguredAccountId
3
- } from "./index-e7xn30bh.js";
3
+ } from "./index-0cc05hzv.js";
4
4
  import {
5
5
  account
6
- } from "./index-x2fd1361.js";
6
+ } from "./index-phcrvs6d.js";
7
7
  import"./index-atwc3csp.js";
8
- import"./index-2xz4etye.js";
8
+ import"./index-hvtd936d.js";
9
9
  import {
10
10
  getDependencies
11
11
  } from "./index-z9gy8w6b.js";
@@ -18,11 +18,9 @@ import {
18
18
  yellow
19
19
  } from "./index-maw0jjnn.js";
20
20
  import"./index-3t6rypgc.js";
21
- import"./index-x0wpeb3x.js";
22
- import"./index-pd97hk2j.js";
21
+ import"./index-x8s9rwfh.js";
23
22
  import"./index-h7r11y4a.js";
24
23
  import"./index-04wh9bxx.js";
25
- import"./index-wxdcrzcp.js";
26
24
  import"./index-37x76zdn.js";
27
25
 
28
26
  // src/cli/commands/login.ts
@@ -4,23 +4,23 @@ import {
4
4
  buildStableWorkerRowsFromLiveWorkers,
5
5
  collectConfiguredWorkerFamilies,
6
6
  orderPreviewWorkerNamesForDeletion
7
- } from "./index-3t0e51a0.js";
7
+ } from "./index-2yv7w548.js";
8
8
  import {
9
9
  cleanupPreviewScopedResources
10
- } from "./index-b20xx2vk.js";
10
+ } from "./index-se4kw8tm.js";
11
11
  import {
12
12
  findConfigPathsUnderDirectory
13
- } from "./index-ksqth51q.js";
13
+ } from "./index-a8pnvg3r.js";
14
14
  import {
15
15
  asOptionalString,
16
16
  resolveCloudflareAccountId,
17
17
  resolveNamedSelection
18
- } from "./index-e7xn30bh.js";
18
+ } from "./index-0cc05hzv.js";
19
19
  import {
20
20
  account
21
- } from "./index-x2fd1361.js";
21
+ } from "./index-phcrvs6d.js";
22
22
  import"./index-atwc3csp.js";
23
- import"./index-2xz4etye.js";
23
+ import"./index-hvtd936d.js";
24
24
  import {
25
25
  getDependencies
26
26
  } from "./index-z9gy8w6b.js";
@@ -38,23 +38,19 @@ import {
38
38
  yellowBold
39
39
  } from "./index-maw0jjnn.js";
40
40
  import"./index-3t6rypgc.js";
41
- import"./index-x0wpeb3x.js";
42
41
  import"./index-5dkjffqz.js";
43
42
  import {
44
43
  compileBuildConfig
45
- } from "./index-w8c8tjc5.js";
44
+ } from "./index-mek9msfv.js";
46
45
  import {
47
46
  ConfigNotFoundError,
48
47
  loadConfig,
49
48
  loadResolvedConfig,
50
- resolveConfigPath
51
- } from "./index-pd97hk2j.js";
49
+ resolveConfigPath,
50
+ resolvePreviewIdentifier
51
+ } from "./index-x8s9rwfh.js";
52
52
  import"./index-h7r11y4a.js";
53
53
  import"./index-04wh9bxx.js";
54
- import {
55
- resolvePreviewIdentifier
56
- } from "./index-wxdcrzcp.js";
57
- import"./index-34dejneh.js";
58
54
  import"./index-37x76zdn.js";
59
55
 
60
56
  // src/cli/preview-bindings.ts