mirror of https://github.com/webpack/webpack.git
fixes for RegExp in schema
This commit is contained in:
parent
8b489f1c1b
commit
72c63ba91c
|
@ -122,7 +122,8 @@
|
|||
},
|
||||
{
|
||||
"description": "Every matched dependency becomes external.",
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -157,7 +158,8 @@
|
|||
"FilterItemTypes": {
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
|
@ -238,7 +240,8 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -253,12 +256,14 @@
|
|||
"type": "array",
|
||||
"items": {
|
||||
"description": "A regular expression, when matched the module is not parsed",
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
"minItems": 1
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
|
@ -310,7 +315,8 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -340,7 +346,8 @@
|
|||
},
|
||||
"wrappedContextRegExp": {
|
||||
"description": "Set the inner regular expression for partial dynamic dependencies",
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -554,7 +561,8 @@
|
|||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
|
@ -642,13 +650,15 @@
|
|||
"description": "Assign modules to a cache group by module name",
|
||||
"oneOf": [
|
||||
{
|
||||
"instanceof": "Function"
|
||||
"instanceof": "Function",
|
||||
"tsType": "Function"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -663,7 +673,8 @@
|
|||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1210,7 +1221,8 @@
|
|||
"RuleSetCondition": {
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
"Rule": {
|
||||
"oneOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
"properties": {
|
||||
"contextRegExp": {
|
||||
"description": "A RegExp to test the context (directory) against",
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
"resourceRegExp": {
|
||||
"description": "A RegExp to test the request against",
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"rule": {
|
||||
"oneOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
|
|
|
@ -76,7 +76,7 @@ describe("Schemas", () => {
|
|||
}
|
||||
});
|
||||
|
||||
if (Object.keys(item).indexOf("$ref") >= 0) {
|
||||
if ("$ref" in item) {
|
||||
it("should not have other properties next to $ref", () => {
|
||||
const otherProperties = Object.keys(item).filter(
|
||||
p => p !== "$ref"
|
||||
|
@ -91,6 +91,14 @@ describe("Schemas", () => {
|
|||
});
|
||||
}
|
||||
|
||||
if ("instanceof" in item) {
|
||||
it("should have tsType specified when using instanceof", () => {
|
||||
if (!("tsType" in item)) {
|
||||
throw new Error("When using instanceof, tsType is required");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
arrayProperties.forEach(prop => {
|
||||
if (prop in item) {
|
||||
describe(prop, () => {
|
||||
|
|
Loading…
Reference in New Issue