Skip to content

Commit f902cad

Browse files
committed
Arktype code wasn't excluded from bundle due to not being dynamically loaded.
1 parent 3b7d0e1 commit f902cad

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Headlines: Added, Changed, Deprecated, Removed, Fixed, Security
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [2.15.0] - 2024-06-10
8+
## [2.15.1] - 2024-06-10
99

1010
### Changed
1111

@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Inlined the [SuperDebug](https://superforms.rocks/super-debug) css, to prevent it from being automatically bundled due to it being a default import.
1717
- The [customValidity](https://superforms.rocks/concepts/error-handling#customvalidity) option now handles object errors, and can refer to any part of the schema.
18+
- Arktype code wasn't excluded from bundle due to not being dynamically loaded.
1819

1920
## [2.14.0] - 2024-05-26
2021

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"@sinclair/typebox": ">=0.32.30 <1",
107107
"@sveltejs/kit": "1.x || 2.x",
108108
"@vinejs/vine": "^1.8.0",
109-
"arktype": ">=2.0.0-dev.15",
109+
"arktype": ">=2.0.0-dev.21",
110110
"joi": "^17.13.1",
111111
"superstruct": "^1.0.4",
112112
"svelte": "3.x || 4.x || >=5.0.0-next.51",
@@ -149,7 +149,7 @@
149149
"@sinclair/typebox": "^0.32.30",
150150
"@sodaru/yup-to-json-schema": "^2.0.1",
151151
"@vinejs/vine": "^1.8.0",
152-
"arktype": "2.0.0-dev.15",
152+
"arktype": "2.0.0-dev.21",
153153
"joi": "^17.13.1",
154154
"json-schema-to-ts": "^3.1.0",
155155
"superstruct": "^1.0.4",

pnpm-lock.yaml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/adapters/arktype.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type, type Type } from 'arktype';
1+
import type { Type } from 'arktype';
22
import {
33
type ValidationAdapter,
44
type RequiredDefaultsOptions,
@@ -11,10 +11,18 @@ import {
1111
} from './adapters.js';
1212
import { memoize } from '$lib/memoize.js';
1313

14+
async function modules() {
15+
const { type } = await import(/* webpackIgnore: true */ 'arktype');
16+
return { type };
17+
}
18+
19+
const fetchModule = /* @__PURE__ */ memoize(modules);
20+
1421
async function _validate<T extends Type>(
1522
schema: T,
1623
data: unknown
1724
): Promise<ValidationResult<Infer<T>>> {
25+
const { type } = await fetchModule();
1826
const result = schema(data);
1927
if (!(result instanceof type.errors)) {
2028
return {

0 commit comments

Comments
 (0)