meno-core 1.0.54 → 1.1.1

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 (298) hide show
  1. package/bin/cli.ts +19 -205
  2. package/build-astro.ts +31 -27
  3. package/dist/bin/cli.js +15 -154
  4. package/dist/bin/cli.js.map +2 -2
  5. package/dist/chunks/{chunk-3XER4E5W.js → chunk-4ZRU52J2.js} +6 -5
  6. package/dist/chunks/{chunk-3XER4E5W.js.map → chunk-4ZRU52J2.js.map} +2 -2
  7. package/dist/chunks/{chunk-NVRBTSQG.js → chunk-5X4HCN7J.js} +4 -4
  8. package/dist/chunks/chunk-5X4HCN7J.js.map +7 -0
  9. package/dist/chunks/{chunk-FZITJSSS.js → chunk-7CCVOL5M.js} +14 -14
  10. package/dist/chunks/chunk-7CCVOL5M.js.map +7 -0
  11. package/dist/chunks/{chunk-AE3QK5QW.js → chunk-7ZLF4NE5.js} +31 -26
  12. package/dist/chunks/chunk-7ZLF4NE5.js.map +7 -0
  13. package/dist/chunks/{chunk-HIZMY3EP.js → chunk-AR7LHIFY.js} +8 -2
  14. package/dist/chunks/chunk-AR7LHIFY.js.map +7 -0
  15. package/dist/chunks/{chunk-7HWQUVTU.js → chunk-J4IPTP5X.js} +1839 -443
  16. package/dist/chunks/chunk-J4IPTP5X.js.map +7 -0
  17. package/dist/chunks/{chunk-5ETZFREW.js → chunk-QWTQZHG3.js} +186 -79
  18. package/dist/chunks/chunk-QWTQZHG3.js.map +7 -0
  19. package/dist/chunks/{chunk-STDY3OVM.js → chunk-XTKNX4FW.js} +3 -3
  20. package/dist/chunks/{chunk-STDY3OVM.js.map → chunk-XTKNX4FW.js.map} +2 -2
  21. package/dist/chunks/{fs-ZI5JEU7V.js → fs-G3ANWEFP.js} +2 -2
  22. package/dist/lib/client/index.js +381 -159
  23. package/dist/lib/client/index.js.map +3 -3
  24. package/dist/lib/server/index.js +14365 -6276
  25. package/dist/lib/server/index.js.map +4 -4
  26. package/dist/lib/shared/index.js +296 -87
  27. package/dist/lib/shared/index.js.map +4 -4
  28. package/dist/lib/shared/richtext/index.js +1 -1
  29. package/dist/lib/test-utils/index.js +27 -21
  30. package/dist/lib/test-utils/index.js.map +2 -2
  31. package/lib/client/ErrorBoundary.test.tsx +147 -90
  32. package/lib/client/ErrorBoundary.tsx +8 -5
  33. package/lib/client/componentRegistry.ts +0 -1
  34. package/lib/client/core/ComponentBuilder.test.ts +150 -0
  35. package/lib/client/core/ComponentBuilder.ts +112 -12
  36. package/lib/client/core/ComponentRenderer.test.tsx +1 -2
  37. package/lib/client/core/builders/embedBuilder.ts +1 -1
  38. package/lib/client/core/builders/linkBuilder.ts +2 -2
  39. package/lib/client/core/builders/linkNodeBuilder.ts +1 -1
  40. package/lib/client/core/builders/listBuilder.ts +41 -4
  41. package/lib/client/core/builders/localeListBuilder.ts +2 -2
  42. package/lib/client/core/cmsTemplateProcessor.ts +1 -2
  43. package/lib/client/hmr/HMRManager.tsx +39 -30
  44. package/lib/client/hmrCssReload.ts +35 -6
  45. package/lib/client/hmrWebSocket.ts +5 -5
  46. package/lib/client/hooks/useColorVariables.ts +12 -9
  47. package/lib/client/hooks/usePropertyAutocomplete.ts +1 -1
  48. package/lib/client/hooks/useVariables.ts +3 -1
  49. package/lib/client/meno-filter/MenoFilter.test.ts +28 -28
  50. package/lib/client/meno-filter/MenoFilter.ts +9 -6
  51. package/lib/client/meno-filter/bindings.ts +3 -3
  52. package/lib/client/meno-filter/init.ts +3 -3
  53. package/lib/client/meno-filter/renderer.ts +8 -4
  54. package/lib/client/meno-filter/ui.ts +1 -1
  55. package/lib/client/meno-filter/updates.ts +3 -2
  56. package/lib/client/meno-filter/utils.ts +1 -1
  57. package/lib/client/navigation.test.ts +40 -44
  58. package/lib/client/responsiveStyleResolver.knownTokens.test.ts +71 -0
  59. package/lib/client/responsiveStyleResolver.test.ts +5 -5
  60. package/lib/client/responsiveStyleResolver.ts +61 -4
  61. package/lib/client/routing/RouteLoader.test.ts +1 -1
  62. package/lib/client/routing/RouteLoader.ts +8 -3
  63. package/lib/client/routing/Router.tsx +181 -152
  64. package/lib/client/scripts/ScriptExecutor.ts +3 -3
  65. package/lib/client/services/PrefetchService.test.ts +1 -1
  66. package/lib/client/services/PrefetchService.ts +13 -5
  67. package/lib/client/styleProcessor.ts +9 -3
  68. package/lib/client/styles/StyleInjector.ts +1 -1
  69. package/lib/client/styles/UtilityClassCollector.ts +54 -13
  70. package/lib/client/templateEngine.test.ts +17 -23
  71. package/lib/client/templateEngine.ts +7 -13
  72. package/lib/client/theme.test.ts +1 -1
  73. package/lib/server/__integration__/server-lifecycle.test.ts +3 -1
  74. package/lib/server/__integration__/static-assets.test.ts +2 -2
  75. package/lib/server/__integration__/test-helpers.ts +3 -4
  76. package/lib/server/astro/cmsPageEmitter.ts +4 -5
  77. package/lib/server/astro/componentEmitter.ts +11 -8
  78. package/lib/server/astro/nodeToAstro.test.ts +4 -4
  79. package/lib/server/astro/nodeToAstro.ts +41 -36
  80. package/lib/server/astro/normalizeOrphanTemplateProps.test.ts +11 -11
  81. package/lib/server/astro/normalizeOrphanTemplateProps.ts +7 -6
  82. package/lib/server/astro/pageEmitter.ts +1 -1
  83. package/lib/server/astro/templateTransformer.ts +3 -3
  84. package/lib/server/createServer.ts +2 -2
  85. package/lib/server/cssGenerator.ts +2 -2
  86. package/lib/server/fileWatcher.test.ts +41 -4
  87. package/lib/server/fileWatcher.ts +102 -23
  88. package/lib/server/index.ts +7 -16
  89. package/lib/server/jsonLoader.test.ts +3 -3
  90. package/lib/server/jsonLoader.ts +8 -5
  91. package/lib/server/middleware/cors.test.ts +1 -1
  92. package/lib/server/middleware/cors.ts +2 -2
  93. package/lib/server/middleware/errorHandler.test.ts +2 -2
  94. package/lib/server/middleware/logger.test.ts +3 -3
  95. package/lib/server/middleware/logger.ts +7 -7
  96. package/lib/server/migrateTemplates.ts +3 -3
  97. package/lib/server/projectContext.ts +1 -1
  98. package/lib/server/providers/fileSystemCMSProvider.test.ts +18 -4
  99. package/lib/server/providers/fileSystemCMSProvider.ts +27 -18
  100. package/lib/server/routes/api/cms.ts +1 -1
  101. package/lib/server/routes/api/colors.test.ts +2 -2
  102. package/lib/server/routes/api/components.ts +1 -1
  103. package/lib/server/routes/api/config.ts +3 -3
  104. package/lib/server/routes/api/core-routes.ts +2 -2
  105. package/lib/server/routes/api/enums.test.ts +2 -2
  106. package/lib/server/routes/api/functions.ts +1 -1
  107. package/lib/server/routes/api/variables.test.ts +2 -2
  108. package/lib/server/routes/index.ts +2 -2
  109. package/lib/server/routes/pages.ts +1 -2
  110. package/lib/server/routes/static.ts +1 -2
  111. package/lib/server/runtime/bundler.ts +65 -43
  112. package/lib/server/runtime/fs.ts +13 -13
  113. package/lib/server/runtime/httpServer.ts +3 -3
  114. package/lib/server/services/ColorService.test.ts +3 -3
  115. package/lib/server/services/ColorService.ts +5 -2
  116. package/lib/server/services/EnumService.test.ts +2 -2
  117. package/lib/server/services/EnumService.ts +4 -1
  118. package/lib/server/services/VariableService.test.ts +7 -7
  119. package/lib/server/services/VariableService.ts +5 -2
  120. package/lib/server/services/cmsService.test.ts +44 -44
  121. package/lib/server/services/cmsService.ts +17 -97
  122. package/lib/server/services/componentService.test.ts +10 -16
  123. package/lib/server/services/componentService.ts +20 -12
  124. package/lib/server/services/configService.test.ts +13 -14
  125. package/lib/server/services/configService.ts +30 -0
  126. package/lib/server/services/fileWatcherService.ts +2 -2
  127. package/lib/server/services/pageService.test.ts +7 -7
  128. package/lib/server/services/pageService.ts +18 -5
  129. package/lib/server/ssr/attributeBuilder.ts +2 -2
  130. package/lib/server/ssr/cmsSSRProcessor.ts +1 -2
  131. package/lib/server/ssr/errorOverlay.ts +1 -1
  132. package/lib/server/ssr/htmlGenerator.nonce.test.ts +6 -5
  133. package/lib/server/ssr/htmlGenerator.test.ts +0 -1
  134. package/lib/server/ssr/htmlGenerator.ts +25 -9
  135. package/lib/server/ssr/imageMetadata.ts +2 -2
  136. package/lib/server/ssr/jsCollector.test.ts +5 -5
  137. package/lib/server/ssr/liveReloadIntegration.test.ts +7 -8
  138. package/lib/server/ssr/ssrRenderer.branches.test.ts +9 -9
  139. package/lib/server/ssr/ssrRenderer.test.ts +150 -15
  140. package/lib/server/ssr/ssrRenderer.ts +218 -40
  141. package/lib/server/ssrRenderer.test.ts +6 -6
  142. package/lib/server/utils/jsonLineMapper.ts +7 -7
  143. package/lib/server/validateStyleCoverage.ts +0 -1
  144. package/lib/server/websocketManager.ts +12 -0
  145. package/lib/shared/breakpoints.test.ts +5 -5
  146. package/lib/shared/cmsQuery.test.ts +81 -0
  147. package/lib/shared/cmsQuery.ts +92 -0
  148. package/lib/shared/cmsQueryParser.ts +11 -7
  149. package/lib/shared/colorConversions.ts +9 -9
  150. package/lib/shared/colorVariableUtils.test.ts +22 -0
  151. package/lib/shared/colorVariableUtils.ts +19 -5
  152. package/lib/shared/constants.ts +4 -0
  153. package/lib/shared/cssGeneration.test.ts +33 -0
  154. package/lib/shared/cssGeneration.ts +50 -35
  155. package/lib/shared/cssProperties.test.ts +64 -64
  156. package/lib/shared/cssProperties.ts +2 -2
  157. package/lib/shared/elementClassName.ts +2 -2
  158. package/lib/shared/errorLogger.test.ts +12 -12
  159. package/lib/shared/expressionEvaluator.test.ts +27 -1
  160. package/lib/shared/expressionEvaluator.ts +9 -0
  161. package/lib/shared/fontLoader.test.ts +13 -13
  162. package/lib/shared/fontLoader.ts +2 -2
  163. package/lib/shared/gradientUtils.test.ts +2 -2
  164. package/lib/shared/gradientUtils.ts +15 -8
  165. package/lib/shared/hrefRefs.test.ts +2 -2
  166. package/lib/shared/hrefRefs.ts +1 -1
  167. package/lib/shared/i18n.test.ts +3 -3
  168. package/lib/shared/i18n.ts +5 -4
  169. package/lib/shared/index.ts +29 -0
  170. package/lib/shared/inlineSvgStyleRules.ts +12 -9
  171. package/lib/shared/interactiveStyleMappings.test.ts +21 -21
  172. package/lib/shared/interactiveStyleMappings.ts +2 -8
  173. package/lib/shared/interactiveStyles.test.ts +3 -1
  174. package/lib/shared/itemTemplateUtils.test.ts +5 -5
  175. package/lib/shared/itemTemplateUtils.ts +9 -5
  176. package/lib/shared/jsonRepair.ts +8 -8
  177. package/lib/shared/libraryLoader.test.ts +6 -6
  178. package/lib/shared/linkUtils.ts +1 -1
  179. package/lib/shared/logger.test.ts +66 -0
  180. package/lib/shared/logger.ts +94 -0
  181. package/lib/shared/markdown.ts +25 -0
  182. package/lib/shared/nodeUtils.test.ts +13 -9
  183. package/lib/shared/nodeUtils.ts +27 -4
  184. package/lib/shared/pathSecurity.ts +1 -1
  185. package/lib/shared/pathUtils.ts +1 -2
  186. package/lib/shared/paths/PathConverter.ts +3 -3
  187. package/lib/shared/paths/PathUtils.ts +4 -3
  188. package/lib/shared/paths/PathValidator.ts +1 -1
  189. package/lib/shared/permissions.test.ts +168 -0
  190. package/lib/shared/permissions.ts +162 -0
  191. package/lib/shared/propResolver.test.ts +1 -1
  192. package/lib/shared/propResolver.ts +1 -1
  193. package/lib/shared/registry/BaseNodeTypeRegistry.test.ts +5 -3
  194. package/lib/shared/registry/ClientRegistry.ts +0 -1
  195. package/lib/shared/registry/ComponentRegistry.test.ts +3 -3
  196. package/lib/shared/registry/ComponentRegistry.ts +6 -1
  197. package/lib/shared/registry/NodeTypeDefinition.ts +2 -2
  198. package/lib/shared/registry/SSRRegistry.ts +0 -1
  199. package/lib/shared/registry/fieldPresets.ts +3 -1
  200. package/lib/shared/registry/nodeTypes/CustomNodeType.ts +103 -0
  201. package/lib/shared/registry/nodeTypes/HtmlNodeType.ts +1 -1
  202. package/lib/shared/registry/nodeTypes/IslandNodeType.ts +129 -0
  203. package/lib/shared/registry/nodeTypes/ListNodeType.ts +43 -7
  204. package/lib/shared/registry/nodeTypes/MarkdownNodeType.ts +78 -0
  205. package/lib/shared/registry/nodeTypes/SlotMarkerType.ts +6 -1
  206. package/lib/shared/registry/nodeTypes/index.ts +16 -1
  207. package/lib/shared/responsiveScaling.test.ts +1 -3
  208. package/lib/shared/responsiveScaling.ts +6 -5
  209. package/lib/shared/responsiveStyleUtils.test.ts +0 -1
  210. package/lib/shared/richtext/htmlToTiptap.test.ts +116 -116
  211. package/lib/shared/richtext/htmlToTiptap.ts +1 -1
  212. package/lib/shared/styleNodeUtils.ts +17 -14
  213. package/lib/shared/tailwindThemeScale.ts +256 -0
  214. package/lib/shared/themeDefaults.test.ts +0 -3
  215. package/lib/shared/tree/PathBuilder.test.ts +1 -7
  216. package/lib/shared/tree/PathBuilder.ts +15 -13
  217. package/lib/shared/treePathUtils.test.ts +49 -2
  218. package/lib/shared/treePathUtils.ts +40 -4
  219. package/lib/shared/types/api.ts +105 -7
  220. package/lib/shared/types/cms.test.ts +34 -0
  221. package/lib/shared/types/cms.ts +65 -13
  222. package/lib/shared/types/components.ts +24 -0
  223. package/lib/shared/types/errors.test.ts +1 -1
  224. package/lib/shared/types/index.ts +23 -0
  225. package/lib/shared/types/permissions.ts +139 -0
  226. package/lib/shared/types/variables.ts +3 -3
  227. package/lib/shared/utilityClassConfig.ts +219 -0
  228. package/lib/shared/utilityClassMapper.durability.test.ts +117 -0
  229. package/lib/shared/utilityClassMapper.test.ts +401 -26
  230. package/lib/shared/utilityClassMapper.ts +193 -29
  231. package/lib/shared/utilityClassNames.test.ts +38 -0
  232. package/lib/shared/utilityClassNames.ts +301 -23
  233. package/lib/shared/validation/index.ts +1 -0
  234. package/lib/shared/validation/permissionsValidators.test.ts +49 -0
  235. package/lib/shared/validation/permissionsValidators.ts +49 -0
  236. package/lib/shared/validation/propValidator.test.ts +1 -1
  237. package/lib/shared/validation/propValidator.ts +1 -1
  238. package/lib/shared/validation/schemas.test.ts +41 -0
  239. package/lib/shared/validation/schemas.ts +159 -13
  240. package/lib/shared/validation/validators.test.ts +2 -2
  241. package/lib/shared/viewportUnits.test.ts +13 -0
  242. package/lib/shared/viewportUnits.ts +12 -5
  243. package/lib/test-utils/factories/ConsoleMockFactory.ts +7 -7
  244. package/lib/test-utils/factories/DomMockFactory.ts +10 -4
  245. package/lib/test-utils/factories/ServerMockFactory.ts +1 -1
  246. package/lib/test-utils/factories/StoreMockFactory.ts +5 -5
  247. package/lib/test-utils/mockFactories.ts +1 -1
  248. package/lib/test-utils/mocks.ts +3 -3
  249. package/package.json +3 -5
  250. package/scripts/build-for-publish.mjs +2 -4
  251. package/scripts/build-meno-filter.ts +3 -3
  252. package/tsconfig.json +1 -0
  253. package/vite.config.ts +1 -1
  254. package/build-next.ts +0 -1374
  255. package/build-static.test.ts +0 -453
  256. package/build-static.ts +0 -1072
  257. package/dist/build-static.js +0 -37
  258. package/dist/chunks/chunk-2FN4UOVO.js +0 -6465
  259. package/dist/chunks/chunk-2FN4UOVO.js.map +0 -7
  260. package/dist/chunks/chunk-5ETZFREW.js.map +0 -7
  261. package/dist/chunks/chunk-7E4IF5L7.js +0 -245
  262. package/dist/chunks/chunk-7E4IF5L7.js.map +0 -7
  263. package/dist/chunks/chunk-7HWQUVTU.js.map +0 -7
  264. package/dist/chunks/chunk-AE3QK5QW.js.map +0 -7
  265. package/dist/chunks/chunk-F6KTJYGV.js +0 -322
  266. package/dist/chunks/chunk-F6KTJYGV.js.map +0 -7
  267. package/dist/chunks/chunk-FZITJSSS.js.map +0 -7
  268. package/dist/chunks/chunk-GSYYA5GX.js +0 -77
  269. package/dist/chunks/chunk-GSYYA5GX.js.map +0 -7
  270. package/dist/chunks/chunk-HIZMY3EP.js.map +0 -7
  271. package/dist/chunks/chunk-I2WEGYA7.js +0 -424
  272. package/dist/chunks/chunk-I2WEGYA7.js.map +0 -7
  273. package/dist/chunks/chunk-JNO3CNLJ.js +0 -464
  274. package/dist/chunks/chunk-JNO3CNLJ.js.map +0 -7
  275. package/dist/chunks/chunk-NVRBTSQG.js.map +0 -7
  276. package/dist/chunks/chunk-Q4OBWKXG.js +0 -1143
  277. package/dist/chunks/chunk-Q4OBWKXG.js.map +0 -7
  278. package/dist/chunks/chunk-QTE32Y53.js +0 -3829
  279. package/dist/chunks/chunk-QTE32Y53.js.map +0 -7
  280. package/dist/chunks/configService-PRJZF7Y6.js +0 -14
  281. package/dist/chunks/configService-PRJZF7Y6.js.map +0 -7
  282. package/dist/chunks/constants-KIQEYMAM.js +0 -46
  283. package/dist/chunks/constants-KIQEYMAM.js.map +0 -7
  284. package/dist/chunks/fs-ZI5JEU7V.js.map +0 -7
  285. package/dist/entries/server-router.js +0 -62
  286. package/dist/entries/server-router.js.map +0 -7
  287. package/entries/server-router.tsx +0 -75
  288. package/lib/server/providers/fileSystemPageProvider.test.ts +0 -84
  289. package/lib/server/providers/fileSystemPageProvider.ts +0 -179
  290. package/lib/server/webflow/buildWebflow.ts +0 -623
  291. package/lib/server/webflow/index.ts +0 -23
  292. package/lib/server/webflow/nodeToWebflow.test.ts +0 -3102
  293. package/lib/server/webflow/nodeToWebflow.ts +0 -2372
  294. package/lib/server/webflow/styleMapper.test.ts +0 -348
  295. package/lib/server/webflow/styleMapper.ts +0 -687
  296. package/lib/server/webflow/templateWrapper.ts +0 -49
  297. package/lib/server/webflow/types.ts +0 -389
  298. /package/dist/{build-static.js.map → chunks/fs-G3ANWEFP.js.map} +0 -0
