@pinegrow/vite-plugin 3.0.73-alpha.0 → 3.0.73-alpha.10

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/dist/vue/index.js CHANGED
@@ -16,10 +16,26 @@ export function usePinegrow() {
16
16
  const winObj = window
17
17
 
18
18
  if (!(winObj?.process?.client && winObj.process.client !== true)) {
19
- if (!winObj.pinegrow) {
20
- // console.log('Cache initialized by Vue Plugin!')
21
- const elCache = reactive(new Map())
19
+ const isMapLike = value =>
20
+ value &&
21
+ typeof value.get === 'function' &&
22
+ typeof value.set === 'function' &&
23
+ typeof value.delete === 'function' &&
24
+ typeof value.entries === 'function'
25
+
26
+ const existingPinegrow = winObj.pinegrow || {}
27
+ const existingElCache = isMapLike(existingPinegrow.elCache) ? existingPinegrow.elCache : new Map()
28
+ const elCache = reactive(existingElCache)
22
29
 
30
+ if (
31
+ !winObj.pinegrow ||
32
+ winObj.pinegrow.elCache !== elCache ||
33
+ winObj.pinegrow.reactiveFromContext !== reactive ||
34
+ winObj.pinegrow.refFromContext !== ref ||
35
+ winObj.pinegrow.computedFromContext !== computed ||
36
+ winObj.pinegrow.watchFromContext !== watch
37
+ ) {
38
+ // console.log('Cache initialized by Vue Plugin!')
23
39
  const enrichWithComponentName = (elCacheObj, localFile) => {
24
40
  return {
25
41
  name: elCacheObj.instance.type.__name || '',
@@ -28,7 +44,7 @@ export function usePinegrow() {
28
44
  }
29
45
  }
30
46
 
31
- winObj.pinegrow = {
47
+ winObj.pinegrow = Object.assign(existingPinegrow, {
32
48
  elCache,
33
49
  // pgIdToElComputed,
34
50
  // localComponentToElComputed,
@@ -40,7 +56,7 @@ export function usePinegrow() {
40
56
  // // Uncomment these two to test locally
41
57
  // elCacheErrHandlerFn,
42
58
  // elUpdateHanderFn,
43
- }
59
+ })
44
60
  }
45
61
  }
46
62
  }
@@ -316,4 +332,3 @@ export function usePinegrow() {
316
332
 
317
333
  return { pgUpdateElCache }
318
334
  }
319
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/vite-plugin",
3
- "version": "3.0.73-alpha.0",
3
+ "version": "3.0.73-alpha.10",
4
4
  "description": "Pinegrow Vite Plugin",
5
5
  "type": "module",
6
6
  "files": [