devflare 1.0.0-next.33 → 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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/LLM.md +9 -9
  3. package/bin/devflare.js +1 -1
  4. package/dist/{account-p9eywryw.js → account-4tgh03a8.js} +4 -6
  5. package/dist/browser.js +2340 -19
  6. package/dist/{build-8bn7frg8.js → build-rh7ghrgw.js} +7 -10
  7. package/dist/cli/index.js +1377 -6
  8. package/dist/cloudflare/index.js +2 -3
  9. package/dist/config/resolve-phased.d.ts.map +1 -1
  10. package/dist/config-entry.js +1 -9
  11. package/dist/{config-gphd6wx7.js → config-ghk2bxj3.js} +3 -6
  12. package/dist/{deploy-vpcp41fw.js → deploy-6hzv76sh.js} +13 -17
  13. package/dist/{dev-9scy9gap.js → dev-mkhjdwh7.js} +971 -73
  14. package/dist/{doctor-swfeeqny.js → doctor-0ng5qrr1.js} +2 -3
  15. package/dist/{index-e7xn30bh.js → index-0cc05hzv.js} +1 -1
  16. package/dist/{index-t0r7evpw.js → index-293aqfy4.js} +7 -9
  17. package/dist/{index-3t0e51a0.js → index-2yv7w548.js} +1 -1
  18. package/dist/{index-ksqth51q.js → index-a8pnvg3r.js} +1 -1
  19. package/dist/{index-bhxj7ff6.js → index-e251zhns.js} +943 -117
  20. package/dist/{index-2xz4etye.js → index-hvtd936d.js} +3 -0
  21. package/dist/{index-13sfensw.js → index-kcp7y951.js} +2 -13
  22. package/dist/{index-w8c8tjc5.js → index-mek9msfv.js} +1 -4
  23. package/dist/{index-dem45895.js → index-mjvybn39.js} +1 -1
  24. package/dist/{index-x0wpeb3x.js → index-phcrvs6d.js} +112 -2
  25. package/dist/{index-b20xx2vk.js → index-se4kw8tm.js} +4 -6
  26. package/dist/{index-pd97hk2j.js → index-x8s9rwfh.js} +466 -19
  27. package/dist/index.js +1 -42
  28. package/dist/{login-7vyzeqy4.js → login-4h1sfsed.js} +4 -6
  29. package/dist/{previews-jfbectpc.js → previews-qr7c5j8h.js} +10 -14
  30. package/dist/{productions-49ct4kjm.js → productions-xpmd6bw8.js} +6 -9
  31. package/dist/{remote-6876k6mz.js → remote-kqcvhnfx.js} +100 -5
  32. package/dist/runtime/index.js +0 -63
  33. package/dist/{secrets-9ne7armr.js → secrets-6wbdsdek.js} +3 -5
  34. package/dist/sveltekit/index.js +0 -263
  35. package/dist/test/binding-hints.d.ts +2 -3
  36. package/dist/test/binding-hints.d.ts.map +1 -1
  37. package/dist/test/index.js +2 -4626
  38. package/dist/{types-zekmbebk.js → types-ahnnpphq.js} +6 -8
  39. package/dist/vite/index.js +7 -9
  40. package/dist/{worker-706g8qeh.js → worker-1yg72jxg.js} +6 -9
  41. package/package.json +5 -3
  42. package/dist/index-1trss579.js +0 -2299
  43. package/dist/index-34dejneh.js +0 -214
  44. package/dist/index-3z20d3kd.js +0 -1380
  45. package/dist/index-4xmtkg9g.js +0 -109
  46. package/dist/index-62b3gt2g.js +0 -12
  47. package/dist/index-97rfy7n2.js +0 -413
  48. package/dist/index-c4zd39tc.js +0 -155
  49. package/dist/index-dgx495pv.js +0 -1036
  50. package/dist/index-dm9q84c7.js +0 -360
  51. package/dist/index-pmnb7eke.js +0 -109
  52. package/dist/index-t23wq5js.js +0 -111
  53. package/dist/index-wxdcrzcp.js +0 -475
  54. package/dist/index-x2fd1361.js +0 -133
  55. package/dist/index-za0r01bx.js +0 -588
