@hostlink/nuxt-light 1.10.9 → 1.10.10
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.json +1 -1
- package/dist/module.mjs +32 -6
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
|
-
import { defineNuxtModule, createResolver, resolvePath, addComponentsDir, addImports,
|
|
3
|
-
import { quasar } from '@quasar/vite-plugin';
|
|
2
|
+
import { defineNuxtModule, createResolver, resolvePath, addVitePlugin, addComponentsDir, addImports, resolveFiles, addPlugin } from '@nuxt/kit';
|
|
4
3
|
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { quasar } from '@quasar/vite-plugin';
|
|
5
5
|
|
|
6
6
|
const module = defineNuxtModule({
|
|
7
7
|
meta: {
|
|
@@ -24,6 +24,7 @@ const module = defineNuxtModule({
|
|
|
24
24
|
rel: "stylesheet",
|
|
25
25
|
href: "https://fonts.googleapis.com/css2?family=Noto+Sans&family=Noto+Sans+HK&family=Noto+Sans+TC&family=Material+Symbols+Outlined"
|
|
26
26
|
});
|
|
27
|
+
addVitePlugin(quasar());
|
|
27
28
|
await addComponentsDir({
|
|
28
29
|
path: resolver.resolve("./runtime/components")
|
|
29
30
|
});
|
|
@@ -61,10 +62,6 @@ const module = defineNuxtModule({
|
|
|
61
62
|
{ name: "LightModelField", from, type: true },
|
|
62
63
|
{ name: "LightModel", from, type: true }
|
|
63
64
|
]);
|
|
64
|
-
addVitePlugin(quasar({
|
|
65
|
-
runMode: "ssr-client",
|
|
66
|
-
devTreeshaking: true
|
|
67
|
-
}));
|
|
68
65
|
const files = await resolveFiles(process.cwd() + "/models", ["*"]);
|
|
69
66
|
nuxt.options.runtimeConfig.public.light = {
|
|
70
67
|
model: []
|
|
@@ -85,6 +82,13 @@ const module = defineNuxtModule({
|
|
|
85
82
|
config.optimizeDeps ??= {};
|
|
86
83
|
config.optimizeDeps.exclude ??= [];
|
|
87
84
|
config.optimizeDeps.exclude.push("quasar");
|
|
85
|
+
config.plugins ??= [];
|
|
86
|
+
config.plugins.push(
|
|
87
|
+
virtualQuasarEntryPlugin({
|
|
88
|
+
resolveQuasar,
|
|
89
|
+
dev: nuxt.options.dev
|
|
90
|
+
})
|
|
91
|
+
);
|
|
88
92
|
config.define = {
|
|
89
93
|
...config.define,
|
|
90
94
|
__QUASAR_VERSION__: `'${quasarVersion}'`,
|
|
@@ -109,5 +113,27 @@ const module = defineNuxtModule({
|
|
|
109
113
|
});
|
|
110
114
|
}
|
|
111
115
|
});
|
|
116
|
+
function virtualQuasarEntryPlugin(context) {
|
|
117
|
+
const { resolveQuasar } = context;
|
|
118
|
+
const QUASAR_ENTRY = "quasar";
|
|
119
|
+
const QUASAR_VIRTUAL_ENTRY = "/__quasar/entry.mjs";
|
|
120
|
+
const clientEntry = resolveQuasar("dist/quasar.client.js");
|
|
121
|
+
return {
|
|
122
|
+
name: "quasar:entry",
|
|
123
|
+
enforce: "pre",
|
|
124
|
+
resolveId(id) {
|
|
125
|
+
if (id === QUASAR_ENTRY) {
|
|
126
|
+
return {
|
|
127
|
+
id: clientEntry,
|
|
128
|
+
moduleSideEffects: false
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
async load(id) {
|
|
133
|
+
if (!context.dev && id === QUASAR_VIRTUAL_ENTRY)
|
|
134
|
+
return Object.entries(context.imports.raw).filter(([, path]) => !path.includes("/__tests__/")).map(([name, path]) => `export { default as ${name} } from "quasar/${path}"`).join("\n");
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
112
138
|
|
|
113
139
|
export { module as default };
|