veryfront 0.0.31 → 0.0.32

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.
@@ -525,8 +525,15 @@ var init_deno = __esm({
525
525
  "deno.json"() {
526
526
  deno_default = {
527
527
  name: "veryfront",
528
- version: "0.0.31",
529
- nodeModulesDir: "auto",
528
+ version: "0.0.32",
529
+ exclude: [
530
+ "npm/",
531
+ "dist/",
532
+ "coverage/",
533
+ "scripts/",
534
+ "examples/",
535
+ "tests/"
536
+ ],
530
537
  exports: {
531
538
  ".": "./src/index.ts",
532
539
  "./cli": "./src/cli/main.ts",
@@ -620,11 +627,13 @@ var init_deno = __esm({
620
627
  unified: "https://esm.sh/unified@11.0.5?dts",
621
628
  ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",
622
629
  "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
630
+ "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
623
631
  "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",
624
632
  "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",
625
633
  unocss: "https://esm.sh/unocss@0.59.0",
626
634
  "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",
627
- "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0"
635
+ "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",
636
+ redis: "npm:redis"
628
637
  },
629
638
  compilerOptions: {
630
639
  jsx: "react-jsx",
@@ -650,8 +659,6 @@ var init_deno = __esm({
650
659
  test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",
651
660
  "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",
652
661
  "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",
653
- "test:batches": "deno run --allow-all scripts/test-batches.ts",
654
- "test:unsafe": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net",
655
662
  "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",
656
663
  "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",
657
664
  "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",
@@ -665,6 +672,7 @@ var init_deno = __esm({
665
672
  "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",
666
673
  "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",
667
674
  "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",
675
+ "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",
668
676
  "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"
669
677
  },
670
678
  lint: {
@@ -725,17 +733,40 @@ var init_runtime = __esm({
725
733
  });
726
734
 
727
735
  // src/platform/compat/process.ts
728
- import process2 from "node:process";
736
+ function cwd() {
737
+ if (isDeno) {
738
+ return process.cwd();
739
+ }
740
+ if (hasNodeProcess2) {
741
+ return nodeProcess.cwd();
742
+ }
743
+ throw new Error("cwd() is not supported in this runtime");
744
+ }
729
745
  function getEnv(key) {
730
746
  if (isDeno) {
731
- return process2.env(key);
747
+ return process.env(key);
748
+ }
749
+ if (hasNodeProcess2) {
750
+ return nodeProcess.env[key];
751
+ }
752
+ return void 0;
753
+ }
754
+ function execPath() {
755
+ if (isDeno) {
756
+ return Deno.execPath();
757
+ }
758
+ if (hasNodeProcess2) {
759
+ return nodeProcess.execPath;
732
760
  }
733
- return process2.env[key];
761
+ return "";
734
762
  }
763
+ var nodeProcess, hasNodeProcess2;
735
764
  var init_process = __esm({
736
765
  "src/platform/compat/process.ts"() {
737
766
  "use strict";
738
767
  init_runtime();
768
+ nodeProcess = globalThis.process;
769
+ hasNodeProcess2 = !!nodeProcess?.versions?.node;
739
770
  }
740
771
  });
741
772
 
@@ -1273,13 +1304,11 @@ var init_feature_flags = __esm({
1273
1304
 
1274
1305
  // src/core/utils/platform.ts
1275
1306
  function isCompiledBinary() {
1276
- const hasDeno = typeof Deno !== "undefined";
1277
- const hasExecPath = hasDeno && typeof Deno.execPath === "function";
1278
- if (!hasExecPath)
1307
+ if (!isDeno)
1279
1308
  return false;
1280
1309
  try {
1281
- const execPath = Deno.execPath();
1282
- return execPath.includes("veryfront");
1310
+ const path = execPath();
1311
+ return path.includes("veryfront");
1283
1312
  } catch {
1284
1313
  return false;
1285
1314
  }
@@ -1287,6 +1316,8 @@ function isCompiledBinary() {
1287
1316
  var init_platform = __esm({
1288
1317
  "src/core/utils/platform.ts"() {
1289
1318
  "use strict";
1319
+ init_runtime();
1320
+ init_process();
1290
1321
  }
1291
1322
  });
1292
1323
 
@@ -1676,7 +1707,7 @@ var init_schema = __esm({
1676
1707
  });
1677
1708
 
1678
1709
  // src/core/config/loader.ts
1679
- import { join } from "path";
1710
+ import { join } from "node:path";
1680
1711
  function getDefaultImportMapForConfig() {
1681
1712
  return { imports: getReactImportMap(REACT_DEFAULT_VERSION) };
1682
1713
  }
@@ -2236,20 +2267,20 @@ var init_filesystem_adapter = __esm({
2236
2267
  });
2237
2268
 
2238
2269
  // src/platform/adapters/node/environment-adapter.ts
2239
- import process3 from "node:process";
2270
+ import process2 from "node:process";
2240
2271
  var NodeEnvironmentAdapter;
2241
2272
  var init_environment_adapter = __esm({
2242
2273
  "src/platform/adapters/node/environment-adapter.ts"() {
2243
2274
  "use strict";
2244
2275
  NodeEnvironmentAdapter = class {
2245
2276
  get(key) {
2246
- return process3.env[key];
2277
+ return process2.env[key];
2247
2278
  }
2248
2279
  set(key, value) {
2249
- process3.env[key] = value;
2280
+ process2.env[key] = value;
2250
2281
  }
2251
2282
  toObject() {
2252
- return { ...process3.env };
2283
+ return { ...process2.env };
2253
2284
  }
2254
2285
  };
2255
2286
  }
@@ -8044,7 +8075,9 @@ var init_registry = __esm({
8044
8075
  "Cloudflare Workers detected but requires manual initialization. Use: await runtime.set(createCloudflareAdapter(env))"
8045
8076
  );
8046
8077
  }
8047
- return "node";
8078
+ throw new Error(
8079
+ "Unsupported runtime detected. Supported runtimes: deno, node, bun. For Cloudflare Workers, call runtime.set(createCloudflareAdapter(env))."
8080
+ );
8048
8081
  }
8049
8082
  /**
8050
8083
  * Initialize the adapter
@@ -8071,7 +8104,6 @@ __export(detect_exports, {
8071
8104
  nodeAdapter: () => nodeAdapter,
8072
8105
  runtime: () => runtime
8073
8106
  });
8074
- import process4 from "node:process";
8075
8107
  function isDeno2(global) {
8076
8108
  return "Deno" in global && typeof global.Deno === "object";
8077
8109
  }
@@ -8088,7 +8120,8 @@ function detectRuntime() {
8088
8120
  if (isBun2(globalThis)) {
8089
8121
  return "bun";
8090
8122
  }
8091
- if (process4?.versions?.node) {
8123
+ const globalProcess = globalThis.process;
8124
+ if (globalProcess?.versions?.node) {
8092
8125
  return "node";
8093
8126
  }
8094
8127
  if (isCloudflare2(globalThis)) {
@@ -8619,7 +8652,7 @@ function getCacheNamespace() {
8619
8652
  // src/module-system/import-map/loader.ts
8620
8653
  init_utils();
8621
8654
  init_config();
8622
- import { dirname, join as join2 } from "path";
8655
+ import { dirname, join as join2 } from "node:path";
8623
8656
 
8624
8657
  // src/module-system/import-map/default-import-map.ts
8625
8658
  init_utils();
@@ -8690,9 +8723,9 @@ function transformImportsWithMap(code, importMap, scope, options) {
8690
8723
  }
8691
8724
 
8692
8725
  // src/build/transforms/mdx/esm-module-loader.ts
8693
- import { join as join4 } from "path";
8694
- var _global = globalThis;
8695
- var IS_NODE = typeof Deno === "undefined" && typeof _global.process !== "undefined" && _global.process?.versions?.node;
8726
+ init_runtime();
8727
+ init_process();
8728
+ import { join as join4 } from "node:path";
8696
8729
  var LOG_PREFIX_MDX_LOADER = "[mdx-loader]";
8697
8730
  var LOG_PREFIX_MDX_RENDERER = "[mdx-renderer]";
8698
8731
  var JSX_IMPORT_PATTERN = /import\s+([^'"]+)\s+from\s+['"]file:\/\/([^'"]+\.(jsx|tsx))['"];?/g;
@@ -8775,9 +8808,9 @@ async function loadModuleESM(compiledProgramCode, context) {
8775
8808
  const { getAdapter: getAdapter2 } = await Promise.resolve().then(() => (init_detect(), detect_exports));
8776
8809
  const adapter = await getAdapter2();
8777
8810
  if (!context.esmCacheDir) {
8778
- if (IS_NODE) {
8811
+ if (isNode) {
8779
8812
  const projectCacheDir = join4(
8780
- _global.process.cwd(),
8813
+ cwd(),
8781
8814
  "node_modules",
8782
8815
  ".cache",
8783
8816
  "veryfront-mdx"
@@ -8789,7 +8822,7 @@ async function loadModuleESM(compiledProgramCode, context) {
8789
8822
  }
8790
8823
  }
8791
8824
  let rewritten;
8792
- if (IS_NODE) {
8825
+ if (isNode) {
8793
8826
  rewritten = compiledProgramCode;
8794
8827
  } else {
8795
8828
  rewritten = transformImportsWithMap(
@@ -8844,7 +8877,7 @@ ${transformed}`;
8844
8877
  if (/\bconst\s+MDXLayout\b/.test(rewritten) && !/export\s+\{[^}]*MDXLayout/.test(rewritten)) {
8845
8878
  rewritten += "\nexport { MDXLayout as __vfLayout };\n";
8846
8879
  }
8847
- if (IS_NODE && HTTP_IMPORT_PATTERN.test(rewritten)) {
8880
+ if (isNode && HTTP_IMPORT_PATTERN.test(rewritten)) {
8848
8881
  rendererLogger.info(`${LOG_PREFIX_MDX_LOADER} Bundling HTTP imports via esbuild for Node.js`);
8849
8882
  const { build } = await import("esbuild/mod.js");
8850
8883
  const tempSourcePath = join4(context.esmCacheDir, `temp-${hashString(rewritten)}.mjs`);