meno-core 1.0.47 → 1.0.49
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/build-astro.ts +2 -2
- package/dist/build-static.js +7 -7
- package/dist/chunks/{chunk-UUA5LEWF.js → chunk-6IVUG7FY.js} +138 -7
- package/dist/chunks/chunk-6IVUG7FY.js.map +7 -0
- package/dist/chunks/{chunk-XSWR3QLI.js → chunk-AZQYF6KE.js} +261 -130
- package/dist/chunks/chunk-AZQYF6KE.js.map +7 -0
- package/dist/chunks/{chunk-47UNLQUU.js → chunk-CHD5UCFF.js} +57 -12
- package/dist/chunks/chunk-CHD5UCFF.js.map +7 -0
- package/dist/chunks/{chunk-FGUZOYJX.js → chunk-EQYDSPBB.js} +435 -131
- package/dist/chunks/chunk-EQYDSPBB.js.map +7 -0
- package/dist/chunks/{chunk-IF3RATBY.js → chunk-H4JSCDNW.js} +2 -2
- package/dist/chunks/{chunk-KITQJYZV.js → chunk-J23ZX5AP.js} +40 -4
- package/dist/chunks/chunk-J23ZX5AP.js.map +7 -0
- package/dist/chunks/{chunk-LJFB5EBT.js → chunk-JER5NQVM.js} +5 -5
- package/dist/chunks/{chunk-ZTKHJQ2Z.js → chunk-KPU2XHOS.js} +5 -2
- package/dist/chunks/{chunk-ZTKHJQ2Z.js.map → chunk-KPU2XHOS.js.map} +2 -2
- package/dist/chunks/{chunk-BCLGRZ3U.js → chunk-LKAGAQ3M.js} +2 -2
- package/dist/chunks/{chunk-FED5MME6.js → chunk-S2CX6HFM.js} +262 -26
- package/dist/chunks/chunk-S2CX6HFM.js.map +7 -0
- package/dist/chunks/{configService-DYCUEURL.js → configService-CCA6AIDI.js} +3 -3
- package/dist/entries/server-router.js +9 -9
- package/dist/entries/server-router.js.map +2 -2
- package/dist/lib/client/index.js +64 -20
- package/dist/lib/client/index.js.map +3 -3
- package/dist/lib/server/index.js +1737 -296
- package/dist/lib/server/index.js.map +4 -4
- package/dist/lib/shared/index.js +50 -10
- package/dist/lib/shared/index.js.map +3 -3
- package/entries/server-router.tsx +6 -2
- package/lib/client/core/ComponentBuilder.test.ts +17 -0
- package/lib/client/core/ComponentBuilder.ts +25 -1
- package/lib/client/core/builders/embedBuilder.ts +15 -2
- package/lib/client/core/builders/linkNodeBuilder.ts +15 -2
- package/lib/client/core/builders/localeListBuilder.ts +17 -6
- package/lib/client/styles/StyleInjector.ts +3 -2
- package/lib/client/theme.ts +4 -4
- package/lib/server/cssGenerator.test.ts +64 -1
- package/lib/server/cssGenerator.ts +48 -9
- package/lib/server/index.ts +1 -1
- package/lib/server/jsonLoader.test.ts +0 -17
- package/lib/server/jsonLoader.ts +0 -81
- package/lib/server/providers/fileSystemCMSProvider.test.ts +163 -0
- package/lib/server/providers/fileSystemCMSProvider.ts +200 -11
- package/lib/server/routes/api/variables.ts +4 -2
- package/lib/server/routes/index.ts +1 -1
- package/lib/server/routes/pages.ts +23 -1
- package/lib/server/services/cmsService.test.ts +246 -0
- package/lib/server/services/cmsService.ts +122 -5
- package/lib/server/services/configService.ts +5 -0
- package/lib/server/ssr/attributeBuilder.ts +41 -0
- package/lib/server/ssr/htmlGenerator.test.ts +114 -2
- package/lib/server/ssr/htmlGenerator.ts +53 -6
- package/lib/server/ssr/liveReloadIntegration.test.ts +209 -0
- package/lib/server/ssr/ssrRenderer.test.ts +362 -1
- package/lib/server/ssr/ssrRenderer.ts +216 -72
- package/lib/server/utils/jsonLineMapper.test.ts +53 -1
- package/lib/server/utils/jsonLineMapper.ts +43 -3
- package/lib/server/webflow/buildWebflow.ts +343 -123
- package/lib/server/webflow/index.ts +1 -0
- package/lib/server/webflow/nodeToWebflow.test.ts +3170 -0
- package/lib/server/webflow/nodeToWebflow.ts +2141 -129
- package/lib/server/webflow/styleMapper.test.ts +389 -0
- package/lib/server/webflow/styleMapper.ts +517 -63
- package/lib/server/webflow/templateWrapper.ts +49 -0
- package/lib/server/webflow/types.ts +218 -18
- package/lib/shared/cssGeneration.test.ts +267 -1
- package/lib/shared/cssGeneration.ts +240 -18
- package/lib/shared/cssProperties.test.ts +247 -1
- package/lib/shared/cssProperties.ts +196 -6
- package/lib/shared/elementClassName.test.ts +15 -0
- package/lib/shared/elementClassName.ts +7 -3
- package/lib/shared/interfaces/contentProvider.ts +39 -6
- package/lib/shared/pathSecurity.ts +16 -0
- package/lib/shared/registry/nodeTypes/ListNodeType.ts +1 -1
- package/lib/shared/responsiveScaling.test.ts +143 -0
- package/lib/shared/responsiveScaling.ts +253 -2
- package/lib/shared/themeDefaults.test.ts +3 -3
- package/lib/shared/themeDefaults.ts +3 -3
- package/lib/shared/types/cms.ts +28 -3
- package/lib/shared/types/index.ts +2 -0
- package/lib/shared/types/variables.ts +37 -0
- package/lib/shared/utilityClassConfig.ts +3 -0
- package/lib/shared/utilityClassMapper.test.ts +123 -0
- package/lib/shared/utilityClassMapper.ts +179 -8
- package/lib/shared/validation/schemas.ts +15 -1
- package/lib/shared/validation/validators.ts +26 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-47UNLQUU.js.map +0 -7
- package/dist/chunks/chunk-FED5MME6.js.map +0 -7
- package/dist/chunks/chunk-FGUZOYJX.js.map +0 -7
- package/dist/chunks/chunk-KITQJYZV.js.map +0 -7
- package/dist/chunks/chunk-UUA5LEWF.js.map +0 -7
- package/dist/chunks/chunk-XSWR3QLI.js.map +0 -7
- /package/dist/chunks/{chunk-IF3RATBY.js.map → chunk-H4JSCDNW.js.map} +0 -0
- /package/dist/chunks/{chunk-LJFB5EBT.js.map → chunk-JER5NQVM.js.map} +0 -0
- /package/dist/chunks/{chunk-BCLGRZ3U.js.map → chunk-LKAGAQ3M.js.map} +0 -0
- /package/dist/chunks/{configService-DYCUEURL.js.map → configService-CCA6AIDI.js.map} +0 -0
|
@@ -11,15 +11,14 @@ import {
|
|
|
11
11
|
loadI18nConfig,
|
|
12
12
|
loadJSONFile,
|
|
13
13
|
loadProjectConfig,
|
|
14
|
-
loadResponsiveScalesConfig,
|
|
15
14
|
mapPageNameToPath,
|
|
16
15
|
parseJSON,
|
|
17
16
|
resolveSlugToPageId,
|
|
18
17
|
variableService
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EQYDSPBB.js";
|
|
20
19
|
import {
|
|
21
20
|
configService
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KPU2XHOS.js";
|
|
23
22
|
import {
|
|
24
23
|
bundleFile,
|
|
25
24
|
createRuntimeServer,
|
|
@@ -39,16 +38,16 @@ import {
|
|
|
39
38
|
} from "./chunk-WQFG7PAH.js";
|
|
40
39
|
import {
|
|
41
40
|
extractStringValue
|
|
42
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-H4JSCDNW.js";
|
|
43
42
|
import {
|
|
44
43
|
isPathWithinRoot
|
|
45
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-J23ZX5AP.js";
|
|
46
45
|
import {
|
|
47
46
|
addItemUrls
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-S2CX6HFM.js";
|
|
49
48
|
import {
|
|
50
49
|
parseLocaleFromPath
|
|
51
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-AZQYF6KE.js";
|
|
52
51
|
import {
|
|
53
52
|
API_ROUTES,
|
|
54
53
|
HMR_ROUTE,
|
|
@@ -306,6 +305,13 @@ function buildLineMap(jsonText) {
|
|
|
306
305
|
}
|
|
307
306
|
return { start: startPos, end: pos };
|
|
308
307
|
}
|
|
308
|
+
function recordTrackedRoot(path2) {
|
|
309
|
+
const { start, end } = parseValue(path2, true);
|
|
310
|
+
lineMap.set("", {
|
|
311
|
+
startLine: charToLine[start],
|
|
312
|
+
endLine: charToLine[end - 1] || charToLine[start]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
309
315
|
function parseObject(path2, trackChildren) {
|
|
310
316
|
pos++;
|
|
311
317
|
skipWhitespace();
|
|
@@ -316,7 +322,9 @@ function buildLineMap(jsonText) {
|
|
|
316
322
|
pos++;
|
|
317
323
|
skipWhitespace();
|
|
318
324
|
if (key === "root" && path2.length === 0) {
|
|
319
|
-
|
|
325
|
+
recordTrackedRoot(path2);
|
|
326
|
+
} else if (key === "component" && path2.length === 0) {
|
|
327
|
+
parseComponentWrapper(path2);
|
|
320
328
|
} else if (key === "children" && trackChildren) {
|
|
321
329
|
parseValue(path2, true);
|
|
322
330
|
} else {
|
|
@@ -328,6 +336,30 @@ function buildLineMap(jsonText) {
|
|
|
328
336
|
}
|
|
329
337
|
pos++;
|
|
330
338
|
}
|
|
339
|
+
function parseComponentWrapper(path2) {
|
|
340
|
+
if (jsonText[pos] !== "{") {
|
|
341
|
+
parseValue(path2, false);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
pos++;
|
|
345
|
+
skipWhitespace();
|
|
346
|
+
while (pos < jsonText.length && jsonText[pos] !== "}") {
|
|
347
|
+
skipWhitespace();
|
|
348
|
+
const key = parseString();
|
|
349
|
+
skipWhitespace();
|
|
350
|
+
pos++;
|
|
351
|
+
skipWhitespace();
|
|
352
|
+
if (key === "structure") {
|
|
353
|
+
recordTrackedRoot(path2);
|
|
354
|
+
} else {
|
|
355
|
+
parseValue(path2, false);
|
|
356
|
+
}
|
|
357
|
+
skipWhitespace();
|
|
358
|
+
if (jsonText[pos] === ",") pos++;
|
|
359
|
+
skipWhitespace();
|
|
360
|
+
}
|
|
361
|
+
pos++;
|
|
362
|
+
}
|
|
331
363
|
function parseArray(path2, trackChildren) {
|
|
332
364
|
pos++;
|
|
333
365
|
skipWhitespace();
|
|
@@ -2029,9 +2061,10 @@ async function handleVariablesStatusRoute() {
|
|
|
2029
2061
|
return jsonResponse(result);
|
|
2030
2062
|
}
|
|
2031
2063
|
async function handleVariablesCSSRoute() {
|
|
2064
|
+
await configService.load();
|
|
2032
2065
|
const variablesConfig = await variableService.loadConfig();
|
|
2033
2066
|
const breakpointConfig = await loadBreakpointConfig();
|
|
2034
|
-
const responsiveScalesConfig =
|
|
2067
|
+
const responsiveScalesConfig = configService.getResponsiveScales();
|
|
2035
2068
|
const css = generateVariablesCSS(variablesConfig, breakpointConfig, responsiveScalesConfig);
|
|
2036
2069
|
return new Response(css, {
|
|
2037
2070
|
headers: { "Content-Type": "text/css" }
|
|
@@ -2600,9 +2633,11 @@ function hashContent2(content) {
|
|
|
2600
2633
|
}
|
|
2601
2634
|
|
|
2602
2635
|
// lib/server/routes/pages.ts
|
|
2603
|
-
|
|
2636
|
+
var EDITOR_HEADER = "x-meno-editor";
|
|
2637
|
+
async function handlePageRoute(url, context, req) {
|
|
2604
2638
|
const { pageService, componentService, cmsService, injectLiveReload, isEditor, serverPort } = context;
|
|
2605
2639
|
const pagePath = url.pathname;
|
|
2640
|
+
const injectEditorAttrs = req?.headers.get(EDITOR_HEADER) === "1";
|
|
2606
2641
|
const i18nConfig = await loadI18nConfig();
|
|
2607
2642
|
const { locale, pathWithoutLocale } = parseLocaleFromPath(pagePath, i18nConfig);
|
|
2608
2643
|
const slugMappings = pageService.getSlugMappings();
|
|
@@ -2610,6 +2645,12 @@ async function handlePageRoute(url, context) {
|
|
|
2610
2645
|
if (cmsService) {
|
|
2611
2646
|
const cmsMatch = await cmsService.matchRoute(pathWithoutLocale, locale);
|
|
2612
2647
|
if (cmsMatch) {
|
|
2648
|
+
if (injectEditorAttrs && url.searchParams.get("previewDraft") === "1" && cmsMatch.item._filename) {
|
|
2649
|
+
const draft = await cmsService.getDraft(cmsMatch.collection, cmsMatch.item._filename);
|
|
2650
|
+
if (draft) {
|
|
2651
|
+
cmsMatch.item = draft;
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2613
2654
|
const templatePageContent = await loadPageByFilePath(cmsMatch.pagePath);
|
|
2614
2655
|
if (templatePageContent) {
|
|
2615
2656
|
const templatesDir = projectPaths.templates();
|
|
@@ -2634,6 +2675,7 @@ async function handlePageRoute(url, context) {
|
|
|
2634
2675
|
pageLibraries: typedPageData.meta?.libraries,
|
|
2635
2676
|
pageCustomCode: typedPageData.meta?.customCode,
|
|
2636
2677
|
injectLiveReload,
|
|
2678
|
+
injectEditorAttrs,
|
|
2637
2679
|
isEditor,
|
|
2638
2680
|
serverPort,
|
|
2639
2681
|
returnSeparateJS: true
|
|
@@ -2667,6 +2709,7 @@ async function handlePageRoute(url, context) {
|
|
|
2667
2709
|
cmsTemplatePath,
|
|
2668
2710
|
pageLibraries: typedPageData.meta?.libraries,
|
|
2669
2711
|
pageCustomCode: typedPageData.meta?.customCode,
|
|
2712
|
+
injectEditorAttrs,
|
|
2670
2713
|
isEditor
|
|
2671
2714
|
});
|
|
2672
2715
|
return new Response(ssrHTML, {
|
|
@@ -2727,6 +2770,7 @@ async function handlePageRoute(url, context) {
|
|
|
2727
2770
|
pageLibraries: pageData.meta?.libraries,
|
|
2728
2771
|
pageCustomCode: pageData.meta?.customCode,
|
|
2729
2772
|
injectLiveReload,
|
|
2773
|
+
injectEditorAttrs,
|
|
2730
2774
|
isEditor,
|
|
2731
2775
|
serverPort,
|
|
2732
2776
|
returnSeparateJS: true
|
|
@@ -2758,6 +2802,7 @@ async function handlePageRoute(url, context) {
|
|
|
2758
2802
|
cmsService,
|
|
2759
2803
|
pageLibraries: pageData.meta?.libraries,
|
|
2760
2804
|
pageCustomCode: pageData.meta?.customCode,
|
|
2805
|
+
injectEditorAttrs,
|
|
2761
2806
|
isEditor
|
|
2762
2807
|
});
|
|
2763
2808
|
return new Response(ssrHTML, {
|
|
@@ -2934,7 +2979,7 @@ async function handleRoutes(req, url, server, context) {
|
|
|
2934
2979
|
}
|
|
2935
2980
|
}
|
|
2936
2981
|
if (url.pathname === "/" || url.pathname.startsWith("/") && !url.pathname.includes(".")) {
|
|
2937
|
-
const response2 = await handlePageRoute(url, context);
|
|
2982
|
+
const response2 = await handlePageRoute(url, context, req);
|
|
2938
2983
|
logResponseTime(startTime, req);
|
|
2939
2984
|
return response2;
|
|
2940
2985
|
}
|
|
@@ -3221,4 +3266,4 @@ export {
|
|
|
3221
3266
|
createServer,
|
|
3222
3267
|
FileSystemPageProvider
|
|
3223
3268
|
};
|
|
3224
|
-
//# sourceMappingURL=chunk-
|
|
3269
|
+
//# sourceMappingURL=chunk-CHD5UCFF.js.map
|