veryfront 0.0.5 → 0.0.7

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.
@@ -0,0 +1,33 @@
1
+ // Component type definitions
2
+ import type { ReactNode, HTMLAttributes, AnchorHTMLAttributes, ScriptHTMLAttributes, ImgHTMLAttributes } from 'react';
3
+
4
+ export interface HeadProps {
5
+ children?: ReactNode;
6
+ }
7
+
8
+ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ href: string;
10
+ prefetch?: boolean;
11
+ replace?: boolean;
12
+ scroll?: boolean;
13
+ children?: ReactNode;
14
+ }
15
+
16
+ export interface ScriptProps extends ScriptHTMLAttributes<HTMLScriptElement> {
17
+ src?: string;
18
+ strategy?: 'beforeInteractive' | 'afterInteractive' | 'lazyOnload';
19
+ }
20
+
21
+ export interface ImageProps extends ImgHTMLAttributes<HTMLImageElement> {
22
+ src: string;
23
+ alt: string;
24
+ width?: number;
25
+ height?: number;
26
+ priority?: boolean;
27
+ placeholder?: 'blur' | 'empty';
28
+ }
29
+
30
+ export declare function Head(props: HeadProps): JSX.Element;
31
+ export declare function Link(props: LinkProps): JSX.Element;
32
+ export declare function Script(props: ScriptProps): JSX.Element;
33
+ export declare function Image(props: ImageProps): JSX.Element;
@@ -65,8 +65,7 @@ function getEnvironmentVariable(name) {
65
65
  const value = globalThis.process?.env[name];
66
66
  return value === "" ? void 0 : value;
67
67
  }
68
- } catch (error) {
69
- console.debug(`Failed to get environment variable ${name}:`, error);
68
+ } catch {
70
69
  return void 0;
71
70
  }
72
71
  return void 0;
@@ -185,10 +184,10 @@ var init_logger = __esm({
185
184
  const end = performance.now();
186
185
  this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);
187
186
  return result;
188
- } catch (_error) {
187
+ } catch (error) {
189
188
  const end = performance.now();
190
- this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, _error);
191
- throw _error;
189
+ this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error);
190
+ throw error;
192
191
  }
193
192
  }
194
193
  };
