@mionjs/run-types 0.8.0-alpha.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/.dist/cjs/index.cjs +209 -0
- package/.dist/cjs/index.cjs.map +1 -0
- package/.dist/cjs/index.d.ts +60 -0
- package/.dist/cjs/package.json +1 -0
- package/.dist/cjs/src/constants.cjs +79 -0
- package/.dist/cjs/src/constants.cjs.map +1 -0
- package/.dist/cjs/src/constants.d.ts +7 -0
- package/.dist/cjs/src/constants.functions.cjs +181 -0
- package/.dist/cjs/src/constants.functions.cjs.map +1 -0
- package/.dist/cjs/src/constants.functions.d.ts +385 -0
- package/.dist/cjs/src/constants.kind.cjs +74 -0
- package/.dist/cjs/src/constants.kind.cjs.map +1 -0
- package/.dist/cjs/src/constants.kind.d.ts +21 -0
- package/.dist/cjs/src/createRunType.cjs +284 -0
- package/.dist/cjs/src/createRunType.cjs.map +1 -0
- package/.dist/cjs/src/createRunType.d.ts +5 -0
- package/.dist/cjs/src/createRunTypeFunctions.cjs +78 -0
- package/.dist/cjs/src/createRunTypeFunctions.cjs.map +1 -0
- package/.dist/cjs/src/createRunTypeFunctions.d.ts +12 -0
- package/.dist/cjs/src/formats.runtype.cjs +7 -0
- package/.dist/cjs/src/formats.runtype.cjs.map +1 -0
- package/.dist/cjs/src/formats.runtype.d.ts +6 -0
- package/.dist/cjs/src/jitCompilers/binary/binarySpec/binaryHelpers.cjs +109 -0
- package/.dist/cjs/src/jitCompilers/binary/binarySpec/binaryHelpers.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/binary/binarySpec/binaryHelpers.d.ts +30 -0
- package/.dist/cjs/src/jitCompilers/binary/fromBinary.cjs +383 -0
- package/.dist/cjs/src/jitCompilers/binary/fromBinary.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/binary/fromBinary.d.ts +7 -0
- package/.dist/cjs/src/jitCompilers/binary/toBinary.cjs +338 -0
- package/.dist/cjs/src/jitCompilers/binary/toBinary.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/binary/toBinary.d.ts +7 -0
- package/.dist/cjs/src/jitCompilers/equalsHelpers.cjs +37 -0
- package/.dist/cjs/src/jitCompilers/equalsHelpers.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/equalsHelpers.d.ts +4 -0
- package/.dist/cjs/src/jitCompilers/json/jsonSpec/jsonHelpers.cjs +56 -0
- package/.dist/cjs/src/jitCompilers/json/jsonSpec/jsonHelpers.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/json/jsonSpec/jsonHelpers.d.ts +27 -0
- package/.dist/cjs/src/jitCompilers/json/stringifyJson.cjs +399 -0
- package/.dist/cjs/src/jitCompilers/json/stringifyJson.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/json/stringifyJson.d.ts +10 -0
- package/.dist/cjs/src/jitCompilers/json/stringifySpec/stringifyHelpers.cjs +51 -0
- package/.dist/cjs/src/jitCompilers/json/stringifySpec/stringifyHelpers.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/json/stringifySpec/stringifyHelpers.d.ts +27 -0
- package/.dist/cjs/src/jitCompilers/json/toJsCode.cjs +123 -0
- package/.dist/cjs/src/jitCompilers/json/toJsCode.cjs.map +1 -0
- package/.dist/cjs/src/jitCompilers/json/toJsCode.d.ts +5 -0
- package/.dist/cjs/src/lib/baseRunTypeFormat.cjs +200 -0
- package/.dist/cjs/src/lib/baseRunTypeFormat.cjs.map +1 -0
- package/.dist/cjs/src/lib/baseRunTypeFormat.d.ts +50 -0
- package/.dist/cjs/src/lib/baseRunTypes.cjs +308 -0
- package/.dist/cjs/src/lib/baseRunTypes.cjs.map +1 -0
- package/.dist/cjs/src/lib/baseRunTypes.d.ts +75 -0
- package/.dist/cjs/src/lib/createJitFunction.cjs +60 -0
- package/.dist/cjs/src/lib/createJitFunction.cjs.map +1 -0
- package/.dist/cjs/src/lib/createJitFunction.d.ts +5 -0
- package/.dist/cjs/src/lib/dkProxy.cjs +23 -0
- package/.dist/cjs/src/lib/dkProxy.cjs.map +1 -0
- package/.dist/cjs/src/lib/dkProxy.d.ts +4 -0
- package/.dist/cjs/src/lib/formats.cjs +89 -0
- package/.dist/cjs/src/lib/formats.cjs.map +1 -0
- package/.dist/cjs/src/lib/formats.d.ts +18 -0
- package/.dist/cjs/src/lib/guards.cjs +243 -0
- package/.dist/cjs/src/lib/guards.cjs.map +1 -0
- package/.dist/cjs/src/lib/guards.d.ts +120 -0
- package/.dist/cjs/src/lib/jitFnCompiler.cjs +648 -0
- package/.dist/cjs/src/lib/jitFnCompiler.cjs.map +1 -0
- package/.dist/cjs/src/lib/jitFnCompiler.d.ts +109 -0
- package/.dist/cjs/src/lib/jitFnsRegistry.cjs +41 -0
- package/.dist/cjs/src/lib/jitFnsRegistry.cjs.map +1 -0
- package/.dist/cjs/src/lib/jitFnsRegistry.d.ts +6 -0
- package/.dist/cjs/src/lib/typeId.cjs +205 -0
- package/.dist/cjs/src/lib/typeId.cjs.map +1 -0
- package/.dist/cjs/src/lib/typeId.d.ts +6 -0
- package/.dist/cjs/src/lib/utils.cjs +325 -0
- package/.dist/cjs/src/lib/utils.cjs.map +1 -0
- package/.dist/cjs/src/lib/utils.d.ts +32 -0
- package/.dist/cjs/src/mocking/constants.mock.cjs +108 -0
- package/.dist/cjs/src/mocking/constants.mock.cjs.map +1 -0
- package/.dist/cjs/src/mocking/constants.mock.d.ts +85 -0
- package/.dist/cjs/src/mocking/mockRegistry.cjs +12 -0
- package/.dist/cjs/src/mocking/mockRegistry.cjs.map +1 -0
- package/.dist/cjs/src/mocking/mockRegistry.d.ts +3 -0
- package/.dist/cjs/src/mocking/mockType.cjs +310 -0
- package/.dist/cjs/src/mocking/mockType.cjs.map +1 -0
- package/.dist/cjs/src/mocking/mockType.d.ts +3 -0
- package/.dist/cjs/src/mocking/mockUtils.cjs +62 -0
- package/.dist/cjs/src/mocking/mockUtils.cjs.map +1 -0
- package/.dist/cjs/src/mocking/mockUtils.d.ts +15 -0
- package/.dist/cjs/src/nodes/atomic/any.cjs +18 -0
- package/.dist/cjs/src/nodes/atomic/any.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/any.d.ts +8 -0
- package/.dist/cjs/src/nodes/atomic/bigInt.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/bigInt.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/bigInt.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/boolean.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/boolean.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/boolean.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/date.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/date.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/date.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/enum.cjs +22 -0
- package/.dist/cjs/src/nodes/atomic/enum.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/enum.d.ts +8 -0
- package/.dist/cjs/src/nodes/atomic/enumMember.cjs +24 -0
- package/.dist/cjs/src/nodes/atomic/enumMember.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/enumMember.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/literal.cjs +126 -0
- package/.dist/cjs/src/nodes/atomic/literal.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/literal.d.ts +20 -0
- package/.dist/cjs/src/nodes/atomic/never.cjs +22 -0
- package/.dist/cjs/src/nodes/atomic/never.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/never.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/null.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/null.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/null.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/number.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/number.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/number.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/object.cjs +14 -0
- package/.dist/cjs/src/nodes/atomic/object.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/object.d.ts +8 -0
- package/.dist/cjs/src/nodes/atomic/regexp.cjs +23 -0
- package/.dist/cjs/src/nodes/atomic/regexp.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/regexp.d.ts +10 -0
- package/.dist/cjs/src/nodes/atomic/string.cjs +14 -0
- package/.dist/cjs/src/nodes/atomic/string.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/string.d.ts +8 -0
- package/.dist/cjs/src/nodes/atomic/symbol.cjs +26 -0
- package/.dist/cjs/src/nodes/atomic/symbol.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/symbol.d.ts +11 -0
- package/.dist/cjs/src/nodes/atomic/undefined.cjs +17 -0
- package/.dist/cjs/src/nodes/atomic/undefined.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/undefined.d.ts +9 -0
- package/.dist/cjs/src/nodes/atomic/unknown.cjs +8 -0
- package/.dist/cjs/src/nodes/atomic/unknown.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/unknown.d.ts +3 -0
- package/.dist/cjs/src/nodes/atomic/void.cjs +20 -0
- package/.dist/cjs/src/nodes/atomic/void.cjs.map +1 -0
- package/.dist/cjs/src/nodes/atomic/void.d.ts +10 -0
- package/.dist/cjs/src/nodes/collection/class.cjs +38 -0
- package/.dist/cjs/src/nodes/collection/class.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/class.d.ts +9 -0
- package/.dist/cjs/src/nodes/collection/functionParams.cjs +33 -0
- package/.dist/cjs/src/nodes/collection/functionParams.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/functionParams.d.ts +9 -0
- package/.dist/cjs/src/nodes/collection/interface.cjs +221 -0
- package/.dist/cjs/src/nodes/collection/interface.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/interface.d.ts +43 -0
- package/.dist/cjs/src/nodes/collection/intersection.cjs +21 -0
- package/.dist/cjs/src/nodes/collection/intersection.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/intersection.d.ts +9 -0
- package/.dist/cjs/src/nodes/collection/tuple.cjs +74 -0
- package/.dist/cjs/src/nodes/collection/tuple.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/tuple.d.ts +18 -0
- package/.dist/cjs/src/nodes/collection/union.cjs +162 -0
- package/.dist/cjs/src/nodes/collection/union.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/union.d.ts +19 -0
- package/.dist/cjs/src/nodes/collection/unionDiscriminator.cjs +198 -0
- package/.dist/cjs/src/nodes/collection/unionDiscriminator.cjs.map +1 -0
- package/.dist/cjs/src/nodes/collection/unionDiscriminator.d.ts +21 -0
- package/.dist/cjs/src/nodes/function/function.cjs +155 -0
- package/.dist/cjs/src/nodes/function/function.cjs.map +1 -0
- package/.dist/cjs/src/nodes/function/function.d.ts +33 -0
- package/.dist/cjs/src/nodes/member/array.cjs +154 -0
- package/.dist/cjs/src/nodes/member/array.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/array.d.ts +24 -0
- package/.dist/cjs/src/nodes/member/callSignature.cjs +40 -0
- package/.dist/cjs/src/nodes/member/callSignature.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/callSignature.d.ts +11 -0
- package/.dist/cjs/src/nodes/member/genericMember.cjs +68 -0
- package/.dist/cjs/src/nodes/member/genericMember.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/genericMember.d.ts +15 -0
- package/.dist/cjs/src/nodes/member/indexProperty.cjs +130 -0
- package/.dist/cjs/src/nodes/member/indexProperty.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/indexProperty.d.ts +21 -0
- package/.dist/cjs/src/nodes/member/method.cjs +41 -0
- package/.dist/cjs/src/nodes/member/method.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/method.d.ts +11 -0
- package/.dist/cjs/src/nodes/member/methodSignature.cjs +44 -0
- package/.dist/cjs/src/nodes/member/methodSignature.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/methodSignature.d.ts +12 -0
- package/.dist/cjs/src/nodes/member/param.cjs +17 -0
- package/.dist/cjs/src/nodes/member/param.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/param.d.ts +8 -0
- package/.dist/cjs/src/nodes/member/property.cjs +85 -0
- package/.dist/cjs/src/nodes/member/property.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/property.d.ts +19 -0
- package/.dist/cjs/src/nodes/member/restParams.cjs +15 -0
- package/.dist/cjs/src/nodes/member/restParams.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/restParams.d.ts +7 -0
- package/.dist/cjs/src/nodes/member/tupleMember.cjs +93 -0
- package/.dist/cjs/src/nodes/member/tupleMember.cjs.map +1 -0
- package/.dist/cjs/src/nodes/member/tupleMember.d.ts +20 -0
- package/.dist/cjs/src/nodes/native/Iterable.cjs +135 -0
- package/.dist/cjs/src/nodes/native/Iterable.cjs.map +1 -0
- package/.dist/cjs/src/nodes/native/Iterable.d.ts +18 -0
- package/.dist/cjs/src/nodes/native/map.cjs +96 -0
- package/.dist/cjs/src/nodes/native/map.cjs.map +1 -0
- package/.dist/cjs/src/nodes/native/map.d.ts +42 -0
- package/.dist/cjs/src/nodes/native/nonSerializable.cjs +36 -0
- package/.dist/cjs/src/nodes/native/nonSerializable.cjs.map +1 -0
- package/.dist/cjs/src/nodes/native/nonSerializable.d.ts +14 -0
- package/.dist/cjs/src/nodes/native/promise.cjs +38 -0
- package/.dist/cjs/src/nodes/native/promise.cjs.map +1 -0
- package/.dist/cjs/src/nodes/native/promise.d.ts +15 -0
- package/.dist/cjs/src/nodes/native/set.cjs +60 -0
- package/.dist/cjs/src/nodes/native/set.cjs.map +1 -0
- package/.dist/cjs/src/nodes/native/set.d.ts +30 -0
- package/.dist/cjs/src/run-types-pure-fns.cjs +112 -0
- package/.dist/cjs/src/run-types-pure-fns.cjs.map +1 -0
- package/.dist/cjs/src/run-types-pure-fns.d.ts +7 -0
- package/.dist/cjs/src/types.cjs +59 -0
- package/.dist/cjs/src/types.cjs.map +1 -0
- package/.dist/cjs/src/types.d.ts +152 -0
- package/.dist/esm/index.d.ts +60 -0
- package/.dist/esm/index.js +209 -0
- package/.dist/esm/index.js.map +1 -0
- package/.dist/esm/src/constants.d.ts +7 -0
- package/.dist/esm/src/constants.functions.d.ts +385 -0
- package/.dist/esm/src/constants.functions.js +181 -0
- package/.dist/esm/src/constants.functions.js.map +1 -0
- package/.dist/esm/src/constants.js +79 -0
- package/.dist/esm/src/constants.js.map +1 -0
- package/.dist/esm/src/constants.kind.d.ts +21 -0
- package/.dist/esm/src/constants.kind.js +74 -0
- package/.dist/esm/src/constants.kind.js.map +1 -0
- package/.dist/esm/src/createRunType.d.ts +5 -0
- package/.dist/esm/src/createRunType.js +284 -0
- package/.dist/esm/src/createRunType.js.map +1 -0
- package/.dist/esm/src/createRunTypeFunctions.d.ts +12 -0
- package/.dist/esm/src/createRunTypeFunctions.js +78 -0
- package/.dist/esm/src/createRunTypeFunctions.js.map +1 -0
- package/.dist/esm/src/formats.runtype.d.ts +6 -0
- package/.dist/esm/src/formats.runtype.js +7 -0
- package/.dist/esm/src/formats.runtype.js.map +1 -0
- package/.dist/esm/src/jitCompilers/binary/binarySpec/binaryHelpers.d.ts +30 -0
- package/.dist/esm/src/jitCompilers/binary/binarySpec/binaryHelpers.js +109 -0
- package/.dist/esm/src/jitCompilers/binary/binarySpec/binaryHelpers.js.map +1 -0
- package/.dist/esm/src/jitCompilers/binary/fromBinary.d.ts +7 -0
- package/.dist/esm/src/jitCompilers/binary/fromBinary.js +383 -0
- package/.dist/esm/src/jitCompilers/binary/fromBinary.js.map +1 -0
- package/.dist/esm/src/jitCompilers/binary/toBinary.d.ts +7 -0
- package/.dist/esm/src/jitCompilers/binary/toBinary.js +338 -0
- package/.dist/esm/src/jitCompilers/binary/toBinary.js.map +1 -0
- package/.dist/esm/src/jitCompilers/equalsHelpers.d.ts +4 -0
- package/.dist/esm/src/jitCompilers/equalsHelpers.js +37 -0
- package/.dist/esm/src/jitCompilers/equalsHelpers.js.map +1 -0
- package/.dist/esm/src/jitCompilers/json/jsonSpec/jsonHelpers.d.ts +27 -0
- package/.dist/esm/src/jitCompilers/json/jsonSpec/jsonHelpers.js +56 -0
- package/.dist/esm/src/jitCompilers/json/jsonSpec/jsonHelpers.js.map +1 -0
- package/.dist/esm/src/jitCompilers/json/stringifyJson.d.ts +10 -0
- package/.dist/esm/src/jitCompilers/json/stringifyJson.js +399 -0
- package/.dist/esm/src/jitCompilers/json/stringifyJson.js.map +1 -0
- package/.dist/esm/src/jitCompilers/json/stringifySpec/stringifyHelpers.d.ts +27 -0
- package/.dist/esm/src/jitCompilers/json/stringifySpec/stringifyHelpers.js +51 -0
- package/.dist/esm/src/jitCompilers/json/stringifySpec/stringifyHelpers.js.map +1 -0
- package/.dist/esm/src/jitCompilers/json/toJsCode.d.ts +5 -0
- package/.dist/esm/src/jitCompilers/json/toJsCode.js +123 -0
- package/.dist/esm/src/jitCompilers/json/toJsCode.js.map +1 -0
- package/.dist/esm/src/lib/baseRunTypeFormat.d.ts +50 -0
- package/.dist/esm/src/lib/baseRunTypeFormat.js +200 -0
- package/.dist/esm/src/lib/baseRunTypeFormat.js.map +1 -0
- package/.dist/esm/src/lib/baseRunTypes.d.ts +75 -0
- package/.dist/esm/src/lib/baseRunTypes.js +308 -0
- package/.dist/esm/src/lib/baseRunTypes.js.map +1 -0
- package/.dist/esm/src/lib/createJitFunction.d.ts +5 -0
- package/.dist/esm/src/lib/createJitFunction.js +60 -0
- package/.dist/esm/src/lib/createJitFunction.js.map +1 -0
- package/.dist/esm/src/lib/dkProxy.d.ts +4 -0
- package/.dist/esm/src/lib/dkProxy.js +23 -0
- package/.dist/esm/src/lib/dkProxy.js.map +1 -0
- package/.dist/esm/src/lib/formats.d.ts +18 -0
- package/.dist/esm/src/lib/formats.js +89 -0
- package/.dist/esm/src/lib/formats.js.map +1 -0
- package/.dist/esm/src/lib/guards.d.ts +120 -0
- package/.dist/esm/src/lib/guards.js +243 -0
- package/.dist/esm/src/lib/guards.js.map +1 -0
- package/.dist/esm/src/lib/jitFnCompiler.d.ts +109 -0
- package/.dist/esm/src/lib/jitFnCompiler.js +648 -0
- package/.dist/esm/src/lib/jitFnCompiler.js.map +1 -0
- package/.dist/esm/src/lib/jitFnsRegistry.d.ts +6 -0
- package/.dist/esm/src/lib/jitFnsRegistry.js +41 -0
- package/.dist/esm/src/lib/jitFnsRegistry.js.map +1 -0
- package/.dist/esm/src/lib/typeId.d.ts +6 -0
- package/.dist/esm/src/lib/typeId.js +205 -0
- package/.dist/esm/src/lib/typeId.js.map +1 -0
- package/.dist/esm/src/lib/utils.d.ts +32 -0
- package/.dist/esm/src/lib/utils.js +325 -0
- package/.dist/esm/src/lib/utils.js.map +1 -0
- package/.dist/esm/src/mocking/constants.mock.d.ts +85 -0
- package/.dist/esm/src/mocking/constants.mock.js +108 -0
- package/.dist/esm/src/mocking/constants.mock.js.map +1 -0
- package/.dist/esm/src/mocking/mockRegistry.d.ts +3 -0
- package/.dist/esm/src/mocking/mockRegistry.js +12 -0
- package/.dist/esm/src/mocking/mockRegistry.js.map +1 -0
- package/.dist/esm/src/mocking/mockType.d.ts +3 -0
- package/.dist/esm/src/mocking/mockType.js +310 -0
- package/.dist/esm/src/mocking/mockType.js.map +1 -0
- package/.dist/esm/src/mocking/mockUtils.d.ts +15 -0
- package/.dist/esm/src/mocking/mockUtils.js +62 -0
- package/.dist/esm/src/mocking/mockUtils.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/any.d.ts +8 -0
- package/.dist/esm/src/nodes/atomic/any.js +18 -0
- package/.dist/esm/src/nodes/atomic/any.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/bigInt.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/bigInt.js +20 -0
- package/.dist/esm/src/nodes/atomic/bigInt.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/boolean.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/boolean.js +20 -0
- package/.dist/esm/src/nodes/atomic/boolean.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/date.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/date.js +20 -0
- package/.dist/esm/src/nodes/atomic/date.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/enum.d.ts +8 -0
- package/.dist/esm/src/nodes/atomic/enum.js +22 -0
- package/.dist/esm/src/nodes/atomic/enum.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/enumMember.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/enumMember.js +24 -0
- package/.dist/esm/src/nodes/atomic/enumMember.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/literal.d.ts +20 -0
- package/.dist/esm/src/nodes/atomic/literal.js +126 -0
- package/.dist/esm/src/nodes/atomic/literal.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/never.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/never.js +22 -0
- package/.dist/esm/src/nodes/atomic/never.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/null.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/null.js +20 -0
- package/.dist/esm/src/nodes/atomic/null.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/number.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/number.js +20 -0
- package/.dist/esm/src/nodes/atomic/number.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/object.d.ts +8 -0
- package/.dist/esm/src/nodes/atomic/object.js +14 -0
- package/.dist/esm/src/nodes/atomic/object.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/regexp.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/regexp.js +23 -0
- package/.dist/esm/src/nodes/atomic/regexp.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/string.d.ts +8 -0
- package/.dist/esm/src/nodes/atomic/string.js +14 -0
- package/.dist/esm/src/nodes/atomic/string.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/symbol.d.ts +11 -0
- package/.dist/esm/src/nodes/atomic/symbol.js +26 -0
- package/.dist/esm/src/nodes/atomic/symbol.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/undefined.d.ts +9 -0
- package/.dist/esm/src/nodes/atomic/undefined.js +17 -0
- package/.dist/esm/src/nodes/atomic/undefined.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/unknown.d.ts +3 -0
- package/.dist/esm/src/nodes/atomic/unknown.js +8 -0
- package/.dist/esm/src/nodes/atomic/unknown.js.map +1 -0
- package/.dist/esm/src/nodes/atomic/void.d.ts +10 -0
- package/.dist/esm/src/nodes/atomic/void.js +20 -0
- package/.dist/esm/src/nodes/atomic/void.js.map +1 -0
- package/.dist/esm/src/nodes/collection/class.d.ts +9 -0
- package/.dist/esm/src/nodes/collection/class.js +38 -0
- package/.dist/esm/src/nodes/collection/class.js.map +1 -0
- package/.dist/esm/src/nodes/collection/functionParams.d.ts +9 -0
- package/.dist/esm/src/nodes/collection/functionParams.js +33 -0
- package/.dist/esm/src/nodes/collection/functionParams.js.map +1 -0
- package/.dist/esm/src/nodes/collection/interface.d.ts +43 -0
- package/.dist/esm/src/nodes/collection/interface.js +221 -0
- package/.dist/esm/src/nodes/collection/interface.js.map +1 -0
- package/.dist/esm/src/nodes/collection/intersection.d.ts +9 -0
- package/.dist/esm/src/nodes/collection/intersection.js +21 -0
- package/.dist/esm/src/nodes/collection/intersection.js.map +1 -0
- package/.dist/esm/src/nodes/collection/tuple.d.ts +18 -0
- package/.dist/esm/src/nodes/collection/tuple.js +74 -0
- package/.dist/esm/src/nodes/collection/tuple.js.map +1 -0
- package/.dist/esm/src/nodes/collection/union.d.ts +19 -0
- package/.dist/esm/src/nodes/collection/union.js +162 -0
- package/.dist/esm/src/nodes/collection/union.js.map +1 -0
- package/.dist/esm/src/nodes/collection/unionDiscriminator.d.ts +21 -0
- package/.dist/esm/src/nodes/collection/unionDiscriminator.js +198 -0
- package/.dist/esm/src/nodes/collection/unionDiscriminator.js.map +1 -0
- package/.dist/esm/src/nodes/function/function.d.ts +33 -0
- package/.dist/esm/src/nodes/function/function.js +155 -0
- package/.dist/esm/src/nodes/function/function.js.map +1 -0
- package/.dist/esm/src/nodes/member/array.d.ts +24 -0
- package/.dist/esm/src/nodes/member/array.js +154 -0
- package/.dist/esm/src/nodes/member/array.js.map +1 -0
- package/.dist/esm/src/nodes/member/callSignature.d.ts +11 -0
- package/.dist/esm/src/nodes/member/callSignature.js +40 -0
- package/.dist/esm/src/nodes/member/callSignature.js.map +1 -0
- package/.dist/esm/src/nodes/member/genericMember.d.ts +15 -0
- package/.dist/esm/src/nodes/member/genericMember.js +68 -0
- package/.dist/esm/src/nodes/member/genericMember.js.map +1 -0
- package/.dist/esm/src/nodes/member/indexProperty.d.ts +21 -0
- package/.dist/esm/src/nodes/member/indexProperty.js +130 -0
- package/.dist/esm/src/nodes/member/indexProperty.js.map +1 -0
- package/.dist/esm/src/nodes/member/method.d.ts +11 -0
- package/.dist/esm/src/nodes/member/method.js +41 -0
- package/.dist/esm/src/nodes/member/method.js.map +1 -0
- package/.dist/esm/src/nodes/member/methodSignature.d.ts +12 -0
- package/.dist/esm/src/nodes/member/methodSignature.js +44 -0
- package/.dist/esm/src/nodes/member/methodSignature.js.map +1 -0
- package/.dist/esm/src/nodes/member/param.d.ts +8 -0
- package/.dist/esm/src/nodes/member/param.js +17 -0
- package/.dist/esm/src/nodes/member/param.js.map +1 -0
- package/.dist/esm/src/nodes/member/property.d.ts +19 -0
- package/.dist/esm/src/nodes/member/property.js +85 -0
- package/.dist/esm/src/nodes/member/property.js.map +1 -0
- package/.dist/esm/src/nodes/member/restParams.d.ts +7 -0
- package/.dist/esm/src/nodes/member/restParams.js +15 -0
- package/.dist/esm/src/nodes/member/restParams.js.map +1 -0
- package/.dist/esm/src/nodes/member/tupleMember.d.ts +20 -0
- package/.dist/esm/src/nodes/member/tupleMember.js +93 -0
- package/.dist/esm/src/nodes/member/tupleMember.js.map +1 -0
- package/.dist/esm/src/nodes/native/Iterable.d.ts +18 -0
- package/.dist/esm/src/nodes/native/Iterable.js +135 -0
- package/.dist/esm/src/nodes/native/Iterable.js.map +1 -0
- package/.dist/esm/src/nodes/native/map.d.ts +42 -0
- package/.dist/esm/src/nodes/native/map.js +96 -0
- package/.dist/esm/src/nodes/native/map.js.map +1 -0
- package/.dist/esm/src/nodes/native/nonSerializable.d.ts +14 -0
- package/.dist/esm/src/nodes/native/nonSerializable.js +36 -0
- package/.dist/esm/src/nodes/native/nonSerializable.js.map +1 -0
- package/.dist/esm/src/nodes/native/promise.d.ts +15 -0
- package/.dist/esm/src/nodes/native/promise.js +38 -0
- package/.dist/esm/src/nodes/native/promise.js.map +1 -0
- package/.dist/esm/src/nodes/native/set.d.ts +30 -0
- package/.dist/esm/src/nodes/native/set.js +60 -0
- package/.dist/esm/src/nodes/native/set.js.map +1 -0
- package/.dist/esm/src/run-types-pure-fns.d.ts +7 -0
- package/.dist/esm/src/run-types-pure-fns.js +112 -0
- package/.dist/esm/src/run-types-pure-fns.js.map +1 -0
- package/.dist/esm/src/types.d.ts +152 -0
- package/.dist/esm/src/types.js +59 -0
- package/.dist/esm/src/types.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/package.json +66 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { getTotalComplexity, sortRunTypeByComplexity } from "../../lib/utils.js";
|
|
2
|
+
import { isAnyRunType, isUnknownRunType } from "../../lib/guards.js";
|
|
3
|
+
function __assignType(fn, args) {
|
|
4
|
+
fn.__type = args;
|
|
5
|
+
return fn;
|
|
6
|
+
}
|
|
7
|
+
const __ΩFlattenedProp = ["CollectionRunType", "unionItem", "unionIndex", "PropertyRunType", "prop", "typeID", "compiledName", "FlattenedProp", `P"w!4"P&'J4#"w$4%P&'J4&&4'Mw(y`];
|
|
8
|
+
const __ΩSplitUnionResult = ["BaseRunType", "simpleItems", "CollectionRunType", "objectTypes", "anyItem", "SplitUnionResult", 'P"w!F4""w#F4$"w!4%8Mw&y'];
|
|
9
|
+
function splitUnionItems(comp, urt, unionChildren) {
|
|
10
|
+
const unionItems = unionChildren || urt.getJitChildren(comp);
|
|
11
|
+
const objectTypes = [];
|
|
12
|
+
const simpleItems = [];
|
|
13
|
+
let anyItem;
|
|
14
|
+
unionItems.forEach(__assignType((unionItem) => {
|
|
15
|
+
if (isAnyRunType(unionItem) || isUnknownRunType(unionItem)) {
|
|
16
|
+
if (!anyItem)
|
|
17
|
+
anyItem = unionItem;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const isObj = urt.isTypeWithProperties(unionItem);
|
|
21
|
+
if (!isObj)
|
|
22
|
+
return simpleItems.push(unionItem);
|
|
23
|
+
return objectTypes.push(unionItem);
|
|
24
|
+
}, ["unionItem", "", 'P"2!"/"']));
|
|
25
|
+
const sortedObjectTypes = sortUnreachableTypes(comp, objectTypes);
|
|
26
|
+
return { simpleItems, objectTypes: sortedObjectTypes, anyItem };
|
|
27
|
+
}
|
|
28
|
+
splitUnionItems.__type = ["JitFnCompiler", "comp", "UnionRunType", "urt", "BaseRunType", "unionChildren", () => __ΩSplitUnionResult, "splitUnionItems", `P"w!2""w#2$"w%F2&8n'/(`];
|
|
29
|
+
function sortUnreachableTypes(comp, objectTypes) {
|
|
30
|
+
if (objectTypes.length <= 1)
|
|
31
|
+
return objectTypes;
|
|
32
|
+
const typePropsMap = (Map.Ω = [["CollectionRunType", '"w!'], ["P&'JD"]], /* @__PURE__ */ new Map());
|
|
33
|
+
objectTypes.forEach(__assignType((objType) => {
|
|
34
|
+
const props = objType.getJitChildren(comp);
|
|
35
|
+
const propTypeIDs = (Set.Ω = [["P&'J"]], /* @__PURE__ */ new Set());
|
|
36
|
+
props.forEach(__assignType((prop) => propTypeIDs.add(prop.getTypeID()), ["prop", "", 'P"2!"/"']));
|
|
37
|
+
typePropsMap.set(objType, propTypeIDs);
|
|
38
|
+
}, ["objType", "", 'P"2!"/"']));
|
|
39
|
+
const isSubsetOf = __assignType((smaller, larger) => {
|
|
40
|
+
const smallerProps = typePropsMap.get(smaller);
|
|
41
|
+
const largerProps = typePropsMap.get(larger);
|
|
42
|
+
if (smallerProps.size >= largerProps.size)
|
|
43
|
+
return false;
|
|
44
|
+
for (const typeID of smallerProps) {
|
|
45
|
+
if (!largerProps.has(typeID))
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}, ["CollectionRunType", "smaller", "larger", "", 'P"w!2""w!2#)/$']);
|
|
50
|
+
const processed = (Set.Ω = [["CollectionRunType", '"w!']], /* @__PURE__ */ new Set());
|
|
51
|
+
const result = [];
|
|
52
|
+
for (let i = 0; i < objectTypes.length; i++) {
|
|
53
|
+
const current = objectTypes[i];
|
|
54
|
+
if (processed.has(current))
|
|
55
|
+
continue;
|
|
56
|
+
const relatedGroup = [current];
|
|
57
|
+
processed.add(current);
|
|
58
|
+
for (let j = 0; j < objectTypes.length; j++) {
|
|
59
|
+
if (i === j)
|
|
60
|
+
continue;
|
|
61
|
+
const other = objectTypes[j];
|
|
62
|
+
if (processed.has(other))
|
|
63
|
+
continue;
|
|
64
|
+
if (isSubsetOf(current, other) || isSubsetOf(other, current)) {
|
|
65
|
+
relatedGroup.push(other);
|
|
66
|
+
processed.add(other);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (relatedGroup.length > 1) {
|
|
70
|
+
relatedGroup.sort(__assignType((a, b) => {
|
|
71
|
+
const aSize = typePropsMap.get(a).size;
|
|
72
|
+
const bSize = typePropsMap.get(b).size;
|
|
73
|
+
return bSize - aSize;
|
|
74
|
+
}, ["a", "b", "", 'P"2!"2""/#']));
|
|
75
|
+
}
|
|
76
|
+
result.push(...relatedGroup);
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
sortUnreachableTypes.__type = ["JitFnCompiler", "comp", "CollectionRunType", "objectTypes", "sortUnreachableTypes", 'P"w!2""w#F2$"w#F/%'];
|
|
81
|
+
function markDiscriminators(comp, urt, unionItems) {
|
|
82
|
+
if (urt.hasDiscriminators !== void 0 && urt.hasObjectTypes !== void 0)
|
|
83
|
+
return;
|
|
84
|
+
const objectTypes = unionItems.filter(__assignType((item) => urt.isTypeWithProperties(item), ["item", "", 'P"2!"/"']));
|
|
85
|
+
const namedDiscriminators = getDiscriminatorProperties(comp, urt, objectTypes, initGetCompiledName());
|
|
86
|
+
const uniqueDiscriminators = getUniqueDiscriminatorProperties(comp, urt, objectTypes, initGetCompiledName());
|
|
87
|
+
urt.hasObjectTypes = !!objectTypes.length;
|
|
88
|
+
urt.hasDiscriminators = !!namedDiscriminators.length || !!uniqueDiscriminators.length;
|
|
89
|
+
}
|
|
90
|
+
markDiscriminators.__type = ["JitFnCompiler", "comp", "UnionRunType", "urt", "BaseRunType", "unionItems", "markDiscriminators", `P"w!2""w#2$"w%F2&"/'`];
|
|
91
|
+
const __ΩPropUnionItemPair = ["PropertyRunType", "prop", "CollectionRunType", "unionItem", "PropUnionItemPair", 'P"w!4""w#4$Mw%y'];
|
|
92
|
+
function getDiscriminatorProperties(comp, urt, unionTypes, getCompiledName) {
|
|
93
|
+
if (!unionTypes.length)
|
|
94
|
+
return [];
|
|
95
|
+
const propByName = (Map.Ω = [["P&'J"], [() => __ΩPropUnionItemPair, "n!F"]], /* @__PURE__ */ new Map());
|
|
96
|
+
unionTypes.forEach(__assignType((unionItem) => {
|
|
97
|
+
const props = unionItem.getJitChildren(comp);
|
|
98
|
+
props.forEach(__assignType((prop) => {
|
|
99
|
+
const name = prop.getChildVarName(comp);
|
|
100
|
+
const existing = propByName.get(name) || [];
|
|
101
|
+
propByName.set(name, [...existing, { prop, unionItem }]);
|
|
102
|
+
}, ["prop", "", 'P"2!"/"']));
|
|
103
|
+
}, ["unionItem", "", 'P"2!"/"']));
|
|
104
|
+
const propsOnAllTypes = Array.from(propByName.entries()).filter(__assignType(([, props]) => props.length === unionTypes.length, ["param0", "", 'P"2!"/"'])).map(__assignType(([key, props]) => ({
|
|
105
|
+
name: key,
|
|
106
|
+
props,
|
|
107
|
+
complexity: props.reduce(__assignType((acc, item) => acc + getTotalComplexity(comp, item.prop), ["acc", "item", "", 'P"2!"2""/#']), 0),
|
|
108
|
+
isUniqueType: props.every(__assignType((item) => {
|
|
109
|
+
const child = item;
|
|
110
|
+
const typeID = child.prop.getTypeID();
|
|
111
|
+
const isDiff = props.every(__assignType((otherItem) => child.prop === otherItem.prop || otherItem.prop.getTypeID() !== typeID, ["otherItem", "", 'P"2!"/"']));
|
|
112
|
+
return isDiff;
|
|
113
|
+
}, ["item", "", 'P"2!"/"']))
|
|
114
|
+
}), ["param0", "", 'P"2!"/"'])).filter(__assignType((item) => item.isUniqueType, ["item", "", 'P"2!"/"']));
|
|
115
|
+
const lessComplexProps = propsOnAllTypes.toSorted(__assignType((a, b) => a.complexity - b.complexity, ["a", "b", "", 'P"2!"2""/#']));
|
|
116
|
+
const lessComplex = lessComplexProps[0];
|
|
117
|
+
if (!lessComplex)
|
|
118
|
+
return [];
|
|
119
|
+
return lessComplex.props.map(__assignType((item) => {
|
|
120
|
+
item.prop.isUnionDiscriminator = true;
|
|
121
|
+
const unionIndex = urt.getUnionItemIndex(comp, item.unionItem);
|
|
122
|
+
const typeID = item.prop.getTypeID();
|
|
123
|
+
return {
|
|
124
|
+
unionItem: item.unionItem,
|
|
125
|
+
unionIndex,
|
|
126
|
+
prop: item.prop,
|
|
127
|
+
typeID,
|
|
128
|
+
compiledName: getCompiledName(comp, urt, typeID)
|
|
129
|
+
};
|
|
130
|
+
}, ["item", "", 'P"2!"/"']));
|
|
131
|
+
}
|
|
132
|
+
getDiscriminatorProperties.__type = ["JitFnCompiler", "comp", "UnionRunType", "urt", "CollectionRunType", "unionTypes", "propTypeID", "", "getCompiledName", () => __ΩFlattenedProp, "getDiscriminatorProperties", `P"w!2""w#2$"w%F2&P"w!2""w#2$P&'J2'&/(2)n*F/+`];
|
|
133
|
+
function getUniqueDiscriminatorProperties(comp, urt, unionTypes, getCompiledName) {
|
|
134
|
+
if (!unionTypes.length)
|
|
135
|
+
return [];
|
|
136
|
+
const uniquePropByUnionItem = (Map.Ω = [["CollectionRunType", '"w!'], [() => __ΩPropUnionItemPair, "n!"]], /* @__PURE__ */ new Map());
|
|
137
|
+
unionTypes.forEach(__assignType((unionItem) => {
|
|
138
|
+
const props = unionItem.getJitChildren(comp);
|
|
139
|
+
props.forEach(__assignType((prop) => {
|
|
140
|
+
const typeID = prop.getTypeID();
|
|
141
|
+
const isUnique = unionTypes.every(__assignType((otherUnionItem) => {
|
|
142
|
+
if (otherUnionItem === unionItem)
|
|
143
|
+
return true;
|
|
144
|
+
const otherProps = otherUnionItem.getJitChildren(comp);
|
|
145
|
+
return otherProps.every(__assignType((otherProp) => otherProp.getTypeID() !== typeID, ["otherProp", "", 'P"2!"/"']));
|
|
146
|
+
}, ["otherUnionItem", "", 'P"2!"/"']));
|
|
147
|
+
if (isUnique) {
|
|
148
|
+
const existing = uniquePropByUnionItem.get(unionItem);
|
|
149
|
+
if (!existing) {
|
|
150
|
+
uniquePropByUnionItem.set(unionItem, {
|
|
151
|
+
prop,
|
|
152
|
+
unionItem
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const newItem = { prop, unionItem };
|
|
157
|
+
const lessComplex = [newItem, existing].toSorted(__assignType((a, b) => sortRunTypeByComplexity(comp, a.prop, b.prop), ["a", "b", "", 'P"2!"2""/#']))[0];
|
|
158
|
+
uniquePropByUnionItem.set(unionItem, lessComplex);
|
|
159
|
+
}
|
|
160
|
+
}, ["prop", "", 'P"2!"/"']));
|
|
161
|
+
}, ["unionItem", "", 'P"2!"/"']));
|
|
162
|
+
if (!uniquePropByUnionItem.size)
|
|
163
|
+
return [];
|
|
164
|
+
const uniqueProps = Array.from(uniquePropByUnionItem.values());
|
|
165
|
+
return uniqueProps.map(__assignType((item) => {
|
|
166
|
+
item.prop.isUnionDiscriminator = true;
|
|
167
|
+
const unionIndex = urt.getUnionItemIndex(comp, item.unionItem);
|
|
168
|
+
const typeID = item.prop.getTypeID();
|
|
169
|
+
return {
|
|
170
|
+
unionItem: item.unionItem,
|
|
171
|
+
unionIndex,
|
|
172
|
+
prop: item.prop,
|
|
173
|
+
typeID,
|
|
174
|
+
compiledName: getCompiledName(comp, urt, typeID)
|
|
175
|
+
};
|
|
176
|
+
}, ["item", "", 'P"2!"/"']));
|
|
177
|
+
}
|
|
178
|
+
getUniqueDiscriminatorProperties.__type = ["JitFnCompiler", "comp", "UnionRunType", "urt", "CollectionRunType", "unionTypes", "propTypeID", "", "getCompiledName", () => __ΩFlattenedProp, "getUniqueDiscriminatorProperties", `P"w!2""w#2$"w%F2&P"w!2""w#2$P&'J2'&/(2)n*F/+`];
|
|
179
|
+
function initGetCompiledName() {
|
|
180
|
+
const typeIDs = (Map.Ω = [["P&'J"], ["'"]], /* @__PURE__ */ new Map());
|
|
181
|
+
return __assignType(function getCompiledName(comp, urt, typeID) {
|
|
182
|
+
const existingIndex = typeIDs.get(typeID);
|
|
183
|
+
if (existingIndex)
|
|
184
|
+
return comp.getLocalVarName("prop", urt) + `_${existingIndex}`;
|
|
185
|
+
const newIndex = typeIDs.size;
|
|
186
|
+
typeIDs.set(typeID, newIndex);
|
|
187
|
+
return comp.getLocalVarName("prop", urt) + `_${newIndex}`;
|
|
188
|
+
}, ["JitFnCompiler", "comp", "UnionRunType", "urt", "typeID", "getCompiledName", `P"w!2""w#2$P&'J2%&/&`]);
|
|
189
|
+
}
|
|
190
|
+
initGetCompiledName.__type = ["initGetCompiledName", 'P"/!'];
|
|
191
|
+
export {
|
|
192
|
+
__ΩFlattenedProp,
|
|
193
|
+
__ΩSplitUnionResult,
|
|
194
|
+
markDiscriminators,
|
|
195
|
+
sortUnreachableTypes,
|
|
196
|
+
splitUnionItems
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=unionDiscriminator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unionDiscriminator.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnyFunction, SrcType, JitFn, JitCode, RunTypeOptions } from '../../types.ts';
|
|
2
|
+
import { TypeFunction } from '@deepkit/type';
|
|
3
|
+
import { BaseRunType } from '../../lib/baseRunTypes.ts';
|
|
4
|
+
import { JitFnCompiler, JitErrorsFnCompiler } from '../../lib/jitFnCompiler.ts';
|
|
5
|
+
import { FunctionParamsRunType } from '../collection/functionParams.ts';
|
|
6
|
+
import { JitCompiledFn } from '@mionjs/core';
|
|
7
|
+
export declare class FunctionRunType<CallType extends AnyFunction = TypeFunction> extends BaseRunType<CallType> {
|
|
8
|
+
parameterRunTypes: FunctionParamsRunType;
|
|
9
|
+
skipJit(comp: JitFnCompiler): boolean;
|
|
10
|
+
onCreated(deepkitType: SrcType): void;
|
|
11
|
+
getFamily(): 'F';
|
|
12
|
+
getFnName(): string | number;
|
|
13
|
+
createJitParamsFunction(jitFn: JitFn, opts?: RunTypeOptions): (...args: any[]) => any;
|
|
14
|
+
createJitCompiledParamsFunction(jitFn: JitFn, opts?: RunTypeOptions): JitCompiledFn;
|
|
15
|
+
createJitReturnFunction(jitFn: JitFn): (...args: any[]) => any;
|
|
16
|
+
createJitCompiledReturnFunction(jitFn: JitFn, opts?: RunTypeOptions): JitCompiledFn;
|
|
17
|
+
emitIsType(comp: JitFnCompiler): JitCode;
|
|
18
|
+
emitTypeErrors(comp: JitErrorsFnCompiler): JitCode;
|
|
19
|
+
emitPrepareForJson(): JitCode;
|
|
20
|
+
emitRestoreFromJson(): JitCode;
|
|
21
|
+
emitHasUnknownKeys(): JitCode;
|
|
22
|
+
emitUnknownKeyErrors(): JitCode;
|
|
23
|
+
emitStripUnknownKeys(): JitCode;
|
|
24
|
+
emitUnknownKeysToUndefined(): JitCode;
|
|
25
|
+
getReturnType(): BaseRunType;
|
|
26
|
+
getParameters(): FunctionParamsRunType;
|
|
27
|
+
getParameterNames(opts?: RunTypeOptions): string[];
|
|
28
|
+
hasReturnData(): boolean;
|
|
29
|
+
isAsync(): boolean;
|
|
30
|
+
returnIsPromise(): boolean;
|
|
31
|
+
mockReturn(ctx?: RunTypeOptions): Promise<any>;
|
|
32
|
+
mockParams(ctx?: RunTypeOptions): Promise<any[]>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ReflectionKind, __ΩTypeFunction as ___TypeFunction } from "@deepkit/type";
|
|
2
|
+
import { BaseRunType } from "../../lib/baseRunTypes.js";
|
|
3
|
+
import { isAnyFunctionRunType, isPromiseRunType, isFunctionRunType } from "../../lib/guards.js";
|
|
4
|
+
import { JitFnCompiler, JitErrorsFnCompiler } from "../../lib/jitFnCompiler.js";
|
|
5
|
+
import { ReflectionSubKind } from "../../constants.kind.js";
|
|
6
|
+
import { FunctionParamsRunType } from "../collection/functionParams.js";
|
|
7
|
+
import { __ΩJitCompiledFn as ___JitCompiledFn } from "@mionjs/core";
|
|
8
|
+
import { registerJitFunctionCompiler } from "../../lib/jitFnsRegistry.js";
|
|
9
|
+
import { JitFunctions } from "../../constants.functions.js";
|
|
10
|
+
function __assignType(fn, args) {
|
|
11
|
+
fn.__type = args;
|
|
12
|
+
return fn;
|
|
13
|
+
}
|
|
14
|
+
class FunctionRunType extends BaseRunType {
|
|
15
|
+
// parameterRunTypes.src must be set after FunctionRunType creation
|
|
16
|
+
parameterRunTypes = new FunctionParamsRunType();
|
|
17
|
+
skipJit(comp) {
|
|
18
|
+
if (!comp)
|
|
19
|
+
return true;
|
|
20
|
+
return comp.fnID !== JitFunctions.toJSCode.id;
|
|
21
|
+
}
|
|
22
|
+
onCreated(deepkitType) {
|
|
23
|
+
super.onCreated(deepkitType);
|
|
24
|
+
const paramsType = { ...deepkitType, subKind: ReflectionSubKind.params };
|
|
25
|
+
delete paramsType._typeId;
|
|
26
|
+
delete paramsType._formatId;
|
|
27
|
+
this.parameterRunTypes.onCreated(paramsType);
|
|
28
|
+
}
|
|
29
|
+
getFamily() {
|
|
30
|
+
return "F";
|
|
31
|
+
}
|
|
32
|
+
getFnName() {
|
|
33
|
+
const name = this.src.name;
|
|
34
|
+
if (!name)
|
|
35
|
+
return "";
|
|
36
|
+
if (typeof name === "symbol")
|
|
37
|
+
return name.toString();
|
|
38
|
+
return name;
|
|
39
|
+
}
|
|
40
|
+
createJitParamsFunction(jitFn, opts) {
|
|
41
|
+
return this.createJitCompiledParamsFunction(jitFn, opts).fn;
|
|
42
|
+
}
|
|
43
|
+
createJitCompiledParamsFunction(jitFn, opts) {
|
|
44
|
+
const start = opts?.paramsSlice?.start;
|
|
45
|
+
const end = opts?.paramsSlice?.end;
|
|
46
|
+
if (start && end) {
|
|
47
|
+
if (start < 0 || end > this.parameterRunTypes.getChildRunTypes().length)
|
|
48
|
+
throw new Error(`Invalid paramsSlice, start: ${start}, end: ${end}.`);
|
|
49
|
+
if (end <= start)
|
|
50
|
+
throw new Error(`Invalid paramsSlice, start: ${start}, end: ${end}`);
|
|
51
|
+
}
|
|
52
|
+
return this.parameterRunTypes.createJitCompiledFunction(jitFn.id, void 0, opts);
|
|
53
|
+
}
|
|
54
|
+
createJitReturnFunction(jitFn) {
|
|
55
|
+
return this.createJitCompiledReturnFunction(jitFn).fn;
|
|
56
|
+
}
|
|
57
|
+
createJitCompiledReturnFunction(jitFn, opts) {
|
|
58
|
+
let currentType = this;
|
|
59
|
+
while (true) {
|
|
60
|
+
if (isAnyFunctionRunType(currentType)) {
|
|
61
|
+
const returnType = currentType.getReturnType();
|
|
62
|
+
if (isPromiseRunType(returnType) || isFunctionRunType(returnType)) {
|
|
63
|
+
currentType = returnType;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
return returnType.createJitCompiledFunction(jitFn.id, void 0, opts);
|
|
67
|
+
}
|
|
68
|
+
const memberType = currentType.getMemberType();
|
|
69
|
+
if (isPromiseRunType(memberType) || isFunctionRunType(memberType)) {
|
|
70
|
+
currentType = memberType;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
return memberType.createJitCompiledFunction(jitFn.id, void 0, opts);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// ######## JIT functions (all throw error) ########
|
|
77
|
+
// can't know the types of the run type function parameters, neither the return type, so only compare function name and length
|
|
78
|
+
emitIsType(comp) {
|
|
79
|
+
const minLength = this.parameterRunTypes.totalRequiredParams(comp);
|
|
80
|
+
const totalParams = this.parameterRunTypes.getParamRunTypes(comp).length;
|
|
81
|
+
const hasOptional = totalParams > minLength;
|
|
82
|
+
const maxLength = this.parameterRunTypes.hasRestParameter(comp) || !hasOptional ? "" : ` && ${comp.vλl}.length <= ${totalParams}`;
|
|
83
|
+
return { code: `(typeof ${comp.vλl} === 'function' && ${comp.vλl}.length >= ${minLength} ${maxLength})`, type: "E" };
|
|
84
|
+
}
|
|
85
|
+
emitTypeErrors(comp) {
|
|
86
|
+
return { code: `if (!(${this.emitIsType(comp).code})) ${comp.callJitErr(this)};`, type: "S" };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* json encode a function
|
|
90
|
+
*/
|
|
91
|
+
emitPrepareForJson() {
|
|
92
|
+
throw new Error(`Compile function PrepareForJson not supported, call compileParams or compileReturn instead.`);
|
|
93
|
+
}
|
|
94
|
+
emitRestoreFromJson() {
|
|
95
|
+
throw new Error(`Compile function RestoreFromJson not supported, call compileParams or compileReturn instead.`);
|
|
96
|
+
}
|
|
97
|
+
emitHasUnknownKeys() {
|
|
98
|
+
return { code: "", type: "E" };
|
|
99
|
+
}
|
|
100
|
+
emitUnknownKeyErrors() {
|
|
101
|
+
return { code: "", type: "S" };
|
|
102
|
+
}
|
|
103
|
+
emitStripUnknownKeys() {
|
|
104
|
+
return { code: "", type: "S" };
|
|
105
|
+
}
|
|
106
|
+
emitUnknownKeysToUndefined() {
|
|
107
|
+
return { code: "", type: "S" };
|
|
108
|
+
}
|
|
109
|
+
// TODO: paramsSlice has been removed as options are not jet passed when building the run type. maybe we can pass it to the JitCompileOperation instead
|
|
110
|
+
// constructor() {
|
|
111
|
+
// const start = opts?.paramsSlice?.start;
|
|
112
|
+
// const end = opts?.paramsSlice?.end;
|
|
113
|
+
// parameterRunTypes = src.parameters.slice(start, end).map((p) => visitor(p, parents, opts)) as ParameterRunType[];
|
|
114
|
+
// }
|
|
115
|
+
getReturnType() {
|
|
116
|
+
return this.src.return._rt;
|
|
117
|
+
}
|
|
118
|
+
getParameters() {
|
|
119
|
+
return this.parameterRunTypes;
|
|
120
|
+
}
|
|
121
|
+
getParameterNames(opts) {
|
|
122
|
+
const start = opts?.paramsSlice?.start;
|
|
123
|
+
const end = opts?.paramsSlice?.end;
|
|
124
|
+
if (start || end) {
|
|
125
|
+
return this.src.parameters.slice(start, end).map(__assignType((p) => p.name, ["p", "", 'P"2!"/"']));
|
|
126
|
+
}
|
|
127
|
+
return this.src.parameters.map(__assignType((p) => p.name, ["p", "", 'P"2!"/"']));
|
|
128
|
+
}
|
|
129
|
+
hasReturnData() {
|
|
130
|
+
const returnKind = this.getReturnType().src.kind;
|
|
131
|
+
return returnKind !== ReflectionKind.void && returnKind !== ReflectionKind.never && returnKind !== ReflectionKind.undefined;
|
|
132
|
+
}
|
|
133
|
+
isAsync() {
|
|
134
|
+
const returnKind = this.getReturnType().src.kind;
|
|
135
|
+
return returnKind === ReflectionKind.promise || returnKind === ReflectionKind.any || returnKind === ReflectionKind.unknown;
|
|
136
|
+
}
|
|
137
|
+
returnIsPromise() {
|
|
138
|
+
return isPromiseRunType(this.getReturnType());
|
|
139
|
+
}
|
|
140
|
+
async mockReturn(ctx) {
|
|
141
|
+
await registerJitFunctionCompiler(JitFunctions.mock);
|
|
142
|
+
return this.getReturnType().mockType(ctx);
|
|
143
|
+
}
|
|
144
|
+
async mockParams(ctx) {
|
|
145
|
+
await registerJitFunctionCompiler(JitFunctions.mock);
|
|
146
|
+
return this.parameterRunTypes.mockType(ctx);
|
|
147
|
+
}
|
|
148
|
+
static __type = [() => ___TypeFunction, "CallType", () => BaseRunType, () => FunctionParamsRunType, "parameterRunTypes", function() {
|
|
149
|
+
return new FunctionParamsRunType();
|
|
150
|
+
}, () => JitFnCompiler, "comp", "skipJit", "SrcType", "deepkitType", "onCreated", "F", "getFamily", "getFnName", "JitFn", "jitFn", "RunTypeOptions", "opts", "args", "", "createJitParamsFunction", () => ___JitCompiledFn, "createJitCompiledParamsFunction", "createJitReturnFunction", () => ___JitCompiledFn, "createJitCompiledReturnFunction", () => JitFnCompiler, "JitCode", "emitIsType", () => JitErrorsFnCompiler, "emitTypeErrors", "emitPrepareForJson", "emitRestoreFromJson", "emitHasUnknownKeys", "emitUnknownKeyErrors", "emitStripUnknownKeys", "emitUnknownKeysToUndefined", () => BaseRunType, "getReturnType", () => FunctionParamsRunType, "getParameters", "getParameterNames", "hasReturnData", "isAsync", "returnIsPromise", "ctx", "mockReturn", "mockParams", "FunctionRunType", 'n!c"Pe"!7#P7$3%>&PP7\'2()0)P"w*2+$0,P.-0.PP&\'J0/P"w021"w2238P"@24"/506P"w021"w2238n708P"w021P"@24"/509P"w021"w2238n:0;PP7<2("w=0>PP7?2("w=0@P"w=0AP"w=0BP"w=0CP"w=0DP"w=0EP"w=0FPP7G0HPP7I0JP"w2238&F0KP)0LP)0MP)0NP"w22O8"`0PP"w22O8"F`0Q5e!!6"wR'];
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
FunctionRunType
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Type, TypeArray } from '@deepkit/type';
|
|
2
|
+
import { JitCode } from '../../types.ts';
|
|
3
|
+
import { JitFnCompiler, JitErrorsFnCompiler } from '../../lib/jitFnCompiler.ts';
|
|
4
|
+
import { MemberRunType } from '../../lib/baseRunTypes.ts';
|
|
5
|
+
export declare class ArrayRunType<T extends Type = TypeArray> extends MemberRunType<T> {
|
|
6
|
+
startIndex(comp: JitFnCompiler): number;
|
|
7
|
+
getChildVarName(comp: JitFnCompiler): string;
|
|
8
|
+
getChildLiteral(comp: JitFnCompiler): string;
|
|
9
|
+
useArrayAccessor(): true;
|
|
10
|
+
isOptional(): boolean;
|
|
11
|
+
emitIsType(comp: JitFnCompiler): JitCode;
|
|
12
|
+
emitTypeErrors(comp: JitErrorsFnCompiler): JitCode;
|
|
13
|
+
emitPrepareForJson(comp: JitFnCompiler): JitCode;
|
|
14
|
+
emitRestoreFromJson(comp: JitFnCompiler): JitCode;
|
|
15
|
+
emitHasUnknownKeys(comp: JitFnCompiler): JitCode;
|
|
16
|
+
emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode;
|
|
17
|
+
emitStripUnknownKeys(comp: JitFnCompiler): JitCode;
|
|
18
|
+
emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode;
|
|
19
|
+
traverseCode(comp: JitFnCompiler, childJit: JitCode | undefined): {
|
|
20
|
+
code: string | undefined;
|
|
21
|
+
type: 'S';
|
|
22
|
+
};
|
|
23
|
+
checkNonSkipTypes(comp: JitFnCompiler): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { MemberRunType } from "../../lib/baseRunTypes.js";
|
|
2
|
+
import { childIsExpression } from "../../lib/utils.js";
|
|
3
|
+
class ArrayRunType extends MemberRunType {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
startIndex(comp) {
|
|
6
|
+
return 0;
|
|
7
|
+
}
|
|
8
|
+
getChildVarName(comp) {
|
|
9
|
+
return comp.getLocalVarName("i", this);
|
|
10
|
+
}
|
|
11
|
+
getChildLiteral(comp) {
|
|
12
|
+
return this.getChildVarName(comp);
|
|
13
|
+
}
|
|
14
|
+
useArrayAccessor() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
isOptional() {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// #### jit code ####
|
|
21
|
+
emitIsType(comp) {
|
|
22
|
+
this.checkNonSkipTypes(comp);
|
|
23
|
+
const resultVal = comp.getLocalVarName("res", this);
|
|
24
|
+
const index = this.getChildVarName(comp);
|
|
25
|
+
const child = this.getJitChild(comp);
|
|
26
|
+
const childJit = comp.compileIsType(child, "E");
|
|
27
|
+
if (!childJit?.code && comp.opts.noIsArrayCheck)
|
|
28
|
+
return { code: void 0, type: "E" };
|
|
29
|
+
if (!childJit?.code)
|
|
30
|
+
return { code: `Array.isArray(${comp.vλl})`, type: "E" };
|
|
31
|
+
const isArrayCheckCode = comp.opts.noIsArrayCheck ? "" : `if (!Array.isArray(${comp.vλl})) return false;`;
|
|
32
|
+
return {
|
|
33
|
+
code: `
|
|
34
|
+
${isArrayCheckCode}
|
|
35
|
+
for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {
|
|
36
|
+
const ${resultVal} = ${childJit.code};
|
|
37
|
+
if (!(${resultVal})) return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
`,
|
|
41
|
+
type: "RB"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
emitTypeErrors(comp) {
|
|
45
|
+
this.checkNonSkipTypes(comp);
|
|
46
|
+
const index = this.getChildVarName(comp);
|
|
47
|
+
const child = this.getJitChild(comp);
|
|
48
|
+
const childJit = comp.compileTypeErrors(child, "S");
|
|
49
|
+
if (!childJit?.code && comp.opts.noIsArrayCheck)
|
|
50
|
+
return { code: void 0, type: "E" };
|
|
51
|
+
if (!childJit?.code)
|
|
52
|
+
return { code: `if (!Array.isArray(${comp.vλl})) ${comp.callJitErr(this)};`, type: "S" };
|
|
53
|
+
const itemsCode = `for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {${childJit.code}}`;
|
|
54
|
+
if (comp.opts.noIsArrayCheck)
|
|
55
|
+
return { code: itemsCode, type: "S" };
|
|
56
|
+
return {
|
|
57
|
+
code: `if (!Array.isArray(${comp.vλl})) {${comp.callJitErr(this)}} else {${itemsCode}}`,
|
|
58
|
+
type: "S"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
emitPrepareForJson(comp) {
|
|
62
|
+
this.checkNonSkipTypes(comp);
|
|
63
|
+
const index = this.getChildVarName(comp);
|
|
64
|
+
const child = this.getJitChild(comp);
|
|
65
|
+
const childJit = comp.compilePrepareForJson(child, "S");
|
|
66
|
+
if (!childJit?.code || !child)
|
|
67
|
+
return { code: void 0, type: "S" };
|
|
68
|
+
const isExpression = childIsExpression(childJit, child);
|
|
69
|
+
const code = isExpression ? `${comp.getChildVλl()} = ${childJit.code};` : childJit.code || "";
|
|
70
|
+
return {
|
|
71
|
+
code: `for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {${code}}`,
|
|
72
|
+
type: "S"
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
emitRestoreFromJson(comp) {
|
|
76
|
+
this.checkNonSkipTypes(comp);
|
|
77
|
+
const index = this.getChildVarName(comp);
|
|
78
|
+
const child = this.getJitChild(comp);
|
|
79
|
+
const childJit = comp.compileRestoreFromJson(child, "S");
|
|
80
|
+
if (!childJit?.code || !child)
|
|
81
|
+
return { code: void 0, type: "S" };
|
|
82
|
+
const isExpression = childIsExpression(childJit, child);
|
|
83
|
+
const code = isExpression ? `${comp.getChildVλl()} = ${childJit.code};` : childJit.code || "";
|
|
84
|
+
return {
|
|
85
|
+
code: `for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {${code}}`,
|
|
86
|
+
type: "S"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
emitHasUnknownKeys(comp) {
|
|
90
|
+
this.checkNonSkipTypes(comp);
|
|
91
|
+
if (this.getMemberType().getFamily() === "A")
|
|
92
|
+
return { code: void 0, type: "E" };
|
|
93
|
+
const child = this.getJitChild(comp);
|
|
94
|
+
const childJit = comp.compileHasUnknownKeys(child, "E");
|
|
95
|
+
if (!childJit?.code)
|
|
96
|
+
return { code: void 0, type: "E" };
|
|
97
|
+
const resultVal = comp.getLocalVarName("res", this);
|
|
98
|
+
const index = this.getChildVarName(comp);
|
|
99
|
+
return {
|
|
100
|
+
code: `
|
|
101
|
+
if (!Array.isArray(${comp.vλl})) return false;
|
|
102
|
+
for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {
|
|
103
|
+
const ${resultVal} = ${childJit.code};
|
|
104
|
+
if (${resultVal}) return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
`,
|
|
108
|
+
type: "RB"
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
emitUnknownKeyErrors(comp) {
|
|
112
|
+
this.checkNonSkipTypes(comp);
|
|
113
|
+
if (this.getMemberType().getFamily() === "A")
|
|
114
|
+
return { code: "", type: "E" };
|
|
115
|
+
const child = this.getJitChild(comp);
|
|
116
|
+
const childJit = comp.compileUnknownKeyErrors(child, "S");
|
|
117
|
+
return this.traverseCode(comp, childJit);
|
|
118
|
+
}
|
|
119
|
+
emitStripUnknownKeys(comp) {
|
|
120
|
+
this.checkNonSkipTypes(comp);
|
|
121
|
+
if (this.getMemberType().getFamily() === "A")
|
|
122
|
+
return { code: "", type: "E" };
|
|
123
|
+
const child = this.getJitChild(comp);
|
|
124
|
+
const childJit = comp.compileStripUnknownKeys(child, "S");
|
|
125
|
+
return this.traverseCode(comp, childJit);
|
|
126
|
+
}
|
|
127
|
+
emitUnknownKeysToUndefined(comp) {
|
|
128
|
+
this.checkNonSkipTypes(comp);
|
|
129
|
+
if (this.getMemberType().getFamily() === "A")
|
|
130
|
+
return { code: "", type: "E" };
|
|
131
|
+
const child = this.getJitChild(comp);
|
|
132
|
+
const childJit = comp.compileUnknownKeysToUndefined(child, "S");
|
|
133
|
+
return this.traverseCode(comp, childJit);
|
|
134
|
+
}
|
|
135
|
+
traverseCode(comp, childJit) {
|
|
136
|
+
if (!childJit?.code)
|
|
137
|
+
return { code: void 0, type: "S" };
|
|
138
|
+
const index = this.getChildVarName(comp);
|
|
139
|
+
return {
|
|
140
|
+
code: `for (let ${index} = ${this.startIndex(comp)}; ${index} < ${comp.vλl}.length; ${index}++) {${childJit.code}}`,
|
|
141
|
+
type: "S"
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
checkNonSkipTypes(comp) {
|
|
145
|
+
const child = this.getMemberType();
|
|
146
|
+
if (child.skipJit(comp))
|
|
147
|
+
throw new Error(`Arrays can not have non serializable types, ie: Symbol[], Function[], etc.`);
|
|
148
|
+
}
|
|
149
|
+
static __type = ["TypeArray", "T", () => MemberRunType, "JitFnCompiler", "comp", "startIndex", "getChildVarName", "getChildLiteral", true, "useArrayAccessor", "isOptional", "JitCode", "emitIsType", "JitErrorsFnCompiler", "emitTypeErrors", "emitPrepareForJson", "emitRestoreFromJson", "emitHasUnknownKeys", "emitUnknownKeyErrors", "emitStripUnknownKeys", "emitUnknownKeysToUndefined", "childJit", "code", "S", "type", "traverseCode", "checkNonSkipTypes", "ArrayRunType", `"w!c"Pe"!7#P"w$2%'0&P"w$2%&0'P"w$2%&0(P.)0*P)0+P"w$2%"w,0-P"w.2%"w,0/P"w$2%"w,00P"w$2%"w,01P"w$2%"w,02P"w.2%"w,03P"w$2%"w,04P"w$2%"w,05P"w$2%P"w,-J26PP&-J47.849M0:P"w$2%"0;5e!!6"w<`];
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
ArrayRunType
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypeCallSignature } from '@deepkit/type';
|
|
2
|
+
import { RunTypeChildAccessor } from '../../types.ts';
|
|
3
|
+
import { FunctionRunType } from '../function/function.ts';
|
|
4
|
+
import { JitFnCompiler } from '../../lib/jitFnCompiler.ts';
|
|
5
|
+
export declare class CallSignatureRunType extends FunctionRunType<TypeCallSignature> implements RunTypeChildAccessor {
|
|
6
|
+
getChildIndex: (comp: JitFnCompiler) => number;
|
|
7
|
+
getChildVarName: () => string;
|
|
8
|
+
getChildLiteral: () => string;
|
|
9
|
+
useArrayAccessor: () => boolean;
|
|
10
|
+
isOptional: () => boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __ΩTypeCallSignature as ___TypeCallSignature } from "@deepkit/type";
|
|
2
|
+
import { __ΩRunTypeChildAccessor as ___RunTypeChildAccessor } from "../../types.js";
|
|
3
|
+
import { getPropIndex } from "../../lib/utils.js";
|
|
4
|
+
import { FunctionRunType } from "../function/function.js";
|
|
5
|
+
function __assignType(fn, args) {
|
|
6
|
+
fn.__type = args;
|
|
7
|
+
return fn;
|
|
8
|
+
}
|
|
9
|
+
class CallSignatureRunType extends FunctionRunType {
|
|
10
|
+
getChildIndex = __assignType((comp) => {
|
|
11
|
+
const start = comp?.opts?.paramsSlice?.start;
|
|
12
|
+
if (start)
|
|
13
|
+
return getPropIndex(this.src) - start;
|
|
14
|
+
return getPropIndex(this.src);
|
|
15
|
+
}, ["JitFnCompiler", "comp", "", 'P"w!2""/#']);
|
|
16
|
+
getChildVarName = () => "";
|
|
17
|
+
getChildLiteral = () => '""';
|
|
18
|
+
useArrayAccessor = () => false;
|
|
19
|
+
isOptional = () => false;
|
|
20
|
+
static __type = [() => ___TypeCallSignature, () => FunctionRunType, "getChildIndex", function() {
|
|
21
|
+
return __assignType((comp) => {
|
|
22
|
+
const start = comp?.opts?.paramsSlice?.start;
|
|
23
|
+
if (start)
|
|
24
|
+
return getPropIndex(this.src) - start;
|
|
25
|
+
return getPropIndex(this.src);
|
|
26
|
+
}, ["JitFnCompiler", "comp", "", 'P"w!2""/#']);
|
|
27
|
+
}, "getChildVarName", function() {
|
|
28
|
+
return () => "";
|
|
29
|
+
}, "getChildLiteral", function() {
|
|
30
|
+
return () => '""';
|
|
31
|
+
}, "useArrayAccessor", function() {
|
|
32
|
+
return () => false;
|
|
33
|
+
}, "isOptional", function() {
|
|
34
|
+
return () => false;
|
|
35
|
+
}, () => ___TypeCallSignature, () => ___RunTypeChildAccessor, "CallSignatureRunType", `Pn!7"!3#>$!3%>&!3'>(!3)>*!3+>,5n-6"n.x"w/`];
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
CallSignatureRunType
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=callSignature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callSignature.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JitFnCompiler, JitErrorsFnCompiler } from '../../lib/jitFnCompiler.ts';
|
|
2
|
+
import { MemberRunType } from '../../lib/baseRunTypes.ts';
|
|
3
|
+
import { JitCode, SrcMember } from '../../types.ts';
|
|
4
|
+
export declare class GenericMemberRunType<T extends SrcMember> extends MemberRunType<T> {
|
|
5
|
+
index: number;
|
|
6
|
+
getChildIndex(): number;
|
|
7
|
+
getChildVarName(comp: JitFnCompiler): string | number;
|
|
8
|
+
getChildLiteral(comp: JitFnCompiler): string | number;
|
|
9
|
+
useArrayAccessor(): boolean;
|
|
10
|
+
isOptional(): boolean;
|
|
11
|
+
emitIsType(comp: JitFnCompiler): JitCode;
|
|
12
|
+
emitTypeErrors(comp: JitErrorsFnCompiler): JitCode;
|
|
13
|
+
emitPrepareForJson(comp: JitFnCompiler): JitCode;
|
|
14
|
+
emitRestoreFromJson(comp: JitFnCompiler): JitCode;
|
|
15
|
+
}
|