@veryfront/ext-content-mdx 0.1.1119 → 0.1.1122

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 (188) hide show
  1. package/esm/_dnt.polyfills.d.ts +6 -0
  2. package/esm/_dnt.polyfills.d.ts.map +1 -1
  3. package/esm/deno.js +1 -1
  4. package/esm/src/config/defaults.d.ts +39 -0
  5. package/esm/src/config/defaults.d.ts.map +1 -0
  6. package/esm/src/config/defaults.js +65 -0
  7. package/esm/src/errors/error-registry/agent.d.ts +18 -0
  8. package/esm/src/errors/error-registry/agent.d.ts.map +1 -0
  9. package/esm/src/errors/error-registry/agent.js +60 -0
  10. package/esm/src/errors/error-registry/boundary.d.ts +16 -0
  11. package/esm/src/errors/error-registry/boundary.d.ts.map +1 -0
  12. package/esm/src/errors/error-registry/boundary.js +52 -0
  13. package/esm/src/errors/error-registry/build.d.ts +20 -0
  14. package/esm/src/errors/error-registry/build.d.ts.map +1 -0
  15. package/esm/src/errors/error-registry/build.js +68 -0
  16. package/esm/src/errors/error-registry/config.d.ts +31 -0
  17. package/esm/src/errors/error-registry/config.d.ts.map +1 -0
  18. package/esm/src/errors/error-registry/config.js +97 -0
  19. package/esm/src/errors/error-registry/deploy.d.ts +12 -0
  20. package/esm/src/errors/error-registry/deploy.d.ts.map +1 -0
  21. package/esm/src/errors/error-registry/deploy.js +36 -0
  22. package/esm/src/errors/error-registry/dev.d.ts +14 -0
  23. package/esm/src/errors/error-registry/dev.d.ts.map +1 -0
  24. package/esm/src/errors/error-registry/dev.js +44 -0
  25. package/esm/src/errors/error-registry/general.d.ts +29 -0
  26. package/esm/src/errors/error-registry/general.d.ts.map +1 -0
  27. package/esm/src/errors/error-registry/general.js +92 -0
  28. package/esm/src/errors/error-registry/module.d.ts +16 -0
  29. package/esm/src/errors/error-registry/module.d.ts.map +1 -0
  30. package/esm/src/errors/error-registry/module.js +52 -0
  31. package/esm/src/errors/error-registry/route.d.ts +16 -0
  32. package/esm/src/errors/error-registry/route.d.ts.map +1 -0
  33. package/esm/src/errors/error-registry/route.js +52 -0
  34. package/esm/src/errors/error-registry/runtime.d.ts +27 -0
  35. package/esm/src/errors/error-registry/runtime.d.ts.map +1 -0
  36. package/esm/src/errors/error-registry/runtime.js +87 -0
  37. package/esm/src/errors/error-registry/server.d.ts +39 -0
  38. package/esm/src/errors/error-registry/server.d.ts.map +1 -0
  39. package/esm/src/errors/error-registry/server.js +129 -0
  40. package/esm/src/errors/error-registry-helpers.d.ts +6 -0
  41. package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
  42. package/esm/src/errors/error-registry-helpers.js +9 -0
  43. package/esm/src/errors/error-registry.d.ts +120 -0
  44. package/esm/src/errors/error-registry.d.ts.map +1 -0
  45. package/esm/src/errors/error-registry.js +60 -0
  46. package/esm/src/errors/types.d.ts +84 -0
  47. package/esm/src/errors/types.d.ts.map +1 -0
  48. package/esm/src/errors/types.js +69 -0
  49. package/esm/src/errors/veryfront-error.d.ts +149 -0
  50. package/esm/src/errors/veryfront-error.d.ts.map +1 -0
  51. package/esm/src/errors/veryfront-error.js +61 -0
  52. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +13 -0
  53. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +1 -0
  54. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +55 -0
  55. package/esm/src/observability/tracing/api-shim.d.ts +191 -0
  56. package/esm/src/observability/tracing/api-shim.d.ts.map +1 -0
  57. package/esm/src/observability/tracing/api-shim.js +281 -0
  58. package/esm/src/observability/tracing/otlp-setup.d.ts +63 -0
  59. package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -0
  60. package/esm/src/observability/tracing/otlp-setup.js +219 -0
  61. package/esm/src/observability/tracing/telemetry-env.d.ts +3 -0
  62. package/esm/src/observability/tracing/telemetry-env.d.ts.map +1 -0
  63. package/esm/src/observability/tracing/telemetry-env.js +10 -0
  64. package/esm/src/platform/adapters/base.d.ts +209 -0
  65. package/esm/src/platform/adapters/base.d.ts.map +1 -0
  66. package/esm/src/platform/adapters/base.js +15 -0
  67. package/esm/src/platform/compat/constants.d.ts +13 -0
  68. package/esm/src/platform/compat/constants.d.ts.map +1 -0
  69. package/esm/src/platform/compat/constants.js +12 -0
  70. package/esm/src/platform/compat/dynamic-import.d.ts +11 -0
  71. package/esm/src/platform/compat/dynamic-import.d.ts.map +1 -0
  72. package/esm/src/platform/compat/dynamic-import.js +10 -0
  73. package/esm/src/platform/compat/fs.d.ts +76 -0
  74. package/esm/src/platform/compat/fs.d.ts.map +1 -0
  75. package/esm/src/platform/compat/fs.js +336 -0
  76. package/esm/src/platform/compat/process/command.d.ts +33 -0
  77. package/esm/src/platform/compat/process/command.d.ts.map +1 -0
  78. package/esm/src/platform/compat/process/command.js +206 -0
  79. package/esm/src/platform/compat/process.d.ts +5 -0
  80. package/esm/src/platform/compat/process.d.ts.map +1 -0
  81. package/esm/src/platform/compat/process.js +4 -0
  82. package/esm/src/transforms/import-rewriter/url-builder.d.ts +70 -0
  83. package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -0
  84. package/esm/src/transforms/import-rewriter/url-builder.js +152 -0
  85. package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -1
  86. package/esm/src/transforms/mdx/compiler/import-rewriter.js +2 -1
  87. package/esm/src/utils/base64url.d.ts +7 -0
  88. package/esm/src/utils/base64url.d.ts.map +1 -0
  89. package/esm/src/utils/base64url.js +39 -0
  90. package/esm/src/utils/bundle-manifest.d.ts +63 -0
  91. package/esm/src/utils/bundle-manifest.d.ts.map +1 -0
  92. package/esm/src/utils/bundle-manifest.js +96 -0
  93. package/esm/src/utils/constants/buffers.d.ts +24 -0
  94. package/esm/src/utils/constants/buffers.d.ts.map +1 -0
  95. package/esm/src/utils/constants/buffers.js +23 -0
  96. package/esm/src/utils/constants/build.d.ts +8 -0
  97. package/esm/src/utils/constants/build.d.ts.map +1 -0
  98. package/esm/src/utils/constants/build.js +7 -0
  99. package/esm/src/utils/constants/cache.d.ts +74 -0
  100. package/esm/src/utils/constants/cache.d.ts.map +1 -0
  101. package/esm/src/utils/constants/cache.js +133 -0
  102. package/esm/src/utils/constants/cdn.d.ts +29 -0
  103. package/esm/src/utils/constants/cdn.d.ts.map +1 -0
  104. package/esm/src/utils/constants/cdn.js +58 -0
  105. package/esm/src/utils/constants/crypto.d.ts +10 -0
  106. package/esm/src/utils/constants/crypto.d.ts.map +1 -0
  107. package/esm/src/utils/constants/crypto.js +9 -0
  108. package/esm/src/utils/constants/env.d.ts +16 -0
  109. package/esm/src/utils/constants/env.d.ts.map +1 -0
  110. package/esm/src/utils/constants/env.js +20 -0
  111. package/esm/src/utils/constants/hash.d.ts +5 -0
  112. package/esm/src/utils/constants/hash.d.ts.map +1 -0
  113. package/esm/src/utils/constants/hash.js +4 -0
  114. package/esm/src/utils/constants/hmr.d.ts +24 -0
  115. package/esm/src/utils/constants/hmr.d.ts.map +1 -0
  116. package/esm/src/utils/constants/hmr.js +26 -0
  117. package/esm/src/utils/constants/html.d.ts +13 -0
  118. package/esm/src/utils/constants/html.d.ts.map +1 -0
  119. package/esm/src/utils/constants/html.js +12 -0
  120. package/esm/src/utils/constants/http.d.ts +77 -0
  121. package/esm/src/utils/constants/http.d.ts.map +1 -0
  122. package/esm/src/utils/constants/http.js +76 -0
  123. package/esm/src/utils/constants/index.d.ts +23 -0
  124. package/esm/src/utils/constants/index.d.ts.map +1 -0
  125. package/esm/src/utils/constants/index.js +22 -0
  126. package/esm/src/utils/constants/limits.d.ts +27 -0
  127. package/esm/src/utils/constants/limits.d.ts.map +1 -0
  128. package/esm/src/utils/constants/limits.js +26 -0
  129. package/esm/src/utils/constants/metrics.d.ts +10 -0
  130. package/esm/src/utils/constants/metrics.d.ts.map +1 -0
  131. package/esm/src/utils/constants/metrics.js +34 -0
  132. package/esm/src/utils/constants/network.d.ts +23 -0
  133. package/esm/src/utils/constants/network.d.ts.map +1 -0
  134. package/esm/src/utils/constants/network.js +27 -0
  135. package/esm/src/utils/constants/priorities.d.ts +31 -0
  136. package/esm/src/utils/constants/priorities.d.ts.map +1 -0
  137. package/esm/src/utils/constants/priorities.js +30 -0
  138. package/esm/src/utils/constants/retry.d.ts +14 -0
  139. package/esm/src/utils/constants/retry.d.ts.map +1 -0
  140. package/esm/src/utils/constants/retry.js +13 -0
  141. package/esm/src/utils/constants/server.d.ts +107 -0
  142. package/esm/src/utils/constants/server.d.ts.map +1 -0
  143. package/esm/src/utils/constants/server.js +120 -0
  144. package/esm/src/utils/feature-flags.d.ts +7 -0
  145. package/esm/src/utils/feature-flags.d.ts.map +1 -0
  146. package/esm/src/utils/feature-flags.js +8 -0
  147. package/esm/src/utils/hash-utils.d.ts +22 -0
  148. package/esm/src/utils/hash-utils.d.ts.map +1 -0
  149. package/esm/src/utils/hash-utils.js +48 -0
  150. package/esm/src/utils/import-lockfile.d.ts +52 -0
  151. package/esm/src/utils/import-lockfile.d.ts.map +1 -0
  152. package/esm/src/utils/import-lockfile.js +187 -0
  153. package/esm/src/utils/index.d.ts +30 -0
  154. package/esm/src/utils/index.d.ts.map +1 -0
  155. package/esm/src/utils/index.js +29 -0
  156. package/esm/src/utils/logger/components.d.ts +73 -0
  157. package/esm/src/utils/logger/components.d.ts.map +1 -0
  158. package/esm/src/utils/logger/components.js +81 -0
  159. package/esm/src/utils/logger/index.d.ts +10 -0
  160. package/esm/src/utils/logger/index.d.ts.map +1 -0
  161. package/esm/src/utils/logger/index.js +9 -0
  162. package/esm/src/utils/logger/request-context.d.ts +27 -0
  163. package/esm/src/utils/logger/request-context.d.ts.map +1 -0
  164. package/esm/src/utils/logger/request-context.js +28 -0
  165. package/esm/src/utils/memoize.d.ts +19 -0
  166. package/esm/src/utils/memoize.d.ts.map +1 -0
  167. package/esm/src/utils/memoize.js +72 -0
  168. package/esm/src/utils/parallel.d.ts +21 -0
  169. package/esm/src/utils/parallel.d.ts.map +1 -0
  170. package/esm/src/utils/parallel.js +51 -0
  171. package/esm/src/utils/path-utils.d.ts +34 -0
  172. package/esm/src/utils/path-utils.d.ts.map +1 -0
  173. package/esm/src/utils/path-utils.js +138 -0
  174. package/esm/src/utils/perf-timer.d.ts +11 -0
  175. package/esm/src/utils/perf-timer.d.ts.map +1 -0
  176. package/esm/src/utils/perf-timer.js +114 -0
  177. package/esm/src/utils/platform.d.ts +9 -0
  178. package/esm/src/utils/platform.d.ts.map +1 -0
  179. package/esm/src/utils/platform.js +11 -0
  180. package/esm/src/utils/runtime-guards.d.ts +29 -0
  181. package/esm/src/utils/runtime-guards.d.ts.map +1 -0
  182. package/esm/src/utils/runtime-guards.js +23 -0
  183. package/esm/src/utils/sleep.d.ts +2 -0
  184. package/esm/src/utils/sleep.d.ts.map +1 -0
  185. package/esm/src/utils/sleep.js +19 -0
  186. package/esm/src/utils/version-constant.d.ts +1 -1
  187. package/esm/src/utils/version-constant.js +1 -1
  188. package/package.json +2 -2