@@ -245,19 +244,19 @@ var init_cache = __esm({
245
244
  MS_PER_SECOND = 1e3;
246
245
  DEFAULT_LRU_MAX_ENTRIES = 100;
247
246
  COMPONENT_LOADER_MAX_ENTRIES = 100;
248
- COMPONENT_LOADER_TTL_MS = 10 * MINUTES_PER_HOUR * MS_PER_SECOND;
247
+ COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;
249
248
  MDX_RENDERER_MAX_ENTRIES = 200;
250
- MDX_RENDERER_TTL_MS = 10 * MINUTES_PER_HOUR * MS_PER_SECOND;
249
+ MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;
251
250
  RENDERER_CORE_MAX_ENTRIES = 100;
252
- RENDERER_CORE_TTL_MS = 5 * MINUTES_PER_HOUR * MS_PER_SECOND;
251
+ RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;
253
252
  TSX_LAYOUT_MAX_ENTRIES = 50;
254
- TSX_LAYOUT_TTL_MS = 10 * MINUTES_PER_HOUR * MS_PER_SECOND;
253
+ TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;
255
254
  DATA_FETCHING_MAX_ENTRIES = 200;
256
- DATA_FETCHING_TTL_MS = 10 * MINUTES_PER_HOUR * MS_PER_SECOND;
255
+ DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;
257
256
  MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;
258
- MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * MINUTES_PER_HOUR * MS_PER_SECOND;
257
+ MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;
259
258
  BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;
260
- BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * MINUTES_PER_HOUR * MS_PER_SECOND;
259
+ BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;
261
260
  BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;
262
261
  BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;
263
262
  RSC_MANIFEST_CACHE_TTL_MS = 5e3;
@@ -526,7 +525,7 @@ var init_deno = __esm({
526
525
  "deno.json"() {
527
526
  deno_default = {
528
527
  name: "veryfront",
529
- version: "0.1.0",
528
+ version: "0.0.7",
530
529
  nodeModulesDir: "auto",
531
530
  workspace: [
532
531
  "./examples/async-worker-redis",
@@ -5836,11 +5835,15 @@ async function createNodeServer(handler, options = {}) {
5836
5835
  headersRecord[key] = value[0] || "";
5837
5836
  }
5838
5837
  }
5839
- const request = new Request(url.toString(), {
5838
+ const requestInit = {
5840
5839
  method: _req.method,
5841
5840
  headers: headersRecord,
5842
5841
  body
5843
- });
5842
+ };
5843
+ if (body !== null) {
5844
+ requestInit.duplex = "half";
5845
+ }
5846
+ const request = new Request(url.toString(), requestInit);
5844
5847
  const response = await handler(request);
5845
5848
  if (response.status === 101) {
5846
5849
  return;
@@ -7205,7 +7208,6 @@ var init_deno3 = __esm({
7205
7208
  "use strict";
7206
7209
  init_ansi();
7207
7210
  colors = {
7208
- // Basic colors
7209
7211
  red,
7210
7212
  green,
7211
7213
  yellow,
@@ -7214,13 +7216,11 @@ var init_deno3 = __esm({
7214
7216
  magenta,
7215
7217
  white,
7216
7218
  gray,
7217
- // Text modifiers
7218
7219
  bold,
7219
7220
  dim,
7220
7221
  italic,
7221
7222
  underline,
7222
7223
  strikethrough,
7223
- // Utility
7224
7224
  reset
7225
7225
  };
7226
7226
  }
@@ -7251,7 +7251,6 @@ var init_node3 = __esm({
7251
7251
  "src/platform/compat/console/node.ts"() {
7252
7252
  "use strict";
7253
7253
  colors2 = {
7254
- // Basic colors
7255
7254
  red: pc.red,
7256
7255
  green: pc.green,
7257
7256
  yellow: pc.yellow,
@@ -7260,13 +7259,11 @@ var init_node3 = __esm({
7260
7259
  magenta: pc.magenta,
7261
7260
  white: pc.white,
7262
7261
  gray: pc.gray,
7263
- // Text modifiers
7264
7262
  bold: pc.bold,
7265
7263
  dim: pc.dim,
7266
7264
  italic: pc.italic,
7267
7265
  underline: pc.underline,
7268
7266
  strikethrough: pc.strikethrough,
7269
- // Utility - picocolors doesn't have reset, so we implement it
7270
7267
  reset: (text) => pc.reset(text)
7271
7268
  };
7272
7269
  red2 = pc.red;
@@ -7348,10 +7345,9 @@ var init_error_formatter = __esm({
7348
7345
 
7349
7346
  // src/platform/compat/process.ts
7350
7347
  import process3 from "node:process";
7351
- var IS_DENO;
7352
7348
  var init_process = __esm({
7353
7349
  "src/platform/compat/process.ts"() {
7354
- IS_DENO = typeof Deno !== "undefined" && "Deno" in globalThis;
7350
+ init_runtime();
7355
7351
  }
7356
7352
  });
7357
7353
 
@@ -7771,9 +7767,7 @@ function createMockAdapter() {
7771
7767
  },
7772
7768
  fs: {
7773
7769
  files,
7774
- // Expose files Map for tests to populate
7775
7770
  directories,
7776
- // Expose directories Set for tests to track empty dirs
7777
7771
  readFile: (path) => {
7778
7772
  const content = files.get(path);
7779
7773
  if (!content) {
@@ -7797,12 +7791,7 @@ function createMockAdapter() {
7797
7791
  if (filePath.startsWith(path + "/"))
7798
7792
  return true;
7799
7793
  }
7800
- try {
7801
- await Deno.stat(path);
7802
- return true;
7803
- } catch {
7804
- return false;
7805
- }
7794
+ return false;
7806
7795
  },
7807
7796
  readDir: async function* (path) {
7808
7797
  const entries = /* @__PURE__ */ new Map();
@@ -8100,7 +8089,7 @@ var init_detect = __esm({
8100
8089
  });
8101
8090
 
8102
8091
  // src/react/components/LayoutComponent.tsx
8103
- import { useMemo } from "react";
8092
+ import { useMemo, useRef } from "react";
8104
8093
 
8105
8094
  // src/build/transforms/mdx/index.ts
8106
8095
  init_utils();
@@ -8553,7 +8542,7 @@ function shouldDisableInterval() {
8553
8542
  }
8554
8543
  try {
8555
8544
  return process.env("VF_DISABLE_LRU_INTERVAL") === "1";
8556
- } catch (_error) {
8545
+ } catch {
8557
8546
  return false;
8558
8547
  }
8559
8548
  }
@@ -8581,11 +8570,6 @@ import { dirname, join as join2 } from "path";
8581
8570
  // src/module-system/import-map/default-import-map.ts
8582
8571
  init_utils();
8583
8572
  function getDefaultImportMap() {
8584
- const _versionMap = {
8585
- 17: REACT_VERSION_17,
8586
- 18: REACT_DEFAULT_VERSION,
8587
- 19: REACT_VERSION_19
8588
- };
8589
8573
  const reactVersion = REACT_DEFAULT_VERSION;
8590
8574
  const importMap = getReactImportMap(reactVersion);
8591
8575
  importMap["react/"] = `https://esm.sh/react@${reactVersion}/`;
@@ -8620,7 +8604,7 @@ function resolveImport(specifier, importMap, scope) {
8620
8604
  function transformImportsWithMap(code, importMap, scope, options) {
8621
8605
  let transformedCode = code;
8622
8606
  transformedCode = transformedCode.replace(
8623
- /((?:import|export)\s+(?:[\w,{ /* empty */ }\s*]+\s+from\s+)?|export\s+(?:\*|\{[^}]+\})\s+from\s+)["']([^"']+)["']/g,
8607
+ /((?:import|export)\s+(?:[\w,{}\s*]+\s+from\s+)?|export\s+(?:\*|\{[^}]+\})\s+from\s+)["']([^"']+)["']/g,
8624
8608
  (_match, prefix, specifier) => {
8625
8609
  const isBare = !specifier.startsWith("http") && !specifier.startsWith("/") && !specifier.startsWith(".");
8626
8610
  if (isBare && !options?.resolveBare) {
@@ -9060,19 +9044,29 @@ var mdxRenderer = new Proxy({}, {
9060
9044
  // src/react/components/LayoutComponent.tsx
9061
9045
  init_utils();
9062
9046
  import { Fragment, jsx } from "react/jsx-runtime";
9047
+ function useStableObject(obj) {
9048
+ const ref = useRef(obj);
9049
+ const serialized = JSON.stringify(obj);
9050
+ const prevSerialized = useRef(serialized);
9051
+ if (prevSerialized.current !== serialized) {
9052
+ ref.current = obj;
9053
+ prevSerialized.current = serialized;
9054
+ }
9055
+ return ref.current;
9056
+ }
9063
9057
  function LayoutComponent({
9064
9058
  mdxBundle,
9065
9059
  children,
9066
- components = {
9067
- /* empty */
9068
- },
9060
+ components = {},
9069
9061
  pageContext
9070
9062
  }) {
9063
+ const stableFrontmatter = useStableObject(mdxBundle.frontmatter);
9064
+ const stablePageContext = useStableObject(pageContext);
9071
9065
  const element = useMemo(() => {
9072
9066
  try {
9073
9067
  return mdxRenderer.render(mdxBundle.compiledCode, {
9074
9068
  components,
9075
- frontmatter: { ...mdxBundle.frontmatter || {}, pageContext },
9069
+ frontmatter: { ...stableFrontmatter || {}, pageContext: stablePageContext },
9076
9070
  globals: mdxBundle.globals,
9077
9071
  extractLayout: true,
9078
9072
  children
@@ -9083,10 +9077,11 @@ function LayoutComponent({
9083
9077
  }
9084
9078
  }, [
9085
9079
  mdxBundle.compiledCode,
9086
- JSON.stringify(mdxBundle.frontmatter),
9080
+ stableFrontmatter,
9087
9081
  components,
9088
9082
  children,
9089
- JSON.stringify(pageContext)
9083
+ stablePageContext,
9084
+ mdxBundle.globals
9090
9085
  ]);
9091
9086
  if (!element)
9092
9087
  return /* @__PURE__ */ jsx(Fragment, { children });
@@ -9094,21 +9089,30 @@ function LayoutComponent({
9094
9089
  }
9095
9090
 
9096
9091
  // src/react/components/ProviderComponent.tsx
9097
- import { useMemo as useMemo2 } from "react";
9092
+ import { useMemo as useMemo2, useRef as useRef2 } from "react";
9098
9093
  init_utils();
9099
9094
  import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
9095
+ function useStableFrontmatter(frontmatter) {
9096
+ const ref = useRef2(frontmatter);
9097
+ const serialized = JSON.stringify(frontmatter);
9098
+ const prevSerialized = useRef2(serialized);
9099
+ if (prevSerialized.current !== serialized) {
9100
+ ref.current = frontmatter;
9101
+ prevSerialized.current = serialized;
9102
+ }
9103
+ return ref.current;
9104
+ }
9100
9105
  function ProviderComponent({
9101
9106
  mdxBundle,
9102
9107
  children,
9103
- components = {
9104
- /* empty */
9105
- }
9108
+ components = {}
9106
9109
  }) {
9110
+ const stableFrontmatter = useStableFrontmatter(mdxBundle.frontmatter);
9107
9111
  const element = useMemo2(() => {
9108
9112
  try {
9109
9113
  return mdxRenderer.render(mdxBundle.compiledCode, {
9110
9114
  components,
9111
- frontmatter: mdxBundle.frontmatter,
9115
+ frontmatter: stableFrontmatter,
9112
9116
  globals: mdxBundle.globals,
9113
9117
  extractLayout: true,
9114
9118
  children
@@ -9117,7 +9121,7 @@ function ProviderComponent({
9117
9121
  rendererLogger.error("[ProviderComponent] Render failed:", error);
9118
9122
  return /* @__PURE__ */ jsx2(Fragment2, { children });
9119
9123
  }
9120
- }, [mdxBundle.compiledCode, JSON.stringify(mdxBundle.frontmatter), components, children]);
9124
+ }, [mdxBundle.compiledCode, stableFrontmatter, components, children, mdxBundle.globals]);
9121
9125
  if (!element)
9122
9126
  return /* @__PURE__ */ jsx2(Fragment2, { children });
9123
9127
  return element;
@@ -9129,9 +9133,7 @@ function AppWrapper({
9129
9133
  children,
9130
9134
  providers = [],
9131
9135
  layout,
9132
- components = {
9133
- /* empty */
9134
- },
9136
+ components = {},
9135
9137
  mode: _mode,
9136
9138
  studioEnabled: _studioEnabled,
9137
9139
  pageContext
@@ -9172,13 +9174,9 @@ function Link({ prefetch = true, children, ...rest }) {
9172
9174
  // src/react/components/MDXProvider.tsx
9173
9175
  import { createContext, useContext } from "react";
9174
9176
  import { jsx as jsx5 } from "react/jsx-runtime";
9175
- var MDXContext = createContext({
9176
- /* empty */
9177
- });
9177
+ var MDXContext = createContext({});
9178
9178
  function MDXProvider({
9179
- components = {
9180
- /* empty */
9181
- },
9179
+ components = {},
9182
9180
  children
9183
9181
  }) {
9184
9182
  return /* @__PURE__ */ jsx5(MDXContext.Provider, { value: components, children });
@@ -9324,10 +9322,7 @@ function OptimizedBackgroundImage({
9324
9322
  backgroundRepeat: "no-repeat",
9325
9323
  ...style
9326
9324
  };
9327
- return (
9328
- // @ts-ignore - csstype version conflict between dependencies
9329
- /* @__PURE__ */ jsx8("div", { className, style: bgStyle, children })
9330
- );
9325
+ return /* @__PURE__ */ jsx8("div", { className, style: bgStyle, children });
9331
9326
  }
9332
9327
 
9333
9328
  // src/react/components/optimized-image/useOptimizedImage.ts
@@ -9387,10 +9382,7 @@ function ResponsiveImageContainer({
9387
9382
  width: "100%",
9388
9383
  height: "100%"
9389
9384
  };
9390
- return (
9391
- // @ts-ignore - csstype version conflict between dependencies
9392
- /* @__PURE__ */ jsx9("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx9("div", { style: contentStyle, children }) })
9393
- );
9385
+ return /* @__PURE__ */ jsx9("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx9("div", { style: contentStyle, children }) });
9394
9386
  }
9395
9387
  export {
9396
9388
  AppWrapper,