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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "vt": "bin/index.js"
5
5
  },
6
6
  "type": "module",
7
- "version": "3.2.1",
7
+ "version": "3.2.3",
8
8
  "main": "src/index.js",
9
9
  "scripts": {
10
10
  "clean": "npx rimraf test",
@@ -32,4 +32,4 @@
32
32
  "bin",
33
33
  "src"
34
34
  ]
35
- }
35
+ }
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 tsFileBase64 = Buffer.from(sourceText).toString('base64')
22
- const configModule = await import(
23
- `data:text/javascript;base64,${tsFileBase64}`
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 base64Code = Buffer.from(zodRawCode).toString('base64')
63
- const zodModule = await import(`data:text/javascript;base64,${base64Code}`)
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) {