@vixt/core 0.6.5 → 0.6.7
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/client/index.d.ts +3 -1
- package/dist/client/index.js +6 -4
- package/dist/node/index.mjs +20 -17
- package/package.json +1 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -24,8 +24,10 @@ interface PluginDefinition {
|
|
|
24
24
|
}
|
|
25
25
|
interface VixtPlugin {
|
|
26
26
|
(this: void, vixt: VixtApp): any;
|
|
27
|
+
/** @internal */
|
|
28
|
+
_name?: string;
|
|
27
29
|
}
|
|
28
30
|
declare function defineVixtPlugin(definition: PluginDefinition | VixtPlugin): VixtPlugin;
|
|
29
|
-
declare function applyPlugins(vixt: VixtApp, plugins: VixtPlugin[]):
|
|
31
|
+
declare function applyPlugins(vixt: VixtApp, plugins: VixtPlugin[]): void;
|
|
30
32
|
//#endregion
|
|
31
33
|
export { CreateOptions, PluginDefinition, VixtApp, VixtAppConfig, VixtPlugin, applyPlugins, createVixtApp, defineAppConfig, defineVixtPlugin, useAppConfig, useVixtApp };
|
package/dist/client/index.js
CHANGED
|
@@ -17,11 +17,13 @@ function createVixtApp(options) {
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/client/plugin.ts
|
|
19
19
|
function defineVixtPlugin(definition) {
|
|
20
|
-
if (typeof definition == "function") return
|
|
21
|
-
|
|
20
|
+
if (typeof definition == "function") return definition;
|
|
21
|
+
const pluginName = definition.name;
|
|
22
|
+
const pluginSetup = definition.setup || (() => {});
|
|
23
|
+
return Object.assign(pluginSetup, { _name: pluginName });
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
for (const plugin of plugins) typeof plugin === "function" &&
|
|
25
|
+
function applyPlugins(vixt, plugins) {
|
|
26
|
+
for (const plugin of plugins) typeof plugin === "function" && plugin(vixt);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
//#endregion
|
package/dist/node/index.mjs
CHANGED
|
@@ -260,28 +260,31 @@ var app_default = defineVixtModule({
|
|
|
260
260
|
},
|
|
261
261
|
transformIndexHtml: {
|
|
262
262
|
order,
|
|
263
|
-
handler() {
|
|
263
|
+
handler(html = "") {
|
|
264
264
|
if (!transformIndexHtml) return;
|
|
265
265
|
const { rootTag, rootId, head } = options;
|
|
266
266
|
const tags = Object.entries(head ?? {}).map(([tag, attrs]) => attrs.map((attr) => resolveHead(tag, attr))).flat();
|
|
267
267
|
const loadingTemplate = resolveLoadingTemplate(options, vixt);
|
|
268
|
-
return
|
|
269
|
-
{
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
tag: "script",
|
|
277
|
-
attrs: {
|
|
278
|
-
type: "module",
|
|
279
|
-
src: relativeEntryPath
|
|
268
|
+
return {
|
|
269
|
+
html: `<!DOCTYPE html>\n${html}`,
|
|
270
|
+
tags: [
|
|
271
|
+
{
|
|
272
|
+
tag: rootTag,
|
|
273
|
+
attrs: { id: rootId },
|
|
274
|
+
children: loadingTemplate,
|
|
275
|
+
injectTo: "body"
|
|
280
276
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
{
|
|
278
|
+
tag: "script",
|
|
279
|
+
attrs: {
|
|
280
|
+
type: "module",
|
|
281
|
+
src: relativeEntryPath
|
|
282
|
+
},
|
|
283
|
+
injectTo: "body"
|
|
284
|
+
},
|
|
285
|
+
...tags
|
|
286
|
+
]
|
|
287
|
+
};
|
|
285
288
|
}
|
|
286
289
|
}
|
|
287
290
|
};
|