jsii 5.4.16-dev.6 → 5.4.16-dev.7
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/case.d.ts +0 -1
- package/lib/case.js +1 -2
- package/lib/case.js.map +1 -1
- package/lib/compiler.d.ts +14 -38
- package/lib/compiler.js +114 -123
- package/lib/compiler.js.map +1 -1
- package/lib/jsii-diagnostic.d.ts +0 -3
- package/lib/jsii-diagnostic.js +1 -15
- package/lib/jsii-diagnostic.js.map +1 -1
- package/lib/main.js +2 -48
- package/lib/main.js.map +1 -1
- package/lib/project-info.d.ts +0 -5
- package/lib/project-info.js +0 -13
- package/lib/project-info.js.map +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/lib/tsconfig/compiler-options.d.ts +0 -54
- package/lib/tsconfig/compiler-options.js +0 -136
- package/lib/tsconfig/compiler-options.js.map +0 -1
- package/lib/tsconfig/index.d.ts +0 -18
- package/lib/tsconfig/index.js +0 -11
- package/lib/tsconfig/index.js.map +0 -1
- package/lib/tsconfig/rulesets/configurable-options.d.ts +0 -4
- package/lib/tsconfig/rulesets/configurable-options.js +0 -20
- package/lib/tsconfig/rulesets/configurable-options.js.map +0 -1
- package/lib/tsconfig/rulesets/deprecated-options.d.ts +0 -4
- package/lib/tsconfig/rulesets/deprecated-options.js +0 -9
- package/lib/tsconfig/rulesets/deprecated-options.js.map +0 -1
- package/lib/tsconfig/rulesets/generated.public.d.ts +0 -4
- package/lib/tsconfig/rulesets/generated.public.js +0 -28
- package/lib/tsconfig/rulesets/generated.public.js.map +0 -1
- package/lib/tsconfig/rulesets/incompatible-options.d.ts +0 -4
- package/lib/tsconfig/rulesets/incompatible-options.js +0 -11
- package/lib/tsconfig/rulesets/incompatible-options.js.map +0 -1
- package/lib/tsconfig/rulesets/jsii-configured-options.d.ts +0 -4
- package/lib/tsconfig/rulesets/jsii-configured-options.js +0 -21
- package/lib/tsconfig/rulesets/jsii-configured-options.js.map +0 -1
- package/lib/tsconfig/rulesets/minimal.public.d.ts +0 -4
- package/lib/tsconfig/rulesets/minimal.public.js +0 -11
- package/lib/tsconfig/rulesets/minimal.public.js.map +0 -1
- package/lib/tsconfig/rulesets/strict-family-options.d.ts +0 -4
- package/lib/tsconfig/rulesets/strict-family-options.js +0 -17
- package/lib/tsconfig/rulesets/strict-family-options.js.map +0 -1
- package/lib/tsconfig/rulesets/strict.public.d.ts +0 -4
- package/lib/tsconfig/rulesets/strict.public.js +0 -33
- package/lib/tsconfig/rulesets/strict.public.js.map +0 -1
- package/lib/tsconfig/tsconfig-validator.d.ts +0 -16
- package/lib/tsconfig/tsconfig-validator.js +0 -46
- package/lib/tsconfig/tsconfig-validator.js.map +0 -1
- package/lib/tsconfig/validator.d.ts +0 -155
- package/lib/tsconfig/validator.js +0 -301
- package/lib/tsconfig/validator.js.map +0 -1
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertNewLineForJson = exports.convertLibForJson = exports.convertEnumToJson = exports.convertForJson = exports.enumAsKebab = exports.enumAsLower = exports.enumAsCamel = exports.BASE_COMPILER_OPTIONS = void 0;
|
|
4
|
-
const ts = require("typescript");
|
|
5
|
-
const Case = require("../case");
|
|
6
|
-
exports.BASE_COMPILER_OPTIONS = {
|
|
7
|
-
alwaysStrict: true,
|
|
8
|
-
declaration: true,
|
|
9
|
-
experimentalDecorators: true,
|
|
10
|
-
incremental: true,
|
|
11
|
-
lib: ['lib.es2020.d.ts'],
|
|
12
|
-
module: ts.ModuleKind.CommonJS,
|
|
13
|
-
noEmitOnError: true,
|
|
14
|
-
noFallthroughCasesInSwitch: true,
|
|
15
|
-
noImplicitAny: true,
|
|
16
|
-
noImplicitReturns: true,
|
|
17
|
-
noImplicitThis: true,
|
|
18
|
-
noUnusedLocals: true,
|
|
19
|
-
noUnusedParameters: true,
|
|
20
|
-
resolveJsonModule: true,
|
|
21
|
-
skipLibCheck: true,
|
|
22
|
-
strict: true,
|
|
23
|
-
strictNullChecks: true,
|
|
24
|
-
strictPropertyInitialization: true,
|
|
25
|
-
stripInternal: false,
|
|
26
|
-
target: ts.ScriptTarget.ES2020,
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Helper function to convert a TS enum into a list of allowed values,
|
|
30
|
-
* converting everything to camel case.
|
|
31
|
-
* This is used for example for the watch options
|
|
32
|
-
*/
|
|
33
|
-
function enumAsCamel(enumData) {
|
|
34
|
-
return Object.keys(enumData)
|
|
35
|
-
.filter((v) => isNaN(Number(v)))
|
|
36
|
-
.map(Case.camel);
|
|
37
|
-
}
|
|
38
|
-
exports.enumAsCamel = enumAsCamel;
|
|
39
|
-
/**
|
|
40
|
-
* Helper function to convert a TS enum into a list of allowed values,
|
|
41
|
-
* converting everything to lower case.
|
|
42
|
-
* This is used for example for the "target" compiler option
|
|
43
|
-
*/
|
|
44
|
-
function enumAsLower(enumData) {
|
|
45
|
-
return Object.keys(enumData)
|
|
46
|
-
.filter((v) => isNaN(Number(v)) && v !== 'None')
|
|
47
|
-
.map((v) => v.toLowerCase());
|
|
48
|
-
}
|
|
49
|
-
exports.enumAsLower = enumAsLower;
|
|
50
|
-
/**
|
|
51
|
-
* Helper function to convert a TS enum into a list of allowed values,
|
|
52
|
-
* converting everything to kebab case.
|
|
53
|
-
* This is used for example for the "jsx" compiler option
|
|
54
|
-
*/
|
|
55
|
-
function enumAsKebab(enumData) {
|
|
56
|
-
return Object.keys(enumData)
|
|
57
|
-
.filter((v) => isNaN(Number(v)) && v !== 'None')
|
|
58
|
-
.map(Case.kebab);
|
|
59
|
-
}
|
|
60
|
-
exports.enumAsKebab = enumAsKebab;
|
|
61
|
-
/**
|
|
62
|
-
* The compilerOptions in the programmatic API are slightly differently than the format used in tsconfig.json
|
|
63
|
-
* This helper performs the necessary conversion from the programmatic API format the one used in tsconfig.json
|
|
64
|
-
*
|
|
65
|
-
* @param opt compilerOptions in programmatic API format
|
|
66
|
-
* @returns compilerOptions ready to be written on disk
|
|
67
|
-
*/
|
|
68
|
-
function convertForJson(opt) {
|
|
69
|
-
return {
|
|
70
|
-
...opt,
|
|
71
|
-
// Drop the "lib." prefix and ".d.ts" suffix before writing up the tsconfig.json file
|
|
72
|
-
...valueHelper('lib', opt.lib, convertLibForJson),
|
|
73
|
-
// Re-write the module, targets & jsx to be the JSON format instead of Programmatic API
|
|
74
|
-
...enumHelper('importsNotUsedAsValues', opt.importsNotUsedAsValues, ts.ImportsNotUsedAsValues),
|
|
75
|
-
...enumHelper('jsx', opt.jsx, ts.JsxEmit, Case.kebab),
|
|
76
|
-
...enumHelper('module', opt.module, ts.ModuleKind),
|
|
77
|
-
...enumHelper('moduleResolution', opt.moduleResolution, ts.ModuleResolutionKind),
|
|
78
|
-
...enumHelper('moduleDetection', opt.moduleDetection, ts.ModuleDetectionKind),
|
|
79
|
-
...enumHelper('target', opt.target, ts.ScriptTarget),
|
|
80
|
-
// rewrite newline to be the JSON format instead of Programmatic API
|
|
81
|
-
...valueHelper('newLine', opt.newLine, convertNewLineForJson),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
exports.convertForJson = convertForJson;
|
|
85
|
-
function valueHelper(name, value, converter) {
|
|
86
|
-
if (!value) {
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
return { [name]: converter(value) };
|
|
90
|
-
}
|
|
91
|
-
function enumHelper(name, value, enumObj, converter) {
|
|
92
|
-
if (!value) {
|
|
93
|
-
return {};
|
|
94
|
-
}
|
|
95
|
-
return { [name]: convertEnumToJson(value, enumObj, converter) };
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Convert an internal enum value to what a user would write in tsconfig.json
|
|
99
|
-
* Possibly using a converter function to adjust casing.
|
|
100
|
-
* @param value The internal enum value
|
|
101
|
-
* @param enumObj The enum object to convert from
|
|
102
|
-
* @param converter The converter function, defaults to lowercase
|
|
103
|
-
* @returns The humanized version of the enum value
|
|
104
|
-
*/
|
|
105
|
-
function convertEnumToJson(value, enumObj, converter = (v) => v.toLowerCase()) {
|
|
106
|
-
return converter(enumObj[value]);
|
|
107
|
-
}
|
|
108
|
-
exports.convertEnumToJson = convertEnumToJson;
|
|
109
|
-
/**
|
|
110
|
-
* Convert the internal lib strings to what a user would write in tsconfig.json
|
|
111
|
-
* @param input The input libs array
|
|
112
|
-
* @returns The humanized version lib array
|
|
113
|
-
*/
|
|
114
|
-
function convertLibForJson(input) {
|
|
115
|
-
return input.map((lib) => lib.slice(4, lib.length - 5));
|
|
116
|
-
}
|
|
117
|
-
exports.convertLibForJson = convertLibForJson;
|
|
118
|
-
/**
|
|
119
|
-
* This is annoying - the values expected in the tsconfig.json file are not
|
|
120
|
-
* the same as the enum constant names, or their values. So we need this
|
|
121
|
-
* function to map the "compiler API version" to the "tsconfig.json version"
|
|
122
|
-
*
|
|
123
|
-
* @param newLine the compiler form of the new line configuration
|
|
124
|
-
*
|
|
125
|
-
* @return the equivalent value to put in tsconfig.json
|
|
126
|
-
*/
|
|
127
|
-
function convertNewLineForJson(newLine) {
|
|
128
|
-
switch (newLine) {
|
|
129
|
-
case ts.NewLineKind.CarriageReturnLineFeed:
|
|
130
|
-
return 'crlf';
|
|
131
|
-
case ts.NewLineKind.LineFeed:
|
|
132
|
-
return 'lf';
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.convertNewLineForJson = convertNewLineForJson;
|
|
136
|
-
//# sourceMappingURL=compiler-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-options.js","sourceRoot":"","sources":["../../src/tsconfig/compiler-options.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,gCAAgC;AAEnB,QAAA,qBAAqB,GAAuB;IACvD,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,sBAAsB,EAAE,IAAI;IAC5B,WAAW,EAA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AAU,CACjB,IAAY,EACZ,KAAU,EACV,OAAU,EACV,SAAqC;IAIrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,KAAc,EACd,OAAU,EACV,YAAuC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;IAE7D,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,CAAQ,CAAC,CAAC;AAC1C,CAAC;AAND,8CAMC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAe;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAFD,8CAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,OAAuB;IAC3D,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,sBAAsB;YACxC,OAAO,MAAM,CAAC;QAChB,KAAK,EAAE,CAAC,WAAW,CAAC,QAAQ;YAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAPD,sDAOC","sourcesContent":["import * as ts from 'typescript';\nimport * as Case from '../case';\n\nexport const BASE_COMPILER_OPTIONS: ts.CompilerOptions = {\n alwaysStrict: true,\n declaration: true,\n experimentalDecorators: true,\n incremental: true,\n lib: ['lib.es2020.d.ts'],\n module: ts.ModuleKind.CommonJS,\n noEmitOnError: true,\n noFallthroughCasesInSwitch: true,\n noImplicitAny: true,\n noImplicitReturns: true,\n noImplicitThis: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n strict: true,\n strictNullChecks: true,\n strictPropertyInitialization: true,\n stripInternal: false,\n target: ts.ScriptTarget.ES2020,\n};\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to camel case.\n * This is used for example for the watch options\n */\nexport function enumAsCamel(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)))\n .map(Case.camel);\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to lower case.\n * This is used for example for the \"target\" compiler option\n */\nexport function enumAsLower(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map((v) => v.toLowerCase());\n}\n\n/**\n * Helper function to convert a TS enum into a list of allowed values,\n * converting everything to kebab case.\n * This is used for example for the \"jsx\" compiler option\n */\nexport function enumAsKebab(enumData: Record<string, string | number>): string[] {\n return Object.keys(enumData)\n .filter((v) => isNaN(Number(v)) && v !== 'None')\n .map(Case.kebab);\n}\n\n/**\n * The compilerOptions in the programmatic API are slightly differently than the format used in tsconfig.json\n * This helper performs the necessary conversion from the programmatic API format the one used in tsconfig.json\n *\n * @param opt compilerOptions in programmatic API format\n * @returns compilerOptions ready to be written on disk\n */\nexport function convertForJson(opt: ts.CompilerOptions): ts.CompilerOptions {\n return {\n ...opt,\n\n // Drop the \"lib.\" prefix and \".d.ts\" suffix before writing up the tsconfig.json file\n ...valueHelper('lib', opt.lib, convertLibForJson),\n\n // Re-write the module, targets & jsx to be the JSON format instead of Programmatic API\n ...enumHelper('importsNotUsedAsValues', opt.importsNotUsedAsValues, ts.ImportsNotUsedAsValues),\n ...enumHelper('jsx', opt.jsx, ts.JsxEmit, Case.kebab),\n ...enumHelper('module', opt.module, ts.ModuleKind),\n ...enumHelper('moduleResolution', opt.moduleResolution, ts.ModuleResolutionKind),\n ...enumHelper('moduleDetection', opt.moduleDetection, ts.ModuleDetectionKind),\n ...enumHelper('target', opt.target, ts.ScriptTarget),\n\n // rewrite newline to be the JSON format instead of Programmatic API\n ...valueHelper('newLine', opt.newLine, convertNewLineForJson),\n };\n}\n\nfunction valueHelper<T, U>(\n name: string,\n value: T | undefined,\n converter: (value: T) => U,\n): {\n [name: string]: U;\n} {\n if (!value) {\n return {};\n }\n return { [name]: converter(value) };\n}\n\nfunction enumHelper<T>(\n name: string,\n value: any,\n enumObj: T,\n converter?: (value: string) => string,\n): {\n [name: string]: string;\n} {\n if (!value) {\n return {};\n }\n return { [name]: convertEnumToJson(value, enumObj, converter) };\n}\n\n/**\n * Convert an internal enum value to what a user would write in tsconfig.json\n * Possibly using a converter function to adjust casing.\n * @param value The internal enum value\n * @param enumObj The enum object to convert from\n * @param converter The converter function, defaults to lowercase\n * @returns The humanized version of the enum value\n */\nexport function convertEnumToJson<T>(\n value: keyof T,\n enumObj: T,\n converter: (value: string) => string = (v) => v.toLowerCase(),\n): string {\n return converter(enumObj[value] as any);\n}\n\n/**\n * Convert the internal lib strings to what a user would write in tsconfig.json\n * @param input The input libs array\n * @returns The humanized version lib array\n */\nexport function convertLibForJson(input: string[]): string[] {\n return input.map((lib) => lib.slice(4, lib.length - 5));\n}\n\n/**\n * This is annoying - the values expected in the tsconfig.json file are not\n * the same as the enum constant names, or their values. So we need this\n * function to map the \"compiler API version\" to the \"tsconfig.json version\"\n *\n * @param newLine the compiler form of the new line configuration\n *\n * @return the equivalent value to put in tsconfig.json\n */\nexport function convertNewLineForJson(newLine: ts.NewLineKind): string {\n switch (newLine) {\n case ts.NewLineKind.CarriageReturnLineFeed:\n return 'crlf';\n case ts.NewLineKind.LineFeed:\n return 'lf';\n }\n}\n"]}
|
package/lib/tsconfig/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
export interface TypeScriptConfig {
|
|
3
|
-
files?: string[];
|
|
4
|
-
extends?: string | string[];
|
|
5
|
-
include?: string[];
|
|
6
|
-
exclude?: string[];
|
|
7
|
-
references?: ts.ProjectReference[];
|
|
8
|
-
compilerOptions: ts.CompilerOptions;
|
|
9
|
-
watchOptions?: ts.WatchOptions;
|
|
10
|
-
typeAcquisition?: ts.TypeAcquisition;
|
|
11
|
-
}
|
|
12
|
-
export declare enum TypeScriptConfigValidationRuleSet {
|
|
13
|
-
STRICT = "strict",
|
|
14
|
-
GENERATED = "generated",
|
|
15
|
-
MINIMAL = "minimal",
|
|
16
|
-
NONE = "off"
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/tsconfig/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeScriptConfigValidationRuleSet = void 0;
|
|
4
|
-
var TypeScriptConfigValidationRuleSet;
|
|
5
|
-
(function (TypeScriptConfigValidationRuleSet) {
|
|
6
|
-
TypeScriptConfigValidationRuleSet["STRICT"] = "strict";
|
|
7
|
-
TypeScriptConfigValidationRuleSet["GENERATED"] = "generated";
|
|
8
|
-
TypeScriptConfigValidationRuleSet["MINIMAL"] = "minimal";
|
|
9
|
-
TypeScriptConfigValidationRuleSet["NONE"] = "off";
|
|
10
|
-
})(TypeScriptConfigValidationRuleSet || (exports.TypeScriptConfigValidationRuleSet = TypeScriptConfigValidationRuleSet = {}));
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tsconfig/index.ts"],"names":[],"mappings":";;;AAaA,IAAY,iCAKX;AALD,WAAY,iCAAiC;IAC3C,sDAAiB,CAAA;IACjB,4DAAuB,CAAA;IACvB,wDAAmB,CAAA;IACnB,iDAAY,CAAA;AACd,CAAC,EALW,iCAAiC,iDAAjC,iCAAiC,QAK5C","sourcesContent":["import * as ts from 'typescript';\n\nexport interface TypeScriptConfig {\n files?: string[];\n extends?: string | string[];\n include?: string[];\n exclude?: string[];\n references?: ts.ProjectReference[];\n compilerOptions: ts.CompilerOptions;\n watchOptions?: ts.WatchOptions;\n typeAcquisition?: ts.TypeAcquisition;\n}\n\nexport enum TypeScriptConfigValidationRuleSet {\n STRICT = 'strict',\n GENERATED = 'generated',\n MINIMAL = 'minimal',\n NONE = 'off',\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsii_configured_options_1 = require("./jsii-configured-options");
|
|
4
|
-
const validator_1 = require("../validator");
|
|
5
|
-
// A rule set defining all compilerOptions that can be configured by users with or without constraints.
|
|
6
|
-
// These are options jsii doesn't have a particular opinion about
|
|
7
|
-
// This is an internal rule set, that may be used by other rule sets.
|
|
8
|
-
const configurableOptions = new validator_1.RuleSet();
|
|
9
|
-
// import all options that are configurable via jsii settings
|
|
10
|
-
configurableOptions.import(jsii_configured_options_1.default);
|
|
11
|
-
// options jsii allows to be configured
|
|
12
|
-
configurableOptions.shouldPass('incremental', validator_1.Match.ANY);
|
|
13
|
-
configurableOptions.shouldPass('noImplicitReturns', validator_1.Match.ANY);
|
|
14
|
-
configurableOptions.shouldPass('noUnusedLocals', validator_1.Match.ANY);
|
|
15
|
-
configurableOptions.shouldPass('noUnusedParameters', validator_1.Match.ANY);
|
|
16
|
-
configurableOptions.shouldPass('resolveJsonModule', validator_1.Match.ANY);
|
|
17
|
-
configurableOptions.shouldPass('experimentalDecorators', validator_1.Match.ANY);
|
|
18
|
-
configurableOptions.shouldPass('noFallthroughCasesInSwitch', validator_1.Match.ANY);
|
|
19
|
-
exports.default = configurableOptions;
|
|
20
|
-
//# sourceMappingURL=configurable-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurable-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/configurable-options.ts"],"names":[],"mappings":";;AAAA,uEAA8D;AAC9D,4CAA8C;AAE9C,uGAAuG;AACvG,iEAAiE;AACjE,qEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1C,6DAA6D;AAC7D,mBAAmB,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAElD,uCAAuC;AACvC,mBAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACzD,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,mBAAmB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,mBAAmB,CAAC,UAAU,CAAC,wBAAwB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACpE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAExE,kBAAe,mBAAmB,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { Match, RuleSet } from '../validator';\n\n// A rule set defining all compilerOptions that can be configured by users with or without constraints.\n// These are options jsii doesn't have a particular opinion about\n// This is an internal rule set, that may be used by other rule sets.\n\nconst configurableOptions = new RuleSet();\n\n// import all options that are configurable via jsii settings\nconfigurableOptions.import(jsiiConfiguredOptions);\n\n// options jsii allows to be configured\nconfigurableOptions.shouldPass('incremental', Match.ANY);\nconfigurableOptions.shouldPass('noImplicitReturns', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedLocals', Match.ANY);\nconfigurableOptions.shouldPass('noUnusedParameters', Match.ANY);\nconfigurableOptions.shouldPass('resolveJsonModule', Match.ANY);\nconfigurableOptions.shouldPass('experimentalDecorators', Match.ANY);\nconfigurableOptions.shouldPass('noFallthroughCasesInSwitch', Match.ANY);\n\nexport default configurableOptions;\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validator_1 = require("../validator");
|
|
4
|
-
// A rule set for deprecated compilerOptions that should not be used with jsii
|
|
5
|
-
// This is an internal rule set, that may be used by other rule sets.
|
|
6
|
-
const deprecatedOptions = new validator_1.RuleSet();
|
|
7
|
-
deprecatedOptions.shouldPass('prepend', validator_1.Match.MISSING);
|
|
8
|
-
exports.default = deprecatedOptions;
|
|
9
|
-
//# sourceMappingURL=deprecated-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/deprecated-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,8EAA8E;AAC9E,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAI,mBAAO,EAAE,CAAC;AACxC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAEvD,kBAAe,iBAAiB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set for deprecated compilerOptions that should not be used with jsii\n// This is an internal rule set, that may be used by other rule sets.\nconst deprecatedOptions = new RuleSet();\ndeprecatedOptions.shouldPass('prepend', Match.MISSING);\n\nexport default deprecatedOptions;\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsii_configured_options_1 = require("./jsii-configured-options");
|
|
4
|
-
const compiler_options_1 = require("../compiler-options");
|
|
5
|
-
const validator_1 = require("../validator");
|
|
6
|
-
// The public rule set used for the "generated" tsconfig validation setting.\
|
|
7
|
-
// The goal of this rule set is to ensure a tsconfig is compatible to the one jsii would generate for the user.
|
|
8
|
-
// It is explicitly enforcing option values that are used for the generated tsconfig,
|
|
9
|
-
// as well as options that can be configured via jsii settings. All other options are disallowed.
|
|
10
|
-
const generated = new validator_1.RuleSet({
|
|
11
|
-
unexpectedFields: validator_1.RuleType.FAIL,
|
|
12
|
-
});
|
|
13
|
-
// import all options that are configurable via jsii settings
|
|
14
|
-
generated.import(jsii_configured_options_1.default);
|
|
15
|
-
// ... and all generated options
|
|
16
|
-
for (const [field, value] of Object.entries((0, compiler_options_1.convertForJson)(compiler_options_1.BASE_COMPILER_OPTIONS))) {
|
|
17
|
-
if (typeof value === 'string') {
|
|
18
|
-
generated.shouldPass(field, validator_1.Match.strEq(value, true));
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(value)) {
|
|
22
|
-
generated.shouldPass(field, validator_1.Match.arrEq(value));
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
generated.shouldPass(field, validator_1.Match.eq(value));
|
|
26
|
-
}
|
|
27
|
-
exports.default = generated;
|
|
28
|
-
//# sourceMappingURL=generated.public.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/generated.public.ts"],"names":[],"mappings":";;AAAA,uEAA8D;AAC9D,0DAA4E;AAC5E,4CAAwD;AAExD,6EAA6E;AAC7E,+GAA+G;AAC/G,qFAAqF;AACrF,iGAAiG;AACjG,MAAM,SAAS,GAAG,IAAI,mBAAO,CAAC;IAC5B,gBAAgB,EAAE,oBAAQ,CAAC,IAAI;CAChC,CAAC,CAAC;AAEH,6DAA6D;AAC7D,SAAS,CAAC,MAAM,CAAC,iCAAqB,CAAC,CAAC;AAExC,gCAAgC;AAChC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAA,iCAAc,EAAC,wCAAqB,CAAC,CAAC,EAAE,CAAC;IACnF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,SAAS;IACX,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,SAAS;IACX,CAAC;IAED,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,kBAAe,SAAS,CAAC","sourcesContent":["import jsiiConfiguredOptions from './jsii-configured-options';\nimport { BASE_COMPILER_OPTIONS, convertForJson } from '../compiler-options';\nimport { Match, RuleSet, RuleType } from '../validator';\n\n// The public rule set used for the \"generated\" tsconfig validation setting.\\\n// The goal of this rule set is to ensure a tsconfig is compatible to the one jsii would generate for the user.\n// It is explicitly enforcing option values that are used for the generated tsconfig,\n// as well as options that can be configured via jsii settings. All other options are disallowed.\nconst generated = new RuleSet({\n unexpectedFields: RuleType.FAIL,\n});\n\n// import all options that are configurable via jsii settings\ngenerated.import(jsiiConfiguredOptions);\n\n// ... and all generated options\nfor (const [field, value] of Object.entries(convertForJson(BASE_COMPILER_OPTIONS))) {\n if (typeof value === 'string') {\n generated.shouldPass(field, Match.strEq(value, true));\n continue;\n }\n\n if (Array.isArray(value)) {\n generated.shouldPass(field, Match.arrEq(value));\n continue;\n }\n\n generated.shouldPass(field, Match.eq(value));\n}\n\nexport default generated;\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validator_1 = require("../validator");
|
|
4
|
-
// A rule set defining all compilerOptions that are explicitly known to be incompatible with jsii
|
|
5
|
-
// This is an internal rule set, that may be used by other rule sets.
|
|
6
|
-
const incompatibleOptions = new validator_1.RuleSet();
|
|
7
|
-
incompatibleOptions.shouldFail('noEmit', validator_1.Match.TRUE);
|
|
8
|
-
incompatibleOptions.shouldFail('noLib', validator_1.Match.TRUE);
|
|
9
|
-
incompatibleOptions.shouldFail('declaration', validator_1.Match.FALSE);
|
|
10
|
-
exports.default = incompatibleOptions;
|
|
11
|
-
//# sourceMappingURL=incompatible-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"incompatible-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/incompatible-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,iGAAiG;AACjG,qEAAqE;AACrE,MAAM,mBAAmB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC1C,mBAAmB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AACrD,mBAAmB,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AACpD,mBAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,iBAAK,CAAC,KAAK,CAAC,CAAC;AAE3D,kBAAe,mBAAmB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set defining all compilerOptions that are explicitly known to be incompatible with jsii\n// This is an internal rule set, that may be used by other rule sets.\nconst incompatibleOptions = new RuleSet();\nincompatibleOptions.shouldFail('noEmit', Match.TRUE);\nincompatibleOptions.shouldFail('noLib', Match.TRUE);\nincompatibleOptions.shouldFail('declaration', Match.FALSE);\n\nexport default incompatibleOptions;\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validator_1 = require("../validator");
|
|
4
|
-
// A rule set defining all compilerOptions that are configurable via the jsii field in package.json
|
|
5
|
-
// This is an internal rule set, that may be used by other rule sets.
|
|
6
|
-
// We accept all value for these
|
|
7
|
-
const jsiiConfiguredOptions = new validator_1.RuleSet();
|
|
8
|
-
jsiiConfiguredOptions.shouldPass('outdir', validator_1.Match.ANY);
|
|
9
|
-
jsiiConfiguredOptions.shouldPass('rootDir', validator_1.Match.ANY);
|
|
10
|
-
jsiiConfiguredOptions.shouldPass('forceConsistentCasingInFileNames', validator_1.Match.ANY);
|
|
11
|
-
jsiiConfiguredOptions.shouldPass('declarationMap', validator_1.Match.ANY);
|
|
12
|
-
jsiiConfiguredOptions.shouldPass('inlineSourceMap', validator_1.Match.ANY);
|
|
13
|
-
jsiiConfiguredOptions.shouldPass('inlineSources', validator_1.Match.ANY);
|
|
14
|
-
jsiiConfiguredOptions.shouldPass('sourceMap', validator_1.Match.ANY);
|
|
15
|
-
jsiiConfiguredOptions.shouldPass('types', validator_1.Match.ANY);
|
|
16
|
-
jsiiConfiguredOptions.shouldPass('baseUrl', validator_1.Match.ANY);
|
|
17
|
-
jsiiConfiguredOptions.shouldPass('paths', validator_1.Match.ANY);
|
|
18
|
-
jsiiConfiguredOptions.shouldPass('composite', validator_1.Match.ANY); // configured via projectReferences
|
|
19
|
-
jsiiConfiguredOptions.shouldPass('tsBuildInfoFile', validator_1.Match.ANY);
|
|
20
|
-
exports.default = jsiiConfiguredOptions;
|
|
21
|
-
//# sourceMappingURL=jsii-configured-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsii-configured-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/jsii-configured-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,mGAAmG;AACnG,qEAAqE;AACrE,gCAAgC;AAChC,MAAM,qBAAqB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC5C,qBAAqB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACtD,qBAAqB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACvD,qBAAqB,CAAC,UAAU,CAAC,kCAAkC,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChF,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC9D,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC/D,qBAAqB,CAAC,UAAU,CAAC,eAAe,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC7D,qBAAqB,CAAC,UAAU,CAAC,WAAW,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACzD,qBAAqB,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACvD,qBAAqB,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACrD,qBAAqB,CAAC,UAAU,CAAC,WAAW,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC,CAAC,mCAAmC;AAC7F,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAE/D,kBAAe,qBAAqB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set defining all compilerOptions that are configurable via the jsii field in package.json\n// This is an internal rule set, that may be used by other rule sets.\n// We accept all value for these\nconst jsiiConfiguredOptions = new RuleSet();\njsiiConfiguredOptions.shouldPass('outdir', Match.ANY);\njsiiConfiguredOptions.shouldPass('rootDir', Match.ANY);\njsiiConfiguredOptions.shouldPass('forceConsistentCasingInFileNames', Match.ANY);\njsiiConfiguredOptions.shouldPass('declarationMap', Match.ANY);\njsiiConfiguredOptions.shouldPass('inlineSourceMap', Match.ANY);\njsiiConfiguredOptions.shouldPass('inlineSources', Match.ANY);\njsiiConfiguredOptions.shouldPass('sourceMap', Match.ANY);\njsiiConfiguredOptions.shouldPass('types', Match.ANY);\njsiiConfiguredOptions.shouldPass('baseUrl', Match.ANY);\njsiiConfiguredOptions.shouldPass('paths', Match.ANY);\njsiiConfiguredOptions.shouldPass('composite', Match.ANY); // configured via projectReferences\njsiiConfiguredOptions.shouldPass('tsBuildInfoFile', Match.ANY);\n\nexport default jsiiConfiguredOptions;\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const incompatible_options_1 = require("./incompatible-options");
|
|
4
|
-
const validator_1 = require("../validator");
|
|
5
|
-
// The public rule set used for the "minimal" tsconfig validation setting
|
|
6
|
-
// To goal of this rule set is to only prevent obvious misconfigurations,
|
|
7
|
-
// while leaving everything else up to the user.
|
|
8
|
-
const minimal = new validator_1.RuleSet();
|
|
9
|
-
minimal.import(incompatible_options_1.default);
|
|
10
|
-
exports.default = minimal;
|
|
11
|
-
//# sourceMappingURL=minimal.public.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"minimal.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/minimal.public.ts"],"names":[],"mappings":";;AAAA,iEAAyD;AACzD,4CAAuC;AAEvC,yEAAyE;AACzE,yEAAyE;AACzE,gDAAgD;AAChD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,MAAM,CAAC,8BAAmB,CAAC,CAAC;AAEpC,kBAAe,OAAO,CAAC","sourcesContent":["import incompatibleOptions from './incompatible-options';\nimport { RuleSet } from '../validator';\n\n// The public rule set used for the \"minimal\" tsconfig validation setting\n// To goal of this rule set is to only prevent obvious misconfigurations,\n// while leaving everything else up to the user.\nconst minimal = new RuleSet();\nminimal.import(incompatibleOptions);\n\nexport default minimal;\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validator_1 = require("../validator");
|
|
4
|
-
// A rule set for the compilerOptions of the strict family.
|
|
5
|
-
// The rule set enforces strict, but allows the defining options that are implied by strict
|
|
6
|
-
const strictFamilyOptions = new validator_1.RuleSet();
|
|
7
|
-
strictFamilyOptions.shouldPass('strict', validator_1.Match.eq(true));
|
|
8
|
-
strictFamilyOptions.shouldPass('alwaysStrict', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
9
|
-
strictFamilyOptions.shouldPass('noImplicitAny', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
10
|
-
strictFamilyOptions.shouldPass('noImplicitThis', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
11
|
-
strictFamilyOptions.shouldPass('strictBindCallApply', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
12
|
-
strictFamilyOptions.shouldPass('strictFunctionTypes', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
13
|
-
strictFamilyOptions.shouldPass('strictNullChecks', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
14
|
-
strictFamilyOptions.shouldPass('strictPropertyInitialization', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
15
|
-
strictFamilyOptions.shouldPass('useUnknownInCatchVariables', validator_1.Match.optional(validator_1.Match.eq(true)));
|
|
16
|
-
exports.default = strictFamilyOptions;
|
|
17
|
-
//# sourceMappingURL=strict-family-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strict-family-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/strict-family-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,2DAA2D;AAC3D,2FAA2F;AAE3F,MAAM,mBAAmB,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC1C,mBAAmB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,mBAAmB,CAAC,UAAU,CAAC,cAAc,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/E,mBAAmB,CAAC,UAAU,CAAC,eAAe,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,mBAAmB,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjF,mBAAmB,CAAC,UAAU,CAAC,qBAAqB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtF,mBAAmB,CAAC,UAAU,CAAC,qBAAqB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtF,mBAAmB,CAAC,UAAU,CAAC,kBAAkB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnF,mBAAmB,CAAC,UAAU,CAAC,8BAA8B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/F,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE7F,kBAAe,mBAAmB,CAAC","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set for the compilerOptions of the strict family.\n// The rule set enforces strict, but allows the defining options that are implied by strict\n\nconst strictFamilyOptions = new RuleSet();\nstrictFamilyOptions.shouldPass('strict', Match.eq(true));\nstrictFamilyOptions.shouldPass('alwaysStrict', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('noImplicitAny', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('noImplicitThis', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('strictBindCallApply', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('strictFunctionTypes', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('strictNullChecks', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('strictPropertyInitialization', Match.optional(Match.eq(true)));\nstrictFamilyOptions.shouldPass('useUnknownInCatchVariables', Match.optional(Match.eq(true)));\n\nexport default strictFamilyOptions;\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configurable_options_1 = require("./configurable-options");
|
|
4
|
-
const deprecated_options_1 = require("./deprecated-options");
|
|
5
|
-
const incompatible_options_1 = require("./incompatible-options");
|
|
6
|
-
const strict_family_options_1 = require("./strict-family-options");
|
|
7
|
-
const validator_1 = require("../validator");
|
|
8
|
-
// The public rule set used for the "strict" tsconfig validation setting.
|
|
9
|
-
// The goal of this rule set is to ensure a tsconfig that is following best practices for jsii.
|
|
10
|
-
// In practice, this is a combination of known incompatible options, known configurable options and additional best practices.
|
|
11
|
-
// The rule set also explicitly disallows unknown options.
|
|
12
|
-
const strict = new validator_1.RuleSet({
|
|
13
|
-
unexpectedFields: validator_1.RuleType.FAIL,
|
|
14
|
-
});
|
|
15
|
-
// import all options that are configurable
|
|
16
|
-
strict.import(configurable_options_1.default);
|
|
17
|
-
// import all options that are definitely incompatible
|
|
18
|
-
strict.import(incompatible_options_1.default);
|
|
19
|
-
// strict family options
|
|
20
|
-
strict.import(strict_family_options_1.default);
|
|
21
|
-
// Best practice rules
|
|
22
|
-
strict.shouldPass('target', validator_1.Match.eq('es2022')); // node18
|
|
23
|
-
strict.shouldPass('lib', validator_1.Match.arrEq(['es2022'])); // node18
|
|
24
|
-
strict.shouldPass('module', validator_1.Match.oneOf('node16', 'commonjs'));
|
|
25
|
-
strict.shouldPass('moduleResolution', validator_1.Match.optional(validator_1.Match.oneOf('node', 'node16')));
|
|
26
|
-
strict.shouldPass('esModuleInterop', validator_1.Match.TRUE);
|
|
27
|
-
strict.shouldPass('skipLibCheck', validator_1.Match.TRUE);
|
|
28
|
-
strict.shouldPass('stripInternal', validator_1.Match.optional(validator_1.Match.FALSE));
|
|
29
|
-
strict.shouldPass('noEmitOnError', validator_1.Match.TRUE);
|
|
30
|
-
// Deprecated ts options that should not be used with jsii
|
|
31
|
-
strict.import(deprecated_options_1.default);
|
|
32
|
-
exports.default = strict;
|
|
33
|
-
//# sourceMappingURL=strict.public.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strict.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/strict.public.ts"],"names":[],"mappings":";;AAAA,iEAAyD;AACzD,6DAAqD;AACrD,iEAAyD;AACzD,mEAA0D;AAC1D,4CAAwD;AAExD,yEAAyE;AACzE,+FAA+F;AAC/F,8HAA8H;AAC9H,0DAA0D;AAC1D,MAAM,MAAM,GAAG,IAAI,mBAAO,CAAC;IACzB,gBAAgB,EAAE,oBAAQ,CAAC,IAAI;CAChC,CAAC,CAAC;AAEH,2CAA2C;AAC3C,MAAM,CAAC,MAAM,CAAC,8BAAmB,CAAC,CAAC;AAEnC,sDAAsD;AACtD,MAAM,CAAC,MAAM,CAAC,8BAAmB,CAAC,CAAC;AAEnC,wBAAwB;AACxB,MAAM,CAAC,MAAM,CAAC,+BAAmB,CAAC,CAAC;AAEnC,sBAAsB;AACtB,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;AAC1D,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,iBAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;AAC5D,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAC/D,MAAM,CAAC,UAAU,CAAC,kBAAkB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACrF,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AACjD,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AAC9C,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAChE,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,CAAC,4BAAiB,CAAC,CAAC;AAEjC,kBAAe,MAAM,CAAC","sourcesContent":["import configurableOptions from './configurable-options';\nimport deprecatedOptions from './deprecated-options';\nimport incompatibleOptions from './incompatible-options';\nimport strictFamilyOptions from './strict-family-options';\nimport { Match, RuleSet, RuleType } from '../validator';\n\n// The public rule set used for the \"strict\" tsconfig validation setting.\n// The goal of this rule set is to ensure a tsconfig that is following best practices for jsii.\n// In practice, this is a combination of known incompatible options, known configurable options and additional best practices.\n// The rule set also explicitly disallows unknown options.\nconst strict = new RuleSet({\n unexpectedFields: RuleType.FAIL,\n});\n\n// import all options that are configurable\nstrict.import(configurableOptions);\n\n// import all options that are definitely incompatible\nstrict.import(incompatibleOptions);\n\n// strict family options\nstrict.import(strictFamilyOptions);\n\n// Best practice rules\nstrict.shouldPass('target', Match.eq('es2022')); // node18\nstrict.shouldPass('lib', Match.arrEq(['es2022'])); // node18\nstrict.shouldPass('module', Match.oneOf('node16', 'commonjs'));\nstrict.shouldPass('moduleResolution', Match.optional(Match.oneOf('node', 'node16')));\nstrict.shouldPass('esModuleInterop', Match.TRUE);\nstrict.shouldPass('skipLibCheck', Match.TRUE);\nstrict.shouldPass('stripInternal', Match.optional(Match.FALSE));\nstrict.shouldPass('noEmitOnError', Match.TRUE);\n\n// Deprecated ts options that should not be used with jsii\nstrict.import(deprecatedOptions);\n\nexport default strict;\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from '.';
|
|
2
|
-
export declare class TypeScriptConfigValidator {
|
|
3
|
-
ruleSet: TypeScriptConfigValidationRuleSet;
|
|
4
|
-
private readonly validator;
|
|
5
|
-
private readonly compilerOptions;
|
|
6
|
-
constructor(ruleSet: TypeScriptConfigValidationRuleSet);
|
|
7
|
-
/**
|
|
8
|
-
* Validated the provided config against the set of rules.
|
|
9
|
-
*
|
|
10
|
-
* @throws when the config is invalid
|
|
11
|
-
*
|
|
12
|
-
* @param tsconfig the tsconfig to be validated, this MUST be a tsconfig as a user would have written it in tsconfig.
|
|
13
|
-
*/
|
|
14
|
-
validate(tsconfig: TypeScriptConfig): void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=tsconfig-validator.d.ts.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeScriptConfigValidator = void 0;
|
|
4
|
-
const generated_public_1 = require("./rulesets/generated.public");
|
|
5
|
-
const minimal_public_1 = require("./rulesets/minimal.public");
|
|
6
|
-
const strict_public_1 = require("./rulesets/strict.public");
|
|
7
|
-
const validator_1 = require("./validator");
|
|
8
|
-
const RuleSets = {
|
|
9
|
-
generated: generated_public_1.default,
|
|
10
|
-
strict: strict_public_1.default,
|
|
11
|
-
minimal: minimal_public_1.default,
|
|
12
|
-
off: new validator_1.RuleSet(),
|
|
13
|
-
};
|
|
14
|
-
class TypeScriptConfigValidator {
|
|
15
|
-
constructor(ruleSet) {
|
|
16
|
-
this.ruleSet = ruleSet;
|
|
17
|
-
const topLevelRules = new validator_1.RuleSet({
|
|
18
|
-
unexpectedFields: validator_1.RuleType.PASS,
|
|
19
|
-
});
|
|
20
|
-
topLevelRules.shouldPass('files', validator_1.Match.ANY);
|
|
21
|
-
topLevelRules.shouldPass('extends', validator_1.Match.ANY);
|
|
22
|
-
topLevelRules.shouldPass('include', validator_1.Match.ANY);
|
|
23
|
-
topLevelRules.shouldPass('exclude', validator_1.Match.ANY);
|
|
24
|
-
topLevelRules.shouldPass('references', validator_1.Match.ANY);
|
|
25
|
-
topLevelRules.shouldPass('watchOptions', validator_1.Match.ANY);
|
|
26
|
-
topLevelRules.shouldPass('typeAcquisition', validator_1.Match.MISSING);
|
|
27
|
-
this.compilerOptions = new validator_1.ObjectValidator(RuleSets[ruleSet], 'compilerOptions');
|
|
28
|
-
topLevelRules.shouldPass('compilerOptions', (compilerOptions) => {
|
|
29
|
-
this.compilerOptions.validate(compilerOptions);
|
|
30
|
-
return true;
|
|
31
|
-
});
|
|
32
|
-
this.validator = new validator_1.ObjectValidator(topLevelRules, 'tsconfig');
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Validated the provided config against the set of rules.
|
|
36
|
-
*
|
|
37
|
-
* @throws when the config is invalid
|
|
38
|
-
*
|
|
39
|
-
* @param tsconfig the tsconfig to be validated, this MUST be a tsconfig as a user would have written it in tsconfig.
|
|
40
|
-
*/
|
|
41
|
-
validate(tsconfig) {
|
|
42
|
-
this.validator.validate(tsconfig);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.TypeScriptConfigValidator = TypeScriptConfigValidator;
|
|
46
|
-
//# sourceMappingURL=tsconfig-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-validator.js","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-validator.ts"],"names":[],"mappings":";;;AACA,kEAAoD;AACpD,8DAAg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AC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,QAA0B;QACxC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF;AAnCD,8DAmCC","sourcesContent":["import { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from '.';\nimport generated from './rulesets/generated.public';\nimport minimal from './rulesets/minimal.public';\nimport strict from './rulesets/strict.public';\nimport { Match, ObjectValidator, RuleSet, RuleType } from './validator';\n\nconst RuleSets: {\n [name in TypeScriptConfigValidationRuleSet]: RuleSet;\n} = {\n generated,\n strict,\n minimal,\n off: new RuleSet(),\n};\n\nexport class TypeScriptConfigValidator {\n private readonly validator: ObjectValidator;\n private readonly compilerOptions: ObjectValidator;\n\n public constructor(public ruleSet: TypeScriptConfigValidationRuleSet) {\n const topLevelRules = new RuleSet({\n unexpectedFields: RuleType.PASS,\n });\n topLevelRules.shouldPass('files', Match.ANY);\n topLevelRules.shouldPass('extends', Match.ANY);\n topLevelRules.shouldPass('include', Match.ANY);\n topLevelRules.shouldPass('exclude', Match.ANY);\n topLevelRules.shouldPass('references', Match.ANY);\n topLevelRules.shouldPass('watchOptions', Match.ANY);\n topLevelRules.shouldPass('typeAcquisition', Match.MISSING);\n\n this.compilerOptions = new ObjectValidator(RuleSets[ruleSet], 'compilerOptions');\n topLevelRules.shouldPass('compilerOptions', (compilerOptions) => {\n this.compilerOptions.validate(compilerOptions);\n return true;\n });\n\n this.validator = new ObjectValidator(topLevelRules, 'tsconfig');\n }\n\n /**\n * Validated the provided config against the set of rules.\n *\n * @throws when the config is invalid\n *\n * @param tsconfig the tsconfig to be validated, this MUST be a tsconfig as a user would have written it in tsconfig.\n */\n public validate(tsconfig: TypeScriptConfig) {\n this.validator.validate(tsconfig);\n }\n}\n"]}
|