@herb-tools/formatter 0.7.1 → 0.7.3
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-format.js +81 -24
- package/dist/herb-format.js.map +1 -1
- package/dist/index.cjs +17 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +17 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/types/cli.d.ts +1 -0
- package/package.json +3 -3
- package/src/cli.ts +69 -12
- package/src/format-printer.ts +14 -2
package/dist/index.cjs
CHANGED
|
@@ -198,7 +198,7 @@ class Token {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
201
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.
|
|
201
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/errors.ts.erb
|
|
202
202
|
class HerbError {
|
|
203
203
|
type;
|
|
204
204
|
message;
|
|
@@ -648,7 +648,7 @@ function convertToUTF8(string) {
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
651
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.
|
|
651
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/nodes.ts.erb
|
|
652
652
|
class Node {
|
|
653
653
|
type;
|
|
654
654
|
location;
|
|
@@ -2882,7 +2882,7 @@ class ParseResult extends Result {
|
|
|
2882
2882
|
}
|
|
2883
2883
|
|
|
2884
2884
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2885
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.
|
|
2885
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2886
2886
|
/**
|
|
2887
2887
|
* Type guard functions for AST nodes.
|
|
2888
2888
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3369,7 +3369,7 @@ function getNodesAfterPosition(nodes, position, inclusive = true) {
|
|
|
3369
3369
|
}
|
|
3370
3370
|
|
|
3371
3371
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3372
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.
|
|
3372
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.3/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3373
3373
|
class Visitor {
|
|
3374
3374
|
visit(node) {
|
|
3375
3375
|
if (!node)
|
|
@@ -4442,7 +4442,18 @@ class FormatPrinter extends Printer {
|
|
|
4442
4442
|
}
|
|
4443
4443
|
visitHTMLElementBody(body, element) {
|
|
4444
4444
|
if (this.isContentPreserving(element)) {
|
|
4445
|
-
element.body.map(child =>
|
|
4445
|
+
element.body.map(child => {
|
|
4446
|
+
if (isNode(child, HTMLElementNode)) {
|
|
4447
|
+
const wasInlineMode = this.inlineMode;
|
|
4448
|
+
this.inlineMode = true;
|
|
4449
|
+
const formattedElement = this.capture(() => this.visit(child)).join("");
|
|
4450
|
+
this.pushToLastLine(formattedElement);
|
|
4451
|
+
this.inlineMode = wasInlineMode;
|
|
4452
|
+
}
|
|
4453
|
+
else {
|
|
4454
|
+
this.pushToLastLine(IdentityPrinter.print(child));
|
|
4455
|
+
}
|
|
4456
|
+
});
|
|
4446
4457
|
return;
|
|
4447
4458
|
}
|
|
4448
4459
|
const analysis = this.elementFormattingAnalysis.get(element);
|
|
@@ -5105,7 +5116,7 @@ class FormatPrinter extends Printer {
|
|
|
5105
5116
|
return child.content;
|
|
5106
5117
|
}
|
|
5107
5118
|
else if (isNode(child, ERBContentNode)) {
|
|
5108
|
-
return
|
|
5119
|
+
return this.reconstructERBNode(child, true);
|
|
5109
5120
|
}
|
|
5110
5121
|
else {
|
|
5111
5122
|
const printed = IdentityPrinter.print(child);
|