@lwrjs/diagnostics 0.17.2-alpha.0 → 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.
Files changed (34) hide show
  1. package/build/cjs/descriptions/application.cjs +11 -27
  2. package/build/cjs/descriptions/config.cjs +41 -0
  3. package/build/cjs/descriptions/index.cjs +2 -3
  4. package/build/cjs/descriptions/server.cjs +5 -31
  5. package/build/cjs/descriptions/unresolvable.cjs +16 -100
  6. package/build/cjs/errors.cjs +39 -33
  7. package/build/cjs/index.cjs +0 -1
  8. package/build/es/descriptions/application.d.ts +11 -10
  9. package/build/es/descriptions/application.js +11 -11
  10. package/build/es/descriptions/config.d.ts +30 -0
  11. package/build/es/descriptions/config.js +31 -0
  12. package/build/es/descriptions/index.d.ts +60 -234
  13. package/build/es/descriptions/index.js +2 -3
  14. package/build/es/descriptions/server.d.ts +5 -14
  15. package/build/es/descriptions/server.js +5 -15
  16. package/build/es/descriptions/unresolvable.d.ts +15 -82
  17. package/build/es/descriptions/unresolvable.js +15 -83
  18. package/build/es/errors.d.ts +36 -15
  19. package/build/es/errors.js +42 -34
  20. package/build/es/index.d.ts +0 -1
  21. package/build/es/index.js +0 -1
  22. package/package.json +3 -3
  23. package/build/cjs/descriptions/compiler.cjs +0 -35
  24. package/build/cjs/descriptions/configParser.cjs +0 -150
  25. package/build/cjs/descriptions/core-diagnostics.cjs +0 -37
  26. package/build/cjs/types.cjs +0 -5
  27. package/build/es/descriptions/compiler.d.ts +0 -7
  28. package/build/es/descriptions/compiler.js +0 -8
  29. package/build/es/descriptions/configParser.d.ts +0 -129
  30. package/build/es/descriptions/configParser.js +0 -123
  31. package/build/es/descriptions/core-diagnostics.d.ts +0 -3
  32. package/build/es/descriptions/core-diagnostics.js +0 -27
  33. package/build/es/types.d.ts +0 -160
  34. package/build/es/types.js +0 -2
@@ -1,39 +1,23 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
2
  var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
3
  var __export = (target, all) => {
9
4
  for (var name in all)
10
5
  __defProp(target, name, {get: all[name], enumerable: true});
11
6
  };
12
- var __exportStar = (target, module2, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && key !== "default")
16
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
- }
18
- return target;
19
- };
20
- var __toModule = (module2) => {
21
- return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
- };
23
7
 
24
8
  // packages/@lwrjs/diagnostics/src/descriptions/application.ts
25
9
  __markAsModule(exports);
26
10
  __export(exports, {
27
11
  application: () => application
28
12
  });
