veryfront 0.0.31 → 0.0.33

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.
package/dist/index.js CHANGED
@@ -131,7 +131,6 @@ function __loggerResetForTests(options = {}) {
131
131
  var LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;
132
132
  var init_logger = __esm({
133
133
  "src/core/utils/logger/logger.ts"() {
134
- "use strict";
135
134
  init_env();
136
135
  LogLevel = /* @__PURE__ */ ((LogLevel2) => {
137
136
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
@@ -237,6 +236,7 @@ var init_build = __esm({
237
236
  var SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, MS_PER_SECOND, DEFAULT_LRU_MAX_ENTRIES, COMPONENT_LOADER_MAX_ENTRIES, COMPONENT_LOADER_TTL_MS, MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS, RENDERER_CORE_MAX_ENTRIES, RENDERER_CORE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_TTL_MS, DATA_FETCHING_MAX_ENTRIES, DATA_FETCHING_TTL_MS, MDX_CACHE_TTL_PRODUCTION_MS, MDX_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_CACHE_TTL_PRODUCTION_MS, BUNDLE_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_MANIFEST_PROD_TTL_MS, BUNDLE_MANIFEST_DEV_TTL_MS, RSC_MANIFEST_CACHE_TTL_MS, SERVER_ACTION_DEFAULT_TTL_SEC, DENO_KV_SAFE_SIZE_LIMIT_BYTES, HTTP_CACHE_SHORT_MAX_AGE_SEC, HTTP_CACHE_MEDIUM_MAX_AGE_SEC, HTTP_CACHE_LONG_MAX_AGE_SEC, ONE_DAY_MS, CACHE_CLEANUP_INTERVAL_MS, LRU_DEFAULT_MAX_ENTRIES, LRU_DEFAULT_MAX_SIZE_BYTES, CLEANUP_INTERVAL_MULTIPLIER;
238
237
  var init_cache = __esm({
239
238
  "src/core/utils/constants/cache.ts"() {
239
+ "use strict";
240
240
  SECONDS_PER_MINUTE = 60;
241
241
  MINUTES_PER_HOUR = 60;
242
242
  HOURS_PER_DAY = 24;
@@ -310,7 +310,6 @@ function getUnoCSSTailwindResetUrl() {
310
310
  var ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERSION_18_2, REACT_VERSION_18_3, REACT_VERSION_19_RC, REACT_VERSION_19, REACT_DEFAULT_VERSION, DEFAULT_ALLOWED_CDN_HOSTS, DENO_STD_VERSION, UNOCSS_VERSION;
311
311
  var init_cdn = __esm({
312
312
  "src/core/utils/constants/cdn.ts"() {
313
- "use strict";
314
313
  ESM_CDN_BASE = "https://esm.sh";
315
314
  JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";
316
315
  DENO_STD_BASE = "https://deno.land";
@@ -330,7 +329,6 @@ var init_cdn = __esm({
330
329
  var HASH_SEED_DJB2, HASH_SEED_FNV1A;
331
330
  var init_hash = __esm({
332
331
  "src/core/utils/constants/hash.ts"() {
333
- "use strict";
334
332
  HASH_SEED_DJB2 = 5381;
335
333
  HASH_SEED_FNV1A = 2166136261;
336
334
  }
@@ -340,7 +338,6 @@ var init_hash = __esm({
340
338
  var KB_IN_BYTES, HTTP_MODULE_FETCH_TIMEOUT_MS, HMR_RECONNECT_DELAY_MS, HMR_RELOAD_DELAY_MS, HMR_FILE_WATCHER_DEBOUNCE_MS, HMR_KEEP_ALIVE_INTERVAL_MS, DASHBOARD_RECONNECT_DELAY_MS, SERVER_FUNCTION_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_DEFAULT_DELAY_MS, HTTP_OK, HTTP_NO_CONTENT, HTTP_CREATED, HTTP_REDIRECT_FOUND, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST, HTTP_UNAUTHORIZED, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_METHOD_NOT_ALLOWED, HTTP_GONE, HTTP_PAYLOAD_TOO_LARGE, HTTP_URI_TOO_LONG, HTTP_TOO_MANY_REQUESTS, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, HTTP_SERVER_ERROR, HTTP_INTERNAL_SERVER_ERROR, HTTP_BAD_GATEWAY, HTTP_NOT_IMPLEMENTED, HTTP_UNAVAILABLE, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_STATUS_SUCCESS_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_CONTENT_TYPES, MS_PER_MINUTE, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPE_IMAGE_AVIF, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO;
341
339
  var init_http = __esm({
342
340
  "src/core/utils/constants/http.ts"() {
343
- "use strict";
344
341
  init_cache();
345
342
  KB_IN_BYTES = 1024;
346
343
  HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;
@@ -444,6 +441,7 @@ var init_html = __esm({
444
441
  var DEFAULT_DEV_SERVER_PORT, DEFAULT_REDIS_PORT, DEFAULT_API_SERVER_PORT, DEFAULT_PREVIEW_SERVER_PORT, DEFAULT_METRICS_PORT, BYTES_PER_KB, BYTES_PER_MB, DEFAULT_IMAGE_THUMBNAIL_SIZE, DEFAULT_IMAGE_SMALL_SIZE, DEFAULT_IMAGE_LARGE_SIZE, RESPONSIVE_IMAGE_WIDTH_XS, RESPONSIVE_IMAGE_WIDTH_SM, RESPONSIVE_IMAGE_WIDTH_MD, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, MAX_CHUNK_SIZE_KB, MIN_PORT, MAX_PORT, DEFAULT_SERVER_PORT;
445
442
  var init_network = __esm({
446
443
  "src/core/utils/constants/network.ts"() {
444
+ "use strict";
447
445
  DEFAULT_DEV_SERVER_PORT = 3e3;
448
446
  DEFAULT_REDIS_PORT = 6379;
449
447
  DEFAULT_API_SERVER_PORT = 8080;
@@ -524,8 +522,15 @@ var init_deno = __esm({
524
522
  "deno.json"() {
525
523
  deno_default = {
526
524
  name: "veryfront",
527
- version: "0.0.31",
528
- nodeModulesDir: "auto",
525
+ version: "0.0.33",
526
+ exclude: [
527
+ "npm/",
528
+ "dist/",
529
+ "coverage/",
530
+ "scripts/",
531
+ "examples/",
532
+ "tests/"
533
+ ],
529
534
  exports: {
530
535
  ".": "./src/index.ts",
531
536
  "./cli": "./src/cli/main.ts",
@@ -619,11 +624,13 @@ var init_deno = __esm({
619
624
  unified: "https://esm.sh/unified@11.0.5?dts",
620
625
  ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",
621
626
  "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
627
+ "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
622
628
  "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",
623
629
  "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",
624
630
  unocss: "https://esm.sh/unocss@0.59.0",
625
631
  "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",
626
- "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0"
632
+ "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",
633
+ redis: "npm:redis"
627
634
  },
628
635
  compilerOptions: {
629
636
  jsx: "react-jsx",
@@ -649,8 +656,6 @@ var init_deno = __esm({
649
656
  test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",
650
657
  "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",
651
658
  "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",
652
- "test:batches": "deno run --allow-all scripts/test-batches.ts",
653
- "test:unsafe": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net",
654
659
  "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",
655
660
  "test:coverage:unit": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1",
656
661
  "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",
@@ -664,6 +669,7 @@ var init_deno = __esm({
664
669
  "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",
665
670
  "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",
666
671
  "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",
672
+ "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",
667
673
  "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"
668
674
  },
669
675
  lint: {
@@ -724,17 +730,61 @@ var init_runtime = __esm({
724
730
  });
725
731
 
726
732
  // src/platform/compat/process.ts
727
- import process2 from "node:process";
733
+ function cwd() {
734
+ if (isDeno) {
735
+ return process.cwd();
736
+ }
737
+ if (hasNodeProcess2) {
738
+ return nodeProcess.cwd();
739
+ }
740
+ throw new Error("cwd() is not supported in this runtime");
741
+ }
728
742
  function getEnv(key) {
729
743
  if (isDeno) {
730
- return process2.env(key);
744
+ return process.env(key);
745
+ }
746
+ if (hasNodeProcess2) {
747
+ return nodeProcess.env[key];
731
748
  }
732
- return process2.env[key];
749
+ return void 0;
733
750
  }
751
+ function memoryUsage() {
752
+ if (isDeno) {
753
+ const usage2 = Deno.memoryUsage();
754
+ return {
755
+ rss: usage2.rss,
756
+ heapTotal: usage2.heapTotal,
757
+ heapUsed: usage2.heapUsed,
758
+ external: usage2.external
759
+ };
760
+ }
761
+ if (!hasNodeProcess2) {
762
+ throw new Error("memoryUsage() is not supported in this runtime");
763
+ }
764
+ const usage = nodeProcess.memoryUsage();
765
+ return {
766
+ rss: usage.rss,
767
+ heapTotal: usage.heapTotal,
768
+ heapUsed: usage.heapUsed,
769
+ external: usage.external || 0
770
+ };
771
+ }
772
+ function execPath() {
773
+ if (isDeno) {
774
+ return Deno.execPath();
775
+ }
776
+ if (hasNodeProcess2) {
777
+ return nodeProcess.execPath;
778
+ }
779
+ return "";
780
+ }
781
+ var nodeProcess, hasNodeProcess2;
734
782
  var init_process = __esm({
735
783
  "src/platform/compat/process.ts"() {
736
784
  "use strict";
737
785
  init_runtime();
786
+ nodeProcess = globalThis.process;
787
+ hasNodeProcess2 = !!nodeProcess?.versions?.node;
738
788
  }
739
789
  });
740
790
 
@@ -1271,13 +1321,11 @@ var init_feature_flags = __esm({
1271
1321
 
1272
1322
  // src/core/utils/platform.ts
1273
1323
  function isCompiledBinary() {
1274
- const hasDeno = typeof Deno !== "undefined";
1275
- const hasExecPath = hasDeno && typeof Deno.execPath === "function";
1276
- if (!hasExecPath)
1324
+ if (!isDeno)
1277
1325
  return false;
1278
1326
  try {
1279
- const execPath = Deno.execPath();
1280
- return execPath.includes("veryfront");
1327
+ const path = execPath();
1328
+ return path.includes("veryfront");
1281
1329
  } catch {
1282
1330
  return false;
1283
1331
  }
@@ -1285,6 +1333,8 @@ function isCompiledBinary() {
1285
1333
  var init_platform = __esm({
1286
1334
  "src/core/utils/platform.ts"() {
1287
1335
  "use strict";
1336
+ init_runtime();
1337
+ init_process();
1288
1338
  }
1289
1339
  });
1290
1340
 
@@ -1674,7 +1724,7 @@ var init_schema = __esm({
1674
1724
  });
1675
1725
 
1676
1726
  // src/core/config/loader.ts
1677
- import { join } from "path";
1727
+ import { join } from "node:path";
1678
1728
  function getDefaultImportMapForConfig() {
1679
1729
  return { imports: getReactImportMap(REACT_DEFAULT_VERSION) };
1680
1730
  }
@@ -2267,20 +2317,20 @@ var init_filesystem_adapter = __esm({
2267
2317
  });
2268
2318
 
2269
2319
  // src/platform/adapters/node/environment-adapter.ts
2270
- import process3 from "node:process";
2320
+ import process2 from "node:process";
2271
2321
  var NodeEnvironmentAdapter;
2272
2322
  var init_environment_adapter = __esm({
2273
2323
  "src/platform/adapters/node/environment-adapter.ts"() {
2274
2324
  "use strict";
2275
2325
  NodeEnvironmentAdapter = class {
2276
2326
  get(key) {
2277
- return process3.env[key];
2327
+ return process2.env[key];
2278
2328
  }
2279
2329
  set(key, value) {
2280
- process3.env[key] = value;
2330
+ process2.env[key] = value;
2281
2331
  }
2282
2332
  toObject() {
2283
- return { ...process3.env };
2333
+ return { ...process2.env };
2284
2334
  }
2285
2335
  };
2286
2336
  }
@@ -8075,7 +8125,9 @@ var init_registry = __esm({
8075
8125
  "Cloudflare Workers detected but requires manual initialization. Use: await runtime.set(createCloudflareAdapter(env))"
8076
8126
  );
8077
8127
  }
8078
- return "node";
8128
+ throw new Error(
8129
+ "Unsupported runtime detected. Supported runtimes: deno, node, bun. For Cloudflare Workers, call runtime.set(createCloudflareAdapter(env))."
8130
+ );
8079
8131
  }
8080
8132
  /**
8081
8133
  * Initialize the adapter
@@ -8102,7 +8154,6 @@ __export(detect_exports, {
8102
8154
  nodeAdapter: () => nodeAdapter,
8103
8155
  runtime: () => runtime
8104
8156
  });
8105
- import process4 from "node:process";
8106
8157
  function isDeno2(global) {
8107
8158
  return "Deno" in global && typeof global.Deno === "object";
8108
8159
  }
@@ -8119,7 +8170,8 @@ function detectRuntime() {
8119
8170
  if (isBun2(globalThis)) {
8120
8171
  return "bun";
8121
8172
  }
8122
- if (process4?.versions?.node) {
8173
+ const globalProcess = globalThis.process;
8174
+ if (globalProcess?.versions?.node) {
8123
8175
  return "node";
8124
8176
  }
8125
8177
  if (isCloudflare2(globalThis)) {
@@ -8650,7 +8702,7 @@ function getCacheNamespace() {
8650
8702
  // src/module-system/import-map/loader.ts
8651
8703
  init_utils();
8652
8704
  init_config();
8653
- import { dirname, join as join2 } from "path";
8705
+ import { dirname, join as join2 } from "node:path";
8654
8706
 
8655
8707
  // src/module-system/import-map/default-import-map.ts
8656
8708
  init_utils();
@@ -8721,9 +8773,9 @@ function transformImportsWithMap(code, importMap, scope, options) {
8721
8773
  }
8722
8774
 
8723
8775
  // src/build/transforms/mdx/esm-module-loader.ts
8724
- import { join as join4 } from "path";
8725
- var _global = globalThis;
8726
- var IS_NODE = typeof Deno === "undefined" && typeof _global.process !== "undefined" && _global.process?.versions?.node;
8776
+ init_runtime();
8777
+ init_process();
8778
+ import { join as join4 } from "node:path";
8727
8779
  var LOG_PREFIX_MDX_LOADER = "[mdx-loader]";
8728
8780
  var LOG_PREFIX_MDX_RENDERER = "[mdx-renderer]";
8729
8781
  var JSX_IMPORT_PATTERN = /import\s+([^'"]+)\s+from\s+['"]file:\/\/([^'"]+\.(jsx|tsx))['"];?/g;
@@ -8806,9 +8858,9 @@ async function loadModuleESM(compiledProgramCode, context) {
8806
8858
  const { getAdapter: getAdapter2 } = await Promise.resolve().then(() => (init_detect(), detect_exports));
8807
8859
  const adapter = await getAdapter2();
8808
8860
  if (!context.esmCacheDir) {
8809
- if (IS_NODE) {
8861
+ if (isNode) {
8810
8862
  const projectCacheDir = join4(
8811
- _global.process.cwd(),
8863
+ cwd(),
8812
8864
  "node_modules",
8813
8865
  ".cache",
8814
8866
  "veryfront-mdx"
@@ -8820,7 +8872,7 @@ async function loadModuleESM(compiledProgramCode, context) {
8820
8872
  }
8821
8873
  }
8822
8874
  let rewritten;
8823
- if (IS_NODE) {
8875
+ if (isNode) {
8824
8876
  rewritten = compiledProgramCode;
8825
8877
  } else {
8826
8878
  rewritten = transformImportsWithMap(
@@ -8875,7 +8927,7 @@ ${transformed}`;
8875
8927
  if (/\bconst\s+MDXLayout\b/.test(rewritten) && !/export\s+\{[^}]*MDXLayout/.test(rewritten)) {
8876
8928
  rewritten += "\nexport { MDXLayout as __vfLayout };\n";
8877
8929
  }
8878
- if (IS_NODE && HTTP_IMPORT_PATTERN.test(rewritten)) {
8930
+ if (isNode && HTTP_IMPORT_PATTERN.test(rewritten)) {
8879
8931
  rendererLogger.info(`${LOG_PREFIX_MDX_LOADER} Bundling HTTP imports via esbuild for Node.js`);
8880
8932
  const { build: build2 } = await import("esbuild/mod.js");
8881
8933
  const tempSourcePath = join4(context.esmCacheDir, `temp-${hashString(rewritten)}.mjs`);
@@ -9417,6 +9469,7 @@ import { jsx as jsx9 } from "react/jsx-runtime";
9417
9469
 
9418
9470
  // src/data/data-fetching-cache.ts
9419
9471
  init_cache();
9472
+ init_process();
9420
9473
 
9421
9474
  // src/data/server-data-fetcher.ts
9422
9475
  init_utils();
@@ -9447,7 +9500,7 @@ var pathMod = null;
9447
9500
  if (typeof Deno === "undefined") {
9448
9501
  pathMod = nodePath;
9449
9502
  } else {
9450
- import("path").then((mod) => {
9503
+ import("node:path").then((mod) => {
9451
9504
  pathMod = mod;
9452
9505
  });
9453
9506
  }
@@ -9474,7 +9527,7 @@ init_utils();
9474
9527
  // src/routing/api/handler.ts
9475
9528
  init_utils();
9476
9529
  init_config();
9477
- import { join as join7 } from "path";
9530
+ import { join as join7 } from "node:path";
9478
9531
  init_veryfront_error();
9479
9532
 
9480
9533
  // src/http/responses.ts
@@ -9610,6 +9663,7 @@ init_logger();
9610
9663
  init_utils();
9611
9664
 
9612
9665
  // src/observability/tracing/config.ts
9666
+ init_process();
9613
9667
  var DEFAULT_CONFIG2 = {
9614
9668
  enabled: false,
9615
9669
  exporter: "console",
@@ -9645,13 +9699,10 @@ function applyEnvFromAdapter(config, envAdapter) {
9645
9699
  }
9646
9700
  function applyEnvFromDeno(config) {
9647
9701
  try {
9648
- const denoEnv = globalThis.Deno?.env;
9649
- if (!denoEnv)
9650
- return;
9651
- config.enabled = denoEnv.get("OTEL_TRACES_ENABLED") === "true" || denoEnv.get("VERYFRONT_OTEL") === "1" || config.enabled;
9652
- config.serviceName = denoEnv.get("OTEL_SERVICE_NAME") || config.serviceName;
9653
- config.endpoint = denoEnv.get("OTEL_EXPORTER_OTLP_ENDPOINT") || denoEnv.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") || config.endpoint;
9654
- const exporterType = denoEnv.get("OTEL_TRACES_EXPORTER");
9702
+ config.enabled = getEnv("OTEL_TRACES_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || config.enabled;
9703
+ config.serviceName = getEnv("OTEL_SERVICE_NAME") || config.serviceName;
9704
+ config.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") || config.endpoint;
9705
+ const exporterType = getEnv("OTEL_TRACES_EXPORTER");
9655
9706
  if (isValidExporter(exporterType)) {
9656
9707
  config.exporter = exporterType;
9657
9708
  }
@@ -9894,6 +9945,8 @@ var tracingManager = new TracingManager();
9894
9945
  init_utils();
9895
9946
 
9896
9947
  // src/observability/metrics/config.ts
9948
+ init_process();
9949
+ init_process();
9897
9950
  var DEFAULT_METRICS_COLLECT_INTERVAL_MS2 = 6e4;
9898
9951
  var DEFAULT_CONFIG3 = {
9899
9952
  enabled: false,
@@ -9920,14 +9973,11 @@ function loadConfig2(config, adapter) {
9920
9973
  }
9921
9974
  } else {
9922
9975
  try {
9923
- const env = process.env;
9924
- if (env) {
9925
- finalConfig.enabled = env.OTEL_METRICS_ENABLED === "true" || env.VERYFRONT_OTEL === "1" || finalConfig.enabled;
9926
- finalConfig.endpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT || env.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT || finalConfig.endpoint;
9927
- const exporterType = env.OTEL_METRICS_EXPORTER;
9928
- if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {
9929
- finalConfig.exporter = exporterType;
9930
- }
9976
+ finalConfig.enabled = getEnv("OTEL_METRICS_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || finalConfig.enabled;
9977
+ finalConfig.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT") || finalConfig.endpoint;
9978
+ const exporterType = getEnv("OTEL_METRICS_EXPORTER");
9979
+ if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {
9980
+ finalConfig.exporter = exporterType;
9931
9981
  }
9932
9982
  } catch {
9933
9983
  }
@@ -9936,10 +9986,7 @@ function loadConfig2(config, adapter) {
9936
9986
  }
9937
9987
  function getMemoryUsage() {
9938
9988
  try {
9939
- if (process?.memoryUsage) {
9940
- return process.memoryUsage();
9941
- }
9942
- return null;
9989
+ return memoryUsage();
9943
9990
  } catch {
9944
9991
  return null;
9945
9992
  }
@@ -10112,9 +10159,9 @@ function createMemoryInstruments(meter, config) {
10112
10159
  }
10113
10160
  );
10114
10161
  memoryUsageGauge.addCallback((result) => {
10115
- const memoryUsage = getMemoryUsage();
10116
- if (memoryUsage) {
10117
- result.observe(memoryUsage.rss);
10162
+ const memoryUsage2 = getMemoryUsage();
10163
+ if (memoryUsage2) {
10164
+ result.observe(memoryUsage2.rss);
10118
10165
  }
10119
10166
  });
10120
10167
  const heapUsageGauge = meter.createObservableGauge(
@@ -10125,9 +10172,9 @@ function createMemoryInstruments(meter, config) {
10125
10172
  }
10126
10173
  );
10127
10174
  heapUsageGauge.addCallback((result) => {
10128
- const memoryUsage = getMemoryUsage();
10129
- if (memoryUsage) {
10130
- result.observe(memoryUsage.heapUsed);
10175
+ const memoryUsage2 = getMemoryUsage();
10176
+ if (memoryUsage2) {
10177
+ result.observe(memoryUsage2.heapUsed);
10131
10178
  }
10132
10179
  });
10133
10180
  return {
@@ -10770,6 +10817,7 @@ function applyCORSHeadersSync(options) {
10770
10817
 
10771
10818
  // src/security/http/cors/constants.ts
10772
10819
  init_config();
10820
+ init_process();
10773
10821
 
10774
10822
  // src/security/http/cors/preflight.ts
10775
10823
  init_logger();
@@ -11560,12 +11608,15 @@ init_veryfront_error();
11560
11608
  init_veryfront_error();
11561
11609
  init_runtime();
11562
11610
 
11611
+ // src/routing/api/module-loader/loader.ts
11612
+ init_runtime();
11613
+
11563
11614
  // src/routing/api/route-discovery.ts
11564
- import { relative } from "path";
11615
+ import { relative } from "node:path";
11565
11616
 
11566
11617
  // src/core/utils/file-discovery.ts
11567
11618
  init_deno2();
11568
- import { join as join6 } from "path";
11619
+ import { join as join6 } from "node:path";
11569
11620
 
11570
11621
  // src/routing/api/route-executor.ts
11571
11622
  init_veryfront_error();