@@ -67,7 +67,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
67
67
var ts;
68
68
(function (ts) {
69
69
ts.versionMajorMinor = "4.0";
70
- ts.version = ts.versionMajorMinor + ".1-rc ";
70
+ ts.version = "4.0.2 ";
71
71
var NativeCollections;
72
72
(function (NativeCollections) {
73
73
function tryGetNativeMap() {
@@ -29791,51 +29791,46 @@ var ts;
29791
29791
configFileSpecs: spec
29792
29792
};
29793
29793
function getFileNames() {
29794
- var filesSpecs;
29795
- if (ts.hasProperty(raw, "files") && !isNullOrUndefined(raw.files)) {
29796
- if (ts.isArray(raw.files)) {
29797
- filesSpecs = raw.files;
29798
- var hasReferences = ts.hasProperty(raw, "references") && !isNullOrUndefined(raw.references);
29799
- var hasZeroOrNoReferences = !hasReferences || raw.references.length === 0;
29800
- var hasExtends = ts.hasProperty(raw, "extends");
29801
- if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) {
29802
- if (sourceFile) {
29803
- var fileName = configFileName || "tsconfig.json";
29804
- var diagnosticMessage = ts.Diagnostics.The_files_list_in_config_file_0_is_empty;
29805
- var nodeValue = ts.firstDefined(ts.getTsConfigPropArray(sourceFile, "files"), function (property) { return property.initializer; });
29806
- var error = nodeValue
29807
- ? ts.createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName)
29808
- : ts.createCompilerDiagnostic(diagnosticMessage, fileName);
29809
- errors.push(error);
29810
- }
29811
- else {
29812
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
29813
- }
29794
+ var referencesOfRaw = getPropFromRaw("references", function (element) { return typeof element === "object"; }, "object");
29795
+ if (ts.isArray(referencesOfRaw)) {
29796
+ for (var _i = 0, referencesOfRaw_1 = referencesOfRaw; _i < referencesOfRaw_1.length; _i++) {
29797
+ var ref = referencesOfRaw_1[_i];
29798
+ if (typeof ref.path !== "string") {
29799
+ createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string");
29800
+ }
29801
+ else {
29802
+ (projectReferences || (projectReferences = [])).push({
29803
+ path: ts.getNormalizedAbsolutePath(ref.path, basePath),
29804
+ originalPath: ref.path,
29805
+ prepend: ref.prepend,
29806
+ circular: ref.circular
29807
+ });
29814
29808
}
29815
- }
29816
- else {
29817
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array");
29818
- }
29819
- }
29820
- var includeSpecs;
29821
- if (ts.hasProperty(raw, "include") && !isNullOrUndefined(raw.include)) {
29822
- if (ts.isArray(raw.include)) {
29823
- includeSpecs = raw.include;
29824
- }
29825
- else {
29826
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array");
29827
29809
}
29828
29810
}
29829
- var excludeSpecs;
29830
- if (ts.hasProperty(raw, "exclude") && !isNullOrUndefined(raw.exclude)) {
29831
- if (ts.isArray(raw.exclude)) {
29832
- excludeSpecs = raw.exclude;
29833
- }
29834
- else {
29835
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array");
29811
+ var filesSpecs = toPropValue(getSpecsFromRaw("files"));
29812
+ if (filesSpecs) {
29813
+ var hasZeroOrNoReferences = referencesOfRaw === "no-prop" || ts.isArray(referencesOfRaw) && referencesOfRaw.length === 0;
29814
+ var hasExtends = ts.hasProperty(raw, "extends");
29815
+ if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) {
29816
+ if (sourceFile) {
29817
+ var fileName = configFileName || "tsconfig.json";
29818
+ var diagnosticMessage = ts.Diagnostics.The_files_list_in_config_file_0_is_empty;
29819
+ var nodeValue = ts.firstDefined(ts.getTsConfigPropArray(sourceFile, "files"), function (property) { return property.initializer; });
29820
+ var error = nodeValue
29821
+ ? ts.createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName)
29822
+ : ts.createCompilerDiagnostic(diagnosticMessage, fileName);
29823
+ errors.push(error);
29824
+ }
29825
+ else {
29826
+ createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
29827
+ }
29836
29828
}
29837
29829
}
29838
- else if (raw.compilerOptions) {
29830
+ var includeSpecs = toPropValue(getSpecsFromRaw("include"));
29831
+ var excludeOfRaw = getSpecsFromRaw("exclude");
29832
+ var excludeSpecs = toPropValue(excludeOfRaw);
29833
+ if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
29839
29834
var outDir = raw.compilerOptions.outDir;
29840
29835
var declarationDir = raw.compilerOptions.declarationDir;
29841
29836
if (outDir || declarationDir) {
@@ -29849,28 +29844,29 @@ var ts;
29849
29844
if (shouldReportNoInputFiles(result, canJsonReportNoInputFiles(raw), resolutionStack)) {
29850
29845
errors.push(getErrorForNoInputFiles(result.spec, configFileName));
29851
29846
}
29852
- if (ts.hasProperty(raw, "references") && !isNullOrUndefined(raw.references)) {
29853
- if (ts.isArray(raw.references)) {
29854
- for (var _i = 0, _a = raw.references; _i < _a.length; _i++) {
29855
- var ref = _a[_i];
29856
- if (typeof ref.path !== "string") {
29857
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string");
29858
- }
29859
- else {
29860
- (projectReferences || (projectReferences = [])).push({
29861
- path: ts.getNormalizedAbsolutePath(ref.path, basePath),
29862
- originalPath: ref.path,
29863
- prepend: ref.prepend,
29864
- circular: ref.circular
29865
- });
29866
- }
29847
+ return result;
29848
+ }
29849
+ function toPropValue(specResult) {
29850
+ return ts.isArray(specResult) ? specResult : undefined;
29851
+ }
29852
+ function getSpecsFromRaw(prop) {
29853
+ return getPropFromRaw(prop, ts.isString, "string");
29854
+ }
29855
+ function getPropFromRaw(prop, validateElement, elementTypeName) {
29856
+ if (ts.hasProperty(raw, prop) && !isNullOrUndefined(raw[prop])) {
29857
+ if (ts.isArray(raw[prop])) {
29858
+ var result = raw[prop];
29859
+ if (!sourceFile && !ts.every(result, validateElement)) {
29860
+ errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, elementTypeName));
29867
29861
}
29862
+ return result;
29868
29863
}
29869
29864
else {
29870
- createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "references", "Array");
29865
+ createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, "Array");
29866
+ return "not-array";
29871
29867
}
29872
29868
}
29873
- return result ;
29869
+ return "no-prop" ;
29874
29870
}
29875
29871
function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
29876
29872
if (!sourceFile) {
@@ -30216,7 +30212,15 @@ var ts;
30216
30212
validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, true, jsonSourceFile, "exclude");
30217
30213
}
30218
30214
var wildcardDirectories = getWildcardDirectories(validatedIncludeSpecs, validatedExcludeSpecs, basePath, host.useCaseSensitiveFileNames);
30219
- var spec = { filesSpecs: filesSpecs, includeSpecs: includeSpecs, excludeSpecs: excludeSpecs, validatedIncludeSpecs: validatedIncludeSpecs, validatedExcludeSpecs: validatedExcludeSpecs, wildcardDirectories: wildcardDirectories };
30215
+ var spec = {
30216
+ filesSpecs: filesSpecs,
30217
+ includeSpecs: includeSpecs,
30218
+ excludeSpecs: excludeSpecs,
30219
+ validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
30220
+ validatedIncludeSpecs: validatedIncludeSpecs,
30221
+ validatedExcludeSpecs: validatedExcludeSpecs,
30222
+ wildcardDirectories: wildcardDirectories
30223
+ };
30220
30224
return getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions);
30221
30225
}
30222
30226
function getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions) {
@@ -30226,12 +30230,12 @@ var ts;
30226
30230
var literalFileMap = new ts.Map();
30227
30231
var wildcardFileMap = new ts.Map();
30228
30232
var wildCardJsonFileMap = new ts.Map();
30229
- var filesSpecs = spec.filesSpecs , validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs, wildcardDirectories = spec.wildcardDirectories;
30233
+ var validatedFilesSpec = spec.validatedFilesSpec , validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs, wildcardDirectories = spec.wildcardDirectories;
30230
30234
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
30231
30235
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
30232
- if (filesSpecs ) {
30233
- for (var _i = 0, filesSpecs_1 = filesSpecs ; _i < filesSpecs_1 .length; _i++) {
30234
- var fileName = filesSpecs_1 [_i];
30236
+ if (validatedFilesSpec ) {
30237
+ for (var _i = 0, validatedFilesSpec_1 = validatedFilesSpec ; _i < validatedFilesSpec_1 .length; _i++) {
30238
+ var fileName = validatedFilesSpec_1 [_i];
30235
30239
var file = ts.getNormalizedAbsolutePath(fileName, basePath);
30236
30240
literalFileMap.set(keyMapper(file), file);
30237
30241
}
@@ -30278,14 +30282,14 @@ var ts;
30278
30282
}
30279
30283
ts.getFileNamesFromConfigSpecs = getFileNamesFromConfigSpecs;
30280
30284
function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames, currentDirectory) {
30281
- var filesSpecs = spec.filesSpecs , validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs;
30285
+ var validatedFilesSpec = spec.validatedFilesSpec , validatedIncludeSpecs = spec.validatedIncludeSpecs, validatedExcludeSpecs = spec.validatedExcludeSpecs;
30282
30286
if (!ts.length(validatedIncludeSpecs) || !ts.length(validatedExcludeSpecs))
30283
30287
return false;
30284
30288
basePath = ts.normalizePath(basePath);
30285
30289
var keyMapper = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
30286
- if (filesSpecs ) {
30287
- for (var _i = 0, filesSpecs_2 = filesSpecs ; _i < filesSpecs_2 .length; _i++) {
30288
- var fileName = filesSpecs_2 [_i];
30290
+ if (validatedFilesSpec ) {
30291
+ for (var _i = 0, validatedFilesSpec_2 = validatedFilesSpec ; _i < validatedFilesSpec_2 .length; _i++) {
30292
+ var fileName = validatedFilesSpec_2 [_i];
30289
30293
if (keyMapper(ts.getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck)
30290
30294
return false;
30291
30295
}
@@ -30301,6 +30305,8 @@ var ts;
30301
30305
ts.isExcludedFile = isExcludedFile;
30302
30306
function validateSpecs(specs, errors, allowTrailingRecursion, jsonSourceFile, specKey) {
30303
30307
return specs.filter(function (spec) {
30308
+ if (!ts.isString(spec))
30309
+ return false;
30304
30310
var diag = specToDiagnostic(spec, allowTrailingRecursion);
30305
30311
if (diag !== undefined) {
30306
30312
errors.push(createDiagnostic(diag, spec));
0 commit comments