29
- var import_core_diagnostics = __toModule(require("./core-diagnostics.cjs"));
30
- var application = (0, import_core_diagnostics.createDiagnosticsCategory)({
31
- ROUTE_HANDLER_ERROR: (route, error) => ({
32
- category: "lwrApplication/routeHandler",
33
- message: `An error occurred executing route handler for "${route}": "${error}"`
34
- }),
35
- SSR_ERROR: (specifier, error) => ({
36
- category: "lwrApplication/ssr",
37
- message: `Server-side rendering for "${specifier}" failed: ${error}`
38
- })
39
- });
13
+ var application = {
14
+ INVALID_JSON: () => "400: Accept header and json query parameter are incompatible",
15
+ INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
16
+ INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
17
+ INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
18
+ PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
19
+ INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`,
20
+ SSR_ERROR: (specifier, error) => `Server-side rendering for "${specifier}" failed: ${error}`,
21
+ SSR_TIMEOUT: (specifier, time) => `Server side rendering or data prefetching for '${escape(specifier)}' timed out after ${time}ms`,
22
+ ROUTE_HANDLER_ERROR: (route, error) => `An error occurred executing route handler for "${route}": "${error}"`
23
+ };
@@ -0,0 +1,41 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+
8
+ // packages/@lwrjs/diagnostics/src/descriptions/config.ts
9
+ __markAsModule(exports);
10
+ __export(exports, {
11
+ config: () => config
12
+ });
13
+ var config = {
14
+ INVALID_JSON: (invalidJsonError) => `Invalid JSON: ${invalidJsonError}`,
15
+ INCORRECT_NODE_TYPE: (configProperty, expectedNodeType, actualNodeType) => `Incorrect node type for property "${configProperty}". Expected type: "${expectedNodeType}", got "${actualNodeType}"`,
16
+ INVALID_EMPTY_NODE: (configProperty) => `Property "${configProperty}" must not be an empty object`,
17
+ INVALID_PROPERTY: (configProperty, prop) => `Unexpected property "${prop}" in "${configProperty}" configuration`,
18
+ NON_EMPTY_STRING: (configProperty, actualProp) => `Property "${configProperty}" must be a non-empty string, received ${actualProp}`,
19
+ NON_EMPTY_ARRAY: (configProperty, actualProp) => `Property "${configProperty}" must be a non-empty array, received ${actualProp}`,
20
+ INVALID_PORT: (configProperty, actualProp) => `Property "${configProperty}" must be a valid port number, received ${actualProp}`,
21
+ INVALID_METHOD: (configProperty, actualProp) => `Property "${configProperty}" must be "get" or "post", received ${actualProp}`,
22
+ INVALID_SERVER_TYPE: (configProperty, actualProp) => `Property "${configProperty}" must be one of ["express" | "koa" | "fs"] , received ${actualProp}`,
23
+ INVALID_GENERATOR_CONFIG: (configProperty, actualProp) => `Property "${configProperty}" must be an object , received ${actualProp}`,
24
+ INVALID_STATUS: (configProperty, actualProp) => `Property "${configProperty}" must be 404 or 500, received ${actualProp}`,
25
+ INVALID_SPECIFIER: (configProperty, actualProp) => `Property "${configProperty}" must be a valid specifier, received ${actualProp}`,
26
+ INVALID_PATH: (configProperty, actualProp) => `Property "${configProperty}" must be a URI path string which starts but does not end with a slash, received ${actualProp}`,
27
+ INVALID_ORIGIN: (configProperty, actualProp) => `Property "${configProperty}" must be a full URI string with a scheme (eg: "https://site.com"), received ${actualProp}`,
28
+ INVALID_FILE_PATTERN: (configProperty, actualProp) => `Property "${configProperty}" must use a valid regex but received ${actualProp === "" ? "empty string" : actualProp}`,
29
+ INVALID_BASEPATH: (configProperty, actualProp) => `Property "${configProperty}" must be a URI base path string which starts with a slash, received ${actualProp}`,
30
+ INVALID_SERVICE: (configProperty, actualProp) => `Property "${configProperty}" must be a valid service (a non-empty string or array with [non-empty string, any]), received ${actualProp}`,
31
+ INVALID_ENVIRONMENT: (configProperty) => `Property "${configProperty}" must define a default environment`,
32
+ MISSING_ONE_OF: (configProperty, childProps) => `A "${configProperty}" must contain at least one of [${childProps}]`,
33
+ TOO_MANY: (configProperty, childProps) => `A "${configProperty}" must contain exactly one of [${childProps}]`,
34
+ MISSING_REQUIRED: (configProperty, childProps) => `Property "${configProperty}" is missing required properties [${childProps}]`,
35
+ DUPLICATE_IDS: (configProperty, dupeIds) => `Each "${configProperty}" must have a unique "id", found duplicates [${dupeIds}]`,
36
+ COMPILE_LOCKER_SSR: () => 'If "locker.enabled: true" and any route sets "ssr: true", then "locker.clientOnly" must also be set to "true"',
37
+ DUPLICATE_BUNDLE_CONFIG: (dupeIds) => `Found duplicate specifiers in BundleConfig: [${dupeIds}]`,
38
+ DEFAULT_NOT_IN_LOCALES: (defaultLocale, locales) => `Property "i18n.defaultLocale" must be in the list of "i18n.locales": ${defaultLocale} [${locales}]`,
39
+ FALLBACK_NOT_IN_LOCALES: (fallback, locales) => `Property "i18n.locales.fallback" must be in the list of "i18n.locales": ${fallback} [${locales}]`,
40
+ SSR_WITHOUT_PRELOAD: (configProperty) => `A route cannot have preloadData disabled when ssr is enabled:": ${configProperty}`
41
+ };
@@ -26,13 +26,12 @@ __markAsModule(exports);
26
26
  __export(exports, {
27
27
  descriptions: () => descriptions
28
28
  });