@@ -1,214 +0,0 @@
1
- // src/config/define.ts
2
- function defineConfig(config) {
3
- if (typeof config === "function") {
4
- const result = config();
5
- if (result instanceof Promise) {
6
- return result;
7
- }
8
- return result;
9
- }
10
- return config;
11
- }
12
-
13
- // src/config/ref.ts
14
- var resolvedCache = new WeakMap;
15
- var pendingResolutions = new WeakMap;
16
- var PENDING_REF_VALUE = "<pending>";
17
- function extractConfigPathFromImportFn(fn) {
18
- let source;
19
- try {
20
- source = Function.prototype.toString.call(fn);
21
- } catch {
22
- return PENDING_REF_VALUE;
23
- }
24
- if (!/import\s*\(/.test(source)) {
25
- return PENDING_REF_VALUE;
26
- }
27
- const match = source.match(/import\s*\(\s*(['"`])([^'"`]+)\1\s*\)/);
28
- const raw = match?.[2];
29
- if (!raw || raw.length === 0) {
30
- throw new Error("ref() could not extract a config path from the import function source. " + "The specifier must be a static string literal — dynamic or computed " + "specifiers (e.g. template literals with expressions) are not supported. " + "If this input has been minified, pass an unminified config source.");
31
- }
32
- if (match?.[1] === "`" && /\$\{/.test(raw)) {
33
- throw new Error("ref() import specifier is a template literal with an embedded expression. " + "The specifier must be a static string literal so the config path can " + "be resolved ahead of time.");
34
- }
35
- if (raw.length < 2 && !/[./]/.test(raw)) {
36
- throw new Error(`ref() extracted a suspiciously short config path (${JSON.stringify(raw)}). ` + "This usually indicates a minified bundle where the original specifier " + "was rewritten. Pass an unminified config source.");
37
- }
38
- return raw;
39
- }
40
- function ref(nameOrImport, maybeImport) {
41
- const nameOverride = typeof nameOrImport === "string" ? nameOrImport : undefined;
42
- let importFn;
43
- if (typeof nameOrImport === "function") {
44
- importFn = nameOrImport;
45
- } else if (typeof maybeImport === "function") {
46
- importFn = maybeImport;
47
- }
48
- if (!importFn) {
49
- throw new Error("ref() requires an import function");
50
- }
51
- const resolvedImportFn = importFn;
52
- const configPath = extractConfigPathFromImportFn(resolvedImportFn);
53
- const doBindingCache = new Map;
54
- async function doResolve() {
55
- const cached = resolvedCache.get(proxy);
56
- if (cached)
57
- return cached;
58
- const pending = pendingResolutions.get(proxy);
59
- if (pending)
60
- return pending;
61
- const promise = (async () => {
62
- const module = await resolvedImportFn();
63
- const config = "default" in module ? module.default : module;
64
- if (!config.name && !nameOverride) {
65
- throw new Error('Referenced config must have a "name" property');
66
- }
67
- const resolved = {
68
- name: nameOverride ?? config.name,
69
- config,
70
- configPath
71
- };
72
- resolvedCache.set(proxy, resolved);
73
- return resolved;
74
- })();
75
- const trackedPromise = promise.finally(() => {
76
- pendingResolutions.delete(proxy);
77
- });
78
- pendingResolutions.set(proxy, trackedPromise);
79
- return trackedPromise;
80
- }
81
- function getResolved() {
82
- const cached = resolvedCache.get(proxy);
83
- if (cached)
84
- return cached;
85
- throw new Error("ref() not yet resolved. Call ref().resolve() first, or use top-level await " + "in your config file to resolve all refs before exporting.");
86
- }
87
- function createWorkerBinding(entrypoint) {
88
- return {
89
- get service() {
90
- const cached = resolvedCache.get(proxy);
91
- if (cached)
92
- return cached.name;
93
- if (nameOverride)
94
- return nameOverride;
95
- return PENDING_REF_VALUE;
96
- },
97
- entrypoint,
98
- __ref: proxy
99
- };
100
- }
101
- const workerAccessor = new Proxy((entrypoint) => createWorkerBinding(entrypoint), {
102
- get(target, prop) {
103
- if (prop === "service") {
104
- const cached = resolvedCache.get(proxy);
105
- if (cached)
106
- return cached.name;
107
- if (nameOverride)
108
- return nameOverride;
109
- return PENDING_REF_VALUE;
110
- }
111
- if (prop === "entrypoint")
112
- return;
113
- if (prop === "__ref")
114
- return proxy;
115
- return Reflect.get(target, prop);
116
- }
117
- });
118
- function createDOBinding(bindingName) {
119
- const cachedBinding = doBindingCache.get(bindingName);
120
- if (cachedBinding) {
121
- return cachedBinding;
122
- }
123
- const doBinding = {
124
- get className() {
125
- const cached = resolvedCache.get(proxy);
126
- if (cached?.config.bindings?.durableObjects) {
127
- const doBindings = cached.config.bindings.durableObjects;
128
- const doConfig = doBindings[bindingName];
129
- if (typeof doConfig === "string") {
130
- return doConfig;
131
- }
132
- if (doConfig && typeof doConfig === "object" && "className" in doConfig) {
133
- return doConfig.className;
134
- }
135
- }
136
- return PENDING_REF_VALUE;
137
- },
138
- get scriptName() {
139
- const cached = resolvedCache.get(proxy);
140
- if (cached)
141
- return cached.name;
142
- if (nameOverride)
143
- return nameOverride;
144
- return PENDING_REF_VALUE;
145
- },
146
- kind: "cross-worker",
147
- __ref: proxy
148
- };
149
- doBindingCache.set(bindingName, doBinding);
150
- return doBinding;
151
- }
152
- const knownProps = new Set([
153
- "name",
154
- "config",
155
- "configPath",
156
- "worker",
157
- "__import",
158
- "__nameOverride",
159
- "resolve",
160
- "then"
161
- ]);
162
- const proxyTarget = {
163
- get name() {
164
- return getResolved().name;
165
- },
166
- get config() {
167
- return getResolved().config;
168
- },
169
- configPath,
170
- worker: workerAccessor,
171
- __import: resolvedImportFn,
172
- __nameOverride: nameOverride,
173
- resolve: doResolve
174
- };
175
- const proxy = new Proxy(proxyTarget, {
176
- get(target, prop) {
177
- if (typeof prop === "string" && knownProps.has(prop)) {
178
- return Reflect.get(target, prop);
179
- }
180
- if (typeof prop === "symbol") {
181
- return Reflect.get(target, prop);
182
- }
183
- if (typeof prop === "string" && /^[A-Z][A-Z0-9_]*$/.test(prop)) {
184
- const cached = resolvedCache.get(proxy);
185
- if (cached) {
186
- const doBindings = cached.config.bindings?.durableObjects;
187
- if (!doBindings || !(prop in doBindings)) {
188
- return;
189
- }
190
- }
191
- return createDOBinding(prop);
192
- }
193
- return Reflect.get(target, prop);
194
- },
195
- has(target, prop) {
196
- if (typeof prop === "string") {
197
- if (knownProps.has(prop))
198
- return true;
199
- if (/^[A-Z][A-Z0-9_]*$/.test(prop)) {
200
- const cached = resolvedCache.get(proxy);
201
- if (cached) {
202
- const doBindings = cached.config.bindings?.durableObjects;
203
- return !!doBindings && prop in doBindings;
204
- }
205
- return true;
206
- }
207
- }
208
- return Reflect.has(target, prop);
209
- }
210
- });
211
- return proxy;
212
- }
213
-
214
- export { defineConfig, ref };