devflare 1.0.0-next.21 → 1.0.0-next.23

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 (133) hide show
  1. package/LLM.md +144 -5
  2. package/dist/account-j8nfggg4.js +475 -0
  3. package/dist/account-qhe8vtds.js +475 -0
  4. package/dist/bridge/gateway-runtime.d.ts +1 -1
  5. package/dist/bridge/gateway-runtime.d.ts.map +1 -1
  6. package/dist/bridge/miniflare.d.ts +1 -1
  7. package/dist/bridge/miniflare.d.ts.map +1 -1
  8. package/dist/bridge/proxy.d.ts +2 -0
  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 +13 -13
  12. package/dist/browser.d.ts.map +1 -1
  13. package/dist/browser.js +5 -3
  14. package/dist/build-qsgnme4z.js +54 -0
  15. package/dist/build-vy95gy3f.js +54 -0
  16. package/dist/build-yzx0gsaj.js +54 -0
  17. package/dist/cli/commands/build-artifacts.d.ts.map +1 -1
  18. package/dist/cli/commands/config.d.ts.map +1 -1
  19. package/dist/cli/commands/type-generation/generator.d.ts +4 -2
  20. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -1
  21. package/dist/cli/commands/types.d.ts.map +1 -1
  22. package/dist/cli/index.js +1 -1
  23. package/dist/config/compiler/types.d.ts +1 -1
  24. package/dist/config/compiler/types.d.ts.map +1 -1
  25. package/dist/config/define.d.ts +7 -4
  26. package/dist/config/define.d.ts.map +1 -1
  27. package/dist/config/env-vars.d.ts +309 -0
  28. package/dist/config/env-vars.d.ts.map +1 -0
  29. package/dist/config/index.d.ts +2 -1
  30. package/dist/config/index.d.ts.map +1 -1
  31. package/dist/config/loader.d.ts.map +1 -1
  32. package/dist/config/local-dev-vars.d.ts +2 -2
  33. package/dist/config/local-dev-vars.d.ts.map +1 -1
  34. package/dist/config/schema-env.d.ts +6 -6
  35. package/dist/config/schema-types-bindings-platform.d.ts +378 -0
  36. package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
  37. package/dist/config/schema-types-bindings-resources.d.ts +551 -0
  38. package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
  39. package/dist/config/schema-types-bindings.d.ts +254 -0
  40. package/dist/config/schema-types-bindings.d.ts.map +1 -0
  41. package/dist/config/schema-types-build.d.ts +86 -0
  42. package/dist/config/schema-types-build.d.ts.map +1 -0
  43. package/dist/config/schema-types-runtime.d.ts +882 -0
  44. package/dist/config/schema-types-runtime.d.ts.map +1 -0
  45. package/dist/config/schema-types.d.ts +377 -0
  46. package/dist/config/schema-types.d.ts.map +1 -0
  47. package/dist/config/schema.d.ts +14 -15
  48. package/dist/config/schema.d.ts.map +1 -1
  49. package/dist/config-entry.d.ts +2 -0
  50. package/dist/config-entry.d.ts.map +1 -1
  51. package/dist/config-entry.js +3 -1
  52. package/dist/config-gq5jh4cx.js +105 -0
  53. package/dist/config-vec13050.js +105 -0
  54. package/dist/deploy-01j0ep5n.js +1055 -0
  55. package/dist/deploy-nh5tbv45.js +1055 -0
  56. package/dist/deploy-tjypkhg7.js +1055 -0
  57. package/dist/dev-bh581ew3.js +2597 -0
  58. package/dist/dev-cme5de75.js +2551 -0
  59. package/dist/dev-gn5y93z9.js +2597 -0
  60. package/dist/dev-server/server.d.ts.map +1 -1
  61. package/dist/doctor-h5q28qt1.js +259 -0
  62. package/dist/doctor-khk550tw.js +259 -0
  63. package/dist/env.d.ts +10 -0
  64. package/dist/env.d.ts.map +1 -1
  65. package/dist/index-0bv2qjs1.js +1555 -0
  66. package/dist/index-35bmgpfw.js +573 -0
  67. package/dist/index-3tkzn06q.js +413 -0
  68. package/dist/index-4se6krdj.js +574 -0
  69. package/dist/index-8fyz6gcm.js +699 -0
  70. package/dist/index-97z629zr.js +109 -0
  71. package/dist/index-b28c4yr4.js +1205 -0
  72. package/dist/index-c1cj9085.js +2250 -0
  73. package/dist/index-c8p4njqy.js +479 -0
  74. package/dist/index-cr06zrgw.js +1033 -0
  75. package/dist/index-cwjjdtgn.js +74 -0
  76. package/dist/index-dref9ecb.js +476 -0
  77. package/dist/index-e151t4ge.js +895 -0
  78. package/dist/index-e7kakw0j.js +1033 -0
  79. package/dist/index-f1g5jdm8.js +1426 -0
  80. package/dist/index-f46984zs.js +1554 -0
  81. package/dist/index-grk8pzhr.js +185 -0
  82. package/dist/index-hbxkmb1q.js +1426 -0
  83. package/dist/index-hzmpecq9.js +52 -0
  84. package/dist/index-j1csb7gb.js +581 -0
  85. package/dist/index-j7x7f72h.js +185 -0
  86. package/dist/index-jkqbjwt2.js +476 -0
  87. package/dist/index-jwd3fanx.js +412 -0
  88. package/dist/index-mh5renra.js +895 -0
  89. package/dist/index-p9xq83p7.js +147 -0
  90. package/dist/index-q15nj71j.js +52 -0
  91. package/dist/index-qqp65pyv.js +699 -0
  92. package/dist/index-s0fmwxbk.js +74 -0
  93. package/dist/index-s9q605sq.js +1033 -0
  94. package/dist/index-stzx8nc4.js +111 -0
  95. package/dist/index-th4vrnbk.js +1205 -0
  96. package/dist/index-vtcmsgaf.js +581 -0
  97. package/dist/index-w36q6819.js +895 -0
  98. package/dist/index-x2k3awjs.js +147 -0
  99. package/dist/index-x8x547tz.js +1426 -0
  100. package/dist/index-xp0qkkxf.js +68 -0
  101. package/dist/index-xxxd0mvw.js +109 -0
  102. package/dist/index-zawn5tte.js +109 -0
  103. package/dist/index-zpy9caxn.js +1193 -0
  104. package/dist/index.d.ts +1 -1
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +9 -7
  107. package/dist/login-280p2cm9.js +77 -0
  108. package/dist/login-4n266whq.js +77 -0
  109. package/dist/previews-3m3ffpaw.js +1337 -0
  110. package/dist/previews-tr8sm03d.js +1337 -0
  111. package/dist/productions-62y489ff.js +505 -0
  112. package/dist/productions-cgn3fz7d.js +505 -0
  113. package/dist/runtime/exports.d.ts +23 -0
  114. package/dist/runtime/exports.d.ts.map +1 -1
  115. package/dist/runtime/index.d.ts +1 -1
  116. package/dist/runtime/index.d.ts.map +1 -1
  117. package/dist/runtime/index.js +6 -4
  118. package/dist/secrets-4050kqf5.js +91 -0
  119. package/dist/secrets-p112cajt.js +91 -0
  120. package/dist/sveltekit/index.js +8 -7
  121. package/dist/sveltekit/local-bindings.d.ts.map +1 -1
  122. package/dist/test/index.js +24 -12
  123. package/dist/test/resolve-service-bindings.d.ts +1 -1
  124. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  125. package/dist/test/simple-context-lifecycle.d.ts.map +1 -1
  126. package/dist/types-apmt10yj.js +705 -0
  127. package/dist/types-ttrrgdfj.js +705 -0
  128. package/dist/vite/index.js +5 -5
  129. package/dist/vite/plugin-context.d.ts.map +1 -1
  130. package/dist/vite/plugin-programmatic.d.ts.map +1 -1
  131. package/dist/worker-2k1jyr6p.js +513 -0
  132. package/dist/worker-jqgn6jyj.js +513 -0
  133. package/package.json +1 -1
