meno-core 1.0.46 → 1.0.47

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 (31) hide show
  1. package/build-astro.ts +11 -75
  2. package/dist/build-static.js +3 -3
  3. package/dist/chunks/{chunk-C6U5T5S5.js → chunk-47UNLQUU.js} +2 -2
  4. package/dist/chunks/{chunk-ZWYDT3QJ.js → chunk-BCLGRZ3U.js} +3 -3
  5. package/dist/chunks/{chunk-ZWYDT3QJ.js.map → chunk-BCLGRZ3U.js.map} +2 -2
  6. package/dist/chunks/{chunk-77ZB6353.js → chunk-FGUZOYJX.js} +22 -14
  7. package/dist/chunks/chunk-FGUZOYJX.js.map +7 -0
  8. package/dist/chunks/{chunk-ORN7S4AP.js → chunk-LJFB5EBT.js} +2 -2
  9. package/dist/entries/server-router.js +3 -3
  10. package/dist/lib/client/index.js +4 -2
  11. package/dist/lib/client/index.js.map +2 -2
  12. package/dist/lib/server/index.js +70 -91
  13. package/dist/lib/server/index.js.map +2 -2
  14. package/lib/client/core/ComponentBuilder.test.ts +21 -0
  15. package/lib/client/core/ComponentBuilder.ts +8 -1
  16. package/lib/server/astro/astroEmitHelpers.ts +5 -0
  17. package/lib/server/astro/cmsPageEmitter.ts +15 -2
  18. package/lib/server/astro/componentEmitter.ts +13 -5
  19. package/lib/server/astro/nodeToAstro.ts +23 -9
  20. package/lib/server/astro/pageEmitter.ts +15 -2
  21. package/lib/server/ssr/htmlGenerator.test.ts +3 -2
  22. package/lib/server/ssr/htmlGenerator.ts +5 -0
  23. package/lib/server/ssr/imageMetadata.ts +15 -9
  24. package/lib/server/ssr/ssrRenderer.test.ts +47 -0
  25. package/lib/server/ssr/ssrRenderer.ts +9 -9
  26. package/lib/shared/styleNodeUtils.test.ts +47 -1
  27. package/lib/shared/styleNodeUtils.ts +7 -7
  28. package/package.json +1 -1
  29. package/dist/chunks/chunk-77ZB6353.js.map +0 -7
  30. /package/dist/chunks/{chunk-C6U5T5S5.js.map → chunk-47UNLQUU.js.map} +0 -0
  31. /package/dist/chunks/{chunk-ORN7S4AP.js.map → chunk-LJFB5EBT.js.map} +0 -0
package/build-astro.ts CHANGED
@@ -29,7 +29,6 @@ import { isItemDraftForLocale } from "./lib/shared/types";
29
29
  import type { SlugMap } from "./lib/shared/slugTranslator";
30
30
  import { renderPageSSR } from "./lib/server/ssr/ssrRenderer";
31
31
  import { generateThemeColorVariablesCSS, generateVariablesCSS } from "./lib/server/cssGenerator";
32
- import { generateAllInteractiveCSS } from "./lib/shared/cssGeneration";
33
32
  import { colorService } from "./lib/server/services/ColorService";
34
33
  import { variableService } from "./lib/server/services/VariableService";
35
34
  import { configService } from "./lib/server/services/configService";
