@regle/nuxt 1.25.3-beta.1 → 1.26.0-beta.5
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 +26 -10
- package/package.json +15 -14
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin, resolvePath, addTemplate, addImports, addImportsSources } from '@nuxt/kit';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
+
function removeExtension(filePath) {
|
|
5
|
+
const normalizedPath = filePath.replaceAll(/\\/g, "/");
|
|
6
|
+
return path.posix.join(
|
|
7
|
+
path.posix.dirname(normalizedPath),
|
|
8
|
+
path.posix.basename(normalizedPath, path.posix.extname(normalizedPath))
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
function resolveBuildDir(buildDir, rootDir) {
|
|
12
|
+
return path.isAbsolute(buildDir) ? buildDir : path.resolve(rootDir, buildDir);
|
|
13
|
+
}
|
|
14
|
+
function resolveRegleExportsTemplatePath(buildDir, rootDir) {
|
|
15
|
+
return path.join(resolveBuildDir(buildDir, rootDir), "regle-exports.ts");
|
|
16
|
+
}
|
|
17
|
+
function resolveTemplateImportPath(templatePath, importPath) {
|
|
18
|
+
const relativePath = path.relative(path.dirname(templatePath), importPath);
|
|
19
|
+
const importPathWithoutExtension = removeExtension(relativePath);
|
|
20
|
+
if (path.isAbsolute(importPathWithoutExtension) || importPathWithoutExtension.startsWith(".")) {
|
|
21
|
+
return importPathWithoutExtension;
|
|
22
|
+
}
|
|
23
|
+
return `./${importPathWithoutExtension}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
4
26
|
const module = defineNuxtModule({
|
|
5
27
|
meta: {
|
|
6
28
|
name: "@regle/nuxt",
|
|
7
29
|
configKey: "regle"
|
|
8
30
|
},
|
|
9
31
|
defaults: {},
|
|
10
|
-
async setup(options) {
|
|
32
|
+
async setup(options, nuxt) {
|
|
11
33
|
const { resolve } = createResolver(import.meta.url);
|
|
12
34
|
addPlugin({
|
|
13
35
|
src: resolve("runtime/plugins/regle.plugin"),
|
|
@@ -20,14 +42,8 @@ const module = defineNuxtModule({
|
|
|
20
42
|
try {
|
|
21
43
|
const setupFilePathOS = await resolvePath(options.setupFile);
|
|
22
44
|
if (setupFilePathOS) {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
path.dirname(relativePath),
|
|
26
|
-
path.basename(relativePath, path.extname(relativePath))
|
|
27
|
-
);
|
|
28
|
-
const setupFilePathWithoutExtensionCleaned = path.posix.normalize(
|
|
29
|
-
setupFilePathWithoutExtension.replaceAll(/\\/gi, "/")
|
|
30
|
-
);
|
|
45
|
+
const templatePath = resolveRegleExportsTemplatePath(nuxt.options.buildDir, nuxt.options.rootDir);
|
|
46
|
+
const setupFileImportPath = resolveTemplateImportPath(templatePath, setupFilePathOS);
|
|
31
47
|
const regleImports = [
|
|
32
48
|
{ name: "inferRules", type: false },
|
|
33
49
|
{ name: "useRegle", type: false },
|
|
@@ -40,7 +56,7 @@ const module = defineNuxtModule({
|
|
|
40
56
|
write: true,
|
|
41
57
|
getContents: () => `
|
|
42
58
|
import type { InferRegleRules, RegleCustomFieldStatus } from '@regle/core';
|
|
43
|
-
import ReglePlugin from "${
|
|
59
|
+
import ReglePlugin from "${setupFileImportPath}";
|
|
44
60
|
export const { ${regleImports.filter(({ type }) => !type).map(({ name }) => name).join(", ")} } = ReglePlugin;
|
|
45
61
|
|
|
46
62
|
export type RegleFieldStatus<
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regle/nuxt",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0-beta.5",
|
|
4
4
|
"description": "Regle nuxt module",
|
|
5
5
|
"homepage": "https://reglejs.dev/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,28 +32,29 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nuxt/kit": "4.4.
|
|
36
|
-
"@nuxt/schema": "4.4.
|
|
37
|
-
"@regle/core": "1.
|
|
38
|
-
"@regle/rules": "1.
|
|
35
|
+
"@nuxt/kit": "4.4.6",
|
|
36
|
+
"@nuxt/schema": "4.4.6",
|
|
37
|
+
"@regle/core": "1.26.0-beta.5",
|
|
38
|
+
"@regle/rules": "1.26.0-beta.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@nuxt/module-builder": "1.0.2",
|
|
42
|
-
"@nuxt/test-utils": "4.0.
|
|
43
|
-
"@playwright/test": "1.
|
|
44
|
-
"@types/node": "24.12.
|
|
45
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
46
|
-
"nuxt": "4.4.
|
|
42
|
+
"@nuxt/test-utils": "4.0.3",
|
|
43
|
+
"@playwright/test": "1.60.0",
|
|
44
|
+
"@types/node": "24.12.4",
|
|
45
|
+
"@typescript/native-preview": "7.0.0-dev.20260519.1",
|
|
46
|
+
"nuxt": "4.4.6",
|
|
47
47
|
"type-fest": "5.6.0",
|
|
48
48
|
"typescript": "6.0.3",
|
|
49
49
|
"unbuild": "3.6.1",
|
|
50
|
-
"vitest": "4.1.
|
|
51
|
-
"vue": "3.5.
|
|
52
|
-
"vue-tsc": "3.2.7"
|
|
50
|
+
"vitest": "4.1.6",
|
|
51
|
+
"vue": "3.5.34",
|
|
52
|
+
"vue-tsc": "3.2.7",
|
|
53
|
+
"vite-plus": "0.1.21"
|
|
53
54
|
},
|
|
54
55
|
"optionalDependencies": {
|
|
55
56
|
"pinia": ">=3.0.4",
|
|
56
|
-
"@regle/schemas": "1.
|
|
57
|
+
"@regle/schemas": "1.26.0-beta.5"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
|
59
60
|
"node": "^20.19.0 || >=22.12.0"
|