vue 3.2.40 → 3.2.41

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.
@@ -4,68 +4,68 @@ export * from '@vue/runtime-dom';
4
4
  import { compile } from '@vue/compiler-dom';
5
5
  import { isString, NOOP, extend, generateCodeFrame } from '@vue/shared';
6
6
 
7
- function initDev() {
8
- {
9
- initCustomFormatter();
10
- }
7
+ function initDev() {
8
+ {
9
+ initCustomFormatter();
10
+ }
11
11
  }
12
12
 
13
- // This entry is the "full-build" that includes both the runtime
14
- if ((process.env.NODE_ENV !== 'production')) {
15
- initDev();
16
- }
17
- const compileCache = Object.create(null);
18
- function compileToFunction(template, options) {
19
- if (!isString(template)) {
20
- if (template.nodeType) {
21
- template = template.innerHTML;
22
- }
23
- else {
24
- (process.env.NODE_ENV !== 'production') && warn(`invalid template option: `, template);
25
- return NOOP;
26
- }
27
- }
28
- const key = template;
29
- const cached = compileCache[key];
30
- if (cached) {
31
- return cached;
32
- }
33
- if (template[0] === '#') {
34
- const el = document.querySelector(template);
35
- if ((process.env.NODE_ENV !== 'production') && !el) {
36
- warn(`Template element not found or is empty: ${template}`);
37
- }
38
- // __UNSAFE__
39
- // Reason: potential execution of JS expressions in in-DOM template.
40
- // The user must make sure the in-DOM template is trusted. If it's rendered
41
- // by the server, the template should not contain any user data.
42
- template = el ? el.innerHTML : ``;
43
- }
44
- const opts = extend({
45
- hoistStatic: true,
46
- onError: (process.env.NODE_ENV !== 'production') ? onError : undefined,
47
- onWarn: (process.env.NODE_ENV !== 'production') ? e => onError(e, true) : NOOP
48
- }, options);
49
- if (!opts.isCustomElement && typeof customElements !== 'undefined') {
50
- opts.isCustomElement = tag => !!customElements.get(tag);
51
- }
52
- const { code } = compile(template, opts);
53
- function onError(err, asWarning = false) {
54
- const message = asWarning
55
- ? err.message
56
- : `Template compilation error: ${err.message}`;
57
- const codeFrame = err.loc &&
58
- generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
59
- warn(codeFrame ? `${message}\n${codeFrame}` : message);
60
- }
61
- // The wildcard import results in a huge object with every export
62
- // with keys that cannot be mangled, and can be quite heavy size-wise.
63
- // In the global build we know `Vue` is available globally so we can avoid
64
- // the wildcard object.
65
- const render = (new Function('Vue', code)(runtimeDom));
66
- render._rc = true;
67
- return (compileCache[key] = render);
68
- }
13
+ // This entry is the "full-build" that includes both the runtime
14
+ if ((process.env.NODE_ENV !== 'production')) {
15
+ initDev();
16
+ }
17
+ const compileCache = Object.create(null);
18
+ function compileToFunction(template, options) {
19
+ if (!isString(template)) {
20
+ if (template.nodeType) {
21
+ template = template.innerHTML;
22
+ }
23
+ else {
24
+ (process.env.NODE_ENV !== 'production') && warn(`invalid template option: `, template);
25
+ return NOOP;
26
+ }
27
+ }
28
+ const key = template;
29
+ const cached = compileCache[key];
30
+ if (cached) {
31
+ return cached;
32
+ }
33
+ if (template[0] === '#') {
34
+ const el = document.querySelector(template);
35
+ if ((process.env.NODE_ENV !== 'production') && !el) {
36
+ warn(`Template element not found or is empty: ${template}`);
37
+ }
38
+ // __UNSAFE__
39
+ // Reason: potential execution of JS expressions in in-DOM template.
40
+ // The user must make sure the in-DOM template is trusted. If it's rendered
41
+ // by the server, the template should not contain any user data.
42
+ template = el ? el.innerHTML : ``;
43
+ }
44
+ const opts = extend({
45
+ hoistStatic: true,
46
+ onError: (process.env.NODE_ENV !== 'production') ? onError : undefined,
47
+ onWarn: (process.env.NODE_ENV !== 'production') ? e => onError(e, true) : NOOP
48
+ }, options);
49
+ if (!opts.isCustomElement && typeof customElements !== 'undefined') {
50
+ opts.isCustomElement = tag => !!customElements.get(tag);
51
+ }
52
+ const { code } = compile(template, opts);
53
+ function onError(err, asWarning = false) {
54
+ const message = asWarning
55
+ ? err.message
56
+ : `Template compilation error: ${err.message}`;
57
+ const codeFrame = err.loc &&
58
+ generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
59
+ warn(codeFrame ? `${message}\n${codeFrame}` : message);
60
+ }
61
+ // The wildcard import results in a huge object with every export
62
+ // with keys that cannot be mangled, and can be quite heavy size-wise.
63
+ // In the global build we know `Vue` is available globally so we can avoid
64
+ // the wildcard object.
65
+ const render = (new Function('Vue', code)(runtimeDom));
66
+ render._rc = true;
67
+ return (compileCache[key] = render);
68
+ }
69
69
  registerRuntimeCompiler(compileToFunction);
70
70
 
71
71
  export { compileToFunction as compile };