package/bin/cli.ts CHANGED
@@ -1,23 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * meno CLI
4
- * Commands: dev, build, init
4
+ *
5
+ * The bespoke JSON renderer (`meno dev`/`build`/`serve`) has been retired — Meno
6
+ * targets Astro exclusively now. The only remaining command is `init` (scaffold a
7
+ * project). To run/build a project, convert it to meno-astro and use the Astro
8
+ * toolchain (`@meno/studio` in the editor, or `astro dev`/`astro build`).
5
9
  */
6
10
 
7
- import { resolve, join } from 'path';
8
- import { existsSync, mkdirSync, writeFileSync, cpSync, readFileSync } from 'fs';
9
- import { setProjectRoot } from '../lib/server/projectContext';
11
+ import { resolve, join } from 'node:path';
12
+ import { existsSync, mkdirSync, writeFileSync, cpSync } from 'node:fs';
10
13
  import { migrateI18nConfig } from '../lib/shared/i18n';
11
14
  import { syncNetlifyLocale404Block } from '../lib/shared/netlifyLocale404';
12
- import { generateBuildErrorPage, type BuildErrorsData } from '../lib/server/ssr/buildErrorOverlay';
13
- import { createRuntimeServer, serveFile, fileExists as runtimeFileExists } from '../lib/server/runtime';
14
15
 
