@lwrjs/diagnostics
Advanced tools
Comparing version 0.17.2-alpha.1 to 0.17.2-alpha.2
@@ -1,11 +0,12 @@ | ||
export declare const application: import("../types.js").OutputMessagesCategory<{ | ||
ROUTE_HANDLER_ERROR: (route: string, error: string) => { | ||
category: "lwrApplication/routeHandler"; | ||
message: string; | ||
}; | ||
SSR_ERROR: (specifier: string, error: string) => { | ||
category: "lwrApplication/ssr"; | ||
message: string; | ||
}; | ||
}>; | ||
export declare const application: { | ||
INVALID_JSON: () => string; | ||
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string; | ||
INVALID_ENVIRONMENT: (environment: string) => string; | ||
INVALID_SPECIFIER: (specifier: string) => string; | ||
PRELOAD_MODULE: (specifier: string) => string; | ||
INVALID_MODE: (mode: string) => string; | ||
SSR_ERROR: (specifier: string, error: string) => string; | ||
SSR_TIMEOUT: (specifier: string, time: number) => string; | ||
ROUTE_HANDLER_ERROR: (route: string, error: string) => string; | ||
}; | ||
//# sourceMappingURL=application.d.ts.map |
@@ -1,12 +0,12 @@ | ||
import { createDiagnosticsCategory } from './core-diagnostics.js'; | ||
export const application = createDiagnosticsCategory({ | ||
ROUTE_HANDLER_ERROR: (route, error) => ({ | ||
category: 'lwrApplication/routeHandler', | ||
message: `An error occurred executing route handler for "${route}": "${error}"`, | ||
}), | ||
SSR_ERROR: (specifier, error) => ({ | ||
category: 'lwrApplication/ssr', | ||
message: `Server-side rendering for "${specifier}" failed: ${error}`, | ||
}), | ||
}); | ||
export const application = { | ||
INVALID_JSON: () => '400: Accept header and json query parameter are incompatible', | ||
INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`, | ||
INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`, | ||
INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`, | ||
PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`, | ||
INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`, | ||
SSR_ERROR: (specifier, error) => `Server-side rendering for "${specifier}" failed: ${error}`, | ||
SSR_TIMEOUT: (specifier, time) => `Server side rendering or data prefetching for '${escape(specifier)}' timed out after ${time}ms`, | ||
ROUTE_HANDLER_ERROR: (route, error) => `An error occurred executing route handler for "${route}": "${error}"`, | ||
}; | ||
//# sourceMappingURL=application.js.map |
export declare const descriptions: { | ||
CONFIG_PARSER: import("../types.js").OutputMessagesCategory<{ | ||
TEST: { | ||
message: string; | ||
}; | ||
TEST_ADVICE: (tagName: string, openLocation: import("../types.js").DiagnosticLocation) => { | ||
message: string; | ||
advice: ({ | ||
type: "log"; | ||
category: "info"; | ||
text: string; | ||
location?: undefined; | ||
} | { | ||
type: "frame"; | ||
location: import("../types.js").DiagnosticLocation; | ||
category?: undefined; | ||
text?: undefined; | ||
})[]; | ||
}; | ||
INVALID_JSON: (invalidJsonError: string) => { | ||
category: "lwrConfig/invalidJson"; | ||
message: string; | ||
}; | ||
INCORRECT_NODE_TYPE: (configProperty: string, expectedNodeType: string, actualNodeType: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_EMPTY_NODE: (configProperty: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_PROPERTY: (configProperty: string, prop: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
NON_EMPTY_STRING: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
NON_EMPTY_ARRAY: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_PORT: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_METHOD: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_SERVER_TYPE: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_GENERATOR_CONFIG: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_STATUS: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_SPECIFIER: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_PATH: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_ORIGIN: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_FILE_PATTERN: (configProperty: string, actualProp: string | any[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_BASEPATH: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_SERVICE: (configProperty: string, actualProp: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
INVALID_ENVIRONMENT: (configProperty: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
MISSING_ONE_OF: (configProperty: string, childProps: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
TOO_MANY: (configProperty: string, childProps: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
MISSING_REQUIRED: (configProperty: string, childProps: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
DUPLICATE_IDS: (configProperty: string, dupeIds: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
COMPILE_LOCKER_SSR: () => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
DUPLICATE_BUNDLE_CONFIG: (dupeIds: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
DEFAULT_NOT_IN_LOCALES: (defaultLocale: string, locales: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
FALLBACK_NOT_IN_LOCALES: (fallback: string, locales: string[]) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
SSR_WITHOUT_PRELOAD: (configProperty: string) => { | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}; | ||
}>; | ||
UNRESOLVABLE: import("../types.js").OutputMessagesCategory<{ | ||
ASSET: (assetPath: string) => { | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}; | ||
DIR_ALIAS: (assetPath: string) => { | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}; | ||
MODULE: (moduleSpecifier: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
MODULE_ENTRY: (moduleSpecifier: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
BUNDLE: (specifier: string) => { | ||
category: "lwrUnresolvable/bundle"; | ||
message: string; | ||
}; | ||
LWC_MODULE: (name: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
RESOURCE: (resourceSpecifier: string, resourceVersion: any) => { | ||
category: "lwrUnresolvable/resource"; | ||
message: string; | ||
}; | ||
VIEW: (viewPath: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
VIEW_CONFIG: (configPath: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
APP_CONFIG: (appId: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
INVALID_JSON: () => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_ENVIRONMENT: (environment: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_SPECIFIER: (specifier: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
LABEL_MODULE: (file: string, error: string) => { | ||
category: "lwrUnresolvable/label"; | ||
message: string; | ||
}; | ||
ROUTES_MODULE: (file: string, error: string) => { | ||
category: "lwrUnresolvable/routes"; | ||
message: string; | ||
}; | ||
PRELOAD_MODULE: (specifier: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_MODE: (mode: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
SSR_TIMEOUT: (specifier: string, time: number) => { | ||
category: "lwrUnresolvable/ssr"; | ||
message: string; | ||
}; | ||
}>; | ||
SERVER: import("../types.js").OutputMessagesCategory<{ | ||
WARMUP_ERROR: (error: string) => { | ||
category: "lwrServer/warmupError"; | ||
message: string; | ||
}; | ||
UNEXPECTED_ERROR: (error: string) => { | ||
category: "lwrServer/fatal"; | ||
message: string; | ||
}; | ||
SERVER_ERROR: (name: string) => { | ||
category: "lwrServer/fatal"; | ||
message: string; | ||
}; | ||
}>; | ||
APPLICATION: import("../types.js").OutputMessagesCategory<{ | ||
ROUTE_HANDLER_ERROR: (route: string, error: string) => { | ||
category: "lwrApplication/routeHandler"; | ||
message: string; | ||
}; | ||
SSR_ERROR: (specifier: string, error: string) => { | ||
category: "lwrApplication/ssr"; | ||
message: string; | ||
}; | ||
}>; | ||
CONFIG: { | ||
INVALID_JSON: (invalidJsonError: string) => string; | ||
INCORRECT_NODE_TYPE: (configProperty: string, expectedNodeType: string, actualNodeType: string) => string; | ||
INVALID_EMPTY_NODE: (configProperty: string) => string; | ||
INVALID_PROPERTY: (configProperty: string, prop: string) => string; | ||
NON_EMPTY_STRING: (configProperty: string, actualProp: string) => string; | ||
NON_EMPTY_ARRAY: (configProperty: string, actualProp: string) => string; | ||
INVALID_PORT: (configProperty: string, actualProp: string) => string; | ||
INVALID_METHOD: (configProperty: string, actualProp: string) => string; | ||
INVALID_SERVER_TYPE: (configProperty: string, actualProp: string) => string; | ||
INVALID_GENERATOR_CONFIG: (configProperty: string, actualProp: string) => string; | ||
INVALID_STATUS: (configProperty: string, actualProp: string) => string; | ||
INVALID_SPECIFIER: (configProperty: string, actualProp: string) => string; | ||
INVALID_PATH: (configProperty: string, actualProp: string) => string; | ||
INVALID_ORIGIN: (configProperty: string, actualProp: string) => string; | ||
INVALID_FILE_PATTERN: (configProperty: string, actualProp: string | any[]) => string; | ||
INVALID_BASEPATH: (configProperty: string, actualProp: string) => string; | ||
INVALID_SERVICE: (configProperty: string, actualProp: string) => string; | ||
INVALID_ENVIRONMENT: (configProperty: string) => string; | ||
MISSING_ONE_OF: (configProperty: string, childProps: string[]) => string; | ||
TOO_MANY: (configProperty: string, childProps: string[]) => string; | ||
MISSING_REQUIRED: (configProperty: string, childProps: string[]) => string; | ||
DUPLICATE_IDS: (configProperty: string, dupeIds: string[]) => string; | ||
COMPILE_LOCKER_SSR: () => string; | ||
DUPLICATE_BUNDLE_CONFIG: (dupeIds: string[]) => string; | ||
DEFAULT_NOT_IN_LOCALES: (defaultLocale: string, locales: string[]) => string; | ||
FALLBACK_NOT_IN_LOCALES: (fallback: string, locales: string[]) => string; | ||
SSR_WITHOUT_PRELOAD: (configProperty: string) => string; | ||
}; | ||
UNRESOLVABLE: { | ||
ASSET: (assetPath: string) => string; | ||
DIR_ALIAS: (assetPath: string) => string; | ||
MODULE: (moduleSpecifier: string) => string; | ||
MODULE_ENTRY: (moduleSpecifier: string) => string; | ||
BUNDLE: (specifier: string) => string; | ||
LWC_MODULE: (name: string) => string; | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => string; | ||
RESOURCE: (resourceSpecifier: string, resourceVersion: any) => string; | ||
VIEW: (viewPath: string) => string; | ||
VIEW_CONFIG: (configPath: string) => string; | ||
APP_CONFIG: (appId: string) => string; | ||
LABEL_MODULE: (file: string, error: string) => string; | ||
ROUTES_MODULE: (file: string, error: string) => string; | ||
}; | ||
SERVER: { | ||
WARMUP_ERROR: (error: string) => string; | ||
UNEXPECTED_ERROR: (error: string) => string; | ||
SERVER_ERROR: (name: string) => string; | ||
}; | ||
APPLICATION: { | ||
INVALID_JSON: () => string; | ||
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string; | ||
INVALID_ENVIRONMENT: (environment: string) => string; | ||
INVALID_SPECIFIER: (specifier: string) => string; | ||
PRELOAD_MODULE: (specifier: string) => string; | ||
INVALID_MODE: (mode: string) => string; | ||
SSR_ERROR: (specifier: string, error: string) => string; | ||
SSR_TIMEOUT: (specifier: string, time: number) => string; | ||
ROUTE_HANDLER_ERROR: (route: string, error: string) => string; | ||
}; | ||
}; | ||
export * from './core-diagnostics.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { configParser } from './configParser.js'; | ||
import { config } from './config.js'; | ||
import { unresolvable } from './unresolvable.js'; | ||
@@ -6,3 +6,3 @@ import { server } from './server.js'; | ||
export const descriptions = { | ||
CONFIG_PARSER: configParser, | ||
CONFIG: config, | ||
UNRESOLVABLE: unresolvable, | ||
@@ -12,3 +12,2 @@ SERVER: server, | ||
}; | ||
export * from './core-diagnostics.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,15 +0,6 @@ | ||
export declare const server: import("../types.js").OutputMessagesCategory<{ | ||
WARMUP_ERROR: (error: string) => { | ||
category: "lwrServer/warmupError"; | ||
message: string; | ||
}; | ||
UNEXPECTED_ERROR: (error: string) => { | ||
category: "lwrServer/fatal"; | ||
message: string; | ||
}; | ||
SERVER_ERROR: (name: string) => { | ||
category: "lwrServer/fatal"; | ||
message: string; | ||
}; | ||
}>; | ||
export declare const server: { | ||
WARMUP_ERROR: (error: string) => string; | ||
UNEXPECTED_ERROR: (error: string) => string; | ||
SERVER_ERROR: (name: string) => string; | ||
}; | ||
//# sourceMappingURL=server.d.ts.map |
@@ -1,16 +0,6 @@ | ||
import { createDiagnosticsCategory } from './core-diagnostics.js'; | ||
export const server = createDiagnosticsCategory({ | ||
WARMUP_ERROR: (error) => ({ | ||
category: 'lwrServer/warmupError', | ||
message: `An error occurred during warmup: ${error}`, | ||
}), | ||
UNEXPECTED_ERROR: (error) => ({ | ||
category: 'lwrServer/fatal', | ||
message: `An unexpected error occurred: "${error}"`, | ||
}), | ||
SERVER_ERROR: (name) => ({ | ||
category: 'lwrServer/fatal', | ||
message: `500: Unexpected error fetching "${name}"`, | ||
}), | ||
}); | ||
export const server = { | ||
WARMUP_ERROR: (error) => `An error occurred during warmup: ${error}`, | ||
UNEXPECTED_ERROR: (error) => `An unexpected error occurred: "${error}"`, | ||
SERVER_ERROR: (name) => `500: Unexpected error fetching "${escape(name)}"`, | ||
}; | ||
//# sourceMappingURL=server.js.map |
@@ -1,83 +0,16 @@ | ||
export declare const unresolvable: import("../types.js").OutputMessagesCategory<{ | ||
ASSET: (assetPath: string) => { | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}; | ||
DIR_ALIAS: (assetPath: string) => { | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}; | ||
MODULE: (moduleSpecifier: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
MODULE_ENTRY: (moduleSpecifier: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
BUNDLE: (specifier: string) => { | ||
category: "lwrUnresolvable/bundle"; | ||
message: string; | ||
}; | ||
LWC_MODULE: (name: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => { | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}; | ||
RESOURCE: (resourceSpecifier: string, resourceVersion: any) => { | ||
category: "lwrUnresolvable/resource"; | ||
message: string; | ||
}; | ||
VIEW: (viewPath: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
VIEW_CONFIG: (configPath: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
APP_CONFIG: (appId: string) => { | ||
category: "lwrUnresolvable/view"; | ||
message: string; | ||
}; | ||
INVALID_JSON: () => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_ENVIRONMENT: (environment: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_SPECIFIER: (specifier: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
LABEL_MODULE: (file: string, error: string) => { | ||
category: "lwrUnresolvable/label"; | ||
message: string; | ||
}; | ||
ROUTES_MODULE: (file: string, error: string) => { | ||
category: "lwrUnresolvable/routes"; | ||
message: string; | ||
}; | ||
PRELOAD_MODULE: (specifier: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
INVALID_MODE: (mode: string) => { | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}; | ||
SSR_TIMEOUT: (specifier: string, time: number) => { | ||
category: "lwrUnresolvable/ssr"; | ||
message: string; | ||
}; | ||
}>; | ||
export declare const unresolvable: { | ||
ASSET: (assetPath: string) => string; | ||
DIR_ALIAS: (assetPath: string) => string; | ||
MODULE: (moduleSpecifier: string) => string; | ||
MODULE_ENTRY: (moduleSpecifier: string) => string; | ||
BUNDLE: (specifier: string) => string; | ||
LWC_MODULE: (name: string) => string; | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => string; | ||
RESOURCE: (resourceSpecifier: string, resourceVersion: any) => string; | ||
VIEW: (viewPath: string) => string; | ||
VIEW_CONFIG: (configPath: string) => string; | ||
APP_CONFIG: (appId: string) => string; | ||
LABEL_MODULE: (file: string, error: string) => string; | ||
ROUTES_MODULE: (file: string, error: string) => string; | ||
}; | ||
//# sourceMappingURL=unresolvable.d.ts.map |
/* istanbul ignore file */ | ||
import { createDiagnosticsCategory } from './core-diagnostics.js'; | ||
export const unresolvable = createDiagnosticsCategory({ | ||
ASSET: (assetPath) => ({ | ||
category: 'lwrUnresolvable/asset', | ||
message: `404: Could not find asset at "${assetPath}"`, | ||
}), | ||
DIR_ALIAS: (assetPath) => ({ | ||
category: 'lwrUnresolvable/asset', | ||
message: `404: Unable to normalize "${assetPath}", no alias replacement found`, | ||
}), | ||
MODULE: (moduleSpecifier) => ({ | ||
category: 'lwrUnresolvable/module', | ||
message: `404: Could not find module with specifier "${moduleSpecifier}"`, | ||
}), | ||
MODULE_ENTRY: (moduleSpecifier) => ({ | ||
category: 'lwrUnresolvable/module', | ||
message: `404: Could not find module entry with specifier "${moduleSpecifier}"`, | ||
}), | ||
BUNDLE: (specifier) => ({ | ||
category: 'lwrUnresolvable/bundle', | ||
message: `404: Could not find bundle with specifier "${specifier}"`, | ||
}), | ||
LWC_MODULE: (name) => ({ | ||
category: 'lwrUnresolvable/module', | ||
message: `404: Could not find ${name}`, | ||
}), | ||
SIGNED_MODULE: (moduleSpecifier, signature) => ({ | ||
category: 'lwrUnresolvable/module', | ||
message: `404: Could not find module with specifier "${moduleSpecifier}" and signature "${signature}"`, | ||
}), | ||
RESOURCE: (resourceSpecifier, resourceVersion) => ({ | ||
category: 'lwrUnresolvable/resource', | ||
message: `404: Could not find resource with specifier "${resourceSpecifier}" and version "${resourceVersion}"`, | ||
}), | ||
VIEW: (viewPath) => ({ | ||
category: 'lwrUnresolvable/view', | ||
message: `404: Could not find view at "${viewPath}"`, | ||
}), | ||
VIEW_CONFIG: (configPath) => ({ | ||
category: 'lwrUnresolvable/view', | ||
message: `404: LWR configuration for viewPath "${configPath}" is not available`, | ||
}), | ||
APP_CONFIG: (appId) => ({ | ||
category: 'lwrUnresolvable/view', | ||
message: `404: LWR configuration for appId "${appId}" is not available`, | ||
}), | ||
INVALID_JSON: () => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: '400: Accept header and json query parameter are incompatible', | ||
}), | ||
INVALID_API_VERSION: (apiVersion, expectedVersion) => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: `400: API Version "${apiVersion}" is not supported. Expected "${expectedVersion}"`, | ||
}), | ||
INVALID_ENVIRONMENT: (environment) => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: `400: Environment "${environment}" is not supported`, | ||
}), | ||
INVALID_SPECIFIER: (specifier) => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: `400: Unable to resolve specifier "${specifier}" because it contains path traversal`, | ||
}), | ||
LABEL_MODULE: (file, error) => ({ | ||
category: 'lwrUnresolvable/label', | ||
message: `Invalid JSON: Labels file ${file} must be a JSON object with string values or nested string values\n${error}`, | ||
}), | ||
ROUTES_MODULE: (file, error) => ({ | ||
category: 'lwrUnresolvable/routes', | ||
message: `Invalid JSON: Route config file ${file} is invalid\n${error}`, | ||
}), | ||
PRELOAD_MODULE: (specifier) => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: `Invalid preload module: ${specifier}`, | ||
}), | ||
INVALID_MODE: (mode) => ({ | ||
category: 'lwrUnresolvable/invalid', | ||
message: `No configuration found for server mode - ${mode}`, | ||
}), | ||
SSR_TIMEOUT: (specifier, time) => ({ | ||
category: 'lwrUnresolvable/ssr', | ||
message: `Server side rendering or data prefetching for '${specifier}' timed out after ${time}ms`, | ||
}), | ||
}); | ||
export const unresolvable = { | ||
ASSET: (assetPath) => `404: Could not find asset at "${escape(assetPath)}"`, | ||
DIR_ALIAS: (assetPath) => `404: Unable to normalize "${escape(assetPath)}", no alias replacement found`, | ||
MODULE: (moduleSpecifier) => `404: Could not find module with specifier "${escape(moduleSpecifier)}"`, | ||
MODULE_ENTRY: (moduleSpecifier) => `404: Could not find module entry with specifier "${escape(moduleSpecifier)}"`, | ||
BUNDLE: (specifier) => `404: Could not find bundle with specifier "${escape(specifier)}"`, | ||
LWC_MODULE: (name) => `404: Could not find ${escape(name)}`, | ||
SIGNED_MODULE: (moduleSpecifier, signature) => `404: Could not find module with specifier "${escape(moduleSpecifier)}" and signature "${escape(signature)}"`, | ||
RESOURCE: (resourceSpecifier, resourceVersion) => `404: Could not find resource with specifier "${escape(resourceSpecifier)}" and version "${escape(resourceVersion)}"`, | ||
VIEW: (viewPath) => `404: Could not find view at "${escape(viewPath)}"`, | ||
VIEW_CONFIG: (configPath) => `404: LWR configuration for viewPath "${escape(configPath)}" is not available`, | ||
APP_CONFIG: (appId) => `404: LWR configuration for appId "${escape(appId)}" is not available`, | ||
LABEL_MODULE: (file, error) => `Invalid JSON: Labels file ${escape(file)} must be a JSON object with string values or nested string values\n${error}`, | ||
ROUTES_MODULE: (file, error) => `Invalid JSON: Route config file ${escape(file)} is invalid\n${error}`, | ||
}; | ||
//# sourceMappingURL=unresolvable.js.map |
/// <reference types="node" /> | ||
import type { Diagnostic, Diagnostics } from './types.js'; | ||
export declare function isNodeError(error: unknown): error is NodeJS.ErrnoException; | ||
export declare function createSingleDiagnosticError(diag: Diagnostic, errorClass?: typeof DiagnosticsError): DiagnosticsError; | ||
export declare class DiagnosticsError extends Error { | ||
constructor(message: undefined | string, diagnostics: Diagnostics); | ||
private _memoMessage; | ||
private _message; | ||
get message(): string; | ||
set message(message: string); | ||
diagnostics: Diagnostics; | ||
export declare class LwrError extends Error { | ||
name: string; | ||
} | ||
export declare class LwrConfigValidationError extends DiagnosticsError { | ||
export declare class LwrServerError extends LwrError { | ||
name: string; | ||
} | ||
export declare class LwrUnresolvableError extends DiagnosticsError { | ||
export declare class LwrApplicationError extends LwrError { | ||
name: string; | ||
} | ||
export declare class LwrServerError extends DiagnosticsError { | ||
constructor(message: undefined | string, diagnostics: Diagnostics); | ||
export declare class LwrUnresolvableError extends LwrError { | ||
name: string; | ||
type: string; | ||
constructor(message: undefined | string, type: string); | ||
} | ||
export declare class LwrApplicationError extends DiagnosticsError { | ||
constructor(message: undefined | string, diagnostics: Diagnostics); | ||
export declare class LwrStatusError extends LwrError { | ||
name: string; | ||
status: 301 | 302 | 429 | 503; | ||
location?: string; | ||
constructor(message: undefined | string, status: 301 | 302 | 429 | 503, location?: string); | ||
} | ||
type Position = { | ||
line: number; | ||
column: number; | ||
}; | ||
export type DiagnosticLocation = { | ||
sourceText?: string; | ||
start?: Position; | ||
end?: Position; | ||
}; | ||
export type Diagnostic = { | ||
description: string; | ||
location?: DiagnosticLocation; | ||
}; | ||
export declare class DiagnosticsError extends LwrError { | ||
constructor(message: undefined | string, diagnostics?: Diagnostic[]); | ||
diagnostics: Diagnostic[]; | ||
} | ||
export declare class LwrConfigError extends DiagnosticsError { | ||
name: string; | ||
} | ||
export {}; | ||
//# sourceMappingURL=errors.d.ts.map |
@@ -5,46 +5,54 @@ // The NodeJS Error is different from the JavaScript Error (e.g. NodeJS Error has a code) | ||
} | ||
export function createSingleDiagnosticError(diag, errorClass = DiagnosticsError) { | ||
return new errorClass(diag.description.message, [diag]); | ||
// LWR-Node base error class from which all others extend | ||
export class LwrError extends Error { | ||
constructor() { | ||
super(...arguments); | ||
this.name = 'LwrError'; | ||
} | ||
} | ||
export class DiagnosticsError extends Error { | ||
constructor(message, diagnostics) { | ||
if (diagnostics.length === 0) { | ||
throw new Error('No diagnostics'); | ||
} | ||
super(); | ||
this._memoMessage = undefined; | ||
this._message = message; | ||
this.diagnostics = diagnostics; | ||
this.name = 'DiagnosticsError'; | ||
// 500 - All errors which are instances of Error or LwrServerError will impact availability metrics | ||
export class LwrServerError extends LwrError { | ||
constructor() { | ||
super(...arguments); | ||
this.name = 'LwrServerError'; | ||
} | ||
// Lazily instantiate this. If we ever catchDiagnostics we wont even care about the `message` | ||
// so this avoids having to print it to a string | ||
get message() { | ||
if (this._memoMessage !== undefined) { | ||
return this._memoMessage; | ||
} | ||
const message = this._message === undefined ? '' : this._message + '\n'; | ||
return message; | ||
} | ||
// 400 | ||
export class LwrApplicationError extends LwrError { | ||
constructor() { | ||
super(...arguments); | ||
this.name = 'LwrApplicationError'; | ||
} | ||
// Allow set message can be called from rollup ModuleLoader.addModuleSource | ||
set message(message) { | ||
this._message = message; | ||
} | ||
// 404 | ||
export class LwrUnresolvableError extends LwrError { | ||
constructor(message, type) { | ||
super(message); | ||
this.name = 'LwrUnresolvableError'; | ||
this.type = type; | ||
} | ||
} | ||
export class LwrConfigValidationError extends DiagnosticsError { | ||
// 301, 302, 429, 503 | ||
export class LwrStatusError extends LwrError { | ||
constructor(message, status, location) { | ||
super(message); | ||
this.name = 'LwrStatusError'; | ||
this.status = status; | ||
this.location = location; | ||
} | ||
} | ||
export class LwrUnresolvableError extends DiagnosticsError { | ||
} | ||
export class LwrServerError extends DiagnosticsError { | ||
constructor(message, diagnostics) { | ||
super(message, diagnostics); | ||
this.name = 'ServerError'; | ||
export class DiagnosticsError extends LwrError { | ||
constructor(message, diagnostics = []) { | ||
super(message); | ||
this.diagnostics = diagnostics; | ||
this.name = 'LwrDiagnosticsError'; | ||
} | ||
} | ||
export class LwrApplicationError extends DiagnosticsError { | ||
constructor(message, diagnostics) { | ||
super(message, diagnostics); | ||
this.name = 'ApplicationError'; | ||
// fatal config validation issues | ||
export class LwrConfigError extends DiagnosticsError { | ||
constructor() { | ||
super(...arguments); | ||
this.name = 'LwrConfigError'; | ||
} | ||
} | ||
//# sourceMappingURL=errors.js.map |
@@ -1,2 +0,1 @@ | ||
export * from './types.js'; | ||
export * from './descriptions/index.js'; | ||
@@ -3,0 +2,0 @@ export * from './errors.js'; |
@@ -1,2 +0,1 @@ | ||
export * from './types.js'; | ||
export * from './descriptions/index.js'; | ||
@@ -3,0 +2,0 @@ export * from './errors.js'; |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.17.2-alpha.1", | ||
"version": "0.17.2-alpha.2", | ||
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview", | ||
@@ -39,3 +39,3 @@ "repository": { | ||
"devDependencies": { | ||
"@lwrjs/types": "0.17.2-alpha.1", | ||
"@lwrjs/types": "0.17.2-alpha.2", | ||
"jest": "^26.6.3", | ||
@@ -51,3 +51,3 @@ "ts-jest": "^26.5.6", | ||
}, | ||
"gitHead": "bba15ca717a242b0375decaa378af06bdee813b5" | ||
"gitHead": "739b237f5d7f2c1989142cb505a56cc763f21976" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
46565
26
918
1