jsii 6.0.22-dev.0 → 7.1.0-dev.1

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.
Files changed (107) hide show
  1. package/lib/assembler.d.ts +254 -196
  2. package/lib/assembler.js +2105 -2327
  3. package/lib/assembler.js.map +1 -1
  4. package/lib/case.js.map +1 -1
  5. package/lib/common/find-utils.js.map +1 -1
  6. package/lib/common/index.d.ts +1 -1
  7. package/lib/common/index.js +2 -1
  8. package/lib/common/index.js.map +1 -1
  9. package/lib/common/symbol-id.d.ts +23 -4
  10. package/lib/common/symbol-id.js +13 -9
  11. package/lib/common/symbol-id.js.map +1 -1
  12. package/lib/compiler-host.d.ts +60 -0
  13. package/lib/compiler-host.js +201 -0
  14. package/lib/compiler-host.js.map +1 -0
  15. package/lib/compiler.d.ts +74 -62
  16. package/lib/compiler.js +332 -254
  17. package/lib/compiler.js.map +1 -1
  18. package/lib/diagnostic.d.ts +34 -0
  19. package/lib/diagnostic.js +141 -0
  20. package/lib/diagnostic.js.map +1 -0
  21. package/lib/emitter.d.ts +40 -10
  22. package/lib/emitter.js +188 -0
  23. package/lib/emitter.js.map +1 -1
  24. package/lib/helpers.d.ts +1 -1
  25. package/lib/helpers.js +2 -2
  26. package/lib/helpers.js.map +1 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib/jsii-diagnostic.d.ts +27 -22
  29. package/lib/jsii-diagnostic.js +22 -38
  30. package/lib/jsii-diagnostic.js.map +1 -1
  31. package/lib/literate.js.map +1 -1
  32. package/lib/main.js +3 -2
  33. package/lib/main.js.map +1 -1
  34. package/lib/project-info.d.ts +23 -4
  35. package/lib/project-info.js +5 -5
  36. package/lib/project-info.js.map +1 -1
  37. package/lib/support-types.d.ts +2 -0
  38. package/lib/support-types.js +3 -0
  39. package/lib/support-types.js.map +1 -0
  40. package/lib/support.js.map +1 -1
  41. package/lib/tsconfig/compiler-options.d.ts +12 -46
  42. package/lib/tsconfig/compiler-options.js +45 -87
  43. package/lib/tsconfig/compiler-options.js.map +1 -1
  44. package/lib/tsconfig/index.d.ts +24 -5
  45. package/lib/tsconfig/index.js.map +1 -1
  46. package/lib/tsconfig/read.d.ts +15 -0
  47. package/lib/tsconfig/read.js +196 -0
  48. package/lib/tsconfig/read.js.map +1 -0
  49. package/lib/tsconfig/rule-set-format.js.map +1 -1
  50. package/lib/tsconfig/rulesets/configurable-options.js.map +1 -1
  51. package/lib/tsconfig/rulesets/deprecated-options.js.map +1 -1
  52. package/lib/tsconfig/rulesets/generated.public.js.map +1 -1
  53. package/lib/tsconfig/rulesets/incompatible-options.js.map +1 -1
  54. package/lib/tsconfig/rulesets/jsii-configured-options.js.map +1 -1
  55. package/lib/tsconfig/rulesets/minimal.public.js.map +1 -1
  56. package/lib/tsconfig/rulesets/strict-family-options.js.map +1 -1
  57. package/lib/tsconfig/rulesets/strict.public.js.map +1 -1
  58. package/lib/tsconfig/tsconfig-validator.js +2 -50
  59. package/lib/tsconfig/tsconfig-validator.js.map +1 -1
  60. package/lib/tsconfig/validator.js.map +1 -1
  61. package/lib/type-analysis.js.map +1 -1
  62. package/lib/type-reference.js.map +1 -1
  63. package/lib/type-visitor.js.map +1 -1
  64. package/lib/utils.d.ts +6 -6
  65. package/lib/utils.js +8 -13
  66. package/lib/utils.js.map +1 -1
  67. package/lib/version.d.ts +3 -3
  68. package/lib/version.js +4 -4
  69. package/lib/version.js.map +1 -1
  70. package/lib/warnings.d.ts +2 -2
  71. package/lib/warnings.js +3 -77
  72. package/lib/warnings.js.map +1 -1
  73. package/package.json +15 -11
  74. package/scripts/ts7-compare-jsii.mjs +101 -0
  75. package/lib/directives.d.ts +0 -24
  76. package/lib/directives.js +0 -139
  77. package/lib/directives.js.map +0 -1
  78. package/lib/docs.d.ts +0 -64
  79. package/lib/docs.js +0 -293
  80. package/lib/docs.js.map +0 -1
  81. package/lib/node-bindings.d.ts +0 -19
  82. package/lib/node-bindings.js +0 -49
  83. package/lib/node-bindings.js.map +0 -1
  84. package/lib/reserved-words.d.ts +0 -6
  85. package/lib/reserved-words.js +0 -258
  86. package/lib/reserved-words.js.map +0 -1
  87. package/lib/sets.d.ts +0 -16
  88. package/lib/sets.js +0 -41
  89. package/lib/sets.js.map +0 -1
  90. package/lib/transforms/deprecated-remover.d.ts +0 -44
  91. package/lib/transforms/deprecated-remover.js +0 -545
  92. package/lib/transforms/deprecated-remover.js.map +0 -1
  93. package/lib/transforms/deprecation-warnings.d.ts +0 -37
  94. package/lib/transforms/deprecation-warnings.js +0 -616
  95. package/lib/transforms/deprecation-warnings.js.map +0 -1
  96. package/lib/transforms/runtime-info.d.ts +0 -39
  97. package/lib/transforms/runtime-info.js +0 -128
  98. package/lib/transforms/runtime-info.js.map +0 -1
  99. package/lib/transforms/utils.d.ts +0 -11
  100. package/lib/transforms/utils.js +0 -31
  101. package/lib/transforms/utils.js.map +0 -1
  102. package/lib/type-tracker.d.ts +0 -13
  103. package/lib/type-tracker.js +0 -67
  104. package/lib/type-tracker.js.map +0 -1
  105. package/lib/validator.d.ts +0 -19
  106. package/lib/validator.js +0 -602
  107. package/lib/validator.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import type { TypeScriptConfig } from './index';
