@herb-tools/rewriter 0.10.0 → 0.10.2
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/index.cjs +53 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +53 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/loader.cjs +53 -5
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.esm.js +53 -5
- package/dist/loader.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -50,7 +50,7 @@ class ASTRewriter {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
53
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.
|
|
53
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.2/templates/javascript/packages/core/src/action-view-helpers.ts.erb
|
|
54
54
|
var HelperType;
|
|
55
55
|
(function (HelperType) {
|
|
56
56
|
HelperType["ActionCableMetaTag"] = "action_cable_meta_tag";
|
|
@@ -2574,7 +2574,7 @@ class Token {
|
|
|
2574
2574
|
}
|
|
2575
2575
|
|
|
2576
2576
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2577
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.
|
|
2577
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.2/templates/javascript/packages/core/src/errors.ts.erb
|
|
2578
2578
|
class HerbError {
|
|
2579
2579
|
type;
|
|
2580
2580
|
message;
|
|
@@ -4126,6 +4126,45 @@ class DotNotationCasingError extends HerbError {
|
|
|
4126
4126
|
return output;
|
|
4127
4127
|
}
|
|
4128
4128
|
}
|
|
4129
|
+
class TimeoutError extends HerbError {
|
|
4130
|
+
timeout_ms;
|
|
4131
|
+
static from(data) {
|
|
4132
|
+
return new TimeoutError({
|
|
4133
|
+
type: data.type,
|
|
4134
|
+
message: data.message,
|
|
4135
|
+
location: Location.from(data.location),
|
|
4136
|
+
timeout_ms: data.timeout_ms,
|
|
4137
|
+
});
|
|
4138
|
+
}
|
|
4139
|
+
constructor(props) {
|
|
4140
|
+
super(props.type, props.message, props.location);
|
|
4141
|
+
this.timeout_ms = props.timeout_ms;
|
|
4142
|
+
}
|
|
4143
|
+
toJSON() {
|
|
4144
|
+
return {
|
|
4145
|
+
...super.toJSON(),
|
|
4146
|
+
type: "TIMEOUT_ERROR",
|
|
4147
|
+
timeout_ms: this.timeout_ms,
|
|
4148
|
+
};
|
|
4149
|
+
}
|
|
4150
|
+
toMonacoDiagnostic() {
|
|
4151
|
+
return {
|
|
4152
|
+
line: this.location.start.line,
|
|
4153
|
+
column: this.location.start.column,
|
|
4154
|
+
endLine: this.location.end.line,
|
|
4155
|
+
endColumn: this.location.end.column,
|
|
4156
|
+
message: this.message,
|
|
4157
|
+
severity: 'error'
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
4160
|
+
treeInspect() {
|
|
4161
|
+
let output = "";
|
|
4162
|
+
output += `@ TimeoutError ${this.location.treeInspectWithLabel()}\n`;
|
|
4163
|
+
output += `├── message: "${this.message}"\n`;
|
|
4164
|
+
output += `└── timeout_ms: ${JSON.stringify(this.timeout_ms)}\n`;
|
|
4165
|
+
return output;
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4129
4168
|
function fromSerializedError(error) {
|
|
4130
4169
|
switch (error.type) {
|
|
4131
4170
|
case "UNEXPECTED_ERROR": return UnexpectedError.from(error);
|
|
@@ -4165,6 +4204,7 @@ function fromSerializedError(error) {
|
|
|
4165
4204
|
case "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR": return StrictLocalsDuplicateDeclarationError.from(error);
|
|
4166
4205
|
case "VOID_ELEMENT_CONTENT_ERROR": return VoidElementContentError.from(error);
|
|
4167
4206
|
case "DOT_NOTATION_CASING_ERROR": return DotNotationCasingError.from(error);
|
|
4207
|
+
case "TIMEOUT_ERROR": return TimeoutError.from(error);
|
|
4168
4208
|
default:
|
|
4169
4209
|
throw new Error(`Unknown node type: ${error.type}`);
|
|
4170
4210
|
}
|
|
@@ -4317,7 +4357,7 @@ function deserializePrismNode(bytes, source) {
|
|
|
4317
4357
|
}
|
|
4318
4358
|
|
|
4319
4359
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
4320
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.
|
|
4360
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.2/templates/javascript/packages/core/src/nodes.ts.erb
|
|
4321
4361
|
class Node {
|
|
4322
4362
|
type;
|
|
4323
4363
|
location;
|
|
@@ -7697,6 +7737,8 @@ const DEFAULT_PARSER_OPTIONS = {
|
|
|
7697
7737
|
prism_program: false,
|
|
7698
7738
|
dot_notation_tags: false,
|
|
7699
7739
|
html: true,
|
|
7740
|
+
timeout: 1000,
|
|
7741
|
+
max_errors: 25,
|
|
7700
7742
|
};
|
|
7701
7743
|
/**
|
|
7702
7744
|
* Represents the parser options used during parsing.
|
|
@@ -7726,6 +7768,10 @@ class ParserOptions {
|
|
|
7726
7768
|
dot_notation_tags;
|
|
7727
7769
|
/** Whether HTML tag parsing is enabled during parsing. When false, HTML-like content is treated as literal text. */
|
|
7728
7770
|
html;
|
|
7771
|
+
/** Parse timeout in milliseconds. 0 disables the timeout. */
|
|
7772
|
+
timeout;
|
|
7773
|
+
/** Maximum number of errors to report. null means unlimited. */
|
|
7774
|
+
max_errors;
|
|
7729
7775
|
static from(options) {
|
|
7730
7776
|
return new ParserOptions(options);
|
|
7731
7777
|
}
|
|
@@ -7742,6 +7788,8 @@ class ParserOptions {
|
|
|
7742
7788
|
this.prism_program = options.prism_program ?? DEFAULT_PARSER_OPTIONS.prism_program;
|
|
7743
7789
|
this.dot_notation_tags = options.dot_notation_tags ?? DEFAULT_PARSER_OPTIONS.dot_notation_tags;
|
|
7744
7790
|
this.html = options.html ?? DEFAULT_PARSER_OPTIONS.html;
|
|
7791
|
+
this.timeout = options.timeout ?? DEFAULT_PARSER_OPTIONS.timeout;
|
|
7792
|
+
this.max_errors = options.max_errors ?? DEFAULT_PARSER_OPTIONS.max_errors;
|
|
7745
7793
|
}
|
|
7746
7794
|
}
|
|
7747
7795
|
|
|
@@ -7818,7 +7866,7 @@ class ParseResult extends Result {
|
|
|
7818
7866
|
}
|
|
7819
7867
|
|
|
7820
7868
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
7821
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.
|
|
7869
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.2/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
7822
7870
|
/**
|
|
7823
7871
|
* Type guard functions for AST nodes.
|
|
7824
7872
|
* These functions provide type checking by combining both instanceof
|
|
@@ -8509,7 +8557,7 @@ function createERBOutputNode(expression, tagOpening = "<%=", tagClosing = "%>")
|
|
|
8509
8557
|
}
|
|
8510
8558
|
|
|
8511
8559
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
8512
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.
|
|
8560
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.10.2/templates/javascript/packages/core/src/visitor.ts.erb
|
|
8513
8561
|
class Visitor {
|
|
8514
8562
|
visit(node) {
|
|
8515
8563
|
if (!node)
|