@maz-ui/nuxt 5.1.0-beta.0 → 5.1.0-beta.1
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/README.md +1 -0
- package/dist/module.d.mts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +35 -27
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -213,6 +213,7 @@ export default defineNuxtConfig({
|
|
|
213
213
|
// AI coding agents (default: { rules: false, mcp: true }, false to disable)
|
|
214
214
|
// In development, registers the maz-ui MCP server in the configs of the detected agents
|
|
215
215
|
// (.mcp.json, .cursor/mcp.json, .vscode/mcp.json), rules: true also writes .claude/rules/maz-ui.md and an AGENTS.md section
|
|
216
|
+
// In a monorepo, the files go to the root of the workspace (dir: '<folder>' to change it)
|
|
216
217
|
agents: { rules: false, mcp: true },
|
|
217
218
|
},
|
|
218
219
|
})
|
package/dist/module.d.mts
CHANGED
|
@@ -306,6 +306,7 @@ interface MazUiNuxtOptions {
|
|
|
306
306
|
* - `mcp`: registers the maz-ui MCP server in the agent configs (`.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`). Its instructions already give the maz-ui rules to the agents.
|
|
307
307
|
* - `rules`: also writes the maz-ui rules in `.claude/rules/maz-ui.md` and in a delimited section of `AGENTS.md` (for agents without MCP).
|
|
308
308
|
* - `targets`: agents to configure (`'claude'`, `'agents-md'`, `'cursor'`, `'vscode'`), default: the detected ones. Nothing is written when no agent is detected.
|
|
309
|
+
* - `dir`: folder where the agent files are written, relative to the Nuxt root. Default: the workspace root (`workspaceDir`), so that in a monorepo the files land where the agents start
|
|
309
310
|
* - `true`: `{ mcp: true, rules: true }`, `false`: disabled
|
|
310
311
|
* @example `agents: { rules: true }` or `agents: false`
|
|
311
312
|
* @default { rules: false, mcp: true }
|
|
@@ -314,6 +315,7 @@ interface MazUiNuxtOptions {
|
|
|
314
315
|
targets?: AgentTarget[];
|
|
315
316
|
rules?: boolean;
|
|
316
317
|
mcp?: boolean;
|
|
318
|
+
dir?: string;
|
|
317
319
|
};
|
|
318
320
|
}
|
|
319
321
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { dirname } from 'node:path';
|
|
1
|
+
import { dirname, resolve, join } from 'node:path';
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { detectAgentTargets, setupAgents } from '@maz-ui/node';
|
|
4
|
+
import { detectAgentTargets, findProjectPackage, setupAgents } from '@maz-ui/node';
|
|
5
5
|
import { capitalize } from '@maz-ui/utils/helpers/capitalize';
|
|
6
6
|
import { getErrorMessage } from '@maz-ui/utils/helpers/getErrorMessage';
|
|
7
7
|
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
@@ -171,12 +171,20 @@ function syncAgents(agents, nuxt) {
|
|
|
171
171
|
const logger = useLogger("maz-ui");
|
|
172
172
|
const isExplicit = nuxt.options.mazUi?.agents !== void 0;
|
|
173
173
|
try {
|
|
174
|
-
const { rootDir } = nuxt.options;
|
|
175
|
-
const { targets: requestedTargets, rules = true, mcp = true } = typeof agents === "object" ? agents : {};
|
|
176
|
-
const
|
|
174
|
+
const { rootDir, workspaceDir } = nuxt.options;
|
|
175
|
+
const { targets: requestedTargets, rules = true, mcp = true, dir } = typeof agents === "object" ? agents : {};
|
|
176
|
+
const projectDir = dir ? resolve(rootDir, dir) : workspaceDir || rootDir;
|
|
177
|
+
const targets = requestedTargets ?? detectAgentTargets(projectDir);
|
|
177
178
|
if (targets.length === 0 || !rules && !mcp)
|
|
178
179
|
return;
|
|
179
|
-
const
|
|
180
|
+
const mazUiDir = findProjectPackage(rootDir, "maz-ui");
|
|
181
|
+
const { changes } = setupAgents({
|
|
182
|
+
rootDir: projectDir,
|
|
183
|
+
targets,
|
|
184
|
+
rules,
|
|
185
|
+
mcp,
|
|
186
|
+
...mazUiDir ? { docsDir: join(mazUiDir, "docs") } : {}
|
|
187
|
+
});
|
|
180
188
|
const applied = changes.filter((change) => ["create", "update", "remove"].includes(change.action));
|
|
181
189
|
if (applied.length > 0) {
|
|
182
190
|
const files = applied.map((change) => [change.file, `(${change.action})`].join(" "));
|
|
@@ -212,7 +220,7 @@ const module$1 = defineNuxtModule({
|
|
|
212
220
|
defaults,
|
|
213
221
|
/* eslint-disable complexity, sonarjs/cognitive-complexity */
|
|
214
222
|
setup(options, nuxt) {
|
|
215
|
-
const { resolve } = createResolver(import.meta.url);
|
|
223
|
+
const { resolve: resolve2 } = createResolver(import.meta.url);
|
|
216
224
|
nuxt.options.build.transpile.push("maz-ui", "@maz-ui/themes", "@maz-ui/translations");
|
|
217
225
|
const { agents, ...moduleOptions } = defu(
|
|
218
226
|
nuxt.options.runtimeConfig.public.mazUi,
|
|
@@ -231,9 +239,9 @@ const module$1 = defineNuxtModule({
|
|
|
231
239
|
const current = typeof postcssPlugins.cssnano === "object" && postcssPlugins.cssnano !== null ? postcssPlugins.cssnano : {};
|
|
232
240
|
postcssPlugins.cssnano = { ...current, preset: ["default", { calc: false }] };
|
|
233
241
|
}
|
|
234
|
-
addPlugin(
|
|
235
|
-
addPlugin(
|
|
236
|
-
addPlugin(
|
|
242
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/theme"));
|
|
243
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/translations"));
|
|
244
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/maz-link-component"));
|
|
237
245
|
const flags = moduleOptions.flags;
|
|
238
246
|
if (flags && flags !== "cdn" && flags !== "local") {
|
|
239
247
|
moduleOptions.defaults = {
|
|
@@ -242,9 +250,9 @@ const module$1 = defineNuxtModule({
|
|
|
242
250
|
};
|
|
243
251
|
}
|
|
244
252
|
if (flags === "local") {
|
|
245
|
-
addPlugin(
|
|
253
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/local-flags"));
|
|
246
254
|
} else if (Object.keys(moduleOptions.defaults).length > 0) {
|
|
247
|
-
addPlugin(
|
|
255
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/defaults"));
|
|
248
256
|
}
|
|
249
257
|
if (moduleOptions.components.autoImport) {
|
|
250
258
|
for (const name of Object.keys(COMPONENT_NAMES)) {
|
|
@@ -256,10 +264,10 @@ const module$1 = defineNuxtModule({
|
|
|
256
264
|
}
|
|
257
265
|
const autoImportPrefix = moduleOptions.general.autoImportPrefix;
|
|
258
266
|
if (moduleOptions.plugins.aos) {
|
|
259
|
-
addPlugin(
|
|
267
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/aos"));
|
|
260
268
|
addImports({
|
|
261
269
|
name: "useAos",
|
|
262
|
-
from:
|
|
270
|
+
from: resolve2(_dirname, "./runtime/composables/useAos"),
|
|
263
271
|
as: `use${capitalize(autoImportPrefix)}Aos`
|
|
264
272
|
});
|
|
265
273
|
const injectAosCSS = typeof moduleOptions.plugins.aos === "object" && typeof moduleOptions.plugins.aos.injectCss === "boolean" ? moduleOptions.plugins.aos.injectCss : true;
|
|
@@ -268,43 +276,43 @@ const module$1 = defineNuxtModule({
|
|
|
268
276
|
}
|
|
269
277
|
}
|
|
270
278
|
if (moduleOptions.plugins.toast) {
|
|
271
|
-
addPlugin(
|
|
279
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/toast"));
|
|
272
280
|
addImports({
|
|
273
281
|
name: "useToast",
|
|
274
|
-
from:
|
|
282
|
+
from: resolve2(_dirname, "./runtime/composables/useToast"),
|
|
275
283
|
as: `use${capitalize(autoImportPrefix)}Toast`
|
|
276
284
|
});
|
|
277
285
|
}
|
|
278
286
|
if (moduleOptions.plugins.dialog) {
|
|
279
|
-
addPlugin(
|
|
287
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/dialog"));
|
|
280
288
|
addImports({
|
|
281
289
|
name: "useDialog",
|
|
282
|
-
from:
|
|
290
|
+
from: resolve2(_dirname, "./runtime/composables/useDialog"),
|
|
283
291
|
as: `use${capitalize(autoImportPrefix)}Dialog`
|
|
284
292
|
});
|
|
285
293
|
}
|
|
286
294
|
if (moduleOptions.plugins.wait) {
|
|
287
|
-
addPlugin(
|
|
295
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/wait"));
|
|
288
296
|
addImports({
|
|
289
297
|
name: "useWait",
|
|
290
|
-
from:
|
|
298
|
+
from: resolve2(_dirname, "./runtime/composables/useWait"),
|
|
291
299
|
as: `use${capitalize(autoImportPrefix)}Wait`
|
|
292
300
|
});
|
|
293
301
|
}
|
|
294
302
|
if (moduleOptions.directives.vZoomImg) {
|
|
295
|
-
addPlugin(
|
|
303
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/v-zoom-img"));
|
|
296
304
|
}
|
|
297
305
|
if (moduleOptions.directives.vLazyImg) {
|
|
298
|
-
addPlugin(
|
|
306
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/v-lazy-img"));
|
|
299
307
|
}
|
|
300
308
|
if (moduleOptions.directives.vClickOutside) {
|
|
301
|
-
addPlugin(
|
|
309
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/v-click-outside"));
|
|
302
310
|
}
|
|
303
311
|
if (moduleOptions.directives.vFullscreenImg) {
|
|
304
|
-
addPlugin(
|
|
312
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/v-fullscreen-img"));
|
|
305
313
|
}
|
|
306
314
|
if (moduleOptions.directives.vTooltip) {
|
|
307
|
-
addPlugin(
|
|
315
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/v-tooltip"));
|
|
308
316
|
}
|
|
309
317
|
const allowedMazUiComposables = Object.keys(moduleOptions.composables).filter((composable) => mazUiComposables[composable]);
|
|
310
318
|
for (const composable of allowedMazUiComposables) {
|
|
@@ -329,10 +337,10 @@ const module$1 = defineNuxtModule({
|
|
|
329
337
|
});
|
|
330
338
|
}
|
|
331
339
|
if (moduleOptions.general.defaultMazIconPath) {
|
|
332
|
-
addPlugin(
|
|
340
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/maz-icon-path"));
|
|
333
341
|
}
|
|
334
342
|
if (moduleOptions.general.preventIosInputZoom) {
|
|
335
|
-
addPlugin(
|
|
343
|
+
addPlugin(resolve2(_dirname, "./runtime/plugins/prevent-ios-input-zoom.client"));
|
|
336
344
|
}
|
|
337
345
|
if (moduleOptions.general.devtools) {
|
|
338
346
|
addCustomTab({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.1.0-beta.
|
|
4
|
+
"version": "5.1.0-beta.1",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"nuxt": ">=3.4.0 <5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@maz-ui/node": "5.1.0-beta.
|
|
54
|
+
"@maz-ui/node": "5.1.0-beta.1",
|
|
55
55
|
"@maz-ui/themes": "5.0.0",
|
|
56
56
|
"@maz-ui/translations": "5.0.0",
|
|
57
57
|
"@maz-ui/utils": "5.0.0",
|
|
58
58
|
"@nuxt/devtools-kit": "^3.4.4",
|
|
59
59
|
"@nuxt/kit": "^4.6.2",
|
|
60
60
|
"defu": "^6.1.7",
|
|
61
|
-
"maz-ui": "5.1.0-beta.
|
|
61
|
+
"maz-ui": "5.1.0-beta.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@maz-ui/eslint-config": "5.0.0",
|