Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/cli/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface CommandLineOptionOfEnum extends CommandLineOptionBase {
}

interface CommandLineOptionOfPrimitive extends CommandLineOptionBase {
type: "boolean" | "string" | "object";
type: "boolean" | "string" | "object" | "array";
}

type CommandLineOption = CommandLineOptionOfEnum | CommandLineOptionOfPrimitive;
Expand Down Expand Up @@ -78,6 +78,11 @@ export const optionDeclarations: CommandLineOption[] = [
description: "Provide verbose output useful for diagnosing problems.",
type: "boolean",
},
{
name: "noResolvePaths",
description: "An array of paths that tstl should not resolve and keep as-is.",
type: "array",
},
];

export function updateParsedConfigFile(parsedConfigFile: ts.ParsedCommandLine): ParsedCommandLine {
Expand Down Expand Up @@ -199,7 +204,16 @@ function readValue(option: CommandLineOption, value: unknown): ReadValueResult {

return { value };
}
case "array": {
if (!Array.isArray(value)) {
return {
value: undefined,
error: cliDiagnostics.compilerOptionRequiresAValueOfType(option.name, option.type),
};
}

return { value };
}
case "enum": {
if (typeof value !== "string") {
return {
Expand Down
7 changes: 7 additions & 0 deletions test/cli/parse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ describe("tsconfig", () => {

["luaBundle", "foo", { luaBundle: "foo" }],
["luaBundleEntry", "bar", { luaBundleEntry: "bar" }],

["noImplicitSelf", true, { noImplicitSelf: true }],

["tstlVerbose", true, { tstlVerbose: true }],

["noResolvePaths", [], { noResolvePaths: [] }],
["noResolvePaths", ["path1", "path2"], { noResolvePaths: ["path1", "path2"] }],
])("{ %p: %p }", (optionName, value, expected) => {
const result = parseConfigFileContent({ tstl: { [optionName]: value } });

Expand Down