@lwrjs/config 0.17.2-alpha.1 → 0.17.2-alpha.2

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.
@@ -101,7 +101,7 @@ var RUNTIME_CONFIGS = {
101
101
  function getServerModeConfig(serverMode) {
102
102
  const selectedMode = RUNTIME_CONFIGS[serverMode];
103
103
  if (!selectedMode) {
104
- throw (0, import_diagnostics.createSingleDiagnosticError)({description: import_diagnostics.descriptions.UNRESOLVABLE.INVALID_MODE(serverMode)}, import_diagnostics.LwrServerError);
104
+ throw new import_diagnostics.LwrApplicationError(import_diagnostics.descriptions.APPLICATION.INVALID_MODE(serverMode));
105
105
  }
106
106
  return selectedMode;
107
107
  }
@@ -155,7 +155,7 @@ var ValidationContext = class {
155
155
  assertIsObject(node, property) {
156
156
  if (node?.type !== "object" && node) {
157
157
  this.diagnostics.push({
158
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "object", node.type),
158
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "object", node.type),
159
159
  location: this.getLocationFromNode(node)
160
160
  });
161
161
  }
@@ -163,7 +163,7 @@ var ValidationContext = class {
163
163
  assertIsBoolean(node, property) {
164
164
  if (node && node.type !== "boolean") {
165
165
  this.diagnostics.push({
166
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "boolean", node.type),
166
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "boolean", node.type),
167
167
  location: this.getLocationFromNode(node)
168
168
  });
169
169
  }
@@ -171,7 +171,7 @@ var ValidationContext = class {
171
171
  assertIsArray(node, property) {
172
172
  if (node && node.type !== "array") {
173
173
  this.diagnostics.push({
174
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
174
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
175
175
  location: this.getLocationFromNode(node)
176
176
  });
177
177
  }
@@ -179,7 +179,7 @@ var ValidationContext = class {
179
179
  assertIsSpecifier(node, property) {
180
180
  if (node && (node.type !== "string" || !(0, import_shared_utils.isSpecifier)(node.value))) {
181
181
  this.diagnostics.push({
182
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_SPECIFIER(property, node.value),
182
+ description: import_diagnostics.descriptions.CONFIG.INVALID_SPECIFIER(property, node.value),
183
183
  location: this.getLocationFromNode(node)
184
184
  });
185
185
  }
@@ -201,7 +201,7 @@ var ValidationContext = class {
201
201
  } catch (e) {
202
202
  misMatch = matcher[i];
203
203
  this.diagnostics.push({
204
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
204
+ description: import_diagnostics.descriptions.CONFIG.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
205
205
  location: this.getLocationFromNode(node)
206
206
  });
207
207
  }
@@ -217,7 +217,7 @@ var ValidationContext = class {
217
217
  assertIsPath(node, property) {
218
218
  if (node && (node.type !== "string" || node.value[0] !== "/")) {
219
219
  this.diagnostics.push({
220
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_PATH(property, node.value),
220
+ description: import_diagnostics.descriptions.CONFIG.INVALID_PATH(property, node.value),
221
221
  location: this.getLocationFromNode(node)
222
222
  });
223
223
  }
@@ -225,7 +225,7 @@ var ValidationContext = class {
225
225
  assertIsOrigin(node, property) {
226
226
  if (node && (node.type !== "string" || !/^https?:\/\//i.test(node.value))) {
227
227
  this.diagnostics.push({
228
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_ORIGIN(property, node.value),
228
+ description: import_diagnostics.descriptions.CONFIG.INVALID_ORIGIN(property, node.value),
229
229
  location: this.getLocationFromNode(node)
230
230
  });
231
231
  }
@@ -233,7 +233,7 @@ var ValidationContext = class {
233
233
  assertIsPort(node, property) {
234
234
  if (node && (node.type !== "number" || node.value < 0 || node.value > 65353)) {
235
235
  this.diagnostics.push({
236
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_PORT(property, node.value),
236
+ description: import_diagnostics.descriptions.CONFIG.INVALID_PORT(property, node.value),
237
237
  location: this.getLocationFromNode(node)
238
238
  });
239
239
  }
@@ -241,7 +241,7 @@ var ValidationContext = class {
241
241
  assertIsServerType(node, property) {
242
242
  if (node && node.value !== "express" && node.value !== "koa" && node.value !== "fs") {
243
243
  this.diagnostics.push({
244
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_SERVER_TYPE(property, node.value),
244
+ description: import_diagnostics.descriptions.CONFIG.INVALID_SERVER_TYPE(property, node.value),
245
245
  location: this.getLocationFromNode(node)
246
246
  });
247
247
  }
@@ -249,7 +249,7 @@ var ValidationContext = class {
249
249
  assertIsStaticSiteGenerator(node, property) {
250
250
  if (node && node.type !== "object") {
251
251
  this.diagnostics.push({
252
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_GENERATOR_CONFIG(property, node.value),
252
+ description: import_diagnostics.descriptions.CONFIG.INVALID_GENERATOR_CONFIG(property, node.value),
253
253
  location: this.getLocationFromNode(node)
254
254
  });
255
255
  }
@@ -257,7 +257,7 @@ var ValidationContext = class {
257
257
  assertIsMethod(node, property) {
258
258
  if (node && node.value !== "get" && node.value !== "post") {
259
259
  this.diagnostics.push({
260
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_METHOD(property, node.value),
260
+ description: import_diagnostics.descriptions.CONFIG.INVALID_METHOD(property, node.value),
261
261
  location: this.getLocationFromNode(node)
262
262
  });
263
263
  }
@@ -265,7 +265,7 @@ var ValidationContext = class {
265
265
  assertIsStatus(node, property) {
266
266
  if (node && node.value !== 404 && node.value !== 500) {
267
267
  this.diagnostics.push({
268
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_STATUS(property, node.value),
268
+ description: import_diagnostics.descriptions.CONFIG.INVALID_STATUS(property, node.value),
269
269
  location: this.getLocationFromNode(node)
270
270
  });
271
271
  }
@@ -290,7 +290,7 @@ var ValidationContext = class {
290
290
  }
291
291
  if (node.type !== "object" || supportedProperty && !defaultProperty) {
292
292
  this.diagnostics.push({
293
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_ENVIRONMENT(property),
293
+ description: import_diagnostics.descriptions.CONFIG.INVALID_ENVIRONMENT(property),
294
294
  location: this.getLocationFromNode(node)
295
295
  });
296
296
  }
@@ -301,14 +301,14 @@ var ValidationContext = class {
301
301
  }
302
302
  if (node.type !== "string") {
303
303
  this.diagnostics.push({
304
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "string", node.type),
304
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "string", node.type),
305
305
  location: this.getLocationFromNode(node)
306
306
  });
307
307
  } else if (node.value === "" || allowSlash && node.value === "/") {
308
308
  return;
309
309
  } else if (node.value.match(BASE_PATH_REGEX) === null) {
310
310
  this.diagnostics.push({
311
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_BASEPATH(property, node.value),
311
+ description: import_diagnostics.descriptions.CONFIG.INVALID_BASEPATH(property, node.value),
312
312
  location: this.getLocationFromNode(node)
313
313
  });
314
314
  }
@@ -319,12 +319,12 @@ var ValidationContext = class {
319
319
  }
320
320
  if (node.type !== "string") {
321
321
  this.diagnostics.push({
322
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "string", node.type),
322
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "string", node.type),
323
323
  location: this.getLocationFromNode(node)
324
324
  });
325
325
  } else if (!isNotEmptyString(node)) {
326
326
  this.diagnostics.push({
327
- description: import_diagnostics.descriptions.CONFIG_PARSER.NON_EMPTY_STRING(property, node.value),
327
+ description: import_diagnostics.descriptions.CONFIG.NON_EMPTY_STRING(property, node.value),
328
328
  location: this.getLocationFromNode(node)
329
329
  });
330
330
  }
@@ -335,12 +335,12 @@ var ValidationContext = class {
335
335
  }
336
336
  if (node.type !== "array") {
337
337
  this.diagnostics.push({
338
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
338
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
339
339
  location: this.getLocationFromNode(node)
340
340
  });
341
341
  } else if (!node.children || node.children.length === 0) {
342
342
  this.diagnostics.push({
343
- description: import_diagnostics.descriptions.CONFIG_PARSER.NON_EMPTY_ARRAY(property, "[]"),
343
+ description: import_diagnostics.descriptions.CONFIG.NON_EMPTY_ARRAY(property, "[]"),
344
344
  location: this.getLocationFromNode(node)
345
345
  });
346
346
  }
@@ -348,7 +348,7 @@ var ValidationContext = class {
348
348
  assertHasOneOrMore(node, property, childProps) {
349
349
  if (!childProps.some((p) => (0, import_jsonc_parser.findNodeAtLocation)(node, [p]) !== void 0)) {
350
350
  this.diagnostics.push({
351
- description: import_diagnostics.descriptions.CONFIG_PARSER.MISSING_ONE_OF(property, childProps),
351
+ description: import_diagnostics.descriptions.CONFIG.MISSING_ONE_OF(property, childProps),
352
352
  location: this.getLocationFromNode(node)
353
353
  });
354
354
  }
@@ -356,7 +356,7 @@ var ValidationContext = class {
356
356
  assertHasOnlyOne(node, property, childProps) {
357
357
  if (childProps.filter((p) => (0, import_jsonc_parser.findNodeAtLocation)(node, [p])).length !== 1) {
358
358
  this.diagnostics.push({
359
- description: import_diagnostics.descriptions.CONFIG_PARSER.TOO_MANY(property, childProps),
359
+ description: import_diagnostics.descriptions.CONFIG.TOO_MANY(property, childProps),
360
360
  location: this.getLocationFromNode(node)
361
361
  });
362
362
  }
@@ -367,14 +367,14 @@ var ValidationContext = class {
367
367
  }
368
368
  if (node.type !== "array") {
369
369
  this.diagnostics.push({
370
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
370
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
371
371
  location: this.getLocationFromNode(node)
372
372
  });
373
373
  } else if (node.children && node.children.length > 0) {
374
374
  node.children.forEach((n, index) => {
375
375
  if (!isNotEmptyString(n)) {
376
376
  this.diagnostics.push({
377
- description: import_diagnostics.descriptions.CONFIG_PARSER.NON_EMPTY_STRING(`${property}[${index}]`, n.value),
377
+ description: import_diagnostics.descriptions.CONFIG.NON_EMPTY_STRING(`${property}[${index}]`, n.value),
378
378
  location: this.getLocationFromNode(n)
379
379
  });
380
380
  }
@@ -387,14 +387,14 @@ var ValidationContext = class {
387
387
  }
388
388
  if (node.type !== "array") {
389
389
  this.diagnostics.push({
390
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
390
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
391
391
  location: this.getLocationFromNode(node)
392
392
  });
393
393
  } else if (node.children && node.children.length > 0) {
394
394
  node.children.forEach((n, index) => {
395
395
  if (n.type !== "string" || !(0, import_shared_utils.isSpecifier)(n.value)) {
396
396
  this.diagnostics.push({
397
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_SPECIFIER(`${property}[${index}]`, n.value),
397
+ description: import_diagnostics.descriptions.CONFIG.INVALID_SPECIFIER(`${property}[${index}]`, n.value),
398
398
  location: this.getLocationFromNode(n)
399
399
  });
400
400
  }
@@ -407,7 +407,7 @@ var ValidationContext = class {
407
407
  }
408
408
  if (node.type !== "array") {
409
409
  this.diagnostics.push({
410
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
410
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
411
411
  location: this.getLocationFromNode(node)
412
412
  });
413
413
  } else if (node.children && node.children.length > 0) {
@@ -420,7 +420,7 @@ var ValidationContext = class {
420
420
  }
421
421
  if (node.type !== "array") {
422
422
  this.diagnostics.push({
423
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, "array", node.type),
423
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(property, "array", node.type),
424
424
  location: this.getLocationFromNode(node)
425
425
  });
426
426
  } else if (node.children && node.children.length > 0) {
@@ -434,7 +434,7 @@ var ValidationContext = class {
434
434
  }
435
435
  if (!(0, import_shared_utils.isSpecifier)(specifier)) {
436
436
  this.diagnostics.push({
437
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_SPECIFIER(`${property}[${index}]`, specifier),
437
+ description: import_diagnostics.descriptions.CONFIG.INVALID_SPECIFIER(`${property}[${index}]`, specifier),
438
438
  location: this.getLocationFromNode(n)
439
439
  });
440
440
  }
@@ -447,12 +447,12 @@ var ValidationContext = class {
447
447
  }
448
448
  if (node.type !== "string" && node.type !== "object") {
449
449
  this.diagnostics.push({
450
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(index !== void 0 ? `${property}[${index}]` : property, "string or object", node.type),
450
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(index !== void 0 ? `${property}[${index}]` : property, "string or object", node.type),
451
451
  location: this.getLocationFromNode(node)
452
452
  });
453
453
  } else if (node.type === "string" && !isNotEmptyString(node)) {
454
454
  this.diagnostics.push({
455
- description: import_diagnostics.descriptions.CONFIG_PARSER.NON_EMPTY_STRING(property, node.value),
455
+ description: import_diagnostics.descriptions.CONFIG.NON_EMPTY_STRING(property, node.value),
456
456
  location: this.getLocationFromNode(node)
457
457
  });
458
458
  }
@@ -463,13 +463,13 @@ var ValidationContext = class {
463
463
  }
464
464
  if (node.type !== "string" && node.type !== "array") {
465
465
  this.diagnostics.push({
466
- description: import_diagnostics.descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(index !== void 0 ? `${property}[${index}]` : property, "string or array", node.type),
466
+ description: import_diagnostics.descriptions.CONFIG.INCORRECT_NODE_TYPE(index !== void 0 ? `${property}[${index}]` : property, "string or array", node.type),
467
467
  location: this.getLocationFromNode(node)
468
468
  });
469
469
  }
470
470
  if (node.type === "string" && node.value.length === 0 || node.type === "array" && node.children && (node.children.length !== 2 || !isNotEmptyString(node.children[0]))) {
471
471
  this.diagnostics.push({
472
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_SERVICE(index !== void 0 ? `${property}[${index}]` : property, node.value === void 0 && node.children ? `invalid Array[${node.children.length}]` : node.value),
472
+ description: import_diagnostics.descriptions.CONFIG.INVALID_SERVICE(index !== void 0 ? `${property}[${index}]` : property, node.value === void 0 && node.children ? `invalid Array[${node.children.length}]` : node.value),
473
473
  location: this.getLocationFromNode(node)
474
474
  });
475
475
  }
@@ -482,7 +482,7 @@ var ValidationContext = class {
482
482
  const dupeIds = ids.filter((id, index) => ids.indexOf(id) !== index);
483
483
  if (dupeIds.length > 0) {
484
484
  this.diagnostics.push({
485
- description: import_diagnostics.descriptions.CONFIG_PARSER.DUPLICATE_IDS(property, dupeIds),
485
+ description: import_diagnostics.descriptions.CONFIG.DUPLICATE_IDS(property, dupeIds),
486
486
  location: this.getLocationFromNode(nodes[0])
487
487
  });
488
488
  }
@@ -491,7 +491,7 @@ var ValidationContext = class {
491
491
  const missingProps = requiredPropertyKeys.filter((p) => (0, import_jsonc_parser.findNodeAtLocation)(node, [p]) === void 0);
492
492
  if (missingProps.length > 0) {
493
493
  this.diagnostics.push({
494
- description: import_diagnostics.descriptions.CONFIG_PARSER.MISSING_REQUIRED(property, missingProps),
494
+ description: import_diagnostics.descriptions.CONFIG.MISSING_REQUIRED(property, missingProps),
495
495
  location: this.getLocationFromNode(node)
496
496
  });
497
497
  }
@@ -500,7 +500,7 @@ var ValidationContext = class {
500
500
  const {children} = node;
501
501
  if (!children) {
502
502
  this.diagnostics.push({
503
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_EMPTY_NODE(property),
503
+ description: import_diagnostics.descriptions.CONFIG.INVALID_EMPTY_NODE(property),
504
504
  location: this.getLocationFromNode(node)
505
505
  });
506
506
  return;
@@ -511,7 +511,7 @@ var ValidationContext = class {
511
511
  const {type, value} = keyNode;
512
512
  if (type === "string" && !validPropertyKeys.includes(value)) {
513
513
  this.diagnostics.push({
514
- description: import_diagnostics.descriptions.CONFIG_PARSER.INVALID_PROPERTY(property, value),
514
+ description: import_diagnostics.descriptions.CONFIG.INVALID_PROPERTY(property, value),
515
515
  location: this.getLocationFromNode(keyNode)
516
516
  });
517
517
  }
@@ -522,7 +522,7 @@ var ValidationContext = class {
522
522
  assertNoBundleConfigDupes(node, dupes) {
523
523
  if (dupes.length) {
524
524
  this.diagnostics.push({
525
- description: import_diagnostics.descriptions.CONFIG_PARSER.DUPLICATE_BUNDLE_CONFIG(dupes),
525
+ description: import_diagnostics.descriptions.CONFIG.DUPLICATE_BUNDLE_CONFIG(dupes),
526
526
  location: this.getLocationFromNode(node)
527
527
  });
528
528
  }
@@ -530,7 +530,7 @@ var ValidationContext = class {
530
530
  assertDefaultInLocales(node, defaultLocale, localesIds) {
531
531
  if (!localesIds.includes(defaultLocale)) {
532
532
  this.diagnostics.push({
533
- description: import_diagnostics.descriptions.CONFIG_PARSER.DEFAULT_NOT_IN_LOCALES(defaultLocale, localesIds),
533
+ description: import_diagnostics.descriptions.CONFIG.DEFAULT_NOT_IN_LOCALES(defaultLocale, localesIds),
534
534
  location: this.getLocationFromNode(node)
535
535
  });
536
536
  }
@@ -545,7 +545,7 @@ var ValidationContext = class {
545
545
  if (fallbackNode?.value) {
546
546
  if (!localesIds.includes(fallbackNode.value)) {
547
547
  this.diagnostics.push({
548
- description: import_diagnostics.descriptions.CONFIG_PARSER.FALLBACK_NOT_IN_LOCALES(fallbackNode.value, localesIds),
548
+ description: import_diagnostics.descriptions.CONFIG.FALLBACK_NOT_IN_LOCALES(fallbackNode.value, localesIds),
549
549
  location: this.getLocationFromNode(fallbackNode)
550
550
  });
551
551
  }
@@ -557,7 +557,7 @@ var ValidationContext = class {
557
557
  const preloadData = (0, import_jsonc_parser.findNodeAtLocation)(node, ["preloadData"])?.value;
558
558
  if (ssr === true && preloadData === false) {
559
559
  this.diagnostics.push({
560
- description: import_diagnostics.descriptions.CONFIG_PARSER.SSR_WITHOUT_PRELOAD(propPrefix),
560
+ description: import_diagnostics.descriptions.CONFIG.SSR_WITHOUT_PRELOAD(propPrefix),
561
561
  location: this.getLocationFromNode(node)
562
562
  });
563
563
  }
@@ -288,15 +288,12 @@ function validateLwrAppConfig(config, phase) {
288
288
  const {error, length, offset} = errors[0];
289
289
  const message = (0, import_jsonc_parser.printParseErrorCode)(error);
290
290
  const sourceLocation = (0, import_helpers.calculatePositionFromSource)(jsonSourceText, {length, offset});
291
- throw (0, import_diagnostics2.createSingleDiagnosticError)({
292
- location: sourceLocation,
293
- description: import_diagnostics2.descriptions.CONFIG_PARSER.INVALID_JSON(message)
294
- }, import_diagnostics2.LwrConfigValidationError);
291
+ throw new import_diagnostics2.LwrConfigError(import_diagnostics2.descriptions.CONFIG.INVALID_JSON(message));
295
292
  }
296
293
  const validationContext = new import_app_config_context.ValidationContext(jsonSourceText);
297
294
  validateRoot(rootNode, validationContext, preMerge);
298
295
  if (validationContext.diagnostics.length) {
299
- throw new import_diagnostics2.LwrConfigValidationError(`Configuration validation errors in ${SOURCE_BY_PHASE[phase]}`, validationContext.diagnostics);
296
+ throw new import_diagnostics2.LwrConfigError(`Configuration validation errors in ${SOURCE_BY_PHASE[phase]}`, validationContext.diagnostics);
300
297
  }
301
298
  if (phase === "file" && jsonSourceText.includes("/lwr-info")) {
302
299
  import_diagnostics.logger.warn({label: `config`, message: `LWR Config file attempted to override "/lwr-info" path`});
@@ -16,7 +16,7 @@ export interface Configurations {
16
16
  * By default, this file is expected to be named `lwr.config.json` and be located at the root directory.
17
17
  * This default expectation can be override with the `lwrConfigFile` configuration.
18
18
  *
19
- * @throws {LwrConfigValidationError} Validation errors will be swallowed when the
19
+ * @throws {LwrConfigError} Validation errors will be swallowed when the
20
20
  * `UNSAFE_IGNORE_CONFIG_VALIDATION` flag is set.
21
21
  *
22
22
  * @param {string} lwrConfigPath - config file path override
@@ -21,7 +21,7 @@ import { getTracer, ConfigSpan } from '@lwrjs/instrumentation';
21
21
  * By default, this file is expected to be named `lwr.config.json` and be located at the root directory.
22
22
  * This default expectation can be override with the `lwrConfigFile` configuration.
23
23
  *
24
- * @throws {LwrConfigValidationError} Validation errors will be swallowed when the
24
+ * @throws {LwrConfigError} Validation errors will be swallowed when the
25
25
  * `UNSAFE_IGNORE_CONFIG_VALIDATION` flag is set.
26
26
  *
27
27
  * @param {string} lwrConfigPath - config file path override
@@ -62,7 +62,7 @@ function createCacheFolder(cache, rootDir) {
62
62
  * Configurations are merged in the following order:
63
63
  * defaults -> environment variables -> config file (lwr.config.json) -> config argument
64
64
  *
65
- * @throws {LwrConfigValidationError} Validation errors will not be caught without the
65
+ * @throws {LwrConfigError} Validation errors will not be caught without the
66
66
  * `UNSAFE_IGNORE_CONFIG_VALIDATION` flag.
67
67
  *
68
68
  * @param {LwrGlobalConfig} configArg - programmatic global config
@@ -4,7 +4,7 @@ export declare const RUNTIME_CONFIGS: Record<string, ServerModeConfig>;
4
4
  /**
5
5
  * Get server mode config by name
6
6
  *
7
- * @throws {LwrServerError} Mode must be supported by LWR.
7
+ * @throws {LwrApplicationError} Mode must be supported by LWR.
8
8
  *
9
9
  * @param {string} serverMode - the name of the server mode
10
10
  * @returns {ServerModeConfig} the server mode config
@@ -1,4 +1,4 @@
1
- import { createSingleDiagnosticError, descriptions, LwrServerError } from '@lwrjs/diagnostics';
1
+ import { descriptions, LwrApplicationError } from '@lwrjs/diagnostics';
2
2
  import { getFeatureFlags } from '@lwrjs/shared-utils';
3
3
  export const DEFAULT_I18N_CONFIG = {
4
4
  defaultLocale: 'en-US',
@@ -70,7 +70,7 @@ export const RUNTIME_CONFIGS = {
70
70
  /**
71
71
  * Get server mode config by name
72
72
  *
73
- * @throws {LwrServerError} Mode must be supported by LWR.
73
+ * @throws {LwrApplicationError} Mode must be supported by LWR.
74
74
  *
75
75
  * @param {string} serverMode - the name of the server mode
76
76
  * @returns {ServerModeConfig} the server mode config
@@ -78,7 +78,7 @@ export const RUNTIME_CONFIGS = {
78
78
  export function getServerModeConfig(serverMode) {
79
79
  const selectedMode = RUNTIME_CONFIGS[serverMode];
80
80
  if (!selectedMode) {
81
- throw createSingleDiagnosticError({ description: descriptions.UNRESOLVABLE.INVALID_MODE(serverMode) }, LwrServerError);
81
+ throw new LwrApplicationError(descriptions.APPLICATION.INVALID_MODE(serverMode));
82
82
  }
83
83
  return selectedMode;
84
84
  }
@@ -118,7 +118,7 @@ export class ValidationContext {
118
118
  assertIsObject(node, property) {
119
119
  if (node?.type !== 'object' && node) {
120
120
  this.diagnostics.push({
121
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'object', node.type),
121
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'object', node.type),
122
122
  location: this.getLocationFromNode(node),
123
123
  });
124
124
  }
@@ -126,7 +126,7 @@ export class ValidationContext {
126
126
  assertIsBoolean(node, property) {
127
127
  if (node && node.type !== 'boolean') {
128
128
  this.diagnostics.push({
129
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'boolean', node.type),
129
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'boolean', node.type),
130
130
  location: this.getLocationFromNode(node),
131
131
  });
132
132
  }
@@ -134,7 +134,7 @@ export class ValidationContext {
134
134
  assertIsArray(node, property) {
135
135
  if (node && node.type !== 'array') {
136
136
  this.diagnostics.push({
137
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
137
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
138
138
  location: this.getLocationFromNode(node),
139
139
  });
140
140
  }
@@ -142,7 +142,7 @@ export class ValidationContext {
142
142
  assertIsSpecifier(node, property) {
143
143
  if (node && (node.type !== 'string' || !isSpecifier(node.value))) {
144
144
  this.diagnostics.push({
145
- description: descriptions.CONFIG_PARSER.INVALID_SPECIFIER(property, node.value),
145
+ description: descriptions.CONFIG.INVALID_SPECIFIER(property, node.value),
146
146
  location: this.getLocationFromNode(node),
147
147
  });
148
148
  }
@@ -167,7 +167,7 @@ export class ValidationContext {
167
167
  catch (e) {
168
168
  misMatch = matcher[i];
169
169
  this.diagnostics.push({
170
- description: descriptions.CONFIG_PARSER.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
170
+ description: descriptions.CONFIG.INVALID_FILE_PATTERN(`${property}[${index}].match`, misMatch),
171
171
  location: this.getLocationFromNode(node)
172
172
  });
173
173
  }
@@ -183,7 +183,7 @@ export class ValidationContext {
183
183
  assertIsPath(node, property) {
184
184
  if (node && (node.type !== 'string' || node.value[0] !== '/')) {
185
185
  this.diagnostics.push({
186
- description: descriptions.CONFIG_PARSER.INVALID_PATH(property, node.value),
186
+ description: descriptions.CONFIG.INVALID_PATH(property, node.value),
187
187
  location: this.getLocationFromNode(node),
188
188
  });
189
189
  }
@@ -191,7 +191,7 @@ export class ValidationContext {
191
191
  assertIsOrigin(node, property) {
192
192
  if (node && (node.type !== 'string' || !/^https?:\/\//i.test(node.value))) {
193
193
  this.diagnostics.push({
194
- description: descriptions.CONFIG_PARSER.INVALID_ORIGIN(property, node.value),
194
+ description: descriptions.CONFIG.INVALID_ORIGIN(property, node.value),
195
195
  location: this.getLocationFromNode(node),
196
196
  });
197
197
  }
@@ -199,7 +199,7 @@ export class ValidationContext {
199
199
  assertIsPort(node, property) {
200
200
  if (node && (node.type !== 'number' || node.value < 0 || node.value > 65353)) {
201
201
  this.diagnostics.push({
202
- description: descriptions.CONFIG_PARSER.INVALID_PORT(property, node.value),
202
+ description: descriptions.CONFIG.INVALID_PORT(property, node.value),
203
203
  location: this.getLocationFromNode(node),
204
204
  });
205
205
  }
@@ -207,7 +207,7 @@ export class ValidationContext {
207
207
  assertIsServerType(node, property) {
208
208
  if (node && node.value !== 'express' && node.value !== 'koa' && node.value !== 'fs') {
209
209
  this.diagnostics.push({
210
- description: descriptions.CONFIG_PARSER.INVALID_SERVER_TYPE(property, node.value),
210
+ description: descriptions.CONFIG.INVALID_SERVER_TYPE(property, node.value),
211
211
  location: this.getLocationFromNode(node),
212
212
  });
213
213
  }
@@ -215,7 +215,7 @@ export class ValidationContext {
215
215
  assertIsStaticSiteGenerator(node, property) {
216
216
  if (node && node.type !== 'object') {
217
217
  this.diagnostics.push({
218
- description: descriptions.CONFIG_PARSER.INVALID_GENERATOR_CONFIG(property, node.value),
218
+ description: descriptions.CONFIG.INVALID_GENERATOR_CONFIG(property, node.value),
219
219
  location: this.getLocationFromNode(node),
220
220
  });
221
221
  }
@@ -223,7 +223,7 @@ export class ValidationContext {
223
223
  assertIsMethod(node, property) {
224
224
  if (node && node.value !== 'get' && node.value !== 'post') {
225
225
  this.diagnostics.push({
226
- description: descriptions.CONFIG_PARSER.INVALID_METHOD(property, node.value),
226
+ description: descriptions.CONFIG.INVALID_METHOD(property, node.value),
227
227
  location: this.getLocationFromNode(node),
228
228
  });
229
229
  }
@@ -231,7 +231,7 @@ export class ValidationContext {
231
231
  assertIsStatus(node, property) {
232
232
  if (node && node.value !== 404 && node.value !== 500) {
233
233
  this.diagnostics.push({
234
- description: descriptions.CONFIG_PARSER.INVALID_STATUS(property, node.value),
234
+ description: descriptions.CONFIG.INVALID_STATUS(property, node.value),
235
235
  location: this.getLocationFromNode(node),
236
236
  });
237
237
  }
@@ -256,7 +256,7 @@ export class ValidationContext {
256
256
  }
257
257
  if (node.type !== 'object' || (supportedProperty && !defaultProperty)) {
258
258
  this.diagnostics.push({
259
- description: descriptions.CONFIG_PARSER.INVALID_ENVIRONMENT(property),
259
+ description: descriptions.CONFIG.INVALID_ENVIRONMENT(property),
260
260
  location: this.getLocationFromNode(node),
261
261
  });
262
262
  }
@@ -267,7 +267,7 @@ export class ValidationContext {
267
267
  }
268
268
  if (node.type !== 'string') {
269
269
  this.diagnostics.push({
270
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'string', node.type),
270
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'string', node.type),
271
271
  location: this.getLocationFromNode(node),
272
272
  });
273
273
  }
@@ -276,7 +276,7 @@ export class ValidationContext {
276
276
  }
277
277
  else if (node.value.match(BASE_PATH_REGEX) === null) {
278
278
  this.diagnostics.push({
279
- description: descriptions.CONFIG_PARSER.INVALID_BASEPATH(property, node.value),
279
+ description: descriptions.CONFIG.INVALID_BASEPATH(property, node.value),
280
280
  location: this.getLocationFromNode(node),
281
281
  });
282
282
  }
@@ -287,13 +287,13 @@ export class ValidationContext {
287
287
  }
288
288
  if (node.type !== 'string') {
289
289
  this.diagnostics.push({
290
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'string', node.type),
290
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'string', node.type),
291
291
  location: this.getLocationFromNode(node),
292
292
  });
293
293
  }
294
294
  else if (!isNotEmptyString(node)) {
295
295
  this.diagnostics.push({
296
- description: descriptions.CONFIG_PARSER.NON_EMPTY_STRING(property, node.value),
296
+ description: descriptions.CONFIG.NON_EMPTY_STRING(property, node.value),
297
297
  location: this.getLocationFromNode(node),
298
298
  });
299
299
  }
@@ -304,13 +304,13 @@ export class ValidationContext {
304
304
  }
305
305
  if (node.type !== 'array') {
306
306
  this.diagnostics.push({
307
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
307
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
308
308
  location: this.getLocationFromNode(node),
309
309
  });
310
310
  }
311
311
  else if (!node.children || node.children.length === 0) {
312
312
  this.diagnostics.push({
313
- description: descriptions.CONFIG_PARSER.NON_EMPTY_ARRAY(property, '[]'),
313
+ description: descriptions.CONFIG.NON_EMPTY_ARRAY(property, '[]'),
314
314
  location: this.getLocationFromNode(node),
315
315
  });
316
316
  }
@@ -319,7 +319,7 @@ export class ValidationContext {
319
319
  // At least one of the given child properties of node must exist
320
320
  if (!childProps.some((p) => findNodeAtLocation(node, [p]) !== undefined)) {
321
321
  this.diagnostics.push({
322
- description: descriptions.CONFIG_PARSER.MISSING_ONE_OF(property, childProps),
322
+ description: descriptions.CONFIG.MISSING_ONE_OF(property, childProps),
323
323
  location: this.getLocationFromNode(node),
324
324
  });
325
325
  }
@@ -328,7 +328,7 @@ export class ValidationContext {
328
328
  // One and ONLY one of the given child properties of node must exist
329
329
  if (childProps.filter((p) => findNodeAtLocation(node, [p])).length !== 1) {
330
330
  this.diagnostics.push({
331
- description: descriptions.CONFIG_PARSER.TOO_MANY(property, childProps),
331
+ description: descriptions.CONFIG.TOO_MANY(property, childProps),
332
332
  location: this.getLocationFromNode(node),
333
333
  });
334
334
  }
@@ -339,7 +339,7 @@ export class ValidationContext {
339
339
  }
340
340
  if (node.type !== 'array') {
341
341
  this.diagnostics.push({
342
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
342
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
343
343
  location: this.getLocationFromNode(node),
344
344
  });
345
345
  }
@@ -347,7 +347,7 @@ export class ValidationContext {
347
347
  node.children.forEach((n, index) => {
348
348
  if (!isNotEmptyString(n)) {
349
349
  this.diagnostics.push({
350
- description: descriptions.CONFIG_PARSER.NON_EMPTY_STRING(`${property}[${index}]`, n.value),
350
+ description: descriptions.CONFIG.NON_EMPTY_STRING(`${property}[${index}]`, n.value),
351
351
  location: this.getLocationFromNode(n),
352
352
  });
353
353
  }
@@ -360,7 +360,7 @@ export class ValidationContext {
360
360
  }
361
361
  if (node.type !== 'array') {
362
362
  this.diagnostics.push({
363
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
363
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
364
364
  location: this.getLocationFromNode(node),
365
365
  });
366
366
  }
@@ -368,7 +368,7 @@ export class ValidationContext {
368
368
  node.children.forEach((n, index) => {
369
369
  if (n.type !== 'string' || !isSpecifier(n.value)) {
370
370
  this.diagnostics.push({
371
- description: descriptions.CONFIG_PARSER.INVALID_SPECIFIER(`${property}[${index}]`, n.value),
371
+ description: descriptions.CONFIG.INVALID_SPECIFIER(`${property}[${index}]`, n.value),
372
372
  location: this.getLocationFromNode(n),
373
373
  });
374
374
  }
@@ -381,7 +381,7 @@ export class ValidationContext {
381
381
  }
382
382
  if (node.type !== 'array') {
383
383
  this.diagnostics.push({
384
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
384
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
385
385
  location: this.getLocationFromNode(node),
386
386
  });
387
387
  }
@@ -395,7 +395,7 @@ export class ValidationContext {
395
395
  }
396
396
  if (node.type !== 'array') {
397
397
  this.diagnostics.push({
398
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(property, 'array', node.type),
398
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(property, 'array', node.type),
399
399
  location: this.getLocationFromNode(node),
400
400
  });
401
401
  }
@@ -411,7 +411,7 @@ export class ValidationContext {
411
411
  }
412
412
  if (!isSpecifier(specifier)) {
413
413
  this.diagnostics.push({
414
- description: descriptions.CONFIG_PARSER.INVALID_SPECIFIER(`${property}[${index}]`, specifier),
414
+ description: descriptions.CONFIG.INVALID_SPECIFIER(`${property}[${index}]`, specifier),
415
415
  location: this.getLocationFromNode(n),
416
416
  });
417
417
  }
@@ -424,13 +424,13 @@ export class ValidationContext {
424
424
  }
425
425
  if (node.type !== 'string' && node.type !== 'object') {
426
426
  this.diagnostics.push({
427
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(index !== undefined ? `${property}[${index}]` : property, 'string or object', node.type),
427
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(index !== undefined ? `${property}[${index}]` : property, 'string or object', node.type),
428
428
  location: this.getLocationFromNode(node),
429
429
  });
430
430
  }
431
431
  else if (node.type === 'string' && !isNotEmptyString(node)) {
432
432
  this.diagnostics.push({
433
- description: descriptions.CONFIG_PARSER.NON_EMPTY_STRING(property, node.value),
433
+ description: descriptions.CONFIG.NON_EMPTY_STRING(property, node.value),
434
434
  location: this.getLocationFromNode(node),
435
435
  });
436
436
  }
@@ -441,7 +441,7 @@ export class ValidationContext {
441
441
  }
442
442
  if (node.type !== 'string' && node.type !== 'array') {
443
443
  this.diagnostics.push({
444
- description: descriptions.CONFIG_PARSER.INCORRECT_NODE_TYPE(index !== undefined ? `${property}[${index}]` : property, 'string or array', node.type),
444
+ description: descriptions.CONFIG.INCORRECT_NODE_TYPE(index !== undefined ? `${property}[${index}]` : property, 'string or array', node.type),
445
445
  location: this.getLocationFromNode(node),
446
446
  });
447
447
  }
@@ -450,7 +450,7 @@ export class ValidationContext {
450
450
  node.children &&
451
451
  (node.children.length !== 2 || !isNotEmptyString(node.children[0])))) {
452
452
  this.diagnostics.push({
453
- description: descriptions.CONFIG_PARSER.INVALID_SERVICE(index !== undefined ? `${property}[${index}]` : property, node.value === undefined && node.children
453
+ description: descriptions.CONFIG.INVALID_SERVICE(index !== undefined ? `${property}[${index}]` : property, node.value === undefined && node.children
454
454
  ? `invalid Array[${node.children.length}]`
455
455
  : node.value),
456
456
  location: this.getLocationFromNode(node),
@@ -467,7 +467,7 @@ export class ValidationContext {
467
467
  const dupeIds = ids.filter((id, index) => ids.indexOf(id) !== index);
468
468
  if (dupeIds.length > 0) {
469
469
  this.diagnostics.push({
470
- description: descriptions.CONFIG_PARSER.DUPLICATE_IDS(property, dupeIds),
470
+ description: descriptions.CONFIG.DUPLICATE_IDS(property, dupeIds),
471
471
  location: this.getLocationFromNode(nodes[0]),
472
472
  });
473
473
  }
@@ -477,7 +477,7 @@ export class ValidationContext {
477
477
  const missingProps = requiredPropertyKeys.filter((p) => findNodeAtLocation(node, [p]) === undefined);
478
478
  if (missingProps.length > 0) {
479
479
  this.diagnostics.push({
480
- description: descriptions.CONFIG_PARSER.MISSING_REQUIRED(property, missingProps),
480
+ description: descriptions.CONFIG.MISSING_REQUIRED(property, missingProps),
481
481
  location: this.getLocationFromNode(node),
482
482
  });
483
483
  }
@@ -486,7 +486,7 @@ export class ValidationContext {
486
486
  const { children } = node;
487
487
  if (!children) {
488
488
  this.diagnostics.push({
489
- description: descriptions.CONFIG_PARSER.INVALID_EMPTY_NODE(property),
489
+ description: descriptions.CONFIG.INVALID_EMPTY_NODE(property),
490
490
  location: this.getLocationFromNode(node),
491
491
  });
492
492
  return;
@@ -498,7 +498,7 @@ export class ValidationContext {
498
498
  const { type, value } = keyNode;
499
499
  if (type === 'string' && !validPropertyKeys.includes(value)) {
500
500
  this.diagnostics.push({
501
- description: descriptions.CONFIG_PARSER.INVALID_PROPERTY(property, value),
501
+ description: descriptions.CONFIG.INVALID_PROPERTY(property, value),
502
502
  location: this.getLocationFromNode(keyNode),
503
503
  });
504
504
  }
@@ -509,7 +509,7 @@ export class ValidationContext {
509
509
  assertNoBundleConfigDupes(node, dupes) {
510
510
  if (dupes.length) {
511
511
  this.diagnostics.push({
512
- description: descriptions.CONFIG_PARSER.DUPLICATE_BUNDLE_CONFIG(dupes),
512
+ description: descriptions.CONFIG.DUPLICATE_BUNDLE_CONFIG(dupes),
513
513
  location: this.getLocationFromNode(node),
514
514
  });
515
515
  }
@@ -517,7 +517,7 @@ export class ValidationContext {
517
517
  assertDefaultInLocales(node, defaultLocale, localesIds) {
518
518
  if (!localesIds.includes(defaultLocale)) {
519
519
  this.diagnostics.push({
520
- description: descriptions.CONFIG_PARSER.DEFAULT_NOT_IN_LOCALES(defaultLocale, localesIds),
520
+ description: descriptions.CONFIG.DEFAULT_NOT_IN_LOCALES(defaultLocale, localesIds),
521
521
  location: this.getLocationFromNode(node),
522
522
  });
523
523
  }
@@ -534,7 +534,7 @@ export class ValidationContext {
534
534
  if (fallbackNode?.value) {
535
535
  if (!localesIds.includes(fallbackNode.value)) {
536
536
  this.diagnostics.push({
537
- description: descriptions.CONFIG_PARSER.FALLBACK_NOT_IN_LOCALES(fallbackNode.value, localesIds),
537
+ description: descriptions.CONFIG.FALLBACK_NOT_IN_LOCALES(fallbackNode.value, localesIds),
538
538
  location: this.getLocationFromNode(fallbackNode),
539
539
  });
540
540
  }
@@ -546,7 +546,7 @@ export class ValidationContext {
546
546
  const preloadData = findNodeAtLocation(node, ['preloadData'])?.value;
547
547
  if (ssr === true && preloadData === false) {
548
548
  this.diagnostics.push({
549
- description: descriptions.CONFIG_PARSER.SSR_WITHOUT_PRELOAD(propPrefix),
549
+ description: descriptions.CONFIG.SSR_WITHOUT_PRELOAD(propPrefix),
550
550
  location: this.getLocationFromNode(node),
551
551
  });
552
552
  }
@@ -1,6 +1,6 @@
1
1
  import { logger } from '@lwrjs/diagnostics';
2
2
  import { parseTree, printParseErrorCode, findNodeAtLocation as findNode, } from 'jsonc-parser';
3
- import { createSingleDiagnosticError, descriptions, LwrConfigValidationError } from '@lwrjs/diagnostics';
3
+ import { descriptions, LwrConfigError } from '@lwrjs/diagnostics';
4
4
  import { ASSET_DIR_ATTRIBUTE_KEYS, ASSET_FILE_ATTRIBUTE_KEYS, BOOTSTRAP_ATTRIBUTE_KEYS, ERROR_ROUTE_ATTRIBUTE_KEYS, I18N_ATTRIBUTE_KEYS, LOCKER_ATTRIBUTE_KEYS, ROOT_ATTRIBUTE_KEYS, ROUTE_ATTRIBUTE_KEYS, STATIC_SITE_GENERATOR_ATTRIBUTE_KEYS, ValidationContext, } from './app-config-context.js';
5
5
  import { calculatePositionFromSource } from './helpers.js';
6
6
  import { DEFAULT_ESM_BUNDLE_EXCLUSIONS, DEFAULT_AMD_BUNDLE_EXCLUSIONS } from '../defaults.js';
@@ -358,17 +358,14 @@ export function validateLwrAppConfig(config, phase) {
358
358
  const { error, length, offset } = errors[0];
359
359
  const message = printParseErrorCode(error);
360
360
  const sourceLocation = calculatePositionFromSource(jsonSourceText, { length, offset });
361
- throw createSingleDiagnosticError({
362
- location: sourceLocation,
363
- description: descriptions.CONFIG_PARSER.INVALID_JSON(message),
364
- }, LwrConfigValidationError);
361
+ throw new LwrConfigError(descriptions.CONFIG.INVALID_JSON(message));
365
362
  }
366
363
  // Validate from root
367
364
  const validationContext = new ValidationContext(jsonSourceText);
368
365
  validateRoot(rootNode, validationContext, preMerge);
369
366
  // Throw an error with all diagnostics at once
370
367
  if (validationContext.diagnostics.length) {
371
- throw new LwrConfigValidationError(`Configuration validation errors in ${SOURCE_BY_PHASE[phase]}`, validationContext.diagnostics);
368
+ throw new LwrConfigError(`Configuration validation errors in ${SOURCE_BY_PHASE[phase]}`, validationContext.diagnostics);
372
369
  }
373
370
  if (phase === 'file' && jsonSourceText.includes("/lwr-info")) {
374
371
  logger.warn({ label: `config`, message: `LWR Config file attempted to override "/lwr-info" path` });
@@ -1,8 +1,8 @@
1
- import type { SourceLocation } from '@lwrjs/diagnostics';
1
+ import type { DiagnosticLocation } from '@lwrjs/diagnostics';
2
2
  interface SourcePosition {
3
3
  offset: number;
4
4
  length: number;
5
5
  }
6
- export declare function calculatePositionFromSource(source: string, partialPosition: SourcePosition): SourceLocation;
6
+ export declare function calculatePositionFromSource(source: string, partialPosition: SourcePosition): DiagnosticLocation;
7
7
  export {};
8
8
  //# sourceMappingURL=helpers.d.ts.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.17.2-alpha.1",
7
+ "version": "0.17.2-alpha.2",
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.17.2-alpha.1",
46
- "@lwrjs/instrumentation": "0.17.2-alpha.1",
47
- "@lwrjs/shared-utils": "0.17.2-alpha.1",
45
+ "@lwrjs/diagnostics": "0.17.2-alpha.2",
46
+ "@lwrjs/instrumentation": "0.17.2-alpha.2",
47
+ "@lwrjs/shared-utils": "0.17.2-alpha.2",
48
48
  "fs-extra": "^11.2.0",
49
49
  "jsonc-parser": "^3.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@lwrjs/types": "0.17.2-alpha.1",
52
+ "@lwrjs/types": "0.17.2-alpha.2",
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": "bba15ca717a242b0375decaa378af06bdee813b5"
74
+ "gitHead": "739b237f5d7f2c1989142cb505a56cc763f21976"
75
75
  }