typia 13.2.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/http.d.ts +3 -3
- package/lib/http.js.map +1 -1
- package/lib/http.mjs.map +1 -1
- package/lib/internal/_assertGuard.js +13 -3
- package/lib/internal/_assertGuard.js.map +1 -1
- package/lib/internal/_assertGuard.mjs +4 -2
- package/lib/internal/_assertGuard.mjs.map +1 -1
- package/lib/internal/_isFormatIdnHostname.js +5 -1
- package/lib/internal/_isFormatIdnHostname.js.map +1 -1
- package/lib/internal/_isFormatIdnHostname.mjs +1 -1
- package/lib/internal/_isFormatIdnHostname.mjs.map +1 -1
- package/lib/internal/_isFormatTime.js +19 -2
- package/lib/internal/_isFormatTime.js.map +1 -1
- package/lib/internal/_isFormatTime.mjs +9 -2
- package/lib/internal/_isFormatTime.mjs.map +1 -1
- package/lib/internal/_randomArray.js +37 -4
- package/lib/internal/_randomArray.js.map +1 -1
- package/lib/internal/_randomArray.mjs +16 -3
- package/lib/internal/_randomArray.mjs.map +1 -1
- package/lib/internal/_randomFormatByte.js +15 -12
- package/lib/internal/_randomFormatByte.js.map +1 -1
- package/lib/internal/_randomFormatByte.mjs +11 -10
- package/lib/internal/_randomFormatByte.mjs.map +1 -1
- package/lib/internal/_randomFormatDatetime.mjs +1 -1
- package/lib/internal/_randomFormatHostname.d.ts +2 -2
- package/lib/internal/_randomFormatHostname.js +2 -2
- package/lib/internal/_randomFormatHostname.mjs +2 -2
- package/lib/internal/_randomFormatHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.js +9 -10
- package/lib/internal/_randomFormatIdnHostname.js.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.mjs +3 -4
- package/lib/internal/_randomFormatIdnHostname.mjs.map +1 -1
- package/lib/internal/_randomFormatRegex.js +4 -4
- package/lib/internal/_randomFormatRegex.js.map +1 -1
- package/lib/internal/_randomFormatRegex.mjs +1 -2
- package/lib/internal/_randomFormatRegex.mjs.map +1 -1
- package/lib/internal/_randomFormatTime.js +15 -10
- package/lib/internal/_randomFormatTime.js.map +1 -1
- package/lib/internal/_randomFormatTime.mjs +6 -3
- package/lib/internal/_randomFormatTime.mjs.map +1 -1
- package/lib/internal/_randomPattern.js +20 -3
- package/lib/internal/_randomPattern.js.map +1 -1
- package/lib/internal/_randomPattern.mjs +5 -1
- package/lib/internal/_randomPattern.mjs.map +1 -1
- package/lib/internal/_randomStringLength.js +9 -2
- package/lib/internal/_randomStringLength.js.map +1 -1
- package/lib/internal/_randomStringLength.mjs +3 -1
- package/lib/internal/_randomStringLength.mjs.map +1 -1
- package/lib/internal/private/__randomComposition.d.ts +8 -0
- package/lib/internal/private/__randomComposition.js +21 -1
- package/lib/internal/private/__randomComposition.js.map +1 -1
- package/lib/internal/private/__randomComposition.mjs +18 -1
- package/lib/internal/private/__randomComposition.mjs.map +1 -1
- package/lib/json.d.ts +2 -2
- package/lib/json.js.map +1 -1
- package/lib/json.mjs.map +1 -1
- package/lib/module.d.ts +28 -13
- package/lib/module.js.map +1 -1
- package/lib/module.mjs.map +1 -1
- package/lib/notations.d.ts +4 -4
- package/lib/notations.js.map +1 -1
- package/lib/notations.mjs.map +1 -1
- package/lib/plain.d.ts +3 -3
- package/lib/plain.js.map +1 -1
- package/lib/plain.mjs.map +1 -1
- package/lib/protobuf.d.ts +2 -2
- package/lib/protobuf.js.map +1 -1
- package/lib/protobuf.mjs.map +1 -1
- package/lib/transform.mjs +1 -1
- package/native/cmd/ttsc-typia/assert_guard_factory_contract_test.go +17 -4
- package/native/cmd/ttsc-typia/create_assert_error_factory_arity_test.go +309 -0
- package/native/cmd/ttsc-typia/dynamic_key_tags_transform_test.go +206 -0
- package/native/cmd/ttsc-typia/local_function_named_like_typia_operation_transform_test.go +185 -0
- package/native/cmd/ttsc-typia/notation_kebab_case_transform_test.go +2 -2
- package/native/cmd/ttsc-typia/project_catalog_transform_coverage_test.go +84 -85
- package/native/cmd/ttsc-typia/recursive_conditional_alias_name_transform_test.go +307 -0
- package/native/cmd/ttsc-typia/shadowed_typia_module_declaration_diagnostic_test.go +152 -0
- package/native/cmd/ttsc-typia/transform.go +2 -2
- package/native/cmd/ttsc-typia/transform_helpers_test.go +96 -18
- package/native/core/factories/FormatCheatSheet.go +2 -2
- package/native/core/factories/MetadataCommentTagFactory.go +91 -7
- package/native/core/factories/factory_utility_coverage_test.go +896 -907
- package/native/core/factories/internal/metadata/MetadataHelper.go +5 -28
- package/native/core/factories/metadata_comment_tag_factory_rejects_out_of_range_integer_test.go +124 -0
- package/native/core/programmers/AssertProgrammer.go +20 -6
- package/native/core/programmers/RandomProgrammer.go +78 -3
- package/native/core/programmers/ValidateProgrammer.go +21 -6
- package/native/core/programmers/helpers/RandomJoiner.go +8 -1
- package/native/core/programmers/iterate/check_dynamic_properties.go +177 -3
- package/native/core/programmers/iterate/check_object.go +12 -1
- package/native/core/schemas/metadata/MetadataCollection.go +47 -5
- package/native/transform/CallExpressionTransformer.go +167 -0
- package/package.json +3 -12
- package/src/http.ts +18 -4
- package/src/internal/_assertGuard.ts +13 -2
- package/src/internal/_isFormatIdnHostname.ts +5 -1
- package/src/internal/_isFormatTime.ts +19 -2
- package/src/internal/_randomArray.ts +42 -6
- package/src/internal/_randomFormatByte.ts +17 -12
- package/src/internal/_randomFormatHostname.ts +2 -2
- package/src/internal/_randomFormatIdnHostname.ts +8 -9
- package/src/internal/_randomFormatRegex.ts +4 -6
- package/src/internal/_randomFormatTime.ts +15 -10
- package/src/internal/_randomPattern.ts +18 -3
- package/src/internal/_randomStringLength.ts +9 -2
- package/src/internal/private/__randomComposition.ts +24 -0
- package/src/json.ts +16 -4
- package/src/module.ts +56 -22
- package/src/notations.ts +16 -4
- package/src/plain.ts +12 -3
- package/src/protobuf.ts +16 -4
- package/lib/executable/FileSystemIdentity.d.ts +0 -44
- package/lib/executable/FileSystemIdentity.js +0 -213
- package/lib/executable/FileSystemIdentity.js.map +0 -1
- package/lib/executable/FileSystemIdentity.mjs +0 -133
- package/lib/executable/FileSystemIdentity.mjs.map +0 -1
- package/lib/executable/TypiaGenerateWizard.d.ts +0 -9
- package/lib/executable/TypiaGenerateWizard.js +0 -852
- package/lib/executable/TypiaGenerateWizard.js.map +0 -1
- package/lib/executable/TypiaGenerateWizard.mjs +0 -618
- package/lib/executable/TypiaGenerateWizard.mjs.map +0 -1
- package/lib/executable/generate/ttsc.d.ts +0 -1
- package/lib/executable/generate/ttsc.js +0 -53
- package/lib/executable/generate/ttsc.js.map +0 -1
- package/lib/executable/generate/ttsc.mjs +0 -37
- package/lib/executable/generate/ttsc.mjs.map +0 -1
- package/lib/executable/typia.d.ts +0 -2
- package/lib/executable/typia.js +0 -84
- package/lib/executable/typia.js.map +0 -1
- package/lib/executable/typia.mjs +0 -60
- package/lib/executable/typia.mjs.map +0 -1
- package/src/executable/FileSystemIdentity.ts +0 -222
- package/src/executable/TypiaGenerateWizard.ts +0 -1133
- package/src/executable/generate/ttsc.ts +0 -70
- package/src/executable/typia.ts +0 -80
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypiaGenerateWizard.mjs","names":[],"sources":["../../src/executable/TypiaGenerateWizard.ts"],"sourcesContent":["import { createCommand } from \"commander\";\nimport fs from \"fs\";\nimport inquirer from \"inquirer\";\nimport { createRequire } from \"module\";\nimport os from \"os\";\nimport path from \"path\";\nimport { glob, isDynamicPattern } from \"tinyglobby\";\nimport type {\n ITtscCompilerDiagnostic,\n ITtscCompilerTransformation,\n} from \"ttsc\";\n\nimport { FileSystemIdentity } from \"./FileSystemIdentity\";\n\nexport namespace TypiaGenerateWizard {\n export async function generate(): Promise<void> {\n console.log(\"----------------------------------------\");\n console.log(\" Typia Generate Wizard\");\n console.log(\"----------------------------------------\");\n\n const options: IArguments = await parseArguments();\n await build(options);\n }\n\n async function parseArguments(): Promise<IArguments> {\n const command = createCommand(\"typia generate\");\n command.usage(\"[options] [files...]\");\n command.argument(\"[files...]\", \"input TypeScript source files or globs\");\n command.option(\"--input <path>\", \"input directory\");\n command.option(\"--output <directory>\", \"output directory\");\n command.option(\n \"--project <project>\",\n \"tsconfig.json/jsconfig.json file or directory\",\n );\n\n const questioned = { value: false };\n const prompt = inquirer.createPromptModule;\n\n const input = (name: string) => async (message: string) => {\n questioned.value = true;\n const result = await prompt()({\n type: \"input\",\n name,\n message,\n default: \"\",\n });\n return result[name] as string;\n };\n const configure = async (): Promise<string> => {\n const file: string | null = findProjectConfigFile(process.cwd());\n if (file === null) {\n throw new URIError(\n `Unable to find \"tsconfig.json\" or \"jsconfig.json\" file.`,\n );\n }\n return file;\n };\n\n return new Promise<IArguments>((resolve, reject) => {\n command.action(async (files: string[], options: Partial<IArguments>) => {\n try {\n if (files.length !== 0 && options.input !== undefined) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): file arguments cannot be combined with --input.\",\n );\n }\n if (files.length === 0) {\n options.input ??= await input(\"input\")(\"input directory\");\n }\n if (files.length !== 0 && options.output === undefined) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): output directory is required when file arguments are used.\",\n );\n }\n const output: string =\n options.output ?? (await input(\"output\")(\"output directory\"));\n const project: string = options.project ?? (await configure());\n if (questioned.value) console.log(\"\");\n resolve({\n input: options.input,\n output,\n project,\n files,\n });\n } catch (exp) {\n reject(exp);\n }\n });\n command.parseAsync(process.argv.slice(3), { from: \"user\" }).catch(reject);\n });\n }\n\n export interface IArguments {\n input?: string;\n output: string;\n project: string;\n files: string[];\n }\n\n async function build(location: IArguments): Promise<void> {\n location.output = path.resolve(location.output);\n location.project = resolveProjectConfigFile(location.project);\n\n const policy = new FileSystemIdentity.Policy();\n const outputProbe: string = await nearestExistingAncestor(location.output);\n await ensureExistingDirectoryPath({\n label: \"output parent path\",\n directory: outputProbe,\n });\n policy.observe(\n await FileSystemIdentity.probeDirectory(outputProbe),\n outputProbe,\n );\n policy.observe(\n await FileSystemIdentity.inspectDirectory(path.dirname(location.project)),\n path.dirname(location.project),\n );\n\n const entries: IInputFile[] =\n location.files.length === 0\n ? await prepareDirectoryInput(location, policy)\n : await prepareFileInputs(location, policy);\n const identity: FileSystemIdentity.IIdentity = policy.get();\n await inspectTargetDirectories({\n identity,\n output: location.output,\n targets: entries.map((entry) => entry.target),\n });\n\n const binary = resolveTsgoBinary();\n const cwd = path.dirname(location.project);\n const temporaryProject: ITemporaryProject = await createTemporaryProject({\n entries,\n project: location.project,\n });\n let transformed: Record<string, string>;\n try {\n transformed = transformProject({\n binary,\n cwd,\n projectRoot: cwd,\n tsconfig: temporaryProject.config,\n });\n } finally {\n await fs.promises.rm(temporaryProject.directory, {\n force: true,\n recursive: true,\n });\n }\n const outputByKey: Map<string, string> = indexTransformedOutputs(\n transformed,\n identity,\n );\n const outputs: IOutputFile[] = entries.map((entry) => {\n const output = getTransformedOutput({\n cwd,\n entry,\n identity,\n outputByKey,\n });\n if (output === undefined) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): no transformed output for ${entry.file}. Check that --project includes the file.`,\n );\n }\n return { entry, output };\n });\n\n await ensureOutputDirectory(location.output);\n await ensureTargetDirectories({\n identity,\n output: location.output,\n targets: outputs.map(({ entry }) => entry.target),\n });\n await ensurePhysicalTargets({\n identity,\n output: location.output,\n entries: outputs.map(({ entry }) => entry),\n });\n await ensureTargetFiles(\n outputs.map(({ entry }) => entry),\n identity,\n );\n for (const { entry, output } of outputs) {\n await fs.promises.writeFile(entry.target, formatOutput(output), \"utf8\");\n }\n }\n\n interface IInputFile {\n file: string;\n target: string;\n }\n\n interface IOutputFile {\n entry: IInputFile;\n output: string;\n }\n\n interface ITraversalEntry {\n file: string;\n name: string;\n stat: fs.Stats;\n }\n\n interface ITemporaryProject {\n config: string;\n directory: string;\n }\n\n async function createTemporaryProject(props: {\n entries: IInputFile[];\n project: string;\n }): Promise<ITemporaryProject> {\n const directory: string = await fs.promises.mkdtemp(\n path.join(os.tmpdir(), \"typia-generate-project-\"),\n );\n const config: string = path.join(directory, \"tsconfig.json\");\n try {\n await fs.promises.writeFile(\n config,\n JSON.stringify({\n extends: props.project,\n exclude: [],\n files: props.entries.map((entry) => compilerInputPath(entry.file)),\n include: [],\n }),\n \"utf8\",\n );\n return { config, directory };\n } catch (error) {\n await fs.promises.rm(directory, { force: true, recursive: true });\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to prepare the bounded input project: ${formatUnknownError(error)}`,\n );\n }\n }\n\n async function ensureOutputDirectory(output: string): Promise<void> {\n if (fs.existsSync(output) === false) {\n await ensureCreatableDirectory(output);\n await fs.promises.mkdir(output, { recursive: true });\n } else {\n await ensureExistingDirectory({\n label: \"output path\",\n directory: output,\n });\n }\n }\n\n async function ensureTargetDirectories(props: {\n identity: FileSystemIdentity.IIdentity;\n output: string;\n targets: string[];\n }): Promise<void> {\n await inspectTargetDirectories(props);\n const directories: Map<string, string> = targetDirectories(props);\n for (const directory of directories.values()) {\n try {\n await fs.promises.mkdir(directory, { recursive: true });\n } catch (exp) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to create output parent directory ${directory}: ${formatUnknownError(exp)}`,\n );\n }\n await ensureExistingDirectory({\n label: \"output parent path\",\n directory,\n });\n }\n }\n\n async function inspectTargetDirectories(props: {\n identity: FileSystemIdentity.IIdentity;\n output: string;\n targets: string[];\n }): Promise<void> {\n const directories: Map<string, string> = targetDirectories(props);\n for (const directory of directories.values()) {\n await ensureOutputAncestorDirectories({\n identity: props.identity,\n output: props.output,\n directory,\n });\n if (fs.existsSync(directory)) {\n await ensureExistingDirectory({\n label: \"output parent path\",\n directory,\n });\n }\n }\n }\n\n function targetDirectories(props: {\n identity: FileSystemIdentity.IIdentity;\n targets: string[];\n }): Map<string, string> {\n const directories: Map<string, string> = new Map();\n for (const target of props.targets) {\n const directory: string = path.dirname(target);\n directories.set(props.identity.filesystemKey(directory), directory);\n }\n return directories;\n }\n\n async function ensureCreatableDirectory(directory: string): Promise<void> {\n const parent: string = await nearestExistingAncestor(directory);\n await ensureExistingDirectoryPath({\n label: \"output parent path\",\n directory: parent,\n });\n }\n\n async function nearestExistingAncestor(directory: string): Promise<string> {\n let current: string = path.resolve(directory);\n while (fs.existsSync(current) === false) {\n const parent: string = path.dirname(current);\n if (parent === current) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to find existing output parent path: ${directory}`,\n );\n }\n current = parent;\n }\n return current;\n }\n\n async function ensureOutputAncestorDirectories(props: {\n identity: FileSystemIdentity.IIdentity;\n output: string;\n directory: string;\n }): Promise<void> {\n const output: string = path.resolve(props.output);\n const directory: string = path.resolve(props.directory);\n if (props.identity.contains(directory, output) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output parent path escapes output directory: ${props.directory}`,\n );\n }\n\n const relative: string = path.relative(output, directory);\n if (relative === \"\") {\n return;\n }\n\n let current: string = output;\n for (const segment of relative.split(path.sep)) {\n current = path.join(current, segment);\n let stat: fs.Stats;\n try {\n stat = await fs.promises.lstat(current);\n } catch (exp) {\n if (isMissingFileError(exp)) {\n return;\n }\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to inspect output parent path ${current}: ${formatUnknownError(exp)}`,\n );\n }\n if (stat.isSymbolicLink()) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output parent path contains a symbolic link: ${current}`,\n );\n }\n if (stat.isDirectory() === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output parent path is not a directory: ${current}`,\n );\n }\n }\n }\n\n async function ensureExistingDirectory(props: {\n label: string;\n directory: string;\n }): Promise<void> {\n await ensureExistingDirectoryPath(props);\n }\n\n async function ensureExistingDirectoryPath(props: {\n label: string;\n directory: string;\n }): Promise<void> {\n const directory: string = path.resolve(props.directory);\n const parsed: path.ParsedPath = path.parse(directory);\n const relative: string = path.relative(parsed.root, directory);\n let current: string = parsed.root;\n for (const segment of relative === \"\" ? [] : relative.split(path.sep)) {\n current = path.join(current, segment);\n await ensureExistingDirectorySegment({\n label:\n path.normalize(current) === path.normalize(directory)\n ? props.label\n : `${props.label} ancestor`,\n directory: current,\n });\n }\n }\n\n async function ensureExistingDirectorySegment(props: {\n label: string;\n directory: string;\n }): Promise<void> {\n const stat: fs.Stats = await fs.promises.lstat(props.directory);\n if (stat.isSymbolicLink()) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): ${props.label} is a symbolic link: ${props.directory}`,\n );\n }\n if (stat.isDirectory() === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): ${props.label} is not a directory: ${props.directory}`,\n );\n }\n }\n\n async function ensurePhysicalTargets(props: {\n identity: FileSystemIdentity.IIdentity;\n output: string;\n entries: IInputFile[];\n }): Promise<void> {\n const output: string = await fs.promises.realpath(props.output);\n const inputs: Set<string> = new Set();\n for (const entry of props.entries) {\n inputs.add(\n props.identity.filesystemKey(await fs.promises.realpath(entry.file)),\n );\n }\n\n for (const entry of props.entries) {\n const parent: string = path.dirname(entry.target);\n const directory: string = await fs.promises.realpath(parent);\n if (props.identity.contains(directory, output) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output parent path escapes output directory through a symbolic link: ${parent}`,\n );\n }\n\n const target: string = path.join(directory, path.basename(entry.target));\n if (inputs.has(props.identity.filesystemKey(target))) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output file would overwrite input file through a symbolic link: ${entry.target}`,\n );\n }\n }\n }\n\n async function ensureTargetFiles(\n entries: IInputFile[],\n identity: FileSystemIdentity.IIdentity,\n ): Promise<void> {\n const inputs: Set<string> = new Set();\n const files: Map<string, IInputFile> = new Map();\n for (const entry of entries) {\n inputs.add(\n fileIdentityKey(\n await fs.promises.stat(entry.file, { bigint: true }),\n await fs.promises.realpath(entry.file),\n ),\n );\n files.set(identity.filesystemKey(entry.target), entry);\n }\n\n for (const entry of files.values()) {\n let stat: fs.BigIntStats;\n try {\n stat = await fs.promises.lstat(entry.target, { bigint: true });\n } catch (exp) {\n if (isMissingFileError(exp)) {\n continue;\n }\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to inspect output file ${entry.target}: ${formatUnknownError(exp)}`,\n );\n }\n if (stat.isFile() === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output file path is not a regular file: ${entry.target}`,\n );\n }\n if (\n inputs.has(\n fileIdentityKey(stat, await fs.promises.realpath(entry.target)),\n )\n ) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output file would overwrite input file through a physical file alias: ${entry.target}`,\n );\n }\n if (stat.nlink > BigInt(1)) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output file has multiple hard links: ${entry.target}`,\n );\n }\n }\n }\n\n async function prepareDirectoryInput(\n location: IArguments,\n policy: FileSystemIdentity.Policy,\n ): Promise<IInputFile[]> {\n if (location.input === undefined) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): input path is required.\",\n );\n }\n const input = path.resolve(location.input);\n if (fs.existsSync(input) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input path does not exist: ${input}`,\n );\n }\n if ((await isDirectory(input)) === false) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): input path is not a directory.\",\n );\n }\n\n const inputReal: string = await fs.promises.realpath(input);\n const outputReal: string | undefined = await optionalRealPath(\n location.output,\n );\n const files: string[] = [];\n await gather({\n container: files,\n from: input,\n inputReal,\n outputReal,\n policy,\n visitedDirectories: new Set(),\n visitedFiles: new Set(),\n });\n return files.map((file) => ({\n file,\n target: path.join(location.output, path.relative(input, file)),\n }));\n }\n\n async function prepareFileInputs(\n location: IArguments,\n policy: FileSystemIdentity.Policy,\n ): Promise<IInputFile[]> {\n const targets: Set<string> = new Set();\n const output: IInputFile[] = [];\n for (const input of await expandFileInputs(\n location.files,\n location.output,\n policy,\n )) {\n const file: string = path.resolve(input);\n policy.observe(\n await FileSystemIdentity.inspectDirectory(path.dirname(file)),\n path.dirname(file),\n );\n const identity: FileSystemIdentity.IIdentity = policy.get();\n if (fs.existsSync(file) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input file does not exist: ${input}`,\n );\n } else if ((await isFile(file)) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input path is not a file: ${input}`,\n );\n } else if (identity.isDeclarationFile(file)) {\n continue;\n } else if (identity.isSupportedExtension(file) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input file is not a supported TypeScript source: ${input}`,\n );\n }\n\n const target: string = path.join(location.output, path.basename(file));\n if (identity.isSamePath(file, target)) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): output file would overwrite input file: ${input}`,\n );\n }\n const key: string = identity.filesystemKey(target);\n if (targets.has(key)) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): duplicate output filename for ${target}`,\n );\n }\n targets.add(key);\n output.push({ file, target });\n }\n if (output.length === 0) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): input files do not include any supported TypeScript source files outside the output directory.\",\n );\n }\n return output;\n }\n\n async function expandFileInputs(\n inputs: string[],\n directory: string,\n policy: FileSystemIdentity.Policy,\n ): Promise<string[]> {\n const output: string[] = [];\n for (const input of inputs) {\n const pattern: string = toGlobPattern(input);\n if (isDynamicPattern(pattern, { caseSensitiveMatch: true })) {\n const searchDirectory: string = await globSearchDirectory(input);\n const caseSensitive: boolean | undefined =\n await FileSystemIdentity.inspectDirectory(searchDirectory);\n if (caseSensitive === undefined) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to determine filesystem case behavior for input pattern base ${searchDirectory}.`,\n );\n }\n policy.observe(caseSensitive, searchDirectory);\n const identity: FileSystemIdentity.IIdentity = policy.get();\n const matches: string[] = await glob(pattern, {\n absolute: true,\n caseSensitiveMatch: identity.caseSensitive,\n cwd: process.cwd(),\n onlyFiles: true,\n });\n if (matches.length === 0) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input pattern does not match any files: ${input}`,\n );\n }\n output.push(\n ...excludeOutputFiles(matches, directory, identity).filter((file) =>\n identity.isSupportedExtension(file),\n ),\n );\n } else {\n const file: string = path.resolve(input);\n policy.observe(\n await FileSystemIdentity.inspectDirectory(path.dirname(file)),\n path.dirname(file),\n );\n if (policy.get().contains(file, directory) === false) {\n output.push(file);\n }\n }\n }\n return output;\n }\n\n function excludeOutputFiles(\n files: string[],\n directory: string,\n identity: FileSystemIdentity.IIdentity,\n ): string[] {\n return files.filter((file) => identity.contains(file, directory) === false);\n }\n\n async function globSearchDirectory(input: string): Promise<string> {\n let current: string = path.resolve(input);\n while (\n isDynamicPattern(toGlobPattern(current), { caseSensitiveMatch: true })\n ) {\n const parent: string = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n if (fs.existsSync(current) && (await isDirectory(current))) return current;\n return nearestExistingAncestor(path.dirname(current));\n }\n\n function toGlobPattern(input: string): string {\n return input.replace(/\\\\/g, \"/\");\n }\n\n function transformProject(props: {\n binary: string;\n cwd: string;\n projectRoot: string;\n tsconfig: string;\n }): Record<string, string> {\n const TtscCompiler = loadTtscCompiler();\n const result: ITtscCompilerTransformation = new TtscCompiler({\n binary: props.binary,\n cwd: props.cwd,\n projectRoot: props.projectRoot,\n tsconfig: props.tsconfig,\n }).transform();\n if (result.type === \"success\") {\n return result.typescript;\n }\n if (result.type === \"failure\") {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): ${formatDiagnostics(result.diagnostics)}`,\n );\n }\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): ${formatUnknownError(result.error)}`,\n );\n }\n\n function resolveProjectConfigFile(project: string): string {\n const resolved: string = path.resolve(project);\n if (fs.existsSync(resolved) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): project path does not exist: ${resolved}`,\n );\n }\n\n const stat: fs.Stats = fs.statSync(resolved);\n if (stat.isDirectory()) {\n for (const filename of [\"tsconfig.json\", \"jsconfig.json\"]) {\n const candidate: string = path.join(resolved, filename);\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return resolveRealPath(candidate);\n }\n }\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): project directory has no tsconfig.json or jsconfig.json: ${resolved}`,\n );\n }\n if (stat.isFile() === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): project path is not a file: ${resolved}`,\n );\n }\n return resolveRealPath(resolved);\n }\n\n function findProjectConfigFile(directory: string): string | null {\n let current: string = path.resolve(directory);\n while (true) {\n for (const filename of [\"tsconfig.json\", \"jsconfig.json\"]) {\n const candidate: string = path.join(current, filename);\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return resolveRealPath(candidate);\n }\n }\n const parent: string = path.dirname(current);\n if (parent === current) {\n return null;\n }\n current = parent;\n }\n }\n\n function loadTtscCompiler(): typeof import(\"ttsc\").TtscCompiler {\n const packageRoot: string = resolveTypiaPackageRoot();\n const resolved: string | null = resolveFromRoots(\n \"ttsc\",\n resolveRuntimeRoots(packageRoot),\n );\n if (resolved === null) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to resolve ttsc from the current project, typia package, or workspace root. Run \"npm i -D ttsc typescript\" before.`,\n );\n }\n const imported = createRequire(resolved)(resolved) as typeof import(\"ttsc\");\n return imported.TtscCompiler;\n }\n\n function resolveTsgoBinary(): string {\n const explicit: string | undefined = process.env.TTSC_TSGO_BINARY;\n if (explicit !== undefined && explicit.length !== 0) {\n if (path.isAbsolute(explicit) && fs.existsSync(explicit)) {\n return explicit;\n }\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): TTSC_TSGO_BINARY must be an existing absolute path: ${explicit}`,\n );\n }\n\n const packageRoot: string = resolveTypiaPackageRoot();\n const manifest: string | null = resolveFromRoots(\n \"typescript/package.json\",\n resolveRuntimeRoots(packageRoot),\n );\n if (manifest === null) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): unable to resolve typescript from the current project, typia package, or workspace root.\",\n );\n }\n\n const platform: string = `@typescript/typescript-${process.platform}-${process.arch}`;\n const platformManifest: string = createRequire(manifest).resolve(\n `${platform}/package.json`,\n );\n const binary: string = path.join(\n path.dirname(platformManifest),\n \"lib\",\n process.platform === \"win32\" ? \"tsc.exe\" : \"tsc\",\n );\n if (fs.existsSync(binary) === false) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): TypeScript-Go executable not found: ${binary}`,\n );\n }\n return binary;\n }\n\n function resolveTypiaPackageRoot(): string {\n // The CLI entrypoint (`lib/executable/typia.js`) lives in the same\n // directory as this module, so its `process.argv[1]` path anchors the\n // walk-up identically in both the CJS and ESM builds — `__dirname` does\n // not exist in the transcoded `.mjs`.\n const current: string = path.dirname(path.resolve(process.argv[1] ?? \"\"));\n for (const directory of [\n path.resolve(current, \"..\", \"..\"),\n path.resolve(current, \"..\"),\n ]) {\n const file: string = path.join(directory, \"package.json\");\n if (fs.existsSync(file) === false) {\n continue;\n }\n try {\n const pack = JSON.parse(fs.readFileSync(file, \"utf8\")) as Partial<\n Record<\"name\", unknown>\n >;\n if (pack.name === \"typia\") {\n return directory;\n }\n } catch {\n continue;\n }\n }\n\n const resolved: string | null = resolveFromRoots(\"typia/package.json\", [\n process.cwd(),\n current,\n ]);\n if (resolved === null) {\n throw new URIError(\n \"Error on TypiaGenerateWizard.generate(): unable to resolve typia package root.\",\n );\n }\n return path.dirname(resolved);\n }\n\n function resolveRuntimeRoots(packageRoot: string): string[] {\n return [process.cwd(), packageRoot, path.resolve(packageRoot, \"..\", \"..\")];\n }\n\n function resolveFromRoots(request: string, roots: string[]): string | null {\n for (const root of roots) {\n try {\n return createRequire(path.join(root, \"package.json\")).resolve(request);\n } catch {\n continue;\n }\n }\n return null;\n }\n\n async function isDirectory(current: string): Promise<boolean> {\n const stat: fs.Stats = await fs.promises.stat(current);\n return stat.isDirectory();\n }\n\n async function isFile(current: string): Promise<boolean> {\n const stat: fs.Stats = await fs.promises.stat(current);\n return stat.isFile();\n }\n\n async function gather(props: {\n container: string[];\n from: string;\n inputReal: string;\n outputReal: string | undefined;\n policy: FileSystemIdentity.Policy;\n visitedDirectories: Set<string>;\n visitedFiles: Set<string>;\n }): Promise<void> {\n const currentReal: string = await resolveTraversalPath(props.from);\n if (\n props.outputReal !== undefined &&\n isPhysicalSameOrChildPath(currentReal, props.outputReal)\n )\n return;\n ensurePhysicalInputContainment({\n file: props.from,\n input: props.inputReal,\n real: currentReal,\n });\n\n const currentStat: fs.BigIntStats = await fs.promises.stat(props.from, {\n bigint: true,\n });\n const directoryIdentity: string = fileIdentityKey(currentStat, currentReal);\n if (props.visitedDirectories.has(directoryIdentity)) {\n const lexicalStat: fs.Stats = await fs.promises.lstat(props.from);\n if (lexicalStat.isSymbolicLink()) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input directory link revisits a physical directory: ${props.from}.`,\n );\n }\n return;\n }\n props.visitedDirectories.add(directoryIdentity);\n\n props.policy.observe(\n await FileSystemIdentity.inspectDirectory(props.from),\n props.from,\n );\n const identity: FileSystemIdentity.IIdentity = props.policy.get();\n const entries: ITraversalEntry[] = await Promise.all(\n (await fs.promises.readdir(props.from)).map(async (name) => {\n const file: string = path.join(props.from, name);\n try {\n return { file, name, stat: await fs.promises.lstat(file) };\n } catch (error) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to inspect input path ${file}: ${formatUnknownError(error)}`,\n );\n }\n }),\n );\n entries.sort((x, y) => {\n const linkOrder: number =\n Number(x.stat.isSymbolicLink()) - Number(y.stat.isSymbolicLink());\n return linkOrder !== 0\n ? linkOrder\n : Buffer.compare(Buffer.from(x.name), Buffer.from(y.name));\n });\n\n for (const entry of entries) {\n let stat: fs.BigIntStats;\n let real: string;\n try {\n stat = await fs.promises.stat(entry.file, { bigint: true });\n real = await fs.promises.realpath(entry.file);\n } catch (error) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input link target is missing or unreadable: ${entry.file}: ${formatUnknownError(error)}`,\n );\n }\n\n if (\n props.outputReal !== undefined &&\n isPhysicalSameOrChildPath(real, props.outputReal)\n )\n continue;\n ensurePhysicalInputContainment({\n file: entry.file,\n input: props.inputReal,\n real,\n });\n\n if (stat.isDirectory()) {\n await gather({ ...props, from: entry.file });\n continue;\n }\n if (\n stat.isFile() === false ||\n identity.isSupportedExtension(entry.name) === false\n )\n continue;\n\n const fileIdentity: string = fileIdentityKey(stat, real);\n if (props.visitedFiles.has(fileIdentity)) continue;\n props.visitedFiles.add(fileIdentity);\n props.container.push(entry.file);\n }\n }\n\n function formatOutput(output: string): string {\n return output.startsWith(\"// @ts-nocheck\")\n ? output\n : `// @ts-nocheck\\n${output}`;\n }\n\n function indexTransformedOutputs(\n outputs: Record<string, string>,\n identity: FileSystemIdentity.IIdentity,\n ): Map<string, string> {\n const map: Map<string, string> = new Map();\n for (const [file, output] of Object.entries(outputs)) {\n const key: string = identity.projectFileKey(file);\n if (map.has(key)) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): transformed outputs have ambiguous filesystem identities: ${file}.`,\n );\n }\n map.set(key, output);\n }\n return map;\n }\n\n function getTransformedOutput(props: {\n cwd: string;\n entry: IInputFile;\n identity: FileSystemIdentity.IIdentity;\n outputByKey: Map<string, string>;\n }): string | undefined {\n const output = props.outputByKey.get(\n props.identity.projectFileKey(projectKey(props.cwd, props.entry.file)),\n );\n if (output !== undefined) {\n return output;\n }\n\n const compilerFile: string = compilerInputPath(props.entry.file);\n if (\n props.identity.isSamePath(compilerFile, props.entry.file) === false &&\n props.identity.contains(compilerFile, props.cwd)\n ) {\n const compiled: string | undefined = props.outputByKey.get(\n props.identity.projectFileKey(projectKey(props.cwd, compilerFile)),\n );\n if (compiled !== undefined) return compiled;\n }\n\n const real: string = resolveRealPath(props.entry.file);\n if (\n props.identity.isSamePath(real, props.entry.file) ||\n props.identity.contains(real, props.cwd) === false\n ) {\n return undefined;\n }\n return props.outputByKey.get(\n props.identity.projectFileKey(projectKey(props.cwd, real)),\n );\n }\n\n function projectKey(root: string, file: string): string {\n return path.relative(root, file).replace(/\\\\/g, \"/\");\n }\n\n function resolveRealPath(file: string): string {\n try {\n return fs.realpathSync(file);\n } catch {\n return file;\n }\n }\n\n function compilerInputPath(file: string): string {\n try {\n if (fs.lstatSync(file).isSymbolicLink()) {\n return path.join(\n resolveRealPath(path.dirname(file)),\n path.basename(file),\n );\n }\n } catch {\n return file;\n }\n return resolveRealPath(file);\n }\n\n async function optionalRealPath(file: string): Promise<string | undefined> {\n try {\n return await fs.promises.realpath(file);\n } catch (error) {\n if (isMissingFileError(error)) return undefined;\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to resolve path ${file}: ${formatUnknownError(error)}`,\n );\n }\n }\n\n async function resolveTraversalPath(file: string): Promise<string> {\n try {\n return await fs.promises.realpath(file);\n } catch (error) {\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): unable to resolve input path ${file}: ${formatUnknownError(error)}`,\n );\n }\n }\n\n function ensurePhysicalInputContainment(props: {\n file: string;\n input: string;\n real: string;\n }): void {\n if (isPhysicalSameOrChildPath(props.real, props.input)) return;\n throw new URIError(\n `Error on TypiaGenerateWizard.generate(): input path resolves outside the input directory: ${props.file}.`,\n );\n }\n\n function isPhysicalSameOrChildPath(file: string, directory: string): boolean {\n const relative: string = path.relative(directory, file);\n return (\n relative === \"\" ||\n (relative !== \"..\" &&\n relative.startsWith(`..${path.sep}`) === false &&\n path.isAbsolute(relative) === false)\n );\n }\n\n function isMissingFileError(exp: unknown): boolean {\n return (\n typeof exp === \"object\" &&\n exp !== null &&\n \"code\" in exp &&\n exp.code === \"ENOENT\"\n );\n }\n\n /**\n * Delegates to {@link FileSystemIdentity.identityKey}, which owns the rule and\n * carries the reasoning for reading the identity as a `bigint`.\n */\n function fileIdentityKey(stat: fs.BigIntStats, realpath: string): string {\n return FileSystemIdentity.identityKey(stat, realpath);\n }\n\n function formatDiagnostics(diagnostics: ITtscCompilerDiagnostic[]): string {\n return diagnostics.length === 0\n ? \"transformation failed\"\n : diagnostics\n .map((diag) =>\n [\n diag.file ?? \"ttsc\",\n diag.line === undefined\n ? undefined\n : `${diag.line}:${diag.character ?? 1}`,\n diag.messageText,\n ]\n .filter((part) => part !== undefined && part !== \"\")\n .join(\": \"),\n )\n .join(\"\\n\");\n }\n\n function formatUnknownError(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"message\" in error &&\n typeof error.message === \"string\"\n ) {\n return error.message;\n }\n return String(error);\n }\n}\n"],"mappings":";;;;;;;;;AAcO,IAAA;;CACE,eAAe,WAA0B;EAC9C,QAAQ,IAAI,0CAA0C;EACtD,QAAQ,IAAI,wBAAwB;EACpC,QAAQ,IAAI,0CAA0C;EAGtD,MAAM,MAAM,MADsB,eAAe,CAC9B;CACrB;;CAEA,eAAe,iBAAsC;EACnD,MAAM,UAAU,cAAc,gBAAgB;EAC9C,QAAQ,MAAM,sBAAsB;EACpC,QAAQ,SAAS,cAAc,wCAAwC;EACvE,QAAQ,OAAO,kBAAkB,iBAAiB;EAClD,QAAQ,OAAO,wBAAwB,kBAAkB;EACzD,QAAQ,OACN,uBACA,+CACF;EAEA,MAAM,aAAa,EAAE,OAAO,MAAM;EAClC,MAAM,SAAS,SAAS;EAExB,MAAM,SAAS,SAAiB,OAAO,YAAoB;GACzD,WAAW,QAAQ;GAOnB,QAAO,MANc,OAAO,CAAC,CAAC;IAC5B,MAAM;IACN;IACA;IACA,SAAS;GACX,CAAC,EAAA,CACa;EAChB;EACA,MAAM,YAAY,YAA6B;GAC7C,MAAM,OAAsB,sBAAsB,QAAQ,IAAI,CAAC;GAC/D,IAAI,SAAS,MACX,MAAM,IAAI,SACR,yDACF;GAEF,OAAO;EACT;EAEA,OAAO,IAAI,SAAqB,SAAS,WAAW;GAClD,QAAQ,OAAO,OAAO,OAAiB,YAAiC;IACtE,IAAI;KACF,IAAI,MAAM,WAAW,KAAK,QAAQ,UAAU,KAAA,GAC1C,MAAM,IAAI,SACR,0FACF;KAEF,IAAI,MAAM,WAAW,GACnB,QAAQ,UAAU,MAAM,MAAM,OAAO,CAAC,CAAC,iBAAiB;KAE1D,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AAS,0BAA0B,MAAc,WAA4B;EAC3E,MAAM,WAAmB,KAAK,SAAS,WAAW,IAAI;EACtD,OACE,aAAa,MACZ,aAAa,QACZ,SAAS,WAAW,KAAK,KAAK,KAAK,MAAM,SACzC,KAAK,WAAW,QAAQ,MAAM;CAEpC;CAEA,SAAS,mBAAmB,KAAuB;EACjD,OACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,IAAI,SAAS;CAEjB;;;;;CAMA,SAAS,gBAAgB,MAAsB,UAA0B;EACvE,OAAO,mBAAmB,YAAY,MAAM,QAAQ;CACtD;CAEA,SAAS,kBAAkB,aAAgD;EACzE,OAAO,YAAY,WAAW,IAC1B,0BACA,YACG,KAAK,SACJ;GACE,KAAK,QAAQ;GACb,KAAK,SAAS,KAAA,IACV,KAAA,IACA,GAAG,KAAK,KAAK,GAAG,KAAK,aAAa;GACtC,KAAK;EACP,CAAC,CACE,QAAQ,SAAS,SAAS,KAAA,KAAa,SAAS,EAAE,CAAC,CACnD,KAAK,IAAI,CACd,CAAC,CACA,KAAK,IAAI;CAClB;CAEA,SAAS,mBAAmB,OAAwB;EAClD,IAAI,iBAAiB,OACnB,OAAO,MAAM;EAEf,IACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAO,MAAM,YAAY,UAEzB,OAAO,MAAM;EAEf,OAAO,OAAO,KAAK;CACrB;GACD,wBAAA,sBAAA,CAAA,EAAD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
var _a, _b;
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const node_child_process_1 = require("node:child_process");
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const packageRoot = node_path_1.default.resolve(node_path_1.default.dirname(node_path_1.default.resolve((_a = process.argv[1]) !== null && _a !== void 0 ? _a : "")), "..", "..", "..");
|
|
11
|
-
const nativeProject = node_path_1.default.resolve(packageRoot, "native");
|
|
12
|
-
const nativeEntrypoint = node_path_1.default.resolve(nativeProject, "cmd", "ttsc-typia", "main.go");
|
|
13
|
-
const command = process.platform === "win32" ? "go.exe" : "go";
|
|
14
|
-
const invocationCwd = process.cwd();
|
|
15
|
-
const argv = [...process.argv.slice(2)];
|
|
16
|
-
if (process.env.TYPIA_TTSC_TRANSFORM_OUTPUT === "ts" &&
|
|
17
|
-
argv[0] === "transform" &&
|
|
18
|
-
!argv.some((value) => value === "--output" || value.startsWith("--output="))) {
|
|
19
|
-
argv.push("--output=ts");
|
|
20
|
-
}
|
|
21
|
-
if (argv.length > 0 &&
|
|
22
|
-
needsCwd(argv[0]) &&
|
|
23
|
-
!argv.some((value) => value === "--cwd" || value.startsWith("--cwd="))) {
|
|
24
|
-
argv.push(`--cwd=${invocationCwd}`);
|
|
25
|
-
}
|
|
26
|
-
const hasSourceEntrypoint = node_fs_1.default.existsSync(nativeEntrypoint);
|
|
27
|
-
if (!hasSourceEntrypoint) {
|
|
28
|
-
process.stderr.write("ttsc-typia: backend source is missing. Expected native/cmd/ttsc-typia/main.go inside the typia package.\n");
|
|
29
|
-
process.exitCode = 1;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const result = (0, node_child_process_1.spawnSync)(command, ["run", "./cmd/ttsc-typia", ...argv], {
|
|
33
|
-
cwd: nativeProject,
|
|
34
|
-
env: process.env,
|
|
35
|
-
stdio: "inherit",
|
|
36
|
-
windowsHide: true,
|
|
37
|
-
});
|
|
38
|
-
if (result.error) {
|
|
39
|
-
process.stderr.write(`ttsc-typia: failed to launch source backend via ${command}: ${result.error.message}\n`);
|
|
40
|
-
process.exitCode = 1;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
process.exitCode = (_b = result.status) !== null && _b !== void 0 ? _b : 1;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function needsCwd(commandName) {
|
|
47
|
-
return (commandName === "build" ||
|
|
48
|
-
commandName === "check" ||
|
|
49
|
-
commandName === "transform" ||
|
|
50
|
-
commandName === "-p" ||
|
|
51
|
-
commandName === "--project");
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=ttsc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ttsc.js","sourceRoot":"","sources":["../../../src/executable/generate/ttsc.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA+C;AAC/C,sDAAyB;AACzB,0DAA6B;AAE7B,MAAM,WAAW,GAAG,mBAAI,CAAC,OAAO,CAC9B,mBAAI,CAAC,OAAO,CAAC,mBAAI,CAAC,OAAO,OAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC,EACjD,IAAI,EACJ,IAAI,EACJ,IAAI,CACL,CAAC;AACF,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAC1D,MAAM,gBAAgB,GAAG,mBAAI,CAAC,OAAO,CACnC,aAAa,EACb,KAAK,EACL,YAAY,EACZ,SAAS,CACV,CAAC;AACF,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACpC,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAExC,IACE,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,IAAI;IAChD,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW;IACvB,CAAC,IAAI,CAAC,IAAI,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AAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,WAAmB;IACnC,OAAO,CACL,WAAW,KAAK,OAAO;QACvB,WAAW,KAAK,OAAO;QACvB,WAAW,KAAK,WAAW;QAC3B,WAAW,KAAK,IAAI;QACpB,WAAW,KAAK,WAAW,CAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
//#region src/executable/generate/ttsc.ts
|
|
5
|
-
const packageRoot = path.resolve(path.dirname(path.resolve(process.argv[1] ?? "")), "..", "..", "..");
|
|
6
|
-
const nativeProject = path.resolve(packageRoot, "native");
|
|
7
|
-
const nativeEntrypoint = path.resolve(nativeProject, "cmd", "ttsc-typia", "main.go");
|
|
8
|
-
const command = process.platform === "win32" ? "go.exe" : "go";
|
|
9
|
-
const invocationCwd = process.cwd();
|
|
10
|
-
const argv = [...process.argv.slice(2)];
|
|
11
|
-
if (process.env.TYPIA_TTSC_TRANSFORM_OUTPUT === "ts" && argv[0] === "transform" && !argv.some((value) => value === "--output" || value.startsWith("--output="))) argv.push("--output=ts");
|
|
12
|
-
if (argv.length > 0 && needsCwd(argv[0]) && !argv.some((value) => value === "--cwd" || value.startsWith("--cwd="))) argv.push(`--cwd=${invocationCwd}`);
|
|
13
|
-
if (!fs.existsSync(nativeEntrypoint)) {
|
|
14
|
-
process.stderr.write("ttsc-typia: backend source is missing. Expected native/cmd/ttsc-typia/main.go inside the typia package.\n");
|
|
15
|
-
process.exitCode = 1;
|
|
16
|
-
} else {
|
|
17
|
-
const result = spawnSync(command, [
|
|
18
|
-
"run",
|
|
19
|
-
"./cmd/ttsc-typia",
|
|
20
|
-
...argv
|
|
21
|
-
], {
|
|
22
|
-
cwd: nativeProject,
|
|
23
|
-
env: process.env,
|
|
24
|
-
stdio: "inherit",
|
|
25
|
-
windowsHide: true
|
|
26
|
-
});
|
|
27
|
-
if (result.error) {
|
|
28
|
-
process.stderr.write(`ttsc-typia: failed to launch source backend via ${command}: ${result.error.message}\n`);
|
|
29
|
-
process.exitCode = 1;
|
|
30
|
-
} else process.exitCode = result.status ?? 1;
|
|
31
|
-
}
|
|
32
|
-
function needsCwd(commandName) {
|
|
33
|
-
return commandName === "build" || commandName === "check" || commandName === "transform" || commandName === "-p" || commandName === "--project";
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=ttsc.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ttsc.mjs","names":[],"sources":["../../../src/executable/generate/ttsc.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst packageRoot = path.resolve(\n path.dirname(path.resolve(process.argv[1] ?? \"\")),\n \"..\",\n \"..\",\n \"..\",\n);\nconst nativeProject = path.resolve(packageRoot, \"native\");\nconst nativeEntrypoint = path.resolve(\n nativeProject,\n \"cmd\",\n \"ttsc-typia\",\n \"main.go\",\n);\nconst command = process.platform === \"win32\" ? \"go.exe\" : \"go\";\nconst invocationCwd = process.cwd();\nconst argv = [...process.argv.slice(2)];\n\nif (\n process.env.TYPIA_TTSC_TRANSFORM_OUTPUT === \"ts\" &&\n argv[0] === \"transform\" &&\n !argv.some((value) => value === \"--output\" || value.startsWith(\"--output=\"))\n) {\n argv.push(\"--output=ts\");\n}\n\nif (\n argv.length > 0 &&\n needsCwd(argv[0]!) &&\n !argv.some((value) => value === \"--cwd\" || value.startsWith(\"--cwd=\"))\n) {\n argv.push(`--cwd=${invocationCwd}`);\n}\n\nconst hasSourceEntrypoint = fs.existsSync(nativeEntrypoint);\n\nif (!hasSourceEntrypoint) {\n process.stderr.write(\n \"ttsc-typia: backend source is missing. Expected native/cmd/ttsc-typia/main.go inside the typia package.\\n\",\n );\n process.exitCode = 1;\n} else {\n const result = spawnSync(command, [\"run\", \"./cmd/ttsc-typia\", ...argv], {\n cwd: nativeProject,\n env: process.env,\n stdio: \"inherit\",\n windowsHide: true,\n });\n if (result.error) {\n process.stderr.write(\n `ttsc-typia: failed to launch source backend via ${command}: ${result.error.message}\\n`,\n );\n process.exitCode = 1;\n } else {\n process.exitCode = result.status ?? 1;\n }\n}\n\nfunction needsCwd(commandName: string): boolean {\n return (\n commandName === \"build\" ||\n commandName === \"check\" ||\n commandName === \"transform\" ||\n commandName === \"-p\" ||\n commandName === \"--project\"\n );\n}\n"],"mappings":";;;;AAIA,MAAM,cAAc,KAAK,QACvB,KAAK,QAAQ,KAAK,QAAQ,QAAQ,KAAK,MAAM,EAAE,CAAC,GAChD,MACA,MACA,IACF;AACA,MAAM,gBAAgB,KAAK,QAAQ,aAAa,QAAQ;AACxD,MAAM,mBAAmB,KAAK,QAC5B,eACA,OACA,cACA,SACF;AACA,MAAM,UAAU,QAAQ,aAAa,UAAU,WAAW;AAC1D,MAAM,gBAAgB,QAAQ,IAAI;AAClC,MAAM,OAAO,CAAC,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC;AAEtC,IACE,QAAQ,IAAI,gCAAgC,QAC5C,KAAK,OAAO,eACZ,CAAC,KAAK,MAAM,UAAU,UAAU,cAAc,MAAM,WAAW,WAAW,CAAC,GAE3E,KAAK,KAAK,aAAa;AAGzB,IACE,KAAK,SAAS,KACd,SAAS,KAAK,EAAG,KACjB,CAAC,KAAK,MAAM,UAAU,UAAU,WAAW,MAAM,WAAW,QAAQ,CAAC,GAErE,KAAK,KAAK,SAAS,eAAe;AAKpC,IAAI,CAFwB,GAAG,WAAW,gBAEnB,GAAG;CACxB,QAAQ,OAAO,MACb,2GACF;CACA,QAAQ,WAAW;AACrB,OAAO;CACL,MAAM,SAAS,UAAU,SAAS;EAAC;EAAO;EAAoB,GAAG;CAAI,GAAG;EACtE,KAAK;EACL,KAAK,QAAQ;EACb,OAAO;EACP,aAAa;CACf,CAAC;CACD,IAAI,OAAO,OAAO;EAChB,QAAQ,OAAO,MACb,mDAAmD,QAAQ,IAAI,OAAO,MAAM,QAAQ,GACtF;EACA,QAAQ,WAAW;CACrB,OACE,QAAQ,WAAW,OAAO,UAAU;AAExC;AAEA,SAAS,SAAS,aAA8B;CAC9C,OACE,gBAAgB,WAChB,gBAAgB,WAChB,gBAAgB,eAChB,gBAAgB,QAChB,gBAAgB;AAEpB"}
|
package/lib/executable/typia.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
const node_module_1 = require("node:module");
|
|
17
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
-
const USAGE = `Wrong command has been detected. Use like below:
|
|
19
|
-
|
|
20
|
-
npx typia generate [options] [files...]
|
|
21
|
-
|
|
22
|
-
npx typia generate
|
|
23
|
-
--input src/templates \\
|
|
24
|
-
--output src/generated
|
|
25
|
-
|
|
26
|
-
npx typia generate
|
|
27
|
-
--output src/generated \\
|
|
28
|
-
"src/**/*.typia.ts"
|
|
29
|
-
`;
|
|
30
|
-
const halt = (desc) => {
|
|
31
|
-
console.error(desc);
|
|
32
|
-
process.exit(-1);
|
|
33
|
-
};
|
|
34
|
-
const loadTypeScript = () => {
|
|
35
|
-
loadPackage("typescript/package.json", `typescript has not been installed. Run "npm i -D ttsc typescript" before.`);
|
|
36
|
-
};
|
|
37
|
-
const loadTtsc = () => {
|
|
38
|
-
loadPackage("ttsc/package.json", `ttsc has not been installed. Run "npm i -D ttsc typescript" before.`);
|
|
39
|
-
};
|
|
40
|
-
const loadPackage = (request, desc) => {
|
|
41
|
-
// The ambient CJS `require` does not exist in the transcoded `.mjs`;
|
|
42
|
-
// anchor explicit resolvers on the consuming project (cwd) first, then on
|
|
43
|
-
// this executable's own location, mirroring the original lookup order.
|
|
44
|
-
const resolvers = [
|
|
45
|
-
() => (0, node_module_1.createRequire)(node_path_1.default.join(process.cwd(), "package.json")).resolve(request),
|
|
46
|
-
() => { var _a; return (0, node_module_1.createRequire)(node_path_1.default.resolve((_a = process.argv[1]) !== null && _a !== void 0 ? _a : "")).resolve(request); },
|
|
47
|
-
];
|
|
48
|
-
for (const resolve of resolvers) {
|
|
49
|
-
try {
|
|
50
|
-
resolve();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
catch (_a) { }
|
|
54
|
-
}
|
|
55
|
-
halt(desc);
|
|
56
|
-
};
|
|
57
|
-
const isHelp = (args) => {
|
|
58
|
-
return args.some((arg) => arg === "--help" || arg === "-h");
|
|
59
|
-
};
|
|
60
|
-
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
try {
|
|
62
|
-
yield import("inquirer");
|
|
63
|
-
yield import("commander");
|
|
64
|
-
}
|
|
65
|
-
catch (_a) {
|
|
66
|
-
halt(`typia has not been installed. Run "npm i typia" before.`);
|
|
67
|
-
}
|
|
68
|
-
const type = process.argv[2];
|
|
69
|
-
if (type === "generate") {
|
|
70
|
-
if (isHelp(process.argv.slice(3)) === false) {
|
|
71
|
-
loadTtsc();
|
|
72
|
-
loadTypeScript();
|
|
73
|
-
}
|
|
74
|
-
const { TypiaGenerateWizard } = yield import("./TypiaGenerateWizard.js");
|
|
75
|
-
yield TypiaGenerateWizard.generate();
|
|
76
|
-
}
|
|
77
|
-
else
|
|
78
|
-
halt(USAGE);
|
|
79
|
-
});
|
|
80
|
-
main().catch((exp) => {
|
|
81
|
-
console.error(exp instanceof URIError ? exp.message : exp);
|
|
82
|
-
process.exit(-1);
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=typia.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typia.js","sourceRoot":"","sources":["../../src/executable/typia.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAA4C;AAC5C,0DAA6B;AAE7B,MAAM,KAAK,GAAG;;;;;;;;;;;CAWb,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,IAAY,EAAS,EAAE;IACnC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAS,EAAE;IAChC,WAAW,CACT,yBAAyB,EACzB,2EAA2E,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAS,EAAE;IAC1B,WAAW,CACT,mBAAmB,EACnB,qEAAqE,CACtE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,IAAY,EAAQ,EAAE;IAC1D,qEAAqE;IACrE,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,SAAS,GAAwB;QACrC,GAAG,EAAE,CACH,IAAA,2BAAa,EAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1E,GAAG,EAAE,kBAAC,IAAA,2BAAa,EAAC,mBAAI,CAAC,OAAO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EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
package/lib/executable/typia.mjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
//#region src/executable/typia.ts
|
|
5
|
-
const USAGE = `Wrong command has been detected. Use like below:
|
|
6
|
-
|
|
7
|
-
npx typia generate [options] [files...]
|
|
8
|
-
|
|
9
|
-
npx typia generate
|
|
10
|
-
--input src/templates \\
|
|
11
|
-
--output src/generated
|
|
12
|
-
|
|
13
|
-
npx typia generate
|
|
14
|
-
--output src/generated \\
|
|
15
|
-
"src/**/*.typia.ts"
|
|
16
|
-
`;
|
|
17
|
-
const halt = (desc) => {
|
|
18
|
-
console.error(desc);
|
|
19
|
-
process.exit(-1);
|
|
20
|
-
};
|
|
21
|
-
const loadTypeScript = () => {
|
|
22
|
-
loadPackage("typescript/package.json", `typescript has not been installed. Run "npm i -D ttsc typescript" before.`);
|
|
23
|
-
};
|
|
24
|
-
const loadTtsc = () => {
|
|
25
|
-
loadPackage("ttsc/package.json", `ttsc has not been installed. Run "npm i -D ttsc typescript" before.`);
|
|
26
|
-
};
|
|
27
|
-
const loadPackage = (request, desc) => {
|
|
28
|
-
const resolvers = [() => createRequire(path.join(process.cwd(), "package.json")).resolve(request), () => createRequire(path.resolve(process.argv[1] ?? "")).resolve(request)];
|
|
29
|
-
for (const resolve of resolvers) try {
|
|
30
|
-
resolve();
|
|
31
|
-
return;
|
|
32
|
-
} catch {}
|
|
33
|
-
halt(desc);
|
|
34
|
-
};
|
|
35
|
-
const isHelp = (args) => {
|
|
36
|
-
return args.some((arg) => arg === "--help" || arg === "-h");
|
|
37
|
-
};
|
|
38
|
-
const main = async () => {
|
|
39
|
-
try {
|
|
40
|
-
await import("inquirer");
|
|
41
|
-
await import("commander");
|
|
42
|
-
} catch {
|
|
43
|
-
halt(`typia has not been installed. Run "npm i typia" before.`);
|
|
44
|
-
}
|
|
45
|
-
if (process.argv[2] === "generate") {
|
|
46
|
-
if (isHelp(process.argv.slice(3)) === false) {
|
|
47
|
-
loadTtsc();
|
|
48
|
-
loadTypeScript();
|
|
49
|
-
}
|
|
50
|
-
const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard.mjs");
|
|
51
|
-
await TypiaGenerateWizard.generate();
|
|
52
|
-
} else halt(USAGE);
|
|
53
|
-
};
|
|
54
|
-
main().catch((exp) => {
|
|
55
|
-
console.error(exp instanceof URIError ? exp.message : exp);
|
|
56
|
-
process.exit(-1);
|
|
57
|
-
});
|
|
58
|
-
//#endregion
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=typia.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typia.mjs","names":[],"sources":["../../src/executable/typia.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nconst USAGE = `Wrong command has been detected. Use like below:\n\n npx typia generate [options] [files...]\n\n npx typia generate\n --input src/templates \\\\\n --output src/generated\n\n npx typia generate\n --output src/generated \\\\\n \"src/**/*.typia.ts\"\n`;\n\nconst halt = (desc: string): never => {\n console.error(desc);\n process.exit(-1);\n};\n\nconst loadTypeScript = (): void => {\n loadPackage(\n \"typescript/package.json\",\n `typescript has not been installed. Run \"npm i -D ttsc typescript\" before.`,\n );\n};\n\nconst loadTtsc = (): void => {\n loadPackage(\n \"ttsc/package.json\",\n `ttsc has not been installed. Run \"npm i -D ttsc typescript\" before.`,\n );\n};\n\nconst loadPackage = (request: string, desc: string): void => {\n // The ambient CJS `require` does not exist in the transcoded `.mjs`;\n // anchor explicit resolvers on the consuming project (cwd) first, then on\n // this executable's own location, mirroring the original lookup order.\n const resolvers: Array<() => string> = [\n () =>\n createRequire(path.join(process.cwd(), \"package.json\")).resolve(request),\n () => createRequire(path.resolve(process.argv[1] ?? \"\")).resolve(request),\n ];\n for (const resolve of resolvers) {\n try {\n resolve();\n return;\n } catch {}\n }\n halt(desc);\n};\n\nconst isHelp = (args: string[]): boolean => {\n return args.some((arg) => arg === \"--help\" || arg === \"-h\");\n};\n\nconst main = async (): Promise<void> => {\n try {\n await import(\"inquirer\");\n await import(\"commander\");\n } catch {\n halt(`typia has not been installed. Run \"npm i typia\" before.`);\n }\n\n const type: string | undefined = process.argv[2];\n if (type === \"generate\") {\n if (isHelp(process.argv.slice(3)) === false) {\n loadTtsc();\n loadTypeScript();\n }\n const { TypiaGenerateWizard } = await import(\"./TypiaGenerateWizard.js\");\n await TypiaGenerateWizard.generate();\n } else halt(USAGE);\n};\nmain().catch((exp) => {\n console.error(exp instanceof URIError ? exp.message : exp);\n process.exit(-1);\n});\n"],"mappings":";;;;AAIA,MAAM,QAAQ;;;;;;;;;;;;AAad,MAAM,QAAQ,SAAwB;CACpC,QAAQ,MAAM,IAAI;CAClB,QAAQ,KAAK,EAAE;AACjB;AAEA,MAAM,uBAA6B;CACjC,YACE,2BACA,2EACF;AACF;AAEA,MAAM,iBAAuB;CAC3B,YACE,qBACA,qEACF;AACF;AAEA,MAAM,eAAe,SAAiB,SAAuB;CAI3D,MAAM,YAAiC,OAEnC,cAAc,KAAK,KAAK,QAAQ,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,OAAO,SACnE,cAAc,KAAK,QAAQ,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,OAAO,CAC1E;CACA,KAAK,MAAM,WAAW,WACpB,IAAI;EACF,QAAQ;EACR;CACF,QAAQ,CAAC;CAEX,KAAK,IAAI;AACX;AAEA,MAAM,UAAU,SAA4B;CAC1C,OAAO,KAAK,MAAM,QAAQ,QAAQ,YAAY,QAAQ,IAAI;AAC5D;AAEA,MAAM,OAAO,YAA2B;CACtC,IAAI;EACF,MAAM,OAAO;EACb,MAAM,OAAO;CACf,QAAQ;EACN,KAAK,yDAAyD;CAChE;CAGA,IADiC,QAAQ,KAAK,OACjC,YAAY;EACvB,IAAI,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,MAAM,OAAO;GAC3C,SAAS;GACT,eAAe;EACjB;EACA,MAAM,EAAE,wBAAwB,MAAM,OAAO;EAC7C,MAAM,oBAAoB,SAAS;CACrC,OAAO,KAAK,KAAK;AACnB;AACA,KAAK,CAAC,CAAC,OAAO,QAAQ;CACpB,QAAQ,MAAM,eAAe,WAAW,IAAI,UAAU,GAAG;CACzD,QAAQ,KAAK,EAAE;AACjB,CAAC"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
export namespace FileSystemIdentity {
|
|
5
|
-
export interface IIdentity {
|
|
6
|
-
readonly caseSensitive: boolean;
|
|
7
|
-
contains(file: string, directory: string): boolean;
|
|
8
|
-
filesystemKey(file: string): string;
|
|
9
|
-
isDeclarationFile(file: string): boolean;
|
|
10
|
-
isSamePath(x: string, y: string): boolean;
|
|
11
|
-
isSupportedExtension(file: string): boolean;
|
|
12
|
-
projectFileKey(file: string): string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function create(
|
|
16
|
-
caseSensitive: boolean,
|
|
17
|
-
pathApi: typeof path.posix = path,
|
|
18
|
-
): IIdentity {
|
|
19
|
-
const fold = (value: string): string =>
|
|
20
|
-
caseSensitive ? value : value.toLowerCase();
|
|
21
|
-
const filesystemKey = (file: string): string =>
|
|
22
|
-
fold(pathApi.normalize(file));
|
|
23
|
-
return {
|
|
24
|
-
caseSensitive,
|
|
25
|
-
contains: (file, directory) => {
|
|
26
|
-
const fileKey: string = filesystemKey(pathApi.resolve(file));
|
|
27
|
-
const directoryKey: string = filesystemKey(pathApi.resolve(directory));
|
|
28
|
-
const prefix: string = directoryKey.endsWith(pathApi.sep)
|
|
29
|
-
? directoryKey
|
|
30
|
-
: `${directoryKey}${pathApi.sep}`;
|
|
31
|
-
return fileKey === directoryKey || fileKey.startsWith(prefix);
|
|
32
|
-
},
|
|
33
|
-
filesystemKey,
|
|
34
|
-
isDeclarationFile: (file) =>
|
|
35
|
-
DTS_PATTERN.test(fold(pathApi.basename(file))),
|
|
36
|
-
isSamePath: (x, y) => filesystemKey(x) === filesystemKey(y),
|
|
37
|
-
isSupportedExtension: (file) => {
|
|
38
|
-
const filename: string = fold(pathApi.basename(file));
|
|
39
|
-
return (
|
|
40
|
-
TS_PATTERN.test(filename) && DTS_PATTERN.test(filename) === false
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
projectFileKey: fold,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export class Policy {
|
|
48
|
-
private caseSensitive_: boolean | undefined;
|
|
49
|
-
private location_: string | undefined;
|
|
50
|
-
|
|
51
|
-
public observe(caseSensitive: boolean | undefined, location: string): void {
|
|
52
|
-
if (caseSensitive === undefined) return;
|
|
53
|
-
if (this.caseSensitive_ === undefined) {
|
|
54
|
-
this.caseSensitive_ = caseSensitive;
|
|
55
|
-
this.location_ = location;
|
|
56
|
-
} else if (this.caseSensitive_ !== caseSensitive) {
|
|
57
|
-
throw new URIError(
|
|
58
|
-
`Error on TypiaGenerateWizard.generate(): inconsistent filesystem case behavior between ${this.location_} and ${location}.`,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public get(): IIdentity {
|
|
64
|
-
if (this.caseSensitive_ === undefined) {
|
|
65
|
-
throw new URIError(
|
|
66
|
-
"Error on TypiaGenerateWizard.generate(): unable to determine filesystem case behavior for this run.",
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return create(this.caseSensitive_);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function inspectDirectory(
|
|
74
|
-
directory: string,
|
|
75
|
-
): Promise<boolean | undefined> {
|
|
76
|
-
const names: string[] = await fs.promises.readdir(directory);
|
|
77
|
-
const entries: Set<string> = new Set(names);
|
|
78
|
-
for (const name of names) {
|
|
79
|
-
const alternate: string | undefined = alternateCase(name);
|
|
80
|
-
if (alternate === undefined) continue;
|
|
81
|
-
if (entries.has(alternate)) return true;
|
|
82
|
-
try {
|
|
83
|
-
await fs.promises.lstat(path.join(directory, alternate));
|
|
84
|
-
return false;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
if (isMissingFileError(error)) return true;
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export async function probeDirectory(directory: string): Promise<boolean> {
|
|
94
|
-
const inspected: boolean | undefined = await inspectDirectory(directory);
|
|
95
|
-
if (inspected !== undefined) return inspected;
|
|
96
|
-
|
|
97
|
-
for (let attempt = 0; attempt < 10; ++attempt) {
|
|
98
|
-
const name: string =
|
|
99
|
-
`.typia-case-probe-${process.pid}-${Date.now()}-${Math.random()
|
|
100
|
-
.toString(36)
|
|
101
|
-
.slice(2)}`.toLowerCase();
|
|
102
|
-
const original: string = path.join(directory, name);
|
|
103
|
-
const alternate: string = path.join(directory, name.toUpperCase());
|
|
104
|
-
let handle: fs.promises.FileHandle;
|
|
105
|
-
try {
|
|
106
|
-
handle = await fs.promises.open(original, "wx");
|
|
107
|
-
} catch (error) {
|
|
108
|
-
if (isAlreadyExistsError(error)) continue;
|
|
109
|
-
throw new URIError(
|
|
110
|
-
`Error on TypiaGenerateWizard.generate(): unable to probe filesystem case behavior at ${directory}: ${formatUnknownError(error)}`,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
let closed: boolean = false;
|
|
114
|
-
try {
|
|
115
|
-
await handle.close();
|
|
116
|
-
closed = true;
|
|
117
|
-
try {
|
|
118
|
-
await fs.promises.lstat(alternate);
|
|
119
|
-
return false;
|
|
120
|
-
} catch (error) {
|
|
121
|
-
if (isMissingFileError(error)) return true;
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
} finally {
|
|
125
|
-
let cleanupError: unknown;
|
|
126
|
-
if (closed === false) {
|
|
127
|
-
try {
|
|
128
|
-
await handle.close();
|
|
129
|
-
} catch (error) {
|
|
130
|
-
cleanupError = error;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
try {
|
|
134
|
-
await fs.promises.unlink(original);
|
|
135
|
-
} catch (error) {
|
|
136
|
-
if (isMissingFileError(error) === false) cleanupError ??= error;
|
|
137
|
-
}
|
|
138
|
-
if (cleanupError !== undefined) {
|
|
139
|
-
throw new URIError(
|
|
140
|
-
`Error on TypiaGenerateWizard.generate(): unable to clean filesystem case probe ${original}: ${formatUnknownError(cleanupError)}`,
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
throw new URIError(
|
|
146
|
-
`Error on TypiaGenerateWizard.generate(): unable to reserve a filesystem case probe at ${directory}.`,
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Builds the key that decides whether two paths are the same filesystem
|
|
152
|
-
* object.
|
|
153
|
-
*
|
|
154
|
-
* The identity is read from `fs.BigIntStats` rather than `fs.Stats`, because
|
|
155
|
-
* `fs.Stats.ino` is a JavaScript number. An NTFS file ID is `(sequenceNumber
|
|
156
|
-
* << 48) | mftRecordIndex` and routinely exceeds `Number.MAX_SAFE_INTEGER` —
|
|
157
|
-
* in a 4000-directory probe, 1879 of them did — where the spacing between
|
|
158
|
-
* representable doubles is 8 or more. Two entries sharing a sequence number
|
|
159
|
-
* with MFT record indices within that spacing round to one double. The
|
|
160
|
-
* traversal callers would then treat a distinct directory or file as already
|
|
161
|
-
* visited and skip it with no diagnostic, and the overwrite guard would
|
|
162
|
-
* refuse a legitimate output (samchon/typia#2269).
|
|
163
|
-
*
|
|
164
|
-
* A filesystem that reports no inode at all keeps the canonical path
|
|
165
|
-
* fallback, which is the only identity available there.
|
|
166
|
-
*
|
|
167
|
-
* @param stat Stats read with `{ bigint: true }`.
|
|
168
|
-
* @param realpath Canonical path of the same object.
|
|
169
|
-
* @returns Key that is equal for two paths only when they are one object.
|
|
170
|
-
*/
|
|
171
|
-
export function identityKey(
|
|
172
|
-
stat: Pick<fs.BigIntStats, "dev" | "ino">,
|
|
173
|
-
realpath: string,
|
|
174
|
-
): string {
|
|
175
|
-
// `BigInt(0)` rather than `0n`: this package compiles at ES2016, where a
|
|
176
|
-
// BigInt literal is a syntax error, while the constructor and the `bigint`
|
|
177
|
-
// type are fine.
|
|
178
|
-
return stat.ino === BigInt(0)
|
|
179
|
-
? `path:${path.normalize(realpath)}`
|
|
180
|
-
: `inode:${stat.dev}:${stat.ino}`;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function alternateCase(name: string): string | undefined {
|
|
184
|
-
let changed: boolean = false;
|
|
185
|
-
let output: string = "";
|
|
186
|
-
for (const character of name) {
|
|
187
|
-
if (character >= "a" && character <= "z") {
|
|
188
|
-
output += character.toUpperCase();
|
|
189
|
-
changed = true;
|
|
190
|
-
} else if (character >= "A" && character <= "Z") {
|
|
191
|
-
output += character.toLowerCase();
|
|
192
|
-
changed = true;
|
|
193
|
-
} else output += character;
|
|
194
|
-
}
|
|
195
|
-
return changed ? output : undefined;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function isAlreadyExistsError(error: unknown): boolean {
|
|
199
|
-
return (
|
|
200
|
-
typeof error === "object" &&
|
|
201
|
-
error !== null &&
|
|
202
|
-
"code" in error &&
|
|
203
|
-
error.code === "EEXIST"
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function isMissingFileError(error: unknown): boolean {
|
|
208
|
-
return (
|
|
209
|
-
typeof error === "object" &&
|
|
210
|
-
error !== null &&
|
|
211
|
-
"code" in error &&
|
|
212
|
-
error.code === "ENOENT"
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function formatUnknownError(error: unknown): string {
|
|
217
|
-
return error instanceof Error ? error.message : String(error);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const TS_PATTERN = /\.[cm]?tsx?$/;
|
|
222
|
-
const DTS_PATTERN = /\.d\.[cm]?tsx?$/;
|