typia 3.8.0-dev.20230417 → 3.8.0-dev.20230418
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 +1 -1
- package/lib/executable/setup/PackageManager.d.ts +1 -1
- package/lib/metadata/Metadata.js +1 -1
- package/lib/metadata/Metadata.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.js +1 -1
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/typings/Customizable.d.ts +2 -2
- package/lib/utils/RandomGenerator.d.ts +1 -17
- package/lib/utils/RandomGenerator.js.map +1 -1
- package/package.json +2 -2
- package/src/IRandomGenerator.ts +33 -33
- package/src/executable/TypiaGenerateWizard.ts +85 -85
- package/src/executable/setup/ArgumentParser.ts +45 -45
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +22 -22
- package/src/executable/setup/PackageManager.ts +1 -1
- package/src/executable/setup/PluginConfigurator.ts +59 -59
- package/src/factories/MetadataTagFactory.ts +302 -302
- package/src/factories/TypiaFileFactory.ts +129 -129
- package/src/metadata/ICommentTag.ts +4 -4
- package/src/metadata/Metadata.ts +1 -1
- package/src/module.ts +2043 -2043
- package/src/programmers/AssertProgrammer.ts +284 -284
- package/src/programmers/CheckerProgrammer.ts +1 -1
- package/src/programmers/LiteralsProgrammer.ts +65 -65
- package/src/programmers/RandomProgrammer.ts +413 -413
- package/src/programmers/ValidateProgrammer.ts +317 -317
- package/src/programmers/helpers/RandomJoiner.ts +161 -161
- package/src/programmers/helpers/RandomRanger.ts +216 -216
- package/src/programmers/internal/application_native.ts +32 -32
- package/src/programmers/internal/check_array.ts +30 -30
- package/src/programmers/internal/check_array_length.ts +35 -35
- package/src/programmers/internal/check_custom.ts +33 -33
- package/src/programmers/internal/check_number.ts +177 -177
- package/src/programmers/internal/check_object.ts +55 -55
- package/src/programmers/internal/check_union_array_like.ts +272 -272
- package/src/programmers/internal/feature_object_entries.ts +63 -63
- package/src/programmers/internal/get_comment_tags.ts +23 -23
- package/src/programmers/internal/metadata_to_pattern.ts +34 -34
- package/src/programmers/internal/random_custom.ts +30 -30
- package/src/programmers/internal/stringify_dynamic_properties.ts +168 -168
- package/src/programmers/internal/stringify_regular_properties.ts +84 -84
- package/src/transformers/CallExpressionTransformer.ts +174 -174
- package/src/transformers/ImportTransformer.ts +66 -66
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +119 -119
- package/src/transformers/features/miscellaneous/CreateRandomTransformer.ts +41 -41
- package/src/transformers/features/miscellaneous/LiteralsTransformer.ts +30 -30
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +54 -54
- package/src/transformers/features/miscellaneous/RandomTransformer.ts +46 -46
- package/src/typings/Customizable.ts +2 -2
- package/src/utils/RandomGenerator.ts +3 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
export namespace FileRetriever {
|
|
5
|
-
export const directory =
|
|
6
|
-
(name: string) =>
|
|
7
|
-
(dir: string, depth: number = 0): string | null => {
|
|
8
|
-
const location: string = path.join(dir, name);
|
|
9
|
-
if (fs.existsSync(location)) return dir;
|
|
10
|
-
else if (depth > 2) return null;
|
|
11
|
-
return directory(name)(path.join(dir, ".."), depth + 1);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const file =
|
|
15
|
-
(name: string) =>
|
|
16
|
-
(directory: string, depth: number = 0): string | null => {
|
|
17
|
-
const location: string = path.join(directory, name);
|
|
18
|
-
if (fs.existsSync(location)) return location;
|
|
19
|
-
else if (depth > 2) return null;
|
|
20
|
-
return file(name)(path.join(directory, ".."), depth + 1);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
export namespace FileRetriever {
|
|
5
|
+
export const directory =
|
|
6
|
+
(name: string) =>
|
|
7
|
+
(dir: string, depth: number = 0): string | null => {
|
|
8
|
+
const location: string = path.join(dir, name);
|
|
9
|
+
if (fs.existsSync(location)) return dir;
|
|
10
|
+
else if (depth > 2) return null;
|
|
11
|
+
return directory(name)(path.join(dir, ".."), depth + 1);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const file =
|
|
15
|
+
(name: string) =>
|
|
16
|
+
(directory: string, depth: number = 0): string | null => {
|
|
17
|
+
const location: string = path.join(directory, name);
|
|
18
|
+
if (fs.existsSync(location)) return location;
|
|
19
|
+
else if (depth > 2) return null;
|
|
20
|
+
return file(name)(path.join(directory, ".."), depth + 1);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import comments from "comment-json";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
|
|
4
|
-
import { TypiaSetupWizard } from "../TypiaSetupWizard";
|
|
5
|
-
|
|
6
|
-
export namespace PluginConfigurator {
|
|
7
|
-
export async function configure(
|
|
8
|
-
args: TypiaSetupWizard.IArguments,
|
|
9
|
-
): Promise<void> {
|
|
10
|
-
// GET COMPILER-OPTIONS
|
|
11
|
-
const config: comments.CommentObject = comments.parse(
|
|
12
|
-
await fs.promises.readFile(args.project!, "utf8"),
|
|
13
|
-
) as comments.CommentObject;
|
|
14
|
-
const compilerOptions = config.compilerOptions as
|
|
15
|
-
| comments.CommentObject
|
|
16
|
-
| undefined;
|
|
17
|
-
if (compilerOptions === undefined)
|
|
18
|
-
throw new Error(
|
|
19
|
-
`${args.project} file does not have "compilerOptions" property.`,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
// PREPARE PLUGINS
|
|
23
|
-
const plugins: comments.CommentArray<comments.CommentObject> = (() => {
|
|
24
|
-
const plugins = compilerOptions.plugins as
|
|
25
|
-
| comments.CommentArray<comments.CommentObject>
|
|
26
|
-
| undefined;
|
|
27
|
-
if (plugins === undefined)
|
|
28
|
-
return (compilerOptions.plugins = [] as any);
|
|
29
|
-
else if (!Array.isArray(plugins))
|
|
30
|
-
throw new Error(
|
|
31
|
-
`"plugins" property of ${args.project} must be array type.`,
|
|
32
|
-
);
|
|
33
|
-
return plugins;
|
|
34
|
-
})();
|
|
35
|
-
|
|
36
|
-
const strict: boolean = compilerOptions.strict === true;
|
|
37
|
-
const oldbie: comments.CommentObject | undefined = plugins.find(
|
|
38
|
-
(p) =>
|
|
39
|
-
typeof p === "object" &&
|
|
40
|
-
p !== null &&
|
|
41
|
-
p.transform === "typia/lib/transform",
|
|
42
|
-
);
|
|
43
|
-
if (strict === true && oldbie !== undefined) return;
|
|
44
|
-
|
|
45
|
-
// DO CONFIGURE
|
|
46
|
-
compilerOptions.strict = true;
|
|
47
|
-
if (oldbie === undefined)
|
|
48
|
-
plugins.push(
|
|
49
|
-
comments.parse(`
|
|
50
|
-
{
|
|
51
|
-
"transform": "typia/lib/transform"
|
|
52
|
-
}`) as comments.CommentObject,
|
|
53
|
-
);
|
|
54
|
-
await fs.promises.writeFile(
|
|
55
|
-
args.project!,
|
|
56
|
-
comments.stringify(config, null, 2),
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
import comments from "comment-json";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
|
|
4
|
+
import { TypiaSetupWizard } from "../TypiaSetupWizard";
|
|
5
|
+
|
|
6
|
+
export namespace PluginConfigurator {
|
|
7
|
+
export async function configure(
|
|
8
|
+
args: TypiaSetupWizard.IArguments,
|
|
9
|
+
): Promise<void> {
|
|
10
|
+
// GET COMPILER-OPTIONS
|
|
11
|
+
const config: comments.CommentObject = comments.parse(
|
|
12
|
+
await fs.promises.readFile(args.project!, "utf8"),
|
|
13
|
+
) as comments.CommentObject;
|
|
14
|
+
const compilerOptions = config.compilerOptions as
|
|
15
|
+
| comments.CommentObject
|
|
16
|
+
| undefined;
|
|
17
|
+
if (compilerOptions === undefined)
|
|
18
|
+
throw new Error(
|
|
19
|
+
`${args.project} file does not have "compilerOptions" property.`,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// PREPARE PLUGINS
|
|
23
|
+
const plugins: comments.CommentArray<comments.CommentObject> = (() => {
|
|
24
|
+
const plugins = compilerOptions.plugins as
|
|
25
|
+
| comments.CommentArray<comments.CommentObject>
|
|
26
|
+
| undefined;
|
|
27
|
+
if (plugins === undefined)
|
|
28
|
+
return (compilerOptions.plugins = [] as any);
|
|
29
|
+
else if (!Array.isArray(plugins))
|
|
30
|
+
throw new Error(
|
|
31
|
+
`"plugins" property of ${args.project} must be array type.`,
|
|
32
|
+
);
|
|
33
|
+
return plugins;
|
|
34
|
+
})();
|
|
35
|
+
|
|
36
|
+
const strict: boolean = compilerOptions.strict === true;
|
|
37
|
+
const oldbie: comments.CommentObject | undefined = plugins.find(
|
|
38
|
+
(p) =>
|
|
39
|
+
typeof p === "object" &&
|
|
40
|
+
p !== null &&
|
|
41
|
+
p.transform === "typia/lib/transform",
|
|
42
|
+
);
|
|
43
|
+
if (strict === true && oldbie !== undefined) return;
|
|
44
|
+
|
|
45
|
+
// DO CONFIGURE
|
|
46
|
+
compilerOptions.strict = true;
|
|
47
|
+
if (oldbie === undefined)
|
|
48
|
+
plugins.push(
|
|
49
|
+
comments.parse(`
|
|
50
|
+
{
|
|
51
|
+
"transform": "typia/lib/transform"
|
|
52
|
+
}`) as comments.CommentObject,
|
|
53
|
+
);
|
|
54
|
+
await fs.promises.writeFile(
|
|
55
|
+
args.project!,
|
|
56
|
+
comments.stringify(config, null, 2),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|