vue 3.4.0-alpha.3 → 3.4.0-beta.1

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.
package/README.md CHANGED
@@ -37,6 +37,7 @@ Starting with 3.0.0-rc.3, `esm-bundler` builds now exposes global feature flags
37
37
 
38
38
  - `__VUE_OPTIONS_API__` (enable/disable Options API support, default: `true`)
39
39
  - `__VUE_PROD_DEVTOOLS__` (enable/disable devtools support in production, default: `false`)
40
+ - `__VUE_PROD_HYDRATION_MISMATCH_DETAILS__` (enable/disable detailed warnings for hydration mismatches in production, default: `false`)
40
41
 
41
42
  The build will work without configuring these flags, however it is **strongly recommended** to properly configure them in order to get proper tree-shaking in the final bundle. To configure these flags:
42
43
 
@@ -1,5 +1,3 @@
1
1
  if (typeof require !== 'undefined') {
2
- try {
3
- require('@vue/compiler-sfc').registerTS(() => require('typescript'))
4
- } catch (e) {}
2
+ require('@vue/compiler-sfc').registerTS(() => require('typescript'))
5
3
  }
package/dist/vue.cjs.js CHANGED
@@ -19,7 +19,15 @@ function _interopNamespaceDefault(e) {
19
19
 
20
20
  var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
21
21
 
22
- const compileCache = /* @__PURE__ */ Object.create(null);
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
+ }
23
31
  function compileToFunction(template, options) {
24
32
  if (!shared.isString(template)) {
25
33
  if (template.nodeType) {
@@ -30,7 +38,8 @@ function compileToFunction(template, options) {
30
38
  }
31
39
  }
32
40
  const key = template;
33
- const cached = compileCache[key];
41
+ const cache = getCache(options);
42
+ const cached = cache[key];
34
43
  if (cached) {
35
44
  return cached;
36
45
  }
@@ -65,7 +74,7 @@ ${codeFrame}` : message);
65
74
  }
66
75
  const render = new Function("Vue", code)(runtimeDom__namespace);
67
76
  render._rc = true;
68
- return compileCache[key] = render;
77
+ return cache[key] = render;
69
78
  }
70
79
  runtimeDom.registerRuntimeCompiler(compileToFunction);
71
80
 
@@ -19,7 +19,15 @@ function _interopNamespaceDefault(e) {
19
19
 
20
20
  var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
21
21
 
22
- const compileCache = /* @__PURE__ */ Object.create(null);
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
+ }
23
31
  function compileToFunction(template, options) {
24
32
  if (!shared.isString(template)) {
25
33
  if (template.nodeType) {
@@ -29,7 +37,8 @@ function compileToFunction(template, options) {
29
37
  }
30
38
  }
31
39
  const key = template;
32
- const cached = compileCache[key];
40
+ const cache = getCache(options);
41
+ const cached = cache[key];
33
42
  if (cached) {
34
43
  return cached;
35
44
  }
@@ -51,7 +60,7 @@ function compileToFunction(template, options) {
51
60
  const { code } = compilerDom.compile(template, opts);
52
61
  const render = new Function("Vue", code)(runtimeDom__namespace);
53
62
  render._rc = true;
54
- return compileCache[key] = render;
63
+ return cache[key] = render;
55
64
  }
56
65
  runtimeDom.registerRuntimeCompiler(compileToFunction);
57
66