@blokkli/editor 1.3.4 → 1.4.0-alpha.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.
- package/dist/module.d.mts +71 -2
- package/dist/module.d.ts +71 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +315 -123
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +1 -1
- package/dist/runtime/components/Blocks/Fragment/index.vue +7 -4
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +8 -5
- package/dist/runtime/components/BlokkliField.vue +2 -2
- package/dist/runtime/components/BlokkliItem.vue +2 -2
- package/dist/runtime/components/Edit/Actions/index.vue +1 -1
- package/dist/runtime/components/Edit/AddListItem/index.vue +1 -1
- package/dist/runtime/components/Edit/AppMenu/index.vue +1 -1
- package/dist/runtime/components/Edit/BlockProxy/index.vue +5 -21
- package/dist/runtime/components/Edit/Dialog/index.vue +1 -1
- package/dist/runtime/components/Edit/DraggableList.vue +2 -2
- package/dist/runtime/components/Edit/EditIndicator.vue +2 -2
- package/dist/runtime/components/Edit/EditProvider.vue +5 -8
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +9 -8
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +38 -32
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +65 -67
- package/dist/runtime/components/Edit/Features/Library/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -11
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +28 -3
- package/dist/runtime/components/Edit/Features/Options/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Icon/index.vue +2 -2
- package/dist/runtime/components/Edit/ItemIcon/index.vue +1 -1
- package/dist/runtime/components/Edit/Pagination/index.vue +21 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +2 -2
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +37 -6
- package/dist/runtime/components/Edit/index.d.ts +2 -1
- package/dist/runtime/components/Edit/index.js +3 -1
- package/dist/runtime/composables/defineBlokkli.d.ts +2 -2
- package/dist/runtime/composables/defineBlokkli.js +19 -55
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFeature.js +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.js +3 -30
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +0 -4
- package/dist/runtime/helpers/domProvider.js +63 -67
- package/dist/runtime/helpers/featuresProvider.d.ts +1 -1
- package/dist/runtime/helpers/featuresProvider.js +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -0
- package/dist/runtime/helpers/index.js +7 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +23 -2
- package/dist/runtime/helpers/runtimeHelpers/index.js +83 -10
- package/dist/runtime/helpers/storageProvider.js +1 -1
- package/dist/runtime/helpers/textProvider.js +2 -2
- package/dist/runtime/helpers/themeProvider.js +1 -1
- package/dist/runtime/types/index.d.ts +7 -4
- package/package.json +2 -2
- package/dist/runtime/helpers/options.d.ts +0 -2
- package/dist/runtime/helpers/options.js +0 -21
package/dist/module.mjs
CHANGED
|
@@ -2,12 +2,13 @@ import path, { basename, extname } from 'node:path';
|
|
|
2
2
|
import fs, { promises, existsSync } from 'node:fs';
|
|
3
3
|
import { defineNuxtModule, createResolver, resolveFiles, addTemplate, addComponent, addBuildPlugin, addImports, addPlugin, updateTemplates } from '@nuxt/kit';
|
|
4
4
|
import { defu, createDefu } from 'defu';
|
|
5
|
+
import { relative } from 'pathe';
|
|
5
6
|
import { createUnplugin } from 'unplugin';
|
|
6
7
|
import MagicString from 'magic-string';
|
|
7
8
|
import { walk } from 'estree-walker-ts';
|
|
8
9
|
import { BK_VISIBLE_LANGUAGES, BK_HIDDEN_GLOBALLY } from '../dist/runtime/helpers/symbols.js';
|
|
9
10
|
|
|
10
|
-
const version = "1.
|
|
11
|
+
const version = "1.4.0-alpha.1";
|
|
11
12
|
|
|
12
13
|
function sortObjectKeys(obj) {
|
|
13
14
|
if (Array.isArray(obj)) {
|
|
@@ -51,24 +52,9 @@ function estreeToObject(expression) {
|
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
function buildRuntimeDefinition(definition) {
|
|
54
|
-
|
|
55
|
+
return {
|
|
55
56
|
bundle: definition.bundle
|
|
56
57
|
};
|
|
57
|
-
if (definition.options) {
|
|
58
|
-
runtimeDefinition.options = {};
|
|
59
|
-
Object.entries(definition.options).forEach(
|
|
60
|
-
([optionKey, optionDefinition]) => {
|
|
61
|
-
runtimeDefinition.options[optionKey] = {
|
|
62
|
-
type: optionDefinition.type,
|
|
63
|
-
default: optionDefinition.default
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
if (definition.globalOptions) {
|
|
69
|
-
runtimeDefinition.globalOptions = definition.globalOptions;
|
|
70
|
-
}
|
|
71
|
-
return runtimeDefinition;
|
|
72
58
|
}
|
|
73
59
|
const DefinitionPlugin = (nuxt, composableName = "defineBlokkli") => createUnplugin(() => {
|
|
74
60
|
return {
|
|
@@ -125,8 +111,12 @@ class BlockExtractor {
|
|
|
125
111
|
isBuild = false;
|
|
126
112
|
composableName;
|
|
127
113
|
fragmentComposableName;
|
|
128
|
-
|
|
114
|
+
buildDir;
|
|
115
|
+
imports;
|
|
116
|
+
constructor(isBuild = false, buildDir, imports) {
|
|
129
117
|
this.isBuild = isBuild;
|
|
118
|
+
this.buildDir = buildDir;
|
|
119
|
+
this.imports = imports;
|
|
130
120
|
this.composableName = "defineBlokkli";
|
|
131
121
|
this.fragmentComposableName = "defineBlokkliFragment";
|
|
132
122
|
}
|
|
@@ -190,7 +180,7 @@ class BlockExtractor {
|
|
|
190
180
|
icon,
|
|
191
181
|
proxyComponent,
|
|
192
182
|
diffComponent,
|
|
193
|
-
chunkName: extracted.definition.chunkName || "global",
|
|
183
|
+
chunkName: this.isBuild ? extracted.definition.chunkName || "global" : "global",
|
|
194
184
|
componentName: "BlokkliComponent_" + extracted.definition.bundle + "_" + componentFileName,
|
|
195
185
|
source: extracted.source,
|
|
196
186
|
fileSource,
|
|
@@ -203,7 +193,7 @@ class BlockExtractor {
|
|
|
203
193
|
this.fragmentDefinitions[filePath2] = {
|
|
204
194
|
filePath: filePath2,
|
|
205
195
|
definition: extracted.definition,
|
|
206
|
-
chunkName: extracted.definition.chunkName || "global",
|
|
196
|
+
chunkName: this.isBuild ? extracted.definition.chunkName || "global" : "global",
|
|
207
197
|
componentName: "BlokkliFragmentComponent_" + extracted.definition.name,
|
|
208
198
|
source: extracted.source,
|
|
209
199
|
fileSource
|
|
@@ -279,45 +269,16 @@ class BlockExtractor {
|
|
|
279
269
|
}
|
|
280
270
|
return acc;
|
|
281
271
|
}, {});
|
|
282
|
-
const buildContextComponents = (name) => {
|
|
283
|
-
const proxyComponents = Object.values(this.definitions).reduce((acc, v) => {
|
|
284
|
-
if (v?.[name]) {
|
|
285
|
-
acc[v.definition.bundle] = v[name];
|
|
286
|
-
}
|
|
287
|
-
return acc;
|
|
288
|
-
}, {});
|
|
289
|
-
const imports = Object.entries(proxyComponents).map(([bundle, proxyComponentPath]) => {
|
|
290
|
-
return `import ${name}_${bundle} from '${proxyComponentPath}'`;
|
|
291
|
-
}).join("\n");
|
|
292
|
-
const maps = Object.keys(proxyComponents).map((bundle) => {
|
|
293
|
-
return `'${bundle}': ${name}_${bundle}`;
|
|
294
|
-
}).join(", \n");
|
|
295
|
-
return {
|
|
296
|
-
imports,
|
|
297
|
-
maps
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
const proxy = buildContextComponents("proxyComponent");
|
|
301
|
-
const diff = buildContextComponents("diffComponent");
|
|
302
272
|
const allFragmentNames = Object.values(this.fragmentDefinitions).filter(falsy).map((v) => `'${v.definition.name}'`).join(" | ");
|
|
303
|
-
return `
|
|
304
|
-
import type {
|
|
273
|
+
return `
|
|
274
|
+
import type { GlobalOptionsKey, ValidFieldListTypes, BlockBundleWithNested } from './generated-types'
|
|
275
|
+
import type { BlockDefinitionInput, BlockDefinitionOptionsInput, FragmentDefinitionInput } from '${this.imports.TYPES}'
|
|
305
276
|
export const globalOptions = ${JSON.stringify(globalOptions, null, 2)} as const
|
|
306
|
-
${proxy.imports}
|
|
307
|
-
${diff.imports}
|
|
308
277
|
|
|
309
278
|
type DefinitionItem = BlockDefinitionInput<BlockDefinitionOptionsInput, GlobalOptionsKey[]>
|
|
310
279
|
|
|
311
280
|
${definitionDeclarations.join("\n")}
|
|
312
281
|
|
|
313
|
-
const PROXY_COMPONENTS: Record<string, any> = {
|
|
314
|
-
${proxy.maps}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const DIFF_COMPONENTS: Record<string, any> = {
|
|
318
|
-
${diff.maps}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
282
|
export const icons: Record<string, string> = ${JSON.stringify(icons)}
|
|
322
283
|
|
|
323
284
|
export const definitionsMap: Record<string, DefinitionItem> = {
|
|
@@ -351,14 +312,6 @@ export function getDefinition(bundle: string, fieldListType: ValidFieldListTypes
|
|
|
351
312
|
return definitionsMap[bundle]
|
|
352
313
|
}
|
|
353
314
|
|
|
354
|
-
export function getBlokkliItemProxyComponent(bundle: string): any {
|
|
355
|
-
return PROXY_COMPONENTS[bundle]
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export function getBlokkliItemDiffComponent(bundle: string): any {
|
|
359
|
-
return DIFF_COMPONENTS[bundle]
|
|
360
|
-
}
|
|
361
|
-
|
|
362
315
|
/**
|
|
363
316
|
* Get the definition of the default block component.
|
|
364
317
|
*/
|
|
@@ -366,6 +319,128 @@ export function getDefaultDefinition(bundle: string): BlockDefinitionInput<Recor
|
|
|
366
319
|
return definitionsMap[bundle]
|
|
367
320
|
}
|
|
368
321
|
export const getFragmentDefinition = (name: string): FragmentDefinitionInput<Record<string, any>, GlobalOptionsKey[]>|undefined => fragmentDefinitionsMap[name]
|
|
322
|
+
`;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Generate the template for the block item options used for runtime (e.g. not during editing).
|
|
326
|
+
*/
|
|
327
|
+
generateRuntimeOptionsTemplate(globalOptions = {}) {
|
|
328
|
+
const bundles = Object.values(this.definitions).filter(falsy).reduce((acc, definition2) => {
|
|
329
|
+
if (definition2.definition.renderFor) {
|
|
330
|
+
return acc;
|
|
331
|
+
}
|
|
332
|
+
const bundle = definition2.definition.bundle;
|
|
333
|
+
const optionDefinitions = Object.entries(
|
|
334
|
+
definition2.definition.options || {}
|
|
335
|
+
);
|
|
336
|
+
const options = {};
|
|
337
|
+
if (definition2.definition.globalOptions) {
|
|
338
|
+
definition2.definition.globalOptions.forEach((name) => {
|
|
339
|
+
const option = globalOptions[name];
|
|
340
|
+
options[name] = [option.type, option.default];
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
optionDefinitions.forEach(([name, option]) => {
|
|
344
|
+
options[name] = [option.type, option.default];
|
|
345
|
+
});
|
|
346
|
+
if (Object.values(options).length) {
|
|
347
|
+
acc[bundle] = options;
|
|
348
|
+
}
|
|
349
|
+
return acc;
|
|
350
|
+
}, {});
|
|
351
|
+
function getOptionTypes(definition2) {
|
|
352
|
+
const definedOptions = definition2.options || {};
|
|
353
|
+
const blockGlobalOptions = definition2.globalOptions || [];
|
|
354
|
+
blockGlobalOptions.forEach((key) => {
|
|
355
|
+
if (globalOptions[key]) {
|
|
356
|
+
definedOptions[key] = globalOptions[key];
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
return Object.entries(definedOptions || {}).map(([key, option]) => {
|
|
360
|
+
if (option.type === "text") {
|
|
361
|
+
return `${key}: string`;
|
|
362
|
+
} else if (option.type === "checkbox") {
|
|
363
|
+
return `${key}: boolean`;
|
|
364
|
+
} else if (option.type === "checkboxes") {
|
|
365
|
+
const possibleValues = Object.keys(option.options).map((v) => `'${v}'`).join(" | ") || "string";
|
|
366
|
+
return `${key}: Array<${possibleValues}>`;
|
|
367
|
+
} else if (option.type === "radios") {
|
|
368
|
+
const possibleValues = Object.keys(option.options).map((v) => `'${v}'`).join(" | ") || "string";
|
|
369
|
+
return `${key}: ${possibleValues}`;
|
|
370
|
+
} else if (option.type === "color") {
|
|
371
|
+
return key + ": `#${string}`";
|
|
372
|
+
} else if (option.type === "range" || option.type === "number") {
|
|
373
|
+
return `${key}: number`;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
const runtimeMappedOptionTypes = Object.values(this.definitions).filter(falsy).map((definition2) => {
|
|
378
|
+
if (definition2.definition.renderFor) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
const bundle = definition2.definition.bundle;
|
|
382
|
+
const options = getOptionTypes(definition2.definition).join("\n ");
|
|
383
|
+
if (!options) {
|
|
384
|
+
return ` ${bundle}: {}`;
|
|
385
|
+
}
|
|
386
|
+
return ` ${bundle}: {
|
|
387
|
+
${options}
|
|
388
|
+
}`;
|
|
389
|
+
}).filter(falsy).join(",\n");
|
|
390
|
+
return `
|
|
391
|
+
import type { BlockOptionDefinition } from '${this.imports.TYPES_BLOKK_OPTIONS}'
|
|
392
|
+
|
|
393
|
+
export type RuntimeBlockOptionArray = {
|
|
394
|
+
[T in BlockOptionDefinition as T['type']]: [T['type'], T['default']]
|
|
395
|
+
}[BlockOptionDefinition['type']]
|
|
396
|
+
|
|
397
|
+
export type RuntimeBlockOptions = {
|
|
398
|
+
${runtimeMappedOptionTypes}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export const BLOCK_OPTIONS: Record<string, Record<string, RuntimeBlockOptionArray>> = ${JSON.stringify(bundles, null, 2)}
|
|
402
|
+
`;
|
|
403
|
+
}
|
|
404
|
+
generateEditComponents() {
|
|
405
|
+
const buildContextComponents = (name) => {
|
|
406
|
+
const proxyComponents = Object.values(this.definitions).reduce((acc, v) => {
|
|
407
|
+
if (v?.[name]) {
|
|
408
|
+
acc[v.definition.bundle] = v[name];
|
|
409
|
+
}
|
|
410
|
+
return acc;
|
|
411
|
+
}, {});
|
|
412
|
+
const imports = Object.entries(proxyComponents).map(([bundle, proxyComponentPath]) => {
|
|
413
|
+
return `import ${name}_${bundle} from '${this.toBuildRelativePath(proxyComponentPath)}'`;
|
|
414
|
+
}).join("\n");
|
|
415
|
+
const maps = Object.keys(proxyComponents).map((bundle) => {
|
|
416
|
+
return `'${bundle}': ${name}_${bundle}`;
|
|
417
|
+
}).join(", \n");
|
|
418
|
+
return {
|
|
419
|
+
imports,
|
|
420
|
+
maps
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
const proxy = buildContextComponents("proxyComponent");
|
|
424
|
+
const diff = buildContextComponents("diffComponent");
|
|
425
|
+
return `
|
|
426
|
+
${proxy.imports}
|
|
427
|
+
${diff.imports}
|
|
428
|
+
|
|
429
|
+
const PROXY_COMPONENTS: Record<string, any> = {
|
|
430
|
+
${proxy.maps}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const DIFF_COMPONENTS: Record<string, any> = {
|
|
434
|
+
${diff.maps}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export function getBlokkliItemProxyComponent(bundle: string): any {
|
|
438
|
+
return PROXY_COMPONENTS[bundle]
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export function getBlokkliItemDiffComponent(bundle: string): any {
|
|
442
|
+
return DIFF_COMPONENTS[bundle]
|
|
443
|
+
}
|
|
369
444
|
`;
|
|
370
445
|
}
|
|
371
446
|
/**
|
|
@@ -388,7 +463,8 @@ export const getFragmentDefinition = (name: string): FragmentDefinitionInput<Rec
|
|
|
388
463
|
}
|
|
389
464
|
getBundlesWithGlobalOptions(key) {
|
|
390
465
|
return Object.values(this.definitions).map((definition2) => {
|
|
391
|
-
|
|
466
|
+
const globalOptions = definition2?.definition.globalOptions;
|
|
467
|
+
if (definition2 && globalOptions && globalOptions.includes(key)) {
|
|
392
468
|
return definition2.definition.bundle;
|
|
393
469
|
}
|
|
394
470
|
}).filter(falsy);
|
|
@@ -399,7 +475,7 @@ export const getFragmentDefinition = (name: string): FragmentDefinitionInput<Rec
|
|
|
399
475
|
generateDefaultGlobalOptions(globalOptions = {}) {
|
|
400
476
|
const defaults = Object.entries(globalOptions).reduce(
|
|
401
477
|
(acc, [key, option]) => {
|
|
402
|
-
if (option.default) {
|
|
478
|
+
if (option.default !== void 0 && option.default !== null) {
|
|
403
479
|
acc[key] = {
|
|
404
480
|
default: option.default,
|
|
405
481
|
type: option.type
|
|
@@ -409,7 +485,7 @@ export const getFragmentDefinition = (name: string): FragmentDefinitionInput<Rec
|
|
|
409
485
|
},
|
|
410
486
|
{}
|
|
411
487
|
);
|
|
412
|
-
return `import type { BlockOptionDefinition } from '
|
|
488
|
+
return `import type { BlockOptionDefinition } from '${this.imports.TYPES_BLOKK_OPTIONS}'
|
|
413
489
|
|
|
414
490
|
type GlobalOptionsDefaults = {
|
|
415
491
|
type: BlockOptionDefinition['type']
|
|
@@ -425,7 +501,7 @@ export const globalOptionsDefaults: Record<string, GlobalOptionsDefaults> = ${JS
|
|
|
425
501
|
2
|
|
426
502
|
)} as const`;
|
|
427
503
|
}
|
|
428
|
-
generateTypesTemplate(globalOptions, chunkNames, fieldListTypes) {
|
|
504
|
+
generateTypesTemplate(globalOptions, chunkNames, fieldListTypes, getBundlePropsType) {
|
|
429
505
|
const allDefintions = Object.values(
|
|
430
506
|
this.definitions
|
|
431
507
|
).map((v) => v?.definition).filter(falsy);
|
|
@@ -444,12 +520,9 @@ export const globalOptionsDefaults: Record<string, GlobalOptionsDefaults> = ${JS
|
|
|
444
520
|
const validBlockBundles = allDefintions.filter((v) => v.bundle !== "from_library").map((v) => {
|
|
445
521
|
return `'${v.bundle}'`;
|
|
446
522
|
}).join(" | ");
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
const definedOptions = v.definition.options;
|
|
452
|
-
const blockGlobalOptions = v.globalOptions || [];
|
|
523
|
+
function getOptionTypes(definition2) {
|
|
524
|
+
const definedOptions = definition2.options || {};
|
|
525
|
+
const blockGlobalOptions = definition2.globalOptions || [];
|
|
453
526
|
blockGlobalOptions.forEach((key) => {
|
|
454
527
|
if (globalOptions[key]) {
|
|
455
528
|
definedOptions[key] = globalOptions[key];
|
|
@@ -461,33 +534,73 @@ export const globalOptionsDefaults: Record<string, GlobalOptionsDefaults> = ${JS
|
|
|
461
534
|
} else if (option.type === "checkbox") {
|
|
462
535
|
return `${key}: '1' | '0' | undefined`;
|
|
463
536
|
} else if (option.type === "radios" || option.type === "checkboxes") {
|
|
464
|
-
|
|
465
|
-
|
|
537
|
+
return `${key}: string | undefined`;
|
|
538
|
+
} else if (option.type === "color") {
|
|
539
|
+
return `${key}: string | undefined`;
|
|
540
|
+
} else if (option.type === "range" || option.type === "number") {
|
|
541
|
+
return `${key}: number | string | undefined`;
|
|
466
542
|
}
|
|
467
543
|
}).join("\n ");
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
(
|
|
477
|
-
const typeName = `FieldListItem_${bundle}`;
|
|
478
|
-
const typeDefinition = `
|
|
479
|
-
type ${typeName} = {
|
|
480
|
-
bundle: '${bundle}'
|
|
481
|
-
options: ${options.join(" | ")}
|
|
482
|
-
}`;
|
|
544
|
+
return `{
|
|
545
|
+
${options}
|
|
546
|
+
}`;
|
|
547
|
+
}
|
|
548
|
+
const propTypeImports = {};
|
|
549
|
+
const typedFieldListItems = [];
|
|
550
|
+
const definitions = Object.entries(this.definitions);
|
|
551
|
+
const mappedGetBundlePropsType = (bundle, definition2) => {
|
|
552
|
+
if (bundle === "from_library" || bundle === "blokkli_fragment") {
|
|
483
553
|
return {
|
|
484
|
-
typeName,
|
|
485
|
-
|
|
554
|
+
typeName: "Props",
|
|
555
|
+
from: definition2.filePath
|
|
486
556
|
};
|
|
557
|
+
} else if (getBundlePropsType) {
|
|
558
|
+
return getBundlePropsType(bundle, definition2);
|
|
487
559
|
}
|
|
488
|
-
|
|
560
|
+
return null;
|
|
561
|
+
};
|
|
562
|
+
for (let i = 0; i < definitions.length; i++) {
|
|
563
|
+
const [_, definition2] = definitions[i];
|
|
564
|
+
if (!definition2) {
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (definition2.definition.renderFor) {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
const bundle = definition2.definition.bundle;
|
|
571
|
+
const options = getOptionTypes(definition2.definition);
|
|
572
|
+
const generatedTypeName = `FieldListItem_${bundle}`;
|
|
573
|
+
const lines = [` bundle: '${bundle}'`, `options: ${options}`];
|
|
574
|
+
const bundlePropsType = mappedGetBundlePropsType(bundle, definition2);
|
|
575
|
+
if (bundlePropsType) {
|
|
576
|
+
const { typeName, from } = bundlePropsType;
|
|
577
|
+
if (!propTypeImports[from]) {
|
|
578
|
+
propTypeImports[from] = [];
|
|
579
|
+
}
|
|
580
|
+
propTypeImports[from].push({ bundle, typeName });
|
|
581
|
+
lines.push(`props: Bundle_${bundle}_Props`);
|
|
582
|
+
}
|
|
583
|
+
const typeDefinition = `
|
|
584
|
+
type ${generatedTypeName} = {
|
|
585
|
+
${lines.join("\n ")}
|
|
586
|
+
}`;
|
|
587
|
+
typedFieldListItems.push({
|
|
588
|
+
typeName: generatedTypeName,
|
|
589
|
+
typeDefinition
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
const propTypeImportStatements = Object.entries(propTypeImports).map(([from, items]) => {
|
|
593
|
+
const imports = items.map((v) => {
|
|
594
|
+
return `${v.typeName} as Bundle_${v.bundle}_Props`;
|
|
595
|
+
}).join(",\n ");
|
|
596
|
+
const importPath = this.toBuildRelativePath(from);
|
|
597
|
+
return `import type {
|
|
598
|
+
${imports}
|
|
599
|
+
} from '${importPath}'`;
|
|
600
|
+
}).join("\n");
|
|
489
601
|
return `
|
|
490
|
-
|
|
602
|
+
${propTypeImportStatements}
|
|
603
|
+
import type { FieldListItem } from "${this.imports.TYPES}"
|
|
491
604
|
|
|
492
605
|
export type ValidFieldListTypes = ${validFieldListTypes}
|
|
493
606
|
|
|
@@ -503,7 +616,7 @@ export type ValidGlobalConfigKeys = Array<GlobalOptionsKey>
|
|
|
503
616
|
|
|
504
617
|
${typedFieldListItems.map((v) => v.typeDefinition).join("\n\n")}
|
|
505
618
|
|
|
506
|
-
export type FieldListItemTyped = FieldListItem & (${typedFieldListItems.map((v) => v.typeName).join(" | ")})
|
|
619
|
+
export type FieldListItemTyped = Omit<FieldListItem, 'props'> & (${typedFieldListItems.map((v) => v.typeName).join(" | ")})
|
|
507
620
|
export type FieldListItemTypedArray = Array<FieldListItemTyped>
|
|
508
621
|
`;
|
|
509
622
|
}
|
|
@@ -520,7 +633,7 @@ export type FieldListItemTypedArray = Array<FieldListItemTyped>
|
|
|
520
633
|
*/
|
|
521
634
|
generateImportsTemplate(chunkNames) {
|
|
522
635
|
const chunkImports = chunkNames.filter((v) => v !== "global").map((chunkName) => {
|
|
523
|
-
return `${chunkName}: () => import('
|
|
636
|
+
return `${chunkName}: () => import('./chunk-${chunkName}')`;
|
|
524
637
|
});
|
|
525
638
|
const nonGlobalChunkMapping = Object.values(this.definitions).reduce((acc, v) => {
|
|
526
639
|
if (v && v.chunkName !== "global") {
|
|
@@ -561,20 +674,28 @@ const fragmentChunkMapping: Record<string, string> = ${JSON.stringify(
|
|
|
561
674
|
2
|
|
562
675
|
)}
|
|
563
676
|
|
|
677
|
+
function componentOrFunction(component: any) {
|
|
678
|
+
if (typeof component === 'object') {
|
|
679
|
+
return component
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
return defineAsyncComponent(() => component())
|
|
683
|
+
}
|
|
684
|
+
|
|
564
685
|
export function getBlokkliItemComponent(bundle: string, fieldListType?: string, parentBundle?: string): any {
|
|
565
686
|
const forFieldListType = 'block_' + bundle + '__field_list_type_' + fieldListType
|
|
566
687
|
if (global[forFieldListType]) {
|
|
567
|
-
return global[forFieldListType]
|
|
688
|
+
return componentOrFunction(global[forFieldListType])
|
|
568
689
|
}
|
|
569
690
|
if (parentBundle) {
|
|
570
691
|
const forParentBundle = 'block_' + bundle + '__parent_block_' + parentBundle
|
|
571
692
|
if (global[forParentBundle]) {
|
|
572
|
-
return global[forParentBundle]
|
|
693
|
+
return componentOrFunction(global[forParentBundle])
|
|
573
694
|
}
|
|
574
695
|
}
|
|
575
696
|
const key = 'block_' + bundle
|
|
576
697
|
if (global[key]) {
|
|
577
|
-
return global[key]
|
|
698
|
+
return componentOrFunction(global[key])
|
|
578
699
|
}
|
|
579
700
|
const chunkName = chunkMapping[key]
|
|
580
701
|
if (chunkName) {
|
|
@@ -587,7 +708,7 @@ export function getBlokkliItemComponent(bundle: string, fieldListType?: string,
|
|
|
587
708
|
export function getBlokkliFragmentComponent(name: string): any {
|
|
588
709
|
const key = 'fragment_' + name
|
|
589
710
|
if (globalFragments[key]) {
|
|
590
|
-
return globalFragments[key]
|
|
711
|
+
return componentOrFunction(globalFragments[key])
|
|
591
712
|
}
|
|
592
713
|
const chunkName = fragmentChunkMapping[key]
|
|
593
714
|
if (chunkName) {
|
|
@@ -598,6 +719,12 @@ export function getBlokkliFragmentComponent(name: string): any {
|
|
|
598
719
|
}
|
|
599
720
|
`;
|
|
600
721
|
}
|
|
722
|
+
toBuildRelativePath(path2) {
|
|
723
|
+
if (!path2.startsWith("/")) {
|
|
724
|
+
return path2;
|
|
725
|
+
}
|
|
726
|
+
return relative(this.buildDir, path2);
|
|
727
|
+
}
|
|
601
728
|
/**
|
|
602
729
|
* Generate the template.
|
|
603
730
|
*/
|
|
@@ -606,7 +733,11 @@ export function getBlokkliFragmentComponent(name: string): any {
|
|
|
606
733
|
return v?.chunkName === chunkName;
|
|
607
734
|
}).filter(falsy);
|
|
608
735
|
const imports = definitions.map((v) => {
|
|
609
|
-
|
|
736
|
+
if (this.isBuild) {
|
|
737
|
+
return `import ${v.componentName} from '${this.toBuildRelativePath(v.filePath)}'`;
|
|
738
|
+
} else {
|
|
739
|
+
return `const ${v.componentName} = () => import('${this.toBuildRelativePath(v.filePath)}')`;
|
|
740
|
+
}
|
|
610
741
|
});
|
|
611
742
|
const map = definitions.reduce((acc, v) => {
|
|
612
743
|
if ("bundle" in v.definition) {
|
|
@@ -6978,6 +7109,34 @@ const module = defineNuxtModule({
|
|
|
6978
7109
|
const srcResolver = createResolver(srcDir);
|
|
6979
7110
|
const moduleDir = import.meta.url;
|
|
6980
7111
|
const resolver = createResolver(moduleDir);
|
|
7112
|
+
const buildResolver = createResolver(nuxt.options.buildDir);
|
|
7113
|
+
const blokkliBuildDir = buildResolver.resolve("blokkli");
|
|
7114
|
+
const IMPORTS = {
|
|
7115
|
+
TYPES: relative(
|
|
7116
|
+
blokkliBuildDir,
|
|
7117
|
+
resolver.resolve("./runtime/types/index.ts")
|
|
7118
|
+
),
|
|
7119
|
+
CONSTANTS: relative(
|
|
7120
|
+
blokkliBuildDir,
|
|
7121
|
+
resolver.resolve("./runtime/constants/index.ts")
|
|
7122
|
+
),
|
|
7123
|
+
ADAPTER: relative(
|
|
7124
|
+
blokkliBuildDir,
|
|
7125
|
+
resolver.resolve("./runtime/adapter/index.ts")
|
|
7126
|
+
),
|
|
7127
|
+
TYPES_THEME: relative(
|
|
7128
|
+
blokkliBuildDir,
|
|
7129
|
+
resolver.resolve("./runtime/types/theme.ts")
|
|
7130
|
+
),
|
|
7131
|
+
TYPES_GENERATED_MODULE_TYPED: relative(
|
|
7132
|
+
blokkliBuildDir,
|
|
7133
|
+
resolver.resolve("./runtime/types/generatedModuleTypes.ts")
|
|
7134
|
+
),
|
|
7135
|
+
TYPES_BLOKK_OPTIONS: relative(
|
|
7136
|
+
blokkliBuildDir,
|
|
7137
|
+
resolver.resolve("./runtime/types/blokkOptions.ts")
|
|
7138
|
+
)
|
|
7139
|
+
};
|
|
6981
7140
|
const featureFolder = resolver.resolve("./runtime/components/Edit/Features");
|
|
6982
7141
|
const featureExtractor = new Extractor(!nuxt.options.dev);
|
|
6983
7142
|
const builtinFeatures = await resolveFiles(featureFolder, ["*/index.vue"], {
|
|
@@ -7013,7 +7172,7 @@ const module = defineNuxtModule({
|
|
|
7013
7172
|
id: v.id,
|
|
7014
7173
|
componentName: v.componentPath,
|
|
7015
7174
|
importName,
|
|
7016
|
-
importStatement: `import ${importName} from '${v.componentPath}'`,
|
|
7175
|
+
importStatement: `import ${importName} from '${relative(blokkliBuildDir, v.componentPath)}'`,
|
|
7017
7176
|
definition: v.definition
|
|
7018
7177
|
};
|
|
7019
7178
|
});
|
|
@@ -7038,8 +7197,8 @@ const module = defineNuxtModule({
|
|
|
7038
7197
|
}`;
|
|
7039
7198
|
}).join(",\n");
|
|
7040
7199
|
return `${imports}
|
|
7041
|
-
import type { BlokkliAdapter } from '
|
|
7042
|
-
import type { Viewport } from '
|
|
7200
|
+
import type { BlokkliAdapter } from '${IMPORTS.ADAPTER}'
|
|
7201
|
+
import type { Viewport } from '${IMPORTS.CONSTANTS}'
|
|
7043
7202
|
type AdapterMethods = keyof BlokkliAdapter<any>
|
|
7044
7203
|
|
|
7045
7204
|
export const availableFeaturesAtBuild = ${JSON.stringify(
|
|
@@ -7068,7 +7227,7 @@ ${featuresArray}
|
|
|
7068
7227
|
blokkli: true
|
|
7069
7228
|
}
|
|
7070
7229
|
});
|
|
7071
|
-
nuxt.options.alias["#blokkli-
|
|
7230
|
+
nuxt.options.alias["#blokkli-build/features"] = featureComponents.dst;
|
|
7072
7231
|
addTemplate({
|
|
7073
7232
|
write: true,
|
|
7074
7233
|
filename: "blokkli/features.json",
|
|
@@ -7122,7 +7281,11 @@ ${featuresArray}
|
|
|
7122
7281
|
const files = await resolveFiles(srcDir, importPattern, {
|
|
7123
7282
|
followSymbolicLinks: false
|
|
7124
7283
|
});
|
|
7125
|
-
const blockExtractor = new BlockExtractor(
|
|
7284
|
+
const blockExtractor = new BlockExtractor(
|
|
7285
|
+
!nuxt.options.dev,
|
|
7286
|
+
blokkliBuildDir,
|
|
7287
|
+
IMPORTS
|
|
7288
|
+
);
|
|
7126
7289
|
await blockExtractor.addFiles(files);
|
|
7127
7290
|
const templateDefinitions = addTemplate({
|
|
7128
7291
|
write: true,
|
|
@@ -7136,7 +7299,31 @@ ${featuresArray}
|
|
|
7136
7299
|
blokkli: true
|
|
7137
7300
|
}
|
|
7138
7301
|
});
|
|
7139
|
-
nuxt.options.alias["#blokkli/definitions"] = templateDefinitions.dst;
|
|
7302
|
+
nuxt.options.alias["#blokkli-build/definitions"] = templateDefinitions.dst;
|
|
7303
|
+
const templateRuntimeOptions = addTemplate({
|
|
7304
|
+
write: true,
|
|
7305
|
+
filename: "blokkli/runtime-options.ts",
|
|
7306
|
+
getContents: () => {
|
|
7307
|
+
return blockExtractor.generateRuntimeOptionsTemplate(
|
|
7308
|
+
moduleOptions.globalOptions
|
|
7309
|
+
);
|
|
7310
|
+
},
|
|
7311
|
+
options: {
|
|
7312
|
+
blokkli: true
|
|
7313
|
+
}
|
|
7314
|
+
});
|
|
7315
|
+
nuxt.options.alias["#blokkli-build/runtime-options"] = templateRuntimeOptions.dst;
|
|
7316
|
+
const templateEditComponents = addTemplate({
|
|
7317
|
+
write: true,
|
|
7318
|
+
filename: "blokkli/edit-components.ts",
|
|
7319
|
+
getContents: () => {
|
|
7320
|
+
return blockExtractor.generateEditComponents();
|
|
7321
|
+
},
|
|
7322
|
+
options: {
|
|
7323
|
+
blokkli: true
|
|
7324
|
+
}
|
|
7325
|
+
});
|
|
7326
|
+
nuxt.options.alias["#blokkli-build/edit-components"] = templateEditComponents.dst;
|
|
7140
7327
|
const templateTranslations = addTemplate({
|
|
7141
7328
|
write: true,
|
|
7142
7329
|
filename: "blokkli/translations.ts",
|
|
@@ -7155,14 +7342,14 @@ ${featuresArray}
|
|
|
7155
7342
|
blokkli: true
|
|
7156
7343
|
}
|
|
7157
7344
|
});
|
|
7158
|
-
nuxt.options.alias["#blokkli/translations"] = templateTranslations.dst;
|
|
7345
|
+
nuxt.options.alias["#blokkli-build/translations"] = templateTranslations.dst;
|
|
7159
7346
|
nuxt.options.runtimeConfig.public.blokkli = {
|
|
7160
7347
|
itemEntityType: moduleOptions.itemEntityType || "",
|
|
7161
7348
|
defaultLanguage: moduleOptions.defaultLanguage || "en"
|
|
7162
7349
|
};
|
|
7163
7350
|
const resolvedPath = "~/app/blokkli.editAdapter".replace(/^(~~|@@)/, nuxt.options.rootDir).replace(/^(~|@)/, nuxt.options.srcDir);
|
|
7164
7351
|
const adapterTemplate = (() => {
|
|
7165
|
-
const resolvedFilename = `blokkli
|
|
7352
|
+
const resolvedFilename = `blokkli/editAdapter.ts`;
|
|
7166
7353
|
const maybeUserFile = fileExists(resolvedPath, ["ts"]);
|
|
7167
7354
|
if (!maybeUserFile) {
|
|
7168
7355
|
throw new Error(
|
|
@@ -7173,14 +7360,14 @@ ${featuresArray}
|
|
|
7173
7360
|
filename: resolvedFilename,
|
|
7174
7361
|
write: true,
|
|
7175
7362
|
getContents: () => `
|
|
7176
|
-
import type { BlokkliAdapterFactory } from '
|
|
7177
|
-
import adapter from '${resolvedPath}'
|
|
7363
|
+
import type { BlokkliAdapterFactory } from '${IMPORTS.ADAPTER}'
|
|
7364
|
+
import adapter from '${relative(blokkliBuildDir, resolvedPath)}'
|
|
7178
7365
|
|
|
7179
7366
|
export default adapter as BlokkliAdapterFactory<any>
|
|
7180
7367
|
`
|
|
7181
7368
|
});
|
|
7182
7369
|
})();
|
|
7183
|
-
nuxt.options.alias["#blokkli/compiled-edit-adapter"] = adapterTemplate.dst;
|
|
7370
|
+
nuxt.options.alias["#blokkli-build/compiled-edit-adapter"] = adapterTemplate.dst;
|
|
7184
7371
|
nuxt.options.build.transpile.push(resolver.resolve("runtime"));
|
|
7185
7372
|
addComponent({
|
|
7186
7373
|
filePath: resolver.resolve("./runtime/components/BlokkliField"),
|
|
@@ -7223,7 +7410,7 @@ ${featuresArray}
|
|
|
7223
7410
|
from: resolver.resolve("./runtime/composables/useBlokkli"),
|
|
7224
7411
|
as: "useBlokkli"
|
|
7225
7412
|
});
|
|
7226
|
-
nuxt.options.alias["#blokkli/styles"] = resolver.resolve(
|
|
7413
|
+
nuxt.options.alias["#blokkli-build/styles"] = resolver.resolve(
|
|
7227
7414
|
"./runtime/css/output.css"
|
|
7228
7415
|
);
|
|
7229
7416
|
const templateGeneratedTypes = addTemplate({
|
|
@@ -7233,14 +7420,15 @@ ${featuresArray}
|
|
|
7233
7420
|
return blockExtractor.generateTypesTemplate(
|
|
7234
7421
|
moduleOptions.globalOptions || {},
|
|
7235
7422
|
getChunkNames(),
|
|
7236
|
-
getFieldListTypes()
|
|
7423
|
+
getFieldListTypes(),
|
|
7424
|
+
moduleOptions.getBundlePropsType
|
|
7237
7425
|
);
|
|
7238
7426
|
},
|
|
7239
7427
|
options: {
|
|
7240
7428
|
blokkli: true
|
|
7241
7429
|
}
|
|
7242
7430
|
});
|
|
7243
|
-
nuxt.options.alias["#blokkli/generated-types"] = templateGeneratedTypes.dst;
|
|
7431
|
+
nuxt.options.alias["#blokkli-build/generated-types"] = templateGeneratedTypes.dst;
|
|
7244
7432
|
const { themeCss, fullTheme, hasCustomTheme } = buildThemeData(
|
|
7245
7433
|
moduleOptions.theme
|
|
7246
7434
|
);
|
|
@@ -7254,14 +7442,14 @@ ${featuresArray}
|
|
|
7254
7442
|
blokkli: true
|
|
7255
7443
|
}
|
|
7256
7444
|
});
|
|
7257
|
-
nuxt.options.alias["#blokkli/theme"] = templateThemeCss.dst;
|
|
7445
|
+
nuxt.options.alias["#blokkli-build/theme"] = templateThemeCss.dst;
|
|
7258
7446
|
const templateConfig = addTemplate({
|
|
7259
7447
|
write: true,
|
|
7260
7448
|
filename: "blokkli/config.ts",
|
|
7261
7449
|
getContents: () => {
|
|
7262
7450
|
const settingsOverride = moduleOptions.settingsOverride || {};
|
|
7263
|
-
return `import type { Theme } from '
|
|
7264
|
-
import type { ModuleOptionsSettings } from '
|
|
7451
|
+
return `import type { Theme } from '${IMPORTS.TYPES_THEME}'
|
|
7452
|
+
import type { ModuleOptionsSettings } from '${IMPORTS.TYPES_GENERATED_MODULE_TYPED}'
|
|
7265
7453
|
|
|
7266
7454
|
export const hasCustomTheme = ${JSON.stringify(hasCustomTheme)}
|
|
7267
7455
|
export const themes: Record<string, Theme> = ${JSON.stringify(themes, null, 2)}
|
|
@@ -7288,7 +7476,7 @@ export const forceDefaultLanguage: boolean = ${JSON.stringify(
|
|
|
7288
7476
|
blokkli: true
|
|
7289
7477
|
}
|
|
7290
7478
|
});
|
|
7291
|
-
nuxt.options.alias["#blokkli/config"] = templateConfig.dst;
|
|
7479
|
+
nuxt.options.alias["#blokkli-build/config"] = templateConfig.dst;
|
|
7292
7480
|
const templateDefaultGlobalOptions = addTemplate({
|
|
7293
7481
|
write: true,
|
|
7294
7482
|
filename: "blokkli/default-global-options.ts",
|
|
@@ -7301,7 +7489,7 @@ export const forceDefaultLanguage: boolean = ${JSON.stringify(
|
|
|
7301
7489
|
blokkli: true
|
|
7302
7490
|
}
|
|
7303
7491
|
});
|
|
7304
|
-
nuxt.options.alias["#blokkli/default-global-options"] = templateDefaultGlobalOptions.dst;
|
|
7492
|
+
nuxt.options.alias["#blokkli-build/default-global-options"] = templateDefaultGlobalOptions.dst;
|
|
7305
7493
|
let optionsSchemaTemplate = null;
|
|
7306
7494
|
const generateOptionsSchema = async () => {
|
|
7307
7495
|
const outputPath = moduleOptions.schemaOptionsPath;
|
|
@@ -7330,8 +7518,8 @@ export const forceDefaultLanguage: boolean = ${JSON.stringify(
|
|
|
7330
7518
|
};
|
|
7331
7519
|
await generateOptionsSchema();
|
|
7332
7520
|
getChunkNames().forEach((chunkName) => {
|
|
7333
|
-
if (chunkName !== "global") {
|
|
7334
|
-
|
|
7521
|
+
if (chunkName !== "global" && !nuxt.options.dev) {
|
|
7522
|
+
addTemplate({
|
|
7335
7523
|
write: true,
|
|
7336
7524
|
filename: `blokkli/chunk-${chunkName}.ts`,
|
|
7337
7525
|
getContents: () => {
|
|
@@ -7341,14 +7529,15 @@ export const forceDefaultLanguage: boolean = ${JSON.stringify(
|
|
|
7341
7529
|
blokkli: true
|
|
7342
7530
|
}
|
|
7343
7531
|
});
|
|
7344
|
-
nuxt.options.alias["#blokkli/chunk-" + chunkName] = template.dst;
|
|
7345
7532
|
}
|
|
7346
7533
|
});
|
|
7347
7534
|
const templateImports = addTemplate({
|
|
7348
7535
|
write: true,
|
|
7349
7536
|
filename: "blokkli/imports.ts",
|
|
7350
7537
|
getContents: () => {
|
|
7351
|
-
return blockExtractor.generateImportsTemplate(
|
|
7538
|
+
return blockExtractor.generateImportsTemplate(
|
|
7539
|
+
nuxt.options.dev ? ["global"] : getChunkNames()
|
|
7540
|
+
);
|
|
7352
7541
|
},
|
|
7353
7542
|
options: {
|
|
7354
7543
|
blokkli: true
|
|
@@ -7386,8 +7575,8 @@ export type BlokkliIcon = keyof typeof icons`;
|
|
|
7386
7575
|
blokkli: true
|
|
7387
7576
|
}
|
|
7388
7577
|
});
|
|
7389
|
-
nuxt.options.alias["#blokkli/icons"] = templateIcons.dst;
|
|
7390
|
-
nuxt.options.alias["#blokkli/imports"] = templateImports.dst;
|
|
7578
|
+
nuxt.options.alias["#blokkli-build/icons"] = templateIcons.dst;
|
|
7579
|
+
nuxt.options.alias["#blokkli-build/imports"] = templateImports.dst;
|
|
7391
7580
|
nuxt.options.alias["#blokkli/types"] = resolver.resolve("runtime/types");
|
|
7392
7581
|
nuxt.options.alias["#blokkli/constants"] = resolver.resolve("runtime/constants");
|
|
7393
7582
|
nuxt.options.alias["#blokkli/plugins"] = resolver.resolve(
|
|
@@ -7398,6 +7587,9 @@ export type BlokkliIcon = keyof typeof icons`;
|
|
|
7398
7587
|
);
|
|
7399
7588
|
nuxt.options.alias["#blokkli/helpers"] = resolver.resolve("runtime/helpers");
|
|
7400
7589
|
nuxt.options.alias["#blokkli/adapter"] = resolver.resolve("runtime/adapter");
|
|
7590
|
+
nuxt.options.alias["#blokkli/runtime-helpers"] = resolver.resolve(
|
|
7591
|
+
"runtime/helpers/runtimeHelpers"
|
|
7592
|
+
);
|
|
7401
7593
|
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
7402
7594
|
nitroConfig.publicAssets ||= [];
|
|
7403
7595
|
nitroConfig.publicAssets.push({
|