@herb-tools/core 0.8.4 → 0.8.6
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 +2 -2
- 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/CHANGELOG.md +0 -19
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";
|
|
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";
|
|
5
5
|
export type SerializedErrorType = string;
|
|
6
6
|
export interface SerializedHerbError {
|
|
7
7
|
type: string;
|
|
@@ -268,4 +268,21 @@ export declare class MissingERBEndTagError extends HerbError {
|
|
|
268
268
|
toMonacoDiagnostic(): MonacoDiagnostic;
|
|
269
269
|
treeInspect(): string;
|
|
270
270
|
}
|
|
271
|
+
export interface SerializedERBMultipleBlocksInTagError {
|
|
272
|
+
type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR";
|
|
273
|
+
message: string;
|
|
274
|
+
location: SerializedLocation;
|
|
275
|
+
}
|
|
276
|
+
export interface ERBMultipleBlocksInTagErrorProps {
|
|
277
|
+
type: string;
|
|
278
|
+
message: string;
|
|
279
|
+
location: Location;
|
|
280
|
+
}
|
|
281
|
+
export declare class ERBMultipleBlocksInTagError extends HerbError {
|
|
282
|
+
static from(data: SerializedERBMultipleBlocksInTagError): ERBMultipleBlocksInTagError;
|
|
283
|
+
constructor(props: ERBMultipleBlocksInTagErrorProps);
|
|
284
|
+
toJSON(): SerializedERBMultipleBlocksInTagError;
|
|
285
|
+
toMonacoDiagnostic(): MonacoDiagnostic;
|
|
286
|
+
treeInspect(): string;
|
|
287
|
+
}
|
|
271
288
|
export declare function fromSerializedError(error: SerializedHerbError): HerbError;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herb-tools/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "Core module exporting shared interfaces, AST node definitions, and common utilities for Herb",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://herb-tools.dev",
|
|
7
7
|
"bugs": "https://github.com/marcoroth/herb/issues/new?title=Package%20%60@herb-tools/core%60:%20",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/marcoroth/herb.git",
|
|
10
|
+
"url": "git+https://github.com/marcoroth/herb.git",
|
|
11
11
|
"directory": "javascript/packages/core"
|
|
12
12
|
},
|
|
13
13
|
"main": "./dist/herb-core.cjs",
|
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.6/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"
|
|
@@ -17,6 +17,7 @@ export type HerbErrorType =
|
|
|
17
17
|
| "RUBY_PARSE_ERROR"
|
|
18
18
|
| "ERB_CONTROL_FLOW_SCOPE_ERROR"
|
|
19
19
|
| "MISSINGERB_END_TAG_ERROR"
|
|
20
|
+
| "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR"
|
|
20
21
|
|
|
21
22
|
export type SerializedErrorType = string
|
|
22
23
|
|
|
@@ -807,6 +808,61 @@ export class MissingERBEndTagError extends HerbError {
|
|
|
807
808
|
}
|
|
808
809
|
}
|
|
809
810
|
|
|
811
|
+
export interface SerializedERBMultipleBlocksInTagError {
|
|
812
|
+
type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR";
|
|
813
|
+
message: string;
|
|
814
|
+
location: SerializedLocation;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
export interface ERBMultipleBlocksInTagErrorProps {
|
|
818
|
+
type: string;
|
|
819
|
+
message: string;
|
|
820
|
+
location: Location;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export class ERBMultipleBlocksInTagError extends HerbError {
|
|
824
|
+
|
|
825
|
+
static from(data: SerializedERBMultipleBlocksInTagError): ERBMultipleBlocksInTagError {
|
|
826
|
+
return new ERBMultipleBlocksInTagError({
|
|
827
|
+
type: data.type,
|
|
828
|
+
message: data.message,
|
|
829
|
+
location: Location.from(data.location),
|
|
830
|
+
})
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
constructor(props: ERBMultipleBlocksInTagErrorProps) {
|
|
834
|
+
super(props.type, props.message, props.location);
|
|
835
|
+
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
toJSON(): SerializedERBMultipleBlocksInTagError {
|
|
839
|
+
return {
|
|
840
|
+
...super.toJSON(),
|
|
841
|
+
type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR",
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
toMonacoDiagnostic(): MonacoDiagnostic {
|
|
846
|
+
return {
|
|
847
|
+
line: this.location.start.line,
|
|
848
|
+
column: this.location.start.column,
|
|
849
|
+
endLine: this.location.end.line,
|
|
850
|
+
endColumn: this.location.end.column,
|
|
851
|
+
message: this.message,
|
|
852
|
+
severity: 'error'
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
treeInspect(): string {
|
|
857
|
+
let output = "";
|
|
858
|
+
|
|
859
|
+
output += `@ ERBMultipleBlocksInTagError ${this.location.treeInspectWithLabel()}\n`;
|
|
860
|
+
output += `└── message: "${this.message}"\n`;
|
|
861
|
+
|
|
862
|
+
return output;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
810
866
|
|
|
811
867
|
export function fromSerializedError(error: SerializedHerbError): HerbError {
|
|
812
868
|
switch (error.type) {
|
|
@@ -821,6 +877,7 @@ export function fromSerializedError(error: SerializedHerbError): HerbError {
|
|
|
821
877
|
case "RUBY_PARSE_ERROR": return RubyParseError.from(error as SerializedRubyParseError);
|
|
822
878
|
case "ERB_CONTROL_FLOW_SCOPE_ERROR": return ERBControlFlowScopeError.from(error as SerializedERBControlFlowScopeError);
|
|
823
879
|
case "MISSINGERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
|
|
880
|
+
case "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR": return ERBMultipleBlocksInTagError.from(error as SerializedERBMultipleBlocksInTagError);
|
|
824
881
|
|
|
825
882
|
default:
|
|
826
883
|
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.6/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.6/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.6/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
Node,
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## 0.3.1 (2025-06-23)
|
|
2
|
-
|
|
3
|
-
This was a version bump only for @herb-tools/core to align it with other projects, there were no code changes.
|
|
4
|
-
|
|
5
|
-
## 0.3.0 (2025-06-21)
|
|
6
|
-
|
|
7
|
-
This was a version bump only for @herb-tools/core to align it with other projects, there were no code changes.
|
|
8
|
-
|
|
9
|
-
## 0.2.0 (2025-06-11)
|
|
10
|
-
|
|
11
|
-
This was a version bump only for @herb-tools/core to align it with other projects, there were no code changes.
|
|
12
|
-
|
|
13
|
-
## 0.1.1 (2025-04-20)
|
|
14
|
-
|
|
15
|
-
This was a version bump only for @herb-tools/core to align it with other projects, there were no code changes.
|
|
16
|
-
|
|
17
|
-
## 0.1.0 (2025-04-15)
|
|
18
|
-
|
|
19
|
-
This was a version bump only for @herb-tools/core to align it with other projects, there were no code changes.
|