@katlux/toolkit 0.1.1-alpha.89 → 0.1.1-alpha.90
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.cjs +30 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +31 -1
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -109,6 +109,36 @@ const module$1 = kit.defineNuxtModule({
|
|
|
109
109
|
} catch (e) {
|
|
110
110
|
console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
|
|
111
111
|
}
|
|
112
|
+
kit.addPluginTemplate({
|
|
113
|
+
filename: "katlux-user-presets-plugin.mjs",
|
|
114
|
+
getContents() {
|
|
115
|
+
return `
|
|
116
|
+
import { defineNuxtPlugin } from '#app'
|
|
117
|
+
import { registerPresetComponents } from '#imports'
|
|
118
|
+
|
|
119
|
+
export default defineNuxtPlugin(() => {
|
|
120
|
+
const userPresetLoaders = import.meta.glob([
|
|
121
|
+
'~/presets/**/components/*/*.vue',
|
|
122
|
+
'~/app/presets/**/components/*/*.vue'
|
|
123
|
+
])
|
|
124
|
+
|
|
125
|
+
const loadersByPreset = {}
|
|
126
|
+
for (const [path, loader] of Object.entries(userPresetLoaders)) {
|
|
127
|
+
const match = path.match(/presets\\/([^/]+)\\/components\\/([^/]+)\\/([^/]+)\\.vue$/)
|
|
128
|
+
if (match) {
|
|
129
|
+
const [, presetName, componentDir, componentFile] = match
|
|
130
|
+
if (!loadersByPreset[presetName]) loadersByPreset[presetName] = {}
|
|
131
|
+
loadersByPreset[presetName][\`./components/\${componentDir}/\${componentFile}.vue\`] = loader
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
for (const [presetName, loaders] of Object.entries(loadersByPreset)) {
|
|
136
|
+
registerPresetComponents(presetName, loaders)
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
112
142
|
}
|
|
113
143
|
nuxt.hook("prepare:types", (options2) => {
|
|
114
144
|
options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin, addPluginTemplate } from '@nuxt/kit';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -106,6 +106,36 @@ const module$1 = defineNuxtModule({
|
|
|
106
106
|
} catch (e) {
|
|
107
107
|
console.warn("[Katlux] Failed to auto-scan user presets directory:", e);
|
|
108
108
|
}
|
|
109
|
+
addPluginTemplate({
|
|
110
|
+
filename: "katlux-user-presets-plugin.mjs",
|
|
111
|
+
getContents() {
|
|
112
|
+
return `
|
|
113
|
+
import { defineNuxtPlugin } from '#app'
|
|
114
|
+
import { registerPresetComponents } from '#imports'
|
|
115
|
+
|
|
116
|
+
export default defineNuxtPlugin(() => {
|
|
117
|
+
const userPresetLoaders = import.meta.glob([
|
|
118
|
+
'~/presets/**/components/*/*.vue',
|
|
119
|
+
'~/app/presets/**/components/*/*.vue'
|
|
120
|
+
])
|
|
121
|
+
|
|
122
|
+
const loadersByPreset = {}
|
|
123
|
+
for (const [path, loader] of Object.entries(userPresetLoaders)) {
|
|
124
|
+
const match = path.match(/presets\\/([^/]+)\\/components\\/([^/]+)\\/([^/]+)\\.vue$/)
|
|
125
|
+
if (match) {
|
|
126
|
+
const [, presetName, componentDir, componentFile] = match
|
|
127
|
+
if (!loadersByPreset[presetName]) loadersByPreset[presetName] = {}
|
|
128
|
+
loadersByPreset[presetName][\`./components/\${componentDir}/\${componentFile}.vue\`] = loader
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (const [presetName, loaders] of Object.entries(loadersByPreset)) {
|
|
133
|
+
registerPresetComponents(presetName, loaders)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
109
139
|
}
|
|
110
140
|
nuxt.hook("prepare:types", (options2) => {
|
|
111
141
|
options2.tsConfig.compilerOptions = options2.tsConfig.compilerOptions || {};
|