5etools-utils 0.8.26 → 0.8.27
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.
- package/lib/BrewCleaner.js +10 -3
- package/package.json +1 -1
package/lib/BrewCleaner.js
CHANGED
|
@@ -14,7 +14,9 @@ class BrewCleaner {
|
|
|
14
14
|
|
|
15
15
|
static _CONTENT_KEY_BLOCKLIST = new Set(["$schema", "_meta", "siteVersion"]);
|
|
16
16
|
|
|
17
|
-
static _RE_INVALID_WINDOWS_CHARS = /[<>:"/\\|?*]
|
|
17
|
+
static _RE_INVALID_WINDOWS_CHARS = /[<>:"/\\|?*]/;
|
|
18
|
+
|
|
19
|
+
static _RE_VALID_SOURCE_CHARS = /^[-a-zA-Z0-9 :&+!]+$/;
|
|
18
20
|
|
|
19
21
|
static _ALL_SOURCES_JSON_LOWER = new Set();
|
|
20
22
|
|
|
@@ -74,7 +76,12 @@ class BrewCleaner {
|
|
|
74
76
|
}
|
|
75
77
|
docSourcesJson.forEach(src => this._ALL_SOURCES_JSON_LOWER.add(src.toLowerCase()));
|
|
76
78
|
|
|
77
|
-
const
|
|
79
|
+
const invalidSourceChars = docSourcesJson.filter(src => !this._RE_VALID_SOURCE_CHARS.test(src));
|
|
80
|
+
if (invalidSourceChars.length) {
|
|
81
|
+
ALL_ERRORS.push(`${file} :: "json" source${invalidSourceChars.length === 1 ? "" : "s"} contained invalid characters (must match ${this._RE_VALID_SOURCE_CHARS.toString()}): ${invalidSourceChars.map(src => `"${src}"`).join(", ")}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const docSourcesJsonSet = new Set(docSourcesJson);
|
|
78
85
|
|
|
79
86
|
Object.keys(contents)
|
|
80
87
|
.filter(k => !this._CONTENT_KEY_BLOCKLIST.has(k))
|
|
@@ -88,7 +95,7 @@ class BrewCleaner {
|
|
|
88
95
|
data.forEach(it => {
|
|
89
96
|
const source = it.source || (it.inherits ? it.inherits.source : null);
|
|
90
97
|
if (!source) return ALL_ERRORS.push(`${file} :: ${k} :: "${it.name || it.id}" had no source!`);
|
|
91
|
-
if (!
|
|
98
|
+
if (!docSourcesJsonSet.has(source)) return ALL_ERRORS.push(`${file} :: ${k} :: "${it.name || it.id}" source "${source}" was not in _meta`);
|
|
92
99
|
});
|
|
93
100
|
});
|
|
94
101
|
// endregion
|