@lwrjs/diagnostics
Advanced tools
Comparing version 0.0.2-alpha62 to 0.0.2-alpha63
@@ -1,2 +0,2 @@ | ||
import { createDiagnosticsCategory } from './index'; | ||
import { createDiagnosticsCategory } from './core-diagnostics'; | ||
export const compiler = createDiagnosticsCategory({ | ||
@@ -3,0 +3,0 @@ UMD_TRANFORM: { |
@@ -1,2 +0,2 @@ | ||
import { createDiagnosticsCategory } from './index.js'; | ||
import { createDiagnosticsCategory } from './core-diagnostics.js'; | ||
export const configParser = createDiagnosticsCategory({ | ||
@@ -3,0 +3,0 @@ TEST: { message: 'test' }, |
@@ -1,25 +0,10 @@ | ||
import { DiagnosticDescription, DiagnosticAdvice, StaticMarkup } from '../types'; | ||
declare type InputMessagesFactory = (...params: any[]) => Partial<DiagnosticDescription>; | ||
export declare type InputMessagesCategory = { | ||
[key: string]: Partial<DiagnosticDescription> | InputMessagesFactory; | ||
}; | ||
declare type OuputMessagesFactoryReturn<Ret extends Partial<DiagnosticDescription>> = Omit<Ret, 'message' | 'advice'> & { | ||
advice: DiagnosticAdvice; | ||
message: StaticMarkup; | ||
}; | ||
declare type OutputMessagesFactory<Func extends InputMessagesFactory> = (...params: Parameters<Func>) => OuputMessagesFactoryReturn<ReturnType<Func>>; | ||
declare type OutputMessagesValue<Value> = Value extends StaticMarkup ? { | ||
message: StaticMarkup; | ||
advice: DiagnosticAdvice; | ||
} : Value extends Partial<DiagnosticDescription> ? OuputMessagesFactoryReturn<Value> : Value extends InputMessagesFactory ? OutputMessagesFactory<Value> : never; | ||
declare type OutputMessagesCategory<Input extends InputMessagesCategory> = { | ||
[Key in keyof Input]: OutputMessagesValue<Input[Key]>; | ||
}; | ||
export declare function createDiagnosticsCategory<Input extends InputMessagesCategory>(input: Input): OutputMessagesCategory<Input>; | ||
export declare const descriptions: { | ||
CONFIG_PARSER: OutputMessagesCategory<{ | ||
TEST: { | ||
CONFIG_PARSER: { | ||
TEST: Pick<{ | ||
message: string; | ||
}, never> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
TEST_ADVICE: (tagName: string, openLocation: import("../types").DiagnosticLocation) => { | ||
TEST_ADVICE: (tagName: string, openLocation: import("../types.js").DiagnosticLocation) => Pick<{ | ||
message: string; | ||
@@ -33,120 +18,204 @@ advice: ({ | ||
type: "frame"; | ||
location: import("../types").DiagnosticLocation; | ||
location: import("../types.js").DiagnosticLocation; | ||
category?: undefined; | ||
text?: undefined; | ||
})[]; | ||
}, never> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_JSON: (invalidJsonError: string) => { | ||
INVALID_JSON: (invalidJsonError: string) => Pick<{ | ||
category: "lwrConfig/invalidJson"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INCORRECT_NODE_TYPE: (configProperty: string, expectedNodeType: string, actualNodeType: string) => { | ||
INCORRECT_NODE_TYPE: (configProperty: string, expectedNodeType: string, actualNodeType: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_EMPTY_NODE: (configProperty: string) => { | ||
INVALID_EMPTY_NODE: (configProperty: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_PROPERTY: (configProperty: string, prop: string) => { | ||
INVALID_PROPERTY: (configProperty: string, prop: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
NON_EMPTY_STRING: (configProperty: string, actualProp: string) => { | ||
NON_EMPTY_STRING: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
NON_EMPTY_ARRAY: (configProperty: string, actualProp: string) => { | ||
NON_EMPTY_ARRAY: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_PORT: (configProperty: string, actualProp: string) => { | ||
INVALID_PORT: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_METHOD: (configProperty: string, actualProp: string) => { | ||
INVALID_METHOD: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_SERVER_TYPE: (configProperty: string, actualProp: string) => { | ||
INVALID_SERVER_TYPE: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_STATUS: (configProperty: string, actualProp: string) => { | ||
INVALID_STATUS: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_SPECIFIER: (configProperty: string, actualProp: string) => { | ||
INVALID_SPECIFIER: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_PATH: (configProperty: string, actualProp: string) => { | ||
INVALID_PATH: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_SERVICE: (configProperty: string, actualProp: string) => { | ||
INVALID_SERVICE: (configProperty: string, actualProp: string) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
MISSING_ONE_OF: (configProperty: string, childProps: string[]) => { | ||
MISSING_ONE_OF: (configProperty: string, childProps: string[]) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
TOO_MANY: (configProperty: string, childProps: string[]) => { | ||
TOO_MANY: (configProperty: string, childProps: string[]) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
MISSING_REQUIRED: (configProperty: string, childProps: string[]) => { | ||
MISSING_REQUIRED: (configProperty: string, childProps: string[]) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
DUPLICATE_IDS: (configProperty: string, dupeIds: string[]) => { | ||
DUPLICATE_IDS: (configProperty: string, dupeIds: string[]) => Pick<{ | ||
category: "lwrConfig/invalidSchema"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
}>; | ||
UNRESOLVABLE: OutputMessagesCategory<{ | ||
ASSET: (assetPath: string) => { | ||
}; | ||
UNRESOLVABLE: { | ||
ASSET: (assetPath: string) => Pick<{ | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
DIR_ALIAS: (assetPath: string) => { | ||
DIR_ALIAS: (assetPath: string) => Pick<{ | ||
category: "lwrUnresolvable/asset"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
MODULE: (moduleSpecifier: string) => { | ||
MODULE: (moduleSpecifier: string) => Pick<{ | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
MODULE_ENTRY: (moduleSpecifier: string) => { | ||
MODULE_ENTRY: (moduleSpecifier: string) => Pick<{ | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
LWC_MODULE: (name: string) => { | ||
LWC_MODULE: (name: string) => Pick<{ | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => { | ||
SIGNED_MODULE: (moduleSpecifier: string, signature: string) => Pick<{ | ||
category: "lwrUnresolvable/module"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
RESOURCE: (resourceSpecifier: string) => { | ||
RESOURCE: (resourceSpecifier: string) => Pick<{ | ||
category: "lwrUnresolvable/resource"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
SERVER_ERROR: (name: string) => { | ||
SERVER_ERROR: (name: string) => Pick<{ | ||
category: "lwrUnresolvable/fatal"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
INVALID_JSON: () => { | ||
INVALID_JSON: () => Pick<{ | ||
category: "lwrUnresolvable/invalid"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
LABEL_MODULE: (file: string, error: string) => { | ||
LABEL_MODULE: (file: string, error: string) => Pick<{ | ||
category: "lwrUnresolvable/label"; | ||
message: string; | ||
}, "category"> & { | ||
advice: import("../types.js").DiagnosticAdvice; | ||
message: string; | ||
}; | ||
}>; | ||
}; | ||
}; | ||
export {}; | ||
export * from './core-diagnostics.js'; | ||
//# sourceMappingURL=index.d.ts.map |
import { configParser } from './configParser.js'; | ||
import { unresolvable } from './unresolvable.js'; | ||
export function createDiagnosticsCategory(input) { | ||
const category = {}; | ||
for (const key in input) { | ||
const value = input[key]; | ||
if (typeof value === 'function') { | ||
const callback = value; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
category[key] = function (...params) { | ||
const { message, advice = [], ...ret } = callback(...params); | ||
return { | ||
...ret, | ||
advice, | ||
message, | ||
}; | ||
}; | ||
} | ||
else { | ||
const { message, advice = [], ...obj } = value; | ||
category[key] = { | ||
...obj, | ||
advice, | ||
message, | ||
}; | ||
} | ||
} | ||
return category; | ||
} | ||
export const descriptions = { | ||
@@ -35,2 +7,3 @@ CONFIG_PARSER: configParser, | ||
}; | ||
export * from './core-diagnostics.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { createDiagnosticsCategory } from './index.js'; | ||
import { createDiagnosticsCategory } from './core-diagnostics.js'; | ||
export const unresolvable = createDiagnosticsCategory({ | ||
@@ -3,0 +3,0 @@ ASSET: (assetPath) => ({ |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.0.2-alpha62", | ||
"version": "0.0.2-alpha63", | ||
"homepage": "https://lwr.dev/", | ||
@@ -34,3 +34,3 @@ "repository": { | ||
"devDependencies": { | ||
"@lwrjs/types": "0.0.2-alpha62" | ||
"@lwrjs/types": "0.0.2-alpha63" | ||
}, | ||
@@ -40,3 +40,3 @@ "engines": { | ||
}, | ||
"gitHead": "e877f7e22707975b3289c50be951682e4d8abe01" | ||
"gitHead": "97c61b0b60cf74e8de837889e63fdee74422943f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48153
29
1184