vue.cjs.prod.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * vue v3.4.23
  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__ */ new WeakMap();
  23. function getCache(options) {
  24. let c = compileCache.get(options != null ? options : shared.EMPTY_OBJ);
  25. if (!c) {
  26. c = /* @__PURE__ */ Object.create(null);
  27. compileCache.set(options != null ? options : shared.EMPTY_OBJ, c);
  28. }
  29. return c;
  30. }
  31. function compileToFunction(template, options) {
  32. if (!shared.isString(template)) {
  33. if (template.nodeType) {
  34. template = template.innerHTML;
  35. } else {
  36. return shared.NOOP;
  37. }
  38. }
  39. const key = template;
  40. const cache = getCache(options);
  41. const cached = cache[key];
  42. if (cached) {
  43. return cached;
  44. }
  45. if (template[0] === "#") {
  46. const el = document.querySelector(template);
  47. template = el ? el.innerHTML : ``;
  48. }
  49. const opts = shared.extend(
  50. {
  51. hoistStatic: true,
  52. onError: void 0,
  53. onWarn: shared.NOOP
  54. },
  55. options
  56. );
  57. if (!opts.isCustomElement && typeof customElements !== "undefined") {
  58. opts.isCustomElement = (tag) => !!customElements.get(tag);
  59. }
  60. const { code } = compilerDom.compile(template, opts);
  61. const render = new Function("Vue", code)(runtimeDom__namespace);
  62. render._rc = true;
  63. return cache[key] = render;
  64. }
  65. runtimeDom.registerRuntimeCompiler(compileToFunction);
  66. exports.compile = compileToFunction;
  67. Object.keys(runtimeDom).forEach(function (k) {
  68. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
  69. });