Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@pinegrow/vite-plugin

Package Overview
Dependencies
Maintainers
3
Versions
324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinegrow/vite-plugin - npm Package Compare versions

Comparing version
3.0.76-alpha.2
to
3.0.76-alpha.3
+111
-4
dist/vue/index.js

@@ -13,2 +13,108 @@ import {

const getAppTreeBoundaryFile = elCacheObj => elCacheObj?.localFile || elCacheObj?.component?.file || null
const getBoundaryElement = (elCacheObj, fallbackEl = null) =>
elCacheObj?.firstEl || elCacheObj?.el || fallbackEl || null
const getBoundaryLastElement = (elCacheObj, fallbackEl = null) =>
elCacheObj?.lastEl || elCacheObj?.firstEl || elCacheObj?.el || fallbackEl || null
const isBoundaryConnected = (elCacheObj, fallbackEl = null) => {
const firstEl = getBoundaryElement(elCacheObj, fallbackEl)
const lastEl = getBoundaryLastElement(elCacheObj, fallbackEl)
return Boolean(firstEl?.isConnected || lastEl?.isConnected || fallbackEl?.isConnected)
}
const isBoundaryMounted = elCacheObj => {
if (!elCacheObj?.instance) {
return true
}
return elCacheObj.instance.isMounted !== false && elCacheObj.instance.isUnmounted !== true
}
const isAppTreeBoundary = elCacheObj => {
if (!elCacheObj) {
return false
}
if (elCacheObj.treeScopes) {
return elCacheObj.treeScopes.appTree === true && Boolean(getAppTreeBoundaryFile(elCacheObj))
}
return Boolean(getAppTreeBoundaryFile(elCacheObj))
}
const getBoundaryId = elCacheObj => {
const file = getAppTreeBoundaryFile(elCacheObj) || ''
const uid = elCacheObj?.instance?.uid ?? ''
const key = elCacheObj?.key ?? ''
const pgId = elCacheObj?.pgId ?? elCacheObj?.sourceId ?? elCacheObj?.source?.id ?? ''
return [file, uid, key, pgId].join('::')
}
const createAppTreeBoundariesComputed = elCache =>
computed(() => {
const boundaries = []
const seen = new Set()
for (let [el, elCacheNodes] of elCache.entries()) {
if (!Array.isArray(elCacheNodes)) {
continue
}
elCacheNodes.forEach(elCacheObj => {
if (
!isBoundaryMounted(elCacheObj) ||
!isBoundaryConnected(elCacheObj, el) ||
!isAppTreeBoundary(elCacheObj)
) {
return
}
const localFile = getAppTreeBoundaryFile(elCacheObj)
const firstEl = getBoundaryElement(elCacheObj, el)
const lastEl = getBoundaryLastElement(elCacheObj, el)
const boundaryId = getBoundaryId(elCacheObj)
if (!localFile || !firstEl || seen.has(boundaryId)) {
return
}
if (elCacheObj.isIsland) {
const childEl = firstEl.firstElementChild
if (childEl && elCache.has(childEl)) {
return
}
}
seen.add(boundaryId)
boundaries.push({
...elCacheObj,
appTreeBoundary: true,
appTreeBoundaryId: boundaryId,
localFile,
firstEl,
lastEl,
})
})
}
return boundaries.sort((a, b) => {
const aEl = getBoundaryElement(a)
const bEl = getBoundaryElement(b)
if (!aEl?.compareDocumentPosition || !bEl) {
return 0
}
const position = aEl.compareDocumentPosition(bEl)
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
return 1
}
if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
return -1
}
return 0
})
})
export function usePinegrow() {

@@ -20,5 +126,6 @@ const initCache = () => {

if (!(winObj?.process?.client && winObj.process.client !== true)) {
if (!winObj.pinegrow) {
if (!winObj.pinegrow || !winObj.pinegrow.appTreeBoundariesComputed) {
// console.log('Cache initialized by Vue Plugin!')
const elCache = reactive(new Map())
const existingPinegrow = winObj.pinegrow || {}
const elCache = reactive(existingPinegrow.elCache || new Map())

@@ -34,6 +141,7 @@ const enrichWithComponentName = (elCacheObj, localFile) => {

winObj.pinegrow = {
...existingPinegrow,
elCache,
// pgIdToElComputed,
// localComponentToElComputed,
// appTree,
appTreeBoundariesComputed: createAppTreeBoundariesComputed(elCache),
reactiveFromContext: reactive,

@@ -322,2 +430,1 @@ refFromContext: ref,

}
+1
-1
{
"name": "@pinegrow/vite-plugin",
"version": "3.0.76-alpha.2",
"version": "3.0.76-alpha.3",
"description": "Pinegrow Vite Plugin",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is too big to display