@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,21 @@
1
+ /*******************************
2
+ * Parallel Execution Utilities
3
+ *
4
+ * Provides utilities for parallel execution with concurrency control.
5
+ * Uses a semaphore to limit the number of concurrent operations.
6
+ *
7
+ * @module core/utils/parallel
8
+ *******************************/
9
+ import { Semaphore } from "../modules/react-loader/ssr-module-loader/concurrency/semaphore.js";
10
+ type ParallelOptions = {
11
+ concurrency?: number;
12
+ semaphore?: Semaphore;
13
+ timeoutMs?: number;
14
+ };
15
+ /** Run parallel map. */
16
+ export declare function parallelMap<T, R>(items: T[], fn: (item: T, index: number) => Promise<R>, options?: ParallelOptions): Promise<R[]>;
17
+ export declare function parallelAll<T extends readonly (() => Promise<unknown>)[]>(fns: T, options?: ParallelOptions): Promise<{
18
+ [K in keyof T]: Awaited<ReturnType<T[K]>>;
19
+ }>;
20
+ export {};
21
+ //# sourceMappingURL=parallel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../src/src/utils/parallel.ts"],"names":[],"mappings":"AAAA;;;;;;;iCAOiC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,oEAAoE,CAAC;AAY/F,KAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAgBF,wBAAwB;AACxB,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC9B,KAAK,EAAE,CAAC,EAAE,EACV,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EAC1C,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,EAAE,CAAC,CA4Bd;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EACvE,GAAG,EAAE,CAAC,EACN,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAMxD"}
@@ -0,0 +1,51 @@
1
+ /*******************************
2
+ * Parallel Execution Utilities
3
+ *
4
+ * Provides utilities for parallel execution with concurrency control.
5
+ * Uses a semaphore to limit the number of concurrent operations.
6
+ *
7
+ * @module core/utils/parallel
8
+ *******************************/
9
+ import { Semaphore } from "../modules/react-loader/ssr-module-loader/concurrency/semaphore.js";
10
+ import { withSpan } from "../observability/tracing/otlp-setup.js";
11
+ import { TIMEOUT_ERROR } from "../errors/error-registry.js";
12
+ const DEFAULT_CONCURRENCY = 20;
13
+ const ACQUIRE_TIMEOUT_MS = 30_000;
14
+ // No maxQueueSize — parallelMap schedules all items via Promise.all,
15
+ // so a queue cap would reject items in large batches instead of letting
16
+ // them progress under the concurrency limit with timeout-based backpressure.
17
+ const apiSemaphore = new Semaphore(DEFAULT_CONCURRENCY);
18
+ async function acquireOrThrow(semaphore, timeoutMs, label) {
19
+ const acquired = await semaphore.tryAcquire(timeoutMs);
20
+ if (acquired)
21
+ return;
22
+ throw TIMEOUT_ERROR.create({
23
+ detail: `${label}: timed out waiting for semaphore after ${timeoutMs}ms (available: ${semaphore.available}, waiting: ${semaphore.waiting})`,
24
+ });
25
+ }
26
+ /** Run parallel map. */
27
+ export function parallelMap(items, fn, options = {}) {
28
+ return withSpan("utils.parallelMap", async () => {
29
+ if (items.length === 0)
30
+ return [];
31
+ const semaphore = options.semaphore ?? apiSemaphore;
32
+ const timeoutMs = options.timeoutMs ?? ACQUIRE_TIMEOUT_MS;
33
+ const results = new Array(items.length);
34
+ await Promise.all(items.map(async (item, index) => {
35
+ await acquireOrThrow(semaphore, timeoutMs, "parallelMap");
36
+ try {
37
+ results[index] = await fn(item, index);
38
+ }
39
+ finally {
40
+ semaphore.release();
41
+ }
42
+ }));
43
+ return results;
44
+ }, {
45
+ "parallel.itemCount": items.length,
46
+ "parallel.timeoutMs": options.timeoutMs ?? ACQUIRE_TIMEOUT_MS,
47
+ });
48
+ }
49
+ export function parallelAll(fns, options = {}) {
50
+ return parallelMap([...fns], (fn) => fn(), options);
51
+ }
@@ -0,0 +1,34 @@
1
+ import { isAbsolute } from "../platform/compat/path/resolution.js";
2
+ /** Normalizes path. */
3
+ export declare function normalizePath(pathname: string): string;
4
+ export declare function joinPath(a: string, b: string): string;
5
+ export declare function isWithinDirectory(root: string, target: string): boolean;
6
+ /**
7
+ * Get file extension including the dot (e.g., ".ts", ".tsx").
8
+ * Returns empty string if no extension found.
9
+ */
10
+ export declare function getExtension(path: string): string;
11
+ /**
12
+ * Get file extension without the dot, lowercased (e.g., "ts", "tsx").
13
+ * Returns empty string if no extension found.
14
+ */
15
+ export declare function getExtensionName(path: string): string;
16
+ export declare function getDirectory(path: string): string;
17
+ export declare function hasHashedFilename(path: string): boolean;
18
+ /**
19
+ * Get esbuild loader type from file extension
20
+ */
21
+ export declare function getEsbuildLoader(filePath: string): "tsx" | "jsx" | "ts" | "js";
22
+ export { isAbsolute as isAbsolutePath };
23
+ export declare function toBase64Url(input: string): string;
24
+ export declare function fromBase64Url(encoded: string): string;
25
+ /**
26
+ * Check if a normalized path is a framework path that should not be fetched from API.
27
+ *
28
+ * Framework paths can appear in two forms:
29
+ * 1. "_veryfront/..." - original framework module path prefix
30
+ * 2. "src/react/...", "src/platform/...", etc. - framework source paths
31
+ * (after FSAdapter normalizes absolute paths like /Users/.../veryfront-server/src/...)
32
+ */
33
+ export declare function isFrameworkSourcePath(normalizedPath: string): boolean;
34
+ //# sourceMappingURL=path-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/src/utils/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,uCAAuC,CAAC;AAS9E,uBAAuB;AACvB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAG9E;AAED,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,CAAC;AAExC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAUD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAerD;AAgCD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAQrE"}
@@ -0,0 +1,138 @@
1
+ import { isAbsolute, normalize } from "../platform/compat/path/resolution.js";
2
+ import { base64urlEncode } from "./base64url.js";
3
+ import { logger } from "./logger/logger.js";
4
+ function stripTrailingSlash(pathname) {
5
+ if (pathname === "/")
6
+ return pathname;
7
+ return pathname.replace(/\/+$/, "");
8
+ }
9
+ /** Normalizes path. */
10
+ export function normalizePath(pathname) {
11
+ if (!pathname)
12
+ return pathname;
13
+ return stripTrailingSlash(normalize(pathname.replace(/\\+/g, "/")));
14
+ }
15
+ export function joinPath(a, b) {
16
+ const left = a.replace(/\/$/, "");
17
+ const right = b.replace(/^\//, "");
18
+ return `${left}/${right}`;
19
+ }
20
+ export function isWithinDirectory(root, target) {
21
+ const normalizedRoot = stripTrailingSlash(normalizePath(root));
22
+ const normalizedTarget = stripTrailingSlash(normalizePath(target));
23
+ if (normalizedRoot === "/")
24
+ return normalizedTarget.startsWith("/");
25
+ return normalizedTarget === normalizedRoot || normalizedTarget.startsWith(`${normalizedRoot}/`);
26
+ }
27
+ /**
28
+ * Get file extension including the dot (e.g., ".ts", ".tsx").
29
+ * Returns empty string if no extension found.
30
+ */
31
+ export function getExtension(path) {
32
+ const lastDot = path.lastIndexOf(".");
33
+ if (lastDot === -1 || lastDot === path.length - 1)
34
+ return "";
35
+ return path.slice(lastDot);
36
+ }
37
+ /**
38
+ * Get file extension without the dot, lowercased (e.g., "ts", "tsx").
39
+ * Returns empty string if no extension found.
40
+ */
41
+ export function getExtensionName(path) {
42
+ const lastDot = path.lastIndexOf(".");
43
+ if (lastDot === -1 || lastDot === path.length - 1)
44
+ return "";
45
+ return path.slice(lastDot + 1).toLowerCase();
46
+ }
47
+ export function getDirectory(path) {
48
+ const normalized = normalizePath(path);
49
+ const lastSlash = normalized.lastIndexOf("/");
50
+ if (lastSlash <= 0)
51
+ return "/";
52
+ return normalized.slice(0, lastSlash);
53
+ }
54
+ export function hasHashedFilename(path) {
55
+ return /\.[a-f0-9]{8,}\./.test(path);
56
+ }
57
+ const EXTENSION_TO_LOADER = {
58
+ ".tsx": "tsx",
59
+ ".jsx": "jsx",
60
+ ".ts": "ts",
61
+ };
62
+ /**
63
+ * Get esbuild loader type from file extension
64
+ */
65
+ export function getEsbuildLoader(filePath) {
66
+ const ext = getExtension(filePath).toLowerCase();
67
+ return EXTENSION_TO_LOADER[ext] ?? "js";
68
+ }
69
+ export { isAbsolute as isAbsolutePath };
70
+ export function toBase64Url(input) {
71
+ return base64urlEncode(input);
72
+ }
73
+ function getRequiredBase64Padding(length) {
74
+ const remainder = length % 4;
75
+ if (remainder === 0)
76
+ return "";
77
+ if (remainder === 2)
78
+ return "==";
79
+ if (remainder === 3)
80
+ return "=";
81
+ return undefined;
82
+ }
83
+ export function fromBase64Url(encoded) {
84
+ const b64 = encoded.replaceAll("-", "+").replaceAll("_", "/");
85
+ const padding = getRequiredBase64Padding(b64.length);
86
+ if (padding === undefined) {
87
+ logger.debug(`Failed to decode base64url string "${encoded}": invalid length`);
88
+ return "";
89
+ }
90
+ try {
91
+ return atob(b64 + padding);
92
+ }
93
+ catch (error) {
94
+ logger.debug(`Failed to decode base64url string "${encoded}":`, error);
95
+ return "";
96
+ }
97
+ }
98
+ /**
99
+ * Framework source directories that should never be fetched from the API.
100
+ * These are framework-internal modules that must be resolved from local filesystem.
101
+ */
102
+ const FRAMEWORK_SOURCE_DIRS = [
103
+ "react",
104
+ "platform",
105
+ "client",
106
+ "lib",
107
+ "html",
108
+ "utils",
109
+ "transforms",
110
+ "modules",
111
+ "server",
112
+ "config",
113
+ "errors",
114
+ "observability",
115
+ "rendering",
116
+ "security",
117
+ "data",
118
+ "cache",
119
+ "build",
120
+ "repositories",
121
+ "cli",
122
+ ];
123
+ const FRAMEWORK_SOURCE_PATH_RE = new RegExp(`^src/(${FRAMEWORK_SOURCE_DIRS.join("|")})/`);
124
+ /**
125
+ * Check if a normalized path is a framework path that should not be fetched from API.
126
+ *
127
+ * Framework paths can appear in two forms:
128
+ * 1. "_veryfront/..." - original framework module path prefix
129
+ * 2. "src/react/...", "src/platform/...", etc. - framework source paths
130
+ * (after FSAdapter normalizes absolute paths like /Users/.../veryfront-server/src/...)
131
+ */
132
+ export function isFrameworkSourcePath(normalizedPath) {
133
+ // Check for _veryfront/ prefix (with or without embedded: prefix)
134
+ if (normalizedPath.startsWith("_veryfront/") || normalizedPath.startsWith("embedded:_veryfront/")) {
135
+ return true;
136
+ }
137
+ return FRAMEWORK_SOURCE_PATH_RE.test(normalizedPath);
138
+ }
@@ -0,0 +1,11 @@
1
+ /** Request payload for start. */
2
+ export declare function startRequest(requestId: string): void;
3
+ /** Starts timer. */
4
+ export declare function startTimer(label: string, parent?: string): () => void;
5
+ /** Time async. */
6
+ export declare function timeAsync<T>(label: string, fn: () => Promise<T>, parent?: string): Promise<T>;
7
+ /** Request payload for end. */
8
+ export declare function endRequest(requestId: string): void;
9
+ /** Check whether request performance timing is enabled. */
10
+ export declare function isEnabled(): boolean;
11
+ //# sourceMappingURL=perf-timer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perf-timer.d.ts","sourceRoot":"","sources":["../../../src/src/utils/perf-timer.ts"],"names":[],"mappings":"AAkCA,iCAAiC;AACjC,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAKpD;AAED,oBAAoB;AACpB,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAUrE;AAED,kBAAkB;AAClB,wBAAsB,SAAS,CAAC,CAAC,EAC/B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,+BAA+B;AAC/B,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAmElD;AAED,2DAA2D;AAC3D,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
@@ -0,0 +1,114 @@
1
+ import { getEnv } from "../platform/compat/process.js";
2
+ import { serverLogger } from "./logger/logger.js";
3
+ const logger = serverLogger.component("perf");
4
+ let cachedEnabled;
5
+ function getEnabled() {
6
+ if (cachedEnabled !== undefined)
7
+ return cachedEnabled;
8
+ // Read env directly to avoid triggering getEnvironmentConfig() at module-load time.
9
+ // This module is imported before .env is loaded, so going through the config
10
+ // pipeline produces a noisy early-access warning.
11
+ cachedEnabled = getEnv("VERYFRONT_PERF") === "1";
12
+ return cachedEnabled;
13
+ }
14
+ const timings = new Map();
15
+ let currentRequestId = null;
16
+ function formatMs(value) {
17
+ return Number(value?.toFixed(1));
18
+ }
19
+ function formatPct(duration, total) {
20
+ return ((duration / total) * 100).toFixed(1);
21
+ }
22
+ /** Request payload for start. */
23
+ export function startRequest(requestId) {
24
+ if (!getEnabled())
25
+ return;
26
+ currentRequestId = requestId;
27
+ timings.set(requestId, []);
28
+ }
29
+ /** Starts timer. */
30
+ export function startTimer(label, parent) {
31
+ if (!getEnabled() || !currentRequestId)
32
+ return () => { };
33
+ const entry = { label, startMs: performance.now(), parent };
34
+ timings.get(currentRequestId)?.push(entry);
35
+ return () => {
36
+ entry.endMs = performance.now();
37
+ entry.durationMs = entry.endMs - entry.startMs;
38
+ };
39
+ }
40
+ /** Time async. */
41
+ export async function timeAsync(label, fn, parent) {
42
+ if (!getEnabled())
43
+ return fn();
44
+ const stop = startTimer(label, parent);
45
+ try {
46
+ return await fn();
47
+ }
48
+ finally {
49
+ stop();
50
+ }
51
+ }
52
+ /** Request payload for end. */
53
+ export function endRequest(requestId) {
54
+ if (!getEnabled())
55
+ return;
56
+ const entries = timings.get(requestId);
57
+ if (!entries?.length) {
58
+ currentRequestId = null;
59
+ return;
60
+ }
61
+ const sorted = entries
62
+ .filter((e) => e.durationMs !== undefined)
63
+ .sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0));
64
+ const total = entries.find((e) => e.label === "total")?.durationMs ??
65
+ sorted.reduce((sum, e) => sum + (e.durationMs ?? 0), 0);
66
+ const roots = sorted.filter((e) => !e.parent);
67
+ const children = new Map();
68
+ for (const entry of sorted) {
69
+ const parentLabel = entry.parent;
70
+ if (!parentLabel)
71
+ continue;
72
+ const list = children.get(parentLabel);
73
+ if (list) {
74
+ list.push(entry);
75
+ }
76
+ else {
77
+ children.set(parentLabel, [entry]);
78
+ }
79
+ }
80
+ const breakdown = roots.map((entry) => {
81
+ const duration = entry.durationMs ?? 0;
82
+ const item = {
83
+ label: entry.label,
84
+ durationMs: formatMs(entry.durationMs),
85
+ pct: formatPct(duration, total),
86
+ };
87
+ const childList = children.get(entry.label);
88
+ if (!childList)
89
+ return item;
90
+ item.children = childList.slice(0, 5).map((child) => {
91
+ const childDuration = child.durationMs ?? 0;
92
+ return {
93
+ label: child.label,
94
+ durationMs: formatMs(child.durationMs),
95
+ pct: formatPct(childDuration, total),
96
+ };
97
+ });
98
+ if (childList.length > 5) {
99
+ item.childrenOmitted = childList.length - 5;
100
+ }
101
+ return item;
102
+ });
103
+ logger.debug(`Request ${requestId}`, {
104
+ requestId,
105
+ totalMs: formatMs(total),
106
+ breakdown,
107
+ });
108
+ timings.delete(requestId);
109
+ currentRequestId = null;
110
+ }
111
+ /** Check whether request performance timing is enabled. */
112
+ export function isEnabled() {
113
+ return getEnabled();
114
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Platform detection utilities
3
+ */
4
+ /**
5
+ * Detect if the code is running in a compiled Deno binary
6
+ * @returns true if running in a compiled binary, false otherwise
7
+ */
8
+ export declare function isCompiledBinary(): boolean;
9
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../src/src/utils/platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Platform detection utilities
3
+ */
4
+ import { isDenoCompiled } from "../platform/compat/runtime.js";
5
+ /**
6
+ * Detect if the code is running in a compiled Deno binary
7
+ * @returns true if running in a compiled binary, false otherwise
8
+ */
9
+ export function isCompiledBinary() {
10
+ return isDenoCompiled;
11
+ }
@@ -0,0 +1,29 @@
1
+ /** Public API contract for global with Deno. */
2
+ export interface GlobalWithDeno {
3
+ Deno?: {
4
+ env: {
5
+ get(key: string): string | undefined;
6
+ };
7
+ };
8
+ }
9
+ /** Public API contract for global with process. */
10
+ export interface GlobalWithProcess {
11
+ process?: {
12
+ env: Record<string, string | undefined>;
13
+ version?: string;
14
+ versions?: Record<string, string>;
15
+ };
16
+ }
17
+ /** Public API contract for global with Bun. */
18
+ export interface GlobalWithBun {
19
+ Bun?: {
20
+ version: string;
21
+ };
22
+ }
23
+ /** Check whether Deno runtime is present. */
24
+ export declare function hasDenoRuntime(global: unknown): global is GlobalWithDeno;
25
+ /** Check whether node process is present. */
26
+ export declare function hasNodeProcess(global: unknown): global is GlobalWithProcess;
27
+ /** Check whether Bun runtime is present. */
28
+ export declare function hasBunRuntime(global: unknown): global is GlobalWithBun;
29
+ //# sourceMappingURL=runtime-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-guards.d.ts","sourceRoot":"","sources":["../../../src/src/utils/runtime-guards.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE;QACL,GAAG,EAAE;YACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;SACtC,CAAC;KACH,CAAC;CACH;AAED,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE;QACR,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;QACxC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC,CAAC;CACH;AAED,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAMD,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,cAAc,CAIxE;AAED,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,iBAAiB,CAI3E;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,CAGtE"}
@@ -0,0 +1,23 @@
1
+ function isObject(value) {
2
+ return typeof value === "object" && value !== null;
3
+ }
4
+ /** Check whether Deno runtime is present. */
5
+ export function hasDenoRuntime(global) {
6
+ if (!isObject(global) || !("Deno" in global))
7
+ return false;
8
+ const denoObj = global.Deno;
9
+ return typeof denoObj?.env?.get === "function";
10
+ }
11
+ /** Check whether node process is present. */
12
+ export function hasNodeProcess(global) {
13
+ if (!isObject(global) || !("process" in global))
14
+ return false;
15
+ const processObj = global.process;
16
+ return typeof processObj?.env === "object";
17
+ }
18
+ /** Check whether Bun runtime is present. */
19
+ export function hasBunRuntime(global) {
20
+ if (!isObject(global) || !("Bun" in global))
21
+ return false;
22
+ return global.Bun !== undefined;
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare function sleep(ms: number, abortSignal?: AbortSignal): Promise<void>;
2
+ //# sourceMappingURL=sleep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../src/src/utils/sleep.ts"],"names":[],"mappings":"AAGA,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAe1E"}
@@ -0,0 +1,19 @@
1
+ /** Resolve after `ms` milliseconds; rejects with `abortSignal.reason` if aborted first. */
2
+ import * as dntShim from "../../_dnt.shims.js";
3
+ export function sleep(ms, abortSignal) {
4
+ abortSignal?.throwIfAborted();
5
+ return new Promise((resolve, reject) => {
6
+ const timeoutId = dntShim.setTimeout(() => {
7
+ abortSignal?.removeEventListener("abort", onAbort);
8
+ resolve();
9
+ }, ms);
10
+ const onAbort = () => {
11
+ clearTimeout(timeoutId);
12
+ abortSignal?.removeEventListener("abort", onAbort);
13
+ reject(abortSignal?.reason);
14
+ };
15
+ abortSignal?.addEventListener("abort", onAbort, { once: true });
16
+ if (abortSignal?.aborted)
17
+ onAbort();
18
+ });
19
+ }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1119";
2
+ export declare const VERSION = "0.1.1122";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1119";
4
+ export const VERSION = "0.1.1122";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-content-mdx",
3
- "version": "0.1.1119",
3
+ "version": "0.1.1122",
4
4
  "description": "Veryfront first-party extension package for ext-content-mdx",
5
5
  "keywords": [
6
6
  "veryfront",
@@ -67,7 +67,7 @@
67
67
  "vfile": "6.0.3"
68
68
  },
69
69
  "peerDependencies": {
70
- "veryfront": "^0.1.1119"
70
+ "veryfront": "^0.1.1122"
71
71
  },
72
72
  "type": "module",
73
73
  "types": "./esm/extensions/ext-content-mdx/src/index.d.ts",