@deneb-ui/core 2.0.61 → 2.0.63

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.
@@ -21,5 +21,9 @@ export interface InstallProjectFontsResult {
21
21
  export declare function findSiteDataPath(projectDir: string): string | null;
22
22
  export declare function findHostProject(startDir: string): string | null;
23
23
  export declare function generateFontsCss(fonts: DenebFontDefinition[]): string;
24
+ export declare function stripNextFontGoogle(source: string): {
25
+ source: string;
26
+ stripped: boolean;
27
+ };
24
28
  export declare function installProjectFonts(options: InstallProjectFontsOptions): InstallProjectFontsResult;
25
29
  export declare function installFontsForHostOf(packageDir: string): InstallProjectFontsResult;
@@ -7,6 +7,7 @@ exports.FONTS_CSS_IMPORT = exports.FONTS_CSS_REL = exports.FONTS_MANIFEST_REL =
7
7
  exports.findSiteDataPath = findSiteDataPath;
8
8
  exports.findHostProject = findHostProject;
9
9
  exports.generateFontsCss = generateFontsCss;
10
+ exports.stripNextFontGoogle = stripNextFontGoogle;
10
11
  exports.installProjectFonts = installProjectFonts;
11
12
  exports.installFontsForHostOf = installFontsForHostOf;
12
13
  const node_child_process_1 = require("node:child_process");
@@ -135,6 +136,24 @@ function fontsCssImportSpecifier(projectDir, layoutPath) {
135
136
  rel = `./${rel}`;
136
137
  return rel;
137
138
  }
139
+ function stripNextFontGoogle(source) {
140
+ if (!source.includes("next/font/google")) {
141
+ return { source, stripped: false };
142
+ }
143
+ let next = source;
144
+ // Remove import { ... } from "next/font/google"
145
+ next = next.replace(/import\s*\{[^}]*\}\s*from\s*['"]next\/font\/google['"];?\r?\n?/g, "");
146
+ // Remove font const declarations with options like variable, subsets, display
147
+ next = next.replace(/const\s+[a-zA-Z0-9_$]+\s*=\s*[a-zA-Z0-9_$]+\(\s*\{[\s\S]*?\}\s*\);?\r?\n?/g, (match) => {
148
+ if (match.includes("variable:") || match.includes("subsets:") || match.includes("display:")) {
149
+ return "";
150
+ }
151
+ return match;
152
+ });
153
+ // Clean up font variable classes e.g. ${fraunces.variable}
154
+ next = next.replace(/\$\{[a-zA-Z0-9_$]+\.variable\}\s*/g, "");
155
+ return { source: next, stripped: true };
156
+ }
138
157
  function patchLayoutImport(projectDir) {
139
158
  const layoutPath = findLayoutPath(projectDir);
140
159
  if (!layoutPath)
@@ -142,6 +161,8 @@ function patchLayoutImport(projectDir) {
142
161
  const specifier = fontsCssImportSpecifier(projectDir, layoutPath);
143
162
  const importLine = `import '${specifier}';`;
144
163
  let source = node_fs_1.default.readFileSync(layoutPath, 'utf8');
164
+ const { source: ungoogled, stripped } = stripNextFontGoogle(source);
165
+ source = ungoogled;
145
166
  // Older installer wrote ./fonts/... next to layout.tsx; the CSS lives in src/fonts.
146
167
  if (source.includes("import './fonts/deneb-fonts.css'")) {
147
168
  source = ensureRootHydrationGuard(source.replace("import './fonts/deneb-fonts.css';", importLine));
@@ -155,7 +176,7 @@ function patchLayoutImport(projectDir) {
155
176
  }
156
177
  if (source.includes('deneb-fonts.css')) {
157
178
  const guarded = ensureRootHydrationGuard(source);
158
- if (guarded !== source) {
179
+ if (guarded !== source || stripped) {
159
180
  node_fs_1.default.writeFileSync(layoutPath, guarded, 'utf8');
160
181
  return { patched: true, reason: 'hydration guard', layoutPath };
161
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/core",
3
- "version": "2.0.61",
3
+ "version": "2.0.63",
4
4
  "description": "Headless style engine for real-time Fivora visual editing — CSS variables, DOM patcher, and preview protocol.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",