@nordcraft/ssr 1.0.54 → 1.0.57
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/dist/components/utils.js +6 -4
- package/dist/components/utils.js.map +1 -1
- package/dist/custom-code/codeRefs.js +9 -9
- package/dist/custom-code/codeRefs.js.map +1 -1
- package/dist/rendering/formulaContext.d.ts +1 -1
- package/dist/rendering/formulaContext.js +1 -2
- package/dist/rendering/formulaContext.js.map +1 -1
- package/dist/ssr.types.d.ts +1 -1
- package/dist/utils/media.d.ts +9 -9
- package/dist/utils/routes.js +20 -17
- package/dist/utils/routes.js.map +1 -1
- package/dist/utils/tags.d.ts +9 -9
- package/package.json +3 -3
- package/src/components/utils.ts +6 -4
- package/src/custom-code/codeRefs.ts +14 -17
- package/src/rendering/formulaContext.ts +5 -3
- package/src/ssr.types.ts +1 -1
- package/src/utils/routes.ts +28 -28
package/dist/components/utils.js
CHANGED
|
@@ -3,10 +3,12 @@ export function takeIncludedComponents({ root, projectComponents, packages = {},
|
|
|
3
3
|
const components = {
|
|
4
4
|
...projectComponents,
|
|
5
5
|
// Join the project components with all package components
|
|
6
|
-
...Object.fromEntries(Object.values(packages).flatMap((installedPackage) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
...Object.fromEntries(Object.values(packages).flatMap((installedPackage) => installedPackage
|
|
7
|
+
? Object.values(installedPackage.components).map((component) => [
|
|
8
|
+
`${installedPackage.manifest.name}/${component.name}`,
|
|
9
|
+
component,
|
|
10
|
+
])
|
|
11
|
+
: [])),
|
|
10
12
|
};
|
|
11
13
|
const includedComponents = [];
|
|
12
14
|
if (includeRoot) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/components/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAG3D,MAAM,UAAU,sBAAsB,CAAC,EACrC,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AO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3C,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CACtE,CAAA;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToddleComponent } from '@nordcraft/core/dist/component/ToddleComponent';
|
|
2
|
-
import { isToddleFormula } from '@nordcraft/core/dist/formula/
|
|
2
|
+
import { isToddleFormula } from '@nordcraft/core/dist/formula/formula';
|
|
3
3
|
import { filterObject, mapObject } from '@nordcraft/core/dist/utils/collections';
|
|
4
4
|
import { safeFunctionName } from '@nordcraft/core/dist/utils/handlerUtils';
|
|
5
5
|
import { isDefined } from '@nordcraft/core/dist/utils/util';
|
|
@@ -15,11 +15,11 @@ export function takeReferencedFormulasAndActions({ component, files, }) {
|
|
|
15
15
|
...(files.formulas ?? {}),
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
...mapObject(files.packages ?? {}, ([packageName,
|
|
18
|
+
...mapObject(files.packages ?? {}, ([packageName, p]) => [
|
|
19
19
|
packageName,
|
|
20
20
|
{
|
|
21
|
-
actions: actions ?? {},
|
|
22
|
-
formulas: formulas ?? {},
|
|
21
|
+
actions: p?.actions ?? {},
|
|
22
|
+
formulas: p?.formulas ?? {},
|
|
23
23
|
},
|
|
24
24
|
]),
|
|
25
25
|
};
|
|
@@ -56,15 +56,15 @@ export function takeReferencedFormulasAndActions({ component, files, }) {
|
|
|
56
56
|
return {
|
|
57
57
|
...mapObject(
|
|
58
58
|
// Only include packages that have referenced actions or formulas
|
|
59
|
-
filterObject(files.packages ?? {}, ([packageName,
|
|
60
|
-
Object.values(formulas ?? {}).some((f) => formulaRefs.has(`${packageName}/${f.name}`))),
|
|
59
|
+
filterObject(files.packages ?? {}, ([packageName, p]) => Object.values(p?.actions ?? {}).some((a) => actionRefs.has(`${packageName}/${a.name}`)) ||
|
|
60
|
+
Object.values(p?.formulas ?? {}).some((f) => formulaRefs.has(`${packageName}/${f.name}`))),
|
|
61
61
|
// Only include the actions and formulas that are referenced
|
|
62
|
-
([packageName,
|
|
62
|
+
([packageName, p]) => [
|
|
63
63
|
packageName,
|
|
64
64
|
{
|
|
65
|
-
actions: filterObject(actions ?? {}, ([_, a]) => typeof a.name === 'string' &&
|
|
65
|
+
actions: filterObject(p?.actions ?? {}, ([_, a]) => typeof a.name === 'string' &&
|
|
66
66
|
actionRefs.has(`${packageName}/${a.name}`)),
|
|
67
|
-
formulas: filterObject(formulas ?? {}, ([_, f]) => typeof f.name === 'string' &&
|
|
67
|
+
formulas: filterObject(p?.formulas ?? {}, ([_, f]) => typeof f.name === 'string' &&
|
|
68
68
|
formulaRefs.has(`${packageName}/${f.name}`)),
|
|
69
69
|
},
|
|
70
70
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeRefs.js","sourceRoot":"","sources":["../../src/custom-code/codeRefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;
|
|
1
|
+
{"version":3,"file":"codeRefs.js","sourceRoot":"","sources":["../../src/custom-code/codeRefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAMtE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAG3D,MAAM,UAAU,gCAAgC,CAAC,EAC/C,SAAS,EACT,KAAK,GAIN;IAUC,0EAA0E;IAC1E,IAAI,CAAC,SAAS,CAAC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
@@ -15,7 +15,7 @@ export declare const getPageFormulaContext: ({ branchName, component, req, logEr
|
|
|
15
15
|
env: ToddleServerEnv;
|
|
16
16
|
};
|
|
17
17
|
export declare const getServerToddleObject: (files: Pick<ProjectFiles, "formulas" | "packages"> & {
|
|
18
|
-
packages?: Record<string, Pick<InstalledPackage, "formulas"
|
|
18
|
+
packages?: Partial<Record<string, Pick<InstalledPackage, "formulas">>>;
|
|
19
19
|
}) => FormulaContext["toddle"];
|
|
20
20
|
export declare const getDataUrlParameters: ({ route, req, }: {
|
|
21
21
|
route: Pick<PageRoute, "path" | "query">;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mapHeadersToObject } from '@nordcraft/core/dist/api/headers';
|
|
2
|
-
import { applyFormula } from '@nordcraft/core/dist/formula/formula';
|
|
3
|
-
import { isToddleFormula } from '@nordcraft/core/dist/formula/formulaTypes';
|
|
2
|
+
import { applyFormula, isToddleFormula, } from '@nordcraft/core/dist/formula/formula';
|
|
4
3
|
import { mapValues } from '@nordcraft/core/dist/utils/collections';
|
|
5
4
|
import { isDefined } from '@nordcraft/core/dist/utils/util';
|
|
6
5
|
import * as libFormulas from '@nordcraft/std-lib/dist/formulas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formulaContext.js","sourceRoot":"","sources":["../../src/rendering/formulaContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AASrE,OAAO,
|
|
1
|
+
{"version":3,"file":"formulaContext.js","sourceRoot":"","sources":["../../src/rendering/formulaContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AASrE,OAAO,EACL,YAAY,EACZ,eAAe,GAChB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAC3D,OAAO,K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EAAE,CAAC,CAAC,MAAM,CAE/D,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IACpD,OAAO;QACL,UAAU;QACV,wBAAwB,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,YAAY,EAAE;QACpE,cAAc,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,EAAE;QAClD,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACvB,GAAG;KACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,UAAU,EACV,GAAG,EACH,SAAS,GAKV,EAAE,EAAE,CACH,CAAC;IACC,UAAU,EAAE,UAAU;IACtB,mDAAmD;IACnD,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE;QACP,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC;QACxC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC;QAC/B,GAAG,EAAE,GAAG,CAAC,GAAG;KACb;IACD,SAAS;CACV,CAAoB,CAAA"}
|
package/dist/ssr.types.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface ToddleProject {
|
|
|
22
22
|
}
|
|
23
23
|
export interface ProjectFiles {
|
|
24
24
|
components: Partial<Record<string, Component>>;
|
|
25
|
-
packages?: Record<string, InstalledPackage
|
|
25
|
+
packages?: Partial<Record<string, InstalledPackage>>;
|
|
26
26
|
actions?: Record<string, PluginAction>;
|
|
27
27
|
formulas?: Record<string, PluginFormula<string>>;
|
|
28
28
|
routes?: Record<string, Route>;
|
package/dist/utils/media.d.ts
CHANGED
|
@@ -6,17 +6,17 @@ export declare const isCloudflareImagePath: (path?: string | null) => path is st
|
|
|
6
6
|
export declare const transformRelativePaths: (urlOrigin: string) => (component: Component) => {
|
|
7
7
|
nodes: {};
|
|
8
8
|
name: string;
|
|
9
|
-
version?: 2;
|
|
10
|
-
page?: string;
|
|
9
|
+
version?: 2 | null;
|
|
10
|
+
page?: string | null;
|
|
11
11
|
route?: import("@nordcraft/core/dist/component/component.types").PageRoute | null;
|
|
12
12
|
attributes: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentAttribute>;
|
|
13
13
|
variables: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentVariable>;
|
|
14
|
-
formulas?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentFormula
|
|
15
|
-
contexts?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentContext
|
|
16
|
-
workflows?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentWorkflow
|
|
14
|
+
formulas?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentFormula> | null;
|
|
15
|
+
contexts?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentContext> | null;
|
|
16
|
+
workflows?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentWorkflow> | null;
|
|
17
17
|
apis: Record<string, import("@nordcraft/core/dist/api/apiTypes").ComponentAPI>;
|
|
18
|
-
events?: import("@nordcraft/core/dist/component/component.types").ComponentEvent[];
|
|
19
|
-
onLoad?: import("@nordcraft/core/dist/component/component.types").EventModel;
|
|
20
|
-
onAttributeChange?: import("@nordcraft/core/dist/component/component.types").EventModel;
|
|
21
|
-
exported?: boolean;
|
|
18
|
+
events?: import("@nordcraft/core/dist/component/component.types").ComponentEvent[] | null;
|
|
19
|
+
onLoad?: import("@nordcraft/core/dist/component/component.types").EventModel | null;
|
|
20
|
+
onAttributeChange?: import("@nordcraft/core/dist/component/component.types").EventModel | null;
|
|
21
|
+
exported?: boolean | null;
|
|
22
22
|
};
|
package/dist/utils/routes.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isPageComponent } from '@nordcraft/core/dist/component/isPageComponent';
|
|
2
|
-
import { isToddleFormula
|
|
2
|
+
import { isToddleFormula } from '@nordcraft/core/dist/formula/formula';
|
|
3
|
+
import {} from '@nordcraft/core/dist/formula/formulaTypes';
|
|
3
4
|
import { createStylesheet } from '@nordcraft/core/dist/styling/style.css';
|
|
4
5
|
import { theme as defaultTheme } from '@nordcraft/core/dist/styling/theme.const';
|
|
5
6
|
import { filterObject, mapObject } from '@nordcraft/core/dist/utils/collections';
|
|
@@ -69,22 +70,24 @@ export const splitRoutes = (json) => {
|
|
|
69
70
|
? {
|
|
70
71
|
packages: mapObject(files.packages, ([key, pkg]) => [
|
|
71
72
|
key,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
pkg
|
|
74
|
+
? {
|
|
75
|
+
...pkg,
|
|
76
|
+
components: mapObject(
|
|
77
|
+
// Only include package components that are used by the page
|
|
78
|
+
filterObject(pkg.components, ([_, pkgComponent]) => components.some((c) => pkgComponent &&
|
|
79
|
+
c.name ===
|
|
80
|
+
`${pkg.manifest.name}/${pkgComponent.name}`)),
|
|
81
|
+
// Remove test data from package components
|
|
82
|
+
([cKey, c]) => [cKey, c ? removeTestData(c) : c]),
|
|
83
|
+
// Actions are not available during SSR
|
|
84
|
+
actions: {},
|
|
85
|
+
// TODO: Only include relevant formulas from packages
|
|
86
|
+
formulas: filterObject(pkg.formulas ?? {}, ([_, pkgFormula]) =>
|
|
87
|
+
// custom formulas are not supported during SSR yet
|
|
88
|
+
isToddleFormula(pkgFormula)),
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
88
91
|
]),
|
|
89
92
|
}
|
|
90
93
|
: undefined),
|
package/dist/utils/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/utils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QAAQ,EAAE,YAAY,CACpB,GAAG,CAAC,QAAQ,IAAI,EAAE,EAClB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE;wCAClB,mDAAmD;wCACnD,eAAe,CAAC,UAAU,CAAC,CAC9B;qCACF;oCACH,CAAC,CAAC,SAAS;6BACd,CAAC;yBACH;wBACH,CAAC,CAAC,SAAS,CAAC;iBACf,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,MAAM;QACN,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;KACzD,CAAA;AACH,CAAC,CAAA"}
|
package/dist/utils/tags.d.ts
CHANGED
|
@@ -6,17 +6,17 @@ import type { Component } from '@nordcraft/core/dist/component/component.types';
|
|
|
6
6
|
export declare const replaceTagInNodes: (oldTag: string, newTag: string) => (component: Component) => {
|
|
7
7
|
nodes: {};
|
|
8
8
|
name: string;
|
|
9
|
-
version?: 2;
|
|
10
|
-
page?: string;
|
|
9
|
+
version?: 2 | null;
|
|
10
|
+
page?: string | null;
|
|
11
11
|
route?: import("@nordcraft/core/dist/component/component.types").PageRoute | null;
|
|
12
12
|
attributes: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentAttribute>;
|
|
13
13
|
variables: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentVariable>;
|
|
14
|
-
formulas?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentFormula
|
|
15
|
-
contexts?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentContext
|
|
16
|
-
workflows?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentWorkflow
|
|
14
|
+
formulas?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentFormula> | null;
|
|
15
|
+
contexts?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentContext> | null;
|
|
16
|
+
workflows?: Record<string, import("@nordcraft/core/dist/component/component.types").ComponentWorkflow> | null;
|
|
17
17
|
apis: Record<string, import("@nordcraft/core/dist/api/apiTypes").ComponentAPI>;
|
|
18
|
-
events?: import("@nordcraft/core/dist/component/component.types").ComponentEvent[];
|
|
19
|
-
onLoad?: import("@nordcraft/core/dist/component/component.types").EventModel;
|
|
20
|
-
onAttributeChange?: import("@nordcraft/core/dist/component/component.types").EventModel;
|
|
21
|
-
exported?: boolean;
|
|
18
|
+
events?: import("@nordcraft/core/dist/component/component.types").ComponentEvent[] | null;
|
|
19
|
+
onLoad?: import("@nordcraft/core/dist/component/component.types").EventModel | null;
|
|
20
|
+
onAttributeChange?: import("@nordcraft/core/dist/component/component.types").EventModel | null;
|
|
21
|
+
exported?: boolean | null;
|
|
22
22
|
};
|
package/package.json
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@nordcraft/core": "1.0.
|
|
20
|
-
"@nordcraft/std-lib": "1.0.
|
|
19
|
+
"@nordcraft/core": "1.0.57",
|
|
20
|
+
"@nordcraft/std-lib": "1.0.57",
|
|
21
21
|
"cookie": "1.0.2",
|
|
22
22
|
"xss": "1.0.15"
|
|
23
23
|
},
|
|
24
|
-
"version": "1.0.
|
|
24
|
+
"version": "1.0.57"
|
|
25
25
|
}
|
package/src/components/utils.ts
CHANGED
|
@@ -21,10 +21,12 @@ export function takeIncludedComponents({
|
|
|
21
21
|
// Join the project components with all package components
|
|
22
22
|
...Object.fromEntries(
|
|
23
23
|
Object.values(packages).flatMap((installedPackage) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
installedPackage
|
|
25
|
+
? Object.values(installedPackage.components).map((component) => [
|
|
26
|
+
`${installedPackage.manifest.name}/${component!.name}`,
|
|
27
|
+
component,
|
|
28
|
+
])
|
|
29
|
+
: [],
|
|
28
30
|
),
|
|
29
31
|
),
|
|
30
32
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ToddleComponent } from '@nordcraft/core/dist/component/ToddleComponent'
|
|
2
2
|
import type { Component } from '@nordcraft/core/dist/component/component.types'
|
|
3
|
+
import { isToddleFormula } from '@nordcraft/core/dist/formula/formula'
|
|
3
4
|
import type {
|
|
4
5
|
CodeFormula,
|
|
5
6
|
PluginFormula,
|
|
6
7
|
} from '@nordcraft/core/dist/formula/formulaTypes'
|
|
7
|
-
import { isToddleFormula } from '@nordcraft/core/dist/formula/formulaTypes'
|
|
8
8
|
import type { PluginAction } from '@nordcraft/core/dist/types'
|
|
9
9
|
import { filterObject, mapObject } from '@nordcraft/core/dist/utils/collections'
|
|
10
10
|
import { safeFunctionName } from '@nordcraft/core/dist/utils/handlerUtils'
|
|
@@ -38,16 +38,13 @@ export function takeReferencedFormulasAndActions({
|
|
|
38
38
|
...(files.formulas ?? {}),
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
-
...mapObject(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
),
|
|
41
|
+
...mapObject(files.packages ?? {}, ([packageName, p]) => [
|
|
42
|
+
packageName,
|
|
43
|
+
{
|
|
44
|
+
actions: p?.actions ?? {},
|
|
45
|
+
formulas: p?.formulas ?? {},
|
|
46
|
+
},
|
|
47
|
+
]),
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
|
|
@@ -91,26 +88,26 @@ export function takeReferencedFormulasAndActions({
|
|
|
91
88
|
// Only include packages that have referenced actions or formulas
|
|
92
89
|
filterObject(
|
|
93
90
|
files.packages ?? {},
|
|
94
|
-
([packageName,
|
|
95
|
-
Object.values(actions ?? {}).some((a) =>
|
|
91
|
+
([packageName, p]) =>
|
|
92
|
+
Object.values(p?.actions ?? {}).some((a) =>
|
|
96
93
|
actionRefs.has(`${packageName}/${a.name}`),
|
|
97
94
|
) ||
|
|
98
|
-
Object.values(formulas ?? {}).some((f) =>
|
|
95
|
+
Object.values(p?.formulas ?? {}).some((f) =>
|
|
99
96
|
formulaRefs.has(`${packageName}/${f.name}`),
|
|
100
97
|
),
|
|
101
98
|
),
|
|
102
99
|
// Only include the actions and formulas that are referenced
|
|
103
|
-
([packageName,
|
|
100
|
+
([packageName, p]) => [
|
|
104
101
|
packageName,
|
|
105
102
|
{
|
|
106
103
|
actions: filterObject(
|
|
107
|
-
actions ?? {},
|
|
104
|
+
p?.actions ?? {},
|
|
108
105
|
([_, a]) =>
|
|
109
106
|
typeof a.name === 'string' &&
|
|
110
107
|
actionRefs.has(`${packageName}/${a.name}`),
|
|
111
108
|
),
|
|
112
109
|
formulas: filterObject(
|
|
113
|
-
formulas ?? {},
|
|
110
|
+
p?.formulas ?? {},
|
|
114
111
|
([_, f]) =>
|
|
115
112
|
typeof f.name === 'string' &&
|
|
116
113
|
formulaRefs.has(`${packageName}/${f.name}`),
|
|
@@ -7,9 +7,11 @@ import type {
|
|
|
7
7
|
FormulaContext,
|
|
8
8
|
ToddleServerEnv,
|
|
9
9
|
} from '@nordcraft/core/dist/formula/formula'
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
applyFormula,
|
|
12
|
+
isToddleFormula,
|
|
13
|
+
} from '@nordcraft/core/dist/formula/formula'
|
|
11
14
|
import type { PluginFormula } from '@nordcraft/core/dist/formula/formulaTypes'
|
|
12
|
-
import { isToddleFormula } from '@nordcraft/core/dist/formula/formulaTypes'
|
|
13
15
|
import { mapValues } from '@nordcraft/core/dist/utils/collections'
|
|
14
16
|
import { isDefined } from '@nordcraft/core/dist/utils/util'
|
|
15
17
|
import * as libFormulas from '@nordcraft/std-lib/dist/formulas'
|
|
@@ -72,7 +74,7 @@ export const getPageFormulaContext = ({
|
|
|
72
74
|
|
|
73
75
|
export const getServerToddleObject = (
|
|
74
76
|
files: Pick<ProjectFiles, 'formulas' | 'packages'> & {
|
|
75
|
-
packages?: Record<string, Pick<InstalledPackage, 'formulas'
|
|
77
|
+
packages?: Partial<Record<string, Pick<InstalledPackage, 'formulas'>>>
|
|
76
78
|
},
|
|
77
79
|
): FormulaContext['toddle'] => {
|
|
78
80
|
const coreFormulas = Object.fromEntries(
|
package/src/ssr.types.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface ToddleProject {
|
|
|
32
32
|
export interface ProjectFiles {
|
|
33
33
|
// Partial to make sure we check for the existence of a Component
|
|
34
34
|
components: Partial<Record<string, Component>>
|
|
35
|
-
packages?: Record<string, InstalledPackage
|
|
35
|
+
packages?: Partial<Record<string, InstalledPackage>>
|
|
36
36
|
actions?: Record<string, PluginAction>
|
|
37
37
|
formulas?: Record<string, PluginFormula<string>>
|
|
38
38
|
routes?: Record<string, Route>
|
package/src/utils/routes.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { RouteDeclaration } from '@nordcraft/core/dist/component/component.types'
|
|
2
2
|
import { isPageComponent } from '@nordcraft/core/dist/component/isPageComponent'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type PluginFormula,
|
|
6
|
-
} from '@nordcraft/core/dist/formula/formulaTypes'
|
|
3
|
+
import { isToddleFormula } from '@nordcraft/core/dist/formula/formula'
|
|
4
|
+
import { type PluginFormula } from '@nordcraft/core/dist/formula/formulaTypes'
|
|
7
5
|
import { createStylesheet } from '@nordcraft/core/dist/styling/style.css'
|
|
8
6
|
import { theme as defaultTheme } from '@nordcraft/core/dist/styling/theme.const'
|
|
9
7
|
import { filterObject, mapObject } from '@nordcraft/core/dist/utils/collections'
|
|
@@ -105,31 +103,33 @@ export const splitRoutes = (json: {
|
|
|
105
103
|
? {
|
|
106
104
|
packages: mapObject(files.packages, ([key, pkg]) => [
|
|
107
105
|
key,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
106
|
+
pkg
|
|
107
|
+
? {
|
|
108
|
+
...pkg,
|
|
109
|
+
components: mapObject(
|
|
110
|
+
// Only include package components that are used by the page
|
|
111
|
+
filterObject(pkg.components, ([_, pkgComponent]) =>
|
|
112
|
+
components.some(
|
|
113
|
+
(c) =>
|
|
114
|
+
pkgComponent &&
|
|
115
|
+
c.name ===
|
|
116
|
+
`${pkg.manifest.name}/${pkgComponent.name}`,
|
|
117
|
+
),
|
|
118
|
+
),
|
|
119
|
+
// Remove test data from package components
|
|
120
|
+
([cKey, c]) => [cKey, c ? removeTestData(c) : c],
|
|
121
|
+
),
|
|
122
|
+
// Actions are not available during SSR
|
|
123
|
+
actions: {},
|
|
124
|
+
// TODO: Only include relevant formulas from packages
|
|
125
|
+
formulas: filterObject(
|
|
126
|
+
pkg.formulas ?? {},
|
|
127
|
+
([_, pkgFormula]) =>
|
|
128
|
+
// custom formulas are not supported during SSR yet
|
|
129
|
+
isToddleFormula(pkgFormula),
|
|
118
130
|
),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
([cKey, c]) => [cKey, c ? removeTestData(c) : c],
|
|
122
|
-
),
|
|
123
|
-
// Actions are not available during SSR
|
|
124
|
-
actions: {},
|
|
125
|
-
// TODO: Only include relevant formulas from packages
|
|
126
|
-
formulas: filterObject(
|
|
127
|
-
pkg.formulas ?? {},
|
|
128
|
-
([_, pkgFormula]) =>
|
|
129
|
-
// custom formulas are not supported during SSR yet
|
|
130
|
-
isToddleFormula(pkgFormula),
|
|
131
|
-
),
|
|
132
|
-
},
|
|
131
|
+
}
|
|
132
|
+
: undefined,
|
|
133
133
|
]),
|
|
134
134
|
}
|
|
135
135
|
: undefined),
|