veryfront 0.1.116 → 0.1.117

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.
Files changed (30) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/modules/server/module-server.js +2 -2
  3. package/esm/src/react/components/ai/markdown.d.ts.map +1 -1
  4. package/esm/src/react/components/ai/markdown.js +7 -5
  5. package/esm/src/server/handlers/dev/files/esbuild-bundler.d.ts.map +1 -1
  6. package/esm/src/server/handlers/dev/files/esbuild-bundler.js +12 -1
  7. package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts +1 -0
  8. package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts.map +1 -1
  9. package/esm/src/server/handlers/dev/files/esbuild-plugins.js +22 -9
  10. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  11. package/esm/src/server/handlers/dev/framework-candidates.generated.js +13 -8
  12. package/esm/src/transforms/mdx/esm-module-loader/resolution/file-finder.d.ts.map +1 -1
  13. package/esm/src/transforms/mdx/esm-module-loader/resolution/file-finder.js +5 -4
  14. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts.map +1 -1
  15. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.js +5 -4
  16. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts +3 -3
  17. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +5 -5
  18. package/esm/src/utils/version-constant.d.ts +1 -1
  19. package/esm/src/utils/version-constant.js +1 -1
  20. package/package.json +1 -1
  21. package/src/deno.js +1 -1
  22. package/src/src/modules/server/module-server.ts +2 -2
  23. package/src/src/react/components/ai/markdown.tsx +21 -6
  24. package/src/src/server/handlers/dev/files/esbuild-bundler.ts +12 -1
  25. package/src/src/server/handlers/dev/files/esbuild-plugins.ts +27 -9
  26. package/src/src/server/handlers/dev/framework-candidates.generated.ts +13 -8
  27. package/src/src/transforms/mdx/esm-module-loader/resolution/file-finder.ts +5 -4
  28. package/src/src/transforms/pipeline/stages/ssr-vf-modules/constants.ts +5 -4
  29. package/src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts +5 -5
  30. package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.116",
3
+ "version": "0.1.117",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -359,9 +359,9 @@ async function findSourceFile(secureFs, projectDir, basePath) {
359
359
  basePathWithoutExt = basePathWithoutExt.slice("_vf_modules/".length);
360
360
  }
361
361
  const frameworkLookups = [
362
- // Embedded sources for compiled binaries (.src extensions)
363
- ["_veryfront/", EMBEDDED_SRC_DIR, "_veryfront-embedded", true],
364
362
  ["_veryfront/", join(FRAMEWORK_ROOT, "src"), "_veryfront", true],
363
+ // Embedded sources are a fallback for compiled binaries when src/ is unavailable.
364
+ ["_veryfront/", EMBEDDED_SRC_DIR, "_veryfront-embedded", true],
365
365
  // Fallback to projectDir for local dev/proxy setups where FRAMEWORK_ROOT may differ.
366
366
  ["_veryfront/", join(projectDir, "src"), "_veryfront-project", true],
367
367
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/ai/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,SAAS,CAAC;CAC9D;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmJD,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,aAAoB,EACpB,eAAe,GAChB,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CA+FpC"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/ai/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,SAAS,CAAC;CAC9D;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAkKD,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,aAAoB,EACpB,eAAe,GAChB,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CA+FpC"}
@@ -7,7 +7,9 @@ const ESM_REACT_MARKDOWN = "https://esm.sh/react-markdown@9.0.3?external=react&t
7
7
  const ESM_REMARK_GFM = "https://esm.sh/remark-gfm@4.0.1?target=es2022&pin=v135";
8
8
  const ESM_REHYPE_HIGHLIGHT = "https://esm.sh/rehype-highlight@7.0.2?target=es2022&pin=v135";
9
9
  const ESM_MERMAID = "https://esm.sh/mermaid@11.4.1?pin=v135";
10
- const dynamicImport = new Function("url", "return import(url)");
10
+ async function importFromUrl(url) {
11
+ return await import(url);
12
+ }
11
13
  // deno-lint-ignore no-explicit-any
12
14
  let ReactMarkdown = null;
13
15
  // deno-lint-ignore no-explicit-any
