typia 13.1.0 → 13.1.19
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/README.md +3 -0
- package/lib/_virtual/_rolldown/runtime.mjs +1 -5
- package/lib/executable/FileSystemIdentity.d.ts +21 -0
- package/lib/executable/FileSystemIdentity.js +183 -0
- package/lib/executable/FileSystemIdentity.js.map +1 -0
- package/lib/executable/FileSystemIdentity.mjs +129 -0
- package/lib/executable/FileSystemIdentity.mjs.map +1 -0
- package/lib/executable/TypiaGenerateWizard.js +264 -104
- package/lib/executable/TypiaGenerateWizard.js.map +1 -1
- package/lib/executable/TypiaGenerateWizard.mjs +233 -93
- package/lib/executable/TypiaGenerateWizard.mjs.map +1 -1
- package/lib/functional.d.ts +15 -12
- package/lib/functional.js.map +1 -1
- package/lib/functional.mjs.map +1 -1
- package/lib/internal/_ProtobufReader.d.ts +17 -0
- package/lib/internal/_ProtobufReader.js +117 -45
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufReader.mjs +108 -39
- package/lib/internal/_ProtobufReader.mjs.map +1 -1
- package/lib/internal/_createStandardSchema.js +18 -1
- package/lib/internal/_createStandardSchema.js.map +1 -1
- package/lib/internal/_createStandardSchema.mjs +12 -1
- package/lib/internal/_createStandardSchema.mjs.map +1 -1
- package/lib/internal/_decimal.d.ts +14 -0
- package/lib/internal/_decimal.js +61 -0
- package/lib/internal/_decimal.js.map +1 -0
- package/lib/internal/_decimal.mjs +49 -0
- package/lib/internal/_decimal.mjs.map +1 -0
- package/lib/internal/_httpQueryParseURLSearchParams.js +23 -2
- package/lib/internal/_httpQueryParseURLSearchParams.js.map +1 -1
- package/lib/internal/_httpQueryParseURLSearchParams.mjs +20 -2
- package/lib/internal/_httpQueryParseURLSearchParams.mjs.map +1 -1
- package/lib/internal/_isFormatByte.js +2 -5
- package/lib/internal/_isFormatByte.js.map +1 -1
- package/lib/internal/_isFormatByte.mjs +2 -5
- package/lib/internal/_isFormatByte.mjs.map +1 -1
- package/lib/internal/_isFormatDate.js +15 -2
- package/lib/internal/_isFormatDate.js.map +1 -1
- package/lib/internal/_isFormatDate.mjs +22 -2
- package/lib/internal/_isFormatDate.mjs.map +1 -1
- package/lib/internal/_isFormatDateTime.js +21 -2
- package/lib/internal/_isFormatDateTime.js.map +1 -1
- package/lib/internal/_isFormatDateTime.mjs +13 -2
- package/lib/internal/_isFormatDateTime.mjs.map +1 -1
- package/lib/internal/_isFormatIri.js +3 -2
- package/lib/internal/_isFormatIri.js.map +1 -1
- package/lib/internal/_isFormatIri.mjs +3 -2
- package/lib/internal/_isFormatIri.mjs.map +1 -1
- package/lib/internal/_isFormatIriReference.js +10 -2
- package/lib/internal/_isFormatIriReference.js.map +1 -1
- package/lib/internal/_isFormatIriReference.mjs +9 -2
- package/lib/internal/_isFormatIriReference.mjs.map +1 -1
- package/lib/internal/_isFormatUriReference.js +1 -1
- package/lib/internal/_isFormatUriReference.js.map +1 -1
- package/lib/internal/_isFormatUriReference.mjs +1 -1
- package/lib/internal/_isFormatUriReference.mjs.map +1 -1
- package/lib/internal/_isMultipleOf.d.ts +1 -0
- package/lib/internal/_isMultipleOf.js +13 -0
- package/lib/internal/_isMultipleOf.js.map +1 -0
- package/lib/internal/_isMultipleOf.mjs +12 -0
- package/lib/internal/_isMultipleOf.mjs.map +1 -0
- package/lib/internal/_isTypeFloat.js +1 -1
- package/lib/internal/_isTypeFloat.js.map +1 -1
- package/lib/internal/_isTypeFloat.mjs +1 -1
- package/lib/internal/_isTypeFloat.mjs.map +1 -1
- package/lib/internal/_isTypeInt64.js +1 -0
- package/lib/internal/_isTypeInt64.js.map +1 -1
- package/lib/internal/_isTypeInt64.mjs.map +1 -1
- package/lib/internal/_isTypeInt64Bigint.d.ts +1 -0
- package/lib/internal/_isTypeInt64Bigint.js +15 -0
- package/lib/internal/_isTypeInt64Bigint.js.map +1 -0
- package/lib/internal/_isTypeInt64Bigint.mjs +8 -0
- package/lib/internal/_isTypeInt64Bigint.mjs.map +1 -0
- package/lib/internal/_isTypeUint64.js +1 -0
- package/lib/internal/_isTypeUint64.js.map +1 -1
- package/lib/internal/_isTypeUint64.mjs.map +1 -1
- package/lib/internal/_isTypeUint64Bigint.d.ts +1 -0
- package/lib/internal/_isTypeUint64Bigint.js +10 -0
- package/lib/internal/_isTypeUint64Bigint.js.map +1 -0
- package/lib/internal/_isTypeUint64Bigint.mjs +8 -0
- package/lib/internal/_isTypeUint64Bigint.mjs.map +1 -0
- package/lib/internal/_isUniqueItems.js +96 -109
- package/lib/internal/_isUniqueItems.js.map +1 -1
- package/lib/internal/_isUniqueItems.mjs +62 -50
- package/lib/internal/_isUniqueItems.mjs.map +1 -1
- package/lib/internal/_notationAny.js +8 -1
- package/lib/internal/_notationAny.js.map +1 -1
- package/lib/internal/_notationAny.mjs +7 -1
- package/lib/internal/_notationAny.mjs.map +1 -1
- package/lib/internal/_notationAssign.d.ts +1 -0
- package/lib/internal/_notationAssign.js +18 -0
- package/lib/internal/_notationAssign.js.map +1 -0
- package/lib/internal/_notationAssign.mjs +17 -0
- package/lib/internal/_notationAssign.mjs.map +1 -0
- package/lib/internal/_notationCamel.js +30 -9
- package/lib/internal/_notationCamel.js.map +1 -1
- package/lib/internal/_notationCamel.mjs +13 -5
- package/lib/internal/_notationCamel.mjs.map +1 -1
- package/lib/internal/_notationKebab.d.ts +1 -0
- package/lib/internal/_notationKebab.js +15 -0
- package/lib/internal/_notationKebab.js.map +1 -0
- package/lib/internal/_notationKebab.mjs +15 -0
- package/lib/internal/_notationKebab.mjs.map +1 -0
- package/lib/internal/_notationKeyCollision.d.ts +1 -0
- package/lib/internal/_notationKeyCollision.js +8 -0
- package/lib/internal/_notationKeyCollision.js.map +1 -0
- package/lib/internal/_notationKeyCollision.mjs +8 -0
- package/lib/internal/_notationKeyCollision.mjs.map +1 -0
- package/lib/internal/_notationPascal.js +20 -5
- package/lib/internal/_notationPascal.js.map +1 -1
- package/lib/internal/_notationPascal.mjs +10 -5
- package/lib/internal/_notationPascal.mjs.map +1 -1
- package/lib/internal/_notationSnake.js +25 -22
- package/lib/internal/_notationSnake.js.map +1 -1
- package/lib/internal/_notationSnake.mjs +11 -11
- package/lib/internal/_notationSnake.mjs.map +1 -1
- package/lib/internal/_plainCloneAny.js +174 -38
- package/lib/internal/_plainCloneAny.js.map +1 -1
- package/lib/internal/_plainCloneAny.mjs +126 -22
- package/lib/internal/_plainCloneAny.mjs.map +1 -1
- package/lib/internal/_randomArray.d.ts +1 -1
- package/lib/internal/_randomArray.js +11 -4
- package/lib/internal/_randomArray.js.map +1 -1
- package/lib/internal/_randomArray.mjs +9 -3
- package/lib/internal/_randomArray.mjs.map +1 -1
- package/lib/internal/_randomFormatByte.d.ts +2 -1
- package/lib/internal/_randomFormatByte.js +2 -1
- package/lib/internal/_randomFormatByte.js.map +1 -1
- package/lib/internal/_randomFormatByte.mjs +2 -1
- package/lib/internal/_randomFormatByte.mjs.map +1 -1
- package/lib/internal/_randomFormatDate.d.ts +2 -0
- package/lib/internal/_randomFormatDate.js +3 -2
- package/lib/internal/_randomFormatDate.js.map +1 -1
- package/lib/internal/_randomFormatDate.mjs +3 -2
- package/lib/internal/_randomFormatDate.mjs.map +1 -1
- package/lib/internal/_randomFormatDatetime.d.ts +2 -0
- package/lib/internal/_randomFormatDatetime.js +3 -2
- package/lib/internal/_randomFormatDatetime.js.map +1 -1
- package/lib/internal/_randomFormatDatetime.mjs +3 -2
- package/lib/internal/_randomFormatDatetime.mjs.map +1 -1
- package/lib/internal/_randomFormatDuration.d.ts +2 -1
- package/lib/internal/_randomFormatDuration.js +3 -2
- package/lib/internal/_randomFormatDuration.js.map +1 -1
- package/lib/internal/_randomFormatDuration.mjs +3 -2
- package/lib/internal/_randomFormatDuration.mjs.map +1 -1
- package/lib/internal/_randomFormatEmail.d.ts +2 -1
- package/lib/internal/_randomFormatEmail.js +8 -1
- package/lib/internal/_randomFormatEmail.js.map +1 -1
- package/lib/internal/_randomFormatEmail.mjs +5 -1
- package/lib/internal/_randomFormatEmail.mjs.map +1 -1
- package/lib/internal/_randomFormatHostname.d.ts +8 -1
- package/lib/internal/_randomFormatHostname.js +45 -2
- package/lib/internal/_randomFormatHostname.js.map +1 -1
- package/lib/internal/_randomFormatHostname.mjs +38 -2
- package/lib/internal/_randomFormatHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatIdnEmail.d.ts +2 -1
- package/lib/internal/_randomFormatIdnEmail.js +16 -2
- package/lib/internal/_randomFormatIdnEmail.js.map +1 -1
- package/lib/internal/_randomFormatIdnEmail.mjs +11 -2
- package/lib/internal/_randomFormatIdnEmail.mjs.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.d.ts +2 -1
- package/lib/internal/_randomFormatIdnHostname.js +26 -1
- package/lib/internal/_randomFormatIdnHostname.js.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.mjs +25 -2
- package/lib/internal/_randomFormatIdnHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatIpv4.d.ts +2 -1
- package/lib/internal/_randomFormatIpv4.js +2 -1
- package/lib/internal/_randomFormatIpv4.js.map +1 -1
- package/lib/internal/_randomFormatIpv4.mjs +2 -1
- package/lib/internal/_randomFormatIpv4.mjs.map +1 -1
- package/lib/internal/_randomFormatIpv6.d.ts +2 -1
- package/lib/internal/_randomFormatIpv6.js +2 -1
- package/lib/internal/_randomFormatIpv6.js.map +1 -1
- package/lib/internal/_randomFormatIpv6.mjs +2 -1
- package/lib/internal/_randomFormatIpv6.mjs.map +1 -1
- package/lib/internal/_randomFormatIri.d.ts +2 -1
- package/lib/internal/_randomFormatIri.js +1 -1
- package/lib/internal/_randomFormatIri.js.map +1 -1
- package/lib/internal/_randomFormatIri.mjs +1 -1
- package/lib/internal/_randomFormatIri.mjs.map +1 -1
- package/lib/internal/_randomFormatIriReference.d.ts +2 -1
- package/lib/internal/_randomFormatIriReference.js +1 -1
- package/lib/internal/_randomFormatIriReference.js.map +1 -1
- package/lib/internal/_randomFormatIriReference.mjs +1 -1
- package/lib/internal/_randomFormatIriReference.mjs.map +1 -1
- package/lib/internal/_randomFormatJsonPointer.d.ts +2 -1
- package/lib/internal/_randomFormatJsonPointer.js +8 -1
- package/lib/internal/_randomFormatJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatJsonPointer.mjs +5 -1
- package/lib/internal/_randomFormatJsonPointer.mjs.map +1 -1
- package/lib/internal/_randomFormatPassword.d.ts +2 -1
- package/lib/internal/_randomFormatPassword.js +7 -5
- package/lib/internal/_randomFormatPassword.js.map +1 -1
- package/lib/internal/_randomFormatPassword.mjs +5 -1
- package/lib/internal/_randomFormatPassword.mjs.map +1 -1
- package/lib/internal/_randomFormatRegex.d.ts +2 -1
- package/lib/internal/_randomFormatRegex.js +2 -1
- package/lib/internal/_randomFormatRegex.js.map +1 -1
- package/lib/internal/_randomFormatRegex.mjs +2 -1
- package/lib/internal/_randomFormatRegex.mjs.map +1 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.d.ts +2 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.js +3 -2
- package/lib/internal/_randomFormatRelativeJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.mjs +3 -2
- package/lib/internal/_randomFormatRelativeJsonPointer.mjs.map +1 -1
- package/lib/internal/_randomFormatTime.d.ts +2 -1
- package/lib/internal/_randomFormatTime.js +3 -2
- package/lib/internal/_randomFormatTime.js.map +1 -1
- package/lib/internal/_randomFormatTime.mjs +3 -2
- package/lib/internal/_randomFormatTime.mjs.map +1 -1
- package/lib/internal/_randomFormatUri.d.ts +2 -1
- package/lib/internal/_randomFormatUri.js +1 -1
- package/lib/internal/_randomFormatUri.js.map +1 -1
- package/lib/internal/_randomFormatUri.mjs +1 -1
- package/lib/internal/_randomFormatUri.mjs.map +1 -1
- package/lib/internal/_randomFormatUriReference.d.ts +2 -1
- package/lib/internal/_randomFormatUriReference.js +1 -1
- package/lib/internal/_randomFormatUriReference.js.map +1 -1
- package/lib/internal/_randomFormatUriReference.mjs +1 -1
- package/lib/internal/_randomFormatUriReference.mjs.map +1 -1
- package/lib/internal/_randomFormatUriTemplate.d.ts +2 -1
- package/lib/internal/_randomFormatUriTemplate.js +1 -1
- package/lib/internal/_randomFormatUriTemplate.js.map +1 -1
- package/lib/internal/_randomFormatUriTemplate.mjs +1 -1
- package/lib/internal/_randomFormatUriTemplate.mjs.map +1 -1
- package/lib/internal/_randomFormatUrl.d.ts +2 -1
- package/lib/internal/_randomFormatUrl.js +21 -1
- package/lib/internal/_randomFormatUrl.js.map +1 -1
- package/lib/internal/_randomFormatUrl.mjs +18 -1
- package/lib/internal/_randomFormatUrl.mjs.map +1 -1
- package/lib/internal/_randomFormatUuid.d.ts +2 -1
- package/lib/internal/_randomFormatUuid.js +3 -2
- package/lib/internal/_randomFormatUuid.js.map +1 -1
- package/lib/internal/_randomFormatUuid.mjs +3 -2
- package/lib/internal/_randomFormatUuid.mjs.map +1 -1
- package/lib/internal/_randomInteger.js +59 -28
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_randomInteger.mjs +56 -16
- package/lib/internal/_randomInteger.mjs.map +1 -1
- package/lib/internal/_randomMultiple.d.ts +8 -0
- package/lib/internal/_randomMultiple.js +168 -0
- package/lib/internal/_randomMultiple.js.map +1 -0
- package/lib/internal/_randomMultiple.mjs +158 -0
- package/lib/internal/_randomMultiple.mjs.map +1 -0
- package/lib/internal/_randomNumber.js +42 -42
- package/lib/internal/_randomNumber.js.map +1 -1
- package/lib/internal/_randomNumber.mjs +41 -27
- package/lib/internal/_randomNumber.mjs.map +1 -1
- package/lib/internal/_randomPattern.d.ts +2 -1
- package/lib/internal/_randomPattern.js +19 -4
- package/lib/internal/_randomPattern.js.map +1 -1
- package/lib/internal/_randomPattern.mjs +10 -4
- package/lib/internal/_randomPattern.mjs.map +1 -1
- package/lib/internal/_randomStringLength.d.ts +33 -0
- package/lib/internal/_randomStringLength.js +48 -0
- package/lib/internal/_randomStringLength.js.map +1 -0
- package/lib/internal/_randomStringLength.mjs +44 -0
- package/lib/internal/_randomStringLength.mjs.map +1 -0
- package/lib/internal/_stringLength.d.ts +1 -0
- package/lib/internal/_stringLength.js +11 -0
- package/lib/internal/_stringLength.js.map +1 -0
- package/lib/internal/_stringLength.mjs +10 -0
- package/lib/internal/_stringLength.mjs.map +1 -0
- package/lib/internal/_validateReport.js +4 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/internal/_validateReport.mjs +2 -1
- package/lib/internal/_validateReport.mjs.map +1 -1
- package/lib/internal/private/__notationRename.d.ts +14 -0
- package/lib/internal/private/__notationRename.js +25 -0
- package/lib/internal/private/__notationRename.js.map +1 -0
- package/lib/internal/private/__notationRename.mjs +24 -0
- package/lib/internal/private/__notationRename.mjs.map +1 -0
- package/lib/json.d.ts +2 -2
- package/lib/json.mjs.map +1 -1
- package/lib/module.d.ts +2 -2
- package/lib/module.js.map +1 -1
- package/lib/module.mjs.map +1 -1
- package/lib/notations.d.ts +20 -4
- package/lib/notations.js.map +1 -1
- package/lib/notations.mjs.map +1 -1
- package/native/adapter/plugin_options.go +117 -0
- package/native/adapter/plugin_options_payload_matrix_test.go +181 -0
- package/native/cmd/ttsc-typia/any_array_type_tags_transform_test.go +63 -9
- package/native/cmd/ttsc-typia/assert_guard_factory_contract_test.go +152 -0
- package/native/cmd/ttsc-typia/build.go +81 -64
- package/native/cmd/ttsc-typia/build_no_emit_preserves_analysis_options_test.go +67 -0
- package/native/cmd/ttsc-typia/build_no_emit_transform_diagnostics_test.go +138 -0
- package/native/cmd/ttsc-typia/build_plugin_options_come_from_payload_test.go +48 -0
- package/native/cmd/ttsc-typia/build_transactional_emit_success_test.go +81 -0
- package/native/cmd/ttsc-typia/build_transform_failure_atomicity_test.go +138 -0
- package/native/cmd/ttsc-typia/command_routes_and_diagnostics_coverage_test.go +3 -1
- package/native/cmd/ttsc-typia/compare_less_nan_transform_test.go +98 -0
- package/native/cmd/ttsc-typia/compare_native_object_overmatch_transform_test.go +161 -0
- package/native/cmd/ttsc-typia/compare_nondiscriminable_union_transform_test.go +343 -0
- package/native/cmd/ttsc-typia/compare_union_discrimination_transform_test.go +289 -0
- package/native/cmd/ttsc-typia/escaped_property_key_path_transform_test.go +193 -0
- package/native/cmd/ttsc-typia/finite_option_number_leaf_transform_test.go +240 -0
- package/native/cmd/ttsc-typia/functional_promised_type_transform_test.go +220 -0
- package/native/cmd/ttsc-typia/functional_receiver_transform_test.go +232 -0
- package/native/cmd/ttsc-typia/is_object_function_member_transform_test.go +205 -0
- package/native/cmd/ttsc-typia/json_application_alias_function_validation_transform_test.go +151 -0
- package/native/cmd/ttsc-typia/json_is_stringify_finite_number_transform_test.go +198 -0
- package/native/cmd/ttsc-typia/json_stringify_special_key_transform_test.go +238 -0
- package/native/cmd/ttsc-typia/main_wasm.go +21 -2
- package/native/cmd/ttsc-typia/native_collection_identity_is_transform_test.go +234 -0
- package/native/cmd/ttsc-typia/native_generic_name_guard_is_transform_test.go +194 -0
- package/native/cmd/ttsc-typia/native_name_collision_is_transform_test.go +204 -0
- package/native/cmd/ttsc-typia/non_trailing_rest_tuple_transform_test.go +23 -11
- package/native/cmd/ttsc-typia/notation_dynamic_keys_transform_test.go +286 -0
- package/native/cmd/ttsc-typia/notation_kebab_case_transform_test.go +1 -1
- package/native/cmd/ttsc-typia/notation_literal_collision_transform_test.go +164 -0
- package/native/cmd/ttsc-typia/notation_pascal_case_transform_test.go +230 -0
- package/native/cmd/ttsc-typia/notation_unicode_key_transform_test.go +309 -0
- package/native/cmd/ttsc-typia/pattern_line_terminator_escape_transform_test.go +224 -0
- package/native/cmd/ttsc-typia/plain_prune_union_object_overmatch_transform_test.go +219 -0
- package/native/cmd/ttsc-typia/plugin_options_payload_helpers_test.go +181 -0
- package/native/cmd/ttsc-typia/private_field_filter_is_transform_test.go +278 -0
- package/native/cmd/ttsc-typia/project_catalog_transform_coverage_test.go +73 -27
- package/native/cmd/ttsc-typia/project_dependencies_barrel_reexport_transform_test.go +120 -0
- package/native/cmd/ttsc-typia/project_dependencies_collapsed_alias_transform_test.go +134 -0
- package/native/cmd/ttsc-typia/project_dependencies_custom_lib_name_transform_test.go +135 -0
- package/native/cmd/ttsc-typia/project_dependencies_default_barrel_transform_test.go +114 -0
- package/native/cmd/ttsc-typia/project_dependencies_empty_heritage_transform_test.go +100 -0
- package/native/cmd/ttsc-typia/project_dependencies_envelope_transform_test.go +148 -0
- package/native/cmd/ttsc-typia/project_dependencies_index_signature_alias_transform_test.go +139 -0
- package/native/cmd/ttsc-typia/project_dependencies_local_reexport_transform_test.go +122 -0
- package/native/cmd/ttsc-typia/project_dependencies_signature_alias_transform_test.go +125 -0
- package/native/cmd/ttsc-typia/project_dependencies_star_barrel_transform_test.go +112 -0
- package/native/cmd/ttsc-typia/project_reference_graph_envelope_transform_test.go +190 -0
- package/native/cmd/ttsc-typia/protobuf_is_encode_finite_number_transform_test.go +98 -0
- package/native/cmd/ttsc-typia/protobuf_sequence_field_numbers_transform_test.go +52 -22
- package/native/cmd/ttsc-typia/symbol_key_member_filter_transform_test.go +279 -0
- package/native/cmd/ttsc-typia/template_interpolation_type_tags_transform_test.go +86 -23
- package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +3 -1
- package/native/cmd/ttsc-typia/transform.go +228 -39
- package/native/cmd/ttsc-typia/{transform_declaration_source_produces_no_js_test.go → transform_declaration_source_produces_no_javascript_test.go} +10 -2
- package/native/cmd/ttsc-typia/transform_fixtures_emit_coverage_test.go +21 -4
- package/native/cmd/ttsc-typia/transform_helpers_test.go +159 -1
- package/native/cmd/ttsc-typia/transform_plugin_options_come_from_payload_test.go +43 -0
- package/native/cmd/ttsc-typia/transform_single_file_failure_atomicity_test.go +114 -0
- package/native/cmd/ttsc-typia/transform_single_file_failure_writes_no_stdout_test.go +43 -0
- package/native/cmd/ttsc-typia/transform_single_file_js_distinguishes_same_basename_sources_test.go +81 -0
- package/native/cmd/ttsc-typia/transform_single_file_js_empty_emit_reports_no_output_test.go +100 -0
- package/native/cmd/ttsc-typia/transform_single_file_js_locates_output_across_layouts_test.go +160 -0
- package/native/cmd/ttsc-typia/transform_single_file_success_publishes_artifact_test.go +54 -0
- package/native/cmd/ttsc-typia/transform_wasm_host_argv_reports_diagnostics_test.go +39 -0
- package/native/cmd/ttsc-typia/tuple_optional_compare_clone_transform_test.go +227 -0
- package/native/core/factories/FormatCheatSheet.go +40 -7
- package/native/core/factories/IdentifierFactory.go +131 -4
- package/native/core/factories/MetadataCommentTagFactory.go +83 -40
- package/native/core/factories/MetadataTypeTagFactory.go +13 -1
- package/native/core/factories/NumericRangeFactory.go +60 -17
- package/native/core/factories/ProtobufFactory.go +7 -4
- package/native/core/factories/factory_utility_coverage_test.go +8 -2
- package/native/core/factories/format_alias_resolves_to_cheat_sheet_test.go +57 -0
- package/native/core/factories/format_alias_table_targets_the_cheat_sheet_test.go +44 -0
- package/native/core/factories/identifier_factory_postfix_escapes_every_key_test.go +147 -0
- package/native/core/factories/identifier_factory_postfix_survives_every_code_point_test.go +86 -0
- package/native/core/factories/internal/metadata/MetadataHelper.go +134 -7
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +116 -8
- package/native/core/factories/internal/metadata/iterate_metadata.go +6 -0
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +4 -11
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +8 -6
- package/native/core/factories/internal/metadata/iterate_metadata_map.go +9 -0
- package/native/core/factories/internal/metadata/iterate_metadata_native.go +27 -2
- package/native/core/factories/internal/metadata/iterate_metadata_set.go +9 -0
- package/native/core/factories/internal/metadata/js_doc_link_text_test.go +69 -0
- package/native/core/factories/internal/metadata/type_arguments_precondition_test.go +70 -0
- package/native/core/factories/metadata_comment_tag_factory_coverage_test.go +39 -0
- package/native/core/factories/metadata_comment_tag_factory_exclusivity_matches_interface_test.go +84 -0
- package/native/core/factories/metadata_type_tag_factory_accepts_legal_tag_combinations_test.go +60 -0
- package/native/core/factories/metadata_type_tag_factory_declarations_test.go +86 -0
- package/native/core/factories/metadata_type_tag_factory_keeps_bool_form_exclusivity_test.go +38 -0
- package/native/core/factories/metadata_type_tag_factory_rejects_cross_kind_exclusive_tags_test.go +65 -0
- package/native/core/factories/metadata_type_tag_factory_rejects_duplicated_array_form_tags_test.go +41 -0
- package/native/core/factories/numeric_range_factory_enforces_64bit_bounds_test.go +69 -0
- package/native/core/factories/protobuf_recovery_ownership_test.go +64 -0
- package/native/core/programmers/IsProgrammer.go +15 -1
- package/native/core/programmers/RandomProgrammer.go +51 -14
- package/native/core/programmers/compare/CompareEqualProgrammer.go +393 -5
- package/native/core/programmers/compare/CompareLessProgrammer.go +4 -2
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +4 -6
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +5 -13
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +6 -14
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +4 -6
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +49 -14
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +5 -13
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +4 -6
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +5 -13
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +5 -13
- package/native/core/programmers/functional/internal/FunctionalGeneralProgrammer.go +4 -17
- package/native/core/programmers/helpers/CloneJoiner.go +32 -0
- package/native/core/programmers/helpers/NotationJoiner.go +86 -28
- package/native/core/programmers/helpers/StringifyJoinder.go +32 -1
- package/native/core/programmers/helpers/UnionExplorer.go +203 -61
- package/native/core/programmers/helpers/joiner_branch_coverage_test.go +5 -3
- package/native/core/programmers/helpers/union_explorer_coverage_test.go +1 -1
- package/native/core/programmers/internal/CheckerProgrammer.go +100 -48
- package/native/core/programmers/iterate/check_template.go +344 -32
- package/native/core/programmers/iterate/json_schema_discriminator.go +36 -10
- package/native/core/programmers/iterate/json_schema_discriminator_declaration_syntax_test.go +205 -0
- package/native/core/programmers/iterate/openapi_v3_downgrader.go +641 -0
- package/native/core/programmers/iterate/openapi_v3_downgrader_boolean_default_test.go +95 -0
- package/native/core/programmers/iterate/openapi_v3_downgrader_test.go +123 -0
- package/native/core/programmers/iterate/template_interpolation_tags_test.go +40 -8
- package/native/core/programmers/iterate/template_runtime_pattern.go +52 -7
- package/native/core/programmers/json/JsonApplicationProgrammer.go +45 -11
- package/native/core/programmers/json/JsonSchemasProgrammer.go +12 -2
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +12 -10
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +23 -6
- package/native/core/programmers/llm/llm_reference_codec_test.go +24 -0
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +183 -67
- package/native/core/programmers/notations/notation_general_helpers_test.go +1 -3
- package/native/core/programmers/notations/notation_general_programmer_pascal_multiword_test.go +72 -0
- package/native/core/programmers/notations/notation_general_programmer_underscore_boundary_test.go +68 -0
- package/native/core/programmers/plain/PlainClassifyProgrammer.go +23 -15
- package/native/core/programmers/plain/PlainCloneProgrammer.go +20 -7
- package/native/core/programmers/plain/PlainPruneProgrammer.go +19 -5
- package/native/core/programmers/plain/plain_tuple_seed_recovery_ownership_test.go +25 -0
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +37 -28
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +40 -21
- package/native/core/programmers/protobuf/protobuf_programmer_helper_coverage_test.go +26 -0
- package/native/core/programmers/random_programmer_length_argument_test.go +53 -0
- package/native/core/schemas/metadata/MetadataCollection.go +270 -20
- package/native/core/schemas/metadata/MetadataDependency.go +388 -0
- package/native/core/schemas/metadata/MetadataObjectType.go +17 -4
- package/native/core/schemas/metadata/metadata_collection_generic_argument_dot_test.go +122 -0
- package/native/core/schemas/metadata/metadata_collection_name_allocation_test.go +147 -0
- package/native/core/schemas/metadata/metadata_collection_openapi_name_cascade_test.go +55 -0
- package/native/core/schemas/metadata/metadata_collection_openapi_name_test.go +68 -0
- package/native/core/utils/PatternUtil.go +13 -0
- package/native/core/utils/PromiseTypeFactory.go +59 -0
- package/native/core/utils/ProtobufNameEncoder.go +8 -0
- package/native/core/utils/promise_type_factory_semantics_test.go +118 -0
- package/native/go.mod +9 -1
- package/native/transform/CallExpressionTransformer.go +12 -0
- package/native/transform/features/json/JsonApplicationTransformer.go +1 -1
- package/native/transform/features/json/JsonSchemaTransformer.go +1 -1
- package/native/transform/features/json/JsonSchemasTransformer.go +5 -4
- package/package.json +16 -4
- package/src/executable/FileSystemIdentity.ts +189 -0
- package/src/executable/TypiaGenerateWizard.ts +377 -110
- package/src/functional.ts +30 -60
- package/src/internal/_ProtobufReader.ts +129 -43
- package/src/internal/_createStandardSchema.ts +15 -1
- package/src/internal/_decimal.ts +69 -0
- package/src/internal/_httpQueryParseURLSearchParams.ts +24 -2
- package/src/internal/_isFormatByte.ts +2 -5
- package/src/internal/_isFormatDate.ts +15 -2
- package/src/internal/_isFormatDateTime.ts +28 -2
- package/src/internal/_isFormatIri.ts +5 -2
- package/src/internal/_isFormatIriReference.ts +11 -3
- package/src/internal/_isFormatUriReference.ts +1 -1
- package/src/internal/_isMultipleOf.ts +8 -0
- package/src/internal/_isTypeFloat.ts +1 -1
- package/src/internal/_isTypeInt64.ts +1 -0
- package/src/internal/_isTypeInt64Bigint.ts +12 -0
- package/src/internal/_isTypeUint64.ts +1 -0
- package/src/internal/_isTypeUint64Bigint.ts +7 -0
- package/src/internal/_isUniqueItems.ts +134 -132
- package/src/internal/_notationAny.ts +9 -4
- package/src/internal/_notationAssign.ts +20 -0
- package/src/internal/_notationCamel.ts +31 -10
- package/src/internal/_notationKebab.ts +11 -0
- package/src/internal/_notationKeyCollision.ts +9 -0
- package/src/internal/_notationPascal.ts +19 -6
- package/src/internal/_notationSnake.ts +24 -21
- package/src/internal/_plainCloneAny.ts +208 -33
- package/src/internal/_randomArray.ts +13 -4
- package/src/internal/_randomFormatByte.ts +4 -1
- package/src/internal/_randomFormatDate.ts +17 -12
- package/src/internal/_randomFormatDatetime.ts +15 -10
- package/src/internal/_randomFormatDuration.ts +16 -14
- package/src/internal/_randomFormatEmail.ts +8 -2
- package/src/internal/_randomFormatHostname.ts +48 -1
- package/src/internal/_randomFormatIdnEmail.ts +18 -2
- package/src/internal/_randomFormatIdnHostname.ts +34 -2
- package/src/internal/_randomFormatIpv4.ts +3 -2
- package/src/internal/_randomFormatIpv6.ts +3 -2
- package/src/internal/_randomFormatIri.ts +3 -1
- package/src/internal/_randomFormatIriReference.ts +3 -1
- package/src/internal/_randomFormatJsonPointer.ts +8 -2
- package/src/internal/_randomFormatPassword.ts +11 -6
- package/src/internal/_randomFormatRegex.ts +4 -1
- package/src/internal/_randomFormatRelativeJsonPointer.ts +13 -6
- package/src/internal/_randomFormatTime.ts +13 -10
- package/src/internal/_randomFormatUri.ts +3 -1
- package/src/internal/_randomFormatUriReference.ts +3 -1
- package/src/internal/_randomFormatUriTemplate.ts +3 -1
- package/src/internal/_randomFormatUrl.ts +25 -2
- package/src/internal/_randomFormatUuid.ts +10 -6
- package/src/internal/_randomInteger.ts +87 -40
- package/src/internal/_randomMultiple.ts +245 -0
- package/src/internal/_randomNumber.ts +72 -55
- package/src/internal/_randomPattern.ts +26 -4
- package/src/internal/_randomStringLength.ts +72 -0
- package/src/internal/_stringLength.ts +5 -0
- package/src/internal/_validateReport.ts +5 -1
- package/src/internal/private/__notationRename.ts +24 -0
- package/src/json.ts +2 -2
- package/src/module.ts +4 -6
- package/src/notations.ts +20 -4
- package/lib/internal/private/__notationCapitalize.d.ts +0 -1
- package/lib/internal/private/__notationCapitalize.js +0 -6
- package/lib/internal/private/__notationCapitalize.js.map +0 -1
- package/lib/internal/private/__notationCapitalize.mjs +0 -6
- package/lib/internal/private/__notationCapitalize.mjs.map +0 -1
- package/lib/internal/private/__notationUnsnake.d.ts +0 -4
- package/lib/internal/private/__notationUnsnake.js +0 -26
- package/lib/internal/private/__notationUnsnake.js.map +0 -1
- package/lib/internal/private/__notationUnsnake.mjs +0 -15
- package/lib/internal/private/__notationUnsnake.mjs.map +0 -1
- package/native/cmd/ttsc-typia/plugin_options_missing_config_test.go +0 -26
- package/native/cmd/ttsc-typia/plugin_options_undefined_false_test.go +0 -36
- package/src/internal/private/__notationCapitalize.ts +0 -2
- package/src/internal/private/__notationUnsnake.ts +0 -24
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
package factories
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"strings"
|
|
6
|
+
"testing"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// TestIdentifierFactoryPostfixEscapesEveryKey verifies emitted accessor paths.
|
|
10
|
+
//
|
|
11
|
+
// Postfix returns JavaScript source that callers splice into the emit as
|
|
12
|
+
// `_path + <postfix>`, so it carries two nested escaping levels: the key becomes
|
|
13
|
+
// a JSON literal, and that literal sits inside the JavaScript literal returned.
|
|
14
|
+
// Escaping one level and not the other emitted a file that does not parse for a
|
|
15
|
+
// `"` key, and a path that JSON.parse rejects inside _createStandardSchema for a
|
|
16
|
+
// control-character key. The expected strings below come from the contract that
|
|
17
|
+
// typia's own runtime helper _accessExpressionAsString implements for dynamic
|
|
18
|
+
// keys, `variable(str) ? ".{str}" : "[{JSON.stringify(str)}]"`, not from what
|
|
19
|
+
// the emitter happens to produce.
|
|
20
|
+
//
|
|
21
|
+
// 1. Assert the exact source text Postfix returns for identifier keys, quoting
|
|
22
|
+
// keys, escape-sensitive keys, control characters, and non-ASCII keys.
|
|
23
|
+
// 2. Decode every result as JSON twice and assert the original key survives.
|
|
24
|
+
// 3. Assert the identifier fast path stays a dotted accessor, so ordinary keys
|
|
25
|
+
// and prototype-shadowing keys keep their existing output.
|
|
26
|
+
func TestIdentifierFactoryPostfixEscapesEveryKey(t *testing.T) {
|
|
27
|
+
for _, item := range []struct {
|
|
28
|
+
name string
|
|
29
|
+
key string
|
|
30
|
+
expected string
|
|
31
|
+
}{
|
|
32
|
+
// Identifier fast path: no escaping is possible, so output is unchanged.
|
|
33
|
+
{"identifier", "field", `".field"`},
|
|
34
|
+
{"underscore", "_private", `"._private"`},
|
|
35
|
+
{"dollar", "$ref", `".$ref"`},
|
|
36
|
+
// A prototype-shadowing key is still a plain property access, because the
|
|
37
|
+
// emitted accessor reads the property and never the prototype.
|
|
38
|
+
{"proto", "__proto__", `".__proto__"`},
|
|
39
|
+
{"constructor", "constructor", `".constructor"`},
|
|
40
|
+
{"toString", "toString", `".toString"`},
|
|
41
|
+
// Ordinary quoted keys: byte-identical to the pre-fix output.
|
|
42
|
+
{"hyphen", "a-b", `"[\"a-b\"]"`},
|
|
43
|
+
{"space", "not valid", `"[\"not valid\"]"`},
|
|
44
|
+
{"empty", "", `"[\"\"]"`},
|
|
45
|
+
{"digit first", "0abc", `"[\"0abc\"]"`},
|
|
46
|
+
{"dotted", "a.b", `"[\"a.b\"]"`},
|
|
47
|
+
{"bracket", "a[0]", `"[\"a[0]\"]"`},
|
|
48
|
+
{"reserved", "for", `"[\"for\"]"`},
|
|
49
|
+
// Neither quote nor backslash, so no escape applies at either level.
|
|
50
|
+
{"single quote", "a'b", `"[\"a'b\"]"`},
|
|
51
|
+
{"backtick", "a`b", "\"[\\\"a`b\\\"]\""},
|
|
52
|
+
{"template hole", "a${b}c", `"[\"a${b}c\"]"`},
|
|
53
|
+
// The double quote is escaped once per level: `"` -> `\"` -> `\\\"`.
|
|
54
|
+
{"double quote", `a"b`, `"[\"a\\\"b\"]"`},
|
|
55
|
+
{"only double quote", `"`, `"[\"\\\"\"]"`},
|
|
56
|
+
// The backslash likewise. Escaping it once left the emitted path saying
|
|
57
|
+
// `["a\b"]`, which JSON.parse reads back as a backspace, not a backslash.
|
|
58
|
+
{"backslash", `a\b`, `"[\"a\\\\b\"]"`},
|
|
59
|
+
{"only backslash", `\`, `"[\"\\\\\"]"`},
|
|
60
|
+
{"quote and backslash", `a"\b`, `"[\"a\\\"\\\\b\"]"`},
|
|
61
|
+
// Control characters need a JSON escape; a raw one makes JSON.parse throw.
|
|
62
|
+
{"newline", "a\nb", `"[\"a\\nb\"]"`},
|
|
63
|
+
{"tab", "a\tb", `"[\"a\\tb\"]"`},
|
|
64
|
+
{"carriage return", "a\rb", `"[\"a\\rb\"]"`},
|
|
65
|
+
{"backspace", "a\bb", `"[\"a\\bb\"]"`},
|
|
66
|
+
{"form feed", "a\fb", `"[\"a\\fb\"]"`},
|
|
67
|
+
{"null", "a\x00b", `"[\"a\\u0000b\"]"`},
|
|
68
|
+
{"unit separator", "a\x1fb", `"[\"a\\u001fb\"]"`},
|
|
69
|
+
// strconv.Quote wrote `\a` and `\v` here. JavaScript has no `\a`, so it
|
|
70
|
+
// decoded to a plain "a" and silently changed the key.
|
|
71
|
+
{"bell", "a\x07b", `"[\"a\\u0007b\"]"`},
|
|
72
|
+
{"vertical tab", "a\x0bb", `"[\"a\\u000bb\"]"`},
|
|
73
|
+
// A line terminator to JavaScript but an ordinary character to JSON, so the
|
|
74
|
+
// escape belongs in the source and must not reach the path itself: the
|
|
75
|
+
// emitted `\u2028` decodes back to the raw character JSON.stringify writes.
|
|
76
|
+
{"line separator", "a\u2028b", `"[\"a\u2028b\"]"`},
|
|
77
|
+
{"paragraph separator", "a\u2029b", `"[\"a\u2029b\"]"`},
|
|
78
|
+
// Printable non-ASCII stays raw, exactly as JSON.stringify leaves it.
|
|
79
|
+
{"non ascii", "한글", `"[\"한글\"]"`},
|
|
80
|
+
{"emoji", "a\U0001F600b", "\"[\\\"a\U0001F600b\\\"]\""},
|
|
81
|
+
// strconv.Quote wrote `\U0001d173` for a non-printable astral rune, and
|
|
82
|
+
// JavaScript has no `\U` escape at all; it read back as "U0001d173".
|
|
83
|
+
{"astral format", "a\U0001D173b", "\"[\\\"a\U0001D173b\\\"]\""},
|
|
84
|
+
// A lone surrogate arrives WTF-8 encoded and has no valid UTF-8 form, so an
|
|
85
|
+
// escape is the only way to carry it.
|
|
86
|
+
{"lone surrogate", "a\xed\xa0\x80b", `"[\"a\\ud800b\"]"`},
|
|
87
|
+
// No escape denotes a byte that is not UTF-8 at all.
|
|
88
|
+
{"invalid utf8", "a\xffb", `"[\"a\\ufffdb\"]"`},
|
|
89
|
+
} {
|
|
90
|
+
t.Run(item.name, func(t *testing.T) {
|
|
91
|
+
output := IdentifierFactory.Postfix(item.key)
|
|
92
|
+
if output != item.expected {
|
|
93
|
+
t.Fatalf("Postfix(%q)\n got: %s\nwant: %s", item.key, output, item.expected)
|
|
94
|
+
}
|
|
95
|
+
identifierFactoryPostfixRoundTrip(t, item.key, output)
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// identifierFactoryPostfixRoundTrip decodes the emitted source the way the
|
|
101
|
+
// runtime does: JavaScript reads the outer literal, then _createStandardSchema
|
|
102
|
+
// hands the bracketed key to JSON.parse. encoding/json stands in for both,
|
|
103
|
+
// which makes this an independent check that the escaping is real rather than a
|
|
104
|
+
// restatement of the emitter's own logic.
|
|
105
|
+
func identifierFactoryPostfixRoundTrip(t *testing.T, key string, output string) {
|
|
106
|
+
t.Helper()
|
|
107
|
+
var path string
|
|
108
|
+
if err := json.Unmarshal([]byte(output), &path); err != nil {
|
|
109
|
+
t.Fatalf("Postfix(%q) is not a JavaScript string literal: %s (%v)", key, output, err)
|
|
110
|
+
}
|
|
111
|
+
if strings.HasPrefix(path, ".") {
|
|
112
|
+
if path[1:] != key {
|
|
113
|
+
t.Fatalf("Postfix(%q) dotted accessor lost the key: %q", key, path)
|
|
114
|
+
}
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
if !strings.HasPrefix(path, "[") || !strings.HasSuffix(path, "]") {
|
|
118
|
+
t.Fatalf("Postfix(%q) is neither a dotted nor a bracketed accessor: %q", key, path)
|
|
119
|
+
}
|
|
120
|
+
var decoded string
|
|
121
|
+
if err := json.Unmarshal([]byte(path[1:len(path)-1]), &decoded); err != nil {
|
|
122
|
+
t.Fatalf("Postfix(%q) bracketed key is not JSON: %q (%v)", key, path, err)
|
|
123
|
+
}
|
|
124
|
+
if want := identifierFactoryPostfixDecodable(key); decoded != want {
|
|
125
|
+
t.Fatalf("Postfix(%q) round-tripped to %q, want %q", key, decoded, want)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// identifierFactoryPostfixDecodable states what a JSON decoder can return for
|
|
130
|
+
// `key`. encoding/json replaces an unpaired surrogate and never yields invalid
|
|
131
|
+
// UTF-8, so those two inputs come back as the replacement character even though
|
|
132
|
+
// the emitted escape itself is exact.
|
|
133
|
+
func identifierFactoryPostfixDecodable(key string) string {
|
|
134
|
+
var builder strings.Builder
|
|
135
|
+
for i := 0; i < len(key); {
|
|
136
|
+
// Detect a WTF-8 surrogate here rather than calling the factory's own
|
|
137
|
+
// helper, so this expectation stays independent of the code under test.
|
|
138
|
+
if len(key)-i >= 3 && key[i] == 0xed && key[i+1] >= 0xa0 && key[i+1] <= 0xbf {
|
|
139
|
+
builder.WriteRune('�')
|
|
140
|
+
i += 3
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
143
|
+
builder.WriteByte(key[i])
|
|
144
|
+
i++
|
|
145
|
+
}
|
|
146
|
+
return strings.ToValidUTF8(builder.String(), "�")
|
|
147
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
package factories
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
6
|
+
"strings"
|
|
7
|
+
"testing"
|
|
8
|
+
"unicode/utf8"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// TestIdentifierFactoryPostfixSurvivesEveryCodePoint verifies total escaping.
|
|
12
|
+
//
|
|
13
|
+
// The emitted accessor is spliced into the emit as source text, and nothing
|
|
14
|
+
// downstream parses the file, so a key the escaper mishandles ships as a broken
|
|
15
|
+
// artifact behind a successful build. The table-driven case list pins the
|
|
16
|
+
// characters that actually regressed; this one closes the class by sweeping the
|
|
17
|
+
// whole input space, because the escape decision is per rune and a sampled
|
|
18
|
+
// matrix cannot prove a per-rune rule. encoding/json decodes the result, which
|
|
19
|
+
// is an implementation typia does not own and therefore a real oracle: JSON
|
|
20
|
+
// string syntax is a subset of JavaScript string syntax, so a literal it accepts
|
|
21
|
+
// also parses in the emitted file.
|
|
22
|
+
//
|
|
23
|
+
// 1. Sweep every scalar value and assert the key round-trips exactly.
|
|
24
|
+
// 2. Sweep every surrogate code unit and assert the WTF-8 form survives as an
|
|
25
|
+
// escape rather than corrupting the literal.
|
|
26
|
+
// 3. Sweep every single byte, including the ones that are not UTF-8, and assert
|
|
27
|
+
// the emitted literal still decodes.
|
|
28
|
+
func TestIdentifierFactoryPostfixSurvivesEveryCodePoint(t *testing.T) {
|
|
29
|
+
for code := rune(0); code <= utf8.MaxRune; code++ {
|
|
30
|
+
if code >= 0xd800 && code <= 0xdfff {
|
|
31
|
+
continue // Not a scalar value; covered by the surrogate sweep below.
|
|
32
|
+
}
|
|
33
|
+
key := "a" + string(code) + "b"
|
|
34
|
+
if decoded := identifierFactoryPostfixDecode(t, key); decoded != key {
|
|
35
|
+
t.Fatalf("U+%04X: Postfix round-tripped to %q, want %q", code, decoded, key)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for unit := rune(0xd800); unit <= 0xdfff; unit++ {
|
|
40
|
+
key := "a" + string([]byte{
|
|
41
|
+
0xe0 | byte(unit>>12),
|
|
42
|
+
0x80 | byte((unit>>6)&0x3f),
|
|
43
|
+
0x80 | byte(unit&0x3f),
|
|
44
|
+
}) + "b"
|
|
45
|
+
output := IdentifierFactory.Postfix(key)
|
|
46
|
+
// The inner level writes `\ud800` and the outer level escapes that
|
|
47
|
+
// backslash, so the emitted source carries `\\ud800`.
|
|
48
|
+
if want := fmt.Sprintf(`\\u%04x`, unit); !strings.Contains(output, want) {
|
|
49
|
+
t.Fatalf("U+%04X: lone surrogate was not escaped as %s: %s", unit, want, output)
|
|
50
|
+
}
|
|
51
|
+
// The decoder replaces an unpaired surrogate, so assert the literal stays
|
|
52
|
+
// well formed rather than demanding the original bytes back.
|
|
53
|
+
identifierFactoryPostfixDecode(t, key)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for value := 0; value <= 0xff; value++ {
|
|
57
|
+
key := "a" + string([]byte{byte(value)}) + "b"
|
|
58
|
+
decoded := identifierFactoryPostfixDecode(t, key)
|
|
59
|
+
if utf8.ValidString(key) && decoded != key {
|
|
60
|
+
t.Fatalf("byte 0x%02X: Postfix round-tripped to %q, want %q", value, decoded, key)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// identifierFactoryPostfixDecode reads the emitted source the way the runtime
|
|
66
|
+
// does and fails the test if any layer rejects it: JavaScript parses the outer
|
|
67
|
+
// literal, then _createStandardSchema hands the bracketed key to JSON.parse.
|
|
68
|
+
func identifierFactoryPostfixDecode(t *testing.T, key string) string {
|
|
69
|
+
t.Helper()
|
|
70
|
+
output := IdentifierFactory.Postfix(key)
|
|
71
|
+
var path string
|
|
72
|
+
if err := json.Unmarshal([]byte(output), &path); err != nil {
|
|
73
|
+
t.Fatalf("Postfix(%q) is not a string literal: %s (%v)", key, output, err)
|
|
74
|
+
}
|
|
75
|
+
if strings.HasPrefix(path, ".") {
|
|
76
|
+
return path[1:]
|
|
77
|
+
}
|
|
78
|
+
if !strings.HasPrefix(path, "[") || !strings.HasSuffix(path, "]") {
|
|
79
|
+
t.Fatalf("Postfix(%q) is not an accessor: %q", key, path)
|
|
80
|
+
}
|
|
81
|
+
var decoded string
|
|
82
|
+
if err := json.Unmarshal([]byte(path[1:len(path)-1]), &decoded); err != nil {
|
|
83
|
+
t.Fatalf("Postfix(%q) bracketed key is not JSON: %q (%v)", key, path, err)
|
|
84
|
+
}
|
|
85
|
+
return decoded
|
|
86
|
+
}
|
|
@@ -129,15 +129,13 @@ func metadata_explore_symbol_name(node *nativeast.Node, name string) string {
|
|
|
129
129
|
return name
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
func metadata_get_type_arguments(checker *nativechecker.Checker, typ *nativechecker.Type)
|
|
132
|
+
func metadata_get_type_arguments(checker *nativechecker.Checker, typ *nativechecker.Type) []*nativechecker.Type {
|
|
133
133
|
if checker == nil || typ == nil {
|
|
134
134
|
return nil
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}()
|
|
136
|
+
if typ.Flags()&nativechecker.TypeFlagsObject == 0 || typ.ObjectFlags()&nativechecker.ObjectFlagsReference == 0 {
|
|
137
|
+
return nil
|
|
138
|
+
}
|
|
141
139
|
return checker.GetTypeArguments(typ)
|
|
142
140
|
}
|
|
143
141
|
|
|
@@ -153,6 +151,21 @@ func metadata_get_function_node(typ *nativechecker.Type) *nativeast.Node {
|
|
|
153
151
|
if nativeast.IsFunctionLike(node) {
|
|
154
152
|
return node
|
|
155
153
|
}
|
|
154
|
+
// The global `Function` interface (declared in a default `lib.*.d.ts`) is
|
|
155
|
+
// callable and newable at runtime, so a `Function`-typed member is a function,
|
|
156
|
+
// not a structural object: `constructor: Function` on the global `Object`
|
|
157
|
+
// interface, an explicit `x: Function`, or any member inherited through
|
|
158
|
+
// `extends Object`. Its symbol resolves to an `InterfaceDeclaration` rather
|
|
159
|
+
// than a function-like node, so without this branch it is expanded
|
|
160
|
+
// structurally (`{ prototype, length, arguments, caller, name }`) and its
|
|
161
|
+
// `typeof` is checked as `"object"` even though a real function reports
|
|
162
|
+
// `"function"`, making `is<Object>` universally false (#2178). Returning the
|
|
163
|
+
// interface declaration routes the member through the same function path typia
|
|
164
|
+
// already uses for `() => void` members: a lenient pass under default options
|
|
165
|
+
// and a signature-based check under `functional`.
|
|
166
|
+
if metadata_is_global_function_interface(symbol, node) {
|
|
167
|
+
return node
|
|
168
|
+
}
|
|
156
169
|
if nativeast.IsPropertyAssignment(node) {
|
|
157
170
|
initializer := node.AsPropertyAssignment().Initializer
|
|
158
171
|
if nativeast.IsFunctionLike(initializer) {
|
|
@@ -268,6 +281,25 @@ func metadata_node_type_js_doc_tags(symbol *nativeast.Symbol) []schemametadata.I
|
|
|
268
281
|
return metadata_node_js_doc_tags(symbol)
|
|
269
282
|
}
|
|
270
283
|
|
|
284
|
+
// metadata_is_global_function_interface reports whether the type behind `symbol`
|
|
285
|
+
// is the global `Function` interface from a TypeScript default library. The
|
|
286
|
+
// match is intentionally narrow — the symbol name is exactly `"Function"`, its
|
|
287
|
+
// first declaration is an `InterfaceDeclaration`, and that declaration lives in a
|
|
288
|
+
// `lib.*.d.ts` — so it recognizes only the lib `Function` and never a
|
|
289
|
+
// user-declared `interface Function`, a `function Function()` value, or any
|
|
290
|
+
// other callable object type (a hybrid `interface Foo { (): void; x: number }`
|
|
291
|
+
// keeps its data properties). See metadata_get_function_node for why the lib
|
|
292
|
+
// `Function` must be treated as a function type (#2178).
|
|
293
|
+
func metadata_is_global_function_interface(symbol *nativeast.Symbol, node *nativeast.Node) bool {
|
|
294
|
+
if symbol == nil || symbol.Name != "Function" {
|
|
295
|
+
return false
|
|
296
|
+
}
|
|
297
|
+
if node == nil || node.Kind != nativeast.KindInterfaceDeclaration {
|
|
298
|
+
return false
|
|
299
|
+
}
|
|
300
|
+
return metadata_symbol_from_default_lib(symbol)
|
|
301
|
+
}
|
|
302
|
+
|
|
271
303
|
// metadata_symbol_from_default_lib reports whether the symbol's first locatable
|
|
272
304
|
// declaration lives in a TypeScript default library file. Default library files
|
|
273
305
|
// are always named `lib.<target>.d.ts` regardless of the install directory, so
|
|
@@ -283,6 +315,28 @@ func metadata_symbol_from_default_lib(symbol *nativeast.Symbol) bool {
|
|
|
283
315
|
return false
|
|
284
316
|
}
|
|
285
317
|
|
|
318
|
+
// metadata_symbol_from_declaration_file reports whether the symbol's first
|
|
319
|
+
// locatable declaration lives in a `.d.ts` declaration file. It widens
|
|
320
|
+
// metadata_symbol_from_default_lib beyond the TypeScript default libraries
|
|
321
|
+
// (lib.*.d.ts) to any ambient declaration file, because a built-in native can be
|
|
322
|
+
// declared by an ambient package rather than a default lib — the `File` and
|
|
323
|
+
// `Blob` globals Node adds through @types/node are declared in `.d.ts` files that
|
|
324
|
+
// are not `lib.*.d.ts`. Native classification uses this to keep a real built-in
|
|
325
|
+
// native (declared in a `.d.ts`, whichever library) native, while a user type
|
|
326
|
+
// that merely shares a native's name — an `interface File { name; size }` in a
|
|
327
|
+
// `.ts` module — is not a declaration and falls through to the structural object
|
|
328
|
+
// path (#2200).
|
|
329
|
+
func metadata_symbol_from_declaration_file(symbol *nativeast.Symbol) bool {
|
|
330
|
+
for _, node := range metadata_node_declarations(symbol) {
|
|
331
|
+
src := nativeast.GetSourceFileOfNode(node)
|
|
332
|
+
if src == nil {
|
|
333
|
+
continue
|
|
334
|
+
}
|
|
335
|
+
return src.IsDeclarationFile
|
|
336
|
+
}
|
|
337
|
+
return false
|
|
338
|
+
}
|
|
339
|
+
|
|
286
340
|
func metadata_is_default_lib_file_name(fileName string) bool {
|
|
287
341
|
slash := strings.ReplaceAll(fileName, "\\", "/")
|
|
288
342
|
base := slash
|
|
@@ -407,13 +461,86 @@ func metadata_js_doc_comment_text(list *nativeast.NodeList) string {
|
|
|
407
461
|
}
|
|
408
462
|
parts := []string{}
|
|
409
463
|
for _, node := range list.Nodes {
|
|
410
|
-
if node
|
|
464
|
+
if node == nil {
|
|
465
|
+
continue
|
|
466
|
+
}
|
|
467
|
+
switch node.Kind {
|
|
468
|
+
case nativeast.KindJSDocText:
|
|
411
469
|
parts = append(parts, node.Text())
|
|
470
|
+
case nativeast.KindJSDocLink,
|
|
471
|
+
nativeast.KindJSDocLinkCode,
|
|
472
|
+
nativeast.KindJSDocLinkPlain:
|
|
473
|
+
parts = append(parts, metadata_js_doc_link_text(node))
|
|
412
474
|
}
|
|
413
475
|
}
|
|
414
476
|
return metadata_clean_js_doc_text(strings.Join(parts, ""))
|
|
415
477
|
}
|
|
416
478
|
|
|
479
|
+
func metadata_js_doc_link_text(node *nativeast.Node) string {
|
|
480
|
+
if node == nil {
|
|
481
|
+
return ""
|
|
482
|
+
}
|
|
483
|
+
name := node.Name()
|
|
484
|
+
text := strings.Trim(node.Text(), " ")
|
|
485
|
+
if name == nil {
|
|
486
|
+
return text
|
|
487
|
+
}
|
|
488
|
+
nameText := metadata_js_doc_entity_name_text(name)
|
|
489
|
+
if (nameText == "http" || nameText == "https") && strings.HasPrefix(text, "://") {
|
|
490
|
+
target := nameText + text
|
|
491
|
+
index := strings.IndexAny(target, " |")
|
|
492
|
+
if index == -1 {
|
|
493
|
+
return target
|
|
494
|
+
}
|
|
495
|
+
label := metadata_js_doc_link_label(target[index:])
|
|
496
|
+
if label != "" {
|
|
497
|
+
return label
|
|
498
|
+
}
|
|
499
|
+
return target[:index]
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
suffix := ""
|
|
503
|
+
if strings.HasPrefix(text, "()") {
|
|
504
|
+
suffix = "()"
|
|
505
|
+
text = text[2:]
|
|
506
|
+
}
|
|
507
|
+
if label := metadata_js_doc_link_label(text); label != "" {
|
|
508
|
+
return label
|
|
509
|
+
}
|
|
510
|
+
return nameText + suffix
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
func metadata_js_doc_link_label(text string) string {
|
|
514
|
+
text = strings.TrimLeft(text, " ")
|
|
515
|
+
text = strings.TrimPrefix(text, "|")
|
|
516
|
+
return strings.TrimSpace(text)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
func metadata_js_doc_entity_name_text(node *nativeast.Node) string {
|
|
520
|
+
if node == nil {
|
|
521
|
+
return ""
|
|
522
|
+
}
|
|
523
|
+
switch node.Kind {
|
|
524
|
+
case nativeast.KindIdentifier:
|
|
525
|
+
return node.Text()
|
|
526
|
+
case nativeast.KindQualifiedName:
|
|
527
|
+
name := node.AsQualifiedName()
|
|
528
|
+
if name == nil {
|
|
529
|
+
return ""
|
|
530
|
+
}
|
|
531
|
+
return metadata_js_doc_entity_name_text(name.Left) + "." + metadata_js_doc_entity_name_text(name.Right)
|
|
532
|
+
case nativeast.KindPropertyAccessExpression:
|
|
533
|
+
return metadata_js_doc_entity_name_text(node.Expression()) + "." + metadata_js_doc_entity_name_text(node.Name())
|
|
534
|
+
case nativeast.KindParenthesizedExpression,
|
|
535
|
+
nativeast.KindExpressionWithTypeArguments:
|
|
536
|
+
return metadata_js_doc_entity_name_text(node.Expression())
|
|
537
|
+
case nativeast.KindJSDocNameReference:
|
|
538
|
+
return metadata_js_doc_entity_name_text(node.Name())
|
|
539
|
+
default:
|
|
540
|
+
return ""
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
417
544
|
func metadata_clean_js_doc_text(text string) string {
|
|
418
545
|
text = strings.ReplaceAll(text, "\r\n", "\n")
|
|
419
546
|
text = strings.ReplaceAll(text, "\r", "\n")
|
|
@@ -67,24 +67,61 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
67
67
|
// plain.classify cannot soundly field-copy (Object.create + assign) a class
|
|
68
68
|
// that has them — and the PROTOTYPE CHAIN matters: a field-copied subclass
|
|
69
69
|
// of a #private-bearing base would equally throw "Cannot read private
|
|
70
|
-
// member".
|
|
71
|
-
//
|
|
72
|
-
//
|
|
70
|
+
// member". A `#private` member DOES surface in ApparentProperties (as a
|
|
71
|
+
// mangled key), so the member filter below must drop it from the validated
|
|
72
|
+
// shape; here it is detected on the class declaration(s) — where its
|
|
73
|
+
// KindPrivateIdentifier name is unambiguous and statics are skippable —
|
|
74
|
+
// walking the `extends` chain. Additive flag, read only by the classify
|
|
75
|
+
// programmer.
|
|
73
76
|
if emplace_metadata_object_private_fields(props.Checker, props.Type, map[*nativechecker.Type]bool{}) {
|
|
74
77
|
obj.PrivateFields = true
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
// Report the `extends` / `implements` chain to the dependency listener. The
|
|
83
|
+
// apparent-property walk below already registers the declaring file of every
|
|
84
|
+
// inherited member, but a base that currently contributes no property (an
|
|
85
|
+
// empty interface or class) would otherwise stay invisible — and gaining its
|
|
86
|
+
// first property is exactly the change that must invalidate the consumer.
|
|
87
|
+
if props.Type != nil && schemametadata.MetadataDependency_active(props.Checker) {
|
|
88
|
+
emplace_metadata_object_touch_heritage(props.Checker, props.Type.Symbol(), map[*nativeast.Symbol]bool{})
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
isClass := props.Type != nil && props.Type.IsClass()
|
|
80
92
|
isProperty := emplace_metadata_object_significant(props.Options.Functional, props.Options.Methods)
|
|
81
|
-
pred := func(node *nativeast.Node) bool {
|
|
93
|
+
pred := func(symbol *nativeast.Symbol, node *nativeast.Node) bool {
|
|
94
|
+
// A `symbol`-keyed member (`[uniqueSymbol]: T`, `[Symbol.toStringTag]: T`,
|
|
95
|
+
// ...) is not a string / number key: it is unreachable through the string
|
|
96
|
+
// index access typia emits, `JSON.stringify` ignores it, and JSON Schema has
|
|
97
|
+
// no representation for it. So it is not part of the structural,
|
|
98
|
+
// externally-observable shape — exclude it exactly as a `private`/`protected`
|
|
99
|
+
// keyword member and an ES `#private` one. The checker escapes such a member
|
|
100
|
+
// name with the 0xFE `InternalSymbolNamePrefix`, and ApparentProperties
|
|
101
|
+
// otherwise surfaces it under that mangled name, which no runtime object
|
|
102
|
+
// carries: every real value would fail its own guard, and the emitted schema
|
|
103
|
+
// would declare an uninhabitable required property (#2226). Checked on the
|
|
104
|
+
// SYMBOL rather than a declaration node so a late-bound member with no
|
|
105
|
+
// reachable declaration is excluded too.
|
|
106
|
+
if symbol != nil && iterate_metadata_intersection_is_symbol_name(symbol.Name) {
|
|
107
|
+
return false
|
|
108
|
+
}
|
|
82
109
|
if node == nil {
|
|
83
110
|
return true
|
|
84
111
|
}
|
|
85
112
|
if isClass && node.ModifierFlags()&(nativeast.ModifierFlagsPrivate|nativeast.ModifierFlagsProtected) != 0 {
|
|
86
113
|
return false
|
|
87
114
|
}
|
|
115
|
+
// An ES `#private` member (field, method, or accessor) carries no
|
|
116
|
+
// Private/Protected modifier — its identity is a KindPrivateIdentifier name.
|
|
117
|
+
// It is installed only by the constructor and is unreachable via index
|
|
118
|
+
// access, so it is not part of the structural shape; exclude it exactly as a
|
|
119
|
+
// `private`/`protected` keyword member (see ClassNonPublic). ApparentProperties
|
|
120
|
+
// otherwise surfaces it as a mangled key that no runtime object carries, so
|
|
121
|
+
// every real instance would fail its own guard (#2213).
|
|
122
|
+
if isClass && node.Name() != nil && node.Name().Kind == nativeast.KindPrivateIdentifier {
|
|
123
|
+
return false
|
|
124
|
+
}
|
|
88
125
|
return isProperty(node)
|
|
89
126
|
}
|
|
90
127
|
|
|
@@ -111,7 +148,7 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
111
148
|
} else {
|
|
112
149
|
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, props.Type, symbol.Name)
|
|
113
150
|
}
|
|
114
|
-
if (
|
|
151
|
+
if pred(symbol, node) == false || typ == nil {
|
|
115
152
|
continue
|
|
116
153
|
}
|
|
117
154
|
|
|
@@ -197,6 +234,77 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
197
234
|
return obj
|
|
198
235
|
}
|
|
199
236
|
|
|
237
|
+
// emplace_metadata_object_touch_heritage reports every `extends` / `implements`
|
|
238
|
+
// heritage target of `symbol`'s class / interface declarations to the
|
|
239
|
+
// dependency listener, following the chain recursively so intermediate empty
|
|
240
|
+
// bases register too. Import aliases resolve to their final target symbol,
|
|
241
|
+
// whose declarations carry the real declaring files. Walking runs only while a
|
|
242
|
+
// listener is active (see the call site), so ordinary analysis pays nothing.
|
|
243
|
+
func emplace_metadata_object_touch_heritage(
|
|
244
|
+
checker *nativechecker.Checker,
|
|
245
|
+
symbol *nativeast.Symbol,
|
|
246
|
+
visited map[*nativeast.Symbol]bool,
|
|
247
|
+
) {
|
|
248
|
+
if checker == nil || symbol == nil || visited[symbol] {
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
visited[symbol] = true
|
|
252
|
+
for _, decl := range symbol.Declarations {
|
|
253
|
+
if decl == nil {
|
|
254
|
+
continue
|
|
255
|
+
}
|
|
256
|
+
var clauses *nativeast.NodeList
|
|
257
|
+
switch decl.Kind {
|
|
258
|
+
case nativeast.KindClassDeclaration:
|
|
259
|
+
if cd := decl.AsClassDeclaration(); cd != nil {
|
|
260
|
+
clauses = cd.HeritageClauses
|
|
261
|
+
}
|
|
262
|
+
case nativeast.KindClassExpression:
|
|
263
|
+
if ce := decl.AsClassExpression(); ce != nil {
|
|
264
|
+
clauses = ce.HeritageClauses
|
|
265
|
+
}
|
|
266
|
+
case nativeast.KindInterfaceDeclaration:
|
|
267
|
+
if id := decl.AsInterfaceDeclaration(); id != nil {
|
|
268
|
+
clauses = id.HeritageClauses
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if clauses == nil {
|
|
272
|
+
continue
|
|
273
|
+
}
|
|
274
|
+
for _, clause := range clauses.Nodes {
|
|
275
|
+
if clause == nil || clause.Kind != nativeast.KindHeritageClause {
|
|
276
|
+
continue
|
|
277
|
+
}
|
|
278
|
+
hc := clause.AsHeritageClause()
|
|
279
|
+
if hc == nil || hc.Types == nil {
|
|
280
|
+
continue
|
|
281
|
+
}
|
|
282
|
+
for _, element := range hc.Types.Nodes {
|
|
283
|
+
if element == nil {
|
|
284
|
+
continue
|
|
285
|
+
}
|
|
286
|
+
// The node walk reports the heritage expression's symbol and every
|
|
287
|
+
// reference written in its type arguments (e.g. `extends Base<Id>`).
|
|
288
|
+
schemametadata.MetadataDependency_touchTypeNode(checker, element)
|
|
289
|
+
expr := element.AsExpressionWithTypeArguments()
|
|
290
|
+
if expr == nil || expr.Expression == nil {
|
|
291
|
+
continue
|
|
292
|
+
}
|
|
293
|
+
target := checker.GetSymbolAtLocation(expr.Expression)
|
|
294
|
+
if target == nil {
|
|
295
|
+
continue
|
|
296
|
+
}
|
|
297
|
+
if target.Flags&nativeast.SymbolFlagsAlias != 0 {
|
|
298
|
+
if resolved := nativechecker.Checker_getAliasedSymbol(checker, target); resolved != nil {
|
|
299
|
+
target = resolved
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
emplace_metadata_object_touch_heritage(checker, target, visited)
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
200
308
|
// emplace_metadata_object_private_fields reports whether `typ` or any class in
|
|
201
309
|
// its `extends` chain declares an INSTANCE ES #private member — which field-copy
|
|
202
310
|
// (Object.create + assign) cannot reconstruct, so plain.classify must reject it.
|
|
@@ -350,7 +458,7 @@ func emplace_metadata_object_intersection(
|
|
|
350
458
|
props IMetadataIteratorProps,
|
|
351
459
|
obj *schemametadata.MetadataObjectType,
|
|
352
460
|
insert func(emplace_metadata_object_insert) *schemametadata.MetadataProperty,
|
|
353
|
-
pred func(node *nativeast.Node) bool,
|
|
461
|
+
pred func(symbol *nativeast.Symbol, node *nativeast.Node) bool,
|
|
354
462
|
) bool {
|
|
355
463
|
if props.Checker == nil ||
|
|
356
464
|
props.Type == nil ||
|
|
@@ -424,7 +532,7 @@ func emplace_metadata_object_intersection_append(
|
|
|
424
532
|
props IMetadataIteratorProps,
|
|
425
533
|
child *nativechecker.Type,
|
|
426
534
|
insert func(emplace_metadata_object_insert) *schemametadata.MetadataProperty,
|
|
427
|
-
pred func(node *nativeast.Node) bool,
|
|
535
|
+
pred func(symbol *nativeast.Symbol, node *nativeast.Node) bool,
|
|
428
536
|
) bool {
|
|
429
537
|
if props.Checker == nil || child == nil || len(props.Components.IndexInfos(props.Checker, child)) != 0 {
|
|
430
538
|
return false
|
|
@@ -443,7 +551,7 @@ func emplace_metadata_object_intersection_append(
|
|
|
443
551
|
} else {
|
|
444
552
|
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, child, symbol.Name)
|
|
445
553
|
}
|
|
446
|
-
if (
|
|
554
|
+
if pred(symbol, node) == false || typ == nil {
|
|
447
555
|
continue
|
|
448
556
|
}
|
|
449
557
|
|
|
@@ -9,6 +9,12 @@ func Iterate_metadata(props IMetadataIteratorProps) {
|
|
|
9
9
|
if props.Type == nil {
|
|
10
10
|
return
|
|
11
11
|
}
|
|
12
|
+
// Every type the analysis reads funnels through here (top types, union and
|
|
13
|
+
// intersection members, alias targets, array / tuple elements, generic
|
|
14
|
+
// arguments, property types), so this single touch reports the declaration
|
|
15
|
+
// files of the whole consulted type graph to the dependency listener the
|
|
16
|
+
// project transform host registers (see schemas/metadata/MetadataDependency).
|
|
17
|
+
schemametadata.MetadataDependency_touchType(props.Checker, props.Type)
|
|
12
18
|
if props.Type.IsTypeParameter() == true {
|
|
13
19
|
if props.Errors != nil {
|
|
14
20
|
*props.Errors = append(*props.Errors, MetadataFactory_IError{
|
|
@@ -3,6 +3,7 @@ package metadata
|
|
|
3
3
|
import (
|
|
4
4
|
nativechecker "github.com/microsoft/typescript-go/shim/checker"
|
|
5
5
|
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
6
|
+
nativeutils "github.com/samchon/typia/packages/typia/native/core/utils"
|
|
6
7
|
)
|
|
7
8
|
|
|
8
9
|
func Iterate_metadata_function(props IMetadataIteratorProps) bool {
|
|
@@ -36,16 +37,8 @@ func Iterate_metadata_function(props IMetadataIteratorProps) bool {
|
|
|
36
37
|
|
|
37
38
|
signature := signatures[0]
|
|
38
39
|
returnType := props.Checker.GetReturnTypeOfSignature(signature)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if symbol := returnType.Symbol(); symbol != nil && symbol.Name == "Promise" {
|
|
42
|
-
generic := metadata_get_type_arguments(props.Checker, returnType)
|
|
43
|
-
if len(generic) != 0 {
|
|
44
|
-
returnType = generic[0]
|
|
45
|
-
}
|
|
46
|
-
async = true
|
|
47
|
-
}
|
|
48
|
-
}
|
|
40
|
+
promised := nativeutils.PromiseTypeFactory.Resolve(props.Checker, returnType)
|
|
41
|
+
returnType = promised.Type
|
|
49
42
|
|
|
50
43
|
parameters := make([]*schemametadata.MetadataParameter, 0, len(signature.Parameters()))
|
|
51
44
|
for _, p := range signature.Parameters() {
|
|
@@ -87,7 +80,7 @@ func Iterate_metadata_function(props IMetadataIteratorProps) bool {
|
|
|
87
80
|
props.Metadata.Functions = append(props.Metadata.Functions, schemametadata.MetadataFunction_create(schemametadata.MetadataFunction{
|
|
88
81
|
Parameters: parameters,
|
|
89
82
|
Output: output,
|
|
90
|
-
Async:
|
|
83
|
+
Async: promised.Async,
|
|
91
84
|
}))
|
|
92
85
|
return true
|
|
93
86
|
}
|