@overgaming/valiform 0.4.1 → 0.4.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/nuxt/module.d.ts +4 -1
- package/dist/nuxt.cjs +4 -4
- package/dist/nuxt.js +17 -12
- package/package.json +4 -4
package/dist/nuxt/module.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { FormsPluginOptions } from '../src/types';
|
|
2
|
+
interface NuxtModuleOptions extends FormsPluginOptions {
|
|
3
|
+
rulesPath?: string;
|
|
4
|
+
}
|
|
2
5
|
declare const _default: NuxtModule<TOptions, TOptions, false>;
|
|
3
6
|
export default _default;
|
|
4
|
-
export type ModuleOptions =
|
|
7
|
+
export type ModuleOptions = NuxtModuleOptions;
|
package/dist/nuxt.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";const e=require("@nuxt/kit");var
|
|
2
|
-
${Object.entries(o).map(([
|
|
1
|
+
"use strict";const e=require("@nuxt/kit");var r=typeof document<"u"?document.currentScript:null;const c=e.defineNuxtModule({meta:{name:"@overgaming/valiform",configKey:"valiform",compatibility:{nuxt:">=3.0.0"}},defaults:{},async setup(s){const m=e.createResolver(typeof document>"u"?require("url").pathToFileURL(__filename).href:r&&r.tagName.toUpperCase()==="SCRIPT"&&r.src||new URL("nuxt.cjs",document.baseURI).href),{rules:o,rulesPath:i,...a}=s,t=[`export const pluginOptions = ${JSON.stringify(a)};`];if(i){const n=await e.resolvePath(i);t.unshift(`import _customRules from ${JSON.stringify(n)};`),t.push("export const customRules = _customRules;")}else if(o&&Object.keys(o).length>0){const n=`{
|
|
2
|
+
${Object.entries(o).map(([l,u])=>` ${JSON.stringify(l)}: ${u.toString()}`).join(`,
|
|
3
3
|
`)}
|
|
4
|
-
}
|
|
5
|
-
`),write:!0}),e.addPlugin(
|
|
4
|
+
}`;t.push(`export const customRules = ${n};`)}else t.push("export const customRules = null;");e.addTemplate({filename:"valiform/options.mjs",getContents:()=>t.join(`
|
|
5
|
+
`),write:!0}),e.addPlugin(m.resolve("./runtime/plugin")),e.addComponent({name:"Form",export:"Form",filePath:"@overgaming/valiform"}),e.addComponent({name:"Field",export:"Field",filePath:"@overgaming/valiform"}),e.addImports([{name:"useLocale",from:"@overgaming/valiform"},{name:"useFormContext",from:"@overgaming/valiform"},{name:"useFieldContext",from:"@overgaming/valiform"},{name:"useInputContext",from:"@overgaming/valiform"}])}});module.exports=c;
|
package/dist/nuxt.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { defineNuxtModule as
|
|
2
|
-
const
|
|
1
|
+
import { defineNuxtModule as u, createResolver as f, resolvePath as p, addTemplate as g, addPlugin as c, addComponent as i, addImports as v } from "@nuxt/kit";
|
|
2
|
+
const x = u({
|
|
3
3
|
meta: {
|
|
4
4
|
name: "@overgaming/valiform",
|
|
5
5
|
configKey: "valiform",
|
|
6
6
|
compatibility: { nuxt: ">=3.0.0" }
|
|
7
7
|
},
|
|
8
8
|
defaults: {},
|
|
9
|
-
setup(
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
async setup(r) {
|
|
10
|
+
const s = f(import.meta.url), { rules: o, rulesPath: n, ...m } = r, e = [`export const pluginOptions = ${JSON.stringify(m)};`];
|
|
11
|
+
if (n) {
|
|
12
|
+
const t = await p(n);
|
|
13
|
+
e.unshift(`import _customRules from ${JSON.stringify(t)};`), e.push("export const customRules = _customRules;");
|
|
14
|
+
} else if (o && Object.keys(o).length > 0) {
|
|
15
|
+
const t = `{
|
|
16
|
+
${Object.entries(o).map(([a, l]) => ` ${JSON.stringify(a)}: ${l.toString()}`).join(`,
|
|
12
17
|
`)}
|
|
13
|
-
}
|
|
18
|
+
}`;
|
|
19
|
+
e.push(`export const customRules = ${t};`);
|
|
20
|
+
} else
|
|
21
|
+
e.push("export const customRules = null;");
|
|
14
22
|
g({
|
|
15
23
|
filename: "valiform/options.mjs",
|
|
16
|
-
getContents: () =>
|
|
17
|
-
`export const pluginOptions = ${JSON.stringify(r)}`,
|
|
18
|
-
`export const customRules = ${i}`
|
|
19
|
-
].join(`
|
|
24
|
+
getContents: () => e.join(`
|
|
20
25
|
`),
|
|
21
26
|
write: !0
|
|
22
|
-
}),
|
|
27
|
+
}), c(s.resolve("./runtime/plugin")), i({ name: "Form", export: "Form", filePath: "@overgaming/valiform" }), i({ name: "Field", export: "Field", filePath: "@overgaming/valiform" }), v([
|
|
23
28
|
{ name: "useLocale", from: "@overgaming/valiform" },
|
|
24
29
|
{ name: "useFormContext", from: "@overgaming/valiform" },
|
|
25
30
|
{ name: "useFieldContext", from: "@overgaming/valiform" },
|
|
@@ -28,5 +33,5 @@ ${Object.entries(e).map(([m, a]) => ` ${JSON.stringify(m)}: ${a.toString()}`).j
|
|
|
28
33
|
}
|
|
29
34
|
});
|
|
30
35
|
export {
|
|
31
|
-
|
|
36
|
+
x as default
|
|
32
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overgaming/valiform",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Vue 3 form validation library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"form",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"main": "./dist/index.cjs",
|
|
23
23
|
"module": "./dist/index.js",
|
|
24
|
-
"types": "./dist/index.d.ts",
|
|
24
|
+
"types": "./dist/src/index.d.ts",
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
27
|
+
"types": "./dist/src/index.d.ts",
|
|
28
28
|
"import": "./dist/index.js",
|
|
29
29
|
"require": "./dist/index.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./nuxt": {
|
|
32
|
-
"types": "./dist/nuxt.d.ts",
|
|
32
|
+
"types": "./dist/nuxt/module.d.ts",
|
|
33
33
|
"import": "./dist/nuxt.js",
|
|
34
34
|
"require": "./dist/nuxt.cjs"
|
|
35
35
|
}
|