29
- var import_configParser = __toModule(require("./configParser.cjs"));
29
+ var import_config = __toModule(require("./config.cjs"));
30
30
  var import_unresolvable = __toModule(require("./unresolvable.cjs"));
31
31
  var import_server = __toModule(require("./server.cjs"));
32
32
  var import_application = __toModule(require("./application.cjs"));
33
- __exportStar(exports, __toModule(require("./core-diagnostics.cjs")));
34
33
  var descriptions = {
35
- CONFIG_PARSER: import_configParser.configParser,
34
+ CONFIG: import_config.config,
36
35
  UNRESOLVABLE: import_unresolvable.unresolvable,
37
36
  SERVER: import_server.server,
38
37
  APPLICATION: import_application.application
@@ -1,43 +1,17 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
2
  var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
3
  var __export = (target, all) => {
9
4
  for (var name in all)
10
5
  __defProp(target, name, {get: all[name], enumerable: true});
11
6
  };
12
- var __exportStar = (target, module2, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && key !== "default")
16
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
- }
18
- return target;
19
- };
20
- var __toModule = (module2) => {
21
- return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
- };
23
7
 
24
8
  // packages/@lwrjs/diagnostics/src/descriptions/server.ts
25
9
  __markAsModule(exports);
26
10
  __export(exports, {
27
11
  server: () => server
28
12
  });
29
- var import_core_diagnostics = __toModule(require("./core-diagnostics.cjs"));
30
- var server = (0, import_core_diagnostics.createDiagnosticsCategory)({
31
- WARMUP_ERROR: (error) => ({
32
- category: "lwrServer/warmupError",
33
- message: `An error occurred during warmup: ${error}`
34
- }),
35
- UNEXPECTED_ERROR: (error) => ({
36
- category: "lwrServer/fatal",
37
- message: `An unexpected error occurred: "${error}"`
38
- }),
39
- SERVER_ERROR: (name) => ({
40
- category: "lwrServer/fatal",
41
- message: `500: Unexpected error fetching "${name}"`
42
- })
43
- });
13
+ var server = {
14
+ WARMUP_ERROR: (error) => `An error occurred during warmup: ${error}`,
15
+ UNEXPECTED_ERROR: (error) => `An unexpected error occurred: "${error}"`,
16
+ SERVER_ERROR: (name) => `500: Unexpected error fetching "${escape(name)}"`
17
+ };
@@ -1,113 +1,29 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
2
  var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
3
  var __export = (target, all) => {
9
4
  for (var name in all)
10
5
  __defProp(target, name, {get: all[name], enumerable: true});
11
6
  };
12
- var __exportStar = (target, module2, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && key !== "default")
16
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
- }
18
- return target;
19
- };
20
- var __toModule = (module2) => {
21
- return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
- };
23
7
 
24
8
  // packages/@lwrjs/diagnostics/src/descriptions/unresolvable.ts
25
9
  __markAsModule(exports);
