Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compiler-dom.cjs.prod.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /**
  2. * @vue/compiler-dom v3.4.38
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. var compilerCore = require('@vue/compiler-core');
  9. var shared = require('@vue/shared');
  10. const V_MODEL_RADIO = Symbol(``);
  11. const V_MODEL_CHECKBOX = Symbol(``);
  12. const V_MODEL_TEXT = Symbol(``);
  13. const V_MODEL_SELECT = Symbol(``);
  14. const V_MODEL_DYNAMIC = Symbol(``);
  15. const V_ON_WITH_MODIFIERS = Symbol(``);
  16. const V_ON_WITH_KEYS = Symbol(``);
  17. const V_SHOW = Symbol(``);
  18. const TRANSITION = Symbol(``);
  19. const TRANSITION_GROUP = Symbol(``);
  20. compilerCore.registerRuntimeHelpers({
  21. [V_MODEL_RADIO]: `vModelRadio`,
  22. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  23. [V_MODEL_TEXT]: `vModelText`,
  24. [V_MODEL_SELECT]: `vModelSelect`,
  25. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  26. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  27. [V_ON_WITH_KEYS]: `withKeys`,
  28. [V_SHOW]: `vShow`,
  29. [TRANSITION]: `Transition`,
  30. [TRANSITION_GROUP]: `TransitionGroup`
  31. });
  32. const parserOptions = {
  33. parseMode: "html",
  34. isVoidTag: shared.isVoidTag,
  35. isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
  36. isPreTag: (tag) => tag === "pre",
  37. decodeEntities: void 0,
  38. isBuiltInComponent: (tag) => {
  39. if (tag === "Transition" || tag === "transition") {
  40. return TRANSITION;
  41. } else if (tag === "TransitionGroup" || tag === "transition-group") {
  42. return TRANSITION_GROUP;
  43. }
  44. },
  45. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  46. getNamespace(tag, parent, rootNamespace) {
  47. let ns = parent ? parent.ns : rootNamespace;
  48. if (parent && ns === 2) {
  49. if (parent.tag === "annotation-xml") {
  50. if (tag === "svg") {
  51. return 1;
  52. }
  53. if (parent.props.some(
  54. (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
  55. )) {
  56. ns = 0;
  57. }
  58. } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
  59. ns = 0;
  60. }
  61. } else if (parent && ns === 1) {
  62. if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
  63. ns = 0;
  64. }
  65. }
  66. if (ns === 0) {
  67. if (tag === "svg") {
  68. return 1;
  69. }
  70. if (tag === "math") {
  71. return 2;
  72. }
  73. }
  74. return ns;
  75. }
  76. };
  77. const transformStyle = (node) => {
  78. if (node.type === 1) {
  79. node.props.forEach((p, i) => {
  80. if (p.type === 6 && p.name === "style" && p.value) {
  81. node.props[i] = {
  82. type: 7,
  83. name: `bind`,
  84. arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
  85. exp: parseInlineCSS(p.value.content, p.loc),
  86. modifiers: [],
  87. loc: p.loc
  88. };
  89. }
  90. });
  91. }
  92. };
  93. const parseInlineCSS = (cssText, loc) => {
  94. const normalized = shared.parseStringStyle(cssText);
  95. return compilerCore.createSimpleExpression(
  96. JSON.stringify(normalized),
  97. false,
  98. loc,
  99. 3
  100. );
  101. };
  102. function createDOMCompilerError(code, loc) {
  103. return compilerCore.createCompilerError(
  104. code,
  105. loc,
  106. DOMErrorMessages
  107. );
  108. }
  109. const DOMErrorCodes = {
  110. "X_V_HTML_NO_EXPRESSION": 53,
  111. "53": "X_V_HTML_NO_EXPRESSION",
  112. "X_V_HTML_WITH_CHILDREN": 54,
  113. "54": "X_V_HTML_WITH_CHILDREN",
  114. "X_V_TEXT_NO_EXPRESSION": 55,
  115. "55": "X_V_TEXT_NO_EXPRESSION",
  116. "X_V_TEXT_WITH_CHILDREN": 56,
  117. "56": "X_V_TEXT_WITH_CHILDREN",
  118. "X_V_MODEL_ON_INVALID_ELEMENT": 57,
  119. "57": "X_V_MODEL_ON_INVALID_ELEMENT",
  120. "X_V_MODEL_ARG_ON_ELEMENT": 58,
  121. "58": "X_V_MODEL_ARG_ON_ELEMENT",
  122. "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
  123. "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
  124. "X_V_MODEL_UNNECESSARY_VALUE": 60,
  125. "60": "X_V_MODEL_UNNECESSARY_VALUE",
  126. "X_V_SHOW_NO_EXPRESSION": 61,
  127. "61": "X_V_SHOW_NO_EXPRESSION",
  128. "X_TRANSITION_INVALID_CHILDREN": 62,
  129. "62": "X_TRANSITION_INVALID_CHILDREN",
  130. "X_IGNORED_SIDE_EFFECT_TAG": 63,
  131. "63": "X_IGNORED_SIDE_EFFECT_TAG",
  132. "__EXTEND_POINT__": 64,
  133. "64": "__EXTEND_POINT__"
  134. };
  135. const DOMErrorMessages = {
  136. [53]: `v-html is missing expression.`,
  137. [54]: `v-html will override element children.`,
  138. [55]: `v-text is missing expression.`,
  139. [56]: `v-text will override element children.`,
  140. [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  141. [58]: `v-model argument is not supported on plain elements.`,
  142. [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  143. [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  144. [61]: `v-show is missing expression.`,
  145. [62]: `<Transition> expects exactly one child element or component.`,
  146. [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  147. };
  148. const transformVHtml = (dir, node, context) => {
  149. const { exp, loc } = dir;
  150. if (!exp) {
  151. context.onError(
  152. createDOMCompilerError(53, loc)
  153. );
  154. }
  155. if (node.children.length) {
  156. context.onError(
  157. createDOMCompilerError(54, loc)
  158. );
  159. node.children.length = 0;
  160. }
  161. return {
  162. props: [
  163. compilerCore.createObjectProperty(
  164. compilerCore.createSimpleExpression(`innerHTML`, true, loc),
  165. exp || compilerCore.createSimpleExpression("", true)
  166. )
  167. ]
  168. };
  169. };
  170. const transformVText = (dir, node, context) => {
  171. const { exp, loc } = dir;
  172. if (!exp) {
  173. context.onError(
  174. createDOMCompilerError(55, loc)
  175. );
  176. }
  177. if (node.children.length) {
  178. context.onError(
  179. createDOMCompilerError(56, loc)
  180. );
  181. node.children.length = 0;
  182. }
  183. return {
  184. props: [
  185. compilerCore.createObjectProperty(
  186. compilerCore.createSimpleExpression(`textContent`, true),
  187. exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
  188. context.helperString(compilerCore.TO_DISPLAY_STRING),
  189. [exp],
  190. loc
  191. ) : compilerCore.createSimpleExpression("", true)
  192. )
  193. ]
  194. };
  195. };
  196. const transformModel = (dir, node, context) => {
  197. const baseResult = compilerCore.transformModel(dir, node, context);
  198. if (!baseResult.props.length || node.tagType === 1) {
  199. return baseResult;
  200. }
  201. if (dir.arg) {
  202. context.onError(
  203. createDOMCompilerError(
  204. 58,
  205. dir.arg.loc
  206. )
  207. );
  208. }
  209. const { tag } = node;
  210. const isCustomElement = context.isCustomElement(tag);
  211. if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
  212. let directiveToUse = V_MODEL_TEXT;
  213. let isInvalidType = false;
  214. if (tag === "input" || isCustomElement) {
  215. const type = compilerCore.findProp(node, `type`);
  216. if (type) {
  217. if (type.type === 7) {
  218. directiveToUse = V_MODEL_DYNAMIC;
  219. } else if (type.value) {
  220. switch (type.value.content) {
  221. case "radio":
  222. directiveToUse = V_MODEL_RADIO;
  223. break;
  224. case "checkbox":
  225. directiveToUse = V_MODEL_CHECKBOX;
  226. break;
  227. case "file":
  228. isInvalidType = true;
  229. context.onError(
  230. createDOMCompilerError(
  231. 59,
  232. dir.loc
  233. )
  234. );
  235. break;
  236. }
  237. }
  238. } else if (compilerCore.hasDynamicKeyVBind(node)) {
  239. directiveToUse = V_MODEL_DYNAMIC;
  240. } else ;
  241. } else if (tag === "select") {
  242. directiveToUse = V_MODEL_SELECT;
  243. } else ;
  244. if (!isInvalidType) {
  245. baseResult.needRuntime = context.helper(directiveToUse);
  246. }
  247. } else {
  248. context.onError(
  249. createDOMCompilerError(
  250. 57,
  251. dir.loc
  252. )
  253. );
  254. }
  255. baseResult.props = baseResult.props.filter(
  256. (p) => !(p.key.type === 4 && p.key.content === "modelValue")
  257. );
  258. return baseResult;
  259. };
  260. const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
  261. const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
  262. // event propagation management
  263. `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
  264. );
  265. const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
  266. const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
  267. `onkeyup,onkeydown,onkeypress`,
  268. true
  269. );
  270. const resolveModifiers = (key, modifiers, context, loc) => {
  271. const keyModifiers = [];
  272. const nonKeyModifiers = [];
  273. const eventOptionModifiers = [];
  274. for (let i = 0; i < modifiers.length; i++) {
  275. const modifier = modifiers[i];
  276. if (modifier === "native" && compilerCore.checkCompatEnabled(
  277. "COMPILER_V_ON_NATIVE",
  278. context,
  279. loc
  280. )) {
  281. eventOptionModifiers.push(modifier);
  282. } else if (isEventOptionModifier(modifier)) {
  283. eventOptionModifiers.push(modifier);
  284. } else {
  285. if (maybeKeyModifier(modifier)) {
  286. if (compilerCore.isStaticExp(key)) {
  287. if (isKeyboardEvent(key.content)) {
  288. keyModifiers.push(modifier);
  289. } else {
  290. nonKeyModifiers.push(modifier);
  291. }
  292. } else {
  293. keyModifiers.push(modifier);
  294. nonKeyModifiers.push(modifier);
  295. }
  296. } else {
  297. if (isNonKeyModifier(modifier)) {
  298. nonKeyModifiers.push(modifier);
  299. } else {
  300. keyModifiers.push(modifier);
  301. }
  302. }
  303. }
  304. }
  305. return {
  306. keyModifiers,
  307. nonKeyModifiers,
  308. eventOptionModifiers
  309. };
  310. };
  311. const transformClick = (key, event) => {
  312. const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
  313. return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
  314. `(`,
  315. key,
  316. `) === "onClick" ? "${event}" : (`,
  317. key,
  318. `)`
  319. ]) : key;
  320. };
  321. const transformOn = (dir, node, context) => {
  322. return compilerCore.transformOn(dir, node, context, (baseResult) => {
  323. const { modifiers } = dir;
  324. if (!modifiers.length) return baseResult;
  325. let { key, value: handlerExp } = baseResult.props[0];
  326. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  327. if (nonKeyModifiers.includes("right")) {
  328. key = transformClick(key, `onContextmenu`);
  329. }
  330. if (nonKeyModifiers.includes("middle")) {
  331. key = transformClick(key, `onMouseup`);
  332. }
  333. if (nonKeyModifiers.length) {
  334. handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  335. handlerExp,
  336. JSON.stringify(nonKeyModifiers)
  337. ]);
  338. }
  339. if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
  340. (!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
  341. handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
  342. handlerExp,
  343. JSON.stringify(keyModifiers)
  344. ]);
  345. }
  346. if (eventOptionModifiers.length) {
  347. const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
  348. key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  349. }
  350. return {
  351. props: [compilerCore.createObjectProperty(key, handlerExp)]
  352. };
  353. });
  354. };
  355. const transformShow = (dir, node, context) => {
  356. const { exp, loc } = dir;
  357. if (!exp) {
  358. context.onError(
  359. createDOMCompilerError(61, loc)
  360. );
  361. }
  362. return {
  363. props: [],
  364. needRuntime: context.helper(V_SHOW)
  365. };
  366. };
  367. const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
  368. const stringifyStatic = (children, context, parent) => {
  369. if (context.scopes.vSlot > 0) {
  370. return;
  371. }
  372. let nc = 0;
  373. let ec = 0;
  374. const currentChunk = [];
  375. const stringifyCurrentChunk = (currentIndex) => {
  376. if (nc >= 20 || ec >= 5) {
  377. const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
  378. JSON.stringify(
  379. currentChunk.map((node) => stringifyNode(node, context)).join("")
  380. ).replace(expReplaceRE, `" + $1 + "`),
  381. // the 2nd argument indicates the number of DOM nodes this static vnode
  382. // will insert / hydrate
  383. String(currentChunk.length)
  384. ]);
  385. replaceHoist(currentChunk[0], staticCall, context);
  386. if (currentChunk.length > 1) {
  387. for (let i2 = 1; i2 < currentChunk.length; i2++) {
  388. replaceHoist(currentChunk[i2], null, context);
  389. }
  390. const deleteCount = currentChunk.length - 1;
  391. children.splice(currentIndex - currentChunk.length + 1, deleteCount);
  392. return deleteCount;
  393. }
  394. }
  395. return 0;
  396. };
  397. let i = 0;
  398. for (; i < children.length; i++) {
  399. const child = children[i];
  400. const hoisted = getHoistedNode(child);
  401. if (hoisted) {
  402. const node = child;
  403. const result = analyzeNode(node);
  404. if (result) {
  405. nc += result[0];
  406. ec += result[1];
  407. currentChunk.push(node);
  408. continue;
  409. }
  410. }
  411. i -= stringifyCurrentChunk(i);
  412. nc = 0;
  413. ec = 0;
  414. currentChunk.length = 0;
  415. }
  416. stringifyCurrentChunk(i);
  417. };
  418. const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
  419. const dataAriaRE = /^(data|aria)-/;
  420. const isStringifiableAttr = (name, ns) => {
  421. return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
  422. };
  423. const replaceHoist = (node, replacement, context) => {
  424. const hoistToReplace = node.codegenNode.hoisted;
  425. context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
  426. };
  427. const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
  428. `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
  429. );
  430. function analyzeNode(node) {
  431. if (node.type === 1 && isNonStringifiable(node.tag)) {
  432. return false;
  433. }
  434. if (node.type === 12) {
  435. return [1, 0];
  436. }
  437. let nc = 1;
  438. let ec = node.props.length > 0 ? 1 : 0;
  439. let bailed = false;
  440. const bail = () => {
  441. bailed = true;
  442. return false;
  443. };
  444. function walk(node2) {
  445. const isOptionTag = node2.tag === "option" && node2.ns === 0;
  446. for (let i = 0; i < node2.props.length; i++) {
  447. const p = node2.props[i];
  448. if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
  449. return bail();
  450. }
  451. if (p.type === 7 && p.name === "bind") {
  452. if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
  453. return bail();
  454. }
  455. if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
  456. return bail();
  457. }
  458. if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
  459. return bail();
  460. }
  461. }
  462. }
  463. for (let i = 0; i < node2.children.length; i++) {
  464. nc++;
  465. const child = node2.children[i];
  466. if (child.type === 1) {
  467. if (child.props.length > 0) {
  468. ec++;
  469. }
  470. walk(child);
  471. if (bailed) {
  472. return false;
  473. }
  474. }
  475. }
  476. return true;
  477. }
  478. return walk(node) ? [nc, ec] : false;
  479. }
  480. function stringifyNode(node, context) {
  481. if (shared.isString(node)) {
  482. return node;
  483. }
  484. if (shared.isSymbol(node)) {
  485. return ``;
  486. }
  487. switch (node.type) {
  488. case 1:
  489. return stringifyElement(node, context);
  490. case 2:
  491. return shared.escapeHtml(node.content);
  492. case 3:
  493. return `<!--${shared.escapeHtml(node.content)}-->`;
  494. case 5:
  495. return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
  496. case 8:
  497. return shared.escapeHtml(evaluateConstant(node));
  498. case 12:
  499. return stringifyNode(node.content, context);
  500. default:
  501. return "";
  502. }
  503. }
  504. function stringifyElement(node, context) {
  505. let res = `<${node.tag}`;
  506. let innerHTML = "";
  507. for (let i = 0; i < node.props.length; i++) {
  508. const p = node.props[i];
  509. if (p.type === 6) {
  510. res += ` ${p.name}`;
  511. if (p.value) {
  512. res += `="${shared.escapeHtml(p.value.content)}"`;
  513. }
  514. } else if (p.type === 7) {
  515. if (p.name === "bind") {
  516. const exp = p.exp;
  517. if (exp.content[0] === "_") {
  518. res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
  519. continue;
  520. }
  521. if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
  522. continue;
  523. }
  524. let evaluated = evaluateConstant(exp);
  525. if (evaluated != null) {
  526. const arg = p.arg && p.arg.content;
  527. if (arg === "class") {
  528. evaluated = shared.normalizeClass(evaluated);
  529. } else if (arg === "style") {
  530. evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
  531. }
  532. res += ` ${p.arg.content}="${shared.escapeHtml(
  533. evaluated
  534. )}"`;
  535. }
  536. } else if (p.name === "html") {
  537. innerHTML = evaluateConstant(p.exp);
  538. } else if (p.name === "text") {
  539. innerHTML = shared.escapeHtml(
  540. shared.toDisplayString(evaluateConstant(p.exp))
  541. );
  542. }
  543. }
  544. }
  545. if (context.scopeId) {
  546. res += ` ${context.scopeId}`;
  547. }
  548. res += `>`;
  549. if (innerHTML) {
  550. res += innerHTML;
  551. } else {
  552. for (let i = 0; i < node.children.length; i++) {
  553. res += stringifyNode(node.children[i], context);
  554. }
  555. }
  556. if (!shared.isVoidTag(node.tag)) {
  557. res += `</${node.tag}>`;
  558. }
  559. return res;
  560. }
  561. function evaluateConstant(exp) {
  562. if (exp.type === 4) {
  563. return new Function(`return (${exp.content})`)();
  564. } else {
  565. let res = ``;
  566. exp.children.forEach((c) => {
  567. if (shared.isString(c) || shared.isSymbol(c)) {
  568. return;
  569. }
  570. if (c.type === 2) {
  571. res += c.content;
  572. } else if (c.type === 5) {
  573. res += shared.toDisplayString(evaluateConstant(c.content));
  574. } else {
  575. res += evaluateConstant(c);
  576. }
  577. });
  578. return res;
  579. }
  580. }
  581. const ignoreSideEffectTags = (node, context) => {
  582. if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
  583. context.removeNode();
  584. }
  585. };
  586. const DOMNodeTransforms = [
  587. transformStyle,
  588. ...[]
  589. ];
  590. const DOMDirectiveTransforms = {
  591. cloak: compilerCore.noopDirectiveTransform,
  592. html: transformVHtml,
  593. text: transformVText,
  594. model: transformModel,
  595. // override compiler-core
  596. on: transformOn,
  597. // override compiler-core
  598. show: transformShow
  599. };
  600. function compile(src, options = {}) {
  601. return compilerCore.baseCompile(
  602. src,
  603. shared.extend({}, parserOptions, options, {
  604. nodeTransforms: [
  605. // ignore <script> and <tag>
  606. // this is not put inside DOMNodeTransforms because that list is used
  607. // by compiler-ssr to generate vnode fallback branches
  608. ignoreSideEffectTags,
  609. ...DOMNodeTransforms,
  610. ...options.nodeTransforms || []
  611. ],
  612. directiveTransforms: shared.extend(
  613. {},
  614. DOMDirectiveTransforms,
  615. options.directiveTransforms || {}
  616. ),
  617. transformHoist: stringifyStatic
  618. })
  619. );
  620. }
  621. function parse(template, options = {}) {
  622. return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
  623. }
  624. exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
  625. exports.DOMErrorCodes = DOMErrorCodes;
  626. exports.DOMErrorMessages = DOMErrorMessages;
  627. exports.DOMNodeTransforms = DOMNodeTransforms;
  628. exports.TRANSITION = TRANSITION;
  629. exports.TRANSITION_GROUP = TRANSITION_GROUP;
  630. exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
  631. exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
  632. exports.V_MODEL_RADIO = V_MODEL_RADIO;
  633. exports.V_MODEL_SELECT = V_MODEL_SELECT;
  634. exports.V_MODEL_TEXT = V_MODEL_TEXT;
  635. exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
  636. exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
  637. exports.V_SHOW = V_SHOW;
  638. exports.compile = compile;
  639. exports.createDOMCompilerError = createDOMCompilerError;
  640. exports.parse = parse;
  641. exports.parserOptions = parserOptions;
  642. exports.transformStyle = transformStyle;
  643. Object.keys(compilerCore).forEach(function (k) {
  644. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
  645. });