@mouseless/baked 1.0.2 → 1.0.3
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 +30 -20
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createResolver, defineNuxtModule, addComponentsDir, addImportsDir, addPlugin } from '@nuxt/kit';
|
|
2
2
|
import { pathToFileURL } from 'url';
|
|
3
|
+
import { join } from 'path';
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
+
const metaUrlResolver = createResolver(import.meta.url);
|
|
5
6
|
const module = defineNuxtModule({
|
|
6
7
|
meta: {
|
|
7
8
|
name: "@mouseless/baked",
|
|
@@ -23,12 +24,12 @@ const module = defineNuxtModule({
|
|
|
23
24
|
version: "6.14.0",
|
|
24
25
|
defaults: {
|
|
25
26
|
exposeConfig: true,
|
|
26
|
-
cssPath:
|
|
27
|
+
cssPath: metaUrlResolver.resolve("./runtime/assets/tailwind.css"),
|
|
27
28
|
config: {
|
|
28
29
|
content: {
|
|
29
30
|
files: [
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
metaUrlResolver.resolve("./runtime/components/**/*.{vue,mjs,ts}"),
|
|
32
|
+
metaUrlResolver.resolve("./runtime/*.{mjs,js,ts}")
|
|
32
33
|
]
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -45,8 +46,11 @@ const module = defineNuxtModule({
|
|
|
45
46
|
if (process.env.npm_lifecycle_script?.includes("nuxt-module-build")) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
49
|
+
const resolver = {
|
|
50
|
+
metaUrl: metaUrlResolver,
|
|
51
|
+
rootDir: createResolver(_nuxt.options.rootDir)
|
|
52
|
+
};
|
|
53
|
+
const appJsonPath = pathToFileURL(resolver.rootDir.resolve("./.baked/app.json"));
|
|
50
54
|
const app = (await import(appJsonPath.href, { with: { type: 'json' } })).default;
|
|
51
55
|
_options.composables.useBreakpoints ||= {};
|
|
52
56
|
_options.composables.useBreakpoints.screens ||= {
|
|
@@ -64,32 +68,32 @@ const module = defineNuxtModule({
|
|
|
64
68
|
_nuxt.options.runtimeConfig.public.components = _options.components;
|
|
65
69
|
_nuxt.options.runtimeConfig.public.composables = _options.composables;
|
|
66
70
|
_nuxt.options.css.push("primeicons/primeicons.css");
|
|
67
|
-
_nuxt.options.css.push(resolver.resolve("./runtime/assets/overrides.css"));
|
|
71
|
+
_nuxt.options.css.push(resolver.metaUrl.resolve("./runtime/assets/overrides.css"));
|
|
68
72
|
_nuxt.options.devtools = { enabled: false };
|
|
69
73
|
_nuxt.options.experimental.payloadExtraction = false;
|
|
70
74
|
_nuxt.options.features.inlineStyles = false;
|
|
71
75
|
_nuxt.options.ssr = false;
|
|
72
|
-
addComponentsDir({ path: resolver.resolve("./runtime/components") });
|
|
73
|
-
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
76
|
+
addComponentsDir({ path: resolver.metaUrl.resolve("./runtime/components") });
|
|
77
|
+
addImportsDir(resolver.metaUrl.resolve("./runtime/composables"));
|
|
74
78
|
for (const plugin of app?.plugins ?? []) {
|
|
75
79
|
_nuxt.options.runtimeConfig.public[plugin.name] = plugin;
|
|
76
|
-
addPlugin(resolver.resolve(
|
|
80
|
+
addPlugin(resolver[camelize(plugin.resolver)].resolve(join(plugin.basePath, plugin.name)));
|
|
77
81
|
}
|
|
78
|
-
addPlugin(resolver.resolve("./runtime/plugins/mutex"));
|
|
79
|
-
addPlugin(resolver.resolve("./runtime/plugins/toast"));
|
|
80
|
-
addPlugin(resolver.resolve("./runtime/plugins/trailingSlash"));
|
|
81
|
-
addPlugin(resolver.resolve("./runtime/plugins/baked"));
|
|
82
|
-
addPlugin(resolver.resolve("./runtime/plugins/primeVue"));
|
|
83
|
-
addPlugin(resolver.resolve("./runtime/plugins/fetch"), {});
|
|
82
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/mutex"));
|
|
83
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/toast"));
|
|
84
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/trailingSlash"));
|
|
85
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/baked"));
|
|
86
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/primeVue"));
|
|
87
|
+
addPlugin(resolver.metaUrl.resolve("./runtime/plugins/fetch"), {});
|
|
84
88
|
_nuxt.options.vite.optimizeDeps ||= {};
|
|
85
89
|
_nuxt.options.vite.optimizeDeps.noDiscovery = true;
|
|
86
90
|
_nuxt.options.i18n = {
|
|
87
|
-
vueI18n:
|
|
88
|
-
langDir:
|
|
91
|
+
vueI18n: resolver.rootDir.resolve("./i18n.config.ts"),
|
|
92
|
+
langDir: resolver.rootDir.resolve("./"),
|
|
89
93
|
locales: app?.i18n?.supportedLanguages?.map((i) => {
|
|
90
94
|
const files = [
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
resolver.rootDir.resolve(`./.baked/locale.${i.code}.json`),
|
|
96
|
+
resolver.rootDir.resolve(`./locales/locale.${i.code}.json`)
|
|
93
97
|
];
|
|
94
98
|
return {
|
|
95
99
|
code: i.code,
|
|
@@ -115,5 +119,11 @@ const module = defineNuxtModule({
|
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
121
|
});
|
|
122
|
+
function camelize(str) {
|
|
123
|
+
if (!str) {
|
|
124
|
+
return str;
|
|
125
|
+
}
|
|
126
|
+
return `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
127
|
+
}
|
|
118
128
|
|
|
119
129
|
export { module as default };
|