@@ -298,10 +297,6 @@ export async function buildAstroProject(
298
297
  projectRoot?: string,
299
298
  outputDir?: string
300
299
  ): Promise<AstroBuildStats> {
301
- const startTime = Date.now();
302
-
303
- console.log('🏗️ Building Astro export...\n');
304
-
305
300
  // ----------------------------------------------------------
306
301
  // 1. Setup: load project configuration
307
302
  // ----------------------------------------------------------
@@ -311,7 +306,6 @@ export async function buildAstroProject(
311
306
  const siteUrl = (projectConfig as { siteUrl?: string }).siteUrl?.replace(/\/$/, '') || '';
312
307
 
313
308
  const i18nConfig = await loadI18nConfig();
314
- console.log(`🌐 Locales: ${i18nConfig.locales.map(l => l.code).join(', ')} (default: ${i18nConfig.defaultLocale})\n`);
315
309
 
316
310
  await migrateTemplatesDirectory();
317
311
 
@@ -320,12 +314,10 @@ export async function buildAstroProject(
320
314
  components.forEach((value, key) => { globalComponents[key] = value; });
321
315
  for (const w of warnings) console.warn(` Warning: ${w}`);
322
316
  for (const e of compErrors) console.error(` Error: ${e}`);
323
- console.log(`Loaded ${components.size} global component(s)\n`);
324
317
 
325
318
  const cmsProvider = new FileSystemCMSProvider(projectPaths.templates(), projectPaths.cms());
326
319
  const cmsService = new CMSService(cmsProvider);
327
320
  await cmsService.initialize();
328
- console.log('CMS service initialized\n');
329
321
 
330
322
  const themeConfig = await colorService.loadThemeConfig();
331
323
  const variablesConfig = await variableService.loadConfig();
@@ -339,9 +331,6 @@ export async function buildAstroProject(
339
331
 
340
332
  // Build image metadata map for responsive image generation
341
333
  const imageMetadataMap = await buildImageMetadataMap();
342
- if (imageMetadataMap.size > 0) {
343
- console.log(`Loaded image metadata for ${imageMetadataMap.size} image(s)\n`);
344
- }
345
334
 
346
335
  // ----------------------------------------------------------
347
336
  // 2. Clean and create output directory
@@ -380,8 +369,6 @@ export async function buildAstroProject(
380
369
  return { pages: 0, cmsPages: 0, collections: 0, errors: 0 };
381
370
  }
382
371
 
383
- console.log(`Found ${pageFiles.length} page(s) to process\n`);
384
-
385
372
  // Collect slug mappings (first pass)
386
373
  const slugMappings: SlugMap[] = [];
387
374
  for (const file of pageFiles) {
@@ -485,7 +472,6 @@ export async function buildAstroProject(
485
472
  // Skip draft pages in production
486
473
  const isDevBuild = process.env.MENO_DEV_BUILD === 'true';
487
474
  if (pageData.meta?.draft === true && !isDevBuild) {
488
- console.log(` Skipping draft: ${basePath}`);
489
475
  continue;
490
476
  }
491
477
 
@@ -528,7 +514,6 @@ export async function buildAstroProject(
528
514
  );
529
515
 
530
516
  processRenderResult(result, urlPath, astroFilePath, fileDepth, pageData, pageName, false);
531
- console.log(` Rendered: ${urlPath}`);
532
517
  }
533
518
  } catch (error: any) {
534
519
  console.error(` Error rendering ${basePath}:`, error?.message || error);
@@ -588,6 +573,8 @@ export async function buildAstroProject(
588
573
  : '';
589
574
  const iconTagsHtml = [faviconTag, appleTouchIconTag].filter(Boolean).join('\n ');
590
575
 
576
+ const remConversionConfig = configService.getRemConversion();
577
+
591
578
  // ---------- CMS template pages ----------
592
579
  const templatesDir = projectPaths.templates();
593
580
  const templateSchemas: CMSSchema[] = [];
@@ -596,10 +583,6 @@ export async function buildAstroProject(
596
583
  if (existsSync(templatesDir)) {
597
584
  const templateFiles = readdirSync(templatesDir).filter(f => f.endsWith('.json'));
598
585
 
599
- if (templateFiles.length > 0) {
600
- console.log(`\nProcessing ${templateFiles.length} CMS template(s)...\n`);
601
- }
602
-
603
586
  for (const file of templateFiles) {
604
587
  const templateContent = await loadJSONFile(join(templatesDir, file));
605
588
  if (!templateContent) continue;
@@ -609,7 +592,6 @@ export async function buildAstroProject(
609
592
 
610
593
  const isDevBuild = process.env.MENO_DEV_BUILD === 'true';
611
594
  if (pageData.meta?.draft === true && !isDevBuild) {
612
- console.log(` Skipping draft template: ${file}`);
613
595
  continue;
614
596
  }
615
597
 
@@ -620,18 +602,11 @@ export async function buildAstroProject(
620
602
 
621
603
  const cmsSchema = pageData.meta!.cms as CMSSchema;
622
604
  templateSchemas.push(cmsSchema);
623
- console.log(` CMS Collection: ${cmsSchema.id}`);
624
605
 
625
606
  // Count items for stats
626
607
  const items = await cmsService.queryItems({ collection: cmsSchema.id });
627
608
  const itemCount = items.length;
628
609
 
629
- if (itemCount === 0) {
630
- console.log(` No items found in cms/${cmsSchema.id}/`);
631
- } else {
632
- console.log(` Found ${itemCount} item(s)`);
633
- }
634
-
635
610
  // Render SSR once for metadata collection (interactive styles, component CSS, JS)
636
611
  const defaultLocale = i18nConfig.defaultLocale;
637
612
  const dummyPath = cmsSchema.urlPattern.replace('{{slug}}', '__placeholder__');
@@ -719,6 +694,7 @@ export async function buildAstroProject(
719
694
  slugMappings,
720
695
  imageFormat: configService.getImageFormat(),
721
696
  processedRawHtml: metaResult.processedRawHtmlCollector,
697
+ remConfig: remConversionConfig,
722
698
  });
723
699
 
724
700
  const astroFileFull = join(pagesOutDir, astroFilePath);
@@ -730,8 +706,6 @@ export async function buildAstroProject(
730
706
  await writeFile(astroFileFull, astroContent, 'utf-8');
731
707
  }
732
708
 
733
- console.log(` Generated: ${pathPrefix}[slug].astro (${itemCount} items × ${localesToEmit.length} locale(s))`);
734
-
735
709
  cmsPageCount += itemCount * i18nConfig.locales.length;
736
710
  } catch (error: any) {
737
711
  console.error(` Error processing template ${file}:`, error?.message || error);
@@ -749,17 +723,15 @@ export async function buildAstroProject(
749
723
  const fontCSS = generateFontCSS();
750
724
  const themeColorCSS = generateThemeColorVariablesCSS(themeConfig);
751
725
  const variablesCSS = generateVariablesCSS(variablesConfig, breakpoints, responsiveScales);
752
- const remConversionConfig = configService.getRemConversion();
753
- const interactiveCSS = generateAllInteractiveCSS(allInteractiveStyles, breakpoints, remConversionConfig, responsiveScales);
754
726
  const componentCSSCombined = Array.from(allComponentCSS).join('\n');
755
727
 
756
728
  const baseCSS = `@layer base {
757
729
  * { margin: 0; padding: 0; box-sizing: border-box; }
758
730
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif; }
759
731
  button { background: none; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit; }
760
- img { display: block; width: 100%; height: 100%; }
732
+ img { max-width: 100%; height: auto; }
761
733
  picture { display: block; }
762
- .olink { text-decoration: none; display: block; }
734
+ .olink { text-decoration: none; display: block; color: inherit; }
763
735
  .oem { display: inline-block; }
764
736
  }`;
765
737
 
@@ -771,12 +743,11 @@ export async function buildAstroProject(
771
743
  ? `@import "tailwindcss";\n\n${safelistDirectives}`
772
744
  : `@import "tailwindcss";`;
773
745
 
774
- const globalCSS = [tailwindDirectives, fontCSS, themeColorCSS, variablesCSS, baseCSS, componentCSSCombined, interactiveCSS]
746
+ const globalCSS = [tailwindDirectives, fontCSS, themeColorCSS, variablesCSS, baseCSS, componentCSSCombined]
775
747
  .filter(Boolean)
776
748
  .join('\n\n');
777
749
 
778
750
  await writeFile(join(stylesDir, 'global.css'), globalCSS, 'utf-8');
779
- console.log(`\nGenerated global.css (${(globalCSS.length / 1024).toFixed(1)} KB)`);
780
751
 
781
752
  // ----------------------------------------------------------
782
753
  // 7. Generate BaseLayout.astro
@@ -836,7 +807,6 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
836
807
  `;
837
808
 
838
809
  await writeFile(join(layoutsDir, 'BaseLayout.astro'), baseLayoutContent, 'utf-8');
839
- console.log('Generated BaseLayout.astro');
840
810
 
841
811
  // ----------------------------------------------------------
842
812
  // 7.5. Generate component .astro files
@@ -844,15 +814,13 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
844
814
  let componentFileCount = 0;
845
815
  for (const [compName, compDef] of Object.entries(globalComponents)) {
846
816
  try {
847
- const astroContent = emitAstroComponent(compName, compDef, globalComponents, breakpoints, i18nConfig.defaultLocale, responsiveScales);
817
+ const astroContent = emitAstroComponent(compName, compDef, globalComponents, breakpoints, i18nConfig.defaultLocale, responsiveScales, remConversionConfig);
848
818
  await writeFile(join(componentsOutDir, `${compName}.astro`), astroContent, 'utf-8');
849
819
  componentFileCount++;
850
820
  } catch (error: any) {
851
821
  console.warn(` Warning: could not generate component ${compName}: ${error?.message}`);
852
822
  }
853
823
  }
854
- console.log(`Generated ${componentFileCount} component .astro file(s)`);
855
-
856
824
  // ----------------------------------------------------------
857
825
  // 8. Generate .astro page files (component-structured)
858
826
  // ----------------------------------------------------------
@@ -900,6 +868,7 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
900
868
  slugMappings: i18nConfig.locales.length > 1 ? slugMappings : undefined,
901
869
  imageFormat: configService.getImageFormat(),
902
870
  processedRawHtml: result.processedRawHtmlCollector,
871
+ remConfig: remConversionConfig,
903
872
  });
904
873
  } catch (error: any) {
905
874
  // Fallback to SSR HTML if component emission fails — needs page-level script
@@ -922,8 +891,6 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
922
891
  await writeFile(astroFileFull, astroContent, 'utf-8');
923
892
  }
924
893
 
925
- console.log(`Generated ${allResults.length} .astro page file(s)`);
926
-
927
894
  // ----------------------------------------------------------
928
895
  // 8.5. Generate robots.txt endpoint
929
896
  // ----------------------------------------------------------
@@ -944,7 +911,6 @@ export const GET: APIRoute = () => {
944
911
  };
945
912
  `;
946
913
  await writeFile(join(pagesOutDir, 'robots.txt.ts'), robotsTsContent, 'utf-8');
947
- console.log('Generated robots.txt.ts endpoint');
948
914
 
949
915
  // ----------------------------------------------------------
950
916
  // 9. Generate CMS content collections (if templates exist)
@@ -1017,7 +983,6 @@ export { collections };
1017
983
  `;
1018
984
 
1019
985
  await writeFile(join(srcDir, 'content.config.ts'), configContent, 'utf-8');
1020
- console.log(`Generated ${collectionCount} content collection(s) with content.config.ts`);
1021
986
  }
1022
987
 
1023
988
  // ----------------------------------------------------------
@@ -1026,7 +991,6 @@ export { collections };
1026
991
  // Images go to src/assets/images so Astro's asset pipeline can process
1027
992
  // them via astro:assets `<Picture>` (hashing, on-edit reprocessing).
1028
993
  // Everything else stays in public/ — fonts/icons/videos need stable URLs.
1029
- let copiedAssets = 0;
1030
994
 
1031
995
  const imagesSrcDir = join(projectPaths.project, 'images');
1032
996
  if (existsSync(imagesSrcDir)) {
@@ -1040,7 +1004,6 @@ export { collections };
1040
1004
  // the static Picture path (variants referenced directly in a srcset,
1041
1005
  // CMS/template-bound images, component-prop images) 404s in `astro dev`.
1042
1006
  copyDirectory(imagesSrcDir, join(publicDir, 'images'));
1043
- copiedAssets++;
1044
1007
  }
1045
1008
 
1046
1009
  const publicAssetDirs = ['fonts', 'icons', 'videos', 'assets'];
@@ -1048,15 +1011,13 @@ export { collections };
1048
1011
  const srcAssetDir = join(projectPaths.project, dir);
1049
1012
  if (existsSync(srcAssetDir)) {
1050
1013
  copyDirectory(srcAssetDir, join(publicDir, dir));
1051
- copiedAssets++;
1052
- }
1014
+ }
1053
1015
  }
1054
1016
 
1055
1017
  // Copy libraries folder if it exists
1056
1018
  const librariesDir = join(projectPaths.project, 'libraries');
1057
1019
  if (existsSync(librariesDir)) {
1058
1020
  copyDirectory(librariesDir, join(publicDir, 'libraries'));
1059
- copiedAssets++;
1060
1021
  }
1061
1022
 
1062
1023
  // Copy any project-root library files referenced by absolute URL in
@@ -1068,11 +1029,6 @@ export { collections };
1068
1029
  const destDir = destPath.substring(0, destPath.lastIndexOf('/'));
1069
1030
  if (destDir && !existsSync(destDir)) mkdirSync(destDir, { recursive: true });
1070
1031
  copyFileSync(srcPath, destPath);
1071
- copiedAssets++;
1072
- }
1073
-
1074
- if (copiedAssets > 0) {
1075
- console.log(`Copied ${copiedAssets} asset director${copiedAssets === 1 ? 'y' : 'ies'} to public/`);
1076
1032
  }
1077
1033
 
1078
1034
  // ----------------------------------------------------------
@@ -1132,34 +1088,14 @@ export default defineConfig({${siteUrl ? `\n site: '${siteUrl}',` : ''}${i18nBl
1132
1088
 
1133
1089
  await writeFile(join(outDir, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2), 'utf-8');
1134
1090
 
1135
- console.log('Generated package.json, astro.config.mjs, tsconfig.json');
1091
+ // src/env.d.ts — resolves astro:assets and other virtual module types in IDE
1092
+ await writeFile(join(outDir, 'src', 'env.d.ts'), '/// <reference path="../.astro/types.d.ts" />\n', 'utf-8');
1136
1093
 
1137
1094
  // ----------------------------------------------------------
1138
1095
  // 12. Summary
1139
1096
  // ----------------------------------------------------------
1140
- const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
1141
1097
  const totalPages = allResults.length;
1142
1098
 
1143
- console.log('\n' + '='.repeat(50));
1144
- console.log('Astro export complete!');
1145
- console.log(` Pages: ${totalPages - cmsPageCount}`);
1146
- if (cmsPageCount > 0) {
1147
- console.log(` CMS pages: ${cmsPageCount}`);
1148
- }
1149
- if (collectionCount > 0) {
1150
- console.log(` Content collections: ${collectionCount}`);
1151
- }
1152
- if (errorCount > 0) {
1153
- console.log(` Errors: ${errorCount}`);
1154
- }
1155
- console.log(` SEO: sitemap (@astrojs/sitemap), robots.txt`);
1156
- if (projectNeedsFormHandler) {
1157
- console.log(` Forms: fetch handler injected`);
1158
- }
1159
- console.log(` Time: ${elapsed}s`);
1160
- console.log(` Output: ${outDir}`);
1161
- console.log('');
1162
-
1163
1099
  return {
1164
1100
  pages: totalPages - cmsPageCount,
1165
1101
  cmsPages: cmsPageCount,
@@ -9,13 +9,13 @@ import {
9
9
  hashContent,
10
10
  injectTrackingScript,
11
11
  isCMSPage
12
- } from "./chunks/chunk-ORN7S4AP.js";
13
- import "./chunks/chunk-77ZB6353.js";
12
+ } from "./chunks/chunk-LJFB5EBT.js";
13
+ import "./chunks/chunk-FGUZOYJX.js";
14
14
  import "./chunks/chunk-ZTKHJQ2Z.js";
15
15
  import "./chunks/chunk-I7YIGZXT.js";
16
16
  import "./chunks/chunk-WQFG7PAH.js";
17
17
  import "./chunks/chunk-KITQJYZV.js";
18
- import "./chunks/chunk-ZWYDT3QJ.js";
18
+ import "./chunks/chunk-BCLGRZ3U.js";
19
19
  import "./chunks/chunk-FED5MME6.js";
20
20
  import "./chunks/chunk-XSWR3QLI.js";
21
21
  import "./chunks/chunk-UB44F4Z2.js";
@@ -16,7 +16,7 @@ import {
16
16
  parseJSON,
17
17
  resolveSlugToPageId,
18
18
  variableService
19
- } from "./chunk-77ZB6353.js";
19
+ } from "./chunk-FGUZOYJX.js";
20
20
  import {
21
21
  configService
22
22
  } from "./chunk-ZTKHJQ2Z.js";
@@ -3221,4 +3221,4 @@ export {
3221
3221
  createServer,
3222
3222
  FileSystemPageProvider
3223
3223
  };
3224
- //# sourceMappingURL=chunk-C6U5T5S5.js.map
3224
+ //# sourceMappingURL=chunk-47UNLQUU.js.map
@@ -32,7 +32,7 @@ function applyStylesToNode(node, styles, viewportWidth) {
32
32
  node.props = {};
33
33
  }
34
34
  node.props.style = { ...node.props.style || {}, ...styles };
35
- } else if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {
35
+ } else if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node) || isLinkNode(node)) {
36
36
  node.style = styles;
37
37
  }
38
38
  return node;
@@ -58,7 +58,7 @@ function deepMergeStyles(existing, instance) {
58
58
  }
59
59
  function mergeNodeStyles(node, instanceStyles, viewportWidth) {
60
60
  if (!instanceStyles) return node;
61
- if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node)) {
61
+ if (isHtmlNode(node) || isEmbedNode(node) || isListNode(node) || isLinkNode(node)) {
62
62
  const existingStyle = node.style;
63
63
  if (existingStyle && typeof existingStyle === "object") {
64
64
  node.style = deepMergeStyles(existingStyle, instanceStyles);
@@ -619,4 +619,4 @@ export {
619
619
  extractAttributesFromNode,
620
620
  skipEmptyTemplateAttributes
621
621
  };
622
- //# sourceMappingURL=chunk-ZWYDT3QJ.js.map
622
+ //# sourceMappingURL=chunk-BCLGRZ3U.js.map