@herb-tools/core 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/herb-core.browser.js +41 -6
- package/dist/herb-core.browser.js.map +1 -1
- package/dist/herb-core.cjs +41 -5
- package/dist/herb-core.cjs.map +1 -1
- package/dist/herb-core.esm.js +41 -6
- package/dist/herb-core.esm.js.map +1 -1
- package/dist/herb-core.umd.js +41 -5
- package/dist/herb-core.umd.js.map +1 -1
- package/dist/types/errors.d.ts +18 -1
- package/package.json +1 -1
- package/src/errors.ts +58 -1
- package/src/node-type-guards.ts +1 -1
- package/src/nodes.ts +1 -1
- package/src/visitor.ts +1 -1
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Location, SerializedLocation } from "./location.js";
|
|
2
2
|
import { Token, SerializedToken } from "./token.js";
|
|
3
3
|
import { Diagnostic, MonacoDiagnostic } from "./diagnostic.js";
|
|
4
|
-
export type HerbErrorType = "UNEXPECTED_ERROR" | "UNEXPECTED_TOKEN_ERROR" | "MISSING_OPENING_TAG_ERROR" | "MISSING_CLOSING_TAG_ERROR" | "TAG_NAMES_MISMATCH_ERROR" | "QUOTES_MISMATCH_ERROR" | "VOID_ELEMENT_CLOSING_TAG_ERROR" | "UNCLOSED_ELEMENT_ERROR" | "RUBY_PARSE_ERROR" | "ERB_CONTROL_FLOW_SCOPE_ERROR" | "MISSINGERB_END_TAG_ERROR" | "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR";
|
|
4
|
+
export type HerbErrorType = "UNEXPECTED_ERROR" | "UNEXPECTED_TOKEN_ERROR" | "MISSING_OPENING_TAG_ERROR" | "MISSING_CLOSING_TAG_ERROR" | "TAG_NAMES_MISMATCH_ERROR" | "QUOTES_MISMATCH_ERROR" | "VOID_ELEMENT_CLOSING_TAG_ERROR" | "UNCLOSED_ELEMENT_ERROR" | "RUBY_PARSE_ERROR" | "ERB_CONTROL_FLOW_SCOPE_ERROR" | "MISSINGERB_END_TAG_ERROR" | "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR" | "ERB_CASE_WITH_CONDITIONS_ERROR";
|
|
5
5
|
export type SerializedErrorType = string;
|
|
6
6
|
export interface SerializedHerbError {
|
|
7
7
|
type: string;
|
|
@@ -285,4 +285,21 @@ export declare class ERBMultipleBlocksInTagError extends HerbError {
|
|
|
285
285
|
toMonacoDiagnostic(): MonacoDiagnostic;
|
|
286
286
|
treeInspect(): string;
|
|
287
287
|
}
|
|
288
|
+
export interface SerializedERBCaseWithConditionsError {
|
|
289
|
+
type: "ERB_CASE_WITH_CONDITIONS_ERROR";
|
|
290
|
+
message: string;
|
|
291
|
+
location: SerializedLocation;
|
|
292
|
+
}
|
|
293
|
+
export interface ERBCaseWithConditionsErrorProps {
|
|
294
|
+
type: string;
|
|
295
|
+
message: string;
|
|
296
|
+
location: Location;
|
|
297
|
+
}
|
|
298
|
+
export declare class ERBCaseWithConditionsError extends HerbError {
|
|
299
|
+
static from(data: SerializedERBCaseWithConditionsError): ERBCaseWithConditionsError;
|
|
300
|
+
constructor(props: ERBCaseWithConditionsErrorProps);
|
|
301
|
+
toJSON(): SerializedERBCaseWithConditionsError;
|
|
302
|
+
toMonacoDiagnostic(): MonacoDiagnostic;
|
|
303
|
+
treeInspect(): string;
|
|
304
|
+
}
|
|
288
305
|
export declare function fromSerializedError(error: SerializedHerbError): HerbError;
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/javascript/packages/core/src/errors.ts.erb
|
|
3
3
|
|
|
4
4
|
import { Location, SerializedLocation } from "./location.js"
|
|
5
5
|
import { Token, SerializedToken } from "./token.js"
|
|
@@ -18,6 +18,7 @@ export type HerbErrorType =
|
|
|
18
18
|
| "ERB_CONTROL_FLOW_SCOPE_ERROR"
|
|
19
19
|
| "MISSINGERB_END_TAG_ERROR"
|
|
20
20
|
| "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR"
|
|
21
|
+
| "ERB_CASE_WITH_CONDITIONS_ERROR"
|
|
21
22
|
|
|
22
23
|
export type SerializedErrorType = string
|
|
23
24
|
|
|
@@ -863,6 +864,61 @@ export class ERBMultipleBlocksInTagError extends HerbError {
|
|
|
863
864
|
}
|
|
864
865
|
}
|
|
865
866
|
|
|
867
|
+
export interface SerializedERBCaseWithConditionsError {
|
|
868
|
+
type: "ERB_CASE_WITH_CONDITIONS_ERROR";
|
|
869
|
+
message: string;
|
|
870
|
+
location: SerializedLocation;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export interface ERBCaseWithConditionsErrorProps {
|
|
874
|
+
type: string;
|
|
875
|
+
message: string;
|
|
876
|
+
location: Location;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export class ERBCaseWithConditionsError extends HerbError {
|
|
880
|
+
|
|
881
|
+
static from(data: SerializedERBCaseWithConditionsError): ERBCaseWithConditionsError {
|
|
882
|
+
return new ERBCaseWithConditionsError({
|
|
883
|
+
type: data.type,
|
|
884
|
+
message: data.message,
|
|
885
|
+
location: Location.from(data.location),
|
|
886
|
+
})
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
constructor(props: ERBCaseWithConditionsErrorProps) {
|
|
890
|
+
super(props.type, props.message, props.location);
|
|
891
|
+
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
toJSON(): SerializedERBCaseWithConditionsError {
|
|
895
|
+
return {
|
|
896
|
+
...super.toJSON(),
|
|
897
|
+
type: "ERB_CASE_WITH_CONDITIONS_ERROR",
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
toMonacoDiagnostic(): MonacoDiagnostic {
|
|
902
|
+
return {
|
|
903
|
+
line: this.location.start.line,
|
|
904
|
+
column: this.location.start.column,
|
|
905
|
+
endLine: this.location.end.line,
|
|
906
|
+
endColumn: this.location.end.column,
|
|
907
|
+
message: this.message,
|
|
908
|
+
severity: 'error'
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
treeInspect(): string {
|
|
913
|
+
let output = "";
|
|
914
|
+
|
|
915
|
+
output += `@ ERBCaseWithConditionsError ${this.location.treeInspectWithLabel()}\n`;
|
|
916
|
+
output += `└── message: "${this.message}"\n`;
|
|
917
|
+
|
|
918
|
+
return output;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
866
922
|
|
|
867
923
|
export function fromSerializedError(error: SerializedHerbError): HerbError {
|
|
868
924
|
switch (error.type) {
|
|
@@ -878,6 +934,7 @@ export function fromSerializedError(error: SerializedHerbError): HerbError {
|
|
|
878
934
|
case "ERB_CONTROL_FLOW_SCOPE_ERROR": return ERBControlFlowScopeError.from(error as SerializedERBControlFlowScopeError);
|
|
879
935
|
case "MISSINGERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
|
|
880
936
|
case "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR": return ERBMultipleBlocksInTagError.from(error as SerializedERBMultipleBlocksInTagError);
|
|
937
|
+
case "ERB_CASE_WITH_CONDITIONS_ERROR": return ERBCaseWithConditionsError.from(error as SerializedERBCaseWithConditionsError);
|
|
881
938
|
|
|
882
939
|
default:
|
|
883
940
|
throw new Error(`Unknown node type: ${error.type}`);
|
package/src/node-type-guards.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
3
3
|
|
|
4
4
|
import type { Node, NodeType, ERBNode } from "./nodes.js"
|
|
5
5
|
|
package/src/nodes.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/javascript/packages/core/src/nodes.ts.erb
|
|
3
3
|
|
|
4
4
|
import { Location } from "./location.js"
|
|
5
5
|
import { Token, SerializedToken } from "./token.js"
|
package/src/visitor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
Node,
|