veryfront 0.0.17 → 0.0.21

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
@@ -329,7 +329,6 @@ var init_cdn = __esm({
329
329
  var HASH_SEED_DJB2, HASH_SEED_FNV1A;
330
330
  var init_hash = __esm({
331
331
  "src/core/utils/constants/hash.ts"() {
332
- "use strict";
333
332
  HASH_SEED_DJB2 = 5381;
334
333
  HASH_SEED_FNV1A = 2166136261;
335
334
  }
@@ -339,7 +338,6 @@ var init_hash = __esm({
339
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;
340
339
  var init_http = __esm({
341
340
  "src/core/utils/constants/http.ts"() {
342
- "use strict";
343
341
  init_cache();
344
342
  KB_IN_BYTES = 1024;
345
343
  HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;
@@ -524,16 +522,8 @@ var init_deno = __esm({
524
522
  "deno.json"() {
525
523
  deno_default = {
526
524
  name: "veryfront",
527
- version: "0.0.17",
525
+ version: "0.0.21",
528
526
  nodeModulesDir: "auto",
529
- workspace: [
530
- "./examples/async-worker-redis",
531
- "./examples/knowledge-base",
532
- "./examples/form-handling",
533
- "./examples/middleware-demo",
534
- "./examples/coding-agent",
535
- "./examples/durable-workflows"
536
- ],
537
527
  exports: {
538
528
  ".": "./src/index.ts",
539
529
  "./cli": "./src/cli/main.ts",
@@ -625,8 +615,8 @@ var init_deno = __esm({
625
615
  hast: "https://esm.sh/@types/hast@3.0.3",
626
616
  unist: "https://esm.sh/@types/unist@3.0.2",
627
617
  unified: "https://esm.sh/unified@11.0.5?dts",
628
- ai: "https://esm.sh/ai@5.0.76",
629
- "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59",
618
+ ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",
619
+ "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
630
620
  "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",
631
621
  "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",
632
622
  unocss: "https://esm.sh/unocss@0.59.0",
@@ -664,7 +654,7 @@ var init_deno = __esm({
664
654
  "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
655
  "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",
666
656
  "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",
667
- lint: "deno lint src/",
657
+ lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",
668
658
  fmt: "deno fmt src/",
669
659
  typecheck: "deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts",
670
660
  "docs:check-links": "deno run -A scripts/check-doc-links.ts",
@@ -719,13 +709,41 @@ var init_deno = __esm({
719
709
  }
720
710
  });
721
711
 
712
+ // src/platform/compat/runtime.ts
713
+ var isDeno, isNode, isBun, isCloudflare;
714
+ var init_runtime = __esm({
715
+ "src/platform/compat/runtime.ts"() {
716
+ "use strict";
717
+ isDeno = typeof Deno !== "undefined";
718
+ isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
719
+ isBun = typeof globalThis.Bun !== "undefined";
720
+ isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
721
+ }
722
+ });
723
+
724
+ // src/platform/compat/process.ts
725
+ import process2 from "node:process";
726
+ function getEnv(key) {
727
+ if (isDeno) {
728
+ return process2.env(key);
729
+ }
730
+ return process2.env[key];
731
+ }
732
+ var init_process = __esm({
733
+ "src/platform/compat/process.ts"() {
734
+ "use strict";
735
+ init_runtime();
736
+ }
737
+ });
738
+
722
739
  // src/core/utils/version.ts
723
740
  var VERSION;
724
741
  var init_version = __esm({
725
742
  "src/core/utils/version.ts"() {
726
743
  "use strict";
727
744
  init_deno();
728
- VERSION = typeof deno_default.version === "string" ? deno_default.version : "0.0.0";
745
+ init_process();
746
+ VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");
729
747
  }
730
748
  });
731
749
 
@@ -914,6 +932,7 @@ function fromBase64Url(encoded) {
914
932
  }
915
933
  var init_path_utils = __esm({
916
934
  "src/core/utils/path-utils.ts"() {
935
+ "use strict";
917
936
  init_logger();
918
937
  }
919
938
  });
@@ -1235,33 +1254,6 @@ var init_bundle_manifest_init = __esm({
1235
1254
  }
1236
1255
  });
1237
1256
 
1238
- // src/platform/compat/runtime.ts
1239
- var isDeno, isNode, isBun, isCloudflare;
1240
- var init_runtime = __esm({
1241
- "src/platform/compat/runtime.ts"() {
1242
- "use strict";
1243
- isDeno = typeof Deno !== "undefined";
1244
- isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
1245
- isBun = typeof globalThis.Bun !== "undefined";
1246
- isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
1247
- }
1248
- });
1249
-
1250
- // src/platform/compat/process.ts
1251
- import process2 from "node:process";
1252
- function getEnv(key) {
1253
- if (isDeno) {
1254
- return process2.env(key);
1255
- }
1256
- return process2.env[key];
1257
- }
1258
- var init_process = __esm({
1259
- "src/platform/compat/process.ts"() {
1260
- "use strict";
1261
- init_runtime();
1262
- }
1263
- });
1264
-
1265
1257
  // src/core/utils/feature-flags.ts
1266
1258
  function isRSCEnabled(config) {
1267
1259
  if (config?.experimental?.rsc !== void 0) {
@@ -1829,6 +1821,9 @@ var init_deno2 = __esm({
1829
1821
  async readFile(path) {
1830
1822
  return await Deno.readTextFile(path);
1831
1823
  }
1824
+ async readFileBytes(path) {
1825
+ return await Deno.readFile(path);
1826
+ }
1832
1827
  async writeFile(path, content) {
1833
1828
  await Deno.writeTextFile(path, content);
1834
1829
  }
@@ -2156,6 +2151,11 @@ var init_filesystem_adapter = __esm({
2156
2151
  const fs = await import("node:fs/promises");
2157
2152
  return await fs.readFile(path, "utf-8");
2158
2153
  }
2154
+ async readFileBytes(path) {
2155
+ const fs = await import("node:fs/promises");
2156
+ const buffer = await fs.readFile(path);
2157
+ return buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
2158
+ }
2159
2159
  async writeFile(path, content) {
2160
2160
  const fs = await import("node:fs/promises");
2161
2161
  await fs.writeFile(path, content, "utf-8");
@@ -7299,6 +7299,7 @@ __export(node_exports2, {
7299
7299
  dim: () => dim2,
7300
7300
  gray: () => gray2,
7301
7301
  green: () => green2,
7302
+ initColors: () => initColors,
7302
7303
  italic: () => italic2,
7303
7304
  magenta: () => magenta2,
7304
7305
  red: () => red2,
@@ -7308,41 +7309,53 @@ __export(node_exports2, {
7308
7309
  white: () => white2,
7309
7310
  yellow: () => yellow2
7310
7311
  });
7311
- import pc from "picocolors";
7312
- var colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;
7312
+ async function ensurePc() {
7313
+ if (pc)
7314
+ return pc;
7315
+ const picocolorsModule = ["npm:", "picocolors"].join("");
7316
+ const mod = await import(picocolorsModule);
7317
+ pc = mod.default;
7318
+ return pc;
7319
+ }
7320
+ async function initColors() {
7321
+ await ensurePc();
7322
+ }
7323
+ var pc, lazyColor, colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;
7313
7324
  var init_node3 = __esm({
7314
7325
  "src/platform/compat/console/node.ts"() {
7315
7326
  "use strict";
7327
+ pc = null;
7328
+ lazyColor = (fn) => (s) => pc?.[fn]?.(s) ?? s;
7316
7329
  colors2 = {
7317
- red: pc.red,
7318
- green: pc.green,
7319
- yellow: pc.yellow,
7320
- blue: pc.blue,
7321
- cyan: pc.cyan,
7322
- magenta: pc.magenta,
7323
- white: pc.white,
7324
- gray: pc.gray,
7325
- bold: pc.bold,
7326
- dim: pc.dim,
7327
- italic: pc.italic,
7328
- underline: pc.underline,
7329
- strikethrough: pc.strikethrough,
7330
- reset: (text2) => pc.reset(text2)
7330
+ red: lazyColor("red"),
7331
+ green: lazyColor("green"),
7332
+ yellow: lazyColor("yellow"),
7333
+ blue: lazyColor("blue"),
7334
+ cyan: lazyColor("cyan"),
7335
+ magenta: lazyColor("magenta"),
7336
+ white: lazyColor("white"),
7337
+ gray: lazyColor("gray"),
7338
+ bold: lazyColor("bold"),
7339
+ dim: lazyColor("dim"),
7340
+ italic: lazyColor("italic"),
7341
+ underline: lazyColor("underline"),
7342
+ strikethrough: lazyColor("strikethrough"),
7343
+ reset: lazyColor("reset")
7331
7344
  };
7332
- red2 = pc.red;
7333
- green2 = pc.green;
7334
- yellow2 = pc.yellow;
7335
- blue2 = pc.blue;
7336
- cyan2 = pc.cyan;
7337
- magenta2 = pc.magenta;
7338
- white2 = pc.white;
7339
- gray2 = pc.gray;
7340
- bold2 = pc.bold;
7341
- dim2 = pc.dim;
7342
- italic2 = pc.italic;
7343
- underline2 = pc.underline;
7344
- strikethrough2 = pc.strikethrough;
7345
- reset2 = (text2) => pc.reset(text2);
7345
+ red2 = lazyColor("red");
7346
+ green2 = lazyColor("green");
7347
+ yellow2 = lazyColor("yellow");
7348
+ blue2 = lazyColor("blue");
7349
+ cyan2 = lazyColor("cyan");
7350
+ magenta2 = lazyColor("magenta");
7351
+ white2 = lazyColor("white");
7352
+ gray2 = lazyColor("gray");
7353
+ bold2 = lazyColor("bold");
7354
+ dim2 = lazyColor("dim");
7355
+ italic2 = lazyColor("italic");
7356
+ underline2 = lazyColor("underline");
7357
+ strikethrough2 = lazyColor("strikethrough");
7358
+ reset2 = lazyColor("reset");
7346
7359
  }
7347
7360
  });
7348
7361
 
@@ -7456,6 +7469,11 @@ var init_filesystem_adapter2 = __esm({
7456
7469
  const file = Bun.file(path);
7457
7470
  return await file.text();
7458
7471
  }
7472
+ async readFileBytes(path) {
7473
+ const file = Bun.file(path);
7474
+ const buffer = await file.arrayBuffer();
7475
+ return new Uint8Array(buffer);
7476
+ }
7459
7477
  async writeFile(path, content) {
7460
7478
  await Bun.write(path, content);
7461
7479
  }
@@ -7833,6 +7851,16 @@ function createMockAdapter() {
7833
7851
  }
7834
7852
  return Promise.resolve(content);
7835
7853
  },
7854
+ readFileBytes: (path) => {
7855
+ const content = files.get(path);
7856
+ if (!content) {
7857
+ throw toError(createError({
7858
+ type: "file",
7859
+ message: `File not found: ${path}`
7860
+ }));
7861
+ }
7862
+ return Promise.resolve(new TextEncoder().encode(content));
7863
+ },
7836
7864
  writeFile: (path, content) => {
7837
7865
  files.set(path, content);
7838
7866
  return Promise.resolve();
@@ -8763,7 +8791,9 @@ function createHTTPPluginForMDX() {
8763
8791
  } catch (e) {
8764
8792
  clearTimeout(timeout);
8765
8793
  return {
8766
- errors: [{ text: `Failed to fetch ${args.path}: ${e instanceof Error ? e.message : String(e)}` }]
8794
+ errors: [{
8795
+ text: `Failed to fetch ${args.path}: ${e instanceof Error ? e.message : String(e)}`
8796
+ }]
8767
8797
  };
8768
8798
  }
8769
8799
  });
@@ -8776,7 +8806,12 @@ async function loadModuleESM(compiledProgramCode, context) {
8776
8806
  const adapter = await getAdapter2();
8777
8807
  if (!context.esmCacheDir) {
8778
8808
  if (IS_NODE) {
8779
- const projectCacheDir = join4(_global.process.cwd(), "node_modules", ".cache", "veryfront-mdx");
8809
+ const projectCacheDir = join4(
8810
+ _global.process.cwd(),
8811
+ "node_modules",
8812
+ ".cache",
8813
+ "veryfront-mdx"
8814
+ );
8780
8815
  await adapter.fs.mkdir(projectCacheDir, { recursive: true });
8781
8816
  context.esmCacheDir = projectCacheDir;
8782
8817
  } else {
@@ -8862,7 +8897,10 @@ ${transformed}`;
8862
8897
  rendererLogger.info(`${LOG_PREFIX_MDX_LOADER} Successfully bundled HTTP imports`);
8863
8898
  }
8864
8899
  } catch (bundleError) {
8865
- rendererLogger.warn(`${LOG_PREFIX_MDX_LOADER} Failed to bundle HTTP imports, falling back to original code`, bundleError);
8900
+ rendererLogger.warn(
8901
+ `${LOG_PREFIX_MDX_LOADER} Failed to bundle HTTP imports, falling back to original code`,
8902
+ bundleError
8903
+ );
8866
8904
  } finally {
8867
8905
  try {
8868
8906
  const fsAny = adapter.fs;
@@ -9405,13 +9443,11 @@ init_utils();
9405
9443
  // src/platform/compat/path-helper.ts
9406
9444
  import nodePath from "node:path";
9407
9445
  var pathMod = null;
9408
- var denoPathPromise = null;
9409
9446
  if (typeof Deno === "undefined") {
9410
9447
  pathMod = nodePath;
9411
9448
  } else {
9412
- denoPathPromise = import("path").then((mod) => {
9449
+ import("path").then((mod) => {
9413
9450
  pathMod = mod;
9414
- return pathMod;
9415
9451
  });
9416
9452
  }
9417
9453
  var sep = nodePath.sep;
@@ -9813,12 +9849,15 @@ var TracingManager = class {
9813
9849
  }
9814
9850
  }
9815
9851
  async initializeTracer(config) {
9816
- const api = await import("@opentelemetry/api");
9852
+ const otelApiModule = ["npm:@opentelemetry/", "api@1"].join("");
9853
+ const api = await import(otelApiModule);
9817
9854
  this.state.api = api;
9818
9855
  this.state.tracer = api.trace.getTracer(config.serviceName || "veryfront", "0.1.0");
9819
- const { W3CTraceContextPropagator } = await import("@opentelemetry/core");
9820
- this.state.propagator = new W3CTraceContextPropagator();
9821
- api.propagation.setGlobalPropagator(this.state.propagator);
9856
+ const otelCoreModule = ["npm:@opentelemetry/", "core@1"].join("");
9857
+ const { W3CTraceContextPropagator } = await import(otelCoreModule);
9858
+ const propagator = new W3CTraceContextPropagator();
9859
+ this.state.propagator = propagator;
9860
+ api.propagation.setGlobalPropagator(propagator);
9822
9861
  if (this.state.api && this.state.tracer) {
9823
9862
  this.spanOps = new SpanOperations(this.state.api, this.state.tracer);
9824
9863
  }
@@ -11148,7 +11187,9 @@ var ResponseBuilder = class {
11148
11187
  this.stream = stream;
11149
11188
  }
11150
11189
  };
11151
- setResponseBuilderClass(ResponseBuilder);
11190
+ setResponseBuilderClass(
11191
+ ResponseBuilder
11192
+ );
11152
11193
 
11153
11194
  // src/security/http/base-handler.ts
11154
11195
  init_utils();