Skip to content

Commit 52a320e

Browse files
committed
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 (cherry picked from commit 424af28)
1 parent 8a49506 commit 52a320e

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

packages/angular/cli/lib/config/schema.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,12 @@
10431043
"type": "object",
10441044
"properties": {
10451045
"src": {
1046-
"type": "string"
1046+
"type": "string",
1047+
"pattern": "\\.([cm]?j|t)sx?$"
10471048
},
10481049
"replaceWith": {
1049-
"type": "string"
1050+
"type": "string",
1051+
"pattern": "\\.([cm]?j|t)sx?$"
10501052
}
10511053
},
10521054
"additionalProperties": false,
@@ -1059,10 +1061,12 @@
10591061
"type": "object",
10601062
"properties": {
10611063
"replace": {
1062-
"type": "string"
1064+
"type": "string",
1065+
"pattern": "\\.([cm]?j|t)sx?$"
10631066
},
10641067
"with": {
1065-
"type": "string"
1068+
"type": "string",
1069+
"pattern": "\\.([cm]?j|t)sx?$"
10661070
}
10671071
},
10681072
"additionalProperties": false,
@@ -1931,10 +1935,12 @@
19311935
"type": "object",
19321936
"properties": {
19331937
"src": {
1934-
"type": "string"
1938+
"type": "string",
1939+
"pattern": "\\.([cm]?j|t)sx?$"
19351940
},
19361941
"replaceWith": {
1937-
"type": "string"
1942+
"type": "string",
1943+
"pattern": "\\.([cm]?j|t)sx?$"
19381944
}
19391945
},
19401946
"additionalProperties": false,
@@ -1947,10 +1953,12 @@
19471953
"type": "object",
19481954
"properties": {
19491955
"replace": {
1950-
"type": "string"
1956+
"type": "string",
1957+
"pattern": "\\.([cm]?j|t)sx?$"
19511958
},
19521959
"with": {
1953-
"type": "string"
1960+
"type": "string",
1961+
"pattern": "\\.([cm]?j|t)sx?$"
19541962
}
19551963
},
19561964
"additionalProperties": false,

packages/angular_devkit/build_angular/src/browser/schema.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,12 @@
428428
"type": "object",
429429
"properties": {
430430
"src": {
431-
"type": "string"
431+
"type": "string",
432+
"pattern": "\\.([cm]?j|t)sx?$"
432433
},
433434
"replaceWith": {
434-
"type": "string"
435+
"type": "string",
436+
"pattern": "\\.([cm]?j|t)sx?$"
435437
}
436438
},
437439
"additionalProperties": false,
@@ -444,10 +446,12 @@
444446
"type": "object",
445447
"properties": {
446448
"replace": {
447-
"type": "string"
449+
"type": "string",
450+
"pattern": "\\.([cm]?j|t)sx?$"
448451
},
449452
"with": {
450-
"type": "string"
453+
"type": "string",
454+
"pattern": "\\.([cm]?j|t)sx?$"
451455
}
452456
},
453457
"additionalProperties": false,

packages/angular_devkit/build_angular/src/server/schema.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,12 @@
259259
"type": "object",
260260
"properties": {
261261
"src": {
262-
"type": "string"
262+
"type": "string",
263+
"pattern": "\\.([cm]?j|t)sx?$"
263264
},
264265
"replaceWith": {
265-
"type": "string"
266+
"type": "string",
267+
"pattern": "\\.([cm]?j|t)sx?$"
266268
}
267269
},
268270
"additionalProperties": false,
@@ -275,10 +277,12 @@
275277
"type": "object",
276278
"properties": {
277279
"replace": {
278-
"type": "string"
280+
"type": "string",
281+
"pattern": "\\.([cm]?j|t)sx?$"
279282
},
280283
"with": {
281-
"type": "string"
284+
"type": "string",
285+
"pattern": "\\.([cm]?j|t)sx?$"
282286
}
283287
},
284288
"additionalProperties": false,

0 commit comments

Comments
 (0)