2
+ /**
3
+ * Parses a `tsconfig.json` document. TypeScript accepts comments and trailing
4
+ * commas in these files, so plain `JSON.parse` is not enough.
5
+ */
6
+ export declare function parseTsconfigJson(text: string, fileName: string): any;
7
+ /**
8
+ * Reads a `tsconfig.json` file and resolves its `extends` chain, returning the
9
+ * effective configuration in its JSON form (the form the rule-set validator
10
+ * operates on). Options of the extending file win over the extended ones;
11
+ * `files` / `include` / `exclude` come from the nearest file that sets them,
12
+ * with relative paths rebased onto the directory of the requested file.
13
+ */
14
+ export declare function readTypeScriptConfigFile(configPath: string): TypeScriptConfig;
15
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.parseTsconfigJson = parseTsconfigJson;
37
+ exports.readTypeScriptConfigFile = readTypeScriptConfigFile;
38
+ const fs = __importStar(require("node:fs"));
39
+ const node_module_1 = require("node:module");
40
+ const path = __importStar(require("node:path"));
41
+ const compiler_options_1 = require("./compiler-options");
42
+ const utils_1 = require("../utils");
43
+ /**
44
+ * Parses a `tsconfig.json` document. TypeScript accepts comments and trailing
45
+ * commas in these files, so plain `JSON.parse` is not enough.
46
+ */
47
+ function parseTsconfigJson(text, fileName) {
48
+ try {
49
+ return JSON.parse(stripJsonComments(text));
50
+ }
51
+ catch (e) {
52
+ throw new utils_1.JsiiError(`Failed to parse "${fileName}": ${e.message}`);
53
+ }
54
+ }
55
+ function stripJsonComments(text) {
56
+ let out = '';
57
+ let i = 0;
58
+ while (i < text.length) {
59
+ const ch = text[i];
60
+ if (ch === '"') {
61
+ // copy the string literal verbatim
62
+ let j = i + 1;
63
+ while (j < text.length && text[j] !== '"') {
64
+ if (text[j] === '\\') {
65
+ j++;
66
+ }
67
+ j++;
68
+ }
69
+ out += text.slice(i, j + 1);
70
+ i = j + 1;
71
+ }
72
+ else if (ch === '/' && text[i + 1] === '/') {
73
+ while (i < text.length && text[i] !== '\n') {
74
+ i++;
75
+ }
76
+ }
77
+ else if (ch === '/' && text[i + 1] === '*') {
78
+ const end = text.indexOf('*/', i + 2);
79
+ i = end === -1 ? text.length : end + 2;
80
+ }
81
+ else {
82
+ out += ch;
83
+ i++;
84
+ }
85
+ }
86
+ // trailing commas before a closing bracket/brace
87
+ return out.replace(/,(\s*[}\]])/g, '$1');
88
+ }
89
+ /**
90
+ * Reads a `tsconfig.json` file and resolves its `extends` chain, returning the
91
+ * effective configuration in its JSON form (the form the rule-set validator
92
+ * operates on). Options of the extending file win over the extended ones;
93
+ * `files` / `include` / `exclude` come from the nearest file that sets them,
94
+ * with relative paths rebased onto the directory of the requested file.
95
+ */
96
+ function readTypeScriptConfigFile(configPath) {
97
+ const absolutePath = path.resolve(configPath);
98
+ const seen = new Set();
99
+ const result = readOne(absolutePath, seen, path.dirname(absolutePath));
100
+ delete result.extends;
101
+ return { ...result, compilerOptions: (0, compiler_options_1.convertForJson)(result.compilerOptions) };
102
+ }
103
+ function readOne(absolutePath, seen, targetDir) {
104
+ if (seen.has(absolutePath)) {
105
+ throw new utils_1.JsiiError(`Circular "extends" in tsconfig: ${absolutePath}`);
106
+ }
107
+ seen.add(absolutePath);
108
+ let text;
109
+ try {
110
+ text = fs.readFileSync(absolutePath, 'utf8');
111
+ }
112
+ catch (e) {
113
+ throw new utils_1.JsiiError(`Failed to read tsconfig at "${absolutePath}": ${e.message}`);
114
+ }
115
+ const own = parseTsconfigJson(text, absolutePath) ?? {};
116
+ const ownDir = path.dirname(absolutePath);
117
+ let merged = { compilerOptions: {} };
118
+ const bases = own.extends == null ? [] : Array.isArray(own.extends) ? own.extends : [own.extends];
119
+ for (const base of bases) {
120
+ const resolved = resolveExtends(base, ownDir);
121
+ const baseConfig = readOne(resolved, new Set(seen), targetDir);
122
+ merged = mergeConfigs(merged, baseConfig);
123
+ }
124
+ const ownRebased = {
125
+ ...own,
126
+ compilerOptions: rebaseCompilerOptions(own.compilerOptions ?? {}, ownDir, targetDir),
127
+ ...(own.files ? { files: own.files.map((f) => rebase(f, ownDir, targetDir)) } : {}),
128
+ ...(own.include ? { include: own.include.map((f) => rebase(f, ownDir, targetDir)) } : {}),
129
+ ...(own.exclude ? { exclude: own.exclude.map((f) => rebase(f, ownDir, targetDir)) } : {}),
130
+ };
131
+ return mergeConfigs(merged, ownRebased);
132
+ }
133
+ function mergeConfigs(base, override) {
134
+ return {
135
+ ...base,
136
+ ...override,
137
+ compilerOptions: { ...base.compilerOptions, ...override.compilerOptions },
138
+ ...(base.watchOptions || override.watchOptions
139
+ ? { watchOptions: { ...base.watchOptions, ...override.watchOptions } }
140
+ : {}),
141
+ };
142
+ }
143
+ const PATH_OPTIONS = new Set(['outDir', 'rootDir', 'baseUrl', 'declarationDir', 'tsBuildInfoFile', 'outFile']);
144
+ const PATH_LIST_OPTIONS = new Set(['rootDirs', 'typeRoots']);
145
+ function rebaseCompilerOptions(options, fromDir, toDir) {
146
+ if (fromDir === toDir) {
147
+ return { ...options };
148
+ }
149
+ const out = {};
150
+ for (const [key, value] of Object.entries(options)) {
151
+ if (PATH_OPTIONS.has(key) && typeof value === 'string') {
152
+ out[key] = rebase(value, fromDir, toDir);
153
+ }
154
+ else if (PATH_LIST_OPTIONS.has(key) && Array.isArray(value)) {
155
+ out[key] = value.map((v) => (typeof v === 'string' ? rebase(v, fromDir, toDir) : v));
156
+ }
157
+ else {
158
+ out[key] = value;
159
+ }
160
+ }
161
+ return out;
162
+ }
163
+ function rebase(p, fromDir, toDir) {
164
+ if (path.isAbsolute(p)) {
165
+ return p;
166
+ }
167
+ const rel = path.relative(toDir, path.resolve(fromDir, p));
168
+ return rel.split(path.sep).join('/');
169
+ }
170
+ function resolveExtends(spec, fromDir) {
171
+ if (spec.startsWith('.') || path.isAbsolute(spec)) {
172
+ const candidate = path.resolve(fromDir, spec);
173
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
174
+ return candidate;
175
+ }
176
+ if (fs.existsSync(`${candidate}.json`)) {
177
+ return `${candidate}.json`;
178
+ }
179
+ if (fs.existsSync(path.join(candidate, 'tsconfig.json'))) {
180
+ return path.join(candidate, 'tsconfig.json');
181
+ }
182
+ throw new utils_1.JsiiError(`Cannot resolve "extends": "${spec}" from ${fromDir}`);
183
+ }
184
+ const req = (0, node_module_1.createRequire)(path.join(fromDir, 'package.json'));
185
+ const attempts = [spec, `${spec}.json`, `${spec}/tsconfig.json`];
186
+ for (const attempt of attempts) {
187
+ try {
188
+ return req.resolve(attempt);
189
+ }
190
+ catch {
191
+ /* try the next shape */
192
+ }
193
+ }
194
+ throw new utils_1.JsiiError(`Cannot resolve "extends": "${spec}" from ${fromDir}`);
195
+ }
196
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sources":["../../src/tsconfig/read.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,EAAE,oCAAgB;AAC9B,6CAA4C;AAC5C,MAAY,IAAI,sCAAkB;AAElC,yDAAoD;AAEpD,oCAAqC;AAErC;;;GAGG;AACH,2BAAkC,IAAY,EAAE,QAAgB;IAC9D,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,MAAM,IAAI,iBAAS,CAAC,oBAAoB,QAAQ,MAAM,CAAC,CAAC,OAAO,EA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,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YAChE,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,SAAS,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO,GAAG,SAAS,OAAO,CAAC;QAC7B,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,IAAI,iBAAS,CAAC,8BAA8B,IAAI,UAAU,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,MAAM,GAAG,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC;IACjE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;IACD,MAAM,IAAI,iBAAS,CAAC,8BAA8B,IAAI,UAAU,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport * as path from 'node:path';\n\nimport { convertForJson } from './compiler-options';\nimport type { CompilerOptionsJson, TypeScriptConfig } from './index';\nimport { JsiiError } from '../utils';\n\n/**\n * Parses a `tsconfig.json` document. TypeScript accepts comments and trailing\n * commas in these files, so plain `JSON.parse` is not enough.\n */\nexport function parseTsconfigJson(text: string, fileName: string): any {\n try {\n return JSON.parse(stripJsonComments(text));\n } catch (e: any) {\n throw new JsiiError(`Failed to parse \"${fileName}\": ${e.message}`);\n }\n}\n\nfunction stripJsonComments(text: string): string {\n let out = '';\n let i = 0;\n while (i < text.length) {\n const ch = text[i];\n if (ch === '\"') {\n // copy the string literal verbatim\n let j = i + 1;\n while (j < text.length && text[j] !== '\"') {\n if (text[j] === '\\\\') {\n j++;\n }\n j++;\n }\n out += text.slice(i, j + 1);\n i = j + 1;\n } else if (ch === '/' && text[i + 1] === '/') {\n while (i < text.length && text[i] !== '\\n') {\n i++;\n }\n } else if (ch === '/' && text[i + 1] === '*') {\n const end = text.indexOf('*/', i + 2);\n i = end === -1 ? text.length : end + 2;\n } else {\n out += ch;\n i++;\n }\n }\n // trailing commas before a closing bracket/brace\n return out.replace(/,(\\s*[}\\]])/g, '$1');\n}\n\n/**\n * Reads a `tsconfig.json` file and resolves its `extends` chain, returning the\n * effective configuration in its JSON form (the form the rule-set validator\n * operates on). Options of the extending file win over the extended ones;\n * `files` / `include` / `exclude` come from the nearest file that sets them,\n * with relative paths rebased onto the directory of the requested file.\n */\nexport function readTypeScriptConfigFile(configPath: string): TypeScriptConfig {\n const absolutePath = path.resolve(configPath);\n const seen = new Set<string>();\n const result = readOne(absolutePath, seen, path.dirname(absolutePath));\n delete (result as any).extends;\n return { ...result, compilerOptions: convertForJson(result.compilerOptions) };\n}\n\nfunction readOne(absolutePath: string, seen: Set<string>, targetDir: string): TypeScriptConfig {\n if (seen.has(absolutePath)) {\n throw new JsiiError(`Circular \"extends\" in tsconfig: ${absolutePath}`);\n }\n seen.add(absolutePath);\n let text: string;\n try {\n text = fs.readFileSync(absolutePath, 'utf8');\n } catch (e: any) {\n throw new JsiiError(`Failed to read tsconfig at \"${absolutePath}\": ${e.message}`);\n }\n const own = parseTsconfigJson(text, absolutePath) ?? {};\n const ownDir = path.dirname(absolutePath);\n\n let merged: TypeScriptConfig = { compilerOptions: {} };\n const bases: string[] = own.extends == null ? [] : Array.isArray(own.extends) ? own.extends : [own.extends];\n for (const base of bases) {\n const resolved = resolveExtends(base, ownDir);\n const baseConfig = readOne(resolved, new Set(seen), targetDir);\n merged = mergeConfigs(merged, baseConfig);\n }\n\n const ownRebased: TypeScriptConfig = {\n ...own,\n compilerOptions: rebaseCompilerOptions(own.compilerOptions ?? {}, ownDir, targetDir),\n ...(own.files ? { files: own.files.map((f: string) => rebase(f, ownDir, targetDir)) } : {}),\n ...(own.include ? { include: own.include.map((f: string) => rebase(f, ownDir, targetDir)) } : {}),\n ...(own.exclude ? { exclude: own.exclude.map((f: string) => rebase(f, ownDir, targetDir)) } : {}),\n };\n return mergeConfigs(merged, ownRebased);\n}\n\nfunction mergeConfigs(base: TypeScriptConfig, override: TypeScriptConfig): TypeScriptConfig {\n return {\n ...base,\n ...override,\n compilerOptions: { ...base.compilerOptions, ...override.compilerOptions },\n ...(base.watchOptions || override.watchOptions\n ? { watchOptions: { ...base.watchOptions, ...override.watchOptions } }\n : {}),\n };\n}\n\nconst PATH_OPTIONS = new Set(['outDir', 'rootDir', 'baseUrl', 'declarationDir', 'tsBuildInfoFile', 'outFile']);\nconst PATH_LIST_OPTIONS = new Set(['rootDirs', 'typeRoots']);\n\nfunction rebaseCompilerOptions(options: CompilerOptionsJson, fromDir: string, toDir: string): CompilerOptionsJson {\n if (fromDir === toDir) {\n return { ...options };\n }\n const out: CompilerOptionsJson = {};\n for (const [key, value] of Object.entries(options)) {\n if (PATH_OPTIONS.has(key) && typeof value === 'string') {\n out[key] = rebase(value, fromDir, toDir);\n } else if (PATH_LIST_OPTIONS.has(key) && Array.isArray(value)) {\n out[key] = value.map((v) => (typeof v === 'string' ? rebase(v, fromDir, toDir) : v));\n } else {\n out[key] = value;\n }\n }\n return out;\n}\n\nfunction rebase(p: string, fromDir: string, toDir: string): string {\n if (path.isAbsolute(p)) {\n return p;\n }\n const rel = path.relative(toDir, path.resolve(fromDir, p));\n return rel.split(path.sep).join('/');\n}\n\nfunction resolveExtends(spec: string, fromDir: string): string {\n if (spec.startsWith('.') || path.isAbsolute(spec)) {\n const candidate = path.resolve(fromDir, spec);\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n if (fs.existsSync(`${candidate}.json`)) {\n return `${candidate}.json`;\n }\n if (fs.existsSync(path.join(candidate, 'tsconfig.json'))) {\n return path.join(candidate, 'tsconfig.json');\n }\n throw new JsiiError(`Cannot resolve \"extends\": \"${spec}\" from ${fromDir}`);\n }\n const req = createRequire(path.join(fromDir, 'package.json'));\n const attempts = [spec, `${spec}.json`, `${spec}/tsconfig.json`];\n for (const attempt of attempts) {\n try {\n return req.resolve(attempt);\n } catch {\n /* try the next shape */\n }\n }\n throw new JsiiError(`Cannot resolve \"extends\": \"${spec}\" from ${fromDir}`);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rule-set-format.js","sourceRoot":"","sources":["../../src/tsconfig/rule-set-format.ts"],"names":[],"mappings":";;;;;;AA8BA,sCAyCC;AAQD,4CAkBC;AASD,0CAGC;AA7GD,kDAA0B;AAC1B,wBAAsD;AACtD,6DAAkF;AAClF,2CAAwD;AAExD;;;;;GAKG;AACU,QAAA,qBAAqB,GAE9B;IACF,CAAC,oCAAiC,CAAC,MAAM,CAAC,EACxC,uGAAuG;IACzG,CAAC,oCAAiC,CAAC,SAAS,CAAC,EAC3C,oJAAoJ;IACtJ,CAAC,oCAAiC,CAAC,OAAO,CAAC,EACzC,oLAAoL;IACtL,CAAC,oCAAiC,CAAC,IAAI,CAAC,EACtC,yJAAyJ;CAC5J,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAA0C;IACtE,MAAM,KAAK,GAAa,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE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E,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC;QAChE,OAAO,eAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9C,IAAI,IAAI,KAAK,oBAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,uBAAuB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9G,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,KAAU;IACxC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1E,OAAO,eAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { TypeScriptConfigValidationRuleSet } from '.';\nimport { describeRuleSet, getCompilerOptionsRuleSet } from './tsconfig-validator';\nimport { RuleDescription, RuleType } from './validator';\n\n/**\n * Human-readable descriptions for each tsconfig validation rule set.\n *\n * These are surfaced both as CLI option help (e.g. for `--validate-tsconfig` and\n * `--rule-set`) and as the heading when printing a rule set via `formatRuleSet`.\n */\nexport const RULE_SET_DESCRIPTIONS: {\n [choice in TypeScriptConfigValidationRuleSet]: string;\n} = {\n [TypeScriptConfigValidationRuleSet.STRICT]:\n 'Validates the provided config against a strict rule set designed for maximum backwards-compatibility.',\n [TypeScriptConfigValidationRuleSet.GENERATED]:\n 'Enforces a config as created by --generate-tsconfig. Use this to stay compatible with the generated config, but have full ownership over the file.',\n [TypeScriptConfigValidationRuleSet.MINIMAL]:\n 'Only enforce options that are known to be incompatible with jsii. This rule set is likely to be incomplete and new rules will be added without notice as incompatibilities emerge.',\n [TypeScriptConfigValidationRuleSet.NONE]:\n 'Disables all config validation, including options that are known to be incompatible with jsii. Intended for experimentation only. Use at your own risk.',\n};\n\n/**\n * Render a single rule set (its `compilerOptions` rules) as a human-readable block.\n *\n * @param ruleSet the rule set to render\n * @returns a multi-line string suitable for printing to the console\n */\nexport function formatRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): string {\n const lines: string[] = [`${chalk.bold('Rule set:')} ${chalk.bold.cyan(ruleSet)}`];\n\n const description = RULE_SET_DESCRIPTIONS[ruleSet];\n if (description) {\n lines.push(chalk.dim(description));\n }\n\n const rules = describeRuleSet(ruleSet);\n if (rules.length === 0) {\n lines.push('');\n lines.push(chalk.dim(' No rules. Configuration validation is disabled for this rule set.'));\n return lines.join('\\n');\n }\n\n const unknownRejected = getCompilerOptionsRuleSet(ruleSet).options.unexpectedFields === RuleType.FAIL;\n lines.push('');\n lines.push(chalk.dim(`Applies to: compilerOptions (other options: ${unknownRejected ? 'rejected' : 'allowed'})`));\n lines.push('');\n\n // Group rules by field, preserving the order in which each field first appears.\n const byField = new Map<string, RuleDescription[]>();\n for (const rule of rules) {\n const list = byField.get(rule.field) ?? [];\n list.push(rule);\n byField.set(rule.field, list);\n }\n\n const width = Math.max(...[...byField.keys()].map((field) => field.length));\n for (const [field, fieldRules] of byField) {\n const phrases = fieldRules.map(formatConstraint);\n // A required field is surfaced as an explicit \"required\" constraint at the front.\n if (fieldRules.some((rule) => rule.required)) {\n phrases.unshift(chalk.italic('required'));\n }\n // Dedupe identical phrases (some fields are constrained by several rules that overlap).\n const constraints = [...new Set(phrases)].join('; ');\n lines.push(` ${chalk.bold(field.padEnd(width))} ${constraints}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Render a single rule's constraint as a human-readable phrase.\n *\n * @param rule the rule description to render\n * @returns a phrase such as `must be one of: es2022, es2023` or `not allowed`\n */\nexport function formatConstraint(rule: RuleDescription): string {\n const { type, values } = rule;\n\n // No hints means the matcher accepts anything (e.g. Match.ANY).\n if (values === undefined) {\n return type === RuleType.PASS ? chalk.italic('any value') : 'must not be set to the matched value';\n }\n\n // Only null/undefined hints means the option must be absent (e.g. Match.MISSING).\n if (values.length > 0 && values.every((value) => value == null)) {\n return chalk.italic('not allowed');\n }\n\n const formatted = values.map(formatRuleValue);\n if (type === RuleType.FAIL) {\n return formatted.length > 1 ? `must not be one of: ${formatted.join(', ')}` : `must not be ${formatted[0]}`;\n }\n return formatted.length > 1 ? `must be one of: ${formatted.join(', ')}` : `must be ${formatted[0]}`;\n}\n\n/**\n * Render a single hinted value as a highlighted code literal. Strings are shown\n * verbatim (as a user writes them in tsconfig.json), everything else is JSON-encoded.\n *\n * @param value the hinted value to render\n * @returns the value as a (possibly colorized) code literal\n */\nexport function formatRuleValue(value: any): string {\n const literal = typeof value === 'string' ? value : JSON.stringify(value);\n return chalk.cyan(literal);\n}\n"]}
1
+ {"version":3,"file":"rule-set-format.js","sources":["../../src/tsconfig/rule-set-format.ts"],"names":[],"mappings":";;;;;;;;;AAAA,kDAA0B;AAC1B,wBAAsD;AACtD,6DAAkF;AAClF,2CAAwD;AAExD;;;;;GAKG;AACU,QAAA,qBAAqB,GAE9B;IACF,CAAC,oCAAiC,CAAC,MAAM,CAAC,EACxC,uGAAuG;IACzG,CAAC,oCAAiC,CAAC,SAAS,CAAC,EAC3C,oJAAoJ;IACtJ,CAAC,oCAAiC,CAAC,OAAO,CAAC,EACzC,oLAAoL;IACtL,CAAC,oCAAiC,CAAC,IAAI,CAAC,EACtC,yJAAyJ;CAC5J,CAAC;AAEF;;;;;GAKG;AACH,uBAA8B,OAA0C;IACtE,MAAM,KAAK,GA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C;IAED,kFAAkF;IAClF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC;QAChE,OAAO,eAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9C,IAAI,IAAI,KAAK,oBAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,uBAAuB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9G,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,CAAC;AAED;;;;;;GAMG;AACH,yBAAgC,KAAU;IACxC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1E,OAAO,eAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { TypeScriptConfigValidationRuleSet } from '.';\nimport { describeRuleSet, getCompilerOptionsRuleSet } from './tsconfig-validator';\nimport { RuleDescription, RuleType } from './validator';\n\n/**\n * Human-readable descriptions for each tsconfig validation rule set.\n *\n * These are surfaced both as CLI option help (e.g. for `--validate-tsconfig` and\n * `--rule-set`) and as the heading when printing a rule set via `formatRuleSet`.\n */\nexport const RULE_SET_DESCRIPTIONS: {\n [choice in TypeScriptConfigValidationRuleSet]: string;\n} = {\n [TypeScriptConfigValidationRuleSet.STRICT]:\n 'Validates the provided config against a strict rule set designed for maximum backwards-compatibility.',\n [TypeScriptConfigValidationRuleSet.GENERATED]:\n 'Enforces a config as created by --generate-tsconfig. Use this to stay compatible with the generated config, but have full ownership over the file.',\n [TypeScriptConfigValidationRuleSet.MINIMAL]:\n 'Only enforce options that are known to be incompatible with jsii. This rule set is likely to be incomplete and new rules will be added without notice as incompatibilities emerge.',\n [TypeScriptConfigValidationRuleSet.NONE]:\n 'Disables all config validation, including options that are known to be incompatible with jsii. Intended for experimentation only. Use at your own risk.',\n};\n\n/**\n * Render a single rule set (its `compilerOptions` rules) as a human-readable block.\n *\n * @param ruleSet the rule set to render\n * @returns a multi-line string suitable for printing to the console\n */\nexport function formatRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): string {\n const lines: string[] = [`${chalk.bold('Rule set:')} ${chalk.bold.cyan(ruleSet)}`];\n\n const description = RULE_SET_DESCRIPTIONS[ruleSet];\n if (description) {\n lines.push(chalk.dim(description));\n }\n\n const rules = describeRuleSet(ruleSet);\n if (rules.length === 0) {\n lines.push('');\n lines.push(chalk.dim(' No rules. Configuration validation is disabled for this rule set.'));\n return lines.join('\\n');\n }\n\n const unknownRejected = getCompilerOptionsRuleSet(ruleSet).options.unexpectedFields === RuleType.FAIL;\n lines.push('');\n lines.push(chalk.dim(`Applies to: compilerOptions (other options: ${unknownRejected ? 'rejected' : 'allowed'})`));\n lines.push('');\n\n // Group rules by field, preserving the order in which each field first appears.\n const byField = new Map<string, RuleDescription[]>();\n for (const rule of rules) {\n const list = byField.get(rule.field) ?? [];\n list.push(rule);\n byField.set(rule.field, list);\n }\n\n const width = Math.max(...[...byField.keys()].map((field) => field.length));\n for (const [field, fieldRules] of byField) {\n const phrases = fieldRules.map(formatConstraint);\n // A required field is surfaced as an explicit \"required\" constraint at the front.\n if (fieldRules.some((rule) => rule.required)) {\n phrases.unshift(chalk.italic('required'));\n }\n // Dedupe identical phrases (some fields are constrained by several rules that overlap).\n const constraints = [...new Set(phrases)].join('; ');\n lines.push(` ${chalk.bold(field.padEnd(width))} ${constraints}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Render a single rule's constraint as a human-readable phrase.\n *\n * @param rule the rule description to render\n * @returns a phrase such as `must be one of: es2022, es2023` or `not allowed`\n */\nexport function formatConstraint(rule: RuleDescription): string {\n const { type, values } = rule;\n\n // No hints means the matcher accepts anything (e.g. Match.ANY).\n if (values === undefined) {\n return type === RuleType.PASS ? chalk.italic('any value') : 'must not be set to the matched value';\n }\n\n // Only null/undefined hints means the option must be absent (e.g. Match.MISSING).\n if (values.length > 0 && values.every((value) => value == null)) {\n return chalk.italic('not allowed');\n }\n\n const formatted = values.map(formatRuleValue);\n if (type === RuleType.FAIL) {\n return formatted.length > 1 ? `must not be one of: ${formatted.join(', ')}` : `must not be ${formatted[0]}`;\n }\n return formatted.length > 1 ? `must be one of: ${formatted.join(', ')}` : `must be ${formatted[0]}`;\n}\n\n/**\n * Render a single hinted value as a highlighted code literal. Strings are shown\n * verbatim (as a user writes them in tsconfig.json), everything else is JSON-encoded.\n *\n * @param value the hinted value to render\n * @returns the value as a (possibly colorized) code literal\n */\nexport function formatRuleValue(value: any): string {\n const literal = typeof value === 'string' ? value : JSON.stringify(value);\n return chalk.cyan(literal);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"configurable-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/configurable-options.ts"],"names":[],"mappings":";;;;;AAAA,wFAA8D;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;AACxE,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC7D,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,yBAAyB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACrE,gFAAgF;AAChF,gFAAgF;AAChF,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACxE,mBAAmB,CAAC,UAAU,CAAC,iCAAiC,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAE7E,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);\nconfigurableOptions.shouldPass('verbatimModuleSyntax', Match.ANY);\nconfigurableOptions.shouldPass('isolatedModules', Match.ANY);\nconfigurableOptions.shouldPass('isolatedDeclarations', Match.ANY);\nconfigurableOptions.shouldPass('useDefineForClassFields', Match.ANY);\n// Authoring options the user may opt into; some jsii language features won't be\n// usable under them, but that is the user's choice (TS reports any violations).\nconfigurableOptions.shouldPass('erasableSyntaxOnly', Match.ANY);\nconfigurableOptions.shouldPass('allowImportingTsExtensions', Match.ANY);\nconfigurableOptions.shouldPass('rewriteRelativeImportExtensions', Match.ANY);\n\nexport default configurableOptions;\n"]}
1
+ {"version":3,"file":"configurable-options.js","sources":["../../../src/tsconfig/rulesets/configurable-options.ts"],"names":[],"mappings":";;;;;AAAA,wFAA8D;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;AACxE,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAC7D,mBAAmB,CAAC,UAAU,CAAC,sBAAsB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAClE,mBAAmB,CAAC,UAAU,CAAC,yBAAyB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACrE,gFAAgF;AAChF,gFAAgF;AAChF,mBAAmB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AAChE,mBAAmB,CAAC,UAAU,CAAC,4BAA4B,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;AACxE,mBAAmB,CAAC,UAAU,CAAC,iCAAiC,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;kBAE9D,mBAAmB","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);\nconfigurableOptions.shouldPass('verbatimModuleSyntax', Match.ANY);\nconfigurableOptions.shouldPass('isolatedModules', Match.ANY);\nconfigurableOptions.shouldPass('isolatedDeclarations', Match.ANY);\nconfigurableOptions.shouldPass('useDefineForClassFields', Match.ANY);\n// Authoring options the user may opt into; some jsii language features won't be\n// usable under them, but that is the user's choice (TS reports any violations).\nconfigurableOptions.shouldPass('erasableSyntaxOnly', Match.ANY);\nconfigurableOptions.shouldPass('allowImportingTsExtensions', Match.ANY);\nconfigurableOptions.shouldPass('rewriteRelativeImportExtensions', Match.ANY);\n\nexport default configurableOptions;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-options.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/deprecated-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,+EAA+E;AAC/E,wFAAwF;AACxF,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAI,mBAAO,EAAE,CAAC;AACxC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAClE,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAEvD,gFAAgF;AAChF,iBAAiB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,iBAAiB,CAAC,UAAU,CAAC,8BAA8B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzF,oCAAoC;AACpC,iBAAiB,CAAC,UAAU,CAAC,cAAc,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzE,4BAA4B;AAC5B,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAExD,qDAAqD;AACrD,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtF,6DAA6D;AAC7D,iBAAiB,CAAC,UAAU,CAAC,kBAAkB,EAAE,iBAAK,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3F,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// These options are deprecated in TypeScript 6.0 and will be removed in TypeScript 7.0.\n// This is an internal rule set, that may be used by other rule sets.\nconst deprecatedOptions = new RuleSet();\ndeprecatedOptions.shouldPass('prepend', Match.MISSING);\ndeprecatedOptions.shouldPass('downlevelIteration', Match.MISSING);\ndeprecatedOptions.shouldPass('outFile', Match.MISSING);\ndeprecatedOptions.shouldPass('baseUrl', Match.MISSING);\n\n// esModuleInterop: false and allowSyntheticDefaultImports: false are deprecated\ndeprecatedOptions.shouldPass('esModuleInterop', Match.optional(Match.TRUE));\ndeprecatedOptions.shouldPass('allowSyntheticDefaultImports', Match.optional(Match.TRUE));\n\n// alwaysStrict: false is deprecated\ndeprecatedOptions.shouldPass('alwaysStrict', Match.optional(Match.TRUE));\n\n// target: es5 is deprecated\ndeprecatedOptions.shouldFail('target', Match.eq('es5'));\n\n// Deprecated module values: amd, umd, systemjs, none\ndeprecatedOptions.shouldFail('module', Match.oneOf('amd', 'umd', 'systemjs', 'none'));\n\n// Deprecated moduleResolution values: node (node10), classic\ndeprecatedOptions.shouldFail('moduleResolution', Match.oneOf('node', 'node10', 'classic'));\n\nexport default deprecatedOptions;\n"]}
1
+ {"version":3,"file":"deprecated-options.js","sources":["../../../src/tsconfig/rulesets/deprecated-options.ts"],"names":[],"mappings":";;AAAA,4CAA8C;AAE9C,+EAA+E;AAC/E,wFAAwF;AACxF,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAI,mBAAO,EAAE,CAAC;AACxC,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,oBAAoB,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAClE,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AACvD,iBAAiB,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,OAAO,CAAC,CAAC;AAEvD,gFAAgF;AAChF,iBAAiB,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,iBAAiB,CAAC,UAAU,CAAC,8BAA8B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzF,oCAAoC;AACpC,iBAAiB,CAAC,UAAU,CAAC,cAAc,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzE,4BAA4B;AAC5B,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAExD,qDAAqD;AACrD,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtF,6DAA6D;AAC7D,iBAAiB,CAAC,UAAU,CAAC,kBAAkB,EAAE,iBAAK,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;kBAE5E,iBAAiB","sourcesContent":["import { Match, RuleSet } from '../validator';\n\n// A rule set for deprecated compilerOptions that should not be used with jsii.\n// These options are deprecated in TypeScript 6.0 and will be removed in TypeScript 7.0.\n// This is an internal rule set, that may be used by other rule sets.\nconst deprecatedOptions = new RuleSet();\ndeprecatedOptions.shouldPass('prepend', Match.MISSING);\ndeprecatedOptions.shouldPass('downlevelIteration', Match.MISSING);\ndeprecatedOptions.shouldPass('outFile', Match.MISSING);\ndeprecatedOptions.shouldPass('baseUrl', Match.MISSING);\n\n// esModuleInterop: false and allowSyntheticDefaultImports: false are deprecated\ndeprecatedOptions.shouldPass('esModuleInterop', Match.optional(Match.TRUE));\ndeprecatedOptions.shouldPass('allowSyntheticDefaultImports', Match.optional(Match.TRUE));\n\n// alwaysStrict: false is deprecated\ndeprecatedOptions.shouldPass('alwaysStrict', Match.optional(Match.TRUE));\n\n// target: es5 is deprecated\ndeprecatedOptions.shouldFail('target', Match.eq('es5'));\n\n// Deprecated module values: amd, umd, systemjs, none\ndeprecatedOptions.shouldFail('module', Match.oneOf('amd', 'umd', 'systemjs', 'none'));\n\n// Deprecated moduleResolution values: node (node10), classic\ndeprecatedOptions.shouldFail('moduleResolution', Match.oneOf('node', 'node10', 'classic'));\n\nexport default deprecatedOptions;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"generated.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/generated.public.ts"],"names":[],"mappings":";;;;;AAAA,wFAA8D;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,8FAA8F;AAC9F,8FAA8F;AAC9F,mCAAmC;AACnC,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. Deprecated options need no explicit handling here: this is a\n// closed whitelist, so any deprecated option is either pinned to its generated value below or\n// rejected as an unexpected field.\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
+ {"version":3,"file":"generated.public.js","sources":["../../../src/tsconfig/rulesets/generated.public.ts"],"names":[],"mappings":";;;;;AAAA,wFAA8D;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,8FAA8F;AAC9F,8FAA8F;AAC9F,mCAAmC;AACnC,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;kBAEc,SAAS","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. Deprecated options need no explicit handling here: this is a\n// closed whitelist, so any deprecated option is either pinned to its generated value below or\n// rejected as an unexpected field.\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 +1 @@
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;AAC3D,mBAAmB,CAAC,UAAU,CAAC,qBAAqB,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AAElE,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);\nincompatibleOptions.shouldFail('emitDeclarationOnly', Match.TRUE);\n\nexport default incompatibleOptions;\n"]}
1
+ {"version":3,"file":"incompatible-options.js","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;AAC3D,mBAAmB,CAAC,UAAU,CAAC,qBAAqB,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;kBAEnD,mBAAmB","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);\nincompatibleOptions.shouldFail('emitDeclarationOnly', Match.TRUE);\n\nexport default incompatibleOptions;\n"]}
@@ -1 +1 @@
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,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('paths', Match.ANY);\njsiiConfiguredOptions.shouldPass('composite', Match.ANY); // configured via projectReferences\njsiiConfiguredOptions.shouldPass('tsBuildInfoFile', Match.ANY);\n\nexport default jsiiConfiguredOptions;\n"]}
1
+ {"version":3,"file":"jsii-configured-options.js","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,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;kBAEhD,qBAAqB","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('paths', Match.ANY);\njsiiConfiguredOptions.shouldPass('composite', Match.ANY); // configured via projectReferences\njsiiConfiguredOptions.shouldPass('tsBuildInfoFile', Match.ANY);\n\nexport default jsiiConfiguredOptions;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"minimal.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/minimal.public.ts"],"names":[],"mappings":";;;;;AAAA,kFAAyD;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
+ {"version":3,"file":"minimal.public.js","sources":["../../../src/tsconfig/rulesets/minimal.public.ts"],"names":[],"mappings":";;;;;AAAA,kFAAyD;AACzD,4CAAuC;AAEvC,yEAAyE;AACzE,yEAAyE;AACzE,gDAAgD;AAChD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,MAAM,CAAC,8BAAmB,CAAC,CAAC;kBAErB,OAAO","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 +1 @@
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
+ {"version":3,"file":"strict-family-options.js","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;kBAE9E,mBAAmB","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 +1 @@
1
- {"version":3,"file":"strict.public.js","sourceRoot":"","sources":["../../../src/tsconfig/rulesets/strict.public.ts"],"names":[],"mappings":";;;;;AAAA,kFAAyD;AACzD,8EAAqD;AACrD,kFAAyD;AACzD,oFAA0D;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;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CAAC,IAAI,CAAC,CAAC,CAAC;AAE9E,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.oneOf('es2022', 'es2023', 'esnext')); // node18+\nstrict.shouldPass('lib', Match.anyOf(Match.arrEq(['es2022']), Match.arrEq(['es2023']), Match.arrEq(['esnext']))); // node18+\nstrict.shouldPass('module', Match.oneOf('node16', 'node18', 'node20', 'nodenext', 'commonjs'));\nstrict.shouldPass('moduleResolution', Match.optional(Match.oneOf('node16', 'nodenext', 'bundler')));\nstrict.shouldPass('skipLibCheck', Match.TRUE);\nstrict.shouldPass('stripInternal', Match.optional(Match.FALSE));\nstrict.shouldPass('noEmitOnError', Match.TRUE);\nstrict.shouldPass('declaration', Match.TRUE);\nstrict.shouldPass('noUncheckedSideEffectImports', Match.optional(Match.TRUE));\n\n// Deprecated ts options that should not be used with jsii\nstrict.import(deprecatedOptions);\n\nexport default strict;\n"]}
1
+ {"version":3,"file":"strict.public.js","sources":["../../../src/tsconfig/rulesets/strict.public.ts"],"names":[],"mappings":";;;;;AAAA,kFAAyD;AACzD,8EAAqD;AACrD,kFAAyD;AACzD,oFAA0D;AAC1D,4CAAwD;AAExD,yEAAyE;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AC;AAChE,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,iBAAK,CAAC,IAAI,CAAC,CAAC;AAC7C,MAAM,CAAC,UAAU,CAAC,8BAA8B,EAAE,iBAAK,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,CAAC,4BAAiB,CAAC,CAAC;kBAElB,MAAM","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.oneOf('es2022', 'es2023', 'esnext')); // node18+\nstrict.shouldPass('lib', Match.anyOf(Match.arrEq(['es2022']), Match.arrEq(['es2023']), Match.arrEq(['esnext']))); // node18+\nstrict.shouldPass('module', Match.oneOf('node16', 'node18', 'node20', 'nodenext', 'commonjs'));\nstrict.shouldPass('moduleResolution', Match.optional(Match.oneOf('node16', 'nodenext', 'bundler')));\nstrict.shouldPass('skipLibCheck', Match.TRUE);\nstrict.shouldPass('stripInternal', Match.optional(Match.FALSE));\nstrict.shouldPass('noEmitOnError', Match.TRUE);\nstrict.shouldPass('declaration', Match.TRUE);\nstrict.shouldPass('noUncheckedSideEffectImports', Match.optional(Match.TRUE));\n\n// Deprecated ts options that should not be used with jsii\nstrict.import(deprecatedOptions);\n\nexport default strict;\n"]}
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -41,10 +8,8 @@ exports.getCompilerOptionsRuleSet = getCompilerOptionsRuleSet;
41
8
  exports.describeRuleSet = describeRuleSet;
42
9
  exports.readTypeScriptConfig = readTypeScriptConfig;
43
10
  exports.validateTypeScriptConfigFile = validateTypeScriptConfigFile;
44
- const path = __importStar(require("node:path"));
45
- const ts = __importStar(require("typescript"));
46
11
  const compiler_options_1 = require("./compiler-options");
47
- const utils_1 = require("../utils");
12
+ const read_1 = require("./read");
48
13
  const generated_public_1 = __importDefault(require("./rulesets/generated.public"));
49
14
  const minimal_public_1 = __importDefault(require("./rulesets/minimal.public"));
50
15
  const strict_public_1 = __importDefault(require("./rulesets/strict.public"));
@@ -122,20 +87,7 @@ function describeRuleSet(ruleSet) {
122
87
  * @returns the parsed TypeScript configuration
123
88
  */
124
89
  function readTypeScriptConfig(configPath) {
125
- const absolutePath = path.resolve(configPath);
126
- const { config, error } = ts.readConfigFile(absolutePath, ts.sys.readFile);
127
- if (error) {
128
- throw new utils_1.JsiiError(`Failed to read tsconfig at "${configPath}": ${ts.flattenDiagnosticMessageText(error.messageText, '\n')}`);
129
- }
130
- const basePath = path.dirname(absolutePath);
131
- const extended = ts.parseJsonConfigFileContent(config, ts.sys, basePath);
132
- // the tsconfig parser adds this in, but it is not an expected compilerOption
133
- delete extended.options.configFilePath;
134
- return {
135
- compilerOptions: extended.options,
136
- watchOptions: extended.watchOptions,
137
- include: extended.fileNames,
138
- };
90
+ return (0, read_1.readTypeScriptConfigFile)(configPath);
139
91
  }
140
92
  /**
141
93
  * Reads a `tsconfig.json` file from disk and validates its `compilerOptions`
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig-validator.js","sourceRoot":"","sources":["../../src/tsconfig/tsconfig-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,8DAEC;AAQD,0CAEC;AAWD,oDAmBC;AAWD,oEAmBC;AA1ID,gDAAkC;AAClC,+CAAiC;AAEjC,yDAAoD;AACpD,oCAAqC;AACrC,mFAAoD;AACpD,+EAAgD;AAChD,6EAA8C;AAC9C,2CAAqH;AAErH,MAAM,QAAQ,GAEV;IACF,SAAS,EAAT,0BAAS;IACT,MAAM,EAAN,uBAAM;IACN,OAAO,EAAP,wBAAO;IACP,GAAG,EAAE,IAAI,mBAAO,EAAE;CACnB,CAAC;AAEF,MAAa,yBAAyB;IAIV;IAHT,SAAS,CAAkB;IAC3B,eAAe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Q,CAAC;YACjB,GAAG,MAAM;YACT,yFAAyF;YACzF,eAAe,EAAE,IAAA,iCAAc,EAAC,MAAM,CAAC,eAAe,CAAC;SACxD,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,2BAAe,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC,UAAU,CAAC;QAC1B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as ts from 'typescript';\nimport { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from '.';\nimport { convertForJson } from './compiler-options';\nimport { JsiiError } from '../utils';\nimport generated from './rulesets/generated.public';\nimport minimal from './rulesets/minimal.public';\nimport strict from './rulesets/strict.public';\nimport { Match, ObjectValidator, RuleDescription, RuleSet, RuleType, ValidationError, Violation } 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\n/**\n * Returns the `compilerOptions` rule set that backs the given validation setting.\n *\n * These are the substantive, set-specific rules (the top-level rules such as\n * `files`/`include`/`exclude` are identical across all sets). The `off` rule set\n * is empty, as it disables validation.\n *\n * @param ruleSet the validation setting to look up\n * @returns the `RuleSet` applied to `compilerOptions`\n */\nexport function getCompilerOptionsRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleSet {\n return RuleSets[ruleSet];\n}\n\n/**\n * Produces a human-readable description of every `compilerOptions` rule in a rule set.\n *\n * @param ruleSet the validation setting to describe\n * @returns a description for every rule in the set\n */\nexport function describeRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleDescription[] {\n return getCompilerOptionsRuleSet(ruleSet).describe();\n}\n\n/**\n * Reads and parses a `tsconfig.json` file from disk into the format expected by\n * the validator. This resolves `extends` and normalizes the options the same way\n * the compiler does, so validation behaves identically to a real compilation.\n *\n * @param configPath the path to the tsconfig file to read\n * @throws {@link JsiiError} if the file cannot be read or parsed\n * @returns the parsed TypeScript configuration\n */\nexport function readTypeScriptConfig(configPath: string): TypeScriptConfig {\n const absolutePath = path.resolve(configPath);\n const { config, error } = ts.readConfigFile(absolutePath, ts.sys.readFile);\n if (error) {\n throw new JsiiError(\n `Failed to read tsconfig at \"${configPath}\": ${ts.flattenDiagnosticMessageText(error.messageText, '\\n')}`,\n );\n }\n\n const basePath = path.dirname(absolutePath);\n const extended = ts.parseJsonConfigFileContent(config, ts.sys, basePath);\n // the tsconfig parser adds this in, but it is not an expected compilerOption\n delete extended.options.configFilePath;\n\n return {\n compilerOptions: extended.options,\n watchOptions: extended.watchOptions,\n include: extended.fileNames,\n };\n}\n\n/**\n * Reads a `tsconfig.json` file from disk and validates its `compilerOptions`\n * against the given rule set, without running a compilation.\n *\n * @param configPath the path to the tsconfig file to validate\n * @param ruleSet the rule set to validate against\n * @throws {@link JsiiError} if the file cannot be read or parsed\n * @returns the list of rule violations (empty if the config is valid)\n */\nexport function validateTypeScriptConfigFile(\n configPath: string,\n ruleSet: TypeScriptConfigValidationRuleSet,\n): Violation[] {\n const config = readTypeScriptConfig(configPath);\n const validator = new TypeScriptConfigValidator(ruleSet);\n try {\n validator.validate({\n ...config,\n // convert the internal format to the user format which is what the validator operates on\n compilerOptions: convertForJson(config.compilerOptions),\n });\n return [];\n } catch (error: unknown) {\n if (error instanceof ValidationError) {\n return error.violations;\n }\n throw error;\n }\n}\n"]}
1
+ {"version":3,"file":"tsconfig-validator.js","sources":["../../src/tsconfig/tsconfig-validator.ts"],"names":[],"mappings":";;;;;;;;;;AACA,yDAAoD;AACpD,iCAAkD;AAClD,mFAAoD;AACpD,+EAAgD;AAChD,6EAA8C;AAC9C,2CAAqH;AAErH,MAAM,QAAQ,GAEV;IACF,SAAS,EAAT,0BAAS;IACT,MAAM,EAAN,uBAAM;IACN,OAAO,EAAP,wBAAO;IACP,GAAG,EAAE,IAAI,mBAAO,EAAE;CACnB,CAAC;AAEF;IAI4B,OAAO;IAHhB,SAAS,CAAkB;IAC3B,eAAe,CAAkB;IAElD,YAA0B,OAA0C;uBAA1C,OAAO;QAC/B,MAAM,aAAa,GAAG,IAAI,mBAAO,CAAC;YAChC,gBAAgB,EAAE,oBAAQ,CAAC,IAAI;SAChC,CAAC,CAAC;QACH,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,aAAa,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,aAAa,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,aAAa,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,aAAa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CAAC;YACjB,GAAG,MAAM;YACT,yFAAyF;YACzF,eAAe,EAAE,IAAA,iCAAc,EAAC,MAAM,CAAC,eAAe,CAAC;SACxD,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,2BAAe,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC,UAAU,CAAC;QAC1B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from '.';\nimport { convertForJson } from './compiler-options';\nimport { readTypeScriptConfigFile } from './read';\nimport generated from './rulesets/generated.public';\nimport minimal from './rulesets/minimal.public';\nimport strict from './rulesets/strict.public';\nimport { Match, ObjectValidator, RuleDescription, RuleSet, RuleType, ValidationError, Violation } 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\n/**\n * Returns the `compilerOptions` rule set that backs the given validation setting.\n *\n * These are the substantive, set-specific rules (the top-level rules such as\n * `files`/`include`/`exclude` are identical across all sets). The `off` rule set\n * is empty, as it disables validation.\n *\n * @param ruleSet the validation setting to look up\n * @returns the `RuleSet` applied to `compilerOptions`\n */\nexport function getCompilerOptionsRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleSet {\n return RuleSets[ruleSet];\n}\n\n/**\n * Produces a human-readable description of every `compilerOptions` rule in a rule set.\n *\n * @param ruleSet the validation setting to describe\n * @returns a description for every rule in the set\n */\nexport function describeRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleDescription[] {\n return getCompilerOptionsRuleSet(ruleSet).describe();\n}\n\n/**\n * Reads and parses a `tsconfig.json` file from disk into the format expected by\n * the validator. This resolves `extends` and normalizes the options the same way\n * the compiler does, so validation behaves identically to a real compilation.\n *\n * @param configPath the path to the tsconfig file to read\n * @throws {@link JsiiError} if the file cannot be read or parsed\n * @returns the parsed TypeScript configuration\n */\nexport function readTypeScriptConfig(configPath: string): TypeScriptConfig {\n return readTypeScriptConfigFile(configPath);\n}\n\n/**\n * Reads a `tsconfig.json` file from disk and validates its `compilerOptions`\n * against the given rule set, without running a compilation.\n *\n * @param configPath the path to the tsconfig file to validate\n * @param ruleSet the rule set to validate against\n * @throws {@link JsiiError} if the file cannot be read or parsed\n * @returns the list of rule violations (empty if the config is valid)\n */\nexport function validateTypeScriptConfigFile(\n configPath: string,\n ruleSet: TypeScriptConfigValidationRuleSet,\n): Violation[] {\n const config = readTypeScriptConfig(configPath);\n const validator = new TypeScriptConfigValidator(ruleSet);\n try {\n validator.validate({\n ...config,\n // convert the internal format to the user format which is what the validator operates on\n compilerOptions: convertForJson(config.compilerOptions),\n });\n return [];\n } catch (error: unknown) {\n if (error instanceof ValidationError) {\n return error.violations;\n }\n throw error;\n }\n}\n"]}