veryfront 0.0.16 → 0.0.19

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,6 +131,7 @@ 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";
134
135
  init_env();
135
136
  LogLevel = /* @__PURE__ */ ((LogLevel2) => {
136
137
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
@@ -309,6 +310,7 @@ function getUnoCSSTailwindResetUrl() {
309
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;
310
311
  var init_cdn = __esm({
311
312
  "src/core/utils/constants/cdn.ts"() {
313
+ "use strict";
312
314
  ESM_CDN_BASE = "https://esm.sh";
313
315
  JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";
314
316
  DENO_STD_BASE = "https://deno.land";
@@ -328,6 +330,7 @@ var init_cdn = __esm({
328
330
  var HASH_SEED_DJB2, HASH_SEED_FNV1A;
329
331
  var init_hash = __esm({
330
332
  "src/core/utils/constants/hash.ts"() {
333
+ "use strict";
331
334
  HASH_SEED_DJB2 = 5381;
332
335
  HASH_SEED_FNV1A = 2166136261;
333
336
  }
@@ -337,6 +340,7 @@ var init_hash = __esm({
337
340
  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;
338
341
  var init_http = __esm({
339
342
  "src/core/utils/constants/http.ts"() {
343
+ "use strict";
340
344
  init_cache();
341
345
  KB_IN_BYTES = 1024;
342
346
  HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;
@@ -521,16 +525,8 @@ var init_deno = __esm({
521
525
  "deno.json"() {
522
526
  deno_default = {
523
527
  name: "veryfront",
524
- version: "0.0.16",
528
+ version: "0.0.19",
525
529
  nodeModulesDir: "auto",
526
- workspace: [
527
- "./examples/async-worker-redis",
528
- "./examples/knowledge-base",
529
- "./examples/form-handling",
530
- "./examples/middleware-demo",
531
- "./examples/coding-agent",
532
- "./examples/durable-workflows"
533
- ],
534
530
  exports: {
535
531
  ".": "./src/index.ts",
536
532
  "./cli": "./src/cli/main.ts",
@@ -622,8 +618,8 @@ var init_deno = __esm({
622
618
  hast: "https://esm.sh/@types/hast@3.0.3",
623
619
  unist: "https://esm.sh/@types/unist@3.0.2",
624
620
  unified: "https://esm.sh/unified@11.0.5?dts",
625
- ai: "https://esm.sh/ai@5.0.76",
626
- "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59",
621
+ ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",
622
+ "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
627
623
  "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",
628
624
  "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",
629
625
  unocss: "https://esm.sh/unocss@0.59.0",
@@ -661,7 +657,7 @@ var init_deno = __esm({
661
657
  "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",
662
658
  "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",
663
659
  "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",
664
- lint: "deno lint src/",
660
+ lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",
665
661
  fmt: "deno fmt src/",
666
662
  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",
667
663
  "docs:check-links": "deno run -A scripts/check-doc-links.ts",
@@ -716,13 +712,41 @@ var init_deno = __esm({
716
712
  }
717
713
  });
718
714
 
715
+ // src/platform/compat/runtime.ts
716
+ var isDeno, isNode, isBun, isCloudflare;
717
+ var init_runtime = __esm({
718
+ "src/platform/compat/runtime.ts"() {
719
+ "use strict";
720
+ isDeno = typeof Deno !== "undefined";
721
+ isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
722
+ isBun = typeof globalThis.Bun !== "undefined";
723
+ isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
724
+ }
725
+ });
726
+
727
+ // src/platform/compat/process.ts
728
+ import process2 from "node:process";
729
+ function getEnv(key) {
730
+ if (isDeno) {
731
+ return process2.env(key);
732
+ }
733
+ return process2.env[key];
734
+ }
735
+ var init_process = __esm({
736
+ "src/platform/compat/process.ts"() {
737
+ "use strict";
738
+ init_runtime();
739
+ }
740
+ });
741
+
719
742
  // src/core/utils/version.ts
720
743
  var VERSION;
721
744
  var init_version = __esm({
722
745
  "src/core/utils/version.ts"() {
723
746
  "use strict";
724
747
  init_deno();
725
- VERSION = typeof deno_default.version === "string" ? deno_default.version : "0.0.0";
748
+ init_process();
749
+ VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");
726
750
  }
727
751
  });
728
752
 
@@ -1233,33 +1257,6 @@ var init_bundle_manifest_init = __esm({
1233
1257
  }
1234
1258
  });
1235
1259
 
1236
- // src/platform/compat/runtime.ts
1237
- var isDeno, isNode, isBun, isCloudflare;
1238
- var init_runtime = __esm({
1239
- "src/platform/compat/runtime.ts"() {
1240
- "use strict";
1241
- isDeno = typeof Deno !== "undefined";
1242
- isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
1243
- isBun = typeof globalThis.Bun !== "undefined";
1244
- isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
1245
- }
1246
- });
1247
-
1248
- // src/platform/compat/process.ts
1249
- import process2 from "node:process";
1250
- function getEnv(key) {
1251
- if (isDeno) {
1252
- return process2.env(key);
1253
- }
1254
- return process2.env[key];
1255
- }
1256
- var init_process = __esm({
1257
- "src/platform/compat/process.ts"() {
1258
- "use strict";
1259
- init_runtime();
1260
- }
1261
- });
1262
-
1263
1260
  // src/core/utils/feature-flags.ts
1264
1261
  function isRSCEnabled(config) {
1265
1262
  if (config?.experimental?.rsc !== void 0) {
@@ -1827,6 +1824,9 @@ var init_deno2 = __esm({
1827
1824
  async readFile(path) {
1828
1825
  return await Deno.readTextFile(path);
1829
1826
  }
1827
+ async readFileBytes(path) {
1828
+ return await Deno.readFile(path);
1829
+ }
1830
1830
  async writeFile(path, content) {
1831
1831
  await Deno.writeTextFile(path, content);
1832
1832
  }
@@ -2154,6 +2154,11 @@ var init_filesystem_adapter = __esm({
2154
2154
  const fs = await import("node:fs/promises");
2155
2155
  return await fs.readFile(path, "utf-8");
2156
2156
  }
2157
+ async readFileBytes(path) {
2158
+ const fs = await import("node:fs/promises");
2159
+ const buffer = await fs.readFile(path);
2160
+ return buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
2161
+ }
2157
2162
  async writeFile(path, content) {
2158
2163
  const fs = await import("node:fs/promises");
2159
2164
  await fs.writeFile(path, content, "utf-8");
@@ -7297,6 +7302,7 @@ __export(node_exports2, {
7297
7302
  dim: () => dim2,
7298
7303
  gray: () => gray2,
7299
7304
  green: () => green2,
7305
+ initColors: () => initColors,
7300
7306
  italic: () => italic2,
7301
7307
  magenta: () => magenta2,
7302
7308
  red: () => red2,
@@ -7306,41 +7312,53 @@ __export(node_exports2, {
7306
7312
  white: () => white2,
7307
7313
  yellow: () => yellow2
7308
7314
  });
7309
- import pc from "picocolors";
7310
- var colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;
7315
+ async function ensurePc() {
7316
+ if (pc)
7317
+ return pc;
7318
+ const picocolorsModule = ["npm:", "picocolors"].join("");
7319
+ const mod = await import(picocolorsModule);
7320
+ pc = mod.default;
7321
+ return pc;
7322
+ }
7323
+ async function initColors() {
7324
+ await ensurePc();
7325
+ }
7326
+ var pc, lazyColor, colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;
7311
7327
  var init_node3 = __esm({
7312
7328
  "src/platform/compat/console/node.ts"() {
7313
7329
  "use strict";
7330
+ pc = null;
7331
+ lazyColor = (fn) => (s) => pc?.[fn]?.(s) ?? s;
7314
7332
  colors2 = {
7315
- red: pc.red,
7316
- green: pc.green,
7317
- yellow: pc.yellow,
7318
- blue: pc.blue,
7319
- cyan: pc.cyan,
7320
- magenta: pc.magenta,
7321
- white: pc.white,
7322
- gray: pc.gray,
7323
- bold: pc.bold,
7324
- dim: pc.dim,
7325
- italic: pc.italic,
7326
- underline: pc.underline,
7327
- strikethrough: pc.strikethrough,
7328
- reset: (text2) => pc.reset(text2)
7333
+ red: lazyColor("red"),
7334
+ green: lazyColor("green"),
7335
+ yellow: lazyColor("yellow"),
7336
+ blue: lazyColor("blue"),
7337
+ cyan: lazyColor("cyan"),
7338
+ magenta: lazyColor("magenta"),
7339
+ white: lazyColor("white"),
7340
+ gray: lazyColor("gray"),
7341
+ bold: lazyColor("bold"),
7342
+ dim: lazyColor("dim"),
7343
+ italic: lazyColor("italic"),
7344
+ underline: lazyColor("underline"),
7345
+ strikethrough: lazyColor("strikethrough"),
7346
+ reset: lazyColor("reset")
7329
7347
  };
7330
- red2 = pc.red;
7331
- green2 = pc.green;
7332
- yellow2 = pc.yellow;
7333
- blue2 = pc.blue;
7334
- cyan2 = pc.cyan;
7335
- magenta2 = pc.magenta;
7336
- white2 = pc.white;
7337
- gray2 = pc.gray;
7338
- bold2 = pc.bold;
7339
- dim2 = pc.dim;
7340
- italic2 = pc.italic;
7341
- underline2 = pc.underline;
7342
- strikethrough2 = pc.strikethrough;
7343
- reset2 = (text2) => pc.reset(text2);
7348
+ red2 = lazyColor("red");
7349
+ green2 = lazyColor("green");
7350
+ yellow2 = lazyColor("yellow");
7351
+ blue2 = lazyColor("blue");
7352
+ cyan2 = lazyColor("cyan");
7353
+ magenta2 = lazyColor("magenta");
7354
+ white2 = lazyColor("white");
7355
+ gray2 = lazyColor("gray");
7356
+ bold2 = lazyColor("bold");
7357
+ dim2 = lazyColor("dim");
7358
+ italic2 = lazyColor("italic");
7359
+ underline2 = lazyColor("underline");
7360
+ strikethrough2 = lazyColor("strikethrough");
7361
+ reset2 = lazyColor("reset");
7344
7362
  }
7345
7363
  });
7346
7364
 
@@ -7454,6 +7472,11 @@ var init_filesystem_adapter2 = __esm({
7454
7472
  const file = Bun.file(path);
7455
7473
  return await file.text();
7456
7474
  }
7475
+ async readFileBytes(path) {
7476
+ const file = Bun.file(path);
7477
+ const buffer = await file.arrayBuffer();
7478
+ return new Uint8Array(buffer);
7479
+ }
7457
7480
  async writeFile(path, content) {
7458
7481
  await Bun.write(path, content);
7459
7482
  }
@@ -7831,6 +7854,16 @@ function createMockAdapter() {
7831
7854
  }
7832
7855
  return Promise.resolve(content);
7833
7856
  },
7857
+ readFileBytes: (path) => {
7858
+ const content = files.get(path);
7859
+ if (!content) {
7860
+ throw toError(createError({
7861
+ type: "file",
7862
+ message: `File not found: ${path}`
7863
+ }));
7864
+ }
7865
+ return Promise.resolve(new TextEncoder().encode(content));
7866
+ },
7834
7867
  writeFile: (path, content) => {
7835
7868
  files.set(path, content);
7836
7869
  return Promise.resolve();
@@ -8761,7 +8794,9 @@ function createHTTPPluginForMDX() {
8761
8794
  } catch (e) {
8762
8795
  clearTimeout(timeout);
8763
8796
  return {
8764
- errors: [{ text: `Failed to fetch ${args.path}: ${e instanceof Error ? e.message : String(e)}` }]
8797
+ errors: [{
8798
+ text: `Failed to fetch ${args.path}: ${e instanceof Error ? e.message : String(e)}`
8799
+ }]
8765
8800
  };
8766
8801
  }
8767
8802
  });
@@ -8774,7 +8809,12 @@ async function loadModuleESM(compiledProgramCode, context) {
8774
8809
  const adapter = await getAdapter2();
8775
8810
  if (!context.esmCacheDir) {
8776
8811
  if (IS_NODE) {
8777
- const projectCacheDir = join4(_global.process.cwd(), "node_modules", ".cache", "veryfront-mdx");
8812
+ const projectCacheDir = join4(
8813
+ _global.process.cwd(),
8814
+ "node_modules",
8815
+ ".cache",
8816
+ "veryfront-mdx"
8817
+ );
8778
8818
  await adapter.fs.mkdir(projectCacheDir, { recursive: true });
8779
8819
  context.esmCacheDir = projectCacheDir;
8780
8820
  } else {
@@ -8860,7 +8900,10 @@ ${transformed}`;
8860
8900
  rendererLogger.info(`${LOG_PREFIX_MDX_LOADER} Successfully bundled HTTP imports`);
8861
8901
  }
8862
8902
  } catch (bundleError) {
8863
- rendererLogger.warn(`${LOG_PREFIX_MDX_LOADER} Failed to bundle HTTP imports, falling back to original code`, bundleError);
8903
+ rendererLogger.warn(
8904
+ `${LOG_PREFIX_MDX_LOADER} Failed to bundle HTTP imports, falling back to original code`,
8905
+ bundleError
8906
+ );
8864
8907
  } finally {
8865
8908
  try {
8866
8909
  const fsAny = adapter.fs;
@@ -9403,13 +9446,11 @@ init_utils();
9403
9446
  // src/platform/compat/path-helper.ts
9404
9447
  import nodePath from "node:path";
9405
9448
  var pathMod = null;
9406
- var denoPathPromise = null;
9407
9449
  if (typeof Deno === "undefined") {
9408
9450
  pathMod = nodePath;
9409
9451
  } else {
9410
- denoPathPromise = import("path").then((mod) => {
9452
+ import("path").then((mod) => {
9411
9453
  pathMod = mod;
9412
- return pathMod;
9413
9454
  });
9414
9455
  }
9415
9456
  var sep = nodePath.sep;
@@ -9811,12 +9852,15 @@ var TracingManager = class {
9811
9852
  }
9812
9853
  }
9813
9854
  async initializeTracer(config) {
9814
- const api = await import("@opentelemetry/api");
9855
+ const otelApiModule = ["npm:@opentelemetry/", "api@1"].join("");
9856
+ const api = await import(otelApiModule);
9815
9857
  this.state.api = api;
9816
9858
  this.state.tracer = api.trace.getTracer(config.serviceName || "veryfront", "0.1.0");
9817
- const { W3CTraceContextPropagator } = await import("@opentelemetry/core");
9818
- this.state.propagator = new W3CTraceContextPropagator();
9819
- api.propagation.setGlobalPropagator(this.state.propagator);
9859
+ const otelCoreModule = ["npm:@opentelemetry/", "core@1"].join("");
9860
+ const { W3CTraceContextPropagator } = await import(otelCoreModule);
9861
+ const propagator = new W3CTraceContextPropagator();
9862
+ this.state.propagator = propagator;
9863
+ api.propagation.setGlobalPropagator(propagator);
9820
9864
  if (this.state.api && this.state.tracer) {
9821
9865
  this.spanOps = new SpanOperations(this.state.api, this.state.tracer);
9822
9866
  }
@@ -11146,7 +11190,9 @@ var ResponseBuilder = class {
11146
11190
  this.stream = stream;
11147
11191
  }
11148
11192
  };
11149
- setResponseBuilderClass(ResponseBuilder);
11193
+ setResponseBuilderClass(
11194
+ ResponseBuilder
11195
+ );
11150
11196
 
11151
11197
  // src/security/http/base-handler.ts
11152
11198
  init_utils();