@lilaquadrat/design-core 0.2.1 → 0.3.0
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/README.md +76 -3
- package/html/index.server.html +1 -8
- package/package.json +54 -54
- package/src/client-entry.ts +8 -8
- package/src/components/partials/error.partial.vue +19 -19
- package/src/components/partials/main-components.partial.vue +75 -70
- package/src/components/partials/qrcode.partial.vue +8 -8
- package/src/functions/AuthProviderFactory.ts +30 -0
- package/src/functions/PaymenyProviderFactory.ts +11 -11
- package/src/functions/auth0.provider.ts +75 -0
- package/src/functions/keycloak.provider.ts +228 -0
- package/src/functions/lila-dom.ts +50 -50
- package/src/functions/shopify.provider.ts +176 -154
- package/src/functions/stripe.provider.ts +120 -108
- package/src/globals.d.ts +1 -2
- package/src/index.ts +9 -7
- package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
- package/src/interfaces/AuthConfig.interface.ts +13 -0
- package/src/interfaces/AuthProvider.interface.ts +15 -0
- package/src/interfaces/FrontendConfig.interface.ts +11 -40
- package/src/interfaces/GenericEvents.interface.ts +1 -1
- package/src/interfaces/IdTokenExtended.interface.ts +13 -4
- package/src/interfaces/PaymentProvider.interface.ts +2 -2
- package/src/interfaces/RenderOptions.interface.ts +12 -0
- package/src/libs/ActionNotice.ts +125 -125
- package/src/libs/Models.class.ts +219 -221
- package/src/main.ts +41 -36
- package/src/mixins/createCookieString.ts +50 -36
- package/src/mixins/createModelDeclaration.ts +22 -19
- package/src/mixins/createRouter.ts +12 -12
- package/src/mixins/date.ts +4 -2
- package/src/mixins/formatSize.ts +5 -5
- package/src/mixins/getAnchor.ts +1 -1
- package/src/mixins/getRoutes.ts +13 -25
- package/src/mixins/hasSlotContent.ts +22 -16
- package/src/mixins/hooks.ts +101 -60
- package/src/mixins/loadComponents.ts +60 -58
- package/src/mixins/logger.ts +17 -13
- package/src/mixins/replaceVariables.ts +10 -8
- package/src/mixins/scroll.ts +61 -45
- package/src/models/Address.model.ts +7 -7
- package/src/models/Contact.model.ts +14 -14
- package/src/plugins/analytics.ts +198 -0
- package/src/plugins/auth.ts +74 -60
- package/src/plugins/currency.ts +10 -10
- package/src/plugins/events.ts +101 -97
- package/src/plugins/filters.ts +21 -18
- package/src/plugins/replacer.ts +7 -6
- package/src/plugins/signupFlow.ts +45 -43
- package/src/plugins/traceable.ts +28 -26
- package/src/plugins/translations.ts +9 -9
- package/src/plugins/youtube.ts +39 -34
- package/src/routes.ts +108 -108
- package/src/server-entry.ts +75 -77
- package/src/stores/calls.store.ts +14 -14
- package/src/stores/cart.store.ts +116 -107
- package/src/stores/content.store.ts +87 -45
- package/src/stores/editor.store.ts +16 -16
- package/src/stores/files.store.ts +72 -72
- package/src/stores/main.store.ts +155 -109
- package/src/stores/user.store.ts +72 -68
- package/src/translations/de.ts +127 -127
- package/src/views/content.view.vue +81 -143
- package/src/views/download.view.vue +25 -23
- package/src/views/editor.view.vue +150 -125
- package/src/views/login.view.vue +35 -36
- package/src/views/signup-account.view.vue +14 -14
- package/tooling/cypress/config.ts +68 -54
- package/tooling/cypress/manifest-utils.mjs +34 -22
- package/tooling/cypress/run-parallel.mjs +41 -35
- package/tooling/cypress/support/commands.ts +458 -300
- package/tooling/eslint.config.js +1 -223
- package/tooling/preview.plugin.js +132 -0
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +36 -0
- package/tooling/vite.js +234 -0
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/preview.plugin.ts +0 -134
- package/tooling/stylelint.config.mjs +0 -24
- package/tooling/vite.ts +0 -260
|
@@ -19,10 +19,10 @@ import { describe, it } from 'node:test';
|
|
|
19
19
|
import assert from 'node:assert/strict';
|
|
20
20
|
|
|
21
21
|
const DEFAULT_PATHS = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
serverEntry: 'dist/server/server-entry.js',
|
|
23
|
+
manifest: 'dist/server/.vite/ssr-manifest.json',
|
|
24
|
+
template: 'dist/server/index.server.html',
|
|
25
|
+
mailTemplate: 'dist/server/index.mail.html',
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* the app logs its startup through mixins/logger, which is console.log - only
|
|
@@ -34,21 +34,24 @@ const VUE_WARN = '[Vue warn]';
|
|
|
34
34
|
* mirrors RenderClass.createGenericContext: the shape the STUDIO renderer hands
|
|
35
35
|
* to render(), minus the parts that only matter for asset urls.
|
|
36
36
|
*/
|
|
37
|
-
function createContext
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
function createContext(content, options = {}) {
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
content: content,
|
|
41
|
+
layout: options.layout,
|
|
42
|
+
contextContent: options.contextContent,
|
|
43
|
+
recipient: options.recipient,
|
|
44
|
+
list: options.list,
|
|
45
|
+
editor: {
|
|
46
|
+
name: content.company ? `${content.company}-${content.project}` : 'preflight',
|
|
47
|
+
company: content.company ?? 'preflight',
|
|
48
|
+
project: content.project ?? 'preflight',
|
|
49
|
+
mode: content.settings?.mode ?? 'presentation',
|
|
50
|
+
},
|
|
51
|
+
tags: content.tags,
|
|
52
|
+
cdn: '',
|
|
53
|
+
renderTarget: options.renderTarget ?? 'web',
|
|
54
|
+
};
|
|
52
55
|
|
|
53
56
|
}
|
|
54
57
|
|
|
@@ -56,26 +59,27 @@ function createContext (content, options = {}) {
|
|
|
56
59
|
* turns a fixture into a site the renderer can address: a filename to look up
|
|
57
60
|
* and a url that resolves to it, exactly as Publish.action stores one.
|
|
58
61
|
*/
|
|
59
|
-
function createSite
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
function createSite(name, content, options = {}) {
|
|
63
|
+
|
|
64
|
+
const target = options.target ?? content.target;
|
|
65
|
+
const filename = target === 'mail'
|
|
66
|
+
? ['mail']
|
|
67
|
+
: content.settings?.filename ?? [name];
|
|
68
|
+
const site = {
|
|
69
|
+
...content,
|
|
70
|
+
id: content.id ?? name,
|
|
71
|
+
state: content.state ?? 'publish',
|
|
72
|
+
settings: {
|
|
73
|
+
mode: 'presentation',
|
|
74
|
+
title: name,
|
|
75
|
+
...content.settings,
|
|
76
|
+
filename,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
if (target) site.target = target;
|
|
81
|
+
|
|
82
|
+
return { name, site, url: site.settings.url || filename[0] };
|
|
79
83
|
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -83,53 +87,54 @@ function createSite (name, content, options = {}) {
|
|
|
83
87
|
* vue reports a failed serverPrefetch and an unresolved component through the
|
|
84
88
|
* console rather than by rejecting, so the console is part of the assertion.
|
|
85
89
|
*/
|
|
86
|
-
async function captureConsole
|
|
90
|
+
async function captureConsole(run) {
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
const captured = { errors: [], warnings: [] };
|
|
93
|
+
const originalError = console.error;
|
|
94
|
+
const originalWarn = console.warn;
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
console.error = (...args) => captured.errors.push(args.map(stringify).join(' '));
|
|
97
|
+
console.warn = (...args) => captured.warnings.push(args.map(stringify).join(' '));
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
try {
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
const result = await run();
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
return { result, captured };
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
} finally {
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
console.error = originalError;
|
|
108
|
+
console.warn = originalWarn;
|
|
105
109
|
|
|
106
|
-
|
|
110
|
+
}
|
|
107
111
|
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
function stringify
|
|
114
|
+
function stringify(value) {
|
|
111
115
|
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
if (value instanceof Error) return `${value.message}\n${value.stack}`;
|
|
117
|
+
if (typeof value === 'string') return value;
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
try {
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
return JSON.stringify(value);
|
|
118
122
|
|
|
119
|
-
|
|
123
|
+
} catch {
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
return String(value);
|
|
122
126
|
|
|
123
|
-
|
|
127
|
+
}
|
|
124
128
|
|
|
125
129
|
}
|
|
126
130
|
|
|
127
|
-
function assembleDocument
|
|
131
|
+
function assembleDocument(template, rendered) {
|
|
128
132
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
return template
|
|
134
|
+
.replace('<!--preload-links-->', rendered.preloadLinks)
|
|
135
|
+
.replace('<!--ssr-outlet-->', rendered.html)
|
|
136
|
+
.replace('<!--pinia-state-->', `<script>window.__INITIAL_STATE__ = ${rendered.initialState}</script>`)
|
|
137
|
+
.replace('</head>', `${rendered.head ?? ''}</head>`);
|
|
133
138
|
|
|
134
139
|
}
|
|
135
140
|
|
|
@@ -138,13 +143,13 @@ function assembleDocument (template, rendered) {
|
|
|
138
143
|
* convention, not a contract - a handful of modules render no wrapper at all -
|
|
139
144
|
* so a miss is reported, never asserted.
|
|
140
145
|
*/
|
|
141
|
-
function moduleMarkers
|
|
146
|
+
function moduleMarkers(type, overrides = {}) {
|
|
142
147
|
|
|
143
|
-
|
|
148
|
+
if (overrides[type]) return overrides[type];
|
|
144
149
|
|
|
145
|
-
|
|
150
|
+
const base = type.replace(/-module$/, '');
|
|
146
151
|
|
|
147
|
-
|
|
152
|
+
return [`lila-${base}-module`, `${base}-module`, `lila-${base}`];
|
|
148
153
|
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -154,89 +159,89 @@ function moduleMarkers (type, overrides = {}) {
|
|
|
154
159
|
* has (a structure declaration, a payment provider) complains offline, and that
|
|
155
160
|
* complaint is not a regression.
|
|
156
161
|
*/
|
|
157
|
-
function splitAllowed
|
|
162
|
+
function splitAllowed(messages, allowed) {
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
const unexpected = [];
|
|
165
|
+
const expected = [];
|
|
161
166
|
|
|
162
|
-
|
|
167
|
+
messages.forEach((single) => {
|
|
163
168
|
|
|
164
|
-
|
|
169
|
+
if (allowed.some((pattern) => pattern.test(single))) {
|
|
165
170
|
|
|
166
|
-
|
|
171
|
+
expected.push(single);
|
|
167
172
|
|
|
168
|
-
|
|
173
|
+
} else {
|
|
169
174
|
|
|
170
|
-
|
|
175
|
+
unexpected.push(single);
|
|
171
176
|
|
|
172
|
-
|
|
177
|
+
}
|
|
173
178
|
|
|
174
|
-
|
|
179
|
+
});
|
|
175
180
|
|
|
176
|
-
|
|
181
|
+
return { unexpected, expected };
|
|
177
182
|
|
|
178
183
|
}
|
|
179
184
|
|
|
180
|
-
function assertRendered
|
|
185
|
+
function assertRendered(name, rendered, captured, options = {}) {
|
|
181
186
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
const allowed = options.allowedConsole ?? [];
|
|
188
|
+
const errors = splitAllowed(captured.errors, allowed);
|
|
189
|
+
const warnings = splitAllowed(
|
|
190
|
+
captured.warnings.filter((single) => single.includes(VUE_WARN)),
|
|
191
|
+
allowed,
|
|
192
|
+
);
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
assert.ok(rendered, `${name}: render returned nothing`);
|
|
195
|
+
assert.equal(
|
|
196
|
+
errors.unexpected.length,
|
|
197
|
+
0,
|
|
198
|
+
`${name}: console.error during render\n${errors.unexpected.join('\n')}`,
|
|
199
|
+
);
|
|
200
|
+
assert.equal(
|
|
201
|
+
warnings.unexpected.length,
|
|
202
|
+
0,
|
|
203
|
+
`${name}: vue warnings during render\n${warnings.unexpected.join('\n')}`,
|
|
204
|
+
);
|
|
200
205
|
|
|
201
|
-
|
|
206
|
+
if (options.onExpected && (errors.expected.length || warnings.expected.length)) {
|
|
202
207
|
|
|
203
|
-
|
|
208
|
+
options.onExpected([...errors.expected, ...warnings.expected]);
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
210
|
+
}
|
|
211
|
+
assert.equal(typeof rendered.html, 'string', `${name}: html is not a string`);
|
|
207
212
|
|
|
208
|
-
|
|
213
|
+
const contentMarker = options.contentMarker ?? 'lila-content-module';
|
|
209
214
|
|
|
210
|
-
|
|
215
|
+
if (contentMarker) {
|
|
211
216
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
assert.ok(
|
|
218
|
+
rendered.html.includes(contentMarker),
|
|
219
|
+
`${name}: ${contentMarker} did not render - the page would publish as an empty shell`,
|
|
220
|
+
);
|
|
216
221
|
|
|
217
|
-
|
|
222
|
+
}
|
|
218
223
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
assert.doesNotThrow(
|
|
225
|
+
() => JSON.parse(rendered.initialState),
|
|
226
|
+
`${name}: initialState is not valid json, hydration would fail`,
|
|
227
|
+
);
|
|
223
228
|
|
|
224
229
|
}
|
|
225
230
|
|
|
226
|
-
async function loadRenderer
|
|
231
|
+
async function loadRenderer(root, paths) {
|
|
227
232
|
|
|
228
|
-
|
|
229
|
-
|
|
233
|
+
const serverEntry = resolve(root, paths.serverEntry);
|
|
234
|
+
const renderer = await import(serverEntry);
|
|
230
235
|
|
|
231
|
-
|
|
236
|
+
assert.equal(typeof renderer.render, 'function', `${paths.serverEntry} does not export render()`);
|
|
232
237
|
|
|
233
|
-
|
|
238
|
+
return renderer;
|
|
234
239
|
|
|
235
240
|
}
|
|
236
241
|
|
|
237
|
-
async function loadJson
|
|
242
|
+
async function loadJson(root, path) {
|
|
238
243
|
|
|
239
|
-
|
|
244
|
+
return JSON.parse(await readFile(resolve(root, path), 'utf-8'));
|
|
240
245
|
|
|
241
246
|
}
|
|
242
247
|
|
|
@@ -251,140 +256,137 @@ async function loadJson (root, path) {
|
|
|
251
256
|
* @param {RegExp[]} [options.allowedConsole] console output the project expects offline, reported instead of failed
|
|
252
257
|
* @param {Record<string, string[]>} [options.markers] root markers for modules whose class does not follow from their type
|
|
253
258
|
*/
|
|
254
|
-
export async function runSsrSuite
|
|
259
|
+
export async function runSsrSuite(options) {
|
|
260
|
+
|
|
261
|
+
const root = options.root ?? process.cwd();
|
|
262
|
+
const paths = { ...DEFAULT_PATHS, ...options.paths };
|
|
263
|
+
const fixtures = options.fixtures;
|
|
264
|
+
const withVariants = options.variants !== false;
|
|
265
|
+
const allowedConsole = options.allowedConsole ?? [];
|
|
266
|
+
const markers = options.markers ?? {};
|
|
267
|
+
const renderer = await loadRenderer(root, paths);
|
|
268
|
+
const manifest = await loadJson(root, paths.manifest);
|
|
269
|
+
const template = await readFile(resolve(root, paths.template), 'utf-8');
|
|
270
|
+
|
|
271
|
+
async function render(entry, renderOptions = {}) {
|
|
272
|
+
|
|
273
|
+
return captureConsole(() => renderer.render({
|
|
274
|
+
url: entry.url,
|
|
275
|
+
context: createContext(entry.site, renderOptions),
|
|
276
|
+
manifest,
|
|
277
|
+
cdnUrl: '',
|
|
278
|
+
}));
|
|
255
279
|
|
|
256
|
-
|
|
257
|
-
const paths = { ...DEFAULT_PATHS, ...options.paths };
|
|
258
|
-
const fixtures = options.fixtures;
|
|
259
|
-
const withVariants = options.variants !== false;
|
|
260
|
-
const allowedConsole = options.allowedConsole ?? [];
|
|
261
|
-
const markers = options.markers ?? {};
|
|
262
|
-
const renderer = await loadRenderer(root, paths);
|
|
263
|
-
const manifest = await loadJson(root, paths.manifest);
|
|
264
|
-
const template = await readFile(resolve(root, paths.template), 'utf-8');
|
|
280
|
+
}
|
|
265
281
|
|
|
266
|
-
|
|
282
|
+
describe('ssr: viewData renders as its own site', () => {
|
|
267
283
|
|
|
268
|
-
|
|
269
|
-
entry.url,
|
|
270
|
-
createContext(entry.site, renderOptions),
|
|
271
|
-
renderOptions.contextData ?? null,
|
|
272
|
-
renderOptions.recipient ?? null,
|
|
273
|
-
renderOptions.list ?? null,
|
|
274
|
-
manifest,
|
|
275
|
-
{ cdnUrl: '' },
|
|
276
|
-
));
|
|
284
|
+
Object.entries(fixtures.viewData ?? {}).forEach(([name, content]) => {
|
|
277
285
|
|
|
278
|
-
|
|
286
|
+
it(name, async (t) => {
|
|
279
287
|
|
|
280
|
-
|
|
288
|
+
if (!Array.isArray(content?.modules)) {
|
|
281
289
|
|
|
282
|
-
|
|
290
|
+
t.diagnostic(`${name} is not page content (no modules array) - skipped`);
|
|
291
|
+
return;
|
|
283
292
|
|
|
284
|
-
|
|
293
|
+
}
|
|
285
294
|
|
|
286
|
-
|
|
295
|
+
const entry = createSite(name, content);
|
|
296
|
+
const { result, captured } = await render(entry);
|
|
287
297
|
|
|
288
|
-
|
|
289
|
-
|
|
298
|
+
assertRendered(name, result, captured, {
|
|
299
|
+
allowedConsole,
|
|
300
|
+
onExpected: (messages) => t.diagnostic(`${name}: expected offline complaints\n${messages.join('\n')}`),
|
|
301
|
+
});
|
|
290
302
|
|
|
291
|
-
|
|
303
|
+
const document = assembleDocument(template, result);
|
|
292
304
|
|
|
293
|
-
|
|
294
|
-
|
|
305
|
+
assert.ok(
|
|
306
|
+
!document.includes('<!--ssr-outlet-->'),
|
|
307
|
+
`${name}: the html template still holds its placeholder`,
|
|
308
|
+
);
|
|
295
309
|
|
|
296
|
-
|
|
297
|
-
allowedConsole,
|
|
298
|
-
onExpected: (messages) => t.diagnostic(`${name}: expected offline complaints\n${messages.join('\n')}`),
|
|
299
|
-
});
|
|
310
|
+
content.modules.forEach((single) => {
|
|
300
311
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
assert.ok(
|
|
304
|
-
!document.includes('<!--ssr-outlet-->'),
|
|
305
|
-
`${name}: the html template still holds its placeholder`,
|
|
306
|
-
);
|
|
312
|
+
if (!single?.type) return;
|
|
307
313
|
|
|
308
|
-
|
|
314
|
+
const found = moduleMarkers(single.type, markers).some((marker) => result.html.includes(marker));
|
|
309
315
|
|
|
310
|
-
|
|
316
|
+
if (!found) t.diagnostic(`${name}: no root marker found for ${single.type}`);
|
|
311
317
|
|
|
312
|
-
|
|
318
|
+
});
|
|
313
319
|
|
|
314
|
-
|
|
320
|
+
});
|
|
315
321
|
|
|
316
322
|
});
|
|
317
323
|
|
|
318
|
-
});
|
|
319
|
-
|
|
320
324
|
});
|
|
321
325
|
|
|
322
|
-
|
|
326
|
+
describe('ssr: every module renders with no data at all', () => {
|
|
323
327
|
|
|
324
|
-
|
|
328
|
+
(fixtures.modules ?? []).forEach((single) => {
|
|
325
329
|
|
|
326
|
-
|
|
330
|
+
const type = `${single.name}-module`;
|
|
327
331
|
|
|
328
|
-
|
|
332
|
+
it(type, async () => {
|
|
329
333
|
|
|
330
|
-
|
|
334
|
+
const entry = createSite(`empty-${single.name}`, {
|
|
335
|
+
modules: [{ type, uuid: `empty-${single.name}` }],
|
|
336
|
+
});
|
|
337
|
+
const { result, captured } = await render(entry);
|
|
331
338
|
|
|
332
|
-
|
|
333
|
-
modules: [{ type, uuid: `empty-${single.name}` }],
|
|
334
|
-
});
|
|
335
|
-
const { result, captured } = await render(entry);
|
|
339
|
+
assertRendered(type, result, captured, { allowedConsole });
|
|
336
340
|
|
|
337
|
-
|
|
341
|
+
});
|
|
338
342
|
|
|
339
|
-
|
|
343
|
+
if (!withVariants) return;
|
|
340
344
|
|
|
341
|
-
|
|
345
|
+
(single.variants ?? []).forEach((variant) => {
|
|
342
346
|
|
|
343
|
-
|
|
347
|
+
if (!variant?.key) return;
|
|
344
348
|
|
|
345
|
-
|
|
349
|
+
it(`${type} [${variant.key}]`, async () => {
|
|
346
350
|
|
|
347
|
-
|
|
351
|
+
const entry = createSite(`empty-${single.name}-${variant.key}`, {
|
|
352
|
+
modules: [{ type, uuid: `empty-${single.name}-${variant.key}`, variant: [variant.key] }],
|
|
353
|
+
});
|
|
354
|
+
const { result, captured } = await render(entry);
|
|
348
355
|
|
|
349
|
-
|
|
350
|
-
modules: [{ type, uuid: `empty-${single.name}-${variant.key}`, variant: [variant.key] }],
|
|
351
|
-
});
|
|
352
|
-
const { result, captured } = await render(entry);
|
|
356
|
+
assertRendered(`${type} [${variant.key}]`, result, captured, { allowedConsole });
|
|
353
357
|
|
|
354
|
-
|
|
358
|
+
});
|
|
355
359
|
|
|
356
|
-
|
|
360
|
+
});
|
|
357
361
|
|
|
358
|
-
|
|
362
|
+
});
|
|
359
363
|
|
|
360
364
|
});
|
|
361
365
|
|
|
362
|
-
|
|
366
|
+
if (!fixtures.mailModules?.length) return;
|
|
363
367
|
|
|
364
|
-
|
|
368
|
+
describe('ssr: every mail module renders with no data at all', () => {
|
|
365
369
|
|
|
366
|
-
|
|
370
|
+
fixtures.mailModules.forEach((single) => {
|
|
367
371
|
|
|
368
|
-
|
|
372
|
+
const type = `${single.name}-module`;
|
|
369
373
|
|
|
370
|
-
|
|
374
|
+
it(type, async () => {
|
|
371
375
|
|
|
372
|
-
|
|
376
|
+
const entry = createSite(`empty-mail-${single.name}`, {
|
|
377
|
+
target: 'mail',
|
|
378
|
+
modules: [{ type, uuid: `empty-mail-${single.name}` }],
|
|
379
|
+
}, { target: 'mail' });
|
|
380
|
+
const { result, captured } = await render(entry);
|
|
373
381
|
|
|
374
|
-
|
|
375
|
-
target : 'mail',
|
|
376
|
-
modules: [{ type, uuid: `empty-mail-${single.name}` }],
|
|
377
|
-
}, { target: 'mail' });
|
|
378
|
-
const { result, captured } = await render(entry);
|
|
382
|
+
assertRendered(type, result, captured, { allowedConsole });
|
|
379
383
|
|
|
380
|
-
|
|
384
|
+
});
|
|
381
385
|
|
|
382
|
-
|
|
386
|
+
});
|
|
383
387
|
|
|
384
388
|
});
|
|
385
389
|
|
|
386
|
-
});
|
|
387
|
-
|
|
388
390
|
}
|
|
389
391
|
|
|
390
392
|
export default runSsrSuite;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Plugin, UserConfig, UserConfigFnObject } from 'vite';
|
|
2
|
+
|
|
3
|
+
export type Target = 'local' | 'next' | 'live';
|
|
4
|
+
|
|
5
|
+
export interface ViteFactoryOptions {
|
|
6
|
+
/**
|
|
7
|
+
* absolute path to the project root (the folder holding index.html)
|
|
8
|
+
*/
|
|
9
|
+
root: string
|
|
10
|
+
/**
|
|
11
|
+
* project relative path to the less folder holding variables, mixins and
|
|
12
|
+
* fonts - these are the design and never ship with the package
|
|
13
|
+
*/
|
|
14
|
+
lessDir?: string
|
|
15
|
+
/**
|
|
16
|
+
* project relative entry for the ssr build
|
|
17
|
+
*/
|
|
18
|
+
ssrEntry?: string
|
|
19
|
+
/**
|
|
20
|
+
* project relative entry for the ssr preflight fixtures (mode ssr-test).
|
|
21
|
+
* it exports the design's viewData and module registries so the test suite
|
|
22
|
+
* can read them without a bundler of its own
|
|
23
|
+
*/
|
|
24
|
+
ssrFixturesEntry?: string
|
|
25
|
+
/**
|
|
26
|
+
* additional defines merged over the framework ones
|
|
27
|
+
*/
|
|
28
|
+
define?: Record<string, string>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function createViteConfig (options: ViteFactoryOptions): UserConfigFnObject;
|
|
32
|
+
export default createViteConfig;
|
|
33
|
+
|
|
34
|
+
export function previewBundle (): Plugin;
|
|
35
|
+
export function dropPreviewAssets (): Plugin;
|
|
36
|
+
export function previewBuildOptions (base: UserConfig['build']): UserConfig['build'];
|