2024-07-08 09:15:33 +00:00
|
|
|
// modules/my-module.ts
|
2024-07-08 10:53:06 +00:00
|
|
|
import {
|
|
|
|
defineNuxtModule,
|
|
|
|
createResolver,
|
|
|
|
addComponent,
|
|
|
|
addImports,
|
|
|
|
} from "@nuxt/kit";
|
2024-07-08 09:15:33 +00:00
|
|
|
|
|
|
|
export interface ModuleOptions {}
|
|
|
|
|
2024-07-08 10:36:47 +00:00
|
|
|
const components = [
|
|
|
|
{
|
|
|
|
name: "MlButton",
|
|
|
|
path: "../src/components/Ml/Button/MlButton.vue",
|
|
|
|
},
|
2024-07-08 11:24:09 +00:00
|
|
|
{
|
|
|
|
name: "MlPaginator",
|
|
|
|
path: "../src/components/Ml/Paginator/MlPaginator.vue",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "MlDropDown",
|
|
|
|
path: "../src/components/Ml/DropDown/MlDropDown.vue",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "MlDropDownItem",
|
|
|
|
path: "../src/components/Ml/DropDown/MlDropDownItem.vue",
|
|
|
|
},
|
2024-07-08 11:58:03 +00:00
|
|
|
{
|
|
|
|
name: "MlDropDownItem",
|
|
|
|
path: "../src/components/Ml/DropDown/MlDropDownItem.vue",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "MlSlider",
|
|
|
|
path: "../src/components/Ml/Slider/MlSlider.vue",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "MlSliderPoint",
|
2024-07-08 11:59:47 +00:00
|
|
|
path: "../src/components/Ml/SliderPoint/MlSliderPoint.vue",
|
2024-07-08 11:58:03 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const composables = [
|
|
|
|
{
|
|
|
|
name: "useRipple",
|
|
|
|
path: "../src/composables/useRipple.ts",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "useMergeClasses",
|
|
|
|
path: "../src/composables/useMergeClasses.ts",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "useBounce",
|
|
|
|
path: "../src/composables/useBounce.ts",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "useTailwindConf",
|
|
|
|
path: "../src/composables/useTailwindConf.ts",
|
|
|
|
},
|
2024-07-08 10:36:47 +00:00
|
|
|
];
|
2024-07-08 09:15:33 +00:00
|
|
|
export default defineNuxtModule<ModuleOptions>({
|
|
|
|
meta: {
|
|
|
|
name: "module",
|
|
|
|
configKey: "myModule",
|
|
|
|
},
|
|
|
|
defaults: {},
|
|
|
|
setup(_options, _nuxt) {
|
|
|
|
const resolver = createResolver(import.meta.url);
|
|
|
|
|
2024-07-08 10:36:47 +00:00
|
|
|
for (let item of components) {
|
|
|
|
addComponent({
|
|
|
|
name: item.name,
|
|
|
|
filePath: resolver.resolve(item.path),
|
|
|
|
});
|
|
|
|
}
|
2024-07-08 10:53:06 +00:00
|
|
|
|
2024-07-08 11:58:03 +00:00
|
|
|
for (let item of composables) {
|
|
|
|
addImports([
|
|
|
|
{
|
|
|
|
name: item.name,
|
|
|
|
from: resolver.resolve(item.path),
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
}
|
2024-07-08 09:15:33 +00:00
|
|
|
},
|
|
|
|
});
|