@@ -23,7 +25,7 @@ async function loadMermaid() {
23
25
  return null;
24
26
  if (mermaidModule)
25
27
  return mermaidModule;
26
- mermaidPromise ??= dynamicImport(ESM_MERMAID);
28
+ mermaidPromise ??= importFromUrl(ESM_MERMAID);
27
29
  mermaidModule = await mermaidPromise;
28
30
  mermaidModule.default.initialize({
29
31
  startOnLoad: false,
@@ -101,9 +103,9 @@ export function Markdown({ children, className, enableMermaid = true, renderCode
101
103
  async function load() {
102
104
  if (!ReactMarkdown) {
103
105
  const [rmModule, gfmModule, highlightModule] = await Promise.all([
104
- dynamicImport(ESM_REACT_MARKDOWN),
105
- dynamicImport(ESM_REMARK_GFM),
106
- dynamicImport(ESM_REHYPE_HIGHLIGHT),
106
+ importFromUrl(ESM_REACT_MARKDOWN),
107
+ importFromUrl(ESM_REMARK_GFM),
108
+ importFromUrl(ESM_REHYPE_HIGHLIGHT),
107
109
  ]);
108
110
  ReactMarkdown = rmModule.default;
109
111
  remarkGfm = gfmModule.default;
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-bundler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/esbuild-bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKrD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BnF"}
1
+ {"version":3,"file":"esbuild-bundler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/esbuild-bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMrD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuCnF"}
@@ -1,3 +1,4 @@
1
+ import { buildImportMapJson } from "../../../../html/index.js";
1
2
  import { getDirectory, getEsbuildLoader } from "../../../../utils/path-utils.js";
2
3
  import { createBareExternalPlugin, createRelativeFsPlugin } from "./esbuild-plugins.js";
3
4
  import { withSpan } from "../../../../observability/tracing/otlp-setup.js";
@@ -5,6 +6,11 @@ export function bundleDevFile(absPath, ctx) {
5
6
  return withSpan("server.dev.esbuild.bundleFile", async () => {
6
7
  const { build } = await import("esbuild");
7
8
  const src = await ctx.adapter.fs.readFile(absPath);
9
+ const importMapJson = await buildImportMapJson({
10
+ projectDir: ctx.projectDir,
11
+ config: ctx.config,
12
+ });
13
+ const importMap = JSON.parse(importMapJson);
8
14
  const { outputFiles } = await build({
9
15
  bundle: true,
10
16
  write: false,
@@ -20,7 +26,12 @@ export function bundleDevFile(absPath, ctx) {
20
26
  resolveDir: getDirectory(absPath),
21
27
  sourcefile: absPath,
22
28
  },
23
- plugins: [createRelativeFsPlugin(ctx.projectDir, ctx.adapter), createBareExternalPlugin()],
29
+ plugins: [
30
+ createRelativeFsPlugin(ctx.projectDir, ctx.adapter),
31
+ createBareExternalPlugin({
32
+ importMapImports: importMap.imports,
33
+ }),
34
+ ],
24
35
  });
25
36
  return outputFiles?.[0]?.text ?? "export default null";
26
37
  }, { "bundle.filePath": absPath, "bundle.projectSlug": ctx.projectSlug ?? "unknown" });
@@ -8,6 +8,7 @@ interface BareExternalPluginOptions {
8
8
  lockfile?: LockfileManager;
9
9
  projectDir?: string;
10
10
  strict?: boolean;
11
+ importMapImports?: Record<string, string>;
11
12
  }
12
13
  /** Create bare module external plugin that rewrites npm imports to esm.sh URLs */
13
14
  export declare function createBareExternalPlugin(options?: BareExternalPluginOptions | boolean): Plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-plugins.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/esbuild-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,MAAM,EAAe,MAAM,SAAS,CAAC;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,sCAAsC,CAAC;AAc9C,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CA6C1F;AAkBD,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA+DD,kFAAkF;AAClF,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,yBAAyB,GAAG,OAAe,GACnD,MAAM,CAoER"}
1
+ {"version":3,"file":"esbuild-plugins.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/esbuild-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,MAAM,EAAe,MAAM,SAAS,CAAC;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,sCAAsC,CAAC;AAc9C,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CA6C1F;AAkBD,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AA4ED,kFAAkF;AAClF,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,yBAAyB,GAAG,OAAe,GACnD,MAAM,CAwER"}
@@ -64,14 +64,14 @@ export function createRelativeFsPlugin(projectDir, adapter) {
64
64
  * Bare specifiers that should be kept as-is (not rewritten to esm.sh URLs).
65
65
  * These are resolved by the browser's import map injected in the HTML <head>.
66
66
  */
67
- const IMPORT_MAP_RESOLVED = new Set([
68
- "react",
69
- "react-dom",
70
- "react-dom/client",
71
- "react-dom/server",
72
- "react/jsx-runtime",
73
- "react/jsx-dev-runtime",
74
- ]);
67
+ const DEFAULT_IMPORT_MAP_IMPORTS = {
68
+ react: "",
69
+ "react-dom": "",
70
+ "react-dom/client": "",
71
+ "react-dom/server": "",
72
+ "react/jsx-runtime": "",
73
+ "react/jsx-dev-runtime": "",
74
+ };
75
75
  /** Map of common packages to their esm.sh URLs for browser imports */
76
76
  const ESM_PACKAGE_MAP = {};
77
77
  function isBareImport(path) {
@@ -83,6 +83,15 @@ function isBareImport(path) {
83
83
  function toEsmUrl(path) {
84
84
  return ESM_PACKAGE_MAP[path] ?? `https://esm.sh/${path}`;
85
85
  }
86
+ function isImportMapResolved(path, imports) {
87
+ if (Object.prototype.hasOwnProperty.call(imports, path))
88
+ return true;
89
+ for (const key of Object.keys(imports)) {
90
+ if (key.endsWith("/") && path.startsWith(key))
91
+ return true;
92
+ }
93
+ return false;
94
+ }
86
95
  function resolveAsExternalOrHttps(path, bundle) {
87
96
  if (bundle)
88
97
  return { path, namespace: "https" };
@@ -127,6 +136,10 @@ export function createBareExternalPlugin(options = false) {
127
136
  const { bundle = false, strict = false } = opts;
128
137
  const lockfile = opts.lockfile ??
129
138
  (opts.projectDir && bundle ? createLockfileManager(opts.projectDir) : null);
139
+ const importMapImports = {
140
+ ...DEFAULT_IMPORT_MAP_IMPORTS,
141
+ ...(opts.importMapImports ?? {}),
142
+ };
130
143
  return {
131
144
  name: "veryfront-bare-ext",
132
145
  setup(build) {
@@ -137,7 +150,7 @@ export function createBareExternalPlugin(options = false) {
137
150
  return undefined;
138
151
  // Keep import-map-resolved specifiers as bare externals — the browser's
139
152
  // <script type="importmap"> resolves them to the correct CDN URL.
140
- if (IMPORT_MAP_RESOLVED.has(args.path)) {
153
+ if (isImportMapResolved(args.path, importMapImports)) {
141
154
  return { path: args.path, external: true };
142
155
  }
143
156
  return resolveAsExternalOrHttps(toEsmUrl(args.path), bundle);
@@ -1 +1 @@
1
- {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EA4kKjD,CAAC"}
1
+ {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAilKjD,CAAC"}
@@ -912,6 +912,7 @@ export const FRAMEWORK_CANDIDATES = [
912
912
  "Debounced",
913
913
  "Default",
914
914
  "Default:",
915
+ "DefaultModule<T>",
915
916
  "Definitions",
916
917
  "Delete",
917
918
  "Denied",
@@ -998,7 +999,6 @@ export const FRAMEWORK_CANDIDATES = [
998
999
  "For",
999
1000
  "Format",
1000
1001
  "Framer",
1001
- "Function(",
1002
1002
  "GPT-4o",
1003
1003
  "Gemini",
1004
1004
  "GeminiLogo",
@@ -1124,6 +1124,7 @@ export const FRAMEWORK_CANDIDATES = [
1124
1124
  "Mermaid",
1125
1125
  "MermaidDiagram",
1126
1126
  "MermaidDiagram({",
1127
+ "MermaidModule",
1127
1128
  "Message",
1128
1129
  "Message(",
1129
1130
  "Message,",
@@ -1319,11 +1320,12 @@ export const FRAMEWORK_CANDIDATES = [
1319
1320
  "Previous",
1320
1321
  "Primitives",
1321
1322
  "Promise.all([",
1323
+ "Promise<MermaidModule>",
1324
+ "Promise<T>",
1322
1325
  "Promise<any",
1323
- "Promise<any>",
1324
- "Promise<any>;",
1325
1326
  "Promise<void>",
1326
1327
  "Promise<void>;",
1328
+ "Promise<{",
1327
1329
  "Property",
1328
1330
  "Props",
1329
1331
  "Provided",
@@ -1590,6 +1592,7 @@ export const FRAMEWORK_CANDIDATES = [
1590
1592
  "System",
1591
1593
  "T",
1592
1594
  "T,",
1595
+ "T;",
1593
1596
  "TABS.map((tab)",
1594
1597
  "TABS:",
1595
1598
  "TARGET_ICON_ELEMENTS);",
@@ -2658,11 +2661,6 @@ export const FRAMEWORK_CANDIDATES = [
2658
2661
  "dynamic-tool",
2659
2662
  "dynamic={isDynamicTool(tool)}",
2660
2663
  "dynamic?:",
2661
- "dynamicImport",
2662
- "dynamicImport(ESM_MERMAID);",
2663
- "dynamicImport(ESM_REACT_MARKDOWN),",
2664
- "dynamicImport(ESM_REHYPE_HIGHLIGHT),",
2665
- "dynamicImport(ESM_REMARK_GFM),",
2666
2664
  "e.dataTransfer.files.length",
2667
2665
  "e.dataTransfer.types.includes(",
2668
2666
  "e.g.",
@@ -3102,6 +3100,11 @@ export const FRAMEWORK_CANDIDATES = [
3102
3100
  "ignores",
3103
3101
  "import",
3104
3102
  "import(url)",
3103
+ "importFromUrl<DefaultModule<unknown>>(ESM_REACT_MARKDOWN),",
3104
+ "importFromUrl<DefaultModule<unknown>>(ESM_REHYPE_HIGHLIGHT),",
3105
+ "importFromUrl<DefaultModule<unknown>>(ESM_REMARK_GFM),",
3106
+ "importFromUrl<MermaidModule>(ESM_MERMAID);",
3107
+ "importFromUrl<T>(url:",
3105
3108
  "imports",
3106
3109
  "in",
3107
3110
  "index",
@@ -3124,6 +3127,7 @@ export const FRAMEWORK_CANDIDATES = [
3124
3127
  "initialContent,",
3125
3128
  "initialContent:",
3126
3129
  "initialContent={content}",
3130
+ "initialize(config:",
3127
3131
  "injected",
3128
3132
  "injection.",
3129
3133
  "inline",
@@ -4188,6 +4192,7 @@ export const FRAMEWORK_CANDIDATES = [
4188
4192
  "render",
4189
4193
  "render():",
4190
4194
  "render();",
4195
+ "render(id:",
4191
4196
  "render;",
4192
4197
  "render?:",
4193
4198
  "renderCodeBlock",
@@ -1 +1 @@
1
- {"version":3,"file":"file-finder.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/resolution/file-finder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAsC5E,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AA0BD,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,cAAc,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAkHtC;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GACjD,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAqB9E"}
1
+ {"version":3,"file":"file-finder.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/resolution/file-finder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAuC5E,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AA0BD,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,cAAc,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAkHtC;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GACjD,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAqB9E"}
@@ -21,10 +21,11 @@ const FRAMEWORK_EXTENSIONS = [
21
21
  ".jsx",
22
22
  ".js", // Regular sources for dev mode
23
23
  ];
24
- // Framework lookup directories in priority order
24
+ // Framework lookup directories in priority order.
25
+ // Prefer source files when they exist; embedded .src files are a fallback.
25
26
  const FRAMEWORK_LOOKUP_DIRS = [
26
- EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
27
27
  join(FRAMEWORK_ROOT, "src"), // Regular sources for dev mode
28
+ EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
28
29
  ];
29
30
  function decodeContent(content) {
30
31
  return typeof content === "string" ? content : new TextDecoder().decode(content);
@@ -113,8 +114,8 @@ export async function resolveModuleFile(normalizedPath, adapter, projectDir) {
113
114
  if (!isFramework)
114
115
  return null;
115
116
  // Try to resolve framework files from multiple locations:
116
- // 1. EMBEDDED_SRC_DIR (dist/framework-src) - for compiled binaries with .src extensions
117
- // 2. FRAMEWORK_ROOT/src - for development mode with regular extensions
117
+ // 1. FRAMEWORK_ROOT/src - source checkouts should prefer current source files
118
+ // 2. EMBEDDED_SRC_DIR (dist/framework-src) - fallback for compiled binaries
118
119
  const localFs = getLocalFs();
119
120
  logger.debug(`${LOG_PREFIX_MDX_LOADER} Resolving framework file`, {
120
121
  normalizedPath,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAG7C,eAAO,MAAM,UAAU,UAAiC,CAAC;AASzD,eAAO,MAAM,cAAc,QAAyB,CAAC;AAKrD,eAAO,MAAM,gBAAgB,QAAwD,CAAC;AAItF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAK3E,CAAC;AAGF,eAAO,MAAM,oBAAoB,sBAA6B,CAAC;AAG/D,eAAO,MAAM,uBAAuB,qBAA4B,CAAC;AAGjE,eAAO,MAAM,kBAAkB,qBAA4B,CAAC;AAG5D,eAAO,MAAM,iBAAiB,aAAoB,CAAC;AAGnD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CACzC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAG7C,eAAO,MAAM,UAAU,UAAiC,CAAC;AASzD,eAAO,MAAM,cAAc,QAAyB,CAAC;AAKrD,eAAO,MAAM,gBAAgB,QAAwD,CAAC;AAKtF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAK3E,CAAC;AAGF,eAAO,MAAM,oBAAoB,sBAA6B,CAAC;AAG/D,eAAO,MAAM,uBAAuB,qBAA4B,CAAC;AAGjE,eAAO,MAAM,kBAAkB,qBAA4B,CAAC;AAG5D,eAAO,MAAM,iBAAiB,aAAoB,CAAC;AAGnD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CACzC"}
@@ -18,13 +18,14 @@ export const FRAMEWORK_ROOT = RUNTIME_FRAMEWORK_ROOT;
18
18
  // These are .src files created by scripts/prepare-framework-sources.ts.
19
19
  // In compiled binaries, files are extracted to the runtime directory.
20
20
  export const EMBEDDED_SRC_DIR = join(RUNTIME_FRAMEWORK_ROOT, "dist", "framework-src");
21
- // Map of _vf_modules prefixes to framework directories
22
- // We try embedded sources first (for compiled binaries), then regular src/
21
+ // Map of _vf_modules prefixes to framework directories.
22
+ // Prefer regular src/ when present so source checkouts never serve stale
23
+ // dist/framework-src copies; compiled binaries fall back to embedded .src files.
23
24
  export const FRAMEWORK_LOOKUPS = [
24
- // Embedded sources for compiled binaries (these are .src files)
25
- ["_veryfront/", EMBEDDED_SRC_DIR],
26
25
  // Regular sources for dev mode
27
26
  ["_veryfront/", join(FRAMEWORK_ROOT, "src")],
27
+ // Embedded sources for compiled binaries (these are .src files)
28
+ ["_veryfront/", EMBEDDED_SRC_DIR],
28
29
  ];
29
30
  // Singleflight for framework module file writes to prevent race conditions
30
31
  export const frameworkWriteFlight = new Singleflight();
@@ -20,9 +20,9 @@ export declare function resolveFrameworkFile(vfModulePath: string, fs: ReturnTyp
20
20
  * Resolve a #veryfront/ import to the actual framework source file path.
21
21
  * Returns the resolved path if found, null otherwise.
22
22
  *
23
- * IMPORTANT: This function checks embedded sources FIRST (for compiled binaries),
24
- * then falls back to regular src/. This matches resolveFrameworkFile's behavior
25
- * and ensures consistent path resolution for cycle detection.
23
+ * IMPORTANT: This function prefers regular src/ when present, then falls back
24
+ * to embedded sources for compiled binaries. This matches resolveFrameworkFile's
25
+ * behavior and ensures consistent path resolution for cycle detection.
26
26
  */
27
27
  export declare function resolveVeryfrontSourcePath(specifier: string, existsFn?: (path: string) => Promise<boolean>): Promise<string | null>;
28
28
  /**
@@ -89,9 +89,9 @@ export async function resolveFrameworkFile(vfModulePath, fs, existsFn = exists)
89
89
  * Resolve a #veryfront/ import to the actual framework source file path.
90
90
  * Returns the resolved path if found, null otherwise.
91
91
  *
92
- * IMPORTANT: This function checks embedded sources FIRST (for compiled binaries),
93
- * then falls back to regular src/. This matches resolveFrameworkFile's behavior
94
- * and ensures consistent path resolution for cycle detection.
92
+ * IMPORTANT: This function prefers regular src/ when present, then falls back
93
+ * to embedded sources for compiled binaries. This matches resolveFrameworkFile's
94
+ * behavior and ensures consistent path resolution for cycle detection.
95
95
  */
96
96
  export async function resolveVeryfrontSourcePath(specifier, existsFn = exists) {
97
97
  if (!specifier.startsWith("#veryfront/"))
@@ -101,13 +101,13 @@ export async function resolveVeryfrontSourcePath(specifier, existsFn = exists) {
101
101
  return null;
102
102
  const relativePath = mappedTarget.slice("./src/".length);
103
103
  const hasExtension = /\.(tsx?|jsx?|mjs)$/.test(relativePath);
104
- // Check embedded sources first (for compiled binaries), then regular src/
104
+ // Prefer regular src/ when present, then fall back to embedded sources.
105
105
  // This order matches FRAMEWORK_LOOKUPS and resolveFrameworkFile to ensure
106
106
  // consistent path resolution across the codebase, which is critical for
107
107
  // cycle detection in transformingFiles.
108
108
  const lookupDirs = [
109
- EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
110
109
  join(FRAMEWORK_ROOT, "src"), // Regular sources for dev mode
110
+ EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
111
111
  ];
112
112
  for (const dir of lookupDirs) {
113
113
  const basePath = join(dir, relativePath);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.116";
1
+ export declare const VERSION = "0.1.117";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.116";
3
+ export const VERSION = "0.1.117";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.116",
3
+ "version": "0.1.117",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.116",
3
+ "version": "0.1.117",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -480,9 +480,9 @@ async function findSourceFile(
480
480
  }
481
481
 
482
482
  const frameworkLookups: [string, string, string, boolean][] = [
483
- // Embedded sources for compiled binaries (.src extensions)
484
- ["_veryfront/", EMBEDDED_SRC_DIR, "_veryfront-embedded", true],
485
483
  ["_veryfront/", join(FRAMEWORK_ROOT, "src"), "_veryfront", true],
484
+ // Embedded sources are a fallback for compiled binaries when src/ is unavailable.
485
+ ["_veryfront/", EMBEDDED_SRC_DIR, "_veryfront-embedded", true],
486
486
  // Fallback to projectDir for local dev/proxy setups where FRAMEWORK_ROOT may differ.
487
487
  ["_veryfront/", join(projectDir, "src"), "_veryfront-project", true],
488
488
  ];
@@ -27,7 +27,22 @@ const ESM_REMARK_GFM = "https://esm.sh/remark-gfm@4.0.1?target=es2022&pin=v135";
27
27
  const ESM_REHYPE_HIGHLIGHT = "https://esm.sh/rehype-highlight@7.0.2?target=es2022&pin=v135";
28
28
  const ESM_MERMAID = "https://esm.sh/mermaid@11.4.1?pin=v135";
29
29
 
30
- const dynamicImport = new Function("url", "return import(url)") as (url: string) => Promise<any>;
30
+ type DefaultModule<T> = { default: T };
31
+
32
+ type MermaidModule = {
33
+ default: {
34
+ initialize(config: {
35
+ startOnLoad: boolean;
36
+ theme: string;
37
+ securityLevel: string;
38
+ }): void;
39
+ render(id: string, code: string): Promise<{ svg: string }>;
40
+ };
41
+ };
42
+
43
+ async function importFromUrl<T>(url: string): Promise<T> {
44
+ return await import(url) as T;
45
+ }
31
46
 
32
47
  // deno-lint-ignore no-explicit-any
33
48
  let ReactMarkdown: any = null;
@@ -37,7 +52,7 @@ let remarkGfm: any = null;
37
52
  let rehypeHighlight: any = null;
38
53
 
39
54
  // deno-lint-ignore no-explicit-any
40
- let mermaidPromise: Promise<any> | null = null;
55
+ let mermaidPromise: Promise<MermaidModule> | null = null;
41
56
  // deno-lint-ignore no-explicit-any
42
57
  let mermaidModule: any = null;
43
58
 
@@ -45,7 +60,7 @@ async function loadMermaid(): Promise<any | null> {
45
60
  if (!isBrowserEnvironment()) return null;
46
61
  if (mermaidModule) return mermaidModule;
47
62
 
48
- mermaidPromise ??= dynamicImport(ESM_MERMAID);
63
+ mermaidPromise ??= importFromUrl<MermaidModule>(ESM_MERMAID);
49
64
  mermaidModule = await mermaidPromise;
50
65
 
51
66
  mermaidModule.default.initialize({
@@ -180,9 +195,9 @@ export function Markdown({
180
195
  async function load(): Promise<void> {
181
196
  if (!ReactMarkdown) {
182
197
  const [rmModule, gfmModule, highlightModule] = await Promise.all([
183
- dynamicImport(ESM_REACT_MARKDOWN),
184
- dynamicImport(ESM_REMARK_GFM),
185
- dynamicImport(ESM_REHYPE_HIGHLIGHT),
198
+ importFromUrl<DefaultModule<unknown>>(ESM_REACT_MARKDOWN),
199
+ importFromUrl<DefaultModule<unknown>>(ESM_REMARK_GFM),
200
+ importFromUrl<DefaultModule<unknown>>(ESM_REHYPE_HIGHLIGHT),
186
201
  ]);
187
202
 
188
203
  ReactMarkdown = rmModule.default;
@@ -1,4 +1,5 @@
1
1
  import type { HandlerContext } from "../../types.js";
2
+ import { buildImportMapJson } from "../../../../html/index.js";
2
3
  import { getDirectory, getEsbuildLoader } from "../../../../utils/path-utils.js";
3
4
  import { createBareExternalPlugin, createRelativeFsPlugin } from "./esbuild-plugins.js";
4
5
  import { withSpan } from "../../../../observability/tracing/otlp-setup.js";
@@ -9,6 +10,11 @@ export function bundleDevFile(absPath: string, ctx: HandlerContext): Promise<str
9
10
  async () => {
10
11
  const { build } = await import("esbuild");
11
12
  const src = await ctx.adapter.fs.readFile(absPath);
13
+ const importMapJson = await buildImportMapJson({
14
+ projectDir: ctx.projectDir,
15
+ config: ctx.config,
16
+ });
17
+ const importMap = JSON.parse(importMapJson) as { imports?: Record<string, string> };
12
18
 
13
19
  const { outputFiles } = await build({
14
20
  bundle: true,
@@ -25,7 +31,12 @@ export function bundleDevFile(absPath: string, ctx: HandlerContext): Promise<str
25
31
  resolveDir: getDirectory(absPath),
26
32
  sourcefile: absPath,
27
33
  },
28
- plugins: [createRelativeFsPlugin(ctx.projectDir, ctx.adapter), createBareExternalPlugin()],
34
+ plugins: [
35
+ createRelativeFsPlugin(ctx.projectDir, ctx.adapter),
36
+ createBareExternalPlugin({
37
+ importMapImports: importMap.imports,
38
+ }),
39
+ ],
29
40
  });
30
41
 
31
42
  return outputFiles?.[0]?.text ?? "export default null";
@@ -75,14 +75,14 @@ export function createRelativeFsPlugin(projectDir: string, adapter: RuntimeAdapt
75
75
  * Bare specifiers that should be kept as-is (not rewritten to esm.sh URLs).
76
76
  * These are resolved by the browser's import map injected in the HTML <head>.
77
77
  */
78
- const IMPORT_MAP_RESOLVED = new Set([
79
- "react",
80
- "react-dom",
81
- "react-dom/client",
82
- "react-dom/server",
83
- "react/jsx-runtime",
84
- "react/jsx-dev-runtime",
85
- ]);
78
+ const DEFAULT_IMPORT_MAP_IMPORTS: Record<string, string> = {
79
+ react: "",
80
+ "react-dom": "",
81
+ "react-dom/client": "",
82
+ "react-dom/server": "",
83
+ "react/jsx-runtime": "",
84
+ "react/jsx-dev-runtime": "",
85
+ };
86
86
 
87
87
  /** Map of common packages to their esm.sh URLs for browser imports */
88
88
  const ESM_PACKAGE_MAP: Record<string, string> = {};
@@ -92,6 +92,7 @@ interface BareExternalPluginOptions {
92
92
  lockfile?: LockfileManager;
93
93
  projectDir?: string;
94
94
  strict?: boolean;
95
+ importMapImports?: Record<string, string>;
95
96
  }
96
97
 
97
98
  function isBareImport(path: string): boolean {
@@ -107,6 +108,19 @@ function toEsmUrl(path: string): string {
107
108
  return ESM_PACKAGE_MAP[path] ?? `https://esm.sh/${path}`;
108
109
  }
109
110
 
111
+ function isImportMapResolved(
112
+ path: string,
113
+ imports: Record<string, string>,
114
+ ): boolean {
115
+ if (Object.prototype.hasOwnProperty.call(imports, path)) return true;
116
+
117
+ for (const key of Object.keys(imports)) {
118
+ if (key.endsWith("/") && path.startsWith(key)) return true;
119
+ }
120
+
121
+ return false;
122
+ }
123
+
110
124
  function resolveAsExternalOrHttps(
111
125
  path: string,
112
126
  bundle: boolean,
@@ -165,6 +179,10 @@ export function createBareExternalPlugin(
165
179
  const { bundle = false, strict = false } = opts;
166
180
  const lockfile = opts.lockfile ??
167
181
  (opts.projectDir && bundle ? createLockfileManager(opts.projectDir) : null);
182
+ const importMapImports = {
183
+ ...DEFAULT_IMPORT_MAP_IMPORTS,
184
+ ...(opts.importMapImports ?? {}),
185
+ };
168
186
 
169
187
  return {
170
188
  name: "veryfront-bare-ext",
@@ -175,7 +193,7 @@ export function createBareExternalPlugin(
175
193
 
176
194
  // Keep import-map-resolved specifiers as bare externals — the browser's
177
195
  // <script type="importmap"> resolves them to the correct CDN URL.
178
- if (IMPORT_MAP_RESOLVED.has(args.path)) {
196
+ if (isImportMapResolved(args.path, importMapImports)) {
179
197
  return { path: args.path, external: true };
180
198
  }
181
199
 
@@ -913,6 +913,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
913
913
  "Debounced",
914
914
  "Default",
915
915
  "Default:",
916
+ "DefaultModule<T>",
916
917
  "Definitions",
917
918
  "Delete",
918
919
  "Denied",
@@ -999,7 +1000,6 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
999
1000
  "For",
1000
1001
  "Format",
1001
1002
  "Framer",
1002
- "Function(",
1003
1003
  "GPT-4o",
1004
1004
  "Gemini",
1005
1005
  "GeminiLogo",
@@ -1125,6 +1125,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
1125
1125
  "Mermaid",
1126
1126
  "MermaidDiagram",
1127
1127
  "MermaidDiagram({",
1128
+ "MermaidModule",
1128
1129
  "Message",
1129
1130
  "Message(",
1130
1131
  "Message,",
@@ -1320,11 +1321,12 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
1320
1321
  "Previous",
1321
1322
  "Primitives",
1322
1323
  "Promise.all([",
1324
+ "Promise<MermaidModule>",
1325
+ "Promise<T>",
1323
1326
  "Promise<any",
1324
- "Promise<any>",
1325
- "Promise<any>;",
1326
1327
  "Promise<void>",
1327
1328
  "Promise<void>;",
1329
+ "Promise<{",
1328
1330
  "Property",
1329
1331
  "Props",
1330
1332
  "Provided",
@@ -1591,6 +1593,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
1591
1593
  "System",
1592
1594
  "T",
1593
1595
  "T,",
1596
+ "T;",
1594
1597
  "TABS.map((tab)",
1595
1598
  "TABS:",
1596
1599
  "TARGET_ICON_ELEMENTS);",
@@ -2659,11 +2662,6 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
2659
2662
  "dynamic-tool",
2660
2663
  "dynamic={isDynamicTool(tool)}",
2661
2664
  "dynamic?:",
2662
- "dynamicImport",
2663
- "dynamicImport(ESM_MERMAID);",
2664
- "dynamicImport(ESM_REACT_MARKDOWN),",
2665
- "dynamicImport(ESM_REHYPE_HIGHLIGHT),",
2666
- "dynamicImport(ESM_REMARK_GFM),",
2667
2665
  "e.dataTransfer.files.length",
2668
2666
  "e.dataTransfer.types.includes(",
2669
2667
  "e.g.",
@@ -3103,6 +3101,11 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
3103
3101
  "ignores",
3104
3102
  "import",
3105
3103
  "import(url)",
3104
+ "importFromUrl<DefaultModule<unknown>>(ESM_REACT_MARKDOWN),",
3105
+ "importFromUrl<DefaultModule<unknown>>(ESM_REHYPE_HIGHLIGHT),",
3106
+ "importFromUrl<DefaultModule<unknown>>(ESM_REMARK_GFM),",
3107
+ "importFromUrl<MermaidModule>(ESM_MERMAID);",
3108
+ "importFromUrl<T>(url:",
3106
3109
  "imports",
3107
3110
  "in",
3108
3111
  "index",
@@ -3125,6 +3128,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
3125
3128
  "initialContent,",
3126
3129
  "initialContent:",
3127
3130
  "initialContent={content}",
3131
+ "initialize(config:",
3128
3132
  "injected",
3129
3133
  "injection.",
3130
3134
  "inline",
@@ -4189,6 +4193,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
4189
4193
  "render",
4190
4194
  "render():",
4191
4195
  "render();",
4196
+ "render(id:",
4192
4197
  "render;",
4193
4198
  "render?:",
4194
4199
  "renderCodeBlock",
@@ -32,10 +32,11 @@ const FRAMEWORK_EXTENSIONS = [
32
32
  ".js", // Regular sources for dev mode
33
33
  ];
34
34
 
35
- // Framework lookup directories in priority order
35
+ // Framework lookup directories in priority order.
36
+ // Prefer source files when they exist; embedded .src files are a fallback.
36
37
  const FRAMEWORK_LOOKUP_DIRS = [
37
- EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
38
38
  join(FRAMEWORK_ROOT, "src"), // Regular sources for dev mode
39
+ EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
39
40
  ];
40
41
 
41
42
  export interface FileResolutionResult {
@@ -145,8 +146,8 @@ export async function resolveModuleFile(
145
146
  if (!isFramework) return null;
146
147
 
147
148
  // Try to resolve framework files from multiple locations:
148
- // 1. EMBEDDED_SRC_DIR (dist/framework-src) - for compiled binaries with .src extensions
149
- // 2. FRAMEWORK_ROOT/src - for development mode with regular extensions
149
+ // 1. FRAMEWORK_ROOT/src - source checkouts should prefer current source files
150
+ // 2. EMBEDDED_SRC_DIR (dist/framework-src) - fallback for compiled binaries
150
151
  const localFs = getLocalFs();
151
152
 
152
153
  logger.debug(`${LOG_PREFIX_MDX_LOADER} Resolving framework file`, {
@@ -26,13 +26,14 @@ export const FRAMEWORK_ROOT = RUNTIME_FRAMEWORK_ROOT;
26
26
  // In compiled binaries, files are extracted to the runtime directory.
27
27
  export const EMBEDDED_SRC_DIR = join(RUNTIME_FRAMEWORK_ROOT, "dist", "framework-src");
28
28
 
29
- // Map of _vf_modules prefixes to framework directories
30
- // We try embedded sources first (for compiled binaries), then regular src/
29
+ // Map of _vf_modules prefixes to framework directories.
30
+ // Prefer regular src/ when present so source checkouts never serve stale
31
+ // dist/framework-src copies; compiled binaries fall back to embedded .src files.
31
32
  export const FRAMEWORK_LOOKUPS: Array<[prefix: string, frameworkDir: string]> = [
32
- // Embedded sources for compiled binaries (these are .src files)
33
- ["_veryfront/", EMBEDDED_SRC_DIR],
34
33
  // Regular sources for dev mode
35
34
  ["_veryfront/", join(FRAMEWORK_ROOT, "src")],
35
+ // Embedded sources for compiled binaries (these are .src files)
36
+ ["_veryfront/", EMBEDDED_SRC_DIR],
36
37
  ];
37
38
 
38
39
  // Singleflight for framework module file writes to prevent race conditions
@@ -116,9 +116,9 @@ export async function resolveFrameworkFile(
116
116
  * Resolve a #veryfront/ import to the actual framework source file path.
117
117
  * Returns the resolved path if found, null otherwise.
118
118
  *
119
- * IMPORTANT: This function checks embedded sources FIRST (for compiled binaries),
120
- * then falls back to regular src/. This matches resolveFrameworkFile's behavior
121
- * and ensures consistent path resolution for cycle detection.
119
+ * IMPORTANT: This function prefers regular src/ when present, then falls back
120
+ * to embedded sources for compiled binaries. This matches resolveFrameworkFile's
121
+ * behavior and ensures consistent path resolution for cycle detection.
122
122
  */
123
123
  export async function resolveVeryfrontSourcePath(
124
124
  specifier: string,
@@ -132,13 +132,13 @@ export async function resolveVeryfrontSourcePath(
132
132
  const relativePath = mappedTarget.slice("./src/".length);
133
133
  const hasExtension = /\.(tsx?|jsx?|mjs)$/.test(relativePath);
134
134
 
135
- // Check embedded sources first (for compiled binaries), then regular src/
135
+ // Prefer regular src/ when present, then fall back to embedded sources.
136
136
  // This order matches FRAMEWORK_LOOKUPS and resolveFrameworkFile to ensure
137
137
  // consistent path resolution across the codebase, which is critical for
138
138
  // cycle detection in transformingFiles.
139
139
  const lookupDirs = [
140
- EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
141
140
  join(FRAMEWORK_ROOT, "src"), // Regular sources for dev mode
141
+ EMBEDDED_SRC_DIR, // Embedded sources for compiled binaries (.src files)
142
142
  ];
143
143
 
144
144
  for (const dir of lookupDirs) {
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.116";
3
+ export const VERSION = "0.1.117";