From fcf1c22d9720d677e7b3a56a9209bf582d3521f0 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 6 Nov 2020 08:35:01 +0100 Subject: [PATCH] fix(@angular-devkit/build-angular): add validation to fileReplacement values fileReplacement is meant to replace compilation source files (JavaScript or TypeScript) with other compilation source files in the build. With this change we add validation to fail the build when the files have unsupported extensions. Closes #11451 --- packages/angular/cli/lib/config/schema.json | 24 ++++++++++++------- .../build_angular/src/browser/schema.json | 12 ++++++---- .../build_angular/src/server/schema.json | 12 ++++++---- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/packages/angular/cli/lib/config/schema.json b/packages/angular/cli/lib/config/schema.json index 79e84e28fb3f..18d7b4a61775 100644 --- a/packages/angular/cli/lib/config/schema.json +++ b/packages/angular/cli/lib/config/schema.json @@ -1062,10 +1062,12 @@ "type": "object", "properties": { "src": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "replaceWith": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, @@ -1078,10 +1080,12 @@ "type": "object", "properties": { "replace": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "with": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, @@ -1955,10 +1959,12 @@ "type": "object", "properties": { "src": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "replaceWith": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, @@ -1971,10 +1977,12 @@ "type": "object", "properties": { "replace": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "with": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, diff --git a/packages/angular_devkit/build_angular/src/browser/schema.json b/packages/angular_devkit/build_angular/src/browser/schema.json index 7a9d32338a52..2256b9c4e2ca 100644 --- a/packages/angular_devkit/build_angular/src/browser/schema.json +++ b/packages/angular_devkit/build_angular/src/browser/schema.json @@ -433,10 +433,12 @@ "type": "object", "properties": { "src": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "replaceWith": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, @@ -449,10 +451,12 @@ "type": "object", "properties": { "replace": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "with": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, diff --git a/packages/angular_devkit/build_angular/src/server/schema.json b/packages/angular_devkit/build_angular/src/server/schema.json index 289b37810a53..93e216a3cf99 100644 --- a/packages/angular_devkit/build_angular/src/server/schema.json +++ b/packages/angular_devkit/build_angular/src/server/schema.json @@ -259,10 +259,12 @@ "type": "object", "properties": { "src": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "replaceWith": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false, @@ -275,10 +277,12 @@ "type": "object", "properties": { "replace": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" }, "with": { - "type": "string" + "type": "string", + "pattern": "\\.([cm]?j|t)sx?$" } }, "additionalProperties": false,