@torpor/prettier 1.0.1 → 1.0.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/index.mjs CHANGED
@@ -84,19 +84,18 @@ async function print(path, options, _print) {
84
84
  case "render":
85
85
  chunk.formatted = formatRenderChunk(chunk.type, chunk.content, options);
86
86
  break;
87
- case "style":
88
- chunk.formatted = formatStyleChunk(chunk.content, options);
89
- break;
87
+ case "style": chunk.formatted = formatStyleChunk(chunk.content, options);
90
88
  }
91
89
  const shell = node.chunks[0];
92
90
  for (let i = 1; i < node.chunks.length; i++) shell.formatted = shell.formatted.replace(`/* ${node.chunks[i].id} */ 1;`, node.chunks[i].formatted.trimStart());
93
91
  return shell.formatted;
94
92
  }
95
93
  function formatRenderChunk(type, content, options) {
96
- const parsed = parse(`
94
+ const source = `
97
95
  export default function C() {
98
96
  ${content}
99
- }`);
97
+ }`;
98
+ const parsed = parse(source);
100
99
  if (!parsed.ok || !parsed.template) {
101
100
  console.log(`Failed to parse render section: ${parsed.errors.map((e) => e.message).join(", ")}`);
102
101
  return content;
@@ -253,16 +252,15 @@ function formatCommentNode(node, state, _options) {
253
252
  case "line":
254
253
  state.output += `${indent}@//${node.content}\n`;
255
254
  break;
256
- case "block":
257
- state.output += `${indent}@/*${node.content}*/`;
258
- break;
255
+ case "block": state.output += `${indent}@/*${node.content}*/`;
259
256
  }
260
257
  }
261
258
  function formatStyleChunk(content, _options) {
262
- const parsed = parse(`
259
+ const source = `
263
260
  export default function C() {
264
261
  ${content}
265
- }`);
262
+ }`;
263
+ const parsed = parse(source);
266
264
  if (!parsed.ok || !parsed.template) {
267
265
  console.log(`Failed to parse style section: ${parsed.errors.map((e) => e.message).join(", ")}`);
268
266
  return content;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["parse","parseTorp"],"sources":["../src/index.ts"],"sourcesContent":["import { parse as parseTorp } from \"@torpor/view/compile\";\n// Import from the specific module path to avoid the \"browser\" export condition\n// resolving to the standalone build (which lacks parser plugins)\n//import * as prettier from \"prettier/index.mjs\";\nimport prettier from \"prettier\";\n\nexport const languages: prettier.SupportLanguage[] = [\n\t{\n\t\tname: \"torpor\",\n\t\tparsers: [\"torpor-parser\"],\n\t\textensions: [\".torp\"],\n\t},\n];\n\nexport const parsers: Record<string, prettier.Parser> = {\n\t\"torpor-parser\": {\n\t\tparse,\n\t\tastFormat: \"torpor-ast\",\n\t\tlocStart,\n\t\tlocEnd,\n\t},\n};\n\nexport const printers: Record<string, prettier.Printer> = {\n\t\"torpor-ast\": {\n\t\t// @ts-ignore\n\t\tprint,\n\t},\n};\n\ninterface Chunk {\n\ttype: \"shell\" | \"head\" | \"render\" | \"style\";\n\tid: string;\n\tcontent: string;\n\tstart: number;\n\tend: number;\n\tshellStart: number;\n\tformatted: string;\n}\n\ninterface TorporNode extends prettier.AST {\n\tchunks: Chunk[];\n}\n\nfunction parse(text: string, _options: object): TorporNode {\n\tlet chunks: Chunk[] = [];\n\tfor (let i = 0; i < text.length; i++) {\n\t\tif (text[i] === \"@\") {\n\t\t\tif (text.slice(i + 1).startsWith(\"render\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"render\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t} else if (text.slice(i + 1).startsWith(\"head\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"head\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t} else if (text.slice(i + 1).startsWith(\"style\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"style\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t}\n\t\t}\n\t}\n\tlet shell = \"\";\n\tfor (let i = 0; i < chunks.length; i++) {\n\t\tlet start = i > 0 ? chunks[i - 1].end : 0;\n\t\tchunks[i].shellStart = shell.length;\n\t\tshell += text.substring(start, chunks[i].start) + `/* ${chunks[i].id} */ 1;`;\n\t}\n\tshell += text.substring(chunks[chunks.length - 1].end);\n\n\treturn {\n\t\tchunks: [\n\t\t\t{\n\t\t\t\ttype: \"shell\",\n\t\t\t\tid: \"\",\n\t\t\t\tcontent: shell,\n\t\t\t\tstart: 0,\n\t\t\t\tend: text.length,\n\t\t\t\tshellStart: 0,\n\t\t\t\tformatted: \"\",\n\t\t\t},\n\t\t\t...chunks,\n\t\t],\n\t};\n}\n\nfunction consumeChunk(text: string, i: number, type: \"head\" | \"render\" | \"style\"): Chunk {\n\tlet level = 0;\n\tlet j;\n\tfor (j = i; j < text.length; j++) {\n\t\tif (text[j] === \"{\") {\n\t\t\tlevel++;\n\t\t} else if (text[j] === \"}\") {\n\t\t\tlevel--;\n\t\t\tif (level === 0) break;\n\t\t}\n\t}\n\treturn {\n\t\ttype,\n\t\tid: crypto.randomUUID(),\n\t\tcontent: text.substring(i, j + 1),\n\t\tstart: i,\n\t\tend: j + 1,\n\t\tshellStart: 0,\n\t\tformatted: \"\",\n\t};\n}\n\nfunction locStart(): number {\n\treturn 0;\n}\n\nfunction locEnd(): number {\n\treturn 0;\n}\n\nasync function print(\n\tpath: prettier.AstPath,\n\toptions: object,\n\t_print: (path: prettier.AstPath) => prettier.Doc,\n): Promise<prettier.Doc> {\n\tconst node = path.node as TorporNode;\n\n\tfor (let chunk of node.chunks) {\n\t\tswitch (chunk.type) {\n\t\t\tcase \"shell\": {\n\t\t\t\tchunk.formatted = await prettier.format(chunk.content, {\n\t\t\t\t\t...options,\n\t\t\t\t\tparser: \"typescript\",\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"head\":\n\t\t\tcase \"render\": {\n\t\t\t\tchunk.formatted = formatRenderChunk(chunk.type, chunk.content, options);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"style\": {\n\t\t\t\tchunk.formatted = formatStyleChunk(chunk.content, options);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst shell = node.chunks[0];\n\n\tfor (let i = 1; i < node.chunks.length; i++) {\n\t\tshell.formatted = shell.formatted.replace(\n\t\t\t// TODO: What if prettier strips semicolons??\n\t\t\t`/* ${node.chunks[i].id} */ 1;`,\n\t\t\tnode.chunks[i].formatted.trimStart(),\n\t\t);\n\t}\n\n\treturn shell.formatted;\n}\n\ninterface FormatState {\n\tindent: number;\n\toutput: string;\n\tpreserveWhitespace: any;\n}\n\nfunction formatRenderChunk(type: \"head\" | \"render\", content: string, options: object) {\n\t// HACK: should do this when parsing and convert it into a better AST\n\tconst source = `\nexport default function C() {\n${content}\n}`;\n\tconst parsed = parseTorp(source);\n\tif (!parsed.ok || !parsed.template) {\n\t\tconsole.log(\n\t\t\t`Failed to parse render section: ${parsed.errors.map((e) => e.message).join(\", \")}`,\n\t\t);\n\t\treturn content;\n\t}\n\n\tlet node =\n\t\ttype === \"head\" ? parsed.template.components[0].head : parsed.template.components[0].markup;\n\tlet state: FormatState = {\n\t\t// HACK: this should come from the indentation of the @render\n\t\tindent: 1,\n\t\toutput: \"\",\n\t\tpreserveWhitespace: false,\n\t};\n\tformatRenderNode(node, state, options, type);\n\treturn state.output;\n}\n\n// HACK: no types on internal types\nfunction formatRenderNode(\n\tnode: any,\n\tstate: FormatState,\n\toptions: Record<PropertyKey, any>,\n\ttype = \"\",\n) {\n\tswitch (node.type) {\n\t\tcase \"root\": {\n\t\t\tformatRootNode(node, state, options, type);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"control\": {\n\t\t\tformatControlNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"element\":\n\t\tcase \"component\":\n\t\tcase \"special\": {\n\t\t\tformatElementNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"text\": {\n\t\t\tformatTextNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"comment\": {\n\t\t\tformatCommentNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"Unknown node type: \" + node.type);\n\t\t}\n\t}\n}\n\nfunction formatRootNode(\n\tnode: any,\n\tstate: FormatState,\n\toptions: Record<PropertyKey, any>,\n\ttype: string,\n) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `${indent}@${type} {`;\n\tstate.indent++;\n\tfor (let c of node.children) {\n\t\tformatRenderNode(c, state, options);\n\t}\n\tstate.indent--;\n\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\tstate.output += `${indent}}`;\n}\n\nfunction formatControlNode(node: any, state: FormatState, options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\t// HACK: might be better to change the way these are parsed out...\n\tswitch (node.operation) {\n\t\tcase \"@if group\":\n\t\tcase \"@for group\": {\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@if\":\n\t\tcase \"@for\": {\n\t\t\tstate.output += `${indent}@${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@else if\":\n\t\tcase \"@else\": {\n\t\t\tstate.output += `${indent}} ${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@switch group\": {\n\t\t\tstate.output += `${indent}@${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@case\":\n\t\tcase \"@default\": {\n\t\t\t// HACK: need to fix parsing\n\t\t\tif (node.operation === \"@default\") state.output += \"\\n\";\n\t\t\tstate.output += `${indent}${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@key\": {\n\t\t\tstate.output += `${indent}@${node.statement}\\n`;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"Unknown control operation: \" + node.operation);\n\t\t}\n\t}\n}\n\nfunction formatElementNode(node: any, state: FormatState, options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\n\t// HACK: Empty <fill> nodes get inserted behind the scenes and shouldn't be output\n\tif (node.tagName === \"filldef\") {\n\t\tfor (let c of node.children) {\n\t\t\tformatRenderNode(c, state, options);\n\t\t}\n\t\treturn;\n\t}\n\n\t// Build the list of attributes\n\tlet attrs = node.attributes.map((a: any) => {\n\t\tif (a.value === undefined) {\n\t\t\treturn a.name;\n\t\t} else if (a.value === a.name || a.value.endsWith(`.${a.name}`)) {\n\t\t\treturn `{${a.value}}`;\n\t\t} else {\n\t\t\tlet value = a.fullyReactive ? `{${a.value}}` : a.value;\n\t\t\treturn `${a.name}=${value}`;\n\t\t}\n\t});\n\n\t// TODO: Do we need to translate tabs to spaces for print width??\n\t// Let's see if they work on one line\n\tlet attributes = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n\tlet element = `${indent}<${node.tagName}${attributes}${node.selfClosed ? \" /\" : \"\"}>`;\n\tif (node.attributes.length && element.length > options.printWidth) {\n\t\t// They're too long, so let's try that again\n\t\tlet attrIndent = `\\n${indent}\\t`;\n\t\tattributes = attrs.join(attrIndent);\n\t\telement = `${indent}<${node.tagName}${attrIndent}${attributes}\\n${indent}${node.selfClosed ? \"/\" : \"\"}>`;\n\t}\n\n\t// If at a newline, add the indent\n\t// If after an element/brace, add a space\n\tif (state.output.endsWith(\"\\n\")) {\n\t\tstate.output += indent;\n\t} else if (\n\t\t!state.output.endsWith(\">\") &&\n\t\t!state.output.endsWith(\"{\") &&\n\t\t!state.output.endsWith(\"}\")\n\t) {\n\t\tstate.output += \" \";\n\t}\n\n\tstate.output += element.trimStart();\n\n\t// If self-closed, we don't need to add anything else\n\tif (node.selfClosed) {\n\t\treturn;\n\t}\n\n\t// Add the children\n\tconst oldPreserveWhitespace = state.preserveWhitespace;\n\tstate.preserveWhitespace = node.tagName === \"code\" || node.tagName === \"pre\";\n\tstate.indent++;\n\tfor (let c of node.children) {\n\t\tformatRenderNode(c, state, options);\n\t}\n\tstate.indent--;\n\tstate.preserveWhitespace = oldPreserveWhitespace;\n\n\t// Add the closing tag\n\tif (state.output.endsWith(\"\\n\")) {\n\t\tstate.output += indent;\n\t}\n\tstate.output += `</${node.tagName}>`;\n}\n\nfunction formatTextNode(node: any, state: FormatState, _options: Record<PropertyKey, any>) {\n\tif (state.preserveWhitespace) {\n\t\tstate.output += node.content;\n\t\treturn;\n\t}\n\n\tconst indent = \"\\t\".repeat(state.indent);\n\tlet text = node.content.trim();\n\n\t// Check if it's just some newlines and, if so, add them\n\tif (!text) {\n\t\tlet newLineCount = 0;\n\t\tfor (let i = 0; i < node.content.length; i++) {\n\t\t\tif (node.content[i] === \"\\n\") newLineCount++;\n\t\t}\n\t\tif (newLineCount > 0) {\n\t\t\tif (newLineCount > 1 && !state.output.endsWith(\"{\")) {\n\t\t\t\tstate.output += \"\\n\";\n\t\t\t}\n\t\t\tstate.output += \"\\n\";\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Replace indents + newlines with the correct spacing (e.g. if a block of\n\t// text has been moved)\n\ttext = text.replaceAll(/\\s*\\n\\s*/g, `\\n${indent}`);\n\n\t// Add a newline if the text had one at the start\n\t// Add a space if the text is after a closing tag and had any spaces at the start\n\tlet newLineBefore = /^\\s*\\n/.test(node.content);\n\tif (newLineBefore) {\n\t\ttext = \"\\n\" + indent + text;\n\t} else if (/(<\\/[^<]+>|\\/>)$/i.test(state.output) && /^\\s+/.test(node.content)) {\n\t\ttext = \" \" + text;\n\t}\n\n\t// Add a newline if the text had one at the end\n\tlet newLineAfter = /\\n\\s*$/.test(node.content);\n\tif (newLineAfter) {\n\t\ttext += \"\\n\";\n\t}\n\n\tstate.output += text;\n}\n\nfunction formatCommentNode(node: any, state: FormatState, _options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tswitch (node.commentType) {\n\t\tcase \"html\":\n\t\t\tstate.output += `${indent}<!--${node.content}-->`;\n\t\t\tbreak;\n\t\tcase \"line\":\n\t\t\tstate.output += `${indent}@//${node.content}\\n`;\n\t\t\tbreak;\n\t\tcase \"block\":\n\t\t\tstate.output += `${indent}@/*${node.content}*/`;\n\t\t\tbreak;\n\t}\n}\n\nfunction formatStyleChunk(content: string, _options: object) {\n\t// HACK: should do this when parsing and convert it into a better AST\n\tconst source = `\nexport default function C() {\n${content}\n}`;\n\tconst parsed = parseTorp(source);\n\tif (!parsed.ok || !parsed.template) {\n\t\tconsole.log(`Failed to parse style section: ${parsed.errors.map((e) => e.message).join(\", \")}`);\n\t\treturn content;\n\t}\n\n\tlet state: FormatState = {\n\t\t// HACK: this should come from the indentation of the @render\n\t\tindent: 1,\n\t\toutput: \"\",\n\t\tpreserveWhitespace: false,\n\t};\n\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `${indent}@style {`;\n\tstate.indent++;\n\tfor (let c of parsed.template.components[0].style!.children) {\n\t\tformatStyleNode(c, state);\n\t}\n\tstate.indent--;\n\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\tstate.output += `\\n${indent}}`;\n\n\treturn state.output;\n}\n\n// HACK: no types on internal types\nfunction formatStyleNode(node: any, state: FormatState) {\n\tif (node.gapBefore && !state.output.endsWith(\"{\")) {\n\t\tstate.output += \"\\n\";\n\t}\n\tswitch (node.type) {\n\t\tcase \"block\": {\n\t\t\tformatStyleBlockNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"attribute\": {\n\t\t\tformatStyleAttributeNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"comment\": {\n\t\t\tformatStyleCommentNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.log(\"Unknown style node type: \" + node.type);\n\t\t}\n\t}\n}\n\nfunction formatStyleBlockNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\n\tstate.output += `\\n${indent}${node.selector} {`;\n\tfor (let c of node.children) {\n\t\tstate.indent++;\n\t\tformatStyleNode(c, state);\n\t\tstate.indent--;\n\t}\n\n\tstate.output += `\\n${indent}}`;\n}\n\nfunction formatStyleAttributeNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `\\n${indent}${node.name}: ${node.value};`;\n}\n\nfunction formatStyleCommentNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `\\n${indent}${node.content}`;\n}\n"],"mappings":";;;AAMA,MAAa,YAAwC,CACpD;CACC,MAAM;CACN,SAAS,CAAC,eAAe;CACzB,YAAY,CAAC,OAAO;AACrB,CACD;AAEA,MAAa,UAA2C,EACvD,iBAAiB;CAChB,OAAA;CACA,WAAW;CACX;CACA;AACD,EACD;AAEA,MAAa,WAA6C,EACzD,cAAc,EAEb,MACD,EACD;AAgBA,SAASA,QAAM,MAAc,UAA8B;CAC1D,IAAI,SAAkB,CAAC;CACvB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAChC,IAAI,KAAK,OAAO,KACX;MAAA,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,WAAW,QAAQ,GAAG;GAC3C,MAAM,QAAQ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,OAAO,SAAS,GAAG,GAC/C,MAAM,UAAU;CAEjB,QAAQ,KAAK,MAAb;EACC,KAAK;GACJ,qBAAqB,MAAM,KAAK;GAChC;EAED,KAAK;GACJ,yBAAyB,MAAM,KAAK;GACpC;EAED,KAAK;GACJ,uBAAuB,MAAM,KAAK;GAClC;EAED,SACC,QAAQ,IAAI,8BAA8B,KAAK,IAAI;CAErD;AACD;AAEA,SAAS,qBAAqB,MAAW,OAAoB;CAC5D,MAAM,SAAS,IAAK,OAAO,MAAM,MAAM;CAEvC,MAAM,UAAU,KAAK,SAAS,KAAK,SAAS;CAC5C,KAAK,IAAI,KAAK,KAAK,UAAU;EAC5B,MAAM;EACN,gBAAgB,GAAG,KAAK;EACxB,MAAM;CACP;CAEA,MAAM,UAAU,KAAK,OAAO;AAC7B;AAEA,SAAS,yBAAyB,MAAW,OAAoB;CAChE,MAAM,SAAS,IAAK,OAAO,MAAM,MAAM;CACvC,MAAM,UAAU,KAAK,SAAS,KAAK,KAAK,IAAI,KAAK,MAAM;AACxD;AAEA,SAAS,uBAAuB,MAAW,OAAoB;CAC9D,MAAM,SAAS,IAAK,OAAO,MAAM,MAAM;CACvC,MAAM,UAAU,KAAK,SAAS,KAAK;AACpC"}
1
+ {"version":3,"file":"index.mjs","names":["parse","parseTorp"],"sources":["../src/index.ts"],"sourcesContent":["import { parse as parseTorp } from \"@torpor/view/compile\";\n// Import from the specific module path to avoid the \"browser\" export condition\n// resolving to the standalone build (which lacks parser plugins)\n//import * as prettier from \"prettier/index.mjs\";\nimport prettier from \"prettier\";\n\nexport const languages: prettier.SupportLanguage[] = [\n\t{\n\t\tname: \"torpor\",\n\t\tparsers: [\"torpor-parser\"],\n\t\textensions: [\".torp\"],\n\t},\n];\n\nexport const parsers: Record<string, prettier.Parser> = {\n\t\"torpor-parser\": {\n\t\tparse,\n\t\tastFormat: \"torpor-ast\",\n\t\tlocStart,\n\t\tlocEnd,\n\t},\n};\n\nexport const printers: Record<string, prettier.Printer> = {\n\t\"torpor-ast\": {\n\t\t// @ts-ignore\n\t\tprint,\n\t},\n};\n\ninterface Chunk {\n\ttype: \"shell\" | \"head\" | \"render\" | \"style\";\n\tid: string;\n\tcontent: string;\n\tstart: number;\n\tend: number;\n\tshellStart: number;\n\tformatted: string;\n}\n\ninterface TorporNode extends prettier.AST {\n\tchunks: Chunk[];\n}\n\nfunction parse(text: string, _options: object): TorporNode {\n\tlet chunks: Chunk[] = [];\n\tfor (let i = 0; i < text.length; i++) {\n\t\tif (text[i] === \"@\") {\n\t\t\tif (text.slice(i + 1).startsWith(\"render\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"render\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t} else if (text.slice(i + 1).startsWith(\"head\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"head\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t} else if (text.slice(i + 1).startsWith(\"style\")) {\n\t\t\t\tconst chunk = consumeChunk(text, i, \"style\");\n\t\t\t\tchunks.push(chunk);\n\t\t\t\ti = chunk.end - 1;\n\t\t\t}\n\t\t}\n\t}\n\tlet shell = \"\";\n\tfor (let i = 0; i < chunks.length; i++) {\n\t\tlet start = i > 0 ? chunks[i - 1].end : 0;\n\t\tchunks[i].shellStart = shell.length;\n\t\tshell += text.substring(start, chunks[i].start) + `/* ${chunks[i].id} */ 1;`;\n\t}\n\tshell += text.substring(chunks[chunks.length - 1].end);\n\n\treturn {\n\t\tchunks: [\n\t\t\t{\n\t\t\t\ttype: \"shell\",\n\t\t\t\tid: \"\",\n\t\t\t\tcontent: shell,\n\t\t\t\tstart: 0,\n\t\t\t\tend: text.length,\n\t\t\t\tshellStart: 0,\n\t\t\t\tformatted: \"\",\n\t\t\t},\n\t\t\t...chunks,\n\t\t],\n\t};\n}\n\nfunction consumeChunk(text: string, i: number, type: \"head\" | \"render\" | \"style\"): Chunk {\n\tlet level = 0;\n\tlet j;\n\tfor (j = i; j < text.length; j++) {\n\t\tif (text[j] === \"{\") {\n\t\t\tlevel++;\n\t\t} else if (text[j] === \"}\") {\n\t\t\tlevel--;\n\t\t\tif (level === 0) break;\n\t\t}\n\t}\n\treturn {\n\t\ttype,\n\t\tid: crypto.randomUUID(),\n\t\tcontent: text.substring(i, j + 1),\n\t\tstart: i,\n\t\tend: j + 1,\n\t\tshellStart: 0,\n\t\tformatted: \"\",\n\t};\n}\n\nfunction locStart(): number {\n\treturn 0;\n}\n\nfunction locEnd(): number {\n\treturn 0;\n}\n\nasync function print(\n\tpath: prettier.AstPath,\n\toptions: object,\n\t_print: (path: prettier.AstPath) => prettier.Doc,\n): Promise<prettier.Doc> {\n\tconst node = path.node as TorporNode;\n\n\tfor (let chunk of node.chunks) {\n\t\tswitch (chunk.type) {\n\t\t\tcase \"shell\": {\n\t\t\t\tchunk.formatted = await prettier.format(chunk.content, {\n\t\t\t\t\t...options,\n\t\t\t\t\tparser: \"typescript\",\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"head\":\n\t\t\tcase \"render\": {\n\t\t\t\tchunk.formatted = formatRenderChunk(chunk.type, chunk.content, options);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"style\": {\n\t\t\t\tchunk.formatted = formatStyleChunk(chunk.content, options);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst shell = node.chunks[0];\n\n\tfor (let i = 1; i < node.chunks.length; i++) {\n\t\tshell.formatted = shell.formatted.replace(\n\t\t\t// TODO: What if prettier strips semicolons??\n\t\t\t`/* ${node.chunks[i].id} */ 1;`,\n\t\t\tnode.chunks[i].formatted.trimStart(),\n\t\t);\n\t}\n\n\treturn shell.formatted;\n}\n\ninterface FormatState {\n\tindent: number;\n\toutput: string;\n\tpreserveWhitespace: any;\n}\n\nfunction formatRenderChunk(type: \"head\" | \"render\", content: string, options: object) {\n\t// HACK: should do this when parsing and convert it into a better AST\n\tconst source = `\nexport default function C() {\n${content}\n}`;\n\tconst parsed = parseTorp(source);\n\tif (!parsed.ok || !parsed.template) {\n\t\tconsole.log(\n\t\t\t`Failed to parse render section: ${parsed.errors.map((e) => e.message).join(\", \")}`,\n\t\t);\n\t\treturn content;\n\t}\n\n\tlet node =\n\t\ttype === \"head\" ? parsed.template.components[0].head : parsed.template.components[0].markup;\n\tlet state: FormatState = {\n\t\t// HACK: this should come from the indentation of the @render\n\t\tindent: 1,\n\t\toutput: \"\",\n\t\tpreserveWhitespace: false,\n\t};\n\tformatRenderNode(node, state, options, type);\n\treturn state.output;\n}\n\n// HACK: no types on internal types\nfunction formatRenderNode(\n\tnode: any,\n\tstate: FormatState,\n\toptions: Record<PropertyKey, any>,\n\ttype = \"\",\n) {\n\tswitch (node.type) {\n\t\tcase \"root\": {\n\t\t\tformatRootNode(node, state, options, type);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"control\": {\n\t\t\tformatControlNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"element\":\n\t\tcase \"component\":\n\t\tcase \"special\": {\n\t\t\tformatElementNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"text\": {\n\t\t\tformatTextNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"comment\": {\n\t\t\tformatCommentNode(node, state, options);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"Unknown node type: \" + node.type);\n\t\t}\n\t}\n}\n\nfunction formatRootNode(\n\tnode: any,\n\tstate: FormatState,\n\toptions: Record<PropertyKey, any>,\n\ttype: string,\n) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `${indent}@${type} {`;\n\tstate.indent++;\n\tfor (let c of node.children) {\n\t\tformatRenderNode(c, state, options);\n\t}\n\tstate.indent--;\n\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\tstate.output += `${indent}}`;\n}\n\nfunction formatControlNode(node: any, state: FormatState, options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\t// HACK: might be better to change the way these are parsed out...\n\tswitch (node.operation) {\n\t\tcase \"@if group\":\n\t\tcase \"@for group\": {\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@if\":\n\t\tcase \"@for\": {\n\t\t\tstate.output += `${indent}@${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@else if\":\n\t\tcase \"@else\": {\n\t\t\tstate.output += `${indent}} ${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@switch group\": {\n\t\t\tstate.output += `${indent}@${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@case\":\n\t\tcase \"@default\": {\n\t\t\t// HACK: need to fix parsing\n\t\t\tif (node.operation === \"@default\") state.output += \"\\n\";\n\t\t\tstate.output += `${indent}${node.statement} {`;\n\t\t\tstate.indent++;\n\t\t\tfor (let c of node.children) {\n\t\t\t\tformatRenderNode(c, state, options);\n\t\t\t}\n\t\t\tstate.indent--;\n\t\t\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\t\t\tstate.output += `${indent}}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"@key\": {\n\t\t\tstate.output += `${indent}@${node.statement}\\n`;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new Error(\"Unknown control operation: \" + node.operation);\n\t\t}\n\t}\n}\n\nfunction formatElementNode(node: any, state: FormatState, options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\n\t// HACK: Empty <fill> nodes get inserted behind the scenes and shouldn't be output\n\tif (node.tagName === \"filldef\") {\n\t\tfor (let c of node.children) {\n\t\t\tformatRenderNode(c, state, options);\n\t\t}\n\t\treturn;\n\t}\n\n\t// Build the list of attributes\n\tlet attrs = node.attributes.map((a: any) => {\n\t\tif (a.value === undefined) {\n\t\t\treturn a.name;\n\t\t} else if (a.value === a.name || a.value.endsWith(`.${a.name}`)) {\n\t\t\treturn `{${a.value}}`;\n\t\t} else {\n\t\t\tlet value = a.fullyReactive ? `{${a.value}}` : a.value;\n\t\t\treturn `${a.name}=${value}`;\n\t\t}\n\t});\n\n\t// TODO: Do we need to translate tabs to spaces for print width??\n\t// Let's see if they work on one line\n\tlet attributes = attrs.length ? \" \" + attrs.join(\" \") : \"\";\n\tlet element = `${indent}<${node.tagName}${attributes}${node.selfClosed ? \" /\" : \"\"}>`;\n\tif (node.attributes.length && element.length > options.printWidth) {\n\t\t// They're too long, so let's try that again\n\t\tlet attrIndent = `\\n${indent}\\t`;\n\t\tattributes = attrs.join(attrIndent);\n\t\telement = `${indent}<${node.tagName}${attrIndent}${attributes}\\n${indent}${node.selfClosed ? \"/\" : \"\"}>`;\n\t}\n\n\t// If at a newline, add the indent\n\t// If after an element/brace, add a space\n\tif (state.output.endsWith(\"\\n\")) {\n\t\tstate.output += indent;\n\t} else if (\n\t\t!state.output.endsWith(\">\") &&\n\t\t!state.output.endsWith(\"{\") &&\n\t\t!state.output.endsWith(\"}\")\n\t) {\n\t\tstate.output += \" \";\n\t}\n\n\tstate.output += element.trimStart();\n\n\t// If self-closed, we don't need to add anything else\n\tif (node.selfClosed) {\n\t\treturn;\n\t}\n\n\t// Add the children\n\tconst oldPreserveWhitespace = state.preserveWhitespace;\n\tstate.preserveWhitespace = node.tagName === \"code\" || node.tagName === \"pre\";\n\tstate.indent++;\n\tfor (let c of node.children) {\n\t\tformatRenderNode(c, state, options);\n\t}\n\tstate.indent--;\n\tstate.preserveWhitespace = oldPreserveWhitespace;\n\n\t// Add the closing tag\n\tif (state.output.endsWith(\"\\n\")) {\n\t\tstate.output += indent;\n\t}\n\tstate.output += `</${node.tagName}>`;\n}\n\nfunction formatTextNode(node: any, state: FormatState, _options: Record<PropertyKey, any>) {\n\tif (state.preserveWhitespace) {\n\t\tstate.output += node.content;\n\t\treturn;\n\t}\n\n\tconst indent = \"\\t\".repeat(state.indent);\n\tlet text = node.content.trim();\n\n\t// Check if it's just some newlines and, if so, add them\n\tif (!text) {\n\t\tlet newLineCount = 0;\n\t\tfor (let i = 0; i < node.content.length; i++) {\n\t\t\tif (node.content[i] === \"\\n\") newLineCount++;\n\t\t}\n\t\tif (newLineCount > 0) {\n\t\t\tif (newLineCount > 1 && !state.output.endsWith(\"{\")) {\n\t\t\t\tstate.output += \"\\n\";\n\t\t\t}\n\t\t\tstate.output += \"\\n\";\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Replace indents + newlines with the correct spacing (e.g. if a block of\n\t// text has been moved)\n\ttext = text.replaceAll(/\\s*\\n\\s*/g, `\\n${indent}`);\n\n\t// Add a newline if the text had one at the start\n\t// Add a space if the text is after a closing tag and had any spaces at the start\n\tlet newLineBefore = /^\\s*\\n/.test(node.content);\n\tif (newLineBefore) {\n\t\ttext = \"\\n\" + indent + text;\n\t} else if (/(<\\/[^<]+>|\\/>)$/i.test(state.output) && /^\\s+/.test(node.content)) {\n\t\ttext = \" \" + text;\n\t}\n\n\t// Add a newline if the text had one at the end\n\tlet newLineAfter = /\\n\\s*$/.test(node.content);\n\tif (newLineAfter) {\n\t\ttext += \"\\n\";\n\t}\n\n\tstate.output += text;\n}\n\nfunction formatCommentNode(node: any, state: FormatState, _options: Record<PropertyKey, any>) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tswitch (node.commentType) {\n\t\tcase \"html\":\n\t\t\tstate.output += `${indent}<!--${node.content}-->`;\n\t\t\tbreak;\n\t\tcase \"line\":\n\t\t\tstate.output += `${indent}@//${node.content}\\n`;\n\t\t\tbreak;\n\t\tcase \"block\":\n\t\t\tstate.output += `${indent}@/*${node.content}*/`;\n\t\t\tbreak;\n\t}\n}\n\nfunction formatStyleChunk(content: string, _options: object) {\n\t// HACK: should do this when parsing and convert it into a better AST\n\tconst source = `\nexport default function C() {\n${content}\n}`;\n\tconst parsed = parseTorp(source);\n\tif (!parsed.ok || !parsed.template) {\n\t\tconsole.log(`Failed to parse style section: ${parsed.errors.map((e) => e.message).join(\", \")}`);\n\t\treturn content;\n\t}\n\n\tlet state: FormatState = {\n\t\t// HACK: this should come from the indentation of the @render\n\t\tindent: 1,\n\t\toutput: \"\",\n\t\tpreserveWhitespace: false,\n\t};\n\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `${indent}@style {`;\n\tstate.indent++;\n\tfor (let c of parsed.template.components[0].style!.children) {\n\t\tformatStyleNode(c, state);\n\t}\n\tstate.indent--;\n\tstate.output = state.output.replace(/\\n\\n$/, \"\\n\");\n\tstate.output += `\\n${indent}}`;\n\n\treturn state.output;\n}\n\n// HACK: no types on internal types\nfunction formatStyleNode(node: any, state: FormatState) {\n\tif (node.gapBefore && !state.output.endsWith(\"{\")) {\n\t\tstate.output += \"\\n\";\n\t}\n\tswitch (node.type) {\n\t\tcase \"block\": {\n\t\t\tformatStyleBlockNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"attribute\": {\n\t\t\tformatStyleAttributeNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"comment\": {\n\t\t\tformatStyleCommentNode(node, state);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.log(\"Unknown style node type: \" + node.type);\n\t\t}\n\t}\n}\n\nfunction formatStyleBlockNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\n\tstate.output += `\\n${indent}${node.selector} {`;\n\tfor (let c of node.children) {\n\t\tstate.indent++;\n\t\tformatStyleNode(c, state);\n\t\tstate.indent--;\n\t}\n\n\tstate.output += `\\n${indent}}`;\n}\n\nfunction formatStyleAttributeNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `\\n${indent}${node.name}: ${node.value};`;\n}\n\nfunction formatStyleCommentNode(node: any, state: FormatState) {\n\tconst indent = \"\\t\".repeat(state.indent);\n\tstate.output += `\\n${indent}${node.content}`;\n}\n"],"mappings":";;;AAMA,MAAa,YAAwC,CACpD;CACC,MAAM;CACN,SAAS,CAAC,eAAe;CACzB,YAAY,CAAC,OAAO;AACrB,CACD;AAEA,MAAa,UAA2C,EACvD,iBAAiB;CAChB,OAAA;CACA,WAAW;CACX;CACA;AACD,EACD;AAEA,MAAa,WAA6C,EACzD,cAAc,EAEb,MACD,EACD;AAgBA,SAASA,QAAM,MAAc,UAA8B;CAC1D,IAAI,SAAkB,CAAC;CACvB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAChC,IAAI,KAAK,OAAO,KAAK;EACpB,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,WAAW,QAAQ,GAAG;GAC3C,MAAM,QAAQ,aAAa,MAAM,GAAG,QAAQ;GAC5C,OAAO,KAAK,KAAK;GACjB,IAAI,MAAM,MAAM;EACjB,OAAO,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG;GAChD,MAAM,QAAQ,aAAa,MAAM,GAAG,MAAM;GAC1C,OAAO,KAAK,KAAK;GACjB,IAAI,MAAM,MAAM;EACjB,OAAO,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,WAAW,OAAO,GAAG;GACjD,MAAM,QAAQ,aAAa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AAM,MAAM;CAEvC,MAAM,UAAU,KAAK,SAAS,KAAK,SAAS;CAC5C,KAAK,IAAI,KAAK,KAAK,UAAU;EAC5B,MAAM;EACN,gBAAgB,GAAG,KAAK;EACxB,MAAM;CACP;CAEA,MAAM,UAAU,KAAK,OAAO;AAC7B;AAEA,SAAS,yBAAyB,MAAW,OAAoB;CAChE,MAAM,SAAS,IAAK,OAAO,MAAM,MAAM;CACvC,MAAM,UAAU,KAAK,SAAS,KAAK,KAAK,IAAI,KAAK,MAAM;AACxD;AAEA,SAAS,uBAAuB,MAAW,OAAoB;CAC9D,MAAM,SAAS,IAAK,OAAO,MAAM,MAAM;CACvC,MAAM,UAAU,KAAK,SAAS,KAAK;AACpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/prettier",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A Prettier plugin for Torpor files",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,13 +21,13 @@
21
21
  "license": "ISC",
22
22
  "dependencies": {
23
23
  "prettier": "^3.9.6",
24
- "@torpor/view": "^1.0.1"
24
+ "@torpor/view": "^1.0.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
28
28
  "tsx": "^4.23.5",
29
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.7",
30
- "vite-plus": "0.2.7"
29
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
30
+ "vite-plus": "0.3.0"
31
31
  },
32
32
  "scripts": {
33
33
  "check": "tsgo --noEmit && pnpm dlx oxlint --type-aware",