veryfront 0.1.127 → 0.1.128

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.127",
3
+ "version": "0.1.128",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -1,3 +1,4 @@
1
+ export declare function getPreviewStylesheetLink(): string;
1
2
  export declare function getDevStyles(nonce?: string): string;
2
3
  export declare function getDevScripts(_hmrPort?: number, nonce?: string): string;
3
4
  export declare function getProdScripts(slug: string, nonce?: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"dev-scripts.d.ts","sourceRoot":"","sources":["../../../src/src/html/dev-scripts.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CA+BnD;AAMD,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAwBrE"}
1
+ {"version":3,"file":"dev-scripts.d.ts","sourceRoot":"","sources":["../../../src/src/html/dev-scripts.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CA+BnD;AAMD,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAwBrE"}
@@ -1,4 +1,7 @@
1
1
  import { escapeHtml } from "./html-escape.js";
2
+ export function getPreviewStylesheetLink() {
3
+ return `<link id="vf-tailwind-css" rel="stylesheet" href="/_vf_styles/styles.css?t=${Date.now()}">`;
4
+ }
2
5
  export function getDevStyles(nonce) {
3
6
  const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
4
7
  return `
@@ -1 +1 @@
1
- {"version":3,"file":"html-injection.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-injection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAY/D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;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CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACvC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgBD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,wBAAwB,GAChC,MAAM,CA+FR"}
@@ -2,13 +2,18 @@ import { resolveRelativePath } from "../modules/react-loader/path-resolver.js";
2
2
  import { determineClientModuleStrategy } from "../rendering/rsc/client-module-strategy.js";
3
3
  import { generateLinkTags, generateMetaTags, generateScriptTags, generateStyleTags, } from "./tag-generators.js";
4
4
  import { escapeHtml } from "./html-escape.js";
5
- import { getDevScripts, getDevStyles, getProdScripts, getStudioScripts } from "./dev-scripts.js";
5
+ import { getDevScripts, getDevStyles, getPreviewStylesheetLink, getProdScripts, getStudioScripts, } from "./dev-scripts.js";
6
6
  function toProjectRelativePath(absolutePath, projectDir) {
7
7
  const normalizedPath = absolutePath.replace(/\\/g, "/");
8
8
  if (!projectDir)
9
9
  return normalizedPath.replace(/^\//, "");
10
10
  return resolveRelativePath(normalizedPath, projectDir);
11
11
  }
12
+ function hasProjectStylesheet(html) {
13
+ return /id=["']vf-tailwind-css["']/i.test(html) ||
14
+ /href=["'][^"']*\/_vf_styles\/styles\.css(?:\?[^"']*)?["']/i.test(html) ||
15
+ /href=["'][^"']*\/_vf\/css\/[^"']+\.css["']/i.test(html);
16
+ }
12
17
  export function injectHTMLContent(template, content, metadata, options) {
13
18
  let html = template;
14
19
  html = html.replace(/{{\s*content\s*}}/gi, content);
@@ -32,6 +37,11 @@ export function injectHTMLContent(template, content, metadata, options) {
32
37
  const importMapTag = `<script type="importmap"${nonceAttr}>\n${options.importMapJson}\n</script>`;
33
38
  html = html.replace(/<\/head>/i, `${importMapTag}\n</head>`);
34
39
  }
40
+ const shouldUsePreviewStylesheet = options.mode === "development" ||
41
+ options.environment === "preview";
42
+ if (shouldUsePreviewStylesheet && /<\/head>/i.test(html) && !hasProjectStylesheet(html)) {
43
+ html = html.replace(/<\/head>/i, `${getPreviewStylesheetLink()}\n</head>`);
44
+ }
35
45
  const hasBodyClose = /<\/body>/i.test(html);
36
46
  // Inject hydration data for 'use client' pages (before scripts, so client.js can find it)
37
47
  if (options.pagePath && options.isClientPage && hasBodyClose) {
@@ -1 +1 @@
1
- {"version":3,"file":"html-shell-generator.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-shell-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAmBxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA+ExD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,EACtB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAWzC;AA6PD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
1
+ {"version":3,"file":"html-shell-generator.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-shell-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAmBxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA+ExD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,EACtB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAWzC;AA4PD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
@@ -6,7 +6,7 @@ import { isMarkdownPreview as checkMarkdownPreview } from "../transforms/md/util
6
6
  import { generateModulePreloadHintsFromManifest, getRouteManifest, } from "../modules/manifest/route-module-manifest.js";
7
7
  import { escapeHTML } from "./html-escape.js";
8
8
  import { generateHydrationData, getDevScripts, getProdScripts, } from "./hydration-script-builder/index.js";
9
- import { getStudioScripts } from "./dev-scripts.js";
9
+ import { getPreviewStylesheetLink, getStudioScripts } from "./dev-scripts.js";
10
10
  import { processMetadata } from "./metadata-builder.js";
11
11
  import { extractCandidates, getDevStyles, getProjectCSS } from "./styles-builder/index.js";
12
12
  import { buildImportMapJson, buildRootAttributes, shouldDisableLayout } from "./utils.js";
@@ -189,8 +189,7 @@ async function generateHTMLShellPartsImpl(meta, options, params, props, contentF
189
189
  }
190
190
  else {
191
191
  // Dev/preview: use link tag for HMR cache-busting
192
- tailwindCSSBlock =
193
- `<link id="vf-tailwind-css" rel="stylesheet" href="/_vf_styles/styles.css?t=${Date.now()}">`;
192
+ tailwindCSSBlock = getPreviewStylesheetLink();
194
193
  }
195
194
  // Markdown styles: .md files with prose !== false get GitHub markdown CSS
196
195
  const isMarkdownPreview = options.pageType === "md" &&
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.127";
1
+ export declare const VERSION = "0.1.128";
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.127";
3
+ export const VERSION = "0.1.128";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.127",
3
+ "version": "0.1.128",
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.127",
3
+ "version": "0.1.128",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -1,5 +1,9 @@
1
1
  import { escapeHtml } from "./html-escape.js";
2
2
 
3
+ export function getPreviewStylesheetLink(): string {
4
+ return `<link id="vf-tailwind-css" rel="stylesheet" href="/_vf_styles/styles.css?t=${Date.now()}">`;
5
+ }
6
+
3
7
  export function getDevStyles(nonce?: string): string {
4
8
  const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
5
9
 
@@ -8,7 +8,13 @@ import {
8
8
  generateStyleTags,
9
9
  } from "./tag-generators.js";
10
10
  import { escapeHtml } from "./html-escape.js";
11
- import { getDevScripts, getDevStyles, getProdScripts, getStudioScripts } from "./dev-scripts.js";
11
+ import {
12
+ getDevScripts,
13
+ getDevStyles,
14
+ getPreviewStylesheetLink,
15
+ getProdScripts,
16
+ getStudioScripts,
17
+ } from "./dev-scripts.js";
12
18
 
13
19
  export interface InjectHTMLContentOptions {
14
20
  mode: string;
@@ -48,6 +54,12 @@ function toProjectRelativePath(absolutePath: string, projectDir?: string): strin
48
54
  return resolveRelativePath(normalizedPath, projectDir);
49
55
  }
50
56
 
57
+ function hasProjectStylesheet(html: string): boolean {
58
+ return /id=["']vf-tailwind-css["']/i.test(html) ||
59
+ /href=["'][^"']*\/_vf_styles\/styles\.css(?:\?[^"']*)?["']/i.test(html) ||
60
+ /href=["'][^"']*\/_vf\/css\/[^"']+\.css["']/i.test(html);
61
+ }
62
+
51
63
  export function injectHTMLContent(
52
64
  template: string,
53
65
  content: string,
@@ -84,6 +96,13 @@ export function injectHTMLContent(
84
96
  html = html.replace(/<\/head>/i, `${importMapTag}\n</head>`);
85
97
  }
86
98
 
99
+ const shouldUsePreviewStylesheet = options.mode === "development" ||
100
+ options.environment === "preview";
101
+
102
+ if (shouldUsePreviewStylesheet && /<\/head>/i.test(html) && !hasProjectStylesheet(html)) {
103
+ html = html.replace(/<\/head>/i, `${getPreviewStylesheetLink()}\n</head>`);
104
+ }
105
+
87
106
  const hasBodyClose = /<\/body>/i.test(html);
88
107
 
89
108
  // Inject hydration data for 'use client' pages (before scripts, so client.js can find it)
@@ -14,7 +14,7 @@ import {
14
14
  getDevScripts,
15
15
  getProdScripts,
16
16
  } from "./hydration-script-builder/index.js";
17
- import { getStudioScripts } from "./dev-scripts.js";
17
+ import { getPreviewStylesheetLink, getStudioScripts } from "./dev-scripts.js";
18
18
  import { processMetadata } from "./metadata-builder.js";
19
19
  import { extractCandidates, getDevStyles, getProjectCSS } from "./styles-builder/index.js";
20
20
  import type { HTMLGenerationOptions } from "./types.js";
@@ -270,8 +270,7 @@ async function generateHTMLShellPartsImpl(
270
270
  }
271
271
  } else {
272
272
  // Dev/preview: use link tag for HMR cache-busting
273
- tailwindCSSBlock =
274
- `<link id="vf-tailwind-css" rel="stylesheet" href="/_vf_styles/styles.css?t=${Date.now()}">`;
273
+ tailwindCSSBlock = getPreviewStylesheetLink();
275
274
  }
276
275
 
277
276
  // Markdown styles: .md files with prose !== false get GitHub markdown CSS
@@ -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.127";
3
+ export const VERSION = "0.1.128";