15
16
  const args = process.argv.slice(2);
16
17
  const command = args[0];
17
18
 
18
19
  function printHelp() {
19
20
  console.log(`
20
- meno - Visual editor for JSON-based pages
21
+ meno - Visual editor for websites (meno-astro)
21
22
 
22
23
  Requirements:
23
24
  - Bun or Node.js 18+
@@ -26,204 +27,20 @@ Usage:
26
27
  meno <command> [options]
27
28
 
28
29
  Commands:
29
- dev Start development server with hot reload
30
- build Build static HTML files for production
31
- serve Serve built files from ./dist on port 8080
32
30
  init Initialize a new project
33
31
 
34
- Options:
35
- build --dev Include draft pages in build (for local preview)
32
+ Note:
33
+ The legacy JSON runtime (dev/build/serve) has been retired. Convert a JSON
34
+ project to meno-astro and use the Astro toolchain instead.
36
35
 
37
36
  Examples:
38
- meno dev Start dev server in current directory
39
- meno build Build static files to ./dist (excludes drafts)
40
- meno build --dev Build including draft pages
41
- meno serve Serve built files on port 8080
42
37
  meno init my-project Create new project in ./my-project
43
38
  `);
44
39
  }
45
40
 
46
- // Parse _headers file (Netlify/Cloudflare format)
47
- function parseHeadersFile(distPath: string): Map<string, Record<string, string>> {
48
- const headersPath = join(distPath, '_headers');
49
- const headers = new Map<string, Record<string, string>>();
50
-
51
- if (!existsSync(headersPath)) return headers;
52
-
53
- const content = readFileSync(headersPath, 'utf-8');
54
- let currentPath = '';
55
-
56
- for (const line of content.split('\n')) {
57
- const trimmed = line.trim();
58
- if (!trimmed || trimmed.startsWith('#')) continue;
59
-
60
- if (!line.startsWith(' ') && !line.startsWith('\t')) {
61
- // Path line
62
- currentPath = trimmed;
63
- if (!headers.has(currentPath)) {
64
- headers.set(currentPath, {});
65
- }
66
- } else if (currentPath && trimmed.includes(':')) {
67
- // Header line
68
- const colonIndex = trimmed.indexOf(':');
69
- const name = trimmed.substring(0, colonIndex).trim();
70
- const value = trimmed.substring(colonIndex + 1).trim();
71
- headers.get(currentPath)![name] = value;
72
- }
73
- }
74
-
75
- return headers;
76
- }
77
-
78
- // Get headers matching a pathname
79
- function getMatchingHeaders(pathname: string, headersMap: Map<string, Record<string, string>>): Record<string, string> {
80
- const result: Record<string, string> = {};
81
-
82
- headersMap.forEach((headers, pattern) => {
83
- if (pattern === pathname || pattern === '/*') {
84
- Object.assign(result, headers);
85
- } else if (pattern.endsWith('/*')) {
86
- const prefix = pattern.slice(0, -1);
87
- if (pathname.startsWith(prefix)) {
88
- Object.assign(result, headers);
89
- }
90
- }
91
- });
92
-
93
- return result;
94
- }
95
-
96
- // Start static file server on port 8080 (non-blocking)
97
- async function startStaticServer(distPath: string) {
98
- const { SERVE_PORT } = await import('../lib/shared/constants');
99
-
100
- // Parse _headers file once on startup
101
- const headersMap = parseHeadersFile(distPath);
102
-
103
- const server = await createRuntimeServer({
104
- port: SERVE_PORT,
105
- hostname: 'localhost',
106
- async fetch(req: Request) {
107
- const url = new URL(req.url);
108
- let pathname = url.pathname;
109
-
110
- // Check for build errors and show overlay (except for _errors.json itself)
111
- if (pathname !== '/_errors.json') {
112
- const errorsPath = join(distPath, '_errors.json');
113
- if (existsSync(errorsPath)) {
114
- try {
115
- const errorsData: BuildErrorsData = JSON.parse(readFileSync(errorsPath, 'utf-8'));
116
- return new Response(generateBuildErrorPage(errorsData), {
117
- headers: { 'Content-Type': 'text/html; charset=utf-8' },
118
- });
119
- } catch {
120
- // If we can't parse errors file, continue normally
121
- }
122
- }
123
- }
124
-
125
- // Default to index.html for root
126
- if (pathname === '/') {
127
- pathname = '/index.html';
128
- }
129
-
130
- // Get custom headers for this path
131
- const customHeaders = getMatchingHeaders(pathname, headersMap);
132
-
133
- // Try to serve the file
134
- const filePath = join(distPath, pathname);
135
-
136
- // Check if file exists and serve it
137
- if (await runtimeFileExists(filePath)) {
138
- return await serveFile(filePath, customHeaders);
139
- }
140
-
141
- // Try with .html extension for clean URLs
142
- const htmlPath = filePath.endsWith('.html') ? filePath : `${filePath}.html`;
143
- if (await runtimeFileExists(htmlPath)) {
144
- return await serveFile(htmlPath, customHeaders);
145
- }
146
-
147
- // Try index.html in directory
148
- const indexPath = join(filePath, 'index.html');
149
- if (await runtimeFileExists(indexPath)) {
150
- return await serveFile(indexPath, customHeaders);
151
- }
152
-
153
- return new Response('Not Found', { status: 404 });
154
- },
155
- });
156
-
157
- return server;
158
- }
159
-
160
- async function runDev() {
161
- const projectRoot = process.cwd();
162
-
163
- // Validate project structure
164
- if (!existsSync(join(projectRoot, 'pages'))) {
165
- console.error('❌ No pages directory found. Are you in a valid project directory?');
166
- console.error(' Run "meno init <project-name>" to create a new project.');
167
- process.exit(1);
168
- }
169
-
170
- // Set project root for path resolution
171
- setProjectRoot(projectRoot);
172
-
173
- console.log(`📁 Project root: ${projectRoot}`);
174
-
175
- // Start static server on 8080 if dist exists
176
- const distPath = join(projectRoot, 'dist');
177
- if (existsSync(distPath)) {
178
- const staticServer = await startStaticServer(distPath);
179
- console.log(`🚀 Static server running at http://localhost:${staticServer.port}`);
180
- }
181
-
182
- // Import and run the dev server (it handles all initialization internally)
183
- await import('../entries/server-router');
184
- }
185
-
186
- async function runBuild(isDev: boolean = false) {
187
- const projectRoot = process.cwd();
188
-
189
- // Validate project structure
190
- if (!existsSync(join(projectRoot, 'pages'))) {
191
- console.error('❌ No pages directory found. Are you in a valid project directory?');
192
- process.exit(1);
193
- }
194
-
195
- // Set project root for path resolution
196
- setProjectRoot(projectRoot);
197
-
198
- // Set dev mode environment variable (drafts are built in dev mode)
199
- if (isDev) {
200
- process.env.MENO_DEV_BUILD = 'true';
201
- }
202
-
203
- console.log(`📁 Building project: ${projectRoot}${isDev ? ' (dev mode - including drafts)' : ''}`);
204
-
205
- // Import and run build
206
- const { buildStaticPages } = await import('../build-static.ts');
207
- await buildStaticPages();
208
- }
209
-
210
- async function runServe() {
211
- const projectRoot = process.cwd();
212
- const distPath = join(projectRoot, 'dist');
213
-
214
- // Validate dist directory exists
215
- if (!existsSync(distPath)) {
216
- console.error('❌ No dist directory found. Run "meno build" first.');
217
- process.exit(1);
218
- }
219
-
220
- console.log(`📁 Serving built files from: ${distPath}`);
221
- const server = await startStaticServer(distPath);
222
- console.log(`🚀 Static server running at http://localhost:${server.port}`);
223
-
224
- // Keep the process alive
225
- await new Promise(() => {});
226
- }
41
+ const RETIRED_NOTICE = `The legacy JSON "${command}" command has been retired.
42
+ Meno targets Astro exclusively now. Convert this project to meno-astro and use the
43
+ Astro toolchain instead (open it in @meno/studio, or run "astro dev" / "astro build").`;
227
44
 
