@marko/compiler 5.20.6 → 5.20.9
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/babel-plugin/index.js +9 -11
- package/dist/babel-plugin/index.js.map +1 -1
- package/dist/babel-plugin/parser.js +388 -275
- package/dist/babel-plugin/parser.js.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/taglib/marko-html.json +3 -0
- package/dist/traverse.d.ts +15 -10
- package/dist/types.d.ts +30 -5
- package/index.d.ts +2 -2
- package/package.json +5 -5
- package/dist/babel-plugin/util/parse-arguments.js +0 -15
- package/dist/babel-plugin/util/parse-arguments.js.map +0 -1
- package/dist/babel-plugin/util/parse-attributes.js +0 -89
- package/dist/babel-plugin/util/parse-attributes.js.map +0 -1
- package/dist/babel-plugin/util/parse-classname-shorthand.js +0 -65
- package/dist/babel-plugin/util/parse-classname-shorthand.js.map +0 -1
- package/dist/babel-plugin/util/parse-id-shorthand.js +0 -34
- package/dist/babel-plugin/util/parse-id-shorthand.js.map +0 -1
- package/dist/babel-plugin/util/parse-params.js +0 -10
- package/dist/babel-plugin/util/parse-params.js.map +0 -1
- package/dist/babel-plugin/util/parse-var.js +0 -8
- package/dist/babel-plugin/util/parse-var.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/babel-plugin/parser.js"],"names":["EMPTY_OBJECT","EMPTY_ARRAY","htmlTrimStart","t","replace","htmlTrimEnd","htmlTrim","isAttributeTag","node","isStringLiteral","name","value","parseMarko","file","code","htmlParseOptions","markoOpts","watchFiles","metadata","marko","pushTagBody","getTagBody","pushContainer","currentTag","isProgram","get","preserveWhitespace","path","preservingWhitespaceUntil","wasSelfClosing","handledTagName","onNext","handlers","onDocumentType","pos","endPos","markoDocumentType","onDeclaration","markoDeclaration","onComment","markoComment","onCDATA","markoCDATA","onText","parser","shouldTrim","body","length","prev","prevIndex","isMarkoClass","isMarkoComment","isMarkoScriptlet","undefined","originalValue","indexOf","isMarkoText","test","markoText","prevBody","next","onPlaceholder","escape","withinBody","markoPlaceholder","onScriptlet","line","block","buildCodeFrameError","loc","markoScriptlet","onOpenTagName","event","tagName","tagNameExpression","exec","tagDef","tagNameStartPos","concise","tagNameNode","templateLiteral","templateElement","raw","cooked","stringLiteral","markoTag","markoTagBody","parseOptions","setParseOptions","rootOnly","onOpenTag","tagNameEndPos","selfClosed","state","enterParsedTextContentState","enterStaticTextContentState","rawOpenTag","set","substring","ignoreAttributes","var","params","argument","shorthandId","shorthandClassNames","attributes","onCloseTag","tag","isConcise","start","end","push","hook","default","parentPath","onfinish","onError","message","includes","isOpenTagOnly","openTagOnly","ignoreNonstandardStringPlaceholders","parse","opts","filename"],"mappings":"4JAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gD;;;;;;;;;AASA,MAAMA,YAAY,GAAG,EAArB;AACA,MAAMC,WAAW,GAAG,EAApB;AACA,MAAMC,aAAa,GAAG,CAAAC,CAAC,KAAIA,CAAC,CAACC,OAAF,CAAU,YAAV,EAAwB,EAAxB,CAA3B;AACA,MAAMC,WAAW,GAAG,CAAAF,CAAC,KAAIA,CAAC,CAACC,OAAF,CAAU,YAAV,EAAwB,EAAxB,CAAzB;AACA,MAAME,QAAQ,GAAG,CAAAH,CAAC,KAAID,aAAa,CAACG,WAAW,CAACF,CAAD,CAAZ,CAAnC;AACA,MAAMI,cAAc,GAAG,CAAAC,IAAI;AACzBL,CAAC,CAACM,eAAF,CAAkBD,IAAI,CAACE,IAAvB,KAAgCF,IAAI,CAACE,IAAL,CAAUC,KAAV,CAAgB,CAAhB,MAAuB,GADzD;;AAGO,SAASC,UAAT,CAAoBC,IAApB,EAA0B;AAC/B,QAAM,EAAEC,IAAF,KAAWD,IAAjB;AACA,QAAM,EAAEE,gBAAgB,GAAG,EAArB,KAA4BF,IAAI,CAACG,SAAvC;AACA,QAAM,EAAEC,UAAF,KAAiBJ,IAAI,CAACK,QAAL,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WAApB;AACD,KALoB;AAMrBC,IAAAA,mCAAmC,EAAE,IANhB;AAOrB,OAAG1G,gBAPkB,EAAvB;AAQG2G,EAAAA,KARH,CAQS5G,IART,EAQeD,IAAI,CAAC8G,IAAL,CAAUC,QARzB;AASD","sourcesContent":["import { createParser } from \"htmljs-parser\";\nimport parseAttributes from \"./util/parse-attributes\";\nimport parseArguments from \"./util/parse-arguments\";\nimport parseParams from \"./util/parse-params\";\nimport parseVar from \"./util/parse-var\";\nimport parseIDShorthand from \"./util/parse-id-shorthand\";\nimport parseClassnameShorthand from \"./util/parse-classname-shorthand\";\nimport * as t from \"../babel-types\";\nimport {\n withLoc,\n getLoc,\n getLocRange,\n parseScript,\n parseExpression,\n getTagDefForTagName\n} from \"@marko/babel-utils\";\n\nconst EMPTY_OBJECT = {};\nconst EMPTY_ARRAY = [];\nconst htmlTrimStart = t => t.replace(/^[\\n\\r]\\s*/, \"\");\nconst htmlTrimEnd = t => t.replace(/[\\n\\r]\\s*$/, \"\");\nconst htmlTrim = t => htmlTrimStart(htmlTrimEnd(t));\nconst isAttributeTag = node =>\n t.isStringLiteral(node.name) && node.name.value[0] === \"@\";\n\nexport function parseMarko(file) {\n const { code } = file;\n const { htmlParseOptions = {} } = file.markoOpts;\n const { watchFiles } = file.metadata.marko;\n const pushTagBody = node => getTagBody().pushContainer(\"body\", node);\n const getTagBody = () =>\n currentTag.isProgram() ? currentTag : currentTag.get(\"body\");\n let { preserveWhitespace } = htmlParseOptions;\n let currentTag = file.path;\n let preservingWhitespaceUntil = preserveWhitespace;\n let wasSelfClosing = false;\n let handledTagName = false;\n let onNext;\n\n const handlers = {\n onDocumentType({ value, pos, endPos }) {\n const node = withLoc(file, t.markoDocumentType(value), pos, endPos);\n pushTagBody(node);\n /* istanbul ignore next */\n onNext = onNext && onNext(node);\n },\n\n onDeclaration({ value, pos, endPos }) {\n const node = withLoc(file, t.markoDeclaration(value), pos, endPos);\n pushTagBody(node);\n /* istanbul ignore next */\n onNext = onNext && onNext(node);\n },\n\n onComment({ value, pos, endPos }) {\n const node = withLoc(file, t.markoComment(value), pos, endPos);\n pushTagBody(node);\n onNext = onNext && onNext(node);\n },\n\n onCDATA({ value, pos, endPos }) {\n const node = withLoc(file, t.markoCDATA(value), pos, endPos);\n pushTagBody(node);\n onNext = onNext && onNext(node);\n },\n\n onText({ value }, parser) {\n const shouldTrim = !preservingWhitespaceUntil;\n const { body } = getTagBody().node;\n let pos = parser.pos - value.length;\n\n if (shouldTrim) {\n if (htmlTrim(value) === \"\") {\n return;\n }\n\n // Find previous non-scriptlet/@tag.\n let prev;\n let prevIndex = body.length;\n while (prevIndex > 0) {\n prev = body[--prevIndex];\n\n if (\n t.isMarkoClass(prev) ||\n t.isMarkoComment(prev) ||\n t.isMarkoScriptlet(prev) ||\n isAttributeTag(prev)\n ) {\n prev = undefined;\n } else {\n break;\n }\n }\n\n if (!prev) {\n const originalValue = value;\n value = htmlTrimStart(value);\n pos += originalValue.indexOf(value);\n } else if (\n t.isMarkoText(prev) &&\n /\\s/.test(prev.value[prev.value.length - 1])\n ) {\n const originalValue = value;\n value = value.replace(/^\\s+/, \"\");\n pos += originalValue.indexOf(value);\n }\n }\n\n const endPos = pos + value.length;\n const node = withLoc(file, t.markoText(value), pos, endPos);\n const prevBody = getTagBody().node.body;\n pushTagBody(node);\n onNext && onNext(node);\n onNext =\n shouldTrim &&\n (next => {\n if (!next || prevBody.indexOf(next) === -1) {\n node.value = htmlTrimEnd(node.value);\n }\n\n node.value = node.value.replace(/\\s+/g, \" \");\n });\n },\n\n onPlaceholder({ escape, value, withinBody, pos, endPos }) {\n if (withinBody) {\n const node = withLoc(\n file,\n t.markoPlaceholder(\n parseExpression(\n file,\n value,\n pos + (escape ? 2 /* ${ */ : 3) /* $!{ */\n ),\n escape\n ),\n pos,\n endPos\n );\n\n pushTagBody(node);\n onNext = onNext && onNext(node);\n }\n },\n\n onScriptlet({ value, line, block, pos, endPos }) {\n if (!line && !block) {\n throw file.buildCodeFrameError(\n { loc: getLocRange(file, pos, endPos) },\n \"<% scriptlets %> are no longer supported.\"\n );\n }\n\n pos -= 1; // Include $.\n // Scriptlets are ignored as content and don't call `onNext`.\n pushTagBody(\n withLoc(\n file,\n t.markoScriptlet(\n parseScript(file, value, pos + 2 /** Ignores leading `$ ` */).body\n ),\n pos,\n endPos\n )\n );\n },\n\n onOpenTagName(event) {\n const { pos, endPos } = event;\n const tagName = event.tagName || \"div\";\n const [, tagNameExpression] =\n /^\\$\\{([\\s\\S]*)\\}/.exec(tagName) || EMPTY_ARRAY;\n const tagDef = !tagNameExpression && getTagDefForTagName(file, tagName);\n const tagNameStartPos = pos + (event.concise ? 0 : 1); // Account for leading `<`.\n\n handledTagName = true;\n\n if (tagNameExpression === \"\") {\n throw file.buildCodeFrameError(\n { loc: getLocRange(file, tagNameStartPos + 1, tagNameStartPos + 3) },\n \"Missing expression for <${dynamic}> tag.\"\n );\n }\n\n let tagNameNode;\n\n if (tagNameExpression) {\n tagNameNode = parseExpression(\n file,\n tagNameExpression,\n tagNameStartPos + 2 /* ${ */\n );\n\n if (t.isStringLiteral(tagNameNode)) {\n // convert to template literal just so that we don't mistake it for a native tag.\n tagNameNode = t.templateLiteral(\n [\n t.templateElement({\n raw: tagNameNode.value,\n cooked: tagNameNode.value\n })\n ],\n []\n );\n }\n } else {\n tagNameNode = withLoc(\n file,\n t.stringLiteral(tagName),\n tagNameStartPos,\n tagNameStartPos + tagName.length\n );\n }\n\n const node = withLoc(\n file,\n t.markoTag(tagNameNode, [], t.markoTagBody()),\n pos,\n endPos\n );\n\n if (tagDef) {\n node.tagDef = tagDef;\n\n const { parseOptions } = tagDef;\n if (parseOptions) {\n event.setParseOptions(parseOptions);\n\n if (parseOptions.rootOnly && !currentTag.isProgram()) {\n throw file.buildCodeFrameError(\n { loc: getLocRange(file, pos, endPos) },\n `\"${tagName}\" tags must be at the root of your Marko template.`\n );\n }\n }\n }\n\n [currentTag] = pushTagBody(node);\n\n // @tags are not treated as content and do not call next.\n if (!isAttributeTag(node)) {\n onNext = onNext && onNext(node);\n }\n },\n\n onOpenTag(event, parser) {\n if (!handledTagName) {\n // There is a bug in htmljs parser where a single top level concise mode tag with nothing else\n // does not emit the openTagNameEvent.\n handlers.onOpenTagName(event);\n }\n\n handledTagName = false;\n const { pos, endPos, tagNameEndPos } = event;\n const { tagDef } = currentTag.node;\n const parseOptions = (tagDef && tagDef.parseOptions) || EMPTY_OBJECT;\n wasSelfClosing = event.selfClosed;\n\n if (parseOptions.state === \"parsed-text\") {\n parser.enterParsedTextContentState();\n } else if (parseOptions.state === \"static-text\") {\n parser.enterStaticTextContentState();\n }\n\n if (parseOptions.rawOpenTag) {\n currentTag.set(\n \"rawValue\",\n parser.substring(pos, endPos).replace(/^<|\\/>$|>$/g, \"\")\n );\n }\n\n if (!parseOptions.ignoreAttributes) {\n currentTag.set(\"var\", parseVar(file, event.var));\n currentTag.get(\"body\").set(\"params\", parseParams(file, event.params));\n currentTag.set(\"arguments\", parseArguments(file, event.argument));\n currentTag.set(\n \"attributes\",\n parseIDShorthand(\n file,\n event.shorthandId,\n parseClassnameShorthand(\n file,\n event.shorthandClassNames,\n parseAttributes(file, event.attributes, tagNameEndPos)\n )\n )\n );\n }\n\n if (!preservingWhitespaceUntil && parseOptions.preserveWhitespace) {\n preservingWhitespaceUntil = currentTag;\n }\n },\n\n onCloseTag(event, parser) {\n let { pos, endPos } = event;\n const tag = currentTag;\n const { node } = tag;\n const { tagDef } = node;\n const isConcise = code[node.start - 1] !== \"<\";\n\n if (preservingWhitespaceUntil === currentTag) {\n preservingWhitespaceUntil = undefined;\n }\n\n if (!pos) {\n pos = parser.pos;\n }\n\n if (!endPos) {\n endPos = pos;\n\n if (wasSelfClosing && !isConcise) {\n endPos += 2; // account for \"/>\"\n }\n }\n\n node.end = endPos;\n node.loc.end = getLoc(file, endPos);\n\n if (\n !isConcise &&\n !wasSelfClosing &&\n code[pos + 1] !== \"/\" &&\n !currentTag.get(\"name\").isStringLiteral()\n ) {\n throw file.buildCodeFrameError(\n { loc: getLocRange(file, pos, endPos) },\n `Invalid ending for dynamic tag, expected \"</>\".`\n );\n }\n\n if (tagDef && tagDef.parser) {\n if (tagDef.parser.path) {\n watchFiles.push(tagDef.parser.path);\n }\n /* istanbul ignore next */\n (tagDef.parser.hook.default || tagDef.parser.hook)(tag, t);\n }\n\n currentTag = currentTag.parentPath.parentPath || file.path;\n },\n\n onfinish() {\n onNext = onNext && onNext();\n },\n\n onError({ message, pos, endPos }) {\n if (message.includes(\"EOF\")) endPos = pos;\n throw file.buildCodeFrameError(\n { loc: getLocRange(file, pos, endPos) },\n message\n );\n }\n };\n\n createParser(handlers, {\n isOpenTagOnly(name) {\n const { parseOptions = EMPTY_OBJECT } =\n getTagDefForTagName(file, name) || EMPTY_OBJECT;\n return parseOptions.openTagOnly;\n },\n ignoreNonstandardStringPlaceholders: true,\n ...htmlParseOptions\n }).parse(code, file.opts.filename);\n}\n"],"file":"parser.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/babel-plugin/parser.js"],"names":["noop","emptyRange","part","start","end","isAttrTag","tag","name","value","toBabelPosition","line","character","column","parseMarko","file","code","htmlParseOptions","markoOpts","watchFiles","metadata","marko","currentTag","path","currentBody","currentAttr","undefined","currentShorthandId","currentShorthandClassNames","preserveWhitespace","preservingWhitespaceUntil","onNext","positionAt","index","parser","locationAt","range","withLoc","node","loc","enterTag","pushContainer","get","pushContent","body","push","endAttr","parseTemplateString","quasis","expressions","length","first","t","stringLiteral","read","result","isStringLiteral","templateLiteral","templateElement","raw","cooked","onError","buildCodeFrameError","message","onText","rawValue","markoText","test","prev","prevIndex","isMarkoScriptlet","isMarkoComment","type","replace","next","trimmedStart","indexOf","splice","onCDATA","markoCDATA","onDoctype","markoDocumentType","onDeclaration","markoDeclaration","onComment","markoComment","onPlaceholder","markoPlaceholder","escape","onScriptlet","markoScriptlet","onTagName","tagName","markoTag","markoTagBody","parseType","TagType","html","concise","literalTagName","parseOptions","tagDef","statement","openTagOnly","void","text","onTagShorthandId","onTagShorthandClass","onTagVar","var","left","onTagParams","params","onTagArgs","arguments","onAttrName","modifier","exec","attributes","markoAttribute","booleanLiteral","onAttrArgs","onAttrValue","bound","onAttrMethod","prefix","onAttrSpread","markoSpreadAttribute","onOpenTagEnd","foundClassAttr","classShorthandValue","every","expr","map","join","arrayExpression","attr","isArrayExpression","elements","rawOpenTag","selfClosed","onCloseTag","parserPlugin","hook","default","parentPath","parse","ast","program"],"mappings":"uEAAA;AACA;AACA,gD;;;;;;AAMA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AACA,MAAMC,UAAU,GAAG,CAAAC,IAAI,KAAIA,IAAI,CAACC,KAAL,KAAeD,IAAI,CAACE,GAA/C;AACA,MAAMC,SAAS,GAAG,CAAAC,GAAG,iCAAI,oBAAAA,GAAG,CAACC,IAAJ,CAASC,KAAT,qCAAiB,CAAjB,OAAwB,GAA5B,EAArB;AACA,MAAMC,eAAe,GAAG,CAAC,EAAEC,IAAF,EAAQC,SAAR,EAAD,MAA0B;AAChDD,EAAAA,IAAI,EAAEA,IAAI,GAAG,CADmC;AAEhDE,EAAAA,MAAM,EAAED,SAAS,GAAGA,SAAS,GAAG,CAAf,GAAmBA,SAFY,EAA1B,CAAxB;;;AAKO,SAASE,UAAT,CAAoBC,IAApB,EAA0B;AAC/B,QAAM,EAAEC,IAAF,KAAWD,IAAjB;AACA,QAAM,EAAEE,gBAAgB,GAAG,EAArB,KAA4BF,IAAI,CAACG,SAAvC;AACA,QAAM,EAAEC,UAAF,KAAiBJ,IAAI,CAACK,QAAL,CAAcC,KAArC;AACA,MAAIC,UAAU,GAAGP,IAAI,CAACQ,IAAtB;AACA,MAAIC,WAAW,GAAGF,UAAlB;AACA,MAAIG,WAAW,GAAGC,SAAlB;AACA,MAAIC,kBAAkB,GAAGD,SAAzB;AACA,MAAIE,0BAA0B,GAAGF,SAAjC;AACA,MAAI,EAAEG,kBAAF,KAAyBZ,gBAA7B;AACA,MAAIa,yBAAy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EAAE,CAAnB,EADe;AAEtBR,IAAAA,GAAG,EAAE2B,UAAU,CAACmH,GAAG,CAAC9I,GAAL,CAFO,EAAxB;;AAID","sourcesContent":["import { createParser, TagType } from \"htmljs-parser\";\nimport * as t from \"../babel-types\";\nimport {\n parseScript,\n parseExpression,\n getTagDefForTagName\n} from \"@marko/babel-utils\";\n\nconst noop = () => {};\nconst emptyRange = part => part.start === part.end;\nconst isAttrTag = tag => tag.name.value?.[0] === \"@\";\nconst toBabelPosition = ({ line, character }) => ({\n line: line + 1,\n column: character ? character - 1 : character\n});\n\nexport function parseMarko(file) {\n const { code } = file;\n const { htmlParseOptions = {} } = file.markoOpts;\n const { watchFiles } = file.metadata.marko;\n let currentTag = file.path;\n let currentBody = currentTag;\n let currentAttr = undefined;\n let currentShorthandId = undefined;\n let currentShorthandClassNames = undefined;\n let { preserveWhitespace } = htmlParseOptions;\n let preservingWhitespaceUntil = preserveWhitespace;\n let onNext = noop;\n const positionAt = index => toBabelPosition(parser.positionAt(index));\n const locationAt = range => {\n // Babel columns start at 0, but that is silly.\n // Here we normalize the parsers 1 based columns.\n const { start, end } = parser.locationAt(range);\n return {\n start: toBabelPosition(start),\n end: toBabelPosition(end)\n };\n };\n const withLoc = (node, range) => {\n node.start = range.start;\n node.end = range.end;\n node.loc = locationAt(range);\n return node;\n };\n const enterTag = node => {\n currentTag = currentBody.pushContainer(\"body\", node)[0];\n currentBody = currentTag.get(\"body\");\n onNext(node);\n };\n const pushContent = node => {\n currentBody.node.body.push(node);\n onNext(node);\n };\n const endAttr = () => {\n if (currentAttr) {\n currentAttr.loc = locationAt(currentAttr);\n currentAttr = undefined;\n }\n };\n const parseTemplateString = ({ quasis, expressions }) => {\n switch (expressions.length) {\n case 0: {\n const [first] = quasis;\n return withLoc(t.stringLiteral(parser.read(first)), first);\n }\n case 1: {\n if (emptyRange(quasis[0]) && emptyRange(quasis[1])) {\n const [{ value }] = expressions;\n const result = parseExpression(file, parser.read(value), value.start);\n if (t.isStringLiteral(result)) {\n // convert to template literal just so that we don't mistake it for a native tag if this is a tag name.\n return t.templateLiteral(\n [\n t.templateElement({\n raw: result.value,\n cooked: result.value\n })\n ],\n []\n );\n } else {\n return result;\n }\n }\n }\n }\n\n const [{ start }] = quasis;\n const end = quasis[quasis.length - 1].end;\n return parseExpression(\n file,\n `\\`${parser.read({ start, end })}\\``,\n start - 1\n );\n };\n\n const parser = createParser({\n onError(part) {\n throw file.buildCodeFrameError({ loc: locationAt(part) }, part.message);\n },\n onText(part) {\n const rawValue = parser.read(part);\n\n if (preservingWhitespaceUntil) {\n pushContent(withLoc(t.markoText(rawValue), part));\n return;\n }\n\n if (/^(?:[\\n\\r]\\s*)?(?:[\\n\\r]\\s*)?$/.test(rawValue)) return;\n\n const { body } = currentBody.node;\n let prev;\n let prevIndex = body.length;\n // Find previous non-scriptlet or comment.\n while (prevIndex > 0) {\n prev = body[--prevIndex];\n\n if (t.isMarkoScriptlet(prev) || t.isMarkoComment(prev)) {\n prev = undefined;\n } else {\n break;\n }\n }\n\n let value = rawValue;\n switch (prev?.type) {\n case \"MarkoPlaceholder\":\n break;\n case \"MarkoText\":\n if (/\\s$/.test(prev.value)) {\n value = value.replace(/^\\s+/, \"\");\n }\n break;\n case \"MarkoTag\":\n if (isAttrTag(prev)) {\n value = value.replace(/^[\\n\\r]\\s*/, \"\");\n }\n break;\n default:\n value = value.replace(/^[\\n\\r]\\s*/, \"\");\n break;\n }\n\n const node = t.markoText(value);\n pushContent(node);\n onNext = next => {\n switch (next?.type) {\n case \"MarkoScriptlet\":\n case \"MarkoComment\":\n return;\n case \"MarkoPlaceholder\":\n break;\n case \"MarkoText\":\n if (/^\\s/.test(next.value)) {\n value = value.replace(/\\s+$/, \"\");\n }\n break;\n case \"MarkoTag\":\n if (isAttrTag(next)) {\n value = value.replace(/[\\n\\r]\\s*$/, \"\");\n }\n\n break;\n default:\n value = value.replace(/[\\n\\r]\\s*$/, \"\");\n break;\n }\n\n node.value = value.replace(/\\s+/g, \" \");\n\n if (node.value) {\n const trimmedStart = part.start + rawValue.indexOf(value);\n withLoc(node, {\n start: trimmedStart,\n end: trimmedStart + rawValue.length\n });\n } else {\n body.splice(body.indexOf(node), 1);\n }\n\n onNext = noop;\n };\n },\n onCDATA(part) {\n pushContent(withLoc(t.markoCDATA(parser.read(part.value)), part));\n },\n onDoctype(part) {\n pushContent(withLoc(t.markoDocumentType(parser.read(part.value)), part));\n },\n onDeclaration(part) {\n pushContent(withLoc(t.markoDeclaration(parser.read(part.value)), part));\n },\n onComment(part) {\n pushContent(withLoc(t.markoComment(parser.read(part.value)), part));\n },\n onPlaceholder(part) {\n pushContent(\n withLoc(\n t.markoPlaceholder(\n parseExpression(file, parser.read(part.value), part.value.start),\n part.escape\n ),\n part\n )\n );\n },\n onScriptlet(part) {\n pushContent(\n withLoc(\n t.markoScriptlet(\n parseScript(file, parser.read(part.value), part.value.start).body\n ),\n part\n )\n );\n },\n onTagName(part) {\n const tagName = parseTemplateString(part);\n const node = t.markoTag(tagName, [], t.markoTagBody());\n let parseType = TagType.html;\n node.start = part.start - (part.concise ? 0 : 1); // Account for leading `<`.\n node.end = part.end;\n\n if (t.isStringLiteral(tagName)) {\n const literalTagName = tagName.value || (tagName.value = \"div\");\n\n if (literalTagName === \"%\") {\n throw file.buildCodeFrameError(\n tagName,\n \"<% scriptlets %> are no longer supported.\"\n );\n }\n\n const parseOptions = (node.tagDef = getTagDefForTagName(\n file,\n literalTagName\n ))?.parseOptions;\n\n if (parseOptions) {\n if (parseOptions.preserveWhitespace) {\n preservingWhitespaceUntil = node;\n }\n\n if (parseOptions.statement) {\n parseType = TagType.statement;\n } else if (parseOptions.openTagOnly) {\n parseType = TagType.void;\n } else if (parseOptions.text) {\n parseType = TagType.text;\n }\n }\n }\n\n enterTag(node);\n return parseType;\n },\n onTagShorthandId(part) {\n currentShorthandId = parseTemplateString(part);\n },\n onTagShorthandClass(part) {\n if (currentShorthandClassNames) {\n currentShorthandClassNames.push(parseTemplateString(part));\n } else {\n currentShorthandClassNames = [parseTemplateString(part)];\n }\n },\n\n onTagVar(part) {\n currentTag.node.var = parseExpression(\n file,\n `${parser.read(part.value)}=1`,\n part.value.start\n ).left;\n },\n\n onTagParams(part) {\n currentTag.node.body.params = parseExpression(\n file,\n `(${parser.read(part.value)})=>{}`,\n part.start\n ).params;\n },\n\n onTagArgs(part) {\n currentTag.node.arguments = parseExpression(\n file,\n `_${parser.read(part)}`,\n part.start - 1\n ).arguments;\n },\n\n onAttrName(part) {\n const [, name, modifier] = /^([^:]*)(?::(.*))?/.exec(parser.read(part));\n endAttr();\n currentTag.node.attributes.push(\n (currentAttr = t.markoAttribute(\n name || \"default\",\n t.booleanLiteral(true),\n modifier,\n undefined,\n !name\n ))\n );\n\n currentAttr.start = part.start;\n currentAttr.end = part.end;\n },\n\n onAttrArgs(part) {\n currentAttr.arguments = parseExpression(\n file,\n `_${parser.read(part)}`,\n part.start - 1\n ).arguments;\n currentAttr.end = part.end;\n },\n\n onAttrValue(part) {\n currentAttr.end = part.end;\n currentAttr.bound = part.bound;\n currentAttr.value = parseExpression(\n file,\n parser.read(part.value),\n part.value.start\n );\n },\n\n onAttrMethod(part) {\n const prefix = \"function\";\n currentAttr.end = part.end;\n currentAttr.value = parseExpression(\n file,\n prefix + parser.read(part),\n part.start - prefix.length\n );\n },\n\n onAttrSpread(part) {\n endAttr();\n currentTag.node.attributes.push(\n withLoc(\n t.markoSpreadAttribute(\n parseExpression(file, parser.read(part.value), part.value.start)\n ),\n part\n )\n );\n },\n\n onOpenTagEnd(part) {\n const { node } = currentTag;\n const { attributes } = node;\n const parseOptions = node.tagDef?.parseOptions;\n endAttr();\n\n if (currentShorthandClassNames) {\n let foundClassAttr = false;\n const classShorthandValue =\n currentShorthandClassNames.length === 1\n ? currentShorthandClassNames[0]\n : currentShorthandClassNames.every(expr => t.isStringLiteral(expr))\n ? withLoc(\n t.stringLiteral(\n currentShorthandClassNames.map(node => node.value).join(\" \")\n ),\n {\n start: currentShorthandClassNames[0].start,\n end: currentShorthandClassNames[\n currentShorthandClassNames.length - 1\n ].end\n }\n )\n : t.arrayExpression(currentShorthandClassNames);\n\n for (const attr of attributes) {\n if (attr.name === \"class\") {\n foundClassAttr = true;\n if (t.isArrayExpression(attr.value)) {\n if (t.isArrayExpression(classShorthandValue)) {\n attr.value.elements.push(...classShorthandValue.elements);\n } else {\n attr.value.elements.push(classShorthandValue);\n }\n } else if (\n t.isStringLiteral(attr.value) &&\n t.isStringLiteral(classShorthandValue)\n ) {\n attr.value.value = `${classShorthandValue.value} ${attr.value.value}`;\n } else if (t.isArrayExpression(classShorthandValue)) {\n classShorthandValue.elements.push(attr.value);\n attr.value = classShorthandValue;\n } else {\n attr.value = t.arrayExpression([classShorthandValue, attr.value]);\n }\n break;\n }\n }\n\n if (!foundClassAttr) {\n attributes.push(t.markoAttribute(\"class\", classShorthandValue));\n }\n\n currentShorthandClassNames = undefined;\n }\n\n if (currentShorthandId) {\n for (const attr of attributes) {\n if (attr.name === \"id\") {\n throw file.buildCodeFrameError(\n attr,\n \"Cannot have shorthand id and id attribute.\"\n );\n }\n }\n currentTag.node.attributes.push(\n t.markoAttribute(\"id\", currentShorthandId)\n );\n currentShorthandId = undefined;\n }\n\n if (parseOptions) {\n if (parseOptions.rawOpenTag) {\n node.rawValue = parser.read({\n start: node.name.start,\n end: part.start\n });\n }\n\n if (\n part.selfClosed ||\n parseOptions.statement ||\n parseOptions.openTagOnly\n ) {\n this.onCloseTag(part);\n }\n } else if (part.selfClosed) {\n this.onCloseTag(part);\n }\n },\n onCloseTag(part) {\n const { node } = currentTag;\n const parserPlugin = node.tagDef?.parser;\n if (preservingWhitespaceUntil === node) {\n preservingWhitespaceUntil = undefined;\n }\n\n node.end = part.end;\n node.loc = locationAt(node);\n\n if (parserPlugin) {\n const { hook } = parserPlugin;\n if (parserPlugin.path) watchFiles.push(parserPlugin.path);\n (hook.default || hook)(currentTag, t);\n }\n\n currentTag = currentTag.parentPath.parentPath;\n\n if (currentTag) {\n currentBody = currentTag.get(\"body\");\n } else {\n currentTag = currentBody = file.path;\n }\n\n onNext();\n }\n });\n\n parser.parse(code);\n onNext();\n\n const { ast } = file;\n const { program } = ast;\n ast.start = program.start = 0;\n ast.end = program.end = code.length - 1;\n ast.loc = program.loc = {\n start: { line: 1, column: 0 },\n end: positionAt(ast.end)\n };\n}\n"],"file":"parser.js"}
|
package/dist/config.js
CHANGED
|
@@ -151,7 +151,7 @@ var _lassoPackageRoot = require("lasso-package-root");
|
|
|
151
151
|
|
|
152
152
|
var _fs2 = require("./taglib/fs");let config;const globalThis = typeof window === "undefined" ? global : window;const MARKO_CONFIG_KEY = Symbol("Default Marko Compiler Config");if (globalThis[MARKO_CONFIG_KEY]) {config = globalThis[MARKO_CONFIG_KEY];} else {config = globalThis[MARKO_CONFIG_KEY] = { // The default output mode for compiled templates
|
|
153
153
|
output: "html", // Override the runtimeid used when calling `marko/components.init` in the `hydrate` output.
|
|
154
|
-
runtimeId:
|
|
154
|
+
runtimeId: null, // Have Marko provide the final AST in the compile result.
|
|
155
155
|
ast: false, // Set the false to have Marko not generate the final code string, useful if just reading metadata or AST.
|
|
156
156
|
code: true, /**
|
|
157
157
|
* Whether the version should be written to the template as a comment e.g.
|
|
@@ -184,7 +184,7 @@ var _fs2 = require("./taglib/fs");let config;const globalThis = typeof window ==
|
|
|
184
184
|
* This option should be set if `hydrate` output is specified.
|
|
185
185
|
* Maps a virtual dependency to a resolved file which can be implemented
|
|
186
186
|
* for specific bundlers.
|
|
187
|
-
*/resolveVirtualDependency:
|
|
187
|
+
*/resolveVirtualDependency: null, /**
|
|
188
188
|
* Compiling a Marko template may require other (used) Marko templates to compile.
|
|
189
189
|
* To prevent compiling templates more than once, most of the compilation is cached.
|
|
190
190
|
*
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.js"],"names":["config","globalThis","window","global","MARKO_CONFIG_KEY","Symbol","output","runtimeId","
|
|
1
|
+
{"version":3,"sources":["../src/config.js"],"names":["config","globalThis","window","global","MARKO_CONFIG_KEY","Symbol","output","runtimeId","ast","code","writeVersionComment","ignoreUnrecognizedTags","sourceMaps","meta","translator","translatorReg","pkg","process","cwd","name","dependencies","test","peerDependencies","devDependencies","fileSystem","fs","modules","optimize","undefined","resolveVirtualDependency","cache","Map","hydrateIncludeImports","hot","env","MARKO_CONFIG","Object","assign","JSON","parse"],"mappings":"qJAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsJA,kCApJA,IAAIA,MAAJ,CACA,MAAMC,UAAU,GAAG,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,MAAhC,GAAyCD,MAA5D,CACA,MAAME,gBAAgB,GAAGC,MAAM,CAAC,+BAAD,CAA/B,CAEA,IAAIJ,UAAU,CAACG,gBAAD,CAAd,EAAkC,CAChCJ,MAAM,GAAGC,UAAU,CAACG,gBAAD,CAAnB,CACD,CAFD,MAEO,CACLJ,MAAM,GAAGC,UAAU,CAACG,gBAAD,CAAV,GAA+B,EACtC;AACAE,IAAAA,MAAM,EAAE,MAF8B,EAItC;AACAC,IAAAA,SAAS,EAAE,IAL2B,EAOtC;AACAC,IAAAA,GAAG,EAAE,KARiC,EAUtC;AACAC,IAAAA,IAAI,EAAE,IAXgC,EAatC;AACJ;AACA;AACA,OACIC,mBAAmB,EAAE,IAjBiB,EAmBtC;AACJ;AACA;AACA,OACIC,sBAAsB,EAAE,KAvBc,EAyBtC;AACJ;AACA;AACA;AACA;AACA,OACIC,UAAU,EAAE,KA/B0B,EAiCtC;AACJ;AACA;AACA;AACA,OACIC,IAAI,EAAE,KAtCgC,EAwCtC;AACJ;AACA,OACIC,UAAU,EAAE,CAAC,MAAM,CACjB,MAAMC,aAAa,GA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BAAqB,EACnB,6GA9HoC,EAgItC;AACJ;AACA,OACIC,GAAG,EAAE,KAnIiC,EAAxC,CAsIA,IAAIhB,OAAO,CAACiB,GAAR,CAAYC,YAAhB,EAA8B,CAC5BC,MAAM,CAACC,MAAP,CAAcrC,MAAd,EAAsBsC,IAAI,CAACC,KAAL,CAAWtB,OAAO,CAACiB,GAAR,CAAYC,YAAvB,CAAtB,EACD,CACF,C,eAEcnC,M,4BAGf,gBAAMA,MAAM,CAACwB,UAAb","sourcesContent":["import fs from \"fs\";\nimport { getRootPackage } from \"lasso-package-root\";\n\nlet config;\nconst globalThis = typeof window === \"undefined\" ? global : window;\nconst MARKO_CONFIG_KEY = Symbol(\"Default Marko Compiler Config\");\n\nif (globalThis[MARKO_CONFIG_KEY]) {\n config = globalThis[MARKO_CONFIG_KEY];\n} else {\n config = globalThis[MARKO_CONFIG_KEY] = {\n // The default output mode for compiled templates\n output: \"html\",\n\n // Override the runtimeid used when calling `marko/components.init` in the `hydrate` output.\n runtimeId: null,\n\n // Have Marko provide the final AST in the compile result.\n ast: false,\n\n // Set the false to have Marko not generate the final code string, useful if just reading metadata or AST.\n code: true,\n\n /**\n * Whether the version should be written to the template as a comment e.g.\n * // Compiled using marko@x.x.x - DO NOT EDIT\n */\n writeVersionComment: true,\n\n /**\n * Whether unrecognized tags should be ignored or not. This flag will\n * be enabled by default when compiling XML.\n */\n ignoreUnrecognizedTags: false,\n\n /**\n * Whether source maps should be output with the compiled templates.\n * When `true` a `map` property will be available on the compile result.\n * When `\"inline\"` the sourcemap will be inlined as a comment in the output code.\n * When `\"both\"` both of the above will be used.\n */\n sourceMaps: false,\n\n /**\n * This option inlines all of the meta data in the template.\n * You can also access this metadata via `compile(...).meta`.\n * This API is sticking around for compatibility purposes.\n */\n meta: false,\n\n /**\n * Allows configuring Marko to compile to different runtimes.\n */\n translator: (() => {\n const translatorReg = /^(@marko\\/|marko-)translator-/;\n let translator;\n let pkg;\n\n try {\n pkg = getRootPackage(process.cwd());\n // eslint-disable-next-line no-empty\n } catch {}\n\n if (pkg) {\n for (const name in pkg.dependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.peerDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n\n for (const name in pkg.devDependencies) {\n if (translatorReg.test(name)) {\n if (translator && translator !== name) {\n return;\n }\n\n translator = name;\n }\n }\n }\n\n return translator || \"@marko/translator-default\";\n })(),\n\n /**\n * Use a different file system object, eg webpacks CachedInputFileSystem or lasso-caching-fs\n */\n fileSystem: fs,\n /**\n * By default Marko 5 outputs esm, you can optionally specify commonjs.\n *\n * Valid options: esm | cjs\n */\n modules: \"esm\",\n\n /**\n * Enables production mode optimizations if true, or not if false.\n * If left as undefined checks for env === \"production\".\n */\n optimize: undefined,\n\n /**\n * This option should be set if `hydrate` output is specified.\n * Maps a virtual dependency to a resolved file which can be implemented\n * for specific bundlers.\n */\n resolveVirtualDependency: null,\n\n /**\n * Compiling a Marko template may require other (used) Marko templates to compile.\n * To prevent compiling templates more than once, most of the compilation is cached.\n *\n * The default cache strategy is to clear the cache on every macrotask.\n * If the default cache is overwritten it is up to the user to determine when the\n * cache is cleared.\n */\n cache: new Map(),\n\n /**\n * A regexp or function that receives an import path that matches file types known to be client side assets.\n */\n hydrateIncludeImports:\n /\\.(css|less|s[ac]ss|styl|png|jpe?g|gif|svg|ico|webp|avif|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)$/,\n\n /**\n * Set to true in order to bring in the hot module replacement runtime.\n */\n hot: false\n };\n\n if (process.env.MARKO_CONFIG) {\n Object.assign(config, JSON.parse(process.env.MARKO_CONFIG));\n }\n}\n\nexport default config;\n\nimport { setFS } from \"./taglib/fs\";\nsetFS(config.fileSystem);\n"],"file":"config.js"}
|
|
@@ -720,6 +720,7 @@
|
|
|
720
720
|
},
|
|
721
721
|
"<script>": {
|
|
722
722
|
"parse-options": {
|
|
723
|
+
"text": true,
|
|
723
724
|
"preserveWhitespace": true
|
|
724
725
|
},
|
|
725
726
|
"@async": "#html-async",
|
|
@@ -786,6 +787,7 @@
|
|
|
786
787
|
},
|
|
787
788
|
"<style>": {
|
|
788
789
|
"parse-options": {
|
|
790
|
+
"text": true,
|
|
789
791
|
"preserveWhitespace": true
|
|
790
792
|
},
|
|
791
793
|
"@disabled": "#html-disabled",
|
|
@@ -824,6 +826,7 @@
|
|
|
824
826
|
},
|
|
825
827
|
"<textarea>": {
|
|
826
828
|
"parse-options": {
|
|
829
|
+
"text": true,
|
|
827
830
|
"preserveWhitespace": true
|
|
828
831
|
},
|
|
829
832
|
"@autocomplete": "#html-autocomplete",
|
package/dist/traverse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for @babel/traverse 7.
|
|
1
|
+
// Type definitions for @babel/traverse 7.17
|
|
2
2
|
// Project: https://github.com/babel/babel/tree/main/packages/babel-traverse, https://babeljs.io
|
|
3
3
|
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
|
4
4
|
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
|
@@ -140,7 +140,12 @@ export class Scope {
|
|
|
140
140
|
|
|
141
141
|
crawl(): void;
|
|
142
142
|
|
|
143
|
-
push(opts: {
|
|
143
|
+
push(opts: {
|
|
144
|
+
id: t.LVal;
|
|
145
|
+
init?: t.Expression | undefined;
|
|
146
|
+
unique?: boolean | undefined;
|
|
147
|
+
kind?: 'var' | 'let' | 'const' | undefined;
|
|
148
|
+
}): void;
|
|
144
149
|
|
|
145
150
|
getProgramParent(): Scope;
|
|
146
151
|
|
|
@@ -194,13 +199,11 @@ export class Binding {
|
|
|
194
199
|
constantViolations: NodePath[];
|
|
195
200
|
}
|
|
196
201
|
|
|
197
|
-
export type Visitor<S = {}> = VisitNodeObject<S, Node> &
|
|
198
|
-
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
[K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>;
|
|
203
|
-
};
|
|
202
|
+
export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
|
|
203
|
+
[Type in Node['type']]?: VisitNode<S, Extract<Node, { type: Type }>>;
|
|
204
|
+
} & {
|
|
205
|
+
[K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>;
|
|
206
|
+
};
|
|
204
207
|
|
|
205
208
|
export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
|
|
206
209
|
|
|
@@ -254,6 +257,8 @@ export class NodePath<T = Node> {
|
|
|
254
257
|
|
|
255
258
|
getData(key: string, def?: any): any;
|
|
256
259
|
|
|
260
|
+
hasNode(): this is NodePath<NonNullable<this['node']>>;
|
|
261
|
+
|
|
257
262
|
buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
|
|
258
263
|
|
|
259
264
|
traverse<T>(visitor: Visitor<T>, state: T): void;
|
|
@@ -1187,7 +1192,7 @@ export interface BabelFile {
|
|
|
1187
1192
|
watchFiles: string[]
|
|
1188
1193
|
}
|
|
1189
1194
|
},
|
|
1190
|
-
markoOpts: import('@marko/compiler').Config
|
|
1195
|
+
markoOpts: Required<import('@marko/compiler').Config>
|
|
1191
1196
|
}
|
|
1192
1197
|
|
|
1193
1198
|
export interface HubInterface {
|
package/dist/types.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ interface BaseNode {
|
|
|
42
42
|
extra?: Record<string, unknown>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
|
|
45
|
+
export type Node = Accessor | AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
|
|
46
46
|
|
|
47
47
|
export interface ArrayExpression extends BaseNode {
|
|
48
48
|
type: "ArrayExpression";
|
|
@@ -407,7 +407,7 @@ export interface ArrowFunctionExpression extends BaseNode {
|
|
|
407
407
|
|
|
408
408
|
export interface ClassBody extends BaseNode {
|
|
409
409
|
type: "ClassBody";
|
|
410
|
-
body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | TSDeclareMethod | TSIndexSignature>;
|
|
410
|
+
body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock>;
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
export interface ClassExpression extends BaseNode {
|
|
@@ -619,6 +619,24 @@ export interface ClassProperty extends BaseNode {
|
|
|
619
619
|
variance: Variance | null;
|
|
620
620
|
}
|
|
621
621
|
|
|
622
|
+
export interface ClassAccessorProperty extends BaseNode {
|
|
623
|
+
type: "ClassAccessorProperty";
|
|
624
|
+
key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName;
|
|
625
|
+
value: Expression | null;
|
|
626
|
+
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
|
|
627
|
+
decorators: Array<Decorator> | null;
|
|
628
|
+
computed: boolean;
|
|
629
|
+
static: boolean;
|
|
630
|
+
abstract: boolean | null;
|
|
631
|
+
accessibility: "public" | "private" | "protected" | null;
|
|
632
|
+
declare: boolean | null;
|
|
633
|
+
definite: boolean | null;
|
|
634
|
+
optional: boolean | null;
|
|
635
|
+
override: boolean;
|
|
636
|
+
readonly: boolean | null;
|
|
637
|
+
variance: Variance | null;
|
|
638
|
+
}
|
|
639
|
+
|
|
622
640
|
export interface ClassPrivateProperty extends BaseNode {
|
|
623
641
|
type: "ClassPrivateProperty";
|
|
624
642
|
key: PrivateName;
|
|
@@ -1706,7 +1724,7 @@ export type RestProperty = RestElement;
|
|
|
1706
1724
|
*/
|
|
1707
1725
|
export type SpreadProperty = SpreadElement;
|
|
1708
1726
|
|
|
1709
|
-
export type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | ConditionalExpression | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | File | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | LabeledStatement | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | Program | ObjectExpression | ObjectMethod | ObjectProperty | RestElement | ReturnStatement | SequenceExpression | ParenthesizedExpression | SwitchCase | SwitchStatement | ThisExpression | ThrowStatement | TryStatement | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | AssignmentPattern | ArrayPattern | ArrowFunctionExpression | ClassBody | ClassExpression | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ForOfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock;
|
|
1727
|
+
export type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | ConditionalExpression | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | File | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | LabeledStatement | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | Program | ObjectExpression | ObjectMethod | ObjectProperty | RestElement | ReturnStatement | SequenceExpression | ParenthesizedExpression | SwitchCase | SwitchStatement | ThisExpression | ThrowStatement | TryStatement | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | AssignmentPattern | ArrayPattern | ArrowFunctionExpression | ClassBody | ClassExpression | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ForOfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassAccessorProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock;
|
|
1710
1728
|
export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ParenthesizedExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | OptionalMemberExpression | OptionalCallExpression | TypeCastExpression | JSXElement | JSXFragment | BindExpression | DoExpression | RecordExpression | TupleExpression | DecimalLiteral | ModuleExpression | TopicReference | PipelineTopicExpression | PipelineBareFunction | PipelinePrimaryTopicReference | TSAsExpression | TSTypeAssertion | TSNonNullExpression;
|
|
1711
1729
|
export type Binary = BinaryExpression | LogicalExpression;
|
|
1712
1730
|
export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassExpression | ClassDeclaration | ForOfStatement | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock;
|
|
@@ -1733,13 +1751,14 @@ export type Immutable = StringLiteral | NumericLiteral | NullLiteral | BooleanLi
|
|
|
1733
1751
|
export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty;
|
|
1734
1752
|
export type Method = ObjectMethod | ClassMethod | ClassPrivateMethod;
|
|
1735
1753
|
export type ObjectMember = ObjectMethod | ObjectProperty;
|
|
1736
|
-
export type Property = ObjectProperty | ClassProperty | ClassPrivateProperty;
|
|
1754
|
+
export type Property = ObjectProperty | ClassProperty | ClassAccessorProperty | ClassPrivateProperty;
|
|
1737
1755
|
export type UnaryLike = UnaryExpression | SpreadElement;
|
|
1738
1756
|
export type Pattern = AssignmentPattern | ArrayPattern | ObjectPattern;
|
|
1739
1757
|
export type Class = ClassExpression | ClassDeclaration;
|
|
1740
1758
|
export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
|
|
1741
1759
|
export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration;
|
|
1742
1760
|
export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportNamespaceSpecifier | ExportDefaultSpecifier;
|
|
1761
|
+
export type Accessor = ClassAccessorProperty;
|
|
1743
1762
|
export type Private = ClassPrivateProperty | ClassPrivateMethod | PrivateName;
|
|
1744
1763
|
export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ClassImplements | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | DeclaredPredicate | ExistsTypeAnnotation | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | InferredPredicate | InterfaceExtends | InterfaceDeclaration | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | QualifiedTypeIdentifier | StringLiteralTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | UnionTypeAnnotation | Variance | VoidTypeAnnotation | EnumDeclaration | EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody | EnumBooleanMember | EnumNumberMember | EnumStringMember | EnumDefaultedMember | IndexedAccessType | OptionalIndexedAccessType;
|
|
1745
1764
|
export type FlowType = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ExistsTypeAnnotation | FunctionTypeAnnotation | GenericTypeAnnotation | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | StringLiteralTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | UnionTypeAnnotation | VoidTypeAnnotation | IndexedAccessType | OptionalIndexedAccessType;
|
|
@@ -1792,6 +1811,7 @@ export interface Aliases {
|
|
|
1792
1811
|
ModuleDeclaration: ModuleDeclaration;
|
|
1793
1812
|
ExportDeclaration: ExportDeclaration;
|
|
1794
1813
|
ModuleSpecifier: ModuleSpecifier;
|
|
1814
|
+
Accessor: Accessor;
|
|
1795
1815
|
Private: Private;
|
|
1796
1816
|
Flow: Flow;
|
|
1797
1817
|
FlowType: FlowType;
|
|
@@ -1864,7 +1884,7 @@ export function withStatement(object: Expression, body: Statement): WithStatemen
|
|
|
1864
1884
|
export function assignmentPattern(left: Identifier | ObjectPattern | ArrayPattern | MemberExpression, right: Expression): AssignmentPattern;
|
|
1865
1885
|
export function arrayPattern(elements: Array<null | PatternLike>): ArrayPattern;
|
|
1866
1886
|
export function arrowFunctionExpression(params: Array<Identifier | Pattern | RestElement>, body: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression;
|
|
1867
|
-
export function classBody(body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | TSDeclareMethod | TSIndexSignature>): ClassBody;
|
|
1887
|
+
export function classBody(body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock>): ClassBody;
|
|
1868
1888
|
export function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array<Decorator> | null): ClassExpression;
|
|
1869
1889
|
export function classDeclaration(id: Identifier, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array<Decorator> | null): ClassDeclaration;
|
|
1870
1890
|
export function exportAllDeclaration(source: StringLiteral): ExportAllDeclaration;
|
|
@@ -1894,6 +1914,7 @@ export function exportNamespaceSpecifier(exported: Identifier): ExportNamespaceS
|
|
|
1894
1914
|
export function optionalMemberExpression(object: Expression, property: Expression | Identifier, computed: boolean | undefined, optional: boolean): OptionalMemberExpression;
|
|
1895
1915
|
export function optionalCallExpression(callee: Expression, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>, optional: boolean): OptionalCallExpression;
|
|
1896
1916
|
export function classProperty(key: Identifier | StringLiteral | NumericLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassProperty;
|
|
1917
|
+
export function classAccessorProperty(key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassAccessorProperty;
|
|
1897
1918
|
export function classPrivateProperty(key: PrivateName, value: Expression | null | undefined, decorators: Array<Decorator> | null | undefined, _static: any): ClassPrivateProperty;
|
|
1898
1919
|
export function classPrivateMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
|
|
1899
1920
|
export function privateName(id: Identifier): PrivateName;
|
|
@@ -2070,6 +2091,8 @@ export function markoAttribute(name: string, value: Expression, modifier?: strin
|
|
|
2070
2091
|
export function markoSpreadAttribute(value: Expression): MarkoSpreadAttribute;
|
|
2071
2092
|
export function markoTagBody(body?: Array<MarkoTag | MarkoCDATA | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoComment>, params?: Array<Identifier | Pattern | RestElement>): MarkoTagBody;
|
|
2072
2093
|
export function markoTag(name: Expression, attributes: Array<MarkoAttribute | MarkoSpreadAttribute> | undefined, body: MarkoTagBody, _arguments?: Array<Expression | SpreadElement> | null, _var?: LVal | null): MarkoTag;
|
|
2094
|
+
export function isAccessor(node: object | null | undefined, opts?: object | null): node is Accessor;
|
|
2095
|
+
export function assertAccessor(node: object | null | undefined, opts?: object | null): void;
|
|
2073
2096
|
export function isAnyTypeAnnotation(node: object | null | undefined, opts?: object | null): node is AnyTypeAnnotation;
|
|
2074
2097
|
export function assertAnyTypeAnnotation(node: object | null | undefined, opts?: object | null): void;
|
|
2075
2098
|
export function isArgumentPlaceholder(node: object | null | undefined, opts?: object | null): node is ArgumentPlaceholder;
|
|
@@ -2116,6 +2139,8 @@ export function isCatchClause(node: object | null | undefined, opts?: object | n
|
|
|
2116
2139
|
export function assertCatchClause(node: object | null | undefined, opts?: object | null): void;
|
|
2117
2140
|
export function isClass(node: object | null | undefined, opts?: object | null): node is Class;
|
|
2118
2141
|
export function assertClass(node: object | null | undefined, opts?: object | null): void;
|
|
2142
|
+
export function isClassAccessorProperty(node: object | null | undefined, opts?: object | null): node is ClassAccessorProperty;
|
|
2143
|
+
export function assertClassAccessorProperty(node: object | null | undefined, opts?: object | null): void;
|
|
2119
2144
|
export function isClassBody(node: object | null | undefined, opts?: object | null): node is ClassBody;
|
|
2120
2145
|
export function assertClassBody(node: object | null | undefined, opts?: object | null): void;
|
|
2121
2146
|
export function isClassDeclaration(node: object | null | undefined, opts?: object | null): node is ClassDeclaration;
|
package/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ type Dep = {
|
|
|
16
16
|
|
|
17
17
|
export type Config = {
|
|
18
18
|
output?: "html" | "dom" | "hydrate" | "migrate" | "source";
|
|
19
|
-
runtimeId?: string;
|
|
19
|
+
runtimeId?: string | null;
|
|
20
20
|
ast?: boolean;
|
|
21
21
|
code?: boolean;
|
|
22
22
|
writeVersionComment?: boolean;
|
|
@@ -25,7 +25,7 @@ export type Config = {
|
|
|
25
25
|
translator?: any;
|
|
26
26
|
fileSystem?: typeof import("fs");
|
|
27
27
|
modules?: "esm" | "cjs";
|
|
28
|
-
resolveVirtualDependency
|
|
28
|
+
resolveVirtualDependency?: ((filename: string, dep: { virtualPath: string, code: string, map?: SourceMap }) => string) | null;
|
|
29
29
|
hydrateIncludeImports?: RegExp | ((request: string) => boolean);
|
|
30
30
|
optimize?: boolean;
|
|
31
31
|
cache?: Map<unknown, unknown>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
3
|
"description": "Marko template to JS compiler.",
|
|
4
|
-
"version": "5.20.
|
|
4
|
+
"version": "5.20.9",
|
|
5
5
|
"author": "Dylan Piercey <dpiercey@ebay.com>",
|
|
6
6
|
"bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
|
|
7
7
|
"dependencies": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@babel/runtime": "^7.16.0",
|
|
14
14
|
"@babel/traverse": "^7.16.0",
|
|
15
15
|
"@babel/types": "^7.16.0",
|
|
16
|
-
"@marko/babel-utils": "^5.20.
|
|
16
|
+
"@marko/babel-utils": "^5.20.9",
|
|
17
17
|
"complain": "^1.6.0",
|
|
18
18
|
"he": "^1.2.0",
|
|
19
|
-
"htmljs-parser": "^
|
|
19
|
+
"htmljs-parser": "^3.3.1",
|
|
20
20
|
"jsesc": "^3.0.2",
|
|
21
21
|
"lasso-package-root": "^1.0.1",
|
|
22
22
|
"property-handlers": "^1.1.1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"strip-json-comments": "^3.1.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@marko/translator-default": "^5.20.
|
|
31
|
+
"@marko/translator-default": "^5.20.9"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dist",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "637f064c6c8c5c9767d2f6e8a645937eca874a49"
|
|
63
63
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.default = void 0;var _babelUtils = require("@marko/babel-utils");var _default =
|
|
2
|
-
|
|
3
|
-
(file, details) => {
|
|
4
|
-
if (details) {
|
|
5
|
-
let startPos = details.pos;
|
|
6
|
-
|
|
7
|
-
if (file.code[startPos] !== "(" && file.code[startPos + 1] === "(") {
|
|
8
|
-
// Fix bug in htmljs-parser with attribute argument positions
|
|
9
|
-
startPos++;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return (0, _babelUtils.parseExpression)(file, `_(${details.value})`, startPos - 1).arguments;
|
|
13
|
-
}
|
|
14
|
-
};exports.default = _default;
|
|
15
|
-
//# sourceMappingURL=parse-arguments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/babel-plugin/util/parse-arguments.js"],"names":["file","details","startPos","pos","code","value","arguments"],"mappings":"gEAAA,gD;;AAEe,CAACA,IAAD,EAAOC,OAAP,KAAmB;AAChC,MAAIA,OAAJ,EAAa;AACX,QAAIC,QAAQ,GAAGD,OAAO,CAACE,GAAvB;;AAEA,QAAIH,IAAI,CAACI,IAAL,CAAUF,QAAV,MAAwB,GAAxB,IAA+BF,IAAI,CAACI,IAAL,CAAUF,QAAQ,GAAG,CAArB,MAA4B,GAA/D,EAAoE;AAClE;AACAA,MAAAA,QAAQ;AACT;;AAED,WAAO,iCAAgBF,IAAhB,EAAuB,KAAIC,OAAO,CAACI,KAAM,GAAzC,EAA6CH,QAAQ,GAAG,CAAxD,EAA2DI,SAAlE;AACD;AACF,C","sourcesContent":["import { parseExpression } from \"@marko/babel-utils\";\n\nexport default (file, details) => {\n if (details) {\n let startPos = details.pos;\n\n if (file.code[startPos] !== \"(\" && file.code[startPos + 1] === \"(\") {\n // Fix bug in htmljs-parser with attribute argument positions\n startPos++;\n }\n\n return parseExpression(file, `_(${details.value})`, startPos - 1).arguments;\n }\n};\n"],"file":"parse-arguments.js"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var t = _interopRequireWildcard(require("../../babel-types"));
|
|
2
|
-
var _babelUtils = require("@marko/babel-utils");
|
|
3
|
-
var _parseArguments = _interopRequireDefault(require("./parse-arguments"));function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}var _default =
|
|
4
|
-
|
|
5
|
-
(file, attributes, startPos) => {
|
|
6
|
-
const code = file.code;
|
|
7
|
-
let attrEndPos = startPos;
|
|
8
|
-
|
|
9
|
-
return attributes.map((attr) => {
|
|
10
|
-
let attrStartPos = attr.default ?
|
|
11
|
-
attr.pos :
|
|
12
|
-
code.indexOf(attr.name, attrEndPos);
|
|
13
|
-
|
|
14
|
-
if (attr.name.startsWith("...")) {
|
|
15
|
-
let attrExpression = attr.name.slice(3);
|
|
16
|
-
|
|
17
|
-
if (attr.argument) {
|
|
18
|
-
attrExpression += `(${attr.argument.value})`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
attrEndPos = attrStartPos + attrExpression.length;
|
|
22
|
-
|
|
23
|
-
const value = (0, _babelUtils.parseExpression)(file, attrExpression, attrStartPos + 3);
|
|
24
|
-
|
|
25
|
-
// TODO: Inline merge object literals.
|
|
26
|
-
return (0, _babelUtils.withLoc)(
|
|
27
|
-
file,
|
|
28
|
-
t.markoSpreadAttribute(value),
|
|
29
|
-
attrStartPos,
|
|
30
|
-
attrEndPos);
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const match = /:(.*)$/.exec(attr.name);
|
|
35
|
-
const modifier = match && match[1];
|
|
36
|
-
let name = attr.name;
|
|
37
|
-
let value;
|
|
38
|
-
|
|
39
|
-
if (modifier) {
|
|
40
|
-
name = name.slice(0, name.length - modifier.length - 1);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (attr.value) {
|
|
44
|
-
attrEndPos = attr.endPos;
|
|
45
|
-
|
|
46
|
-
if (attr.method) {
|
|
47
|
-
if (code[attrStartPos] !== "(") {
|
|
48
|
-
// fix bug in htmljs parser position.
|
|
49
|
-
attrStartPos = code.indexOf("(", attrStartPos);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (code[attrEndPos] === "}") {
|
|
53
|
-
// fix bug in htmljs parser position.
|
|
54
|
-
attrEndPos++;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const prefix = "function";
|
|
58
|
-
value = (0, _babelUtils.parseExpression)(
|
|
59
|
-
file,
|
|
60
|
-
prefix + code.slice(attrStartPos, attrEndPos), // We use the raw value to ignore things like non standard placeholders.
|
|
61
|
-
attrStartPos - prefix.length);
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
const valueStart = attr.pos + 1; // Add one to account for "=".
|
|
65
|
-
const rawValue = code.slice(valueStart, attrEndPos); // We use the raw value to ignore things like non standard placeholders.
|
|
66
|
-
|
|
67
|
-
value = (0, _babelUtils.parseExpression)(file, rawValue, valueStart);
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
attrEndPos = attr.argument ? attr.argument.endPos + 1 : attr.endPos;
|
|
71
|
-
value = t.booleanLiteral(true);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (0, _babelUtils.withLoc)(
|
|
75
|
-
file,
|
|
76
|
-
t.markoAttribute(
|
|
77
|
-
name,
|
|
78
|
-
value,
|
|
79
|
-
modifier,
|
|
80
|
-
(0, _parseArguments.default)(file, attr.argument),
|
|
81
|
-
Boolean(attr.default),
|
|
82
|
-
Boolean(attr.bound)),
|
|
83
|
-
|
|
84
|
-
attrStartPos,
|
|
85
|
-
attrEndPos);
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
};exports.default = _default;
|
|
89
|
-
//# sourceMappingURL=parse-attributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/babel-plugin/util/parse-attributes.js"],"names":["file","attributes","startPos","code","attrEndPos","map","attr","attrStartPos","default","pos","indexOf","name","startsWith","attrExpression","slice","argument","value","length","t","markoSpreadAttribute","match","exec","modifier","endPos","method","prefix","valueStart","rawValue","booleanLiteral","markoAttribute","Boolean","bound"],"mappings":"qJAAA;AACA;AACA,2E;;AAEe,CAACA,IAAD,EAAOC,UAAP,EAAmBC,QAAnB,KAAgC;AAC7C,QAAMC,IAAI,GAAGH,IAAI,CAACG,IAAlB;AACA,MAAIC,UAAU,GAAGF,QAAjB;;AAEA,SAAOD,UAAU,CAACI,GAAX,CAAe,CAAAC,IAAI,KAAI;AAC5B,QAAIC,YAAY,GAAGD,IAAI,CAACE,OAAL;AACfF,IAAAA,IAAI,CAACG,GADU;AAEfN,IAAAA,IAAI,CAACO,OAAL,CAAaJ,IAAI,CAACK,IAAlB,EAAwBP,UAAxB,CAFJ;;AAIA,QAAIE,IAAI,CAACK,IAAL,CAAUC,UAAV,CAAqB,KAArB,CAAJ,EAAiC;AAC/B,UAAIC,cAAc,GAAGP,IAAI,CAACK,IAAL,CAAUG,KAAV,CAAgB,CAAhB,CAArB;;AAEA,UAAIR,IAAI,CAACS,QAAT,EAAmB;AACjBF,QAAAA,cAAc,IAAK,IAAGP,IAAI,CAACS,QAAL,CAAcC,KAAM,GAA1C;AACD;;AAE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CAACR,MAHhB,CAAR;;AAKD,OAjBD,MAiBO;AACL,cAAMS,UAAU,GAAGpB,IAAI,CAACG,GAAL,GAAW,CAA9B,CADK,CAC4B;AACjC,cAAMkB,QAAQ,GAAGxB,IAAI,CAACW,KAAL,CAAWY,UAAX,EAAuBtB,UAAvB,CAAjB,CAFK,CAEgD;;AAErDY,QAAAA,KAAK,GAAG,iCAAgBhB,IAAhB,EAAsB2B,QAAtB,EAAgCD,UAAhC,CAAR;AACD;AACF,KA1BD,MA0BO;AACLtB,MAAAA,UAAU,GAAGE,IAAI,CAACS,QAAL,GAAgBT,IAAI,CAACS,QAAL,CAAcQ,MAAd,GAAuB,CAAvC,GAA2CjB,IAAI,CAACiB,MAA7D;AACAP,MAAAA,KAAK,GAAGE,CAAC,CAACU,cAAF,CAAiB,IAAjB,CAAR;AACD;;AAED,WAAO;AACL5B,IAAAA,IADK;AAELkB,IAAAA,CAAC,CAACW,cAAF;AACElB,IAAAA,IADF;AAEEK,IAAAA,KAFF;AAGEM,IAAAA,QAHF;AAIE,iCAAetB,IAAf,EAAqBM,IAAI,CAACS,QAA1B,CAJF;AAKEe,IAAAA,OAAO,CAACxB,IAAI,CAACE,OAAN,CALT;AAMEsB,IAAAA,OAAO,CAACxB,IAAI,CAACyB,KAAN,CANT,CAFK;;AAULxB,IAAAA,YAVK;AAWLH,IAAAA,UAXK,CAAP;;AAaD,GA9EM,CAAP;AA+ED,C","sourcesContent":["import * as t from \"../../babel-types\";\nimport { withLoc, parseExpression } from \"@marko/babel-utils\";\nimport parseArguments from \"./parse-arguments\";\n\nexport default (file, attributes, startPos) => {\n const code = file.code;\n let attrEndPos = startPos;\n\n return attributes.map(attr => {\n let attrStartPos = attr.default\n ? attr.pos\n : code.indexOf(attr.name, attrEndPos);\n\n if (attr.name.startsWith(\"...\")) {\n let attrExpression = attr.name.slice(3);\n\n if (attr.argument) {\n attrExpression += `(${attr.argument.value})`;\n }\n\n attrEndPos = attrStartPos + attrExpression.length;\n\n const value = parseExpression(file, attrExpression, attrStartPos + 3);\n\n // TODO: Inline merge object literals.\n return withLoc(\n file,\n t.markoSpreadAttribute(value),\n attrStartPos,\n attrEndPos\n );\n }\n\n const match = /:(.*)$/.exec(attr.name);\n const modifier = match && match[1];\n let name = attr.name;\n let value;\n\n if (modifier) {\n name = name.slice(0, name.length - modifier.length - 1);\n }\n\n if (attr.value) {\n attrEndPos = attr.endPos;\n\n if (attr.method) {\n if (code[attrStartPos] !== \"(\") {\n // fix bug in htmljs parser position.\n attrStartPos = code.indexOf(\"(\", attrStartPos);\n }\n\n if (code[attrEndPos] === \"}\") {\n // fix bug in htmljs parser position.\n attrEndPos++;\n }\n\n const prefix = \"function\";\n value = parseExpression(\n file,\n prefix + code.slice(attrStartPos, attrEndPos), // We use the raw value to ignore things like non standard placeholders.\n attrStartPos - prefix.length\n );\n } else {\n const valueStart = attr.pos + 1; // Add one to account for \"=\".\n const rawValue = code.slice(valueStart, attrEndPos); // We use the raw value to ignore things like non standard placeholders.\n\n value = parseExpression(file, rawValue, valueStart);\n }\n } else {\n attrEndPos = attr.argument ? attr.argument.endPos + 1 : attr.endPos;\n value = t.booleanLiteral(true);\n }\n\n return withLoc(\n file,\n t.markoAttribute(\n name,\n value,\n modifier,\n parseArguments(file, attr.argument),\n Boolean(attr.default),\n Boolean(attr.bound)\n ),\n attrStartPos,\n attrEndPos\n );\n });\n};\n"],"file":"parse-attributes.js"}
|