@stonecrop/nuxt 0.4.35 → 0.4.37
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.d.mts +6 -7
- package/dist/module.json +2 -2
- package/dist/module.mjs +78 -37
- package/dist/runtime/layouts/StonecropHome.vue +0 -1
- package/dist/runtime/layouts/StonecropHome.vue.d.ts +2 -1
- package/dist/runtime/pages/StonecropPage.vue +1 -2
- package/dist/runtime/pages/StonecropPage.vue.d.ts +2 -1
- package/dist/types.d.mts +2 -6
- package/package.json +33 -25
package/dist/module.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
router
|
|
5
|
-
docbuilder
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
docbuilder: boolean;
|
|
9
|
-
}, false>;
|
|
3
|
+
interface ModuleOptions {
|
|
4
|
+
router?: Record<string, unknown>;
|
|
5
|
+
docbuilder?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
10
8
|
|
|
11
9
|
export { _default as default };
|
|
10
|
+
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
3
3
|
import { extname } from 'node:path';
|
|
4
|
+
import { createResolver, defineNuxtModule, useLogger, addLayout, extendPages, addPlugin } from '@nuxt/kit';
|
|
4
5
|
|
|
5
6
|
const { resolve } = createResolver(import.meta.url);
|
|
6
7
|
const module = defineNuxtModule({
|
|
@@ -8,53 +9,93 @@ const module = defineNuxtModule({
|
|
|
8
9
|
name: "@stonecrop/nuxt",
|
|
9
10
|
configKey: "stonecrop"
|
|
10
11
|
},
|
|
11
|
-
defaults: (
|
|
12
|
+
defaults: (_nuxt) => {
|
|
12
13
|
return {
|
|
13
14
|
router: {},
|
|
14
15
|
docbuilder: false
|
|
15
16
|
};
|
|
16
17
|
},
|
|
17
|
-
setup(_options, nuxt) {
|
|
18
|
+
async setup(_options, nuxt) {
|
|
19
|
+
const logger = useLogger("@stonecrop/nuxt", { level: nuxt.options.dev ? 3 : 0 });
|
|
18
20
|
const layoutsDir = resolve("runtime/layouts");
|
|
19
|
-
const
|
|
20
|
-
addLayout(
|
|
21
|
-
const
|
|
22
|
-
const doctypesDir = resolve(
|
|
21
|
+
const homepage = resolve(layoutsDir, "StonecropHome.vue");
|
|
22
|
+
addLayout(homepage, "home");
|
|
23
|
+
const appDir = nuxt.options.srcDir;
|
|
24
|
+
const doctypesDir = resolve(appDir, "doctypes");
|
|
23
25
|
if (existsSync(doctypesDir)) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
for (const schema of schemas) {
|
|
38
|
-
const schemaName = schema.replace(".json", "");
|
|
39
|
-
if (pagePaths.includes(`/${schemaName}`)) {
|
|
40
|
-
throw new Error(`[@stonecrop/nuxt] Conflict found with existing page for doctype: ${schemaName}`);
|
|
41
|
-
}
|
|
42
|
-
const schemaPath = resolve(doctypesDir, schema);
|
|
43
|
-
const jsonData = require(schemaPath);
|
|
44
|
-
if (jsonData.schema) {
|
|
26
|
+
try {
|
|
27
|
+
const dirContents = await readdir(doctypesDir);
|
|
28
|
+
const schemas = dirContents.filter((file) => extname(file) === ".json");
|
|
29
|
+
const pagesDir = resolve("runtime/pages");
|
|
30
|
+
const stonecropPage = resolve(pagesDir, "StonecropPage.vue");
|
|
31
|
+
extendPages(async (pages) => {
|
|
32
|
+
try {
|
|
33
|
+
const pagePaths = pages.map((page) => page.path);
|
|
34
|
+
if (pagePaths.includes("/")) {
|
|
35
|
+
logger.error('Conflict found: existing root page "/" detected.');
|
|
36
|
+
throw new Error("[@stonecrop/nuxt] Conflict found with existing root page");
|
|
37
|
+
}
|
|
45
38
|
pages.unshift({
|
|
46
|
-
name:
|
|
47
|
-
path:
|
|
48
|
-
file:
|
|
49
|
-
meta: {
|
|
50
|
-
schema: jsonData.schema
|
|
51
|
-
}
|
|
39
|
+
name: "stonecrop-home",
|
|
40
|
+
path: "/",
|
|
41
|
+
file: homepage
|
|
52
42
|
});
|
|
43
|
+
for (const schema of schemas) {
|
|
44
|
+
try {
|
|
45
|
+
const schemaName = schema.replace(".json", "");
|
|
46
|
+
if (pagePaths.includes(`/${schemaName}`)) {
|
|
47
|
+
logger.warn(`Skipping doctype '${schemaName}': conflicts with existing page`);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const schemaPath = resolve(doctypesDir, schema);
|
|
51
|
+
const fileContents = await readFile(schemaPath, "utf-8");
|
|
52
|
+
let schemaData;
|
|
53
|
+
try {
|
|
54
|
+
schemaData = JSON.parse(fileContents);
|
|
55
|
+
} catch (parseError) {
|
|
56
|
+
logger.error(`Failed to parse schema file '${schema}':`, parseError);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (schemaData.schema) {
|
|
60
|
+
pages.unshift({
|
|
61
|
+
name: `stonecrop-${schemaName}`,
|
|
62
|
+
path: `/${schemaName}`,
|
|
63
|
+
file: stonecropPage,
|
|
64
|
+
meta: {
|
|
65
|
+
schema: schemaData.schema
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
logger.log(`Added page for doctype: ${schemaName}`);
|
|
69
|
+
} else {
|
|
70
|
+
logger.warn(`Schema file '${schema}' missing 'schema' property, skipping`);
|
|
71
|
+
}
|
|
72
|
+
} catch (schemaError) {
|
|
73
|
+
logger.error(`Error processing schema '${schema}':`, schemaError);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (pagesError) {
|
|
77
|
+
logger.error("Failed to setup doctype pages:", pagesError);
|
|
78
|
+
throw new Error(
|
|
79
|
+
`[@stonecrop/nuxt] Failed to setup pages: ${pagesError instanceof Error ? pagesError.message : String(pagesError)}`
|
|
80
|
+
);
|
|
53
81
|
}
|
|
82
|
+
});
|
|
83
|
+
} catch (doctypeError) {
|
|
84
|
+
logger.error("Error setting up doctype pages:", doctypeError);
|
|
85
|
+
if (nuxt.options.dev) {
|
|
86
|
+
logger.warn("Continuing without doctype pages due to error");
|
|
87
|
+
} else {
|
|
88
|
+
throw doctypeError;
|
|
54
89
|
}
|
|
55
|
-
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const pluginPath = resolve("./runtime/plugin");
|
|
93
|
+
try {
|
|
94
|
+
addPlugin(pluginPath);
|
|
95
|
+
} catch (pluginError) {
|
|
96
|
+
logger.error("Error adding plugin:", pluginError);
|
|
97
|
+
throw new Error(`[@stonecrop/nuxt] Failed to add plugin at ${pluginPath}`);
|
|
56
98
|
}
|
|
57
|
-
addPlugin(resolve("./runtime/plugin"));
|
|
58
99
|
}
|
|
59
100
|
});
|
|
60
101
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
-
|
|
3
|
-
import type { default as Module } from './module.mjs'
|
|
4
|
-
|
|
5
|
-
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
-
|
|
7
1
|
export { default } from './module.mjs'
|
|
2
|
+
|
|
3
|
+
export { type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/nuxt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.37",
|
|
4
4
|
"description": "Nuxt module for Stonecrop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,39 +31,47 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nuxt/kit": "^
|
|
34
|
+
"@nuxt/kit": "^4.2.0",
|
|
35
35
|
"pinia": "^3.0.3",
|
|
36
|
-
"@stonecrop/
|
|
37
|
-
"@stonecrop/stonecrop": "0.4.
|
|
38
|
-
"@stonecrop/
|
|
36
|
+
"@stonecrop/aform": "0.4.37",
|
|
37
|
+
"@stonecrop/stonecrop": "0.4.37",
|
|
38
|
+
"@stonecrop/atable": "0.4.37"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@nuxt/
|
|
43
|
-
"@nuxt/
|
|
44
|
-
"@nuxt/
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"vue
|
|
56
|
-
"
|
|
41
|
+
"@eslint/js": "^9.38.0",
|
|
42
|
+
"@nuxt/devtools": "^3.0.0",
|
|
43
|
+
"@nuxt/eslint": "1.10.0",
|
|
44
|
+
"@nuxt/eslint-config": "^1.10.0",
|
|
45
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
46
|
+
"@nuxt/schema": "^4.2.0",
|
|
47
|
+
"@nuxt/test-utils": "^3.20.1",
|
|
48
|
+
"eslint": "^9.38.0",
|
|
49
|
+
"eslint-config-prettier": "^10.1.8",
|
|
50
|
+
"eslint-plugin-vue": "^10.5.1",
|
|
51
|
+
"globals": "^16.4.0",
|
|
52
|
+
"nuxt": "^4.2.0",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"typescript-eslint": "^8.46.2",
|
|
55
|
+
"vue": "^3.5.22",
|
|
56
|
+
"vite": "^7.1.1",
|
|
57
|
+
"vitest": "^4.0.5",
|
|
58
|
+
"vue-router": "^4.6.3",
|
|
59
|
+
"vue-tsc": "^3.1.2"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=22.5.0"
|
|
57
63
|
},
|
|
58
64
|
"scripts": {
|
|
59
65
|
"_phase:build": "rushx dev:prepare && nuxt-module-build build",
|
|
60
66
|
"prepublish": "rushx dev:prepare && nuxt-module-build build",
|
|
61
67
|
"build": "rushx dev:prepare && nuxt-module-build build",
|
|
62
|
-
"dev": "nuxi dev playground",
|
|
68
|
+
"dev": "rushx dev:prepare && nuxi dev playground",
|
|
63
69
|
"dev:build": "nuxi build playground",
|
|
64
70
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
65
|
-
"lint": "eslint .
|
|
66
|
-
"test": "vitest",
|
|
67
|
-
"test:ui": "vitest --ui"
|
|
71
|
+
"lint": "eslint .",
|
|
72
|
+
"test": "vitest run",
|
|
73
|
+
"test:ui": "vitest --ui",
|
|
74
|
+
"test:watch": "vitest watch",
|
|
75
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
68
76
|
}
|
|
69
77
|
}
|