vue.esm-bundler.min.js 1.2 KB

12
  1. import*as runtimeDom from"@vue/runtime-dom";import{initCustomFormatter,warn,registerRuntimeCompiler}from"@vue/runtime-dom";export*from"@vue/runtime-dom";import{compile}from"@vue/compiler-dom";import{isString,NOOP,extend,generateCodeFrame}from"@vue/shared";function initDev(){initCustomFormatter()}"production"!==process.env.NODE_ENV&&initDev();const compileCache=Object.create(null);function compileToFunction(r,e){if(!isString(r)){if(!r.nodeType)return"production"!==process.env.NODE_ENV&&warn("invalid template option: ",r),NOOP;r=r.innerHTML}var o=r,n=compileCache[o];if(n)return n;"#"===r[0]&&(n=document.querySelector(r),"production"===process.env.NODE_ENV||n||warn("Template element not found or is empty: "+r),r=n?n.innerHTML:"");n=compile(r,extend({hoistStatic:!0,onError:"production"!==process.env.NODE_ENV?t:void 0,onWarn:"production"!==process.env.NODE_ENV?e=>t(e,!0):NOOP},e)).code;function t(e,o=!1){o=o?e.message:"Template compilation error: "+e.message,e=e.loc&&generateCodeFrame(r,e.loc.start.offset,e.loc.end.offset);warn(e?o+`
  2. `+e:o)}const i=new Function("Vue",n)(runtimeDom);return i._rc=!0,compileCache[o]=i}registerRuntimeCompiler(compileToFunction);export{compileToFunction as compile};