228
45
  async function runInit(projectName?: string) {
229
46
  if (!projectName) {
@@ -440,17 +257,14 @@ command = "bun install && bun run build"
440
257
 
441
258
  // Main
442
259
  switch (command) {
443
- case 'dev':
444
- runDev();
260
+ case 'init':
261
+ runInit(args[1]);
445
262
  break;
263
+ case 'dev':
446
264
  case 'build':
447
- runBuild(args.includes('--dev'));
448
- break;
449
265
  case 'serve':
450
- runServe();
451
- break;
452
- case 'init':
453
- runInit(args[1]);
266
+ console.error(RETIRED_NOTICE);
267
+ process.exit(1);
454
268
  break;
455
269
  case '--help':
456
270
  case '-h':
package/build-astro.ts CHANGED
@@ -4,11 +4,10 @@
4
4
  * with a shared layout, global CSS, and optional CMS content collections.
5
5
  */
6
6
 
7
- import { existsSync, readdirSync, mkdirSync, rmSync, statSync, copyFileSync, writeFileSync } from 'fs';
8
- import { writeFile, readFile } from 'fs/promises';
9
- import { join } from 'path';
10
- import { createHash } from 'crypto';
11
- import { inspect, minifyJS as runtimeMinifyJS } from './lib/server/runtime';
7
+ import { existsSync, readdirSync, mkdirSync, rmSync, statSync, copyFileSync, writeFileSync } from 'node:fs';
8
+ import { writeFile, readFile } from 'node:fs/promises';
9
+ import { join } from 'node:path';
10
+ import { createHash } from 'node:crypto';
12
11
  import {
13
12
  loadJSONFile,
14
13
  loadComponentDirectory,
@@ -16,8 +15,6 @@ import {
16
15
  parseJSON,
17
16
  loadI18nConfig,
18
17
  } from './lib/server/jsonLoader';
19
- import { generateSSRHTML } from './lib/server/ssrRenderer';
20
- import type { SSRHTMLResult } from './lib/server/ssr/htmlGenerator';
21
18
  import { projectPaths } from './lib/server/projectContext';
22
19
  import { loadProjectConfig, generateFontCSS, generateFontPreloadTags } from './lib/shared/fontLoader';
23
20
  import { FileSystemCMSProvider } from './lib/server/providers/fileSystemCMSProvider';
@@ -28,10 +25,9 @@ import { tiptapToHtml } from './lib/shared/richtext/tiptapToHtml';
28
25
  import { isTiptapDocument } from './lib/shared/richtext/types';
29
26
  import type { ComponentDefinition, JSONPage, CMSSchema, CMSItem, I18nConfig } from './lib/shared/types';
30
27
  import type { CMSFieldDefinition } from './lib/shared/types/cms';
31
- import { isItemDraftForLocale } from './lib/shared/types';
32
28
  import { CMS_DRAFT_SUFFIX } from './lib/shared/pathSecurity';
33
29
  import type { SlugMap } from './lib/shared/slugTranslator';
34
- import { renderPageSSR } from './lib/server/ssr/ssrRenderer';
30
+ import { type PreloadImage, renderPageSSR } from './lib/server/ssr/ssrRenderer';
35
31
  import { generateThemeColorVariablesCSS, generateVariablesCSS } from './lib/server/cssGenerator';
36
32
  import { colorService } from './lib/server/services/ColorService';
37
33
  import { variableService } from './lib/server/services/VariableService';
@@ -106,7 +102,7 @@ function isCMSPage(pageData: JSONPage): boolean {
106
102
  /**
107
103
  * Build URL path for a CMS item based on the URL pattern
108
104
  */
109
- function buildCMSItemPath(
105
+ function _buildCMSItemPath(
110
106
  urlPattern: string,
111
107
  item: CMSItem,
112
108
  slugField: string,
@@ -299,8 +295,8 @@ function computeCmsConsumerComponents(components: Record<string, ComponentDefini
299
295
  function buildCollectionUrlExpr(schema: CMSSchema): string {
300
296
  const slugField = schema.slugField || 'slug';
301
297
  const pattern = schema.urlPattern || `/${schema.id}/{{slug}}`;
302
- const body = pattern.replace(/\{\{[^}]+\}\}/, '${e.data.' + slugField + ' ?? e.id}');
303
- return '`' + body + '`';
298
+ const body = pattern.replace(/\{\{[^}]+\}\}/, `\${e.data.${slugField} ?? e.id}`);
299
+ return `\`${body}\``;
304
300
  }
305
301
 
306
302
  // ---------------------------------------------------------------------------
@@ -388,7 +384,7 @@ import BaseLayout from '${importPath}';
388
384
  // Main export
389
385
  // ---------------------------------------------------------------------------
390
386
 
391
- export async function buildAstroProject(projectRoot?: string, outputDir?: string): Promise<AstroBuildStats> {
387
+ export async function buildAstroProject(_projectRoot?: string, outputDir?: string): Promise<AstroBuildStats> {
392
388
  // ----------------------------------------------------------
393
389
  // 1. Setup: load project configuration
394
390
  // ----------------------------------------------------------
@@ -510,7 +506,7 @@ export async function buildAstroProject(projectRoot?: string, outputDir?: string
510
506
  componentCSS?: string;
511
507
  locale: string;
512
508
  interactiveStylesMap: Map<string, InteractiveStyles>;
513
- preloadImages: any[];
509
+ preloadImages: PreloadImage[];
514
510
  neededCollections: Set<string>;
515
511
  ssrFallbackCollector?: Map<string, string>;
516
512
  processedRawHtmlCollector?: Map<string, string>;
@@ -591,7 +587,7 @@ export async function buildAstroProject(projectRoot?: string, outputDir?: string
591
587
 
592
588
  // Compute URL path
593
589
  let slug: string;
594
- if (slugs && slugs[locale]) {
590
+ if (slugs?.[locale]) {
595
591
  // Slugs may be authored with a leading slash (e.g. "/blog" from the
596
592
  // page-rename flow). Normalize to the bare form the rest of the
597
593
  // pipeline expects — matches buildPageUrlForLocale(). A leading slash
@@ -632,8 +628,8 @@ export async function buildAstroProject(projectRoot?: string, outputDir?: string
632
628
 
633
629
  processRenderResult(result, urlPath, astroFilePath, fileDepth, pageData, pageName, false);
634
630
  }
635
- } catch (error: any) {
636
- console.error(` Error rendering ${basePath}:`, error?.message || error);
631
+ } catch (error) {
632
+ console.error(` Error rendering ${basePath}:`, error instanceof Error ? error.message : error);
637
633
  errorCount++;
638
634
  }
639
635
  }
@@ -750,6 +746,10 @@ export async function buildAstroProject(projectRoot?: string, outputDir?: string
750
746
  const cmsSchema = pageData.meta!.cms as CMSSchema;
751
747
  templateSchemas.push(cmsSchema);
752
748
 
749
+ // A data-only collection (no urlPattern) has no per-item route — skip page/route
750
+ // generation. It is still a content collection usable in list bindings.
751
+ if (!cmsSchema.urlPattern) continue;
752
+
753
753
  // Count items for stats
754
754
  const items = await cmsService.queryItems({ collection: cmsSchema.id });
755
755
  const itemCount = items.length;
@@ -852,8 +852,8 @@ export async function buildAstroProject(projectRoot?: string, outputDir?: string
852
852
  }
853
853
 
854
854
  cmsPageCount += itemCount * i18nConfig.locales.length;
855
- } catch (error: any) {
856
- console.error(` Error processing template ${file}:`, error?.message || error);
855
+ } catch (error) {
856
+ console.error(` Error processing template ${file}:`, error instanceof Error ? error.message : error);
857
857
  errorCount++;
858
858
  }
859
859
  }
@@ -955,7 +955,7 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
955
955
  // onto each component's interface and forward them from hosts that
956
956
  // declare the same prop. See `normalizeOrphanTemplateProps` for details.
957
957
  const emittableComponents = normalizeOrphanTemplateProps(globalComponents);
958
- let componentFileCount = 0;
958
+ let _componentFileCount = 0;
959
959
  for (const [compName, compDef] of Object.entries(emittableComponents)) {
960
960
  try {
961
961
  const astroContent = emitAstroComponent(
@@ -973,9 +973,11 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
973
973
  },
974
974
  );
975
975
  await writeFile(join(componentsOutDir, `${compName}.astro`), astroContent, 'utf-8');
976
- componentFileCount++;
977
- } catch (error: any) {
978
- console.warn(` Warning: could not generate component ${compName}: ${error?.message}`);
976
+ _componentFileCount++;
977
+ } catch (error) {
978
+ console.warn(
979
+ ` Warning: could not generate component ${compName}: ${error instanceof Error ? error.message : String(error)}`,
980
+ );
979
981
  }
980
982
  }
981
983
  // ----------------------------------------------------------
@@ -1026,10 +1028,10 @@ const { title, meta = '', scripts = [], locale = 'en', theme = '${themeConfig.de
1026
1028
  processedRawHtml: result.processedRawHtmlCollector,
1027
1029
  remConfig: remConversionConfig,
1028
1030
  });
1029
- } catch (error: any) {
1031
+ } catch (error) {
1030
1032
  // Fallback to SSR HTML if component emission fails — needs page-level script
1031
1033
  console.warn(
1032
- ` Warning: component emission failed for ${result.urlPath}, using SSR fallback: ${error?.message}`,
1034
+ ` Warning: component emission failed for ${result.urlPath}, using SSR fallback: ${error instanceof Error ? error.message : String(error)}`,
1033
1035
  );
1034
1036
  scriptPaths = writePageScript(result.javascript, scriptsDir);
1035
1037
  astroContent = buildSSRFallbackPage(result, importPath, fontPreloads, libraryTags, defaultTheme, scriptPaths);
@@ -1117,8 +1119,10 @@ export const GET: APIRoute = () => {
1117
1119
  }
1118
1120
 
1119
1121
  await writeFile(join(collectionDir, itemFile), JSON.stringify(resolved, null, 2), 'utf-8');
1120
- } catch (err: any) {
1121
- console.warn(` Warning: could not process CMS item ${itemFile}: ${err?.message}`);
1122
+ } catch (err) {
1123
+ console.warn(
1124
+ ` Warning: could not process CMS item ${itemFile}: ${err instanceof Error ? err.message : String(err)}`,
1125
+ );
1122
1126
  }
1123
1127
  }
1124
1128
  }
package/dist/bin/cli.js CHANGED
@@ -1,31 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- generateBuildErrorPage
4
- } from "../chunks/chunk-F6KTJYGV.js";
5
- import {
6
- createRuntimeServer,
7
- setProjectRoot
8
- } from "../chunks/chunk-JNO3CNLJ.js";
9
- import {
10
- fileExists,
11
- serveFile
12
- } from "../chunks/chunk-FZITJSSS.js";
13
2
  import {
14
3
  syncNetlifyLocale404Block
15
4
  } from "../chunks/chunk-2AR55GYH.js";
16
5
  import {
17
6
  migrateI18nConfig
18
- } from "../chunks/chunk-3XER4E5W.js";
7
+ } from "../chunks/chunk-4ZRU52J2.js";
19
8
  import "../chunks/chunk-KSBZ2L7C.js";
20
9
 
21
10
  // bin/cli.ts
22
- import { resolve, join } from "path";
23
- import { existsSync, mkdirSync, writeFileSync, cpSync, readFileSync } from "fs";
11
+ import { resolve, join } from "node:path";
12
+ import { existsSync, mkdirSync, writeFileSync, cpSync } from "node:fs";
24
13
  var args = process.argv.slice(2);
25
14
  var command = args[0];
26
15
  function printHelp() {
27
16
  console.log(`
28
- meno - Visual editor for JSON-based pages
17
+ meno - Visual editor for websites (meno-astro)
29
18
 
30
19
  Requirements:
31
20
  - Bun or Node.js 18+
@@ -34,144 +23,19 @@ Usage:
34
23
  meno <command> [options]
35
24
 
36
25
  Commands:
37
- dev Start development server with hot reload
38
- build Build static HTML files for production
39
- serve Serve built files from ./dist on port 8080
40
26
  init Initialize a new project
41
27
 
42
- Options:
43
- build --dev Include draft pages in build (for local preview)
28
+ Note:
29
+ The legacy JSON runtime (dev/build/serve) has been retired. Convert a JSON
30
+ project to meno-astro and use the Astro toolchain instead.
44
31
 
45
32
  Examples:
46
- meno dev Start dev server in current directory
47
- meno build Build static files to ./dist (excludes drafts)
48
- meno build --dev Build including draft pages
49
- meno serve Serve built files on port 8080
50
33
  meno init my-project Create new project in ./my-project
51
34
  `);
52
35
  }
53
- function parseHeadersFile(distPath) {
54
- const headersPath = join(distPath, "_headers");
55
- const headers = /* @__PURE__ */ new Map();
56
- if (!existsSync(headersPath)) return headers;
57
- const content = readFileSync(headersPath, "utf-8");
58
- let currentPath = "";
59
- for (const line of content.split("\n")) {
60
- const trimmed = line.trim();
61
- if (!trimmed || trimmed.startsWith("#")) continue;
62
- if (!line.startsWith(" ") && !line.startsWith(" ")) {
63
- currentPath = trimmed;
64
- if (!headers.has(currentPath)) {
65
- headers.set(currentPath, {});
66
- }
67
- } else if (currentPath && trimmed.includes(":")) {
68
- const colonIndex = trimmed.indexOf(":");
69
- const name = trimmed.substring(0, colonIndex).trim();
70
- const value = trimmed.substring(colonIndex + 1).trim();
71
- headers.get(currentPath)[name] = value;
72
- }
73
- }
74
- return headers;
75
- }
76
- function getMatchingHeaders(pathname, headersMap) {
77
- const result = {};
78
- headersMap.forEach((headers, pattern) => {
79
- if (pattern === pathname || pattern === "/*") {
80
- Object.assign(result, headers);
81
- } else if (pattern.endsWith("/*")) {
82
- const prefix = pattern.slice(0, -1);
83
- if (pathname.startsWith(prefix)) {
84
- Object.assign(result, headers);
85
- }
86
- }
87
- });
88
- return result;
89
- }
90
- async function startStaticServer(distPath) {
91
- const { SERVE_PORT } = await import("../chunks/constants-KIQEYMAM.js");
92
- const headersMap = parseHeadersFile(distPath);
93
- const server = await createRuntimeServer({
94
- port: SERVE_PORT,
95
- hostname: "localhost",
96
- async fetch(req) {
97
- const url = new URL(req.url);
98
- let pathname = url.pathname;
99
- if (pathname !== "/_errors.json") {
100
- const errorsPath = join(distPath, "_errors.json");
101
- if (existsSync(errorsPath)) {
102
- try {
103
- const errorsData = JSON.parse(readFileSync(errorsPath, "utf-8"));
104
- return new Response(generateBuildErrorPage(errorsData), {
105
- headers: { "Content-Type": "text/html; charset=utf-8" }
106
- });
107
- } catch {
108
- }
109
- }
110
- }
111
- if (pathname === "/") {
112
- pathname = "/index.html";
113
- }
114
- const customHeaders = getMatchingHeaders(pathname, headersMap);
115
- const filePath = join(distPath, pathname);
116
- if (await fileExists(filePath)) {
117
- return await serveFile(filePath, customHeaders);
118
- }
119
- const htmlPath = filePath.endsWith(".html") ? filePath : `${filePath}.html`;
120
- if (await fileExists(htmlPath)) {
121
- return await serveFile(htmlPath, customHeaders);
122
- }
123
- const indexPath = join(filePath, "index.html");
124
- if (await fileExists(indexPath)) {
125
- return await serveFile(indexPath, customHeaders);
126
- }
127
- return new Response("Not Found", { status: 404 });
128
- }
129
- });
130
- return server;
131
- }
132
- async function runDev() {
133
- const projectRoot = process.cwd();
134
- if (!existsSync(join(projectRoot, "pages"))) {
135
- console.error("\u274C No pages directory found. Are you in a valid project directory?");
136
- console.error(' Run "meno init <project-name>" to create a new project.');
137
- process.exit(1);
138
- }
139
- setProjectRoot(projectRoot);
140
- console.log(`\u{1F4C1} Project root: ${projectRoot}`);
141
- const distPath = join(projectRoot, "dist");
142
- if (existsSync(distPath)) {
143
- const staticServer = await startStaticServer(distPath);
144
- console.log(`\u{1F680} Static server running at http://localhost:${staticServer.port}`);
145
- }
146
- await import("../entries/server-router.js");
147
- }
148
- async function runBuild(isDev = false) {
149
- const projectRoot = process.cwd();
150
- if (!existsSync(join(projectRoot, "pages"))) {
151
- console.error("\u274C No pages directory found. Are you in a valid project directory?");
152
- process.exit(1);
153
- }
154
- setProjectRoot(projectRoot);
155
- if (isDev) {
156
- process.env.MENO_DEV_BUILD = "true";
157
- }
158
- console.log(`\u{1F4C1} Building project: ${projectRoot}${isDev ? " (dev mode - including drafts)" : ""}`);
159
- const { buildStaticPages } = await import("../build-static.js");
160
- await buildStaticPages();
161
- }
162
- async function runServe() {
163
- const projectRoot = process.cwd();
164
- const distPath = join(projectRoot, "dist");
165
- if (!existsSync(distPath)) {
166
- console.error('\u274C No dist directory found. Run "meno build" first.');
167
- process.exit(1);
168
- }
169
- console.log(`\u{1F4C1} Serving built files from: ${distPath}`);
170
- const server = await startStaticServer(distPath);
171
- console.log(`\u{1F680} Static server running at http://localhost:${server.port}`);
172
- await new Promise(() => {
173
- });
174
- }
36
+ var RETIRED_NOTICE = `The legacy JSON "${command}" command has been retired.
37
+ Meno targets Astro exclusively now. Convert this project to meno-astro and use the
38
+ Astro toolchain instead (open it in @meno/studio, or run "astro dev" / "astro build").`;
175
39
  async function runInit(projectName) {
176
40
  if (!projectName) {
177
41
  console.error("\u274C Please provide a project name: meno init <project-name>");
@@ -358,17 +222,14 @@ command = "bun install && bun run build"
358
222
  console.log("");
359
223
  }
360
224
  switch (command) {
361
- case "dev":
362
- runDev();
225
+ case "init":
226
+ runInit(args[1]);
363
227
  break;
228
+ case "dev":
364
229
  case "build":
365
- runBuild(args.includes("--dev"));
366
- break;
367
230
  case "serve":
368
- runServe();
369
- break;
370
- case "init":
371
- runInit(args[1]);
231
+ console.error(RETIRED_NOTICE);
232
+ process.exit(1);
372
233
  break;
373
234
  case "--help":
374
235
  case "-h":