@lwrjs/config 0.15.0-alpha.37 → 0.15.0-alpha.39

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.
@@ -192,12 +192,23 @@ var ValidationContext = class {
192
192
  if (!Array.isArray(matcher)) {
193
193
  matcher = [matcher];
194
194
  }
195
- const misMatch = matcher.find((match) => !match || typeof match !== "string");
196
- if (misMatch || misMatch === "") {
197
- this.diagnostics.push({
198
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
199
- location: this.getLocationFromNode(node)
200
- });
195
+ let misMatch = null;
196
+ for (let i = 0; i < matcher.length; i++) {
197
+ try {
198
+ if (matcher[i] === "")
199
+ throw new Error("Empty string is not a valid regex");
200
+ new RegExp(matcher[i]);
201
+ } catch (e) {
202
+ misMatch = matcher[i];
203
+ this.diagnostics.push({
204
+ description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
205
+ location: this.getLocationFromNode(node)
206
+ });
207
+ }
208
+ if (misMatch)
209
+ break;
210
+ }
211
+ if (misMatch !== null) {
201
212
  break;
202
213
  }
203
214
  }
@@ -155,12 +155,26 @@ export class ValidationContext {
155
155
  if (!Array.isArray(matcher)) {
156
156
  matcher = [matcher];
157
157
  }
158
- const misMatch = matcher.find((match) => !match || typeof match !== 'string');
159
- if (misMatch || misMatch === '') {
160
- this.diagnostics.push({
161
- description: descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
162
- location: this.getLocationFromNode(node)
163
- });
158
+ let misMatch = null;
159
+ for (let i = 0; i < matcher.length; i++) {
160
+ try {
161
+ if (matcher[i] === '')
162
+ throw new Error('Empty string is not a valid regex');
163
+ // match is a regex set as string, the below line would throw an error if the backslashes are not escaped
164
+ // eg: Regex /^.*\.css(?:\?.*)?$/ should be "^.*\\.css(?:\\?.*)?$"
165
+ new RegExp(matcher[i]);
166
+ }
167
+ catch (e) {
168
+ misMatch = matcher[i];
169
+ this.diagnostics.push({
170
+ description: descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
171
+ location: this.getLocationFromNode(node)
172
+ });
173
+ }
174
+ if (misMatch)
175
+ break;
176
+ }
177
+ if (misMatch !== null) {
164
178
  break;
165
179
  }
166
180
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.37",
7
+ "version": "0.15.0-alpha.39",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -42,14 +42,14 @@
42
42
  "test": "jest"
43
43
  },
44
44
  "dependencies": {
45
- "@lwrjs/diagnostics": "0.15.0-alpha.37",
46
- "@lwrjs/instrumentation": "0.15.0-alpha.37",
47
- "@lwrjs/shared-utils": "0.15.0-alpha.37",
45
+ "@lwrjs/diagnostics": "0.15.0-alpha.39",
46
+ "@lwrjs/instrumentation": "0.15.0-alpha.39",
47
+ "@lwrjs/shared-utils": "0.15.0-alpha.39",
48
48
  "fs-extra": "^11.2.0",
49
49
  "jsonc-parser": "^3.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@lwrjs/types": "0.15.0-alpha.37",
52
+ "@lwrjs/types": "0.15.0-alpha.39",
53
53
  "jest": "^26.6.3",
54
54
  "memfs": "^4.13.0",
55
55
  "ts-jest": "^26.5.6"
@@ -57,7 +57,7 @@
57
57
  "peerDependencies": {
58
58
  "@lwc/engine-dom": ">= 2.x",
59
59
  "@lwc/synthetic-shadow": ">= 2.x",
60
- "@lwrjs/esbuild": "0.13.x || >= 0.13.0-alpha",
60
+ "@lwrjs/esbuild": "0.15.x || >= 0.15.0-alpha",
61
61
  "lwc": ">= 2.x"
62
62
  },
63
63
  "peerDependenciesMeta": {
@@ -71,5 +71,5 @@
71
71
  "volta": {
72
72
  "extends": "../../../package.json"
73
73
  },
74
- "gitHead": "1211275df818eb68a933ea744c13c9f1a525bcd6"
74
+ "gitHead": "27d047854320831ffa9aa6137e2f40691c896448"
75
75
  }