@platformos/prettier-plugin-liquid 0.0.6 → 0.0.8
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/constants.evaluate.js +0 -3
- package/dist/plugin.js +0 -12
- package/dist/printer/embed.js +6 -12
- package/dist/printer/preprocess/augment-with-css-properties.js +6 -2
- package/dist/printer/preprocess/augment-with-siblings.d.ts +88 -146
- package/dist/printer/preprocess/index.d.ts +1 -1
- package/dist/printer/print/children.d.ts +1 -1
- package/dist/printer/print/liquid.d.ts +1 -1
- package/dist/printer/print/liquid.js +2 -11
- package/dist/printer/printer-liquid-html.js +50 -29
- package/dist/types.d.ts +0 -1
- package/package.json +6 -5
- package/standalone.js +1307 -1170
|
@@ -55,12 +55,9 @@ exports.CSS_DISPLAY_LIQUID_TAGS = {
|
|
|
55
55
|
form: 'block',
|
|
56
56
|
layout: 'none',
|
|
57
57
|
liquid: 'inline',
|
|
58
|
-
paginate: 'inline',
|
|
59
58
|
raw: 'inline',
|
|
60
59
|
render: 'inline',
|
|
61
60
|
include: 'inline',
|
|
62
|
-
section: 'block',
|
|
63
|
-
style: 'none',
|
|
64
61
|
// variable tags
|
|
65
62
|
assign: 'none',
|
|
66
63
|
capture: 'inline',
|
package/dist/plugin.js
CHANGED
|
@@ -28,42 +28,30 @@ const options = {
|
|
|
28
28
|
],
|
|
29
29
|
category: 'LIQUID',
|
|
30
30
|
default: 'strict',
|
|
31
|
-
since: '1.5.0',
|
|
32
31
|
},
|
|
33
32
|
liquidSingleQuote: {
|
|
34
33
|
type: 'boolean',
|
|
35
34
|
category: 'LIQUID',
|
|
36
35
|
default: true,
|
|
37
36
|
description: 'Use single quotes instead of double quotes in Liquid tags and objects.',
|
|
38
|
-
since: '0.2.0',
|
|
39
37
|
},
|
|
40
38
|
embeddedSingleQuote: {
|
|
41
39
|
type: 'boolean',
|
|
42
40
|
category: 'LIQUID',
|
|
43
41
|
default: true,
|
|
44
42
|
description: 'Use single quotes instead of double quotes in embedded languages (JavaScript, CSS, TypeScript inside <script>, <style> or Liquid equivalent).',
|
|
45
|
-
since: '0.4.0',
|
|
46
43
|
},
|
|
47
44
|
singleLineLinkTags: {
|
|
48
45
|
type: 'boolean',
|
|
49
46
|
category: 'HTML',
|
|
50
47
|
default: false,
|
|
51
48
|
description: 'Always print link tags on a single line to remove clutter',
|
|
52
|
-
since: '0.1.0',
|
|
53
|
-
},
|
|
54
|
-
indentSchema: {
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
category: 'LIQUID',
|
|
57
|
-
default: false,
|
|
58
|
-
description: 'Indent the contents of the {% schema %} tag',
|
|
59
|
-
since: '0.1.0',
|
|
60
49
|
},
|
|
61
50
|
liquidDocParamDash: {
|
|
62
51
|
type: 'boolean',
|
|
63
52
|
category: 'LIQUID',
|
|
64
53
|
default: true,
|
|
65
54
|
description: 'Append a dash (-) to separate descriptions in {% doc %} @param annotations',
|
|
66
|
-
since: '1.6.4',
|
|
67
55
|
},
|
|
68
56
|
};
|
|
69
57
|
const defaultOptions = {
|
package/dist/printer/embed.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.ParserMap = {
|
|
|
17
17
|
// Prettier 2 and 3 have a slightly different API for embed.
|
|
18
18
|
//
|
|
19
19
|
// https://github.com/prettier/prettier/wiki/How-to-migrate-my-plugin-to-support-Prettier-v3%3F
|
|
20
|
-
|
|
20
|
+
exports.embed2 = ((path, _print, textToDoc, options) => {
|
|
21
21
|
const node = path.getValue();
|
|
22
22
|
switch (node.type) {
|
|
23
23
|
case liquid_html_parser_1.NodeTypes.RawMarkup: {
|
|
@@ -29,7 +29,7 @@ const embed2 = (path, _print, textToDoc, options) => {
|
|
|
29
29
|
parser,
|
|
30
30
|
__embeddedInHtml: true,
|
|
31
31
|
}));
|
|
32
|
-
if (shouldIndentBody(node
|
|
32
|
+
if (shouldIndentBody(node)) {
|
|
33
33
|
return [indent([hardline, body]), hardline];
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
@@ -40,8 +40,7 @@ const embed2 = (path, _print, textToDoc, options) => {
|
|
|
40
40
|
default:
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
-
};
|
|
44
|
-
exports.embed2 = embed2;
|
|
43
|
+
});
|
|
45
44
|
const embed3 = (path, options) => {
|
|
46
45
|
return (textToDoc) => {
|
|
47
46
|
const node = path.node;
|
|
@@ -56,7 +55,7 @@ const embed3 = (path, options) => {
|
|
|
56
55
|
__embeddedInHtml: true,
|
|
57
56
|
}).then((document) => {
|
|
58
57
|
const body = prettier_1.doc.utils.stripTrailingHardline(document);
|
|
59
|
-
if (shouldIndentBody(node
|
|
58
|
+
if (shouldIndentBody(node)) {
|
|
60
59
|
return [indent([hardline, body]), hardline];
|
|
61
60
|
}
|
|
62
61
|
else {
|
|
@@ -71,12 +70,7 @@ const embed3 = (path, options) => {
|
|
|
71
70
|
};
|
|
72
71
|
};
|
|
73
72
|
exports.embed3 = embed3;
|
|
74
|
-
function shouldIndentBody(node
|
|
75
|
-
|
|
76
|
-
const shouldNotIndentBody = parentNode &&
|
|
77
|
-
parentNode.type === liquid_html_parser_1.NodeTypes.LiquidRawTag &&
|
|
78
|
-
parentNode.name === 'schema' &&
|
|
79
|
-
!options.indentSchema;
|
|
80
|
-
return node.kind !== liquid_html_parser_1.RawMarkupKinds.markdown && !shouldNotIndentBody;
|
|
73
|
+
function shouldIndentBody(node) {
|
|
74
|
+
return node.kind !== liquid_html_parser_1.RawMarkupKinds.markdown;
|
|
81
75
|
}
|
|
82
76
|
//# sourceMappingURL=embed.js.map
|
|
@@ -97,11 +97,13 @@ function getCssDisplay(node, options) {
|
|
|
97
97
|
case liquid_html_parser_1.NodeTypes.CycleMarkup:
|
|
98
98
|
case liquid_html_parser_1.NodeTypes.ContentForMarkup:
|
|
99
99
|
case liquid_html_parser_1.NodeTypes.ForMarkup:
|
|
100
|
-
case liquid_html_parser_1.NodeTypes.PaginateMarkup:
|
|
101
100
|
case liquid_html_parser_1.NodeTypes.RenderMarkup:
|
|
102
101
|
case liquid_html_parser_1.NodeTypes.FunctionMarkup:
|
|
103
102
|
case liquid_html_parser_1.NodeTypes.GraphQLMarkup:
|
|
104
103
|
case liquid_html_parser_1.NodeTypes.GraphQLInlineMarkup:
|
|
104
|
+
case liquid_html_parser_1.NodeTypes.JsonHashLiteral:
|
|
105
|
+
case liquid_html_parser_1.NodeTypes.JsonArrayLiteral:
|
|
106
|
+
case liquid_html_parser_1.NodeTypes.JsonKeyValuePair:
|
|
105
107
|
case liquid_html_parser_1.NodeTypes.BackgroundMarkup:
|
|
106
108
|
case liquid_html_parser_1.NodeTypes.BackgroundInlineMarkup:
|
|
107
109
|
case liquid_html_parser_1.NodeTypes.CacheMarkup:
|
|
@@ -202,11 +204,13 @@ function getNodeCssStyleWhiteSpace(node, options) {
|
|
|
202
204
|
case liquid_html_parser_1.NodeTypes.CycleMarkup:
|
|
203
205
|
case liquid_html_parser_1.NodeTypes.ContentForMarkup:
|
|
204
206
|
case liquid_html_parser_1.NodeTypes.ForMarkup:
|
|
205
|
-
case liquid_html_parser_1.NodeTypes.PaginateMarkup:
|
|
206
207
|
case liquid_html_parser_1.NodeTypes.RenderMarkup:
|
|
207
208
|
case liquid_html_parser_1.NodeTypes.FunctionMarkup:
|
|
208
209
|
case liquid_html_parser_1.NodeTypes.GraphQLMarkup:
|
|
209
210
|
case liquid_html_parser_1.NodeTypes.GraphQLInlineMarkup:
|
|
211
|
+
case liquid_html_parser_1.NodeTypes.JsonHashLiteral:
|
|
212
|
+
case liquid_html_parser_1.NodeTypes.JsonArrayLiteral:
|
|
213
|
+
case liquid_html_parser_1.NodeTypes.JsonKeyValuePair:
|
|
210
214
|
case liquid_html_parser_1.NodeTypes.BackgroundMarkup:
|
|
211
215
|
case liquid_html_parser_1.NodeTypes.BackgroundInlineMarkup:
|
|
212
216
|
case liquid_html_parser_1.NodeTypes.CacheMarkup:
|