@lwc/errors
Advanced tools
@@ -1,8 +0,7 @@ | ||
| import { DiagnosticLevel } from '../../shared/types'; | ||
| export declare const GENERIC_COMPILER_ERROR: { | ||
| code: number; | ||
| message: string; | ||
| level: DiagnosticLevel; | ||
| strictLevel: DiagnosticLevel; | ||
| url: string; | ||
| readonly code: 1001; | ||
| readonly message: "Unexpected compilation error: {0}"; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
| }; | ||
@@ -13,3 +12,3 @@ export declare const CompilerValidationErrors: { | ||
| readonly message: "Expected a boolean for outputConfig.compat, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -20,3 +19,3 @@ }; | ||
| readonly message: "Expected a string for outputConfig.env[\"{0}\"], received \"{1}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -27,3 +26,3 @@ }; | ||
| readonly message: "Expected an object for outputConfig.env, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -34,3 +33,3 @@ }; | ||
| readonly message: "Expected an object with files to be compiled."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -41,3 +40,3 @@ }; | ||
| readonly message: "Expected a string for name, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -48,3 +47,3 @@ }; | ||
| readonly message: "Expected a string for namespace, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -55,3 +54,3 @@ }; | ||
| readonly message: "Expected a boolean value or 'inline' for outputConfig.sourcemap, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -62,3 +61,3 @@ }; | ||
| readonly message: "Expected options object, received \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -69,3 +68,3 @@ }; | ||
| readonly message: "Unexpected file content for \"{0}\". Expected a string, received \"{1}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -76,3 +75,3 @@ }; | ||
| readonly message: "Unknown entry \"{0}\" in outputConfig.env."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -85,4 +84,4 @@ }; | ||
| readonly message: "Error in module resolution: {0}"; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 2; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -93,4 +92,4 @@ }; | ||
| readonly message: "Failed to resolve entry for module \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -101,4 +100,4 @@ }; | ||
| readonly message: "Failed to resolve import \"{0}\" from \"{1}\". Please add \"{2}\" file to the component folder."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -109,4 +108,4 @@ }; | ||
| readonly message: "No such file {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -117,3 +116,3 @@ }; | ||
| readonly message: "Illegal folder name \"{0}\". The folder name must start with a lowercase character: \"{1}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -124,3 +123,3 @@ }; | ||
| readonly message: "Failed to resolve \"{0}\". The file name must case match the component folder name \"{1}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -131,3 +130,3 @@ }; | ||
| readonly message: "Failed to resolve \"{0}\" from \"{1}\". Did you mean \"{2}\"?"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -138,3 +137,3 @@ }; | ||
| readonly message: "Illegal usage of the dynamic import syntax with a relative path."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -147,4 +146,4 @@ }; | ||
| readonly message: "{0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -155,4 +154,4 @@ }; | ||
| readonly message: "An error occurred parsing inline CSS. {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -163,4 +162,4 @@ }; | ||
| readonly message: "{0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -171,4 +170,4 @@ }; | ||
| readonly message: "Expect a string for id. Received {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -179,4 +178,4 @@ }; | ||
| readonly message: "Expect a string for source. Received {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -187,4 +186,4 @@ }; | ||
| readonly message: "{0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -195,4 +194,4 @@ }; | ||
| readonly message: "No available transformer for \"{0}\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -203,3 +202,3 @@ }; | ||
| readonly message: "Decorators like @api, @track, and @wire are only supported in LightningElement classes. {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -206,0 +205,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
| import { DiagnosticLevel } from '../../shared/types'; | ||
| export declare const LWCClassErrors: { | ||
@@ -7,3 +6,3 @@ readonly INVALID_DYNAMIC_IMPORT_SOURCE_STRICT: { | ||
| readonly url: ""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| }; | ||
@@ -15,3 +14,3 @@ }; | ||
| readonly message: "@wire expects an adapter as first parameter. @wire(adapter: WireAdapter, config?: any)."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -22,3 +21,3 @@ }; | ||
| readonly message: "@api method or property cannot be used with @track"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -29,3 +28,3 @@ }; | ||
| readonly message: "@wire expects a configuration object expression as second parameter."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -36,3 +35,3 @@ }; | ||
| readonly message: "@wire method or property cannot be used with @{0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -43,3 +42,3 @@ }; | ||
| readonly message: "Duplicate @api property \"{0}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -50,3 +49,3 @@ }; | ||
| readonly message: "@wire expects a function identifier as first parameter."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -57,3 +56,3 @@ }; | ||
| readonly message: "@wire expects a function identifier to be imported as first parameter."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -64,3 +63,3 @@ }; | ||
| readonly message: "Boolean public property must default to false."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -71,3 +70,3 @@ }; | ||
| readonly message: "Invalid decorator usage. Supported decorators ({0}) should be imported from \"{1}\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -78,3 +77,3 @@ }; | ||
| readonly message: "Invalid property of field type"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -85,3 +84,3 @@ }; | ||
| readonly message: "Invalid '{0}' decorator usage. Supported decorators ({1}) should be imported from \"{2}\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -92,3 +91,3 @@ }; | ||
| readonly message: "\"@{0}\" can only be applied on class properties"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -99,3 +98,3 @@ }; | ||
| readonly message: "\"{0}\" can only be used as a class decorator"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -106,3 +105,3 @@ }; | ||
| readonly message: "Method or property can only have 1 @wire decorator"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -113,3 +112,3 @@ }; | ||
| readonly message: "@api cannot be applied to a computed property, getter, setter or method."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -120,3 +119,3 @@ }; | ||
| readonly message: "Invalid property name \"{0}\". Properties starting with \"data\" are reserved attributes."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -127,3 +126,3 @@ }; | ||
| readonly message: "Invalid property name \"{0}\". Properties starting with \"on\" are reserved for event handlers."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -134,3 +133,3 @@ }; | ||
| readonly message: "Ambiguous attribute name \"{0}\". \"{0}\" will never be called from template because its corresponding property is camel cased. Consider renaming to \"{1}\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -141,3 +140,3 @@ }; | ||
| readonly message: "Invalid property name \"{0}\". \"{0}\" is a reserved attribute."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -148,3 +147,3 @@ }; | ||
| readonly message: "Invalid property name \"{0}\". \"part\" is a future reserved attribute for web components."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -155,3 +154,3 @@ }; | ||
| readonly message: "@api get {0} and @api set {0} detected in class declaration. Only one of the two needs to be decorated with @api."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -162,3 +161,3 @@ }; | ||
| readonly message: "@track decorator can only be applied to class properties."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -169,3 +168,3 @@ }; | ||
| readonly message: "Failed to resolve @wire adapter \"{0}\". Ensure it is imported."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -176,3 +175,3 @@ }; | ||
| readonly message: "@wire identifier cannot contain computed properties"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -183,3 +182,3 @@ }; | ||
| readonly message: "@wire identifier cannot contain nested member expressions"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -190,3 +189,3 @@ }; | ||
| readonly message: "Cannot use a template literal as a computed property key. Instead, use a string or extract the value to a constant."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -197,3 +196,3 @@ }; | ||
| readonly message: "Computed property in @wire config must be a constant or primitive literal."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -200,0 +199,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
| import { DiagnosticLevel } from '../../shared/types'; | ||
| export declare const SsrCompilerErrors: { | ||
@@ -6,3 +5,3 @@ readonly RESERVED_IDENTIFIER_PREFIX: { | ||
| readonly message: "Identifier name cannot start with \"__lwc\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -9,0 +8,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
| import { DiagnosticLevel } from '../../shared/types'; | ||
| export declare const TemplateErrors: { | ||
@@ -6,4 +5,4 @@ readonly INVALID_TEMPLATE: { | ||
| readonly message: "Invalid template"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -14,3 +13,3 @@ }; | ||
| readonly message: "Compiler options must be an object"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -21,3 +20,3 @@ }; | ||
| readonly message: "Unknown if modifier {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -28,3 +27,3 @@ }; | ||
| readonly message: "Unknown option property {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -35,3 +34,3 @@ }; | ||
| readonly message: "customRendererConfig contains duplicate entry for {0} element tag"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -42,3 +41,3 @@ }; | ||
| readonly message: "customRendererConfig should not contain a custom element tag, but found {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -51,3 +50,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -58,3 +57,3 @@ }; | ||
| readonly message: "Ambiguous attribute value {0}. If you want to make it a string you should escape it {1}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -65,3 +64,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -72,3 +71,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -79,3 +78,3 @@ }; | ||
| readonly message: "Template expression doesn't allow computed property access"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -86,3 +85,3 @@ }; | ||
| readonly message: "{0} directive is expected to be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -93,3 +92,3 @@ }; | ||
| readonly message: "Invalid id value \"{0}\". Id values must not contain any whitespace."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -100,3 +99,3 @@ }; | ||
| readonly message: "Static id values are not allowed in iterators. Id values must be unique within a template and must therefore be computed with an expression."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -107,3 +106,3 @@ }; | ||
| readonly message: "Duplicate id value \"{0}\" detected. Id values must be unique within a template."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -114,3 +113,3 @@ }; | ||
| readonly message: "Event handler should be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -121,3 +120,3 @@ }; | ||
| readonly message: "for:each and for:item directives should be associated together."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -128,3 +127,3 @@ }; | ||
| readonly message: "for:each directive is expected to be a expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -135,3 +134,3 @@ }; | ||
| readonly message: "for:index directive is expected to be a string."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -142,3 +141,3 @@ }; | ||
| readonly message: "for:item directive is expected to be a string."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -149,3 +148,3 @@ }; | ||
| readonly message: "srcdoc attribute is disallowed on <iframe> for security reasons"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -156,3 +155,3 @@ }; | ||
| readonly message: "Forbidden svg namespace tag found in template: '<{0}>' tag is not allowed within <svg>"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -163,3 +162,3 @@ }; | ||
| readonly message: "Forbidden MathML namespace tag found in template: '<{0}>' tag is not allowed within <math>"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -170,3 +169,3 @@ }; | ||
| readonly message: "Forbidden tag found in template: '<{0}>' tag is not allowed."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -177,4 +176,4 @@ }; | ||
| readonly message: "Error parsing attribute: {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -185,4 +184,4 @@ }; | ||
| readonly message: "Error parsing identifier: {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -193,3 +192,3 @@ }; | ||
| readonly message: "If directive should be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -200,3 +199,3 @@ }; | ||
| readonly message: "{0} is not valid attribute for {1}. All attributes name should be all lowercase."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -207,3 +206,3 @@ }; | ||
| readonly message: "Invalid event type \"{0}\". Event type must begin with a lower-case alphabetic character and contain only lower-case alphabetic characters, underscores, and numeric characters"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -214,3 +213,3 @@ }; | ||
| readonly message: "{0} is not valid attribute for {1}. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/{1}"; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -221,4 +220,4 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -229,3 +228,3 @@ }; | ||
| readonly message: "{0} is not a valid identifier"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -236,3 +235,3 @@ }; | ||
| readonly message: "Template expression doesn't allow {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -243,3 +242,3 @@ }; | ||
| readonly message: "The attribute \"tabindex\" can only be set to \"0\" or \"-1\"."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -250,3 +249,3 @@ }; | ||
| readonly message: "\"is\" attribute value can't be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -257,3 +256,3 @@ }; | ||
| readonly message: "\"is\" attribute is disallowed"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -264,3 +263,3 @@ }; | ||
| readonly message: "Key attribute value should be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -271,3 +270,3 @@ }; | ||
| readonly message: "Invalid key value for element <{0}>. Key cannot reference for:each index {1}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -278,3 +277,3 @@ }; | ||
| readonly message: "Invalid key value for element <{0}>. Key cannot reference iterator index"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -285,3 +284,3 @@ }; | ||
| readonly message: "Missing key for element <{0}> inside of iterator. Elements within iterators must have a unique, computed key value."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -292,4 +291,4 @@ }; | ||
| readonly message: "Missing root template tag"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -300,3 +299,3 @@ }; | ||
| readonly message: "Template expression doesn't allow to modify iterators"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -307,3 +306,3 @@ }; | ||
| readonly message: "Multiple expressions found"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -314,4 +313,4 @@ }; | ||
| readonly message: "Multiple roots found"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -322,3 +321,3 @@ }; | ||
| readonly message: "Name attribute on slot tag can't be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -329,3 +328,3 @@ }; | ||
| readonly message: "Invalid template tag. A directive is expected to be associated with the template tag."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -336,4 +335,4 @@ }; | ||
| readonly message: "<{0}> has no matching closing tag."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -344,4 +343,4 @@ }; | ||
| readonly message: "Expected root tag to be template, found {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -352,3 +351,3 @@ }; | ||
| readonly message: "Root template has unknown or disallowed attributes: {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -359,3 +358,3 @@ }; | ||
| readonly message: "<slot> tag can't be associated with {0} template directives."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -366,4 +365,4 @@ }; | ||
| readonly message: "Error parsing template expression: {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly strictLevel: DiagnosticLevel.Fatal; | ||
| readonly level: 1; | ||
| readonly strictLevel: 0; | ||
| readonly url: ""; | ||
@@ -374,3 +373,3 @@ }; | ||
| readonly message: "Unexpected if modifier {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -381,3 +380,3 @@ }; | ||
| readonly message: "Invalid value for \"lwc:dom\". 'lwc:dom' can only be set to {0}"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -388,3 +387,3 @@ }; | ||
| readonly message: "Invalid contents for element with \"lwc:dom\". Element must be empty"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -395,3 +394,3 @@ }; | ||
| readonly message: "Invalid directive \"lwc:dom\" on element {0}. \"lwc:dom\" cannot be added to a custom element"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -402,3 +401,3 @@ }; | ||
| readonly message: "Invalid directive \"lwc:dom\" on <slot>.. \"lwc:dom\" cannot be added to a <slot>"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -409,3 +408,3 @@ }; | ||
| readonly message: "The <style> element is disallowed inside the template. Please add css rules into '.css' file of your component bundle."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -416,3 +415,3 @@ }; | ||
| readonly message: "Unknown html tag '<{0}>'. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element and https://developer.mozilla.org/en-US/docs/Web/SVG/Element"; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -423,3 +422,3 @@ }; | ||
| readonly message: "{0} is not valid attribute for {1}. Attribute name must start with an underscore, dollar sign, or an optional hyphen character followed by an alphabetic character."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -430,3 +429,3 @@ }; | ||
| readonly message: "{0} is not valid attribute for {1}. Attribute name must end with alpha-numeric character."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -437,3 +436,3 @@ }; | ||
| readonly message: "Invalid directive \"{0}\" on element {1}."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -444,3 +443,3 @@ }; | ||
| readonly message: "Invalid lwc:dynamic usage. The LWC dynamic directive must be enabled in order to use this feature."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -451,3 +450,3 @@ }; | ||
| readonly message: "Invalid lwc:dynamic usage on element \"{0}\". This directive can only be used in a custom element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -458,3 +457,3 @@ }; | ||
| readonly message: "Invalid lwc:dynamic usage on element \"{0}\". The directive binding must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -465,3 +464,3 @@ }; | ||
| readonly message: "Invalid value for \"lwc:render-mode\". 'lwc:render-mode' can only be set to \"shadow\", or \"light\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -472,3 +471,3 @@ }; | ||
| readonly message: "Invalid attribute(s) '{0}' on slot. Slots in Light DOM templates (which have 'lwc:render-mode' directive) can only have [{1}] attributes"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -479,3 +478,3 @@ }; | ||
| readonly message: "Invalid directive 'lwc:dom' on element {0}. 'lwc:dom' is not necessary in Light DOM components."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -486,3 +485,3 @@ }; | ||
| readonly message: "Invalid usage for 'for:each' and '{0}' directives on the same element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -493,3 +492,3 @@ }; | ||
| readonly message: "Invalid duplicate slot ({0})."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -500,3 +499,3 @@ }; | ||
| readonly message: "Invalid slot ({0}). A slot cannot appear inside of an iterator."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -507,3 +506,3 @@ }; | ||
| readonly message: "Invalid event listener '{0}' on slot. Slots in Light DOM templates cannot have event listeners."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -514,3 +513,3 @@ }; | ||
| readonly message: "Invalid lwc:inner-html usage on element \"{0}\". The directive can't be used on a custom element or special LWC managed elements denoted with lwc:*."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -521,3 +520,3 @@ }; | ||
| readonly message: "Invalid lwc:inner-html usage on element \"{0}\". The directive can't be used on a slot or a template element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -528,3 +527,3 @@ }; | ||
| readonly message: "Invalid lwc:inner-html usage on element \"{0}\". The directive can't be used on an element with content."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -535,3 +534,3 @@ }; | ||
| readonly message: "Invalid lwc:inner-html usage on element \"{0}\". The directive binding can only be an expression or a string."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -542,3 +541,3 @@ }; | ||
| readonly message: "Invalid HTML detected, \"<{0}>\" was automatically inserted within \"<{1}>\"; the compiled template may not match the template source."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -549,3 +548,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -556,3 +555,3 @@ }; | ||
| readonly message: "lwc:preserve-comments must be a boolean attribute."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -563,3 +562,3 @@ }; | ||
| readonly message: "Found multiple HTML attributes mapping to the same JavaScript property. \"{0}\" and \"{1}\" both map to \"{2}\"."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -570,3 +569,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -577,3 +576,3 @@ }; | ||
| readonly message: "Invalid key attribute on element <{0}>. The key attribute should be applied to an element with for:each or iterator:*, or to a direct child of a <template> element with for:each or iterator:*. This key will be ignored, and may throw an error in future versions of LWC."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -584,3 +583,3 @@ }; | ||
| readonly message: string; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -591,3 +590,3 @@ }; | ||
| readonly message: "Invalid lwc:spread usage on element \"{0}\". The directive binding must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -598,3 +597,3 @@ }; | ||
| readonly message: "Invalid lwc:ref usage on element \"{0}\". The directive can't be used on a slot or a template element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -605,3 +604,3 @@ }; | ||
| readonly message: "Invalid lwc:ref usage on element \"{0}\". The directive binding must be a non-empty string."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -612,3 +611,3 @@ }; | ||
| readonly message: "Invalid lwc:ref usage on element \"{0}\". lwc:ref cannot be used inside for:each or an iterator."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -619,3 +618,3 @@ }; | ||
| readonly message: "lwc:if directive value should be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -626,3 +625,3 @@ }; | ||
| readonly message: "lwc:elseif directive value should be an expression"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -633,3 +632,3 @@ }; | ||
| readonly message: "lwc:else directive cannot have a value"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -640,3 +639,3 @@ }; | ||
| readonly message: "Invalid usage of 'lwc:if' and '{0}' directives on the same element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -647,3 +646,3 @@ }; | ||
| readonly message: "Invalid usage of 'lwc:elseif' and '{0}' directives on the same element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -654,3 +653,3 @@ }; | ||
| readonly message: "Invalid usage of 'lwc:else' and '{0}' directives on the same element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -661,3 +660,3 @@ }; | ||
| readonly message: "'{0}' directive must be used immediately after an element with 'lwc:if' or 'lwc:elseif'. No such element found."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -668,3 +667,3 @@ }; | ||
| readonly message: "'{0}' directive cannot be used with 'lwc:if', 'lwc:elseif', or 'lwc:else directives on the same element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -675,3 +674,3 @@ }; | ||
| readonly message: "Invalid lwc:slot-bind usage on <slot> element. Scoped slots usage is allowed in Light DOM templates only."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -682,3 +681,3 @@ }; | ||
| readonly message: "Invalid lwc:slot-bind usage on element {0}. The directive binding must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -689,3 +688,3 @@ }; | ||
| readonly message: "Invalid lwc:slot-bind usage on element {0}. The directive can be used on a <slot> element only."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -696,3 +695,3 @@ }; | ||
| readonly message: "Invalid duplicate scoped slots ({0})"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -703,3 +702,3 @@ }; | ||
| readonly message: "Mixing slot types disallowed for same ({0}) slot."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -710,3 +709,3 @@ }; | ||
| readonly message: "lwc:slot-data attribute value is expected to be a string."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -717,3 +716,3 @@ }; | ||
| readonly message: "lwc:slot-data directive can be used on <template> elements only."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -724,3 +723,3 @@ }; | ||
| readonly message: "<template> tag with lwc:slot-data directive cannot contain a comment or text node as a direct child."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -731,3 +730,3 @@ }; | ||
| readonly message: "<template> tag with lwc:slot-data directive must be the direct child of a custom element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -738,3 +737,3 @@ }; | ||
| readonly message: "lwc:slot-data directive cannot be combined with other directives on the same <template> tag."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -745,3 +744,3 @@ }; | ||
| readonly message: "Invalid lwc:external directive usage: {0}. This directive can only be used on custom elements."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -752,3 +751,3 @@ }; | ||
| readonly message: "Invalid lwc:external directive usage: {0}. This directive is a boolean attribute and should not have a value."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -759,3 +758,3 @@ }; | ||
| readonly message: "Multiple if: directives found on '{0}'. Only one if: directive is allowed; the rest are ignored."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -766,3 +765,3 @@ }; | ||
| readonly message: "<lwc:component> must have an 'lwc:is' attribute."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -773,3 +772,3 @@ }; | ||
| readonly message: "{0} is not a special LWC tag name and will be treated as an HTML element."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -780,3 +779,3 @@ }; | ||
| readonly message: "Invalid lwc:is usage for value {0}. The value assigned to lwc:is must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -787,3 +786,3 @@ }; | ||
| readonly message: "Invalid lwc:is usage for element {0}. The directive can only be used with <lwc:component>"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -794,3 +793,3 @@ }; | ||
| readonly message: "The lwc:dynamic directive is deprecated and will be removed in a future release. Please use lwc:is instead."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -801,3 +800,3 @@ }; | ||
| readonly message: "Invalid dynamic components usage, lwc:component and lwc:is can only be used when dynamic components have been enabled."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -808,3 +807,3 @@ }; | ||
| readonly message: "Template expression doesn't allow {0} in arrow function params."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -815,3 +814,3 @@ }; | ||
| readonly message: "Statements are disallowed in template expressions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -822,3 +821,3 @@ }; | ||
| readonly message: "Field mutations are only permitted within arrow functions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -829,3 +828,3 @@ }; | ||
| readonly message: "Use of the delete operator is prohibited within template expressions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -836,3 +835,3 @@ }; | ||
| readonly message: "The body of arrow functions in template expressions must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -843,3 +842,3 @@ }; | ||
| readonly message: "Arrow functions in template expressions cannot be {0}."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -850,3 +849,3 @@ }; | ||
| readonly message: "Early-stage JS features are disallowed in template expressions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -857,3 +856,3 @@ }; | ||
| readonly message: "Use of {0} is disallowed within template expressions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -864,3 +863,3 @@ }; | ||
| readonly message: "Use of comments is disallowed within template expressions."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -871,3 +870,3 @@ }; | ||
| readonly message: "The slot attribute in {0} will be ignored due to its ancestor {1}. It must be a direct child of the containing component."; | ||
| readonly level: DiagnosticLevel.Warning; | ||
| readonly level: 2; | ||
| readonly url: ""; | ||
@@ -878,3 +877,3 @@ }; | ||
| readonly message: "Invalid lwc:on usage on element \"{0}\". The directive can't be used on a template element."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -885,3 +884,3 @@ }; | ||
| readonly message: "Invalid lwc:on usage on element \"{0}\". The directive binding must be an expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -892,3 +891,3 @@ }; | ||
| readonly message: "Invalid lwc:on usage on element \"{0}\". It is not permitted to use declarative event listeners alongside lwc:on"; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -899,3 +898,3 @@ }; | ||
| readonly message: "Invalid lwc:on usage. The `lwc:on` directive must be enabled in order to use this feature."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -906,3 +905,3 @@ }; | ||
| readonly message: "Template expression doesn't allow computed property access unless the expression is surrounded by quotes: \"{0}\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -913,3 +912,3 @@ }; | ||
| readonly message: "Template expression doesn't allow {0} unless the expression is surrounded by quotes: \"{1}\""; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -920,3 +919,3 @@ }; | ||
| readonly message: "Template expression doesn't allow computed property access. The current component API version ({1}) is insufficient and must be increased to at least {2} for this type of expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -927,3 +926,3 @@ }; | ||
| readonly message: "Template expression doesn't allow {0}. The current component API version ({1}) is insufficient and must be increased to at least {2} for this type of expression."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -934,3 +933,3 @@ }; | ||
| readonly message: "{0} is a reserved keyword and cannot be used as an identifier."; | ||
| readonly level: DiagnosticLevel.Error; | ||
| readonly level: 1; | ||
| readonly url: ""; | ||
@@ -937,0 +936,0 @@ }; |
| import { CompilerError } from './utils'; | ||
| import type { LWCErrorInfo } from '../shared/types'; | ||
| import type { CompilerDiagnosticOrigin, CompilerDiagnostic } from './utils'; | ||
| export { CompilerDiagnosticOrigin, CompilerDiagnostic, CompilerError } from './utils'; | ||
| export { type CompilerDiagnosticOrigin, type CompilerDiagnostic, CompilerError } from './utils'; | ||
| export * from './error-info'; | ||
@@ -42,3 +42,3 @@ export interface ErrorConfig { | ||
| */ | ||
| export declare function invariant(condition: boolean, errorInfo: LWCErrorInfo, args?: any[]): void; | ||
| export declare function invariant(condition: boolean, errorInfo: LWCErrorInfo, args?: any[]): asserts condition; | ||
| /** | ||
@@ -45,0 +45,0 @@ * Normalizes a received error into a CompilerError. Adds any provided additional origin info. |
@@ -6,8 +6,9 @@ import type { LWCErrorInfo } from '../shared/types'; | ||
| */ | ||
| export declare enum CompilerMetrics { | ||
| LWCDynamicDirective = "lwc-dynamic-directive", | ||
| LWCRenderModeDirective = "lwc-render-mode-directive", | ||
| LWCSpreadDirective = "lwc-spread-directive", | ||
| DynamicImportTransform = "dynamic-import-transform" | ||
| } | ||
| export declare const CompilerMetrics: { | ||
| readonly LWCDynamicDirective: "lwc-dynamic-directive"; | ||
| readonly LWCRenderModeDirective: "lwc-render-mode-directive"; | ||
| readonly LWCSpreadDirective: "lwc-spread-directive"; | ||
| readonly DynamicImportTransform: "dynamic-import-transform"; | ||
| }; | ||
| export type CompilerMetrics = (typeof CompilerMetrics)[keyof typeof CompilerMetrics]; | ||
| export interface InstrumentationObject { | ||
@@ -14,0 +15,0 @@ log: (errorInfo: LWCErrorInfo, config: ErrorConfig) => void; |
+13
-15
@@ -29,13 +29,12 @@ /** | ||
| */ | ||
| var DiagnosticLevel; | ||
| (function (DiagnosticLevel) { | ||
| const DiagnosticLevel = { | ||
| /** Unexpected error, parsing error, bundling error */ | ||
| DiagnosticLevel[DiagnosticLevel["Fatal"] = 0] = "Fatal"; | ||
| Fatal: 0, | ||
| /** Linting error with error level, invalid external reference, invalid import, invalid transform */ | ||
| DiagnosticLevel[DiagnosticLevel["Error"] = 1] = "Error"; | ||
| Error: 1, | ||
| /** Linting error with warning level, usage of an API to be deprecated */ | ||
| DiagnosticLevel[DiagnosticLevel["Warning"] = 2] = "Warning"; | ||
| Warning: 2, | ||
| /** Logging messages */ | ||
| DiagnosticLevel[DiagnosticLevel["Log"] = 3] = "Log"; | ||
| })(DiagnosticLevel || (DiagnosticLevel = {})); | ||
| Log: 3, | ||
| }; | ||
@@ -1507,12 +1506,11 @@ /* | ||
| */ | ||
| var CompilerMetrics; | ||
| (function (CompilerMetrics) { | ||
| CompilerMetrics["LWCDynamicDirective"] = "lwc-dynamic-directive"; | ||
| CompilerMetrics["LWCRenderModeDirective"] = "lwc-render-mode-directive"; | ||
| CompilerMetrics["LWCSpreadDirective"] = "lwc-spread-directive"; | ||
| CompilerMetrics["DynamicImportTransform"] = "dynamic-import-transform"; | ||
| })(CompilerMetrics || (CompilerMetrics = {})); | ||
| const CompilerMetrics = { | ||
| LWCDynamicDirective: 'lwc-dynamic-directive', | ||
| LWCRenderModeDirective: 'lwc-render-mode-directive', | ||
| LWCSpreadDirective: 'lwc-spread-directive', | ||
| DynamicImportTransform: 'dynamic-import-transform', | ||
| }; | ||
| export { CompilerAggregateError, CompilerError, CompilerMetrics, CompilerValidationErrors, DecoratorErrors, DiagnosticLevel, GENERIC_COMPILER_ERROR, LWCClassErrors, ModuleResolutionErrors, ParserDiagnostics, SsrCompilerErrors, TemplateErrors, TransformerErrors, generateCompilerDiagnostic, generateCompilerError, generateErrorMessage, invariant, normalizeToCompilerError, normalizeToDiagnostic }; | ||
| /** version: 8.28.2 */ | ||
| /** version: 9.0.0 */ | ||
| //# sourceMappingURL=index.js.map |
@@ -1,11 +0,12 @@ | ||
| export declare enum DiagnosticLevel { | ||
| export declare const DiagnosticLevel: { | ||
| /** Unexpected error, parsing error, bundling error */ | ||
| Fatal = 0, | ||
| readonly Fatal: 0; | ||
| /** Linting error with error level, invalid external reference, invalid import, invalid transform */ | ||
| Error = 1, | ||
| readonly Error: 1; | ||
| /** Linting error with warning level, usage of an API to be deprecated */ | ||
| Warning = 2, | ||
| readonly Warning: 2; | ||
| /** Logging messages */ | ||
| Log = 3 | ||
| } | ||
| readonly Log: 3; | ||
| }; | ||
| export type DiagnosticLevel = (typeof DiagnosticLevel)[keyof typeof DiagnosticLevel]; | ||
| export interface LWCErrorInfo { | ||
@@ -12,0 +13,0 @@ code: number; |
+6
-2
@@ -7,3 +7,3 @@ { | ||
| "name": "@lwc/errors", | ||
| "version": "8.28.2", | ||
| "version": "9.0.0", | ||
| "description": "LWC Error Utilities", | ||
@@ -23,9 +23,13 @@ "keywords": [ | ||
| "license": "MIT", | ||
| "type": "module", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "engines": { | ||
| "node": ">=16.6.0" | ||
| }, | ||
| "volta": { | ||
| "extends": "../../../package.json" | ||
| }, | ||
| "main": "dist/index.cjs.js", | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.js", | ||
@@ -32,0 +36,0 @@ "types": "dist/index.d.ts", |
-1536
| /** | ||
| * Copyright (c) 2026 Salesforce, Inc. | ||
| */ | ||
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| const templateRegex = /\{([0-9]+)\}/g; | ||
| /** | ||
| * Replaces {0} in the given string with the value from the given array | ||
| * @param template Template string to fill | ||
| * @param args Values to fill with | ||
| * @returns Filled string | ||
| */ | ||
| function templateString(template, args) { | ||
| return template.replace(templateRegex, (_, index) => { | ||
| return args[index]; | ||
| }); | ||
| } | ||
| /* | ||
| * Copyright (c) 2018, salesforce.com, inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| exports.DiagnosticLevel = void 0; | ||
| (function (DiagnosticLevel) { | ||
| /** Unexpected error, parsing error, bundling error */ | ||
| DiagnosticLevel[DiagnosticLevel["Fatal"] = 0] = "Fatal"; | ||
| /** Linting error with error level, invalid external reference, invalid import, invalid transform */ | ||
| DiagnosticLevel[DiagnosticLevel["Error"] = 1] = "Error"; | ||
| /** Linting error with warning level, usage of an API to be deprecated */ | ||
| DiagnosticLevel[DiagnosticLevel["Warning"] = 2] = "Warning"; | ||
| /** Logging messages */ | ||
| DiagnosticLevel[DiagnosticLevel["Log"] = 3] = "Log"; | ||
| })(exports.DiagnosticLevel || (exports.DiagnosticLevel = {})); | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| class CompilerError extends Error { | ||
| constructor(code, message, filename, location, level = exports.DiagnosticLevel.Error, url) { | ||
| super(message); | ||
| this.code = code; | ||
| this.filename = filename; | ||
| this.location = location; | ||
| this.level = level; | ||
| this.url = url; | ||
| } | ||
| static from(diagnostic, origin) { | ||
| const { code, message, url } = diagnostic; | ||
| const filename = getFilename(origin, diagnostic); | ||
| const location = getLocation(origin, diagnostic); | ||
| const compilerError = new CompilerError(code, message, filename, location, undefined, url); | ||
| // The stack here is misleading and doesn't point to the cause of the original error message | ||
| // TODO [W-5712064]: Enhance diagnostics with useful stack trace and source code | ||
| compilerError.stack = undefined; | ||
| return compilerError; | ||
| } | ||
| toDiagnostic() { | ||
| return { | ||
| code: this.code, | ||
| message: this.message, | ||
| level: this.level, | ||
| filename: this.filename, | ||
| location: this.location, | ||
| url: this.url, | ||
| }; | ||
| } | ||
| } | ||
| class CompilerAggregateError extends AggregateError { | ||
| constructor(errors, message) { | ||
| super(errors, message); | ||
| this.errors = errors; | ||
| } | ||
| } | ||
| /** | ||
| * Extracts an error code from the given error. | ||
| * @param error The error to check. | ||
| * @returns The error code, if found. | ||
| */ | ||
| function getCodeFromError(error) { | ||
| if (error.lwcCode && typeof error.lwcCode === 'number') { | ||
| return error.lwcCode; | ||
| } | ||
| else if (error.code && typeof error.code === 'number') { | ||
| return error.code; | ||
| } | ||
| return undefined; | ||
| } | ||
| /** | ||
| * Extracts the filename from the provided parameters, preferring to use the compiler diagnostic | ||
| * origin, if provided. | ||
| * @param origin Compiler diagnositic origin data | ||
| * @param obj Any object that might have a filename associated | ||
| * @returns The filename, if found. | ||
| */ | ||
| function getFilename(origin, obj) { | ||
| // Give priority to explicit origin | ||
| if (origin && origin.filename) { | ||
| return origin.filename; | ||
| } | ||
| else if (obj) { | ||
| return obj.filename || obj.fileName || obj.file; | ||
| } | ||
| return undefined; | ||
| } | ||
| /** | ||
| * Extracts the location from the provided parameters, preferring to use the compiler diagnostic | ||
| * origin, if provided. | ||
| * @param origin Compiler diagnositic origin data | ||
| * @param obj Any object that might have a location property | ||
| * @returns The location, if found. | ||
| */ | ||
| function getLocation(origin, obj) { | ||
| // Give priority to explicit origin | ||
| if (origin && origin.location) { | ||
| return origin.location; | ||
| } | ||
| return getLocationFromObject(obj); | ||
| } | ||
| function getLocationFromObject(obj) { | ||
| if (obj) { | ||
| if (obj.location) { | ||
| return obj.location; | ||
| } | ||
| else if (obj.loc) { | ||
| return obj.loc; | ||
| } | ||
| else if (Number.isInteger(obj.line) && Number.isInteger(obj.column)) { | ||
| return { line: obj.line, column: obj.column, start: obj.start, length: obj.length }; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| /* | ||
| * For the next available error code, reference (and update!) the value in ./index.ts | ||
| */ | ||
| const GENERIC_COMPILER_ERROR = { | ||
| code: 1001, | ||
| message: 'Unexpected compilation error: {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }; | ||
| const CompilerValidationErrors = { | ||
| INVALID_COMPAT_PROPERTY: { | ||
| code: 1013, | ||
| message: 'Expected a boolean for outputConfig.compat, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ENV_ENTRY_VALUE: { | ||
| code: 1014, | ||
| message: 'Expected a string for outputConfig.env["{0}"], received "{1}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ENV_PROPERTY: { | ||
| code: 1015, | ||
| message: 'Expected an object for outputConfig.env, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_FILES_PROPERTY: { | ||
| code: 1016, | ||
| message: 'Expected an object with files to be compiled.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_NAME_PROPERTY: { | ||
| code: 1018, | ||
| message: 'Expected a string for name, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_NAMESPACE_PROPERTY: { | ||
| code: 1019, | ||
| message: 'Expected a string for namespace, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_SOURCEMAP_PROPERTY: { | ||
| code: 1021, | ||
| message: 'Expected a boolean value or \'inline\' for outputConfig.sourcemap, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| MISSING_OPTIONS_OBJECT: { | ||
| code: 1023, | ||
| message: 'Expected options object, received "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNEXPECTED_FILE_CONTENT: { | ||
| code: 1024, | ||
| message: 'Unexpected file content for "{0}". Expected a string, received "{1}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNKNOWN_ENV_ENTRY_KEY: { | ||
| code: 1025, | ||
| message: 'Unknown entry "{0}" in outputConfig.env.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| const ModuleResolutionErrors = { | ||
| MODULE_RESOLUTION_ERROR: { | ||
| code: 1002, | ||
| message: 'Error in module resolution: {0}', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| IMPORTEE_RESOLUTION_FAILED: { | ||
| code: 1010, | ||
| message: 'Failed to resolve entry for module "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| IMPORTEE_RESOLUTION_FROM_IMPORTER_FAILED: { | ||
| code: 1011, | ||
| message: 'Failed to resolve import "{0}" from "{1}". Please add "{2}" file to the component folder.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| NONEXISTENT_FILE: { | ||
| code: 1004, | ||
| message: 'No such file {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| FOLDER_NAME_STARTS_WITH_CAPITAL_LETTER: { | ||
| code: 1116, | ||
| message: 'Illegal folder name "{0}". The folder name must start with a lowercase character: "{1}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FOLDER_AND_FILE_NAME_CASE_MISMATCH: { | ||
| code: 1117, | ||
| message: 'Failed to resolve "{0}". The file name must case match the component folder name "{1}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IMPORT_AND_FILE_NAME_CASE_MISMATCH: { | ||
| code: 1118, | ||
| message: 'Failed to resolve "{0}" from "{1}". Did you mean "{2}"?', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| RELATIVE_DYNAMIC_IMPORT: { | ||
| code: 1120, | ||
| message: 'Illegal usage of the dynamic import syntax with a relative path.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| const TransformerErrors = { | ||
| CSS_TRANSFORMER_ERROR: { | ||
| code: 1009, | ||
| message: '{0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| CSS_IN_HTML_ERROR: { | ||
| code: 1026, | ||
| message: 'An error occurred parsing inline CSS. {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| HTML_TRANSFORMER_ERROR: { | ||
| code: 1008, | ||
| message: '{0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| INVALID_ID: { | ||
| code: 1027, | ||
| message: 'Expect a string for id. Received {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| INVALID_SOURCE: { | ||
| code: 1006, | ||
| message: 'Expect a string for source. Received {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| JS_TRANSFORMER_ERROR: { | ||
| code: 1007, | ||
| message: '{0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| NO_AVAILABLE_TRANSFORMER: { | ||
| code: 1005, | ||
| message: 'No available transformer for "{0}"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| JS_TRANSFORMER_DECORATOR_ERROR: { | ||
| code: 1198, | ||
| message: 'Decorators like @api, @track, and @wire are only supported in LightningElement classes. {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| /* | ||
| * For the next available error code, reference (and update!) the value in ./index.ts | ||
| */ | ||
| const LWCClassErrors = { | ||
| INVALID_DYNAMIC_IMPORT_SOURCE_STRICT: { | ||
| code: 1121, | ||
| message: 'Invalid import. The argument "{0}" must be a stringLiteral for dynamic imports when strict mode is enabled.', | ||
| url: '', | ||
| level: exports.DiagnosticLevel.Error, | ||
| }, | ||
| }; | ||
| const DecoratorErrors = { | ||
| ADAPTER_SHOULD_BE_FIRST_PARAMETER: { | ||
| code: 1092, | ||
| message: '@wire expects an adapter as first parameter. @wire(adapter: WireAdapter, config?: any).', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| API_AND_TRACK_DECORATOR_CONFLICT: { | ||
| code: 1093, | ||
| message: '@api method or property cannot be used with @track', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| CONFIG_OBJECT_SHOULD_BE_SECOND_PARAMETER: { | ||
| code: 1094, | ||
| message: '@wire expects a configuration object expression as second parameter.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| CONFLICT_WITH_ANOTHER_DECORATOR: { | ||
| code: 1095, | ||
| message: '@wire method or property cannot be used with @{0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DUPLICATE_API_PROPERTY: { | ||
| code: 1096, | ||
| message: 'Duplicate @api property "{0}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER: { | ||
| code: 1097, | ||
| message: '@wire expects a function identifier as first parameter.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IMPORTED_FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER: { | ||
| code: 1098, | ||
| message: '@wire expects a function identifier to be imported as first parameter.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_BOOLEAN_PUBLIC_PROPERTY: { | ||
| code: 1099, | ||
| message: 'Boolean public property must default to false.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_DECORATOR: { | ||
| code: 1100, | ||
| message: 'Invalid decorator usage. Supported decorators ({0}) should be imported from "{1}"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_DECORATOR_TYPE: { | ||
| code: 1101, | ||
| message: 'Invalid property of field type', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_DECORATOR_WITH_NAME: { | ||
| code: 1102, | ||
| message: 'Invalid \'{0}\' decorator usage. Supported decorators ({1}) should be imported from "{2}"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IS_NOT_CLASS_PROPERTY_OR_CLASS_METHOD: { | ||
| code: 1103, | ||
| message: '"@{0}" can only be applied on class properties', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IS_NOT_DECORATOR: { | ||
| code: 1104, | ||
| message: '"{0}" can only be used as a class decorator', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| ONE_WIRE_DECORATOR_ALLOWED: { | ||
| code: 1105, | ||
| message: 'Method or property can only have 1 @wire decorator', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_CANNOT_BE_COMPUTED: { | ||
| code: 1106, | ||
| message: '@api cannot be applied to a computed property, getter, setter or method.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_NAME_CANNOT_START_WITH_DATA: { | ||
| code: 1107, | ||
| message: 'Invalid property name "{0}". Properties starting with "data" are reserved attributes.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_NAME_CANNOT_START_WITH_ON: { | ||
| code: 1108, | ||
| message: 'Invalid property name "{0}". Properties starting with "on" are reserved for event handlers.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_NAME_IS_AMBIGUOUS: { | ||
| code: 1109, | ||
| message: 'Ambiguous attribute name "{0}". "{0}" will never be called from template because its corresponding property is camel cased. Consider renaming to "{1}".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_NAME_IS_RESERVED: { | ||
| code: 1110, | ||
| message: 'Invalid property name "{0}". "{0}" is a reserved attribute.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| PROPERTY_NAME_PART_IS_RESERVED: { | ||
| code: 1111, | ||
| message: 'Invalid property name "{0}". "part" is a future reserved attribute for web components.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SINGLE_DECORATOR_ON_SETTER_GETTER_PAIR: { | ||
| code: 1112, | ||
| message: '@api get {0} and @api set {0} detected in class declaration. Only one of the two needs to be decorated with @api.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| TRACK_ONLY_ALLOWED_ON_CLASS_PROPERTIES: { | ||
| code: 1113, | ||
| message: '@track decorator can only be applied to class properties.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| WIRE_ADAPTER_SHOULD_BE_IMPORTED: { | ||
| code: 1119, | ||
| message: 'Failed to resolve @wire adapter "{0}". Ensure it is imported.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS: { | ||
| code: 1131, | ||
| message: '@wire identifier cannot contain computed properties', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS: { | ||
| code: 1132, | ||
| message: '@wire identifier cannot contain nested member expressions', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| COMPUTED_PROPERTY_CANNOT_BE_TEMPLATE_LITERAL: { | ||
| code: 1199, | ||
| message: 'Cannot use a template literal as a computed property key. Instead, use a string or extract the value to a constant.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| COMPUTED_PROPERTY_MUST_BE_CONSTANT_OR_LITERAL: { | ||
| code: 1200, | ||
| message: 'Computed property in @wire config must be a constant or primitive literal.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| /* | ||
| * For the next available error code, reference (and update!) the value in ./index.ts | ||
| */ | ||
| const TemplateErrors = { | ||
| INVALID_TEMPLATE: { | ||
| code: 1003, | ||
| message: 'Invalid template', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| OPTIONS_MUST_BE_OBJECT: { | ||
| code: 1028, | ||
| message: 'Compiler options must be an object', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNKNOWN_IF_MODIFIER: { | ||
| code: 1029, | ||
| message: 'Unknown if modifier {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNKNOWN_OPTION_PROPERTY: { | ||
| code: 1030, | ||
| message: 'Unknown option property {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DUPLICATE_ELEMENT_ENTRY: { | ||
| code: 1150, | ||
| message: 'customRendererConfig contains duplicate entry for {0} element tag', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| CUSTOM_ELEMENT_TAG_DISALLOWED: { | ||
| code: 1151, | ||
| message: 'customRendererConfig should not contain a custom element tag, but found {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| const ParserDiagnostics = { | ||
| AMBIGUOUS_ATTRIBUTE_VALUE: { | ||
| code: 1034, | ||
| message: 'Ambiguous attribute value {0}. ' + | ||
| 'If you want to make it a valid identifier you should remove the surrounding quotes {1}. ' + | ||
| 'If you want to make it a string you should escape it {2}.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| AMBIGUOUS_ATTRIBUTE_VALUE_STRING: { | ||
| code: 1035, | ||
| message: 'Ambiguous attribute value {0}. If you want to make it a string you should escape it {1}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| BOOLEAN_ATTRIBUTE_FALSE: { | ||
| code: 1036, | ||
| message: 'To not set a boolean attribute, try <{0}> instead of <{0} {1}="{2}">. ' + | ||
| 'To represent a false value, the attribute has to be omitted altogether.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| BOOLEAN_ATTRIBUTE_TRUE: { | ||
| code: 1037, | ||
| message: 'To set a boolean attributes, try <{0} {1}> instead of <{0} {1}="{2}">. ' + | ||
| 'If the attribute is present, its value must either be the empty string ' + | ||
| "or a value that is an ASCII case -insensitive match for the attribute's canonical name " + | ||
| 'with no leading or trailing whitespace.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| COMPUTED_PROPERTY_ACCESS_NOT_ALLOWED: { | ||
| code: 1038, | ||
| message: "Template expression doesn't allow computed property access", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DIRECTIVE_SHOULD_BE_EXPRESSION: { | ||
| code: 1039, | ||
| message: '{0} directive is expected to be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ID_ATTRIBUTE: { | ||
| code: 1040, | ||
| message: 'Invalid id value "{0}". Id values must not contain any whitespace.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_STATIC_ID_IN_ITERATION: { | ||
| code: 1041, | ||
| message: 'Static id values are not allowed in iterators. Id values must be unique within a template and must therefore be computed with an expression.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| DUPLICATE_ID_FOUND: { | ||
| code: 1042, | ||
| message: 'Duplicate id value "{0}" detected. Id values must be unique within a template.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| EVENT_HANDLER_SHOULD_BE_EXPRESSION: { | ||
| code: 1043, | ||
| message: 'Event handler should be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FOR_EACH_AND_FOR_ITEM_DIRECTIVES_SHOULD_BE_TOGETHER: { | ||
| code: 1044, | ||
| message: 'for:each and for:item directives should be associated together.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FOR_EACH_DIRECTIVE_SHOULD_BE_EXPRESSION: { | ||
| code: 1045, | ||
| message: 'for:each directive is expected to be a expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FOR_INDEX_DIRECTIVE_SHOULD_BE_STRING: { | ||
| code: 1046, | ||
| message: 'for:index directive is expected to be a string.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FOR_ITEM_DIRECTIVE_SHOULD_BE_STRING: { | ||
| code: 1047, | ||
| message: 'for:item directive is expected to be a string.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FORBIDDEN_IFRAME_SRCDOC_ATTRIBUTE: { | ||
| code: 1048, | ||
| message: 'srcdoc attribute is disallowed on <iframe> for security reasons', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FORBIDDEN_SVG_NAMESPACE_IN_TEMPLATE: { | ||
| code: 1049, | ||
| message: "Forbidden svg namespace tag found in template: '<{0}>' tag is not allowed within <svg>", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FORBIDDEN_MATHML_NAMESPACE_IN_TEMPLATE: { | ||
| code: 1050, | ||
| message: "Forbidden MathML namespace tag found in template: '<{0}>' tag is not allowed within <math>", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| FORBIDDEN_TAG_ON_TEMPLATE: { | ||
| code: 1051, | ||
| message: "Forbidden tag found in template: '<{0}>' tag is not allowed.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| GENERIC_PARSING_ERROR: { | ||
| code: 1052, | ||
| message: 'Error parsing attribute: {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| IDENTIFIER_PARSING_ERROR: { | ||
| code: 1053, | ||
| message: 'Error parsing identifier: {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| IF_DIRECTIVE_SHOULD_BE_EXPRESSION: { | ||
| code: 1054, | ||
| message: 'If directive should be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ATTRIBUTE_CASE: { | ||
| code: 1055, | ||
| message: '{0} is not valid attribute for {1}. All attributes name should be all lowercase.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_EVENT_NAME: { | ||
| code: 1056, | ||
| message: 'Invalid event type "{0}". Event type must begin with a lower-case alphabetic character and contain only lower-case alphabetic characters, underscores, and numeric characters', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_HTML_ATTRIBUTE: { | ||
| code: 1057, | ||
| message: '{0} is not valid attribute for {1}. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/{1}', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_HTML_SYNTAX: { | ||
| code: 1058, | ||
| message: 'Invalid HTML syntax: {0}. For more information, ' + | ||
| 'please visit https://html.spec.whatwg.org/multipage/parsing.html#parse-error-{0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| INVALID_IDENTIFIER: { | ||
| code: 1059, | ||
| message: '{0} is not a valid identifier', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_NODE: { | ||
| code: 1060, | ||
| message: "Template expression doesn't allow {0}", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_TABINDEX_ATTRIBUTE: { | ||
| code: 1061, | ||
| message: 'The attribute "tabindex" can only be set to "0" or "-1".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DEPRECATED_IS_ATTRIBUTE_CANNOT_BE_EXPRESSION: { | ||
| code: 1062, | ||
| message: '"is" attribute value can\'t be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IS_ATTRIBUTE_NOT_SUPPORTED: { | ||
| code: 1063, | ||
| message: '"is" attribute is disallowed', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| KEY_ATTRIBUTE_SHOULD_BE_EXPRESSION: { | ||
| code: 1064, | ||
| message: 'Key attribute value should be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| KEY_SHOULDNT_REFERENCE_FOR_EACH_INDEX: { | ||
| code: 1065, | ||
| message: 'Invalid key value for element <{0}>. Key cannot reference for:each index {1}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| KEY_SHOULDNT_REFERENCE_ITERATOR_INDEX: { | ||
| code: 1066, | ||
| message: 'Invalid key value for element <{0}>. Key cannot reference iterator index', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| MISSING_KEY_IN_ITERATOR: { | ||
| code: 1071, | ||
| message: 'Missing key for element <{0}> inside of iterator. Elements within iterators must have a unique, computed key value.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| MISSING_ROOT_TEMPLATE_TAG: { | ||
| code: 1072, | ||
| message: 'Missing root template tag', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| MODIFYING_ITERATORS_NOT_ALLOWED: { | ||
| code: 1073, | ||
| message: "Template expression doesn't allow to modify iterators", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| MULTIPLE_EXPRESSIONS: { | ||
| code: 1074, | ||
| message: 'Multiple expressions found', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| MULTIPLE_ROOTS_FOUND: { | ||
| code: 1075, | ||
| message: 'Multiple roots found', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| NAME_ON_SLOT_CANNOT_BE_EXPRESSION: { | ||
| code: 1076, | ||
| message: "Name attribute on slot tag can't be an expression.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NO_DIRECTIVE_FOUND_ON_TEMPLATE: { | ||
| code: 1077, | ||
| message: 'Invalid template tag. A directive is expected to be associated with the template tag.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NO_MATCHING_CLOSING_TAGS: { | ||
| code: 1078, | ||
| message: '<{0}> has no matching closing tag.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| ROOT_TAG_SHOULD_BE_TEMPLATE: { | ||
| code: 1079, | ||
| message: 'Expected root tag to be template, found {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| ROOT_TEMPLATE_HAS_UNKNOWN_ATTRIBUTES: { | ||
| code: 1080, | ||
| message: 'Root template has unknown or disallowed attributes: {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3100]: Update message to point to external documentation once available. | ||
| SLOT_TAG_CANNOT_HAVE_DIRECTIVES: { | ||
| code: 1082, | ||
| message: "<slot> tag can't be associated with {0} template directives.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| TEMPLATE_EXPRESSION_PARSING_ERROR: { | ||
| code: 1083, | ||
| message: 'Error parsing template expression: {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| strictLevel: exports.DiagnosticLevel.Fatal, | ||
| url: '', | ||
| }, | ||
| UNEXPECTED_IF_MODIFIER: { | ||
| code: 1084, | ||
| message: 'Unexpected if modifier {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_DOM_INVALID_VALUE: { | ||
| code: 1085, | ||
| message: 'Invalid value for "lwc:dom". \'lwc:dom\' can only be set to {0}', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_DOM_INVALID_CONTENTS: { | ||
| code: 1086, | ||
| message: 'Invalid contents for element with "lwc:dom". Element must be empty', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_DOM_INVALID_CUSTOM_ELEMENT: { | ||
| code: 1087, | ||
| message: 'Invalid directive "lwc:dom" on element {0}. "lwc:dom" cannot be added to a custom element', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_DOM_INVALID_SLOT_ELEMENT: { | ||
| code: 1088, | ||
| message: 'Invalid directive "lwc:dom" on <slot>.. "lwc:dom" cannot be added to a <slot>', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| STYLE_TAG_NOT_ALLOWED_IN_TEMPLATE: { | ||
| code: 1122, | ||
| message: "The <style> element is disallowed inside the template. Please add css rules into '.css' file of your component bundle.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNKNOWN_HTML_TAG_IN_TEMPLATE: { | ||
| code: 1123, | ||
| message: "Unknown html tag '<{0}>'. For more information refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element and https://developer.mozilla.org/en-US/docs/Web/SVG/Element", | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| ATTRIBUTE_NAME_STARTS_WITH_INVALID_CHARACTER: { | ||
| code: 1124, | ||
| message: '{0} is not valid attribute for {1}. Attribute name must start with an underscore, dollar sign, or an optional hyphen character followed by an alphabetic character.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| ATTRIBUTE_NAME_MUST_END_WITH_ALPHA_NUMERIC_CHARACTER: { | ||
| code: 1125, | ||
| message: '{0} is not valid attribute for {1}. Attribute name must end with alpha-numeric character.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNKNOWN_LWC_DIRECTIVE: { | ||
| code: 1127, | ||
| message: 'Invalid directive "{0}" on element {1}.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_OPTS_LWC_DYNAMIC: { | ||
| code: 1128, | ||
| message: 'Invalid lwc:dynamic usage. The LWC dynamic directive must be enabled in order to use this feature.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_DYNAMIC_ON_NATIVE_ELEMENT: { | ||
| code: 1129, | ||
| message: 'Invalid lwc:dynamic usage on element "{0}". This directive can only be used in a custom element.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_DYNAMIC_LITERAL_PROP: { | ||
| code: 1130, | ||
| message: 'Invalid lwc:dynamic usage on element "{0}". The directive binding must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_RENDER_MODE_INVALID_VALUE: { | ||
| code: 1133, | ||
| message: 'Invalid value for "lwc:render-mode". \'lwc:render-mode\' can only be set to "shadow", or "light"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_LIGHT_SLOT_INVALID_ATTRIBUTES: { | ||
| code: 1134, | ||
| message: "Invalid attribute(s) '{0}' on slot. Slots in Light DOM templates (which have 'lwc:render-mode' directive) can only have [{1}] attributes", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_DOM_INVALID_IN_LIGHT_DOM: { | ||
| code: 1135, | ||
| message: "Invalid directive 'lwc:dom' on element {0}. 'lwc:dom' is not necessary in Light DOM components.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_FOR_EACH_WITH_ITERATOR: { | ||
| code: 1136, | ||
| message: "Invalid usage for 'for:each' and '{0}' directives on the same element.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NO_DUPLICATE_SLOTS: { | ||
| code: 1137, | ||
| message: 'Invalid duplicate slot ({0}).', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| NO_SLOTS_IN_ITERATOR: { | ||
| code: 1138, | ||
| message: 'Invalid slot ({0}). A slot cannot appear inside of an iterator.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| LWC_LIGHT_SLOT_INVALID_EVENT_LISTENER: { | ||
| code: 1139, | ||
| message: "Invalid event listener '{0}' on slot. Slots in Light DOM templates cannot have event listeners.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_INNER_HTML_INVALID_CUSTOM_ELEMENT: { | ||
| code: 1140, | ||
| message: 'Invalid lwc:inner-html usage on element "{0}". The directive can\'t be used on a custom element or special LWC managed elements denoted with lwc:*.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_INNER_HTML_INVALID_ELEMENT: { | ||
| code: 1141, | ||
| message: 'Invalid lwc:inner-html usage on element "{0}". The directive can\'t be used on a slot or a template element.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_INNER_HTML_INVALID_CONTENTS: { | ||
| code: 1142, | ||
| message: 'Invalid lwc:inner-html usage on element "{0}". The directive can\'t be used on an element with content.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_INNER_HTML_INVALID_VALUE: { | ||
| code: 1143, | ||
| message: 'Invalid lwc:inner-html usage on element "{0}". The directive binding can only be an expression or a string.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_HTML_RECOVERY: { | ||
| code: 1144, | ||
| message: 'Invalid HTML detected, "<{0}>" was automatically inserted within "<{1}>"; the compiled template may not match the template source.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_TEMPLATE_ATTRIBUTE: { | ||
| code: 1145, | ||
| message: 'Invalid attributes detected on template. The following attributes are not supported on template tags in LWC: {0}. For more information, ' + | ||
| 'please visit https://sfdc.co/template-directives', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| PRESERVE_COMMENTS_MUST_BE_BOOLEAN: { | ||
| code: 1146, | ||
| message: 'lwc:preserve-comments must be a boolean attribute.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DUPLICATE_ATTR_PROP_TRANSFORM: { | ||
| code: 1147, | ||
| message: 'Found multiple HTML attributes mapping to the same JavaScript property. "{0}" and "{1}" both map to "{2}".', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_HTML_SYNTAX_WARNING: { | ||
| code: 1148, | ||
| message: 'Invalid HTML syntax: {0}. This will not be supported in future versions of LWC. For more information, ' + | ||
| 'please visit https://html.spec.whatwg.org/multipage/parsing.html#parse-error-{0}', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| KEY_SHOULD_BE_IN_ITERATION: { | ||
| code: 1149, | ||
| message: 'Invalid key attribute on element <{0}>. The key attribute should be applied to an element with for:each or iterator:*, or to a direct child of a <template> element with for:each or iterator:*. This key will be ignored, and may throw an error in future versions of LWC.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_TEMPLATE_WARNING: { | ||
| code: 1153, | ||
| message: 'Non-root template elements must contain valid LWC template directive attributes. Otherwise, the template and its children will be ignored. ' + | ||
| 'For more information please visit https://sfdc.co/template-directives', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_SPREAD_LITERAL_PROP: { | ||
| code: 1155, | ||
| message: 'Invalid lwc:spread usage on element "{0}". The directive binding must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_REF_INVALID_ELEMENT: { | ||
| code: 1156, | ||
| message: 'Invalid lwc:ref usage on element "{0}". The directive can\'t be used on a slot or a template element.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_REF_INVALID_VALUE: { | ||
| code: 1157, | ||
| message: 'Invalid lwc:ref usage on element "{0}". The directive binding must be a non-empty string.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_REF_INVALID_LOCATION_INSIDE_ITERATION: { | ||
| code: 1158, | ||
| message: 'Invalid lwc:ref usage on element "{0}". lwc:ref cannot be used inside for:each or an iterator.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IF_BLOCK_DIRECTIVE_SHOULD_BE_EXPRESSION: { | ||
| code: 1159, | ||
| message: 'lwc:if directive value should be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| ELSEIF_BLOCK_DIRECTIVE_SHOULD_BE_EXPRESSION: { | ||
| code: 1160, | ||
| message: 'lwc:elseif directive value should be an expression', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| ELSE_BLOCK_DIRECTIVE_CANNOT_HAVE_VALUE: { | ||
| code: 1161, | ||
| message: 'lwc:else directive cannot have a value', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_IF_BLOCK_DIRECTIVE_WITH_CONDITIONAL: { | ||
| code: 1162, | ||
| message: "Invalid usage of 'lwc:if' and '{0}' directives on the same element.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ELSEIF_BLOCK_DIRECTIVE_WITH_CONDITIONAL: { | ||
| code: 1163, | ||
| message: "Invalid usage of 'lwc:elseif' and '{0}' directives on the same element.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_ELSE_BLOCK_DIRECTIVE_WITH_CONDITIONAL: { | ||
| code: 1164, | ||
| message: "Invalid usage of 'lwc:else' and '{0}' directives on the same element.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_IF_SCOPE_NOT_FOUND: { | ||
| code: 1165, | ||
| message: "'{0}' directive must be used immediately after an element with 'lwc:if' or 'lwc:elseif'. No such element found.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_IF_CANNOT_BE_USED_WITH_IF_DIRECTIVE: { | ||
| code: 1166, | ||
| message: "'{0}' directive cannot be used with 'lwc:if', 'lwc:elseif', or 'lwc:else directives on the same element.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SCOPED_SLOT_BIND_IN_LIGHT_DOM_ONLY: { | ||
| code: 1169, | ||
| message: 'Invalid lwc:slot-bind usage on <slot> element. Scoped slots usage is allowed in Light DOM templates only.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_SLOT_BIND_LITERAL_PROP: { | ||
| code: 1170, | ||
| message: 'Invalid lwc:slot-bind usage on element {0}. The directive binding must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_SLOT_BIND_NON_SLOT_ELEMENT: { | ||
| code: 1171, | ||
| message: 'Invalid lwc:slot-bind usage on element {0}. The directive can be used on a <slot> element only.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NO_DUPLICATE_SCOPED_SLOT: { | ||
| code: 1172, | ||
| message: 'Invalid duplicate scoped slots ({0})', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NO_MIXED_SLOT_TYPES: { | ||
| code: 1173, | ||
| message: 'Mixing slot types disallowed for same ({0}) slot.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SLOT_DATA_VALUE_SHOULD_BE_STRING: { | ||
| code: 1174, | ||
| message: 'lwc:slot-data attribute value is expected to be a string.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SCOPED_SLOT_DATA_ON_TEMPLATE_ONLY: { | ||
| code: 1176, | ||
| message: 'lwc:slot-data directive can be used on <template> elements only.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| NON_ELEMENT_SCOPED_SLOT_CONTENT: { | ||
| code: 1177, | ||
| message: '<template> tag with lwc:slot-data directive cannot contain a comment or text node as a direct child.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_PARENT_OF_LWC_SLOT_DATA: { | ||
| code: 1178, | ||
| message: '<template> tag with lwc:slot-data directive must be the direct child of a custom element.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SCOPED_SLOTDATA_CANNOT_BE_COMBINED_WITH_OTHER_DIRECTIVE: { | ||
| code: 1179, | ||
| message: 'lwc:slot-data directive cannot be combined with other directives on the same <template> tag.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_EXTERNAL_ON_NON_CUSTOM_ELEMENT: { | ||
| code: 1180, | ||
| message: 'Invalid lwc:external directive usage: {0}. This directive can only be used on custom elements.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_EXTERNAL_VALUE: { | ||
| code: 1181, | ||
| message: 'Invalid lwc:external directive usage: {0}. This directive is a boolean attribute and should not have a value.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| SINGLE_IF_DIRECTIVE_ALLOWED: { | ||
| code: 1182, | ||
| message: `Multiple if: directives found on '{0}'. Only one if: directive is allowed; the rest are ignored.`, | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| LWC_COMPONENT_TAG_WITHOUT_IS_DIRECTIVE: { | ||
| code: 1183, | ||
| message: `<lwc:component> must have an 'lwc:is' attribute.`, | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| UNSUPPORTED_LWC_TAG_NAME: { | ||
| code: 1184, | ||
| message: '{0} is not a special LWC tag name and will be treated as an HTML element.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_IS_DIRECTIVE_VALUE: { | ||
| code: 1185, | ||
| message: 'Invalid lwc:is usage for value {0}. The value assigned to lwc:is must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| LWC_IS_INVALID_ELEMENT: { | ||
| code: 1186, | ||
| message: 'Invalid lwc:is usage for element {0}. The directive can only be used with <lwc:component>', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| DEPRECATED_LWC_DYNAMIC_ATTRIBUTE: { | ||
| code: 1187, | ||
| message: `The lwc:dynamic directive is deprecated and will be removed in a future release. Please use lwc:is instead.`, | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_OPTS_LWC_ENABLE_DYNAMIC_COMPONENTS: { | ||
| code: 1188, | ||
| message: 'Invalid dynamic components usage, lwc:component and lwc:is can only be used when dynamic components have been enabled.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_ARROW_FN_PARAM: { | ||
| code: 1189, | ||
| message: "Template expression doesn't allow {0} in arrow function params.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_STATEMENTS_PROHIBITED: { | ||
| code: 1190, | ||
| message: 'Statements are disallowed in template expressions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_MUTATION_OUTSIDE_ARROW: { | ||
| code: 1191, | ||
| message: 'Field mutations are only permitted within arrow functions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_DELETE_OP: { | ||
| code: 1192, | ||
| message: 'Use of the delete operator is prohibited within template expressions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_ARROW_FN_BODY: { | ||
| code: 1193, | ||
| message: 'The body of arrow functions in template expressions must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_ARROW_FN_KIND: { | ||
| code: 1194, | ||
| message: 'Arrow functions in template expressions cannot be {0}.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_EARLY_STAGE_FEATURE: { | ||
| code: 1195, | ||
| message: 'Early-stage JS features are disallowed in template expressions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_PROHIBITED_NODE_TYPE: { | ||
| code: 1196, | ||
| message: 'Use of {0} is disallowed within template expressions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| // TODO [#3370]: remove this error if template expressions is removed | ||
| INVALID_EXPR_COMMENTS_DISALLOWED: { | ||
| code: 1197, | ||
| message: 'Use of comments is disallowed within template expressions.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| IGNORED_SLOT_ATTRIBUTE_IN_CHILD: { | ||
| code: 1201, | ||
| message: 'The slot attribute in {0} will be ignored due to its ancestor {1}. It must be a direct child of the containing component.', | ||
| level: exports.DiagnosticLevel.Warning, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_ON_ELEMENT: { | ||
| code: 1203, | ||
| message: 'Invalid lwc:on usage on element "{0}". The directive can\'t be used on a template element.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_ON_LITERAL_PROP: { | ||
| code: 1204, | ||
| message: 'Invalid lwc:on usage on element "{0}". The directive binding must be an expression.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_ON_WITH_DECLARATIVE_LISTENERS: { | ||
| code: 1205, | ||
| message: 'Invalid lwc:on usage on element "{0}". It is not permitted to use declarative event listeners alongside lwc:on', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_LWC_ON_OPTS: { | ||
| code: 1206, | ||
| message: 'Invalid lwc:on usage. The `lwc:on` directive must be enabled in order to use this feature.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| COMPUTED_PROPERTY_ACCESS_NOT_ALLOWED_CTE_UNQUOTED: { | ||
| code: 1207, | ||
| message: 'Template expression doesn\'t allow computed property access unless the expression is surrounded by quotes: "{0}"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_NODE_CTE_UNQUOTED: { | ||
| code: 1208, | ||
| message: 'Template expression doesn\'t allow {0} unless the expression is surrounded by quotes: "{1}"', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| COMPUTED_PROPERTY_ACCESS_NOT_ALLOWED_CTE_API_VERSION: { | ||
| code: 1209, | ||
| message: "Template expression doesn't allow computed property access. The current component API version ({1}) is insufficient and must be increased to at least {2} for this type of expression.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| INVALID_NODE_CTE_API_VERSION: { | ||
| code: 1210, | ||
| message: "Template expression doesn't allow {0}. The current component API version ({1}) is insufficient and must be increased to at least {2} for this type of expression.", | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| RESERVED_KEYWORD_AS_IDENTIFIER: { | ||
| code: 1211, | ||
| message: '{0} is a reserved keyword and cannot be used as an identifier.', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| /* | ||
| * Copyright (c) 2025, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| /* | ||
| * For the next available error code, reference (and update!) the value in ./index.ts | ||
| */ | ||
| const SsrCompilerErrors = { | ||
| RESERVED_IDENTIFIER_PREFIX: { | ||
| code: 1202, | ||
| message: 'Identifier name cannot start with "__lwc".', | ||
| level: exports.DiagnosticLevel.Error, | ||
| url: '', | ||
| }, | ||
| }; | ||
| /* | ||
| * Copyright (c) 2024, Salesforce, Inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: MIT | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT | ||
| */ | ||
| /** | ||
| * Generates a friendly error message for the given error type, using the provided template values. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param args Values used to fill the error message template. | ||
| * @returns The generated error message. | ||
| */ | ||
| function generateErrorMessage(errorInfo, args) { | ||
| const message = Array.isArray(args) | ||
| ? templateString(errorInfo.message, args) | ||
| : errorInfo.message; | ||
| if (errorInfo.url && errorInfo.url !== '') ; | ||
| return `LWC${errorInfo.code}: ${message}`; | ||
| } | ||
| /** | ||
| * Generates a compiler diagnostic. This function is used to look up the specified errorInfo | ||
| * and generate a friendly and consistent diagnostic object. Diagnostic contains | ||
| * info about the error's code and its origin (filename, line, column) when applicable. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param config A config object providing any message arguments and origin info needed to create the error. | ||
| * @returns The generated compiler diagnostic object. | ||
| */ | ||
| function generateCompilerDiagnostic(errorInfo, config, useStrictErrorOverride = false) { | ||
| const message = generateErrorMessage(errorInfo, config && config.messageArgs); | ||
| const diagnostic = { | ||
| code: errorInfo.code, | ||
| message, | ||
| level: getEffectiveErrorLevel(errorInfo, useStrictErrorOverride), | ||
| url: errorInfo.url, | ||
| }; | ||
| if (config && config.origin) { | ||
| diagnostic.filename = getFilename(config.origin); | ||
| diagnostic.location = getLocation(config.origin); | ||
| } | ||
| return diagnostic; | ||
| } | ||
| /** | ||
| * Generates a compiler error. This function is used to look up the specified errorInfo | ||
| * and generate a friendly and consistent error object. Error object contains info about | ||
| * the error's code and its origin (filename, line, column) when applicable. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param config A config object providing any message arguments and origin info needed to create the error. | ||
| * @returns The generated compiler error. | ||
| */ | ||
| function generateCompilerError(errorInfo, config, useStrictErrorOverride = false) { | ||
| const message = generateErrorMessage(errorInfo, config && config.messageArgs); | ||
| const level = getEffectiveErrorLevel(errorInfo, useStrictErrorOverride); | ||
| const error = new CompilerError(errorInfo.code, message, undefined, undefined, level, errorInfo.url); | ||
| if (config) { | ||
| error.filename = getFilename(config.origin); | ||
| error.location = getLocation(config.origin); | ||
| } | ||
| return error; | ||
| } | ||
| /** | ||
| * Validates that the provided condition is truthy. | ||
| * @param condition Condition to check. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param args Values used to fill the error message template. | ||
| * @throws Throws a compiler error if the provided condition is falsy. | ||
| */ | ||
| function invariant(condition, errorInfo, args) { | ||
| if (!condition) { | ||
| throw generateCompilerError(errorInfo, { | ||
| messageArgs: args, | ||
| }); | ||
| } | ||
| } | ||
| /** | ||
| * Normalizes a received error into a CompilerError. Adds any provided additional origin info. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param error The original error. | ||
| * @param origin The origin associated with the error. | ||
| * @returns The normalized compiler error. | ||
| */ | ||
| function normalizeToCompilerError(fallbackErrorInfo, error, origin, useStrictErrorOverride = false) { | ||
| if (error instanceof CompilerError) { | ||
| if (origin) { | ||
| error.filename = getFilename(origin); | ||
| error.location = getLocation(origin); | ||
| } | ||
| return error; | ||
| } | ||
| const { code, message, filename, location, level, url } = convertErrorToDiagnostic(error, fallbackErrorInfo, origin, useStrictErrorOverride); | ||
| const compilerError = new CompilerError(code, `${error.name}: ${message}`, filename, location, level, url); | ||
| compilerError.stack = error.stack; | ||
| return compilerError; | ||
| } | ||
| /** | ||
| * Determines the effective error level based on strict mode override settings. | ||
| * @param errorInfo The error information containing level and strictLevel properties | ||
| * @param useStrictErrorOverride Whether to use strict error level override | ||
| * @returns The effective diagnostic level to use | ||
| */ | ||
| function getEffectiveErrorLevel(errorInfo, useStrictErrorOverride) { | ||
| return useStrictErrorOverride && errorInfo.strictLevel !== undefined | ||
| ? errorInfo.strictLevel | ||
| : errorInfo.level; | ||
| } | ||
| /** | ||
| * Normalizes a received error into a CompilerDiagnostic. Adds any provided additional origin info. | ||
| * @param errorInfo The object holding the error metadata. | ||
| * @param error The original error. | ||
| * @param origin The origin of the error. | ||
| * @returns The normalized compiler diagnostic object. | ||
| */ | ||
| function normalizeToDiagnostic(errorInfo, error, origin, useStrictErrorOverride = false) { | ||
| if (error instanceof CompilerError) { | ||
| const diagnostic = error.toDiagnostic(); | ||
| if (origin) { | ||
| diagnostic.filename = getFilename(origin); | ||
| diagnostic.location = getLocation(origin); | ||
| } | ||
| return diagnostic; | ||
| } | ||
| return convertErrorToDiagnostic(error, errorInfo, origin, useStrictErrorOverride); | ||
| } | ||
| function convertErrorToDiagnostic(error, fallbackErrorInfo, origin, useStrictErrorOverride = false) { | ||
| const code = getCodeFromError(error) || fallbackErrorInfo.code; | ||
| const message = error.lwcCode | ||
| ? error.message | ||
| : generateErrorMessage(fallbackErrorInfo, [error.message]); | ||
| const level = getEffectiveErrorLevel('level' in error ? error : fallbackErrorInfo, useStrictErrorOverride); | ||
| const url = error.url ?? fallbackErrorInfo.url; | ||
| const filename = getFilename(origin, error); | ||
| const location = getLocation(origin, error); | ||
| // TODO [#1289]: Preserve stack information | ||
| return { code, message, level, filename, location, url }; | ||
| } | ||
| /** | ||
| * Pattern modeled after @lwc/engine-core's reporting.ts system | ||
| */ | ||
| exports.CompilerMetrics = void 0; | ||
| (function (CompilerMetrics) { | ||
| CompilerMetrics["LWCDynamicDirective"] = "lwc-dynamic-directive"; | ||
| CompilerMetrics["LWCRenderModeDirective"] = "lwc-render-mode-directive"; | ||
| CompilerMetrics["LWCSpreadDirective"] = "lwc-spread-directive"; | ||
| CompilerMetrics["DynamicImportTransform"] = "dynamic-import-transform"; | ||
| })(exports.CompilerMetrics || (exports.CompilerMetrics = {})); | ||
| exports.CompilerAggregateError = CompilerAggregateError; | ||
| exports.CompilerError = CompilerError; | ||
| exports.CompilerValidationErrors = CompilerValidationErrors; | ||
| exports.DecoratorErrors = DecoratorErrors; | ||
| exports.GENERIC_COMPILER_ERROR = GENERIC_COMPILER_ERROR; | ||
| exports.LWCClassErrors = LWCClassErrors; | ||
| exports.ModuleResolutionErrors = ModuleResolutionErrors; | ||
| exports.ParserDiagnostics = ParserDiagnostics; | ||
| exports.SsrCompilerErrors = SsrCompilerErrors; | ||
| exports.TemplateErrors = TemplateErrors; | ||
| exports.TransformerErrors = TransformerErrors; | ||
| exports.generateCompilerDiagnostic = generateCompilerDiagnostic; | ||
| exports.generateCompilerError = generateCompilerError; | ||
| exports.generateErrorMessage = generateErrorMessage; | ||
| exports.invariant = invariant; | ||
| exports.normalizeToCompilerError = normalizeToCompilerError; | ||
| exports.normalizeToDiagnostic = normalizeToDiagnostic; | ||
| /** version: 8.28.2 */ | ||
| //# sourceMappingURL=index.cjs.js.map |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
9
-18.18%Yes
NaN116929
-34.8%15
-6.25%2837
-35.02%