@conform-to/yup 1.1.4 → 1.2.0

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/constraint.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { type Constraint } from '@conform-to/dom';
2
2
  import type * as yup from 'yup';
3
- export declare function getYupConstraint<Source extends yup.AnyObjectSchema>(source: Source): Record<string, Constraint>;
3
+ export declare function getYupConstraint<Source extends yup.AnyObjectSchema>(
4
+ source: Source,
5
+ ): Record<string, Constraint>;
package/constraint.js CHANGED
@@ -9,6 +9,7 @@ function _parseStringFieldTests(def) {
9
9
  case 'required':
10
10
  {
11
11
  constraint.required = true;
12
+ break;
12
13
  }
13
14
  case 'min':
14
15
  {
@@ -17,6 +18,7 @@ function _parseStringFieldTests(def) {
17
18
  var _test$params2;
18
19
  constraint.minLength = Number((_test$params2 = test.params) === null || _test$params2 === void 0 ? void 0 : _test$params2.min);
19
20
  }
21
+ break;
20
22
  }
21
23
  case 'max':
22
24
  {
@@ -24,6 +26,7 @@ function _parseStringFieldTests(def) {
24
26
  if (!constraint.maxLength && (_test$params3 = test.params) !== null && _test$params3 !== void 0 && _test$params3.max) {
25
27
  constraint.maxLength = Number(test.params.max);
26
28
  }
29
+ break;
27
30
  }
28
31
  case 'matches':
29
32
  {
@@ -31,6 +34,7 @@ function _parseStringFieldTests(def) {
31
34
  if (!constraint.pattern && ((_test$params4 = test.params) === null || _test$params4 === void 0 ? void 0 : _test$params4.regex) instanceof RegExp) {
32
35
  constraint.pattern = test.params.regex.source;
33
36
  }
37
+ break;
34
38
  }
35
39
  }
36
40
  }
package/constraint.mjs CHANGED
@@ -5,6 +5,7 @@ function _parseStringFieldTests(def) {
5
5
  case 'required':
6
6
  {
7
7
  constraint.required = true;
8
+ break;
8
9
  }
9
10
  case 'min':
10
11
  {
@@ -13,6 +14,7 @@ function _parseStringFieldTests(def) {
13
14
  var _test$params2;
14
15
  constraint.minLength = Number((_test$params2 = test.params) === null || _test$params2 === void 0 ? void 0 : _test$params2.min);
15
16
  }
17
+ break;
16
18
  }
17
19
  case 'max':
18
20
  {
@@ -20,6 +22,7 @@ function _parseStringFieldTests(def) {
20
22
  if (!constraint.maxLength && (_test$params3 = test.params) !== null && _test$params3 !== void 0 && _test$params3.max) {
21
23
  constraint.maxLength = Number(test.params.max);
22
24
  }
25
+ break;
23
26
  }
24
27
  case 'matches':
25
28
  {
@@ -27,6 +30,7 @@ function _parseStringFieldTests(def) {
27
30
  if (!constraint.pattern && ((_test$params4 = test.params) === null || _test$params4 === void 0 ? void 0 : _test$params4.regex) instanceof RegExp) {
28
31
  constraint.pattern = test.params.regex.source;
29
32
  }
33
+ break;
30
34
  }
31
35
  }
32
36
  }
package/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  import { type Intent, type Submission } from '@conform-to/dom';
2
2
  import * as yup from 'yup';
3
3
  export { getYupConstraint } from './constraint';
4
- export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
5
- schema: Schema | ((intent: Intent | null) => Schema);
6
- async?: false;
7
- }): Submission<yup.InferType<Schema>, string[]>;
8
- export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
9
- schema: Schema | ((intent: Intent | null) => Schema);
10
- async: true;
11
- }): Promise<Submission<yup.InferType<Schema>, string[]>>;
4
+ export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(
5
+ payload: FormData | URLSearchParams,
6
+ config: {
7
+ schema: Schema | ((intent: Intent | null) => Schema);
8
+ async?: false;
9
+ },
10
+ ): Submission<yup.InferType<Schema>, string[]>;
11
+ export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(
12
+ payload: FormData | URLSearchParams,
13
+ config: {
14
+ schema: Schema | ((intent: Intent | null) => Schema);
15
+ async: true;
16
+ },
17
+ ): Promise<Submission<yup.InferType<Schema>, string[]>>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform helpers for integrating with yup",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.1.4",
6
+ "version": "1.2.0",
7
7
  "main": "index.js",
8
8
  "module": "index.mjs",
9
9
  "types": "index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/edmundhung/conform/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@conform-to/dom": "1.1.4"
28
+ "@conform-to/dom": "1.2.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "yup": ">=0.32.0"
package/rollup.config.js DELETED
@@ -1,100 +0,0 @@
1
- import path from 'node:path';
2
- import babel from '@rollup/plugin-babel';
3
- import nodeResolve from '@rollup/plugin-node-resolve';
4
- import copy from 'rollup-plugin-copy';
5
-
6
- /** @returns {import("rollup").RollupOptions[]} */
7
- function configurePackage() {
8
- let sourceDir = '.';
9
- let outputDir = sourceDir;
10
-
11
- /** @type {import("rollup").RollupOptions} */
12
- let ESM = {
13
- external(id) {
14
- return !id.startsWith('.') && !path.isAbsolute(id);
15
- },
16
- input: `${sourceDir}/index.ts`,
17
- output: {
18
- dir: outputDir,
19
- format: 'esm',
20
- preserveModules: true,
21
- entryFileNames: '[name].mjs',
22
- },
23
- plugins: [
24
- babel({
25
- babelrc: false,
26
- configFile: false,
27
- presets: [
28
- [
29
- '@babel/preset-env',
30
- {
31
- targets: {
32
- node: '16',
33
- esmodules: true,
34
- },
35
- },
36
- ],
37
- '@babel/preset-typescript',
38
- ],
39
- plugins: [],
40
- babelHelpers: 'bundled',
41
- exclude: /node_modules/,
42
- extensions: ['.ts', '.tsx'],
43
- }),
44
- nodeResolve({
45
- extensions: ['.ts', '.tsx'],
46
- }),
47
- copy({
48
- targets: [
49
- { src: `../../README`, dest: sourceDir },
50
- { src: `../../LICENSE`, dest: sourceDir },
51
- ],
52
- }),
53
- ],
54
- };
55
-
56
- /** @type {import("rollup").RollupOptions} */
57
- let CJS = {
58
- external(id) {
59
- return !id.startsWith('.') && !path.isAbsolute(id);
60
- },
61
- input: `${sourceDir}/index.ts`,
62
- output: {
63
- dir: outputDir,
64
- format: 'cjs',
65
- preserveModules: true,
66
- exports: 'auto',
67
- },
68
- plugins: [
69
- babel({
70
- babelrc: false,
71
- configFile: false,
72
- presets: [
73
- [
74
- '@babel/preset-env',
75
- {
76
- targets: {
77
- node: '16',
78
- esmodules: true,
79
- },
80
- },
81
- ],
82
- '@babel/preset-typescript',
83
- ],
84
- plugins: [],
85
- babelHelpers: 'bundled',
86
- exclude: /node_modules/,
87
- extensions: ['.ts', '.tsx'],
88
- }),
89
- nodeResolve({
90
- extensions: ['.ts', '.tsx'],
91
- }),
92
- ],
93
- };
94
-
95
- return [ESM, CJS];
96
- }
97
-
98
- export default function rollup() {
99
- return configurePackage();
100
- }