@@ -0,0 +1,185 @@
1
+ import {
2
+ resolveConfigForEnvironment
3
+ } from "./index-0bv2qjs1.js";
4
+
5
+ // src/cli/commands/previews-support/family.ts
6
+ function compareConfiguredWorkerFamilies(left, right) {
7
+ if (left.role === "primary" && right.role !== "primary") {
8
+ return -1;
9
+ }
10
+ if (left.role !== "primary" && right.role === "primary") {
11
+ return 1;
12
+ }
13
+ return left.baseName.localeCompare(right.baseName);
14
+ }
15
+ function comparePreviewScopeRows(left, right) {
16
+ const leftTime = left.updatedAt?.getTime() ?? 0;
17
+ const rightTime = right.updatedAt?.getTime() ?? 0;
18
+ if (rightTime !== leftTime) {
19
+ return rightTime - leftTime;
20
+ }
21
+ return left.scope.localeCompare(right.scope);
22
+ }
23
+ function collectConfiguredWorkerFamilies(config, environment) {
24
+ const resolvedConfig = resolveConfigForEnvironment(config, environment);
25
+ const families = new Map;
26
+ families.set(resolvedConfig.name, {
27
+ baseName: resolvedConfig.name,
28
+ roleLabel: "primary",
29
+ role: "primary"
30
+ });
31
+ for (const [bindingName, binding] of Object.entries(resolvedConfig.bindings?.services ?? {})) {
32
+ const existing = families.get(binding.service);
33
+ if (existing) {
34
+ continue;
35
+ }
36
+ families.set(binding.service, {
37
+ baseName: binding.service,
38
+ roleLabel: bindingName,
39
+ role: "service"
40
+ });
41
+ }
42
+ return Array.from(families.values()).sort(compareConfiguredWorkerFamilies);
43
+ }
44
+ function getWorkerUrl(workerName, workersSubdomain) {
45
+ if (!workersSubdomain) {
46
+ return;
47
+ }
48
+ return `https://${workerName}.${workersSubdomain}.workers.dev`;
49
+ }
50
+ function getWorkerScopeSuffix(workerName, baseName) {
51
+ if (!workerName.startsWith(`${baseName}-`)) {
52
+ return;
53
+ }
54
+ const suffix = workerName.slice(baseName.length + 1).trim();
55
+ return suffix || undefined;
56
+ }
57
+ function buildStableWorkerRowsFromLiveWorkers(families, workers, workersSubdomain) {
58
+ const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
59
+ return families.map((family) => {
60
+ const worker = workersByName.get(family.baseName);
61
+ const status = worker ? "active" : "missing";
62
+ return {
63
+ workerName: family.baseName,
64
+ role: family.roleLabel,
65
+ status,
66
+ updatedAt: worker?.modifiedOn,
67
+ url: worker ? getWorkerUrl(family.baseName, workersSubdomain) : undefined
68
+ };
69
+ });
70
+ }
71
+ function getDedicatedPreviewFamilyNamesFromWorkers(families, workers) {
72
+ const familyNames = new Set;
73
+ const workerNames = workers.map((worker) => worker.name);
74
+ for (const family of families) {
75
+ if (family.role === "primary") {
76
+ familyNames.add(family.baseName);
77
+ continue;
78
+ }
79
+ if (workerNames.some((workerName) => Boolean(getWorkerScopeSuffix(workerName, family.baseName)))) {
80
+ familyNames.add(family.baseName);
81
+ }
82
+ }
83
+ return familyNames;
84
+ }
85
+ function buildPreviewScopeRowsFromLiveWorkers(families, workers, workersSubdomain) {
86
+ const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
87
+ const previewFamilyNames = getDedicatedPreviewFamilyNamesFromWorkers(families, workers);
88
+ const expectedFamilies = families.filter((family) => previewFamilyNames.has(family.baseName));
89
+ const workerCandidatesByScope = buildPreviewWorkerCandidatesByScope(families, workers);
90
+ return Array.from(workerCandidatesByScope.keys()).map((scope) => {
91
+ const resolvedFamilies = expectedFamilies.map((family) => ({
92
+ family,
93
+ worker: workersByName.get(`${family.baseName}-${scope}`)
94
+ }));
95
+ const presentFamilies = resolvedFamilies.filter((entry) => entry.worker);
96
+ const updatedAt = presentFamilies.reduce((latest, entry) => {
97
+ const currentDate = entry.worker?.modifiedOn;
98
+ if (!currentDate) {
99
+ return latest;
100
+ }
101
+ if (!latest || currentDate.getTime() > latest.getTime()) {
102
+ return currentDate;
103
+ }
104
+ return latest;
105
+ }, undefined);
106
+ const primaryEntry = resolvedFamilies.find((entry) => entry.family.role === "primary");
107
+ const entryWorker = primaryEntry?.worker ?? presentFamilies[0]?.worker;
108
+ const missingLabels = resolvedFamilies.filter((entry) => !entry.worker).map((entry) => entry.family.role === "primary" ? "primary" : entry.family.roleLabel);
109
+ const notes = [];
110
+ if (missingLabels.length > 0) {
111
+ notes.push(`missing ${missingLabels.join(", ")}`);
112
+ }
113
+ const strategy = "dedicated workers";
114
+ const status = presentFamilies.length === resolvedFamilies.length ? "ready" : "partial";
115
+ return {
116
+ scope,
117
+ strategy,
118
+ workersLabel: `${presentFamilies.length}/${resolvedFamilies.length}`,
119
+ status,
120
+ updatedAt,
121
+ notes: notes.length > 0 ? notes.join(" · ") : undefined,
122
+ entryUrl: entryWorker ? getWorkerUrl(entryWorker.name, workersSubdomain) : undefined
123
+ };
124
+ }).sort(comparePreviewScopeRows);
125
+ }
126
+ function buildPreviewWorkerCandidatesByScope(families, workers) {
127
+ const candidates = new Map;
128
+ for (const worker of workers) {
129
+ for (const family of families) {
130
+ const scope = getWorkerScopeSuffix(worker.name, family.baseName);
131
+ if (!scope) {
132
+ continue;
133
+ }
134
+ const names = candidates.get(scope) ?? new Set;
135
+ names.add(worker.name);
136
+ candidates.set(scope, names);
137
+ }
138
+ }
139
+ return new Map(Array.from(candidates.entries()).map(([scope, workerNames]) => {
140
+ return [scope, Array.from(workerNames).sort((left, right) => left.localeCompare(right))];
141
+ }));
142
+ }
143
+ function orderPreviewWorkerNamesForDeletion(workerNames, scope, families) {
144
+ const familyPriority = new Map;
145
+ for (const family of families) {
146
+ familyPriority.set(family.baseName, {
147
+ priority: family.role === "primary" ? 0 : 1,
148
+ roleLabel: family.roleLabel
149
+ });
150
+ }
151
+ const resolveFamilyForWorker = (workerName) => {
152
+ for (const family of families) {
153
+ if (getWorkerScopeSuffix(workerName, family.baseName) === scope) {
154
+ const resolved = familyPriority.get(family.baseName);
155
+ if (resolved) {
156
+ return {
157
+ priority: resolved.priority,
158
+ roleLabel: resolved.roleLabel,
159
+ baseName: family.baseName
160
+ };
161
+ }
162
+ }
163
+ }
164
+ return {
165
+ priority: 2,
166
+ roleLabel: workerName
167
+ };
168
+ };
169
+ return [...workerNames].sort((left, right) => {
170
+ const leftFamily = resolveFamilyForWorker(left);
171
+ const rightFamily = resolveFamilyForWorker(right);
172
+ if (leftFamily.priority !== rightFamily.priority) {
173
+ return leftFamily.priority - rightFamily.priority;
174
+ }
175
+ if (leftFamily.roleLabel !== rightFamily.roleLabel) {
176
+ return leftFamily.roleLabel.localeCompare(rightFamily.roleLabel);
177
+ }
178
+ if (leftFamily.baseName && rightFamily.baseName && leftFamily.baseName !== rightFamily.baseName) {
179
+ return leftFamily.baseName.localeCompare(rightFamily.baseName);
180
+ }
181
+ return left.localeCompare(right);
182
+ });
183
+ }
184
+
185
+ export { collectConfiguredWorkerFamilies, buildStableWorkerRowsFromLiveWorkers, buildPreviewScopeRowsFromLiveWorkers, buildPreviewWorkerCandidatesByScope, orderPreviewWorkerNamesForDeletion };