exact-mirror 1.0.1 → 1.0.2
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/cjs/index.d.ts +5 -2
- package/dist/cjs/index.js +8 -4
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +8 -4
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -74,8 +74,11 @@ export interface Instruction<Emit extends boolean = false> {
|
|
|
74
74
|
}
|
|
75
75
|
export declare function deepClone<T>(source: T, weak?: WeakMap<object, any>): T;
|
|
76
76
|
export interface Manifest {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
source: string;
|
|
78
|
+
externals: {
|
|
79
|
+
unions: Validator<any, TSchema, unknown, unknown>[][];
|
|
80
|
+
hof?: Record<string, Function>;
|
|
81
|
+
};
|
|
79
82
|
}
|
|
80
83
|
export declare const createMirror: <T extends TSchema, Emit extends boolean = false>(schema: T, { Compile, modules, definitions, sanitize, recursionLimit, removeUnknownUnionType, emit }?: Partial<Pick<Instruction<Emit>, "Compile" | "definitions" | "sanitize" | "modules" | "recursionLimit" | "removeUnknownUnionType" | "emit">>) => Emit extends true ? Manifest : (v: Static<T>) => Static<T>;
|
|
81
84
|
export default createMirror;
|
package/dist/cjs/index.js
CHANGED
|
@@ -375,7 +375,7 @@ var createMirror = (schema, {
|
|
|
375
375
|
removeUnknownUnionType
|
|
376
376
|
});
|
|
377
377
|
if (!unions.length && !sanitize2?.length) {
|
|
378
|
-
if (emit) return {
|
|
378
|
+
if (emit) return { source: f, externals: void 0 };
|
|
379
379
|
return Function("v", f);
|
|
380
380
|
}
|
|
381
381
|
let hof;
|
|
@@ -383,14 +383,18 @@ var createMirror = (schema, {
|
|
|
383
383
|
hof = {};
|
|
384
384
|
for (let i = 0; i < sanitize2.length; i++) hof[`h${i}`] = sanitize2[i];
|
|
385
385
|
}
|
|
386
|
+
const source = `return function mirror(v){${f}}`;
|
|
386
387
|
if (emit)
|
|
387
388
|
return {
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
source,
|
|
390
|
+
externals: {
|
|
391
|
+
unions,
|
|
392
|
+
hof
|
|
393
|
+
}
|
|
390
394
|
};
|
|
391
395
|
return Function(
|
|
392
396
|
"d",
|
|
393
|
-
|
|
397
|
+
source
|
|
394
398
|
)(
|
|
395
399
|
hof ? unions ? {
|
|
396
400
|
unions,
|
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,11 @@ export interface Instruction<Emit extends boolean = false> {
|
|
|
74
74
|
}
|
|
75
75
|
export declare function deepClone<T>(source: T, weak?: WeakMap<object, any>): T;
|
|
76
76
|
export interface Manifest {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
source: string;
|
|
78
|
+
externals: {
|
|
79
|
+
unions: Validator<any, TSchema, unknown, unknown>[][];
|
|
80
|
+
hof?: Record<string, Function>;
|
|
81
|
+
};
|
|
79
82
|
}
|
|
80
83
|
export declare const createMirror: <T extends TSchema, Emit extends boolean = false>(schema: T, { Compile, modules, definitions, sanitize, recursionLimit, removeUnknownUnionType, emit }?: Partial<Pick<Instruction<Emit>, "Compile" | "definitions" | "sanitize" | "modules" | "recursionLimit" | "removeUnknownUnionType" | "emit">>) => Emit extends true ? Manifest : (v: Static<T>) => Static<T>;
|
|
81
84
|
export default createMirror;
|
package/dist/index.mjs
CHANGED
|
@@ -348,7 +348,7 @@ var createMirror = (schema, {
|
|
|
348
348
|
removeUnknownUnionType
|
|
349
349
|
});
|
|
350
350
|
if (!unions.length && !sanitize2?.length) {
|
|
351
|
-
if (emit) return {
|
|
351
|
+
if (emit) return { source: f, externals: void 0 };
|
|
352
352
|
return Function("v", f);
|
|
353
353
|
}
|
|
354
354
|
let hof;
|
|
@@ -356,14 +356,18 @@ var createMirror = (schema, {
|
|
|
356
356
|
hof = {};
|
|
357
357
|
for (let i = 0; i < sanitize2.length; i++) hof[`h${i}`] = sanitize2[i];
|
|
358
358
|
}
|
|
359
|
+
const source = `return function mirror(v){${f}}`;
|
|
359
360
|
if (emit)
|
|
360
361
|
return {
|
|
361
|
-
|
|
362
|
-
|
|
362
|
+
source,
|
|
363
|
+
externals: {
|
|
364
|
+
unions,
|
|
365
|
+
hof
|
|
366
|
+
}
|
|
363
367
|
};
|
|
364
368
|
return Function(
|
|
365
369
|
"d",
|
|
366
|
-
|
|
370
|
+
source
|
|
367
371
|
)(
|
|
368
372
|
hof ? unions ? {
|
|
369
373
|
unions,
|