v-transform 3.2.1 → 3.2.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/bin/index.js +607 -164
- package/package.json +2 -2
- package/src/calibrator.js +8 -7
package/package.json
CHANGED
package/src/calibrator.js
CHANGED
|
@@ -18,10 +18,10 @@ export async function calibrateTsData(raw, name, dts) {
|
|
|
18
18
|
getSchemaName: identifier => `${identifier}Schema`,
|
|
19
19
|
}
|
|
20
20
|
const zod = generate({ sourceText, ...options })
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
)
|
|
21
|
+
const dtsBlob = new Blob([sourceText], { type: 'text/javascript' })
|
|
22
|
+
const dtsUrl = URL.createObjectURL(dtsBlob)
|
|
23
|
+
const configModule = await import(dtsUrl)
|
|
24
|
+
URL.revokeObjectURL(dtsUrl)
|
|
25
25
|
const customTransformers = configModule.transformers || {}
|
|
26
26
|
const mergedTransformers = {
|
|
27
27
|
string: val => {
|
|
@@ -59,9 +59,10 @@ export async function calibrateTsData(raw, name, dts) {
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
globalThis.__MERGED_TRANSFORMERS__ = mergedTransformers
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
62
|
+
const zodBlob = new Blob([zodRawCode], { type: 'text/javascript' })
|
|
63
|
+
const objectUrl = URL.createObjectURL(zodBlob)
|
|
64
|
+
const zodModule = await import(objectUrl)
|
|
65
|
+
URL.revokeObjectURL(objectUrl)
|
|
65
66
|
const search = `${name.replace(/[-_]/g, '')}Schema`.toLocaleLowerCase()
|
|
66
67
|
const targetSchemaName = Object.keys(zodModule).find(key => {
|
|
67
68
|
if (key.toLocaleLowerCase() === search) {
|