@lwrjs/config 0.15.0-alpha.33 → 0.15.0-alpha.35

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.
@@ -185,20 +185,17 @@ var ValidationContext = class {
185
185
  }
186
186
  }
187
187
  assertIsFilePattern(node, property) {
188
- const fileExtRegex = /^\.[a-zA-Z0-9]+$/;
189
188
  if (node) {
190
189
  const children = node.children || [];
191
190
  for (const [index, child] of children.entries()) {
192
- const matchObj = (0, import_jsonc_parser.findNodeAtLocation)(child, ["match"]);
193
- let matcher;
194
- if (matchObj?.type === "array") {
195
- matcher = (0, import_jsonc_parser.findNodeAtLocation)(child, ["match"])?.children?.map((val) => val.value) || [];
196
- } else {
197
- matcher = (0, import_jsonc_parser.findNodeAtLocation)(child, ["match"])?.value || "";
191
+ let matcher = (0, import_jsonc_parser.findNodeAtLocation)(child, ["match"])?.children?.map((val) => val.value) || (0, import_jsonc_parser.findNodeAtLocation)(child, ["match"])?.value;
192
+ if (!Array.isArray(matcher)) {
193
+ matcher = [matcher];
198
194
  }
199
- if (typeof matcher === "string" && !fileExtRegex.test(matcher) || typeof matcher === "object" && matcher.find((match) => !fileExtRegex.test(match))) {
195
+ const misMatch = matcher.find((match) => !match || typeof match !== "string");
196
+ if (misMatch || misMatch === "") {
200
197
  this.diagnostics.push({
201
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, matcher),
198
+ description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
202
199
  location: this.getLocationFromNode(node)
203
200
  });
204
201
  break;
@@ -148,22 +148,17 @@ export class ValidationContext {
148
148
  }
149
149
  }
150
150
  assertIsFilePattern(node, property) {
151
- const fileExtRegex = /^\.[a-zA-Z0-9]+$/;
152
151
  if (node) {
153
152
  const children = node.children || [];
154
153
  for (const [index, child] of children.entries()) {
155
- const matchObj = findNodeAtLocation(child, ['match']);
156
- let matcher;
157
- if (matchObj?.type === 'array') {
158
- matcher = findNodeAtLocation(child, ['match'])?.children?.map(val => val.value) || [];
154
+ let matcher = findNodeAtLocation(child, ['match'])?.children?.map(val => val.value) || findNodeAtLocation(child, ['match'])?.value;
155
+ if (!Array.isArray(matcher)) {
156
+ matcher = [matcher];
159
157
  }
160
- else {
161
- matcher = findNodeAtLocation(child, ['match'])?.value || '';
162
- }
163
- if ((typeof matcher === 'string' && !fileExtRegex.test(matcher)) ||
164
- (typeof matcher === 'object' && matcher.find((match) => !fileExtRegex.test(match)))) {
158
+ const misMatch = matcher.find((match) => !match || typeof match !== 'string');
159
+ if (misMatch || misMatch === '') {
165
160
  this.diagnostics.push({
166
- description: descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, matcher),
161
+ description: descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
167
162
  location: this.getLocationFromNode(node)
168
163
  });
169
164
  break;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.33",
7
+ "version": "0.15.0-alpha.35",
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.33",
46
- "@lwrjs/instrumentation": "0.15.0-alpha.33",
47
- "@lwrjs/shared-utils": "0.15.0-alpha.33",
45
+ "@lwrjs/diagnostics": "0.15.0-alpha.35",
46
+ "@lwrjs/instrumentation": "0.15.0-alpha.35",
47
+ "@lwrjs/shared-utils": "0.15.0-alpha.35",
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.33",
52
+ "@lwrjs/types": "0.15.0-alpha.35",
53
53
  "jest": "^26.6.3",
54
54
  "memfs": "^4.13.0",
55
55
  "ts-jest": "^26.5.6"
@@ -71,5 +71,5 @@
71
71
  "volta": {
72
72
  "extends": "../../../package.json"
73
73
  },
74
- "gitHead": "0e636fb16ede654870100f5fa3bb5b3985a3db00"
74
+ "gitHead": "42f04ad68558ec00f543a04e363671ceb294c88b"
75
75
  }