vue.cjs.prod.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * vue v3.5.12
  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 compilerDom = require('@vue/compiler-dom');
  9. var runtimeDom = require('@vue/runtime-dom');
  10. var shared = require('@vue/shared');
  11. function _interopNamespaceDefault(e) {
  12. var n = Object.create(null);
  13. if (e) {
  14. for (var k in e) {
  15. n[k] = e[k];
  16. }
  17. }
  18. n.default = e;
  19. return Object.freeze(n);
  20. }
  21. var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
  22. const compileCache = /* @__PURE__ */ Object.create(null);
  23. function compileToFunction(template, options) {
  24. if (!shared.isString(template)) {
  25. if (template.nodeType) {
  26. template = template.innerHTML;
  27. } else {
  28. return shared.NOOP;
  29. }
  30. }
  31. const key = shared.genCacheKey(template, options);
  32. const cached = compileCache[key];
  33. if (cached) {
  34. return cached;
  35. }
  36. if (template[0] === "#") {
  37. const el = document.querySelector(template);
  38. template = el ? el.innerHTML : ``;
  39. }
  40. const opts = shared.extend(
  41. {
  42. hoistStatic: true,
  43. onError: void 0,
  44. onWarn: shared.NOOP
  45. },
  46. options
  47. );
  48. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  49. opts.isCustomElement = (tag) => !!customElements.get(tag);
  50. }
  51. const { code } = compilerDom.compile(template, opts);
  52. const render = new Function("Vue", code)(runtimeDom__namespace);
  53. render._rc = true;
  54. return compileCache[key] = render;
  55. }
  56. runtimeDom.registerRuntimeCompiler(compileToFunction);
  57. exports.compile = compileToFunction;
  58. Object.keys(runtimeDom).forEach(function (k) {
  59. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
  60. });