typia 3.5.8 → 3.6.0-dev.20230225
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 +2 -0
- package/lib/Primitive.d.ts +2 -1
- package/lib/executable/TypiaGenerateWizard.d.ts +8 -0
- package/lib/executable/TypiaGenerateWizard.js +182 -0
- package/lib/executable/TypiaGenerateWizard.js.map +1 -0
- package/lib/executable/typia.js +11 -4
- package/lib/executable/typia.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +1 -1
- package/lib/factories/IdentifierFactory.js +3 -3
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/TypeFactory.d.ts +1 -0
- package/lib/factories/TypeFactory.js +17 -1
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/TypiaFileFactory.d.ts +8 -0
- package/lib/factories/TypiaFileFactory.js +236 -0
- package/lib/factories/TypiaFileFactory.js.map +1 -0
- package/lib/programmers/AssertCloneProgrammer.js +4 -1
- package/lib/programmers/AssertCloneProgrammer.js.map +1 -1
- package/lib/programmers/AssertParseProgrammer.js +4 -1
- package/lib/programmers/AssertParseProgrammer.js.map +1 -1
- package/lib/programmers/AssertProgrammer.js +4 -1
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/AssertPruneProgrammer.js +4 -1
- package/lib/programmers/AssertPruneProgrammer.js.map +1 -1
- package/lib/programmers/AssertStringifyProgrammer.js +4 -1
- package/lib/programmers/AssertStringifyProgrammer.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +1 -1
- package/lib/programmers/CheckerProgrammer.js +8 -0
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/CloneProgrammer.d.ts +1 -1
- package/lib/programmers/CloneProgrammer.js +17 -2
- package/lib/programmers/CloneProgrammer.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +10 -1
- package/lib/programmers/FeatureProgrammer.js +24 -16
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/IsCloneProgrammer.js +7 -1
- package/lib/programmers/IsCloneProgrammer.js.map +1 -1
- package/lib/programmers/IsParseProgrammer.js +5 -2
- package/lib/programmers/IsParseProgrammer.js.map +1 -1
- package/lib/programmers/IsProgrammer.d.ts +1 -1
- package/lib/programmers/IsPruneProgrammer.js +4 -1
- package/lib/programmers/IsPruneProgrammer.js.map +1 -1
- package/lib/programmers/IsStringifyProgrammer.js +7 -1
- package/lib/programmers/IsStringifyProgrammer.js.map +1 -1
- package/lib/programmers/PruneProgrammer.d.ts +1 -1
- package/lib/programmers/PruneProgrammer.js +7 -0
- package/lib/programmers/PruneProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +9 -8
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/StringifyProgrammer.d.ts +1 -1
- package/lib/programmers/StringifyProgrammer.js +7 -0
- package/lib/programmers/StringifyProgrammer.js.map +1 -1
- package/lib/programmers/ValidateCloneProgrammer.js +5 -2
- package/lib/programmers/ValidateCloneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateParseProgrammer.js +4 -1
- package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.js +7 -4
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/ValidatePruneProgrammer.js +4 -1
- package/lib/programmers/ValidatePruneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.js +5 -2
- package/lib/programmers/ValidateStringifyProgrammer.js.map +1 -1
- package/lib/programmers/helpers/CloneJoiner.js +5 -4
- package/lib/programmers/helpers/CloneJoiner.js.map +1 -1
- package/lib/programmers/helpers/FunctionImporeter.js +2 -1
- package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
- package/lib/programmers/helpers/RandomJoiner.js +3 -2
- package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
- package/lib/programmers/internal/check_everything.js +4 -1
- package/lib/programmers/internal/check_everything.js.map +1 -1
- package/lib/programmers/internal/check_union_array_like.js +10 -3
- package/lib/programmers/internal/check_union_array_like.js.map +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.js +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +4 -1
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/ImportTransformer.d.ts +4 -0
- package/lib/transformers/ImportTransformer.js +51 -0
- package/lib/transformers/ImportTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/IRandomGenerator.ts +16 -16
- package/src/IValidation.ts +21 -21
- package/src/Primitive.ts +104 -82
- package/src/TypeGuardError.ts +36 -36
- package/src/executable/TypiaGenerateWizard.ts +87 -0
- package/src/executable/TypiaSetupWizard.ts +142 -142
- package/src/executable/setup/ArgumentParser.ts +91 -91
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +33 -33
- package/src/executable/setup/PackageManager.ts +92 -92
- package/src/executable/setup/PluginConfigurator.ts +99 -99
- package/src/executable/typia.ts +38 -29
- package/src/factories/CommentFactory.ts +10 -10
- package/src/factories/ExpressionFactory.ts +77 -77
- package/src/factories/IdentifierFactory.ts +73 -72
- package/src/factories/LiteralFactory.ts +44 -44
- package/src/factories/MetadataCollection.ts +122 -122
- package/src/factories/MetadataFactory.ts +51 -51
- package/src/factories/MetadataTagFactory.ts +265 -265
- package/src/factories/StatementFactory.ts +60 -60
- package/src/factories/TemplateFactory.ts +56 -56
- package/src/factories/TypeFactory.ts +129 -101
- package/src/factories/TypiaFileFactory.ts +117 -0
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/MetadataHelper.ts +12 -12
- package/src/factories/internal/metadata/emplace_metadata_object.ts +140 -140
- package/src/factories/internal/metadata/explore_metadata.ts +92 -92
- package/src/factories/internal/metadata/iterate_metadata.ts +80 -80
- package/src/factories/internal/metadata/iterate_metadata_array.ts +29 -29
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +59 -59
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +58 -58
- package/src/factories/internal/metadata/iterate_metadata_map.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_native.ts +222 -222
- package/src/factories/internal/metadata/iterate_metadata_object.ts +48 -48
- package/src/factories/internal/metadata/iterate_metadata_resolve.ts +27 -27
- package/src/factories/internal/metadata/iterate_metadata_set.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_template.ts +38 -38
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +45 -45
- package/src/factories/internal/metadata/iterate_metadata_union.ts +59 -59
- package/src/functional/$any.ts +3 -3
- package/src/functional/$every.ts +11 -11
- package/src/functional/$guard.ts +35 -35
- package/src/functional/$is_between.ts +7 -7
- package/src/functional/$is_email.ts +5 -5
- package/src/functional/$is_ipv4.ts +5 -5
- package/src/functional/$is_ipv6.ts +5 -5
- package/src/functional/$is_url.ts +5 -5
- package/src/functional/$is_uuid.ts +5 -5
- package/src/functional/$join.ts +50 -50
- package/src/functional/$number.ts +12 -12
- package/src/functional/$report.ts +15 -15
- package/src/functional/$rest.ts +3 -3
- package/src/functional/$string.ts +37 -37
- package/src/functional/$tail.ts +6 -6
- package/src/functional/Namespace.ts +121 -121
- package/src/index.ts +4 -4
- package/src/metadata/IJsDocTagInfo.ts +10 -10
- package/src/metadata/IMetadata.ts +25 -25
- package/src/metadata/IMetadataApplication.ts +7 -7
- package/src/metadata/IMetadataConstant.ts +16 -16
- package/src/metadata/IMetadataEntry.ts +6 -6
- package/src/metadata/IMetadataObject.ts +29 -29
- package/src/metadata/IMetadataProperty.ts +11 -11
- package/src/metadata/IMetadataTag.ts +113 -113
- package/src/metadata/Metadata.ts +534 -534
- package/src/metadata/MetadataConstant.ts +3 -3
- package/src/metadata/MetadataObject.ts +131 -131
- package/src/metadata/MetadataProperty.ts +64 -64
- package/src/module.ts +1946 -1946
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/AssertCloneProgrammer.ts +71 -60
- package/src/programmers/AssertParseProgrammer.ts +66 -55
- package/src/programmers/AssertProgrammer.ts +232 -435
- package/src/programmers/AssertPruneProgrammer.ts +67 -59
- package/src/programmers/AssertStringifyProgrammer.ts +71 -65
- package/src/programmers/CheckerProgrammer.ts +892 -879
- package/src/programmers/CloneProgrammer.ts +387 -361
- package/src/programmers/FeatureProgrammer.ts +505 -462
- package/src/programmers/IsCloneProgrammer.ts +80 -66
- package/src/programmers/IsParseProgrammer.ts +75 -61
- package/src/programmers/IsProgrammer.ts +200 -200
- package/src/programmers/IsPruneProgrammer.ts +75 -63
- package/src/programmers/IsStringifyProgrammer.ts +80 -69
- package/src/programmers/PruneProgrammer.ts +341 -333
- package/src/programmers/RandomProgrammer.ts +392 -373
- package/src/programmers/StringifyProgrammer.ts +795 -787
- package/src/programmers/ValidateCloneProgrammer.ts +91 -77
- package/src/programmers/ValidateParseProgrammer.ts +70 -59
- package/src/programmers/ValidateProgrammer.ts +267 -238
- package/src/programmers/ValidatePruneProgrammer.ts +84 -73
- package/src/programmers/ValidateStringifyProgrammer.ts +88 -77
- package/src/programmers/helpers/AtomicPredicator.ts +31 -31
- package/src/programmers/helpers/CloneJoiner.ts +134 -124
- package/src/programmers/helpers/FunctionImporeter.ts +55 -46
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/OptionPredicator.ts +19 -19
- package/src/programmers/helpers/PruneJoiner.ts +52 -52
- package/src/programmers/helpers/RandomJoiner.ts +149 -142
- package/src/programmers/helpers/RandomRanger.ts +216 -216
- package/src/programmers/helpers/StringifyJoinder.ts +114 -114
- package/src/programmers/helpers/StringifyPredicator.ts +18 -18
- package/src/programmers/helpers/UnionExplorer.ts +274 -274
- package/src/programmers/helpers/UnionPredicator.ts +81 -81
- package/src/programmers/internal/application_array.ts +37 -37
- package/src/programmers/internal/application_boolean.ts +17 -17
- package/src/programmers/internal/application_constant.ts +29 -29
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_default_string.ts +32 -32
- package/src/programmers/internal/application_native.ts +29 -29
- package/src/programmers/internal/application_number.ts +70 -70
- package/src/programmers/internal/application_object.ts +153 -153
- package/src/programmers/internal/application_schema.ts +184 -184
- package/src/programmers/internal/application_string.ts +41 -41
- package/src/programmers/internal/application_templates.ts +27 -27
- package/src/programmers/internal/application_tuple.ts +29 -29
- package/src/programmers/internal/check_array.ts +22 -22
- package/src/programmers/internal/check_array_length.ts +44 -44
- package/src/programmers/internal/check_bigint.ts +64 -64
- package/src/programmers/internal/check_dynamic_properties.ts +197 -197
- package/src/programmers/internal/check_everything.ts +28 -25
- package/src/programmers/internal/check_native.ts +21 -21
- package/src/programmers/internal/check_number.ts +145 -145
- package/src/programmers/internal/check_object.ts +48 -48
- package/src/programmers/internal/check_string.ts +24 -24
- package/src/programmers/internal/check_string_tags.ts +63 -63
- package/src/programmers/internal/check_template.ts +50 -50
- package/src/programmers/internal/check_union_array_like.ts +260 -244
- package/src/programmers/internal/check_union_tuple.ts +33 -33
- package/src/programmers/internal/decode_union_object.ts +73 -73
- package/src/programmers/internal/feature_object_entries.ts +59 -59
- package/src/programmers/internal/metadata_to_pattern.ts +31 -31
- package/src/programmers/internal/prune_object_properties.ts +60 -60
- package/src/programmers/internal/stringify_dynamic_properties.ts +165 -164
- package/src/programmers/internal/stringify_native.ts +8 -8
- package/src/programmers/internal/stringify_regular_properties.ts +81 -81
- package/src/programmers/internal/template_to_pattern.ts +15 -15
- package/src/schemas/IJsonApplication.ts +9 -9
- package/src/schemas/IJsonComponents.ts +26 -26
- package/src/schemas/IJsonSchema.ts +127 -127
- package/src/transform.ts +21 -21
- package/src/transformers/CallExpressionTransformer.ts +172 -165
- package/src/transformers/ExpressionWithArgumentTransformer.ts +66 -66
- package/src/transformers/FileTransformer.ts +49 -49
- package/src/transformers/IProject.ts +11 -11
- package/src/transformers/ITransformOptions.ts +62 -62
- package/src/transformers/ImportTransformer.ts +60 -0
- package/src/transformers/NodeTransformer.ts +19 -19
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +120 -120
- package/src/transformers/features/miscellaneous/AssertCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/CloneTransformer.ts +46 -46
- package/src/transformers/features/miscellaneous/CreateAssertCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +31 -31
- package/src/transformers/features/miscellaneous/CreateIsCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +31 -31
- package/src/transformers/features/miscellaneous/CreateRandomGenerator.ts +39 -39
- package/src/transformers/features/miscellaneous/CreateValidateCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/IsCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +55 -55
- package/src/transformers/features/miscellaneous/PruneTransformer.ts +46 -46
- package/src/transformers/features/miscellaneous/RandomTransformer.ts +45 -45
- package/src/transformers/features/miscellaneous/ValidateCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +38 -38
- package/src/transformers/features/parsers/AssertParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateIsParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/IsParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/ValidateParseTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +31 -31
- package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +32 -32
- package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/StringifyTransformer.ts +46 -46
- package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +38 -38
- package/src/transformers/features/validators/AssertTransformer.ts +43 -43
- package/src/transformers/features/validators/CreateAssertTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateIsTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateValidateTransformer.ts +35 -35
- package/src/transformers/features/validators/IsTransformer.ts +43 -43
- package/src/transformers/features/validators/ValidateTransformer.ts +43 -43
- package/src/typings/Atomic.ts +17 -17
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +49 -49
- package/src/utils/Escaper.ts +50 -50
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/PatternUtil.ts +30 -30
- package/src/utils/RandomGenerator.ts +90 -90
- package/src/utils/Singleton.ts +17 -17
package/src/Primitive.ts
CHANGED
|
@@ -1,82 +1,104 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Primitive type.
|
|
3
|
-
*
|
|
4
|
-
* `Primitive` is a type of TMP (Type Meta Programming) type who converts its argument as a
|
|
5
|
-
* primitive type.
|
|
6
|
-
*
|
|
7
|
-
* If the target argument is a built-in class who returns its origin primitive type through
|
|
8
|
-
* the `valueOf()` method like the `String` or `Number`, its return type would be the
|
|
9
|
-
* `string` or `number`.
|
|
10
|
-
*
|
|
11
|
-
* Otherwise, the target argument is a type of custom class, all of its custom method would
|
|
12
|
-
* be erased and its prototype would be changed to the primitive `object`. Therefore, return
|
|
13
|
-
* type of the TMP type finally be the primitive object.
|
|
14
|
-
*
|
|
15
|
-
* In addition, if the target argument is a type of custom class and it has a special
|
|
16
|
-
* method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
|
|
17
|
-
* but `Primitive<ReturnType<Instance.toJSON>>`.
|
|
18
|
-
*
|
|
19
|
-
* Before | After
|
|
20
|
-
* ------------------------|----------------------------------------
|
|
21
|
-
* `Boolean` | `boolean`
|
|
22
|
-
* `Number` | `number`
|
|
23
|
-
* `String` | `string`
|
|
24
|
-
* `Class` | `object`
|
|
25
|
-
* `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
|
|
26
|
-
* Others | No change
|
|
27
|
-
*
|
|
28
|
-
* @template Instance Target argument type.
|
|
29
|
-
* @author Jenogho Nam - https://github.com/samchon
|
|
30
|
-
*/
|
|
31
|
-
export type Primitive<T> = _Equal<T, _Primitive<T>> extends true
|
|
32
|
-
? T
|
|
33
|
-
: _Primitive<T>;
|
|
34
|
-
|
|
35
|
-
type _Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
|
|
36
|
-
|
|
37
|
-
type _Primitive<Instance> = _ValueOf<Instance> extends object
|
|
38
|
-
? Instance extends object
|
|
39
|
-
? Instance extends
|
|
40
|
-
?
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
?
|
|
61
|
-
: _IsValueOf<Instance,
|
|
62
|
-
?
|
|
63
|
-
: Instance
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Primitive type.
|
|
3
|
+
*
|
|
4
|
+
* `Primitive` is a type of TMP (Type Meta Programming) type who converts its argument as a
|
|
5
|
+
* primitive type.
|
|
6
|
+
*
|
|
7
|
+
* If the target argument is a built-in class who returns its origin primitive type through
|
|
8
|
+
* the `valueOf()` method like the `String` or `Number`, its return type would be the
|
|
9
|
+
* `string` or `number`.
|
|
10
|
+
*
|
|
11
|
+
* Otherwise, the target argument is a type of custom class, all of its custom method would
|
|
12
|
+
* be erased and its prototype would be changed to the primitive `object`. Therefore, return
|
|
13
|
+
* type of the TMP type finally be the primitive object.
|
|
14
|
+
*
|
|
15
|
+
* In addition, if the target argument is a type of custom class and it has a special
|
|
16
|
+
* method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
|
|
17
|
+
* but `Primitive<ReturnType<Instance.toJSON>>`.
|
|
18
|
+
*
|
|
19
|
+
* Before | After
|
|
20
|
+
* ------------------------|----------------------------------------
|
|
21
|
+
* `Boolean` | `boolean`
|
|
22
|
+
* `Number` | `number`
|
|
23
|
+
* `String` | `string`
|
|
24
|
+
* `Class` | `object`
|
|
25
|
+
* `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
|
|
26
|
+
* Others | No change
|
|
27
|
+
*
|
|
28
|
+
* @template Instance Target argument type.
|
|
29
|
+
* @author Jenogho Nam - https://github.com/samchon
|
|
30
|
+
*/
|
|
31
|
+
export type Primitive<T> = _Equal<T, _Primitive<T>> extends true
|
|
32
|
+
? T
|
|
33
|
+
: _Primitive<T>;
|
|
34
|
+
|
|
35
|
+
type _Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
|
|
36
|
+
|
|
37
|
+
type _Primitive<Instance> = _ValueOf<Instance> extends object
|
|
38
|
+
? Instance extends object
|
|
39
|
+
? Instance extends _Native
|
|
40
|
+
? {}
|
|
41
|
+
: Instance extends IJsonable<infer Raw>
|
|
42
|
+
? _ValueOf<Raw> extends object
|
|
43
|
+
? Raw extends object
|
|
44
|
+
? _PrimitiveObject<Raw> // object would be primitified
|
|
45
|
+
: never // cannot be
|
|
46
|
+
: _ValueOf<Raw> // atomic value
|
|
47
|
+
: _PrimitiveObject<Instance> // object would be primitified
|
|
48
|
+
: never // cannot be
|
|
49
|
+
: _ValueOf<Instance>;
|
|
50
|
+
|
|
51
|
+
type _PrimitiveObject<Instance extends object> = Instance extends Array<infer T>
|
|
52
|
+
? _Primitive<T>[]
|
|
53
|
+
: {
|
|
54
|
+
[P in keyof Instance]: Instance[P] extends Function
|
|
55
|
+
? never
|
|
56
|
+
: _Primitive<Instance[P]>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type _ValueOf<Instance> = _IsValueOf<Instance, Boolean> extends true
|
|
60
|
+
? boolean
|
|
61
|
+
: _IsValueOf<Instance, Number> extends true
|
|
62
|
+
? number
|
|
63
|
+
: _IsValueOf<Instance, String> extends true
|
|
64
|
+
? string
|
|
65
|
+
: Instance;
|
|
66
|
+
|
|
67
|
+
type _Native =
|
|
68
|
+
| Set<any>
|
|
69
|
+
| Map<any, any>
|
|
70
|
+
| WeakSet<any>
|
|
71
|
+
| WeakMap<any, any>
|
|
72
|
+
| Uint8Array
|
|
73
|
+
| Uint8ClampedArray
|
|
74
|
+
| Uint16Array
|
|
75
|
+
| Uint32Array
|
|
76
|
+
| BigUint64Array
|
|
77
|
+
| Int8Array
|
|
78
|
+
| Int16Array
|
|
79
|
+
| Int32Array
|
|
80
|
+
| BigInt64Array
|
|
81
|
+
| Float32Array
|
|
82
|
+
| Float64Array
|
|
83
|
+
| ArrayBuffer
|
|
84
|
+
| SharedArrayBuffer
|
|
85
|
+
| DataView;
|
|
86
|
+
|
|
87
|
+
type _IsValueOf<
|
|
88
|
+
Instance,
|
|
89
|
+
Object extends IValueOf<any>,
|
|
90
|
+
> = Instance extends Object
|
|
91
|
+
? Object extends IValueOf<infer Primitive>
|
|
92
|
+
? Instance extends Primitive
|
|
93
|
+
? false
|
|
94
|
+
: true // not Primitive, but Object
|
|
95
|
+
: false // cannot be
|
|
96
|
+
: false;
|
|
97
|
+
|
|
98
|
+
interface IValueOf<T> {
|
|
99
|
+
valueOf(): T;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface IJsonable<T> {
|
|
103
|
+
toJSON(): T;
|
|
104
|
+
}
|
package/src/TypeGuardError.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export class TypeGuardError extends Error {
|
|
2
|
-
public readonly method: string;
|
|
3
|
-
public readonly path: string | undefined;
|
|
4
|
-
public readonly expected: string;
|
|
5
|
-
public readonly value: any;
|
|
6
|
-
|
|
7
|
-
public constructor(props: TypeGuardError.IProps) {
|
|
8
|
-
// MESSAGE CONSTRUCTION
|
|
9
|
-
super(
|
|
10
|
-
props.message ||
|
|
11
|
-
`Error on ${props.method}(): invalid type${
|
|
12
|
-
props.path ? ` on ${props.path}` : ""
|
|
13
|
-
}, expect to be ${props.expected}`,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
// INHERITANCE POLYFILL
|
|
17
|
-
const proto = new.target.prototype;
|
|
18
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
|
|
19
|
-
else (this as any).__proto__ = proto;
|
|
20
|
-
|
|
21
|
-
// ASSIGN MEMBERS
|
|
22
|
-
this.method = props.method;
|
|
23
|
-
this.path = props.path;
|
|
24
|
-
this.expected = props.expected;
|
|
25
|
-
this.value = props.value;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export namespace TypeGuardError {
|
|
29
|
-
export interface IProps {
|
|
30
|
-
method: string;
|
|
31
|
-
path?: string;
|
|
32
|
-
expected: string;
|
|
33
|
-
value: any;
|
|
34
|
-
message?: string;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
export class TypeGuardError extends Error {
|
|
2
|
+
public readonly method: string;
|
|
3
|
+
public readonly path: string | undefined;
|
|
4
|
+
public readonly expected: string;
|
|
5
|
+
public readonly value: any;
|
|
6
|
+
|
|
7
|
+
public constructor(props: TypeGuardError.IProps) {
|
|
8
|
+
// MESSAGE CONSTRUCTION
|
|
9
|
+
super(
|
|
10
|
+
props.message ||
|
|
11
|
+
`Error on ${props.method}(): invalid type${
|
|
12
|
+
props.path ? ` on ${props.path}` : ""
|
|
13
|
+
}, expect to be ${props.expected}`,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// INHERITANCE POLYFILL
|
|
17
|
+
const proto = new.target.prototype;
|
|
18
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
|
|
19
|
+
else (this as any).__proto__ = proto;
|
|
20
|
+
|
|
21
|
+
// ASSIGN MEMBERS
|
|
22
|
+
this.method = props.method;
|
|
23
|
+
this.path = props.path;
|
|
24
|
+
this.expected = props.expected;
|
|
25
|
+
this.value = props.value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export namespace TypeGuardError {
|
|
29
|
+
export interface IProps {
|
|
30
|
+
method: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
expected: string;
|
|
33
|
+
value: any;
|
|
34
|
+
message?: string;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import { TypiaFileFactory } from "../factories/TypiaFileFactory";
|
|
4
|
+
|
|
5
|
+
import { ArgumentParser } from "./setup/ArgumentParser";
|
|
6
|
+
import { PackageManager } from "./setup/PackageManager";
|
|
7
|
+
|
|
8
|
+
export namespace TypiaGenerateWizard {
|
|
9
|
+
export async function generate(): Promise<void> {
|
|
10
|
+
console.log("----------------------------------------");
|
|
11
|
+
console.log(" Typia Generate Wizard");
|
|
12
|
+
console.log("----------------------------------------");
|
|
13
|
+
|
|
14
|
+
// LOAD PACKAGE.JSON INFO
|
|
15
|
+
const pack: PackageManager = await PackageManager.mount();
|
|
16
|
+
const options: IArguments = await ArgumentParser.parse(pack)(false)(
|
|
17
|
+
inquiry,
|
|
18
|
+
);
|
|
19
|
+
await TypiaFileFactory.generate(options);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const inquiry: ArgumentParser.Inquiry<IArguments> = async (
|
|
23
|
+
_pack,
|
|
24
|
+
command,
|
|
25
|
+
prompt,
|
|
26
|
+
action,
|
|
27
|
+
) => {
|
|
28
|
+
// PREPARE ASSETS
|
|
29
|
+
command.option("--input [path]", "input directory");
|
|
30
|
+
command.option("--output [directory]", "output directory");
|
|
31
|
+
command.option("--project [project]", "tsconfig.json file location");
|
|
32
|
+
|
|
33
|
+
const questioned = { value: false };
|
|
34
|
+
|
|
35
|
+
const input = (name: string) => async (message: string) => {
|
|
36
|
+
const result = await prompt()({
|
|
37
|
+
type: "input",
|
|
38
|
+
name,
|
|
39
|
+
message,
|
|
40
|
+
default: "",
|
|
41
|
+
});
|
|
42
|
+
return result[name] as string;
|
|
43
|
+
};
|
|
44
|
+
const select =
|
|
45
|
+
(name: string) =>
|
|
46
|
+
(message: string) =>
|
|
47
|
+
async <Choice extends string>(
|
|
48
|
+
choices: Choice[],
|
|
49
|
+
): Promise<Choice> => {
|
|
50
|
+
questioned.value = true;
|
|
51
|
+
return (
|
|
52
|
+
await prompt()({
|
|
53
|
+
type: "list",
|
|
54
|
+
name: name,
|
|
55
|
+
message: message,
|
|
56
|
+
choices: choices,
|
|
57
|
+
})
|
|
58
|
+
)[name];
|
|
59
|
+
};
|
|
60
|
+
const configure = async () => {
|
|
61
|
+
const fileList: string[] = await (
|
|
62
|
+
await fs.promises.readdir(process.cwd())
|
|
63
|
+
).filter(
|
|
64
|
+
(str) =>
|
|
65
|
+
str.substring(0, 8) === "tsconfig" &&
|
|
66
|
+
str.substring(str.length - 5) === ".json",
|
|
67
|
+
);
|
|
68
|
+
if (fileList.length === 0)
|
|
69
|
+
throw new Error(`Unable to find "tsconfig.json" file.`);
|
|
70
|
+
else if (fileList.length === 1) return fileList[0];
|
|
71
|
+
return select("tsconfig")("TS Config File")(fileList);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return action(async (options) => {
|
|
75
|
+
options.input ??= await input("input")("input directory");
|
|
76
|
+
options.output ??= await input("output")("output directory");
|
|
77
|
+
options.project ??= await configure();
|
|
78
|
+
return options as IArguments;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export interface IArguments {
|
|
83
|
+
input: string;
|
|
84
|
+
output: string;
|
|
85
|
+
project: string;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import { ArgumentParser } from "./setup/ArgumentParser";
|
|
5
|
-
import { CommandExecutor } from "./setup/CommandExecutor";
|
|
6
|
-
import { PackageManager } from "./setup/PackageManager";
|
|
7
|
-
import { PluginConfigurator } from "./setup/PluginConfigurator";
|
|
8
|
-
|
|
9
|
-
export namespace TypiaSetupWizard {
|
|
10
|
-
export interface IArguments {
|
|
11
|
-
compiler: "ts-patch" | "ttypescript";
|
|
12
|
-
manager: "npm" | "pnpm" | "yarn";
|
|
13
|
-
project: string | null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function setup(): Promise<void> {
|
|
17
|
-
console.log("----------------------------------------");
|
|
18
|
-
console.log(" Typia Setup Wizard");
|
|
19
|
-
console.log("----------------------------------------");
|
|
20
|
-
|
|
21
|
-
// PREPARE ASSETS
|
|
22
|
-
const pack: PackageManager = await PackageManager.mount();
|
|
23
|
-
const args: IArguments = await ArgumentParser.parse(pack)(true)(
|
|
24
|
-
inquiry,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
// INSTALL TYPESCRIPT
|
|
28
|
-
pack.install({ dev: true, modulo: "typescript" });
|
|
29
|
-
args.project ??= (() => {
|
|
30
|
-
CommandExecutor.run("npx tsc --init", false);
|
|
31
|
-
return (args.project = "tsconfig.json");
|
|
32
|
-
})();
|
|
33
|
-
pack.install({ dev: true, modulo: "ts-node" });
|
|
34
|
-
|
|
35
|
-
// INSTALL COMPILER
|
|
36
|
-
pack.install({ dev: true, modulo: args.compiler });
|
|
37
|
-
if (args.compiler === "ts-patch") {
|
|
38
|
-
await pack.save((data) => {
|
|
39
|
-
data.scripts ??= {};
|
|
40
|
-
if (
|
|
41
|
-
typeof data.scripts.prepare === "string" &&
|
|
42
|
-
data.scripts.prepare.indexOf("ts-patch install") === -1
|
|
43
|
-
)
|
|
44
|
-
data.scripts.prepare =
|
|
45
|
-
"ts-patch install && " + data.scripts.prepare;
|
|
46
|
-
else data.scripts.prepare = "ts-patch install";
|
|
47
|
-
});
|
|
48
|
-
CommandExecutor.run("npm run prepare", false);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// INSTALL AND CONFIGURE TYPIA
|
|
52
|
-
pack.install({ dev: false, modulo: "typia" });
|
|
53
|
-
await PluginConfigurator.configure(pack, args);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const inquiry: ArgumentParser.Inquiry<IArguments> = async (
|
|
57
|
-
pack,
|
|
58
|
-
command,
|
|
59
|
-
prompt,
|
|
60
|
-
action,
|
|
61
|
-
) => {
|
|
62
|
-
// PREPARE ASSETS
|
|
63
|
-
command.option("--compiler [compiler]", "compiler type");
|
|
64
|
-
command.option("--manager [manager", "package manager");
|
|
65
|
-
command.option("--project [project]", "tsconfig.json file location");
|
|
66
|
-
|
|
67
|
-
// INTERNAL PROCEDURES
|
|
68
|
-
const questioned = { value: false };
|
|
69
|
-
const select =
|
|
70
|
-
(name: string) =>
|
|
71
|
-
(message: string) =>
|
|
72
|
-
async <Choice extends string>(
|
|
73
|
-
choices: Choice[],
|
|
74
|
-
): Promise<Choice> => {
|
|
75
|
-
questioned.value = true;
|
|
76
|
-
return (
|
|
77
|
-
await prompt()({
|
|
78
|
-
type: "list",
|
|
79
|
-
name: name,
|
|
80
|
-
message: message,
|
|
81
|
-
choices: choices,
|
|
82
|
-
})
|
|
83
|
-
)[name];
|
|
84
|
-
};
|
|
85
|
-
const configure = async () => {
|
|
86
|
-
const fileList: string[] = await (
|
|
87
|
-
await fs.promises.readdir(process.cwd())
|
|
88
|
-
).filter(
|
|
89
|
-
(str) =>
|
|
90
|
-
str.substring(0, 8) === "tsconfig" &&
|
|
91
|
-
str.substring(str.length - 5) === ".json",
|
|
92
|
-
);
|
|
93
|
-
if (fileList.length === 0) {
|
|
94
|
-
if (process.cwd() !== pack.directory)
|
|
95
|
-
throw new Error(`Unable to find "tsconfig.json" file.`);
|
|
96
|
-
return null;
|
|
97
|
-
} else if (fileList.length === 1) return fileList[0];
|
|
98
|
-
return select("tsconfig")("TS Config File")(fileList);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// DO CONSTRUCT
|
|
102
|
-
return action(async (options) => {
|
|
103
|
-
if (options.compiler === undefined) {
|
|
104
|
-
console.log(COMPILER_DESCRIPTION);
|
|
105
|
-
options.compiler = await select("compiler")(`Compiler`)(
|
|
106
|
-
is_nest_cli(pack)
|
|
107
|
-
? ["ts-patch" as const, "ttypescript" as const]
|
|
108
|
-
: ["ttypescript" as const, "ts-patch" as const],
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
options.manager ??= await select("manager")("Package Manager")([
|
|
112
|
-
"npm" as const,
|
|
113
|
-
"pnpm" as const,
|
|
114
|
-
"yarn" as const,
|
|
115
|
-
]);
|
|
116
|
-
pack.manager = options.manager;
|
|
117
|
-
options.project ??= await configure();
|
|
118
|
-
|
|
119
|
-
if (questioned.value) console.log("");
|
|
120
|
-
return options as IArguments;
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
function is_nest_cli(pack: PackageManager): boolean {
|
|
125
|
-
return (
|
|
126
|
-
(typeof pack.data.scripts?.build === "string" &&
|
|
127
|
-
pack.data.scripts.build.indexOf("nest build") !== -1) ||
|
|
128
|
-
fs.existsSync(path.join(pack.directory, "nest-cli.json"))
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const COMPILER_DESCRIPTION = [
|
|
134
|
-
`About compiler, if you adapt "ttypescript", you should use "ttsc" instead.`,
|
|
135
|
-
``,
|
|
136
|
-
`Otherwise, you choose "ts-patch", you can use the original "tsc" command.`,
|
|
137
|
-
`However, the "ts-patch" hacks "node_modules/typescript" source code.`,
|
|
138
|
-
`Also, whenever update "typescript", you've to run "npm run prepare" command.`,
|
|
139
|
-
``,
|
|
140
|
-
`By the way, when using "@nest/cli", you must just choose "ts-patch".`,
|
|
141
|
-
``,
|
|
142
|
-
].join("\n");
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import { ArgumentParser } from "./setup/ArgumentParser";
|
|
5
|
+
import { CommandExecutor } from "./setup/CommandExecutor";
|
|
6
|
+
import { PackageManager } from "./setup/PackageManager";
|
|
7
|
+
import { PluginConfigurator } from "./setup/PluginConfigurator";
|
|
8
|
+
|
|
9
|
+
export namespace TypiaSetupWizard {
|
|
10
|
+
export interface IArguments {
|
|
11
|
+
compiler: "ts-patch" | "ttypescript";
|
|
12
|
+
manager: "npm" | "pnpm" | "yarn";
|
|
13
|
+
project: string | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function setup(): Promise<void> {
|
|
17
|
+
console.log("----------------------------------------");
|
|
18
|
+
console.log(" Typia Setup Wizard");
|
|
19
|
+
console.log("----------------------------------------");
|
|
20
|
+
|
|
21
|
+
// PREPARE ASSETS
|
|
22
|
+
const pack: PackageManager = await PackageManager.mount();
|
|
23
|
+
const args: IArguments = await ArgumentParser.parse(pack)(true)(
|
|
24
|
+
inquiry,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// INSTALL TYPESCRIPT
|
|
28
|
+
pack.install({ dev: true, modulo: "typescript" });
|
|
29
|
+
args.project ??= (() => {
|
|
30
|
+
CommandExecutor.run("npx tsc --init", false);
|
|
31
|
+
return (args.project = "tsconfig.json");
|
|
32
|
+
})();
|
|
33
|
+
pack.install({ dev: true, modulo: "ts-node" });
|
|
34
|
+
|
|
35
|
+
// INSTALL COMPILER
|
|
36
|
+
pack.install({ dev: true, modulo: args.compiler });
|
|
37
|
+
if (args.compiler === "ts-patch") {
|
|
38
|
+
await pack.save((data) => {
|
|
39
|
+
data.scripts ??= {};
|
|
40
|
+
if (
|
|
41
|
+
typeof data.scripts.prepare === "string" &&
|
|
42
|
+
data.scripts.prepare.indexOf("ts-patch install") === -1
|
|
43
|
+
)
|
|
44
|
+
data.scripts.prepare =
|
|
45
|
+
"ts-patch install && " + data.scripts.prepare;
|
|
46
|
+
else data.scripts.prepare = "ts-patch install";
|
|
47
|
+
});
|
|
48
|
+
CommandExecutor.run("npm run prepare", false);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// INSTALL AND CONFIGURE TYPIA
|
|
52
|
+
pack.install({ dev: false, modulo: "typia" });
|
|
53
|
+
await PluginConfigurator.configure(pack, args);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const inquiry: ArgumentParser.Inquiry<IArguments> = async (
|
|
57
|
+
pack,
|
|
58
|
+
command,
|
|
59
|
+
prompt,
|
|
60
|
+
action,
|
|
61
|
+
) => {
|
|
62
|
+
// PREPARE ASSETS
|
|
63
|
+
command.option("--compiler [compiler]", "compiler type");
|
|
64
|
+
command.option("--manager [manager", "package manager");
|
|
65
|
+
command.option("--project [project]", "tsconfig.json file location");
|
|
66
|
+
|
|
67
|
+
// INTERNAL PROCEDURES
|
|
68
|
+
const questioned = { value: false };
|
|
69
|
+
const select =
|
|
70
|
+
(name: string) =>
|
|
71
|
+
(message: string) =>
|
|
72
|
+
async <Choice extends string>(
|
|
73
|
+
choices: Choice[],
|
|
74
|
+
): Promise<Choice> => {
|
|
75
|
+
questioned.value = true;
|
|
76
|
+
return (
|
|
77
|
+
await prompt()({
|
|
78
|
+
type: "list",
|
|
79
|
+
name: name,
|
|
80
|
+
message: message,
|
|
81
|
+
choices: choices,
|
|
82
|
+
})
|
|
83
|
+
)[name];
|
|
84
|
+
};
|
|
85
|
+
const configure = async () => {
|
|
86
|
+
const fileList: string[] = await (
|
|
87
|
+
await fs.promises.readdir(process.cwd())
|
|
88
|
+
).filter(
|
|
89
|
+
(str) =>
|
|
90
|
+
str.substring(0, 8) === "tsconfig" &&
|
|
91
|
+
str.substring(str.length - 5) === ".json",
|
|
92
|
+
);
|
|
93
|
+
if (fileList.length === 0) {
|
|
94
|
+
if (process.cwd() !== pack.directory)
|
|
95
|
+
throw new Error(`Unable to find "tsconfig.json" file.`);
|
|
96
|
+
return null;
|
|
97
|
+
} else if (fileList.length === 1) return fileList[0];
|
|
98
|
+
return select("tsconfig")("TS Config File")(fileList);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// DO CONSTRUCT
|
|
102
|
+
return action(async (options) => {
|
|
103
|
+
if (options.compiler === undefined) {
|
|
104
|
+
console.log(COMPILER_DESCRIPTION);
|
|
105
|
+
options.compiler = await select("compiler")(`Compiler`)(
|
|
106
|
+
is_nest_cli(pack)
|
|
107
|
+
? ["ts-patch" as const, "ttypescript" as const]
|
|
108
|
+
: ["ttypescript" as const, "ts-patch" as const],
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
options.manager ??= await select("manager")("Package Manager")([
|
|
112
|
+
"npm" as const,
|
|
113
|
+
"pnpm" as const,
|
|
114
|
+
"yarn" as const,
|
|
115
|
+
]);
|
|
116
|
+
pack.manager = options.manager;
|
|
117
|
+
options.project ??= await configure();
|
|
118
|
+
|
|
119
|
+
if (questioned.value) console.log("");
|
|
120
|
+
return options as IArguments;
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function is_nest_cli(pack: PackageManager): boolean {
|
|
125
|
+
return (
|
|
126
|
+
(typeof pack.data.scripts?.build === "string" &&
|
|
127
|
+
pack.data.scripts.build.indexOf("nest build") !== -1) ||
|
|
128
|
+
fs.existsSync(path.join(pack.directory, "nest-cli.json"))
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const COMPILER_DESCRIPTION = [
|
|
134
|
+
`About compiler, if you adapt "ttypescript", you should use "ttsc" instead.`,
|
|
135
|
+
``,
|
|
136
|
+
`Otherwise, you choose "ts-patch", you can use the original "tsc" command.`,
|
|
137
|
+
`However, the "ts-patch" hacks "node_modules/typescript" source code.`,
|
|
138
|
+
`Also, whenever update "typescript", you've to run "npm run prepare" command.`,
|
|
139
|
+
``,
|
|
140
|
+
`By the way, when using "@nest/cli", you must just choose "ts-patch".`,
|
|
141
|
+
``,
|
|
142
|
+
].join("\n");
|