@platformos/prettier-plugin-liquid 0.0.3 → 0.0.5
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/README.md +0 -4
- package/dist/printer/preprocess/augment-with-css-properties.js +6 -0
- package/dist/printer/preprocess/augment-with-siblings.d.ts +92 -56
- package/dist/printer/preprocess/index.d.ts +1 -1
- package/dist/printer/printer-liquid-html.js +48 -1
- package/package.json +3 -3
- package/standalone.js +169 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AUGMENTATION_PIPELINE: import("../../types").Augment<import("../../types").
|
|
1
|
+
export declare const AUGMENTATION_PIPELINE: import("../../types").Augment<import("../../types").WithSiblings>[];
|
|
@@ -220,7 +220,21 @@ function printNode(path, options, print, args = {}) {
|
|
|
220
220
|
];
|
|
221
221
|
}
|
|
222
222
|
case liquid_html_parser_1.NodeTypes.AssignMarkup: {
|
|
223
|
-
|
|
223
|
+
const doc = [node.name];
|
|
224
|
+
if (node.lookups.length > 0) {
|
|
225
|
+
const lookups = path.map((lookupPath) => {
|
|
226
|
+
const lookup = lookupPath.getValue();
|
|
227
|
+
if (lookup.type === liquid_html_parser_1.NodeTypes.String &&
|
|
228
|
+
/^\D/.test(lookup.value) &&
|
|
229
|
+
/^[a-z0-9_]+\??$/i.test(lookup.value)) {
|
|
230
|
+
return ['.', print(lookupPath)];
|
|
231
|
+
}
|
|
232
|
+
return ['[', print(lookupPath), ']'];
|
|
233
|
+
}, 'lookups');
|
|
234
|
+
doc.push(...lookups);
|
|
235
|
+
}
|
|
236
|
+
doc.push(` ${node.operator} `, path.call((p) => print(p), 'value'));
|
|
237
|
+
return doc;
|
|
224
238
|
}
|
|
225
239
|
case liquid_html_parser_1.NodeTypes.HashAssignMarkup: {
|
|
226
240
|
return [
|
|
@@ -508,6 +522,39 @@ function printNode(path, options, print, args = {}) {
|
|
|
508
522
|
case liquid_html_parser_1.NodeTypes.LiquidDocPromptNode: {
|
|
509
523
|
return (0, liquid_1.printLiquidDocPrompt)(path, options, print, args);
|
|
510
524
|
}
|
|
525
|
+
case liquid_html_parser_1.NodeTypes.JsonHashLiteral: {
|
|
526
|
+
if (node.entries.length === 0)
|
|
527
|
+
return '{}';
|
|
528
|
+
return group([
|
|
529
|
+
'{',
|
|
530
|
+
indent([
|
|
531
|
+
line,
|
|
532
|
+
join([',', line], path.map((p) => print(p), 'entries')),
|
|
533
|
+
]),
|
|
534
|
+
line,
|
|
535
|
+
'}',
|
|
536
|
+
]);
|
|
537
|
+
}
|
|
538
|
+
case liquid_html_parser_1.NodeTypes.JsonKeyValuePair: {
|
|
539
|
+
return [
|
|
540
|
+
path.call((p) => print(p), 'key'),
|
|
541
|
+
': ',
|
|
542
|
+
path.call((p) => print(p), 'value'),
|
|
543
|
+
];
|
|
544
|
+
}
|
|
545
|
+
case liquid_html_parser_1.NodeTypes.JsonArrayLiteral: {
|
|
546
|
+
if (node.elements.length === 0)
|
|
547
|
+
return '[]';
|
|
548
|
+
return group([
|
|
549
|
+
'[',
|
|
550
|
+
indent([
|
|
551
|
+
line,
|
|
552
|
+
join([',', line], path.map((p) => print(p), 'elements')),
|
|
553
|
+
]),
|
|
554
|
+
line,
|
|
555
|
+
']',
|
|
556
|
+
]);
|
|
557
|
+
}
|
|
511
558
|
default: {
|
|
512
559
|
return (0, utils_1.assertNever)(node);
|
|
513
560
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformos/prettier-plugin-liquid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Prettier Liquid/HTML plugin for platformOS",
|
|
5
5
|
"author": "platformOS",
|
|
6
|
-
"homepage": "https://github.com/Platform-OS/platformos-tools/tree/
|
|
6
|
+
"homepage": "https://github.com/Platform-OS/platformos-tools/tree/master/packages/prettier-plugin-liquid#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/Platform-OS/platformos-tools.git",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"tsconfig-paths": "^3.14.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@platformos/liquid-html-parser": "^0.0.
|
|
62
|
+
"@platformos/liquid-html-parser": "^0.0.5",
|
|
63
63
|
"html-styles": "^1.0.0"
|
|
64
64
|
}
|
|
65
65
|
}
|