@@ -0,0 +1,120 @@
1
+ import { type ErrorCategory } from "./types.js";
2
+ export * from "./error-registry/config.js";
3
+ export * from "./error-registry/build.js";
4
+ export * from "./error-registry/runtime.js";
5
+ export * from "./error-registry/route.js";
6
+ export * from "./error-registry/module.js";
7
+ export * from "./error-registry/server.js";
8
+ export * from "./error-registry/boundary.js";
9
+ export * from "./error-registry/dev.js";
10
+ export * from "./error-registry/deploy.js";
11
+ export * from "./error-registry/agent.js";
12
+ export * from "./error-registry/general.js";
13
+ /**
14
+ * Central registry mapping every error slug to its definition. Assembled from
15
+ * the per-category registry fragments.
16
+ */
17
+ export declare const ERROR_REGISTRY: {
18
+ readonly "unknown-error": import("./types.js").RegisteredError;
19
+ readonly "permission-denied": import("./types.js").RegisteredError;
20
+ readonly "file-not-found": import("./types.js").RegisteredError;
21
+ readonly "resource-not-found": import("./types.js").RegisteredError;
22
+ readonly "invalid-argument": import("./types.js").RegisteredError;
23
+ readonly "timeout-error": import("./types.js").RegisteredError;
24
+ readonly "initialization-error": import("./types.js").RegisteredError;
25
+ readonly "not-supported": import("./types.js").RegisteredError;
26
+ readonly "security-violation": import("./types.js").RegisteredError;
27
+ readonly "input-validation-failed": import("./types.js").RegisteredError;
28
+ readonly "agent-error": import("./types.js").RegisteredError;
29
+ readonly "agent-not-found": import("./types.js").RegisteredError;
30
+ readonly "agent-timeout": import("./types.js").RegisteredError;
31
+ readonly "agent-intent-error": import("./types.js").RegisteredError;
32
+ readonly "orchestration-error": import("./types.js").RegisteredError;
33
+ readonly "cost-limit-exceeded": import("./types.js").RegisteredError;
34
+ readonly "tool-id-conflict": import("./types.js").RegisteredError;
35
+ readonly "deployment-error": import("./types.js").RegisteredError;
36
+ readonly "platform-error": import("./types.js").RegisteredError;
37
+ readonly "env-var-missing": import("./types.js").RegisteredError;
38
+ readonly "production-build-required": import("./types.js").RegisteredError;
39
+ readonly "hmr-error": import("./types.js").RegisteredError;
40
+ readonly "dev-server-error": import("./types.js").RegisteredError;
41
+ readonly "fast-refresh-error": import("./types.js").RegisteredError;
42
+ readonly "error-overlay-error": import("./types.js").RegisteredError;
43
+ readonly "source-map-error": import("./types.js").RegisteredError;
44
+ readonly "client-boundary-violation": import("./types.js").RegisteredError;
45
+ readonly "server-only-in-client": import("./types.js").RegisteredError;
46
+ readonly "client-only-in-server": import("./types.js").RegisteredError;
47
+ readonly "invalid-use-client": import("./types.js").RegisteredError;
48
+ readonly "invalid-use-server": import("./types.js").RegisteredError;
49
+ readonly "rsc-payload-error": import("./types.js").RegisteredError;
50
+ readonly "port-in-use": import("./types.js").RegisteredError;
51
+ readonly "server-start-error": import("./types.js").RegisteredError;
52
+ readonly "cache-error": import("./types.js").RegisteredError;
53
+ readonly "file-watch-error": import("./types.js").RegisteredError;
54
+ readonly "request-error": import("./types.js").RegisteredError;
55
+ readonly "service-overloaded": import("./types.js").RegisteredError;
56
+ readonly "semaphore-timeout": import("./types.js").RegisteredError;
57
+ readonly "circuit-breaker-open": import("./types.js").RegisteredError;
58
+ readonly "cache-path-mismatch": import("./types.js").RegisteredError;
59
+ readonly "network-error": import("./types.js").RegisteredError;
60
+ readonly "api-client-error": import("./types.js").RegisteredError;
61
+ readonly "token-storage-error": import("./types.js").RegisteredError;
62
+ readonly "cache-invariant-violation": import("./types.js").RegisteredError;
63
+ readonly "release-not-found": import("./types.js").RegisteredError;
64
+ readonly "fallback-exhausted": import("./types.js").RegisteredError;
65
+ readonly "module-not-found": import("./types.js").RegisteredError;
66
+ readonly "import-resolution-error": import("./types.js").RegisteredError;
67
+ readonly "circular-dependency": import("./types.js").RegisteredError;
68
+ readonly "invalid-import": import("./types.js").RegisteredError;
69
+ readonly "dependency-missing": import("./types.js").RegisteredError;
70
+ readonly "version-mismatch": import("./types.js").RegisteredError;
71
+ readonly "route-conflict": import("./types.js").RegisteredError;
72
+ readonly "invalid-route-file": import("./types.js").RegisteredError;
73
+ readonly "route-handler-invalid": import("./types.js").RegisteredError;
74
+ readonly "dynamic-route-error": import("./types.js").RegisteredError;
75
+ readonly "route-params-error": import("./types.js").RegisteredError;
76
+ readonly "api-route-error": import("./types.js").RegisteredError;
77
+ readonly "hydration-mismatch": import("./types.js").RegisteredError;
78
+ readonly "render-error": import("./types.js").RegisteredError;
79
+ readonly "component-error": import("./types.js").RegisteredError;
80
+ readonly "layout-not-found": import("./types.js").RegisteredError;
81
+ readonly "page-not-found": import("./types.js").RegisteredError;
82
+ readonly "api-error": import("./types.js").RegisteredError;
83
+ readonly "middleware-error": import("./types.js").RegisteredError;
84
+ readonly "trigger-target-not-found": import("./types.js").RegisteredError;
85
+ readonly "trigger-execution-failed": import("./types.js").RegisteredError;
86
+ readonly "trigger-not-supported": import("./types.js").RegisteredError;
87
+ readonly "build-failed": import("./types.js").RegisteredError;
88
+ readonly "bundle-error": import("./types.js").RegisteredError;
89
+ readonly "typescript-error": import("./types.js").RegisteredError;
90
+ readonly "mdx-compile-error": import("./types.js").RegisteredError;
91
+ readonly "asset-optimization-error": import("./types.js").RegisteredError;
92
+ readonly "ssg-generation-error": import("./types.js").RegisteredError;
93
+ readonly "sourcemap-error": import("./types.js").RegisteredError;
94
+ readonly "compilation-error": import("./types.js").RegisteredError;
95
+ readonly "config-not-found": import("./types.js").RegisteredError;
96
+ readonly "config-invalid": import("./types.js").RegisteredError;
97
+ readonly "config-parse-error": import("./types.js").RegisteredError;
98
+ readonly "config-validation-error": import("./types.js").RegisteredError;
99
+ readonly "config-type-error": import("./types.js").RegisteredError;
100
+ readonly "import-map-invalid": import("./types.js").RegisteredError;
101
+ readonly "cors-config-invalid": import("./types.js").RegisteredError;
102
+ readonly "config-validation-failed": import("./types.js").RegisteredError;
103
+ readonly "webhook-config-invalid": import("./types.js").RegisteredError;
104
+ readonly "schedule-config-invalid": import("./types.js").RegisteredError;
105
+ readonly "trigger-config-invalid": import("./types.js").RegisteredError;
106
+ };
107
+ export type ErrorSlug = keyof typeof ERROR_REGISTRY;
108
+ /**
109
+ * Get an error definition by slug
110
+ */
111
+ export declare function getErrorBySlug(slug: ErrorSlug): import("./types.js").RegisteredError;
112
+ /**
113
+ * Get all errors in a category
114
+ */
115
+ export declare function getErrorsByCategory(category: ErrorCategory): import("./types.js").RegisteredError[];
116
+ /**
117
+ * Get all registered slugs
118
+ */
119
+ export declare function getAllSlugs(): ErrorSlug[];
120
+ //# sourceMappingURL=error-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-registry.d.ts","sourceRoot":"","sources":["../../../src/src/errors/error-registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAgBhD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYjB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,cAAc,CAAC;AAEpD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,wCAE7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,0CAE1D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,SAAS,EAAE,CAEzC"}
@@ -0,0 +1,60 @@
1
+ import { getRegistryEntriesByCategory, getRegistryEntry, getRegistrySlugs, } from "./error-registry-helpers.js";
2
+ // Error definitions live in per-category modules under ./error-registry/.
3
+ // This barrel re-exports them and assembles the slug → definition registry.
4
+ import { CONFIG_REGISTRY } from "./error-registry/config.js";
5
+ import { BUILD_REGISTRY } from "./error-registry/build.js";
6
+ import { RUNTIME_REGISTRY } from "./error-registry/runtime.js";
7
+ import { ROUTE_REGISTRY } from "./error-registry/route.js";
8
+ import { MODULE_REGISTRY } from "./error-registry/module.js";
9
+ import { SERVER_REGISTRY } from "./error-registry/server.js";
10
+ import { BOUNDARY_REGISTRY } from "./error-registry/boundary.js";
11
+ import { DEV_REGISTRY } from "./error-registry/dev.js";
12
+ import { DEPLOY_REGISTRY } from "./error-registry/deploy.js";
13
+ import { AGENT_REGISTRY } from "./error-registry/agent.js";
14
+ import { GENERAL_REGISTRY } from "./error-registry/general.js";
15
+ export * from "./error-registry/config.js";
16
+ export * from "./error-registry/build.js";
17
+ export * from "./error-registry/runtime.js";
18
+ export * from "./error-registry/route.js";
19
+ export * from "./error-registry/module.js";
20
+ export * from "./error-registry/server.js";
21
+ export * from "./error-registry/boundary.js";
22
+ export * from "./error-registry/dev.js";
23
+ export * from "./error-registry/deploy.js";
24
+ export * from "./error-registry/agent.js";
25
+ export * from "./error-registry/general.js";
26
+ /**
27
+ * Central registry mapping every error slug to its definition. Assembled from
28
+ * the per-category registry fragments.
29
+ */
30
+ export const ERROR_REGISTRY = {
31
+ ...CONFIG_REGISTRY,
32
+ ...BUILD_REGISTRY,
33
+ ...RUNTIME_REGISTRY,
34
+ ...ROUTE_REGISTRY,
35
+ ...MODULE_REGISTRY,
36
+ ...SERVER_REGISTRY,
37
+ ...BOUNDARY_REGISTRY,
38
+ ...DEV_REGISTRY,
39
+ ...DEPLOY_REGISTRY,
40
+ ...AGENT_REGISTRY,
41
+ ...GENERAL_REGISTRY,
42
+ };
43
+ /**
44
+ * Get an error definition by slug
45
+ */
46
+ export function getErrorBySlug(slug) {
47
+ return getRegistryEntry(ERROR_REGISTRY, slug);
48
+ }
49
+ /**
50
+ * Get all errors in a category
51
+ */
52
+ export function getErrorsByCategory(category) {
53
+ return getRegistryEntriesByCategory(ERROR_REGISTRY, category);
54
+ }
55
+ /**
56
+ * Get all registered slugs
57
+ */
58
+ export function getAllSlugs() {
59
+ return getRegistrySlugs(ERROR_REGISTRY);
60
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Error categories for domain-based grouping and handling
3
+ */
4
+ export type ErrorCategory = "CONFIG" | "BUILD" | "RUNTIME" | "ROUTE" | "MODULE" | "SERVER" | "BOUNDARY" | "DEV" | "DEPLOY" | "AGENT" | "GENERAL";
5
+ /**
6
+ * RFC 9457 Problem Details response shape
7
+ */
8
+ export interface RFC9457Response {
9
+ type: string;
10
+ title: string;
11
+ status: number;
12
+ detail?: string;
13
+ instance?: string;
14
+ category: ErrorCategory;
15
+ suggestion?: string;
16
+ cause?: string;
17
+ }
18
+ /**
19
+ * Error definition for the registry
20
+ */
21
+ export interface ErrorDefinition {
22
+ slug: string;
23
+ category: ErrorCategory;
24
+ status: number;
25
+ title: string;
26
+ suggestion?: string;
27
+ }
28
+ /**
29
+ * Options for creating an error instance
30
+ */
31
+ export interface ErrorCreateOptions {
32
+ /** Override the error message (defaults to detail or definition title) */
33
+ message?: string;
34
+ detail?: string;
35
+ cause?: unknown;
36
+ instance?: string;
37
+ context?: unknown;
38
+ /** Override the definition's default HTTP status (e.g., for per-request status codes) */
39
+ status?: number;
40
+ }
41
+ /**
42
+ * Registered error with factory method
43
+ */
44
+ export interface RegisteredError extends ErrorDefinition {
45
+ create(options?: ErrorCreateOptions): VeryfrontError;
46
+ }
47
+ /**
48
+ * Define an error in the registry
49
+ */
50
+ export declare function defineError(definition: ErrorDefinition): RegisteredError;
51
+ /**
52
+ * Options for VeryfrontError constructor
53
+ */
54
+ export interface VeryfrontErrorOptions extends ErrorCreateOptions {
55
+ slug: string;
56
+ category: ErrorCategory;
57
+ status: number;
58
+ title: string;
59
+ suggestion?: string;
60
+ }
61
+ /**
62
+ * Veryfront Error class with slug-based error identity
63
+ */
64
+ export declare class VeryfrontError extends Error {
65
+ slug: string;
66
+ category: ErrorCategory;
67
+ status: number;
68
+ title: string;
69
+ suggestion?: string;
70
+ detail?: string;
71
+ cause?: unknown;
72
+ instance?: string;
73
+ context?: unknown;
74
+ constructor(message: string, options: VeryfrontErrorOptions);
75
+ /**
76
+ * Convert to RFC 9457 Problem Details format
77
+ */
78
+ toRFC9457(): RFC9457Response;
79
+ /**
80
+ * Get documentation URL for this error
81
+ */
82
+ getDocsUrl(): string;
83
+ }
84
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/errors/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,OAAO,GACP,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,KAAK,GACL,QAAQ,GACR,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE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M,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IACP,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEN,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB;IAe3D;;OAEG;IACH,SAAS,IAAI,eAAe;IAa5B;;OAEG;IACH,UAAU,IAAI,MAAM;CAGrB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Define an error in the registry
3
+ */
4
+ export function defineError(definition) {
5
+ return {
6
+ ...definition,
7
+ create(options) {
8
+ return new VeryfrontError(options?.message || options?.detail || definition.title, {
9
+ slug: definition.slug,
10
+ category: definition.category,
11
+ status: options?.status ?? definition.status,
12
+ title: definition.title,
13
+ suggestion: definition.suggestion,
14
+ detail: options?.detail,
15
+ cause: options?.cause,
16
+ instance: options?.instance,
17
+ context: options?.context,
18
+ });
19
+ },
20
+ };
21
+ }
22
+ /**
23
+ * Veryfront Error class with slug-based error identity
24
+ */
25
+ export class VeryfrontError extends Error {
26
+ slug;
27
+ category;
28
+ status;
29
+ title;
30
+ suggestion;
31
+ detail;
32
+ cause;
33
+ instance;
34
+ context;
35
+ constructor(message, options) {
36
+ super(message);
37
+ this.name = "VeryfrontError";
38
+ this.slug = options.slug;
39
+ this.category = options.category;
40
+ this.status = options.status;
41
+ this.title = options.title;
42
+ this.suggestion = options.suggestion;
43
+ this.detail = options.detail;
44
+ this.cause = options.cause;
45
+ this.instance = options.instance;
46
+ this.context = options.context;
47
+ }
48
+ /**
49
+ * Convert to RFC 9457 Problem Details format
50
+ */
51
+ toRFC9457() {
52
+ return {
53
+ type: `https://veryfront.com/docs/errors/${this.slug}`,
54
+ title: this.title,
55
+ status: this.status,
56
+ detail: this.detail,
57
+ instance: this.instance,
58
+ category: this.category,
59
+ suggestion: this.suggestion,
60
+ cause: typeof this.cause === "string" ? this.cause : undefined,
61
+ };
62
+ }
63
+ /**
64
+ * Get documentation URL for this error
65
+ */
66
+ getDocsUrl() {
67
+ return `https://veryfront.com/docs/errors/${this.slug}`;
68
+ }
69
+ }
@@ -0,0 +1,149 @@
1
+ export interface BuildContext {
2
+ file?: string;
3
+ line?: number;
4
+ column?: number;
5
+ moduleId?: string;
6
+ phase?: "parse" | "transform" | "bundle" | "optimize" | "dependency-resolution" | "circuit-breaker" | "http-bundle-validation";
7
+ /** Number of failures (for circuit breaker) */
8
+ failures?: number;
9
+ /** Missing dependencies list */
10
+ missing?: Array<{
11
+ specifier: string;
12
+ fromFile: string;
13
+ reason: string;
14
+ }>;
15
+ /** Failed HTTP bundle specifiers */
16
+ failed?: string[];
17
+ /** Cache directory path */
18
+ cacheDir?: string;
19
+ }
20
+ export interface APIContext {
21
+ endpoint?: string;
22
+ method?: string;
23
+ statusCode?: number;
24
+ headers?: Record<string, string>;
25
+ }
26
+ export interface RenderContext {
27
+ component?: string;
28
+ route?: string;
29
+ phase?: "server" | "client" | "hydration";
30
+ props?: unknown;
31
+ }
32
+ export interface ConfigContext {
33
+ configFile?: string;
34
+ field?: string;
35
+ value?: unknown;
36
+ expected?: string;
37
+ }
38
+ export interface AgentContext {
39
+ agentId?: string;
40
+ intent?: string;
41
+ timeout?: number;
42
+ }
43
+ export interface FileContext {
44
+ path?: string;
45
+ operation?: "read" | "write" | "delete" | "mkdir";
46
+ permissions?: string;
47
+ }
48
+ interface NetworkContext {
49
+ url?: string;
50
+ timeout?: number;
51
+ retryCount?: number;
52
+ }
53
+ /**
54
+ * Discriminated union for serializable error data.
55
+ *
56
+ * This represents error DATA (plain objects), not throwable errors.
57
+ * For throwable errors, use `VeryfrontError` class from `./types.ts`.
58
+ */
59
+ export type VeryfrontErrorData = {
60
+ type: "build";
61
+ message: string;
62
+ context?: BuildContext;
63
+ } | {
64
+ type: "api";
65
+ message: string;
66
+ context?: APIContext;
67
+ } | {
68
+ type: "render";
69
+ message: string;
70
+ context?: RenderContext;
71
+ } | {
72
+ type: "config";
73
+ message: string;
74
+ context?: ConfigContext;
75
+ } | {
76
+ type: "agent";
77
+ message: string;
78
+ context?: AgentContext;
79
+ } | {
80
+ type: "file";
81
+ message: string;
82
+ context?: FileContext;
83
+ } | {
84
+ type: "network";
85
+ message: string;
86
+ context?: NetworkContext;
87
+ } | {
88
+ type: "permission";
89
+ message: string;
90
+ context?: FileContext;
91
+ } | {
92
+ type: "not_supported";
93
+ message: string;
94
+ feature?: string;
95
+ } | {
96
+ type: "no_ai_available";
97
+ message: string;
98
+ };
99
+ export declare function createError(error: VeryfrontErrorData): VeryfrontErrorData;
100
+ export declare const isBuildError: (error: VeryfrontErrorData) => error is {
101
+ type: "build";
102
+ message: string;
103
+ context?: BuildContext;
104
+ };
105
+ export declare const isAPIError: (error: VeryfrontErrorData) => error is {
106
+ type: "api";
107
+ message: string;
108
+ context?: APIContext;
109
+ };
110
+ export declare const isRenderError: (error: VeryfrontErrorData) => error is {
111
+ type: "render";
112
+ message: string;
113
+ context?: RenderContext;
114
+ };
115
+ export declare const isConfigError: (error: VeryfrontErrorData) => error is {
116
+ type: "config";
117
+ message: string;
118
+ context?: ConfigContext;
119
+ };
120
+ export declare const isFileError: (error: VeryfrontErrorData) => error is {
121
+ type: "file";
122
+ message: string;
123
+ context?: FileContext;
124
+ };
125
+ export declare const isNetworkError: (error: VeryfrontErrorData) => error is {
126
+ type: "network";
127
+ message: string;
128
+ context?: NetworkContext;
129
+ };
130
+ /**
131
+ * Convert a VeryfrontErrorData (plain object) to a throwable Error instance.
132
+ *
133
+ * Uses Error.captureStackTrace when available (V8 engines) to exclude toError()
134
+ * from the stack trace, making the stack point to the actual call site.
135
+ *
136
+ * @see plans/architecture-audit/010.3-dual-veryfront-error-definitions.md
137
+ */
138
+ export declare function toError(veryfrontError: VeryfrontErrorData): Error;
139
+ export declare function fromError(error: unknown): VeryfrontErrorData | null;
140
+ /**
141
+ * Extract error message from any error type
142
+ */
143
+ export declare function getErrorMessage(error: unknown): string;
144
+ /**
145
+ * Ensure error is an Error instance
146
+ */
147
+ export declare function ensureError(error: unknown): Error;
148
+ export {};
149
+ //# sourceMappingURL=veryfront-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"veryfront-error.d.ts","sourceRoot":"","sources":["../../../src/src/errors/veryfront-error.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EACF,OAAO,GACP,WAAW,GACX,QAAQ,GACR,UAAU,GACV,uBAAuB,GACvB,iBAAiB,GACjB,wBAAwB,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW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;AAErD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,cAAc,EAAE,kBAAkB,GAAG,KAAK,CAejE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAQnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGtD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAGjD"}
@@ -0,0 +1,61 @@
1
+ export function createError(error) {
2
+ return error;
3
+ }
4
+ /** Type guard factory for VeryfrontErrorData types */
5
+ function isErrorType(type) {
6
+ return (error) => error.type === type;
7
+ }
8
+ export const isBuildError = isErrorType("build");
9
+ export const isAPIError = isErrorType("api");
10
+ export const isRenderError = isErrorType("render");
11
+ export const isConfigError = isErrorType("config");
12
+ export const isFileError = isErrorType("file");
13
+ export const isNetworkError = isErrorType("network");
14
+ /**
15
+ * Convert a VeryfrontErrorData (plain object) to a throwable Error instance.
16
+ *
17
+ * Uses Error.captureStackTrace when available (V8 engines) to exclude toError()
18
+ * from the stack trace, making the stack point to the actual call site.
19
+ *
20
+ * @see plans/architecture-audit/010.3-dual-veryfront-error-definitions.md
21
+ */
22
+ export function toError(veryfrontError) {
23
+ const error = new Error(veryfrontError.message);
24
+ error.name = `VeryfrontError[${veryfrontError.type}]`;
25
+ // Capture stack at call site, excluding toError from the trace
26
+ // This makes debugging easier by showing where createError+toError was called
27
+ if (Error.captureStackTrace)
28
+ Error.captureStackTrace(error, toError);
29
+ Object.defineProperty(error, "context", {
30
+ value: veryfrontError,
31
+ enumerable: false,
32
+ configurable: true,
33
+ });
34
+ return error;
35
+ }
36
+ export function fromError(error) {
37
+ if (!error || typeof error !== "object" || !("context" in error))
38
+ return null;
39
+ const context = error.context;
40
+ if (!context || typeof context !== "object")
41
+ return null;
42
+ if (!("type" in context) || !("message" in context))
43
+ return null;
44
+ return context;
45
+ }
46
+ /**
47
+ * Extract error message from any error type
48
+ */
49
+ export function getErrorMessage(error) {
50
+ if (error instanceof Error)
51
+ return error.message;
52
+ return String(error);
53
+ }
54
+ /**
55
+ * Ensure error is an Error instance
56
+ */
57
+ export function ensureError(error) {
58
+ if (error instanceof Error)
59
+ return error;
60
+ return new Error(String(error));
61
+ }
@@ -0,0 +1,13 @@
1
+ export declare class Semaphore {
2
+ private permits;
3
+ private readonly maxQueueSize;
4
+ private waitQueue;
5
+ constructor(permits: number, options?: {
6
+ maxQueueSize?: number;
7
+ });
8
+ tryAcquire(timeoutMs?: number): Promise<boolean>;
9
+ release(): void;
10
+ get available(): number;
11
+ get waiting(): number;
12
+ }
13
+ //# sourceMappingURL=semaphore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../../../../../src/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.ts"],"names":[],"mappings":"AAKA,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,SAAS,CAAoE;gBAEzE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;IAKhE,UAAU,CAAC,SAAS,SAA6B,GAAG,OAAO,CAAC,OAAO,CAAC;IAkCpE,OAAO,IAAI,IAAI;IAUf,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF"}
@@ -0,0 +1,55 @@
1
+ /** Default timeout for acquiring a semaphore permit (ms) */
2
+ import * as dntShim from "../../../../../_dnt.shims.js";
3
+ const DEFAULT_ACQUIRE_TIMEOUT_MS = 100;
4
+ export class Semaphore {
5
+ permits;
6
+ maxQueueSize;
7
+ waitQueue = [];
8
+ constructor(permits, options) {
9
+ this.permits = permits;
10
+ this.maxQueueSize = options?.maxQueueSize ?? Infinity;
11
+ }
12
+ tryAcquire(timeoutMs = DEFAULT_ACQUIRE_TIMEOUT_MS) {
13
+ if (this.permits > 0) {
14
+ this.permits--;
15
+ return Promise.resolve(true);
16
+ }
17
+ if (this.waitQueue.length >= this.maxQueueSize) {
18
+ return Promise.resolve(false);
19
+ }
20
+ return new Promise((resolve) => {
21
+ let settled = false;
22
+ const onAcquire = () => {
23
+ if (settled)
24
+ return;
25
+ settled = true;
26
+ clearTimeout(timeoutId);
27
+ resolve(true);
28
+ };
29
+ const timeoutId = dntShim.setTimeout(() => {
30
+ if (settled)
31
+ return;
32
+ settled = true;
33
+ const index = this.waitQueue.findIndex((w) => w.resolve === onAcquire);
34
+ if (index !== -1)
35
+ this.waitQueue.splice(index, 1);
36
+ resolve(false);
37
+ }, timeoutMs);
38
+ this.waitQueue.push({ resolve: onAcquire, reject: onAcquire });
39
+ });
40
+ }
41
+ release() {
42
+ const next = this.waitQueue.shift();
43
+ if (next) {
44
+ next.resolve();
45
+ return;
46
+ }
47
+ this.permits++;
48
+ }
49
+ get available() {
50
+ return this.permits;
51
+ }
52
+ get waiting() {
53
+ return this.waitQueue.length;
54
+ }
55
+ }