26
10
  __export(exports, {
27
11
  unresolvable: () => unresolvable
28
12
  });
29
- var import_core_diagnostics = __toModule(require("./core-diagnostics.cjs"));
30
- var unresolvable = (0, import_core_diagnostics.createDiagnosticsCategory)({
31
- ASSET: (assetPath) => ({
32
- category: "lwrUnresolvable/asset",
33
- message: `404: Could not find asset at "${assetPath}"`
34
- }),
35
- DIR_ALIAS: (assetPath) => ({
36
- category: "lwrUnresolvable/asset",
37
- message: `404: Unable to normalize "${assetPath}", no alias replacement found`
38
- }),
39
- MODULE: (moduleSpecifier) => ({
40
- category: "lwrUnresolvable/module",
41
- message: `404: Could not find module with specifier "${moduleSpecifier}"`
42
- }),
43
- MODULE_ENTRY: (moduleSpecifier) => ({
44
- category: "lwrUnresolvable/module",
45
- message: `404: Could not find module entry with specifier "${moduleSpecifier}"`
46
- }),
47
- BUNDLE: (specifier) => ({
48
- category: "lwrUnresolvable/bundle",
49
- message: `404: Could not find bundle with specifier "${specifier}"`
50
- }),
51
- LWC_MODULE: (name) => ({
52
- category: "lwrUnresolvable/module",
53
- message: `404: Could not find ${name}`
54
- }),
55
- SIGNED_MODULE: (moduleSpecifier, signature) => ({
56
- category: "lwrUnresolvable/module",
57
- message: `404: Could not find module with specifier "${moduleSpecifier}" and signature "${signature}"`
58
- }),
59
- RESOURCE: (resourceSpecifier, resourceVersion) => ({
60
- category: "lwrUnresolvable/resource",
61
- message: `404: Could not find resource with specifier "${resourceSpecifier}" and version "${resourceVersion}"`
62
- }),
63
- VIEW: (viewPath) => ({
64
- category: "lwrUnresolvable/view",
65
- message: `404: Could not find view at "${viewPath}"`
66
- }),
67
- VIEW_CONFIG: (configPath) => ({
68
- category: "lwrUnresolvable/view",
69
- message: `404: LWR configuration for viewPath "${configPath}" is not available`
70
- }),
71
- APP_CONFIG: (appId) => ({
72
- category: "lwrUnresolvable/view",
73
- message: `404: LWR configuration for appId "${appId}" is not available`
74
- }),
75
- INVALID_JSON: () => ({
76
- category: "lwrUnresolvable/invalid",
77
- message: "400: Accept header and json query parameter are incompatible"
78
- }),
79
- INVALID_API_VERSION: (apiVersion, expectedVersion) => ({
80
- category: "lwrUnresolvable/invalid",
81
- message: `400: API Version "${apiVersion}" is not supported. Expected "${expectedVersion}"`
82
- }),
83
- INVALID_ENVIRONMENT: (environment) => ({
84
- category: "lwrUnresolvable/invalid",
85
- message: `400: Environment "${environment}" is not supported`
86
- }),
87
- INVALID_SPECIFIER: (specifier) => ({
88
- category: "lwrUnresolvable/invalid",
89
- message: `400: Unable to resolve specifier "${specifier}" because it contains path traversal`
90
- }),
91
- LABEL_MODULE: (file, error) => ({
92
- category: "lwrUnresolvable/label",
93
- message: `Invalid JSON: Labels file ${file} must be a JSON object with string values or nested string values
94
- ${error}`
95
- }),
96
- ROUTES_MODULE: (file, error) => ({
97
- category: "lwrUnresolvable/routes",
98
- message: `Invalid JSON: Route config file ${file} is invalid
13
+ var unresolvable = {
14
+ ASSET: (assetPath) => `404: Could not find asset at "${escape(assetPath)}"`,
15
+ DIR_ALIAS: (assetPath) => `404: Unable to normalize "${escape(assetPath)}", no alias replacement found`,
16
+ MODULE: (moduleSpecifier) => `404: Could not find module with specifier "${escape(moduleSpecifier)}"`,
17
+ MODULE_ENTRY: (moduleSpecifier) => `404: Could not find module entry with specifier "${escape(moduleSpecifier)}"`,
18
+ BUNDLE: (specifier) => `404: Could not find bundle with specifier "${escape(specifier)}"`,
19
+ LWC_MODULE: (name) => `404: Could not find ${escape(name)}`,
20
+ SIGNED_MODULE: (moduleSpecifier, signature) => `404: Could not find module with specifier "${escape(moduleSpecifier)}" and signature "${escape(signature)}"`,
21
+ RESOURCE: (resourceSpecifier, resourceVersion) => `404: Could not find resource with specifier "${escape(resourceSpecifier)}" and version "${escape(resourceVersion)}"`,
22
+ VIEW: (viewPath) => `404: Could not find view at "${escape(viewPath)}"`,
23
+ VIEW_CONFIG: (configPath) => `404: LWR configuration for viewPath "${escape(configPath)}" is not available`,
24
+ APP_CONFIG: (appId) => `404: LWR configuration for appId "${escape(appId)}" is not available`,
25
+ LABEL_MODULE: (file, error) => `Invalid JSON: Labels file ${escape(file)} must be a JSON object with string values or nested string values
26
+ ${error}`,
27
+ ROUTES_MODULE: (file, error) => `Invalid JSON: Route config file ${escape(file)} is invalid
99
28
  ${error}`
100
- }),
101
- PRELOAD_MODULE: (specifier) => ({
102
- category: "lwrUnresolvable/invalid",
103
- message: `Invalid preload module: ${specifier}`
104
- }),
105
- INVALID_MODE: (mode) => ({
106
- category: "lwrUnresolvable/invalid",
107
- message: `No configuration found for server mode - ${mode}`
108
- }),
109
- SSR_TIMEOUT: (specifier, time) => ({
110
- category: "lwrUnresolvable/ssr",
111
- message: `Server side rendering or data prefetching for '${specifier}' timed out after ${time}ms`
112
- })
113
- });
29
+ };
@@ -10,53 +10,59 @@ __markAsModule(exports);
10
10
  __export(exports, {
11
11
  DiagnosticsError: () => DiagnosticsError,
12
12
  LwrApplicationError: () => LwrApplicationError,
13
- LwrConfigValidationError: () => LwrConfigValidationError,
13
+ LwrConfigError: () => LwrConfigError,
14
+ LwrError: () => LwrError,
14
15
  LwrServerError: () => LwrServerError,
16
+ LwrStatusError: () => LwrStatusError,
15
17
  LwrUnresolvableError: () => LwrUnresolvableError,
16
- createSingleDiagnosticError: () => createSingleDiagnosticError,
17
18
  isNodeError: () => isNodeError
18
19
  });
19
20
  function isNodeError(error) {
20
21
  return error instanceof Error;
21
22
  }
22
- function createSingleDiagnosticError(diag, errorClass = DiagnosticsError) {
23
- return new errorClass(diag.description.message, [diag]);
24
- }
25
- var DiagnosticsError = class extends Error {
26
- constructor(message, diagnostics) {
27
- if (diagnostics.length === 0) {
28
- throw new Error("No diagnostics");
29
- }
30
- super();
31
- this._memoMessage = void 0;
32
- this._message = message;
33
- this.diagnostics = diagnostics;
34
- this.name = "DiagnosticsError";
23
+ var LwrError = class extends Error {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.name = "LwrError";
35
27
  }
36
- get message() {
37
- if (this._memoMessage !== void 0) {
38
- return this._memoMessage;
39
- }
40
- const message = this._message === void 0 ? "" : this._message + "\n";
41
- return message;
28
+ };
29
+ var LwrServerError = class extends LwrError {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.name = "LwrServerError";
42
33
  }
43
- set message(message) {
44
- this._message = message;
34
+ };
35
+ var LwrApplicationError = class extends LwrError {
36
+ constructor() {
37
+ super(...arguments);
38
+ this.name = "LwrApplicationError";
45
39
  }
46
40
  };
47
- var LwrConfigValidationError = class extends DiagnosticsError {
41
+ var LwrUnresolvableError = class extends LwrError {
42
+ constructor(message, type) {
43
+ super(message);
44
+ this.name = "LwrUnresolvableError";
45
+ this.type = type;
46
+ }
48
47
  };
49
- var LwrUnresolvableError = class extends DiagnosticsError {
48
+ var LwrStatusError = class extends LwrError {
49
+ constructor(message, status, location) {
50
+ super(message);
51
+ this.name = "LwrStatusError";
52
+ this.status = status;
53
+ this.location = location;
54
+ }
50
55
  };
51
- var LwrServerError = class extends DiagnosticsError {
52
- constructor(message, diagnostics) {
53
- super(message, diagnostics);
54
- this.name = "ServerError";
56
+ var DiagnosticsError = class extends LwrError {
57
+ constructor(message, diagnostics = []) {
58
+ super(message);
59
+ this.diagnostics = diagnostics;
60
+ this.name = "LwrDiagnosticsError";
55
61
  }
56
62
  };
57
- var LwrApplicationError = class extends DiagnosticsError {
58
- constructor(message, diagnostics) {
59
- super(message, diagnostics);
60
- this.name = "ApplicationError";
63
+ var LwrConfigError = class extends DiagnosticsError {
64
+ constructor() {
65
+ super(...arguments);
66
+ this.name = "LwrConfigError";
61
67
  }
62
68
  };
@@ -19,7 +19,6 @@ var __toModule = (module2) => {
19
19
 
20
20
  // packages/@lwrjs/diagnostics/src/index.ts
21
21
  __markAsModule(exports);
22
- __exportStar(exports, __toModule(require("./types.cjs")));
23
22
  __exportStar(exports, __toModule(require("./descriptions/index.cjs")));
24
23
  __exportStar(exports, __toModule(require("./errors.cjs")));
25
24
  __exportStar(exports, __toModule(require("./logger.cjs")));
@@ -1,11 +1,12 @@
1
- export declare const application: import("../types.js").OutputMessagesCategory<{
2
- ROUTE_HANDLER_ERROR: (route: string, error: string) => {
3
- category: "lwrApplication/routeHandler";
4
- message: string;
5
- };
6
- SSR_ERROR: (specifier: string, error: string) => {
7
- category: "lwrApplication/ssr";
8
- message: string;
9
- };
10
- }>;
1
+ export declare const application: {
2
+ INVALID_JSON: () => string;
3
+ INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string;
4
+ INVALID_ENVIRONMENT: (environment: string) => string;
5
+ INVALID_SPECIFIER: (specifier: string) => string;
6
+ PRELOAD_MODULE: (specifier: string) => string;
7
+ INVALID_MODE: (mode: string) => string;
8
+ SSR_ERROR: (specifier: string, error: string) => string;
9
+ SSR_TIMEOUT: (specifier: string, time: number) => string;
10
+ ROUTE_HANDLER_ERROR: (route: string, error: string) => string;
11
+ };
11
12
  //# sourceMappingURL=application.d.ts.map
@@ -1,12 +1,12 @@
1
- import { createDiagnosticsCategory } from './core-diagnostics.js';
2
- export const application = createDiagnosticsCategory({
3
- ROUTE_HANDLER_ERROR: (route, error) => ({
4
- category: 'lwrApplication/routeHandler',
5
- message: `An error occurred executing route handler for "${route}": "${error}"`,
6
- }),
7
- SSR_ERROR: (specifier, error) => ({
8
- category: 'lwrApplication/ssr',
9
- message: `Server-side rendering for "${specifier}" failed: ${error}`,
10
- }),
11
- });
1
+ export const application = {
2
+ INVALID_JSON: () => '400: Accept header and json query parameter are incompatible',
3
+ INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
4
+ INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
5
+ INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
6
+ PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
7
+ INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`,
8
+ SSR_ERROR: (specifier, error) => `Server-side rendering for "${specifier}" failed: ${error}`,
9
+ SSR_TIMEOUT: (specifier, time) => `Server side rendering or data prefetching for '${escape(specifier)}' timed out after ${time}ms`,
10
+ ROUTE_HANDLER_ERROR: (route, error) => `An error occurred executing route handler for "${route}": "${error}"`,
11
+ };
12
12
  //# sourceMappingURL=application.js.map
@@ -0,0 +1,30 @@
1
+ export declare const config: {
2
+ INVALID_JSON: (invalidJsonError: string) => string;
3
+ INCORRECT_NODE_TYPE: (configProperty: string, expectedNodeType: string, actualNodeType: string) => string;
4
+ INVALID_EMPTY_NODE: (configProperty: string) => string;
5
+ INVALID_PROPERTY: (configProperty: string, prop: string) => string;
6
+ NON_EMPTY_STRING: (configProperty: string, actualProp: string) => string;
7
+ NON_EMPTY_ARRAY: (configProperty: string, actualProp: string) => string;
8
+ INVALID_PORT: (configProperty: string, actualProp: string) => string;
9
+ INVALID_METHOD: (configProperty: string, actualProp: string) => string;
10
+ INVALID_SERVER_TYPE: (configProperty: string, actualProp: string) => string;
11
+ INVALID_GENERATOR_CONFIG: (configProperty: string, actualProp: string) => string;
12
+ INVALID_STATUS: (configProperty: string, actualProp: string) => string;
13
+ INVALID_SPECIFIER: (configProperty: string, actualProp: string) => string;
14
+ INVALID_PATH: (configProperty: string, actualProp: string) => string;
15
+ INVALID_ORIGIN: (configProperty: string, actualProp: string) => string;
16
+ INVALID_FILE_PATTERN: (configProperty: string, actualProp: string | any[]) => string;
17
+ INVALID_BASEPATH: (configProperty: string, actualProp: string) => string;
18
+ INVALID_SERVICE: (configProperty: string, actualProp: string) => string;
19
+ INVALID_ENVIRONMENT: (configProperty: string) => string;
20
+ MISSING_ONE_OF: (configProperty: string, childProps: string[]) => string;
21
+ TOO_MANY: (configProperty: string, childProps: string[]) => string;
22
+ MISSING_REQUIRED: (configProperty: string, childProps: string[]) => string;
23
+ DUPLICATE_IDS: (configProperty: string, dupeIds: string[]) => string;
24
+ COMPILE_LOCKER_SSR: () => string;
25
+ DUPLICATE_BUNDLE_CONFIG: (dupeIds: string[]) => string;
26
+ DEFAULT_NOT_IN_LOCALES: (defaultLocale: string, locales: string[]) => string;
27
+ FALLBACK_NOT_IN_LOCALES: (fallback: string, locales: string[]) => string;
28
+ SSR_WITHOUT_PRELOAD: (configProperty: string) => string;
29
+ };
30
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,31 @@
1
+ /* istanbul ignore file */
2
+ export const config = {
3
+ INVALID_JSON: (invalidJsonError) => `Invalid JSON: ${invalidJsonError}`,
4
+ INCORRECT_NODE_TYPE: (configProperty, expectedNodeType, actualNodeType) => `Incorrect node type for property "${configProperty}". Expected type: "${expectedNodeType}", got "${actualNodeType}"`,
5
+ INVALID_EMPTY_NODE: (configProperty) => `Property "${configProperty}" must not be an empty object`,
6
+ INVALID_PROPERTY: (configProperty, prop) => `Unexpected property "${prop}" in "${configProperty}" configuration`,
7
+ NON_EMPTY_STRING: (configProperty, actualProp) => `Property "${configProperty}" must be a non-empty string, received ${actualProp}`,
8
+ NON_EMPTY_ARRAY: (configProperty, actualProp) => `Property "${configProperty}" must be a non-empty array, received ${actualProp}`,
9
+ INVALID_PORT: (configProperty, actualProp) => `Property "${configProperty}" must be a valid port number, received ${actualProp}`,
10
+ INVALID_METHOD: (configProperty, actualProp) => `Property "${configProperty}" must be "get" or "post", received ${actualProp}`,
11
+ INVALID_SERVER_TYPE: (configProperty, actualProp) => `Property "${configProperty}" must be one of ["express" | "koa" | "fs"] , received ${actualProp}`,
12
+ INVALID_GENERATOR_CONFIG: (configProperty, actualProp) => `Property "${configProperty}" must be an object , received ${actualProp}`,
13
+ INVALID_STATUS: (configProperty, actualProp) => `Property "${configProperty}" must be 404 or 500, received ${actualProp}`,
14
+ INVALID_SPECIFIER: (configProperty, actualProp) => `Property "${configProperty}" must be a valid specifier, received ${actualProp}`,
15
+ INVALID_PATH: (configProperty, actualProp) => `Property "${configProperty}" must be a URI path string which starts but does not end with a slash, received ${actualProp}`,
16
+ INVALID_ORIGIN: (configProperty, actualProp) => `Property "${configProperty}" must be a full URI string with a scheme (eg: "https://site.com"), received ${actualProp}`,
17
+ INVALID_FILE_PATTERN: (configProperty, actualProp) => `Property "${configProperty}" must use a valid regex but received ${actualProp === '' ? 'empty string' : actualProp}`,
18
+ INVALID_BASEPATH: (configProperty, actualProp) => `Property "${configProperty}" must be a URI base path string which starts with a slash, received ${actualProp}`,
19
+ INVALID_SERVICE: (configProperty, actualProp) => `Property "${configProperty}" must be a valid service (a non-empty string or array with [non-empty string, any]), received ${actualProp}`,
20
+ INVALID_ENVIRONMENT: (configProperty) => `Property "${configProperty}" must define a default environment`,
21
+ MISSING_ONE_OF: (configProperty, childProps) => `A "${configProperty}" must contain at least one of [${childProps}]`,
22
+ TOO_MANY: (configProperty, childProps) => `A "${configProperty}" must contain exactly one of [${childProps}]`,
23
+ MISSING_REQUIRED: (configProperty, childProps) => `Property "${configProperty}" is missing required properties [${childProps}]`,
24
+ DUPLICATE_IDS: (configProperty, dupeIds) => `Each "${configProperty}" must have a unique "id", found duplicates [${dupeIds}]`,
25
+ COMPILE_LOCKER_SSR: () => 'If "locker.enabled: true" and any route sets "ssr: true", then "locker.clientOnly" must also be set to "true"',
26
+ DUPLICATE_BUNDLE_CONFIG: (dupeIds) => `Found duplicate specifiers in BundleConfig: [${dupeIds}]`,
27
+ DEFAULT_NOT_IN_LOCALES: (defaultLocale, locales) => `Property "i18n.defaultLocale" must be in the list of "i18n.locales": ${defaultLocale} [${locales}]`,
28
+ FALLBACK_NOT_IN_LOCALES: (fallback, locales) => `Property "i18n.locales.fallback" must be in the list of "i18n.locales": ${fallback} [${locales}]`,
29
+ SSR_WITHOUT_PRELOAD: (configProperty) => `A route cannot have preloadData disabled when ssr is enabled:": ${configProperty}`,
30
+ };
31
+ //# sourceMappingURL=config.js.map