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.75
to
3.0.76-alpha.0
+132
astro-runtime.d.ts
export interface AstroRuntimeBridgeOptions {
markerAttribute?: string
root?: Document | Element
win?: Window
clearPrevious?: boolean
}
export interface AstroElCacheEntry {
el: Element
framework: 'astro'
entryKind: 'source-node' | 'component-boundary' | 'page-root'
treeScopes: {
pageTree: boolean
appTree: boolean
}
isAstro: true
isAstroSourceDomEntry: boolean
isAstroComponent: boolean
isAppTreeComponent: boolean
isAstroPageRoot?: boolean
sourceId: string
pgId: string | null
key: string | null
localFile: string | null
sourceFile: string | null
nodeType: string | null
name: string
source: {
id: string
file: string | null
range: {
start: number | null
end: number | null
status: string
}
nodeType: string | null
name: string
}
component: {
file: string
name: string
kind: string
} | null
owners: Array<{
kind: string
file: string
name?: string
}>
sourceRange: {
start: number | null
end: number | null
status: string
}
sourceStart: number | null
sourceEnd: number | null
sourceRangeStatus: string
marker: unknown
editability: unknown
attributes: unknown[]
isFragment: false
isRootFragment: false
isIsland: false
rootEl: null
firstEl: Element
lastEl: Element | null
instance: {
uid: string
isMounted: boolean
isUnmounted: boolean
type: {
__name?: string
__file?: string | null
}
props: Record<string, unknown>
attrs: Record<string, unknown>
slots: Record<string, unknown>
subTree: {
el: Element
}
appContext: unknown
}
vnode: null
}
export type AstroComponentEntry = AstroElCacheEntry & {
entryKind: 'component-boundary' | 'page-root'
treeScopes: {
pageTree: false
appTree: true
}
isAstroSourceDomEntry: false
isAstroComponent: true
isAppTreeComponent: true
pgId: null
key: null
localFile: string
sourceFile: string
nodeType: 'component-file'
component: {
file: string
name: string
kind: string
}
}
export function createAstroComponentEntries(input: {
entries: AstroElCacheEntry[]
manifest: unknown
root?: Document | Element
}): AstroComponentEntry[]
export function createAstroElCacheEntry(input: {
element: Element
manifest: unknown
node: unknown
}): AstroElCacheEntry
export function createAstroRuntimeBridge(manifest: unknown, options?: AstroRuntimeBridgeOptions): {
manifest: unknown
scan(root?: Document | Element): unknown
refresh(options?: AstroRuntimeBridgeOptions): unknown
}
export function ensurePinegrowAstroBridge(win?: Window): unknown
export function refreshAstroElCache(manifest: unknown, options?: AstroRuntimeBridgeOptions): unknown
export function scanAstroSourceDomMarkers(
root: Document | Element,
manifest: unknown,
options?: AstroRuntimeBridgeOptions
): unknown
import type { AstroIntegration } from 'astro'
import type { LiveDesignerOptions } from './types'
export interface PinegrowAstroModuleOptions {
/**
* Pinegrow Live Designer options.
*/
liveDesigner?: {
[key in string]?: any
} & LiveDesignerOptions
}
declare function pinegrowAstro(moduleOptions?: PinegrowAstroModuleOptions): AstroIntegration
declare function resolveAstroLiveDesignerOptions(moduleOptions?: PinegrowAstroModuleOptions): PinegrowAstroModuleOptions['liveDesigner']
export { pinegrowAstro, resolveAstroLiveDesignerOptions }
export default pinegrowAstro
const defaultMarkerAttribute = 'data-pg-id'
const pinegrowMarkerAttribute = 'data-pg-id'
const astroFrameworkKey = 'astro'
const astroSourceIdPrefix = 'pgastro-'
const elementNodeType = 1
const commentNodeType = 8
const documentPositionPreceding = 2
const documentPositionFollowing = 4
const createFallbackComputed = getter => ({
get value() {
return getter()
},
})
const createFallbackRef = value => ({ value })
const readWatchSource = source => {
if (typeof source === 'function') {
return source()
}
return source?.value
}
const createFallbackWatch = (source, callback, options = {}) => {
if (options.immediate && typeof callback === 'function') {
callback(readWatchSource(source), undefined)
}
return () => {}
}
const createAstroSyntheticInstance = (node, element) => ({
uid: `astro:${node.id}`,
isMounted: true,
isUnmounted: false,
parent: null,
type: {
__name: node.name || 'AstroElement',
__file: null,
},
props: {},
attrs: {},
slots: {},
subTree: {
el: element,
},
appContext: null,
})
const getDefaultWindow = () => {
if (typeof window !== 'undefined') {
return window
}
return null
}
const isMapLike = value =>
value &&
typeof value.get === 'function' &&
typeof value.set === 'function' &&
typeof value.delete === 'function' &&
typeof value.entries === 'function'
const createReactiveMap = (pinegrow, value) => {
const map = isMapLike(value) ? value : new Map()
const reactiveFromContext = pinegrow?.reactiveFromContext
return typeof reactiveFromContext === 'function' ? reactiveFromContext(map) : map
}
const getMarkerAttribute = (manifest, options = {}) =>
options.markerAttribute || manifest?.marker?.attribute || defaultMarkerAttribute
const getManifestSourceKey = manifest => manifest?.sourceFile || manifest?.id || null
const normalizeElCacheEntries = entries => Array.isArray(entries) ? entries : []
const getEntryFirstElement = entry => entry?.firstEl || entry?.el || null
const getEntryLastElement = entry => entry?.lastEl || entry?.el || null
const sortEntriesByDocumentPosition = entries =>
[...entries].sort((a, b) => {
const aEl = getEntryFirstElement(a)
const bEl = getEntryFirstElement(b)
if (!aEl || !bEl || aEl === bEl || typeof aEl.compareDocumentPosition !== 'function') {
return 0
}
const position = aEl.compareDocumentPosition(bEl)
if (position & documentPositionPreceding) {
return 1
}
if (position & documentPositionFollowing) {
return -1
}
return 0
})
const normalizePathLike = value => `${value || ''}`.replace(/\\/g, '/')
const getBasename = value => {
if (!value) {
return ''
}
return normalizePathLike(value).split('/').pop() || ''
}
const isAstroPageSourceFile = sourceFile =>
/(^|\/)src\/pages\/.+\.astro$/i.test(normalizePathLike(sourceFile))
const getRootElement = root => {
if (!root) {
return null
}
if (root.documentElement) {
return root.documentElement
}
if (root.body) {
return root.body
}
if (root.firstElementChild) {
return root.firstElementChild
}
return root.nodeType === 1 ? root : null
}
const createAstroComponentSyntheticInstance = (manifest, componentId, element) => ({
uid: componentId,
isMounted: true,
isUnmounted: false,
parent: null,
type: {
__name: getBasename(manifest?.sourceFile) || 'AstroComponent',
__file: manifest?.sourceFile || null,
},
props: {},
attrs: {},
slots: {},
subTree: {
el: element,
},
appContext: null,
})
const createNodeIndex = manifest => {
const index = new Map()
;(manifest?.nodes || []).forEach(node => {
if (node?.id) {
index.set(node.id, node)
}
})
return index
}
const queryMarkerElements = (root, markerAttribute) => {
if (!root || typeof root.querySelectorAll !== 'function') {
return []
}
return Array.from(root.querySelectorAll(`[${markerAttribute}]`))
}
const getChildNodes = node => Array.from(node?.childNodes || [])
const walkDomNodes = (node, visitor) => {
if (!node) {
return
}
visitor(node)
getChildNodes(node).forEach(child => walkDomNodes(child, visitor))
}
const parseAstroBoundaryComment = node => {
if (node?.nodeType !== commentNodeType) {
return null
}
const match = `${node.nodeValue || ''}`.trim().match(/^pgastro:(start|end):(.+)$/)
return match
? {
boundary: match[1],
sourceId: match[2],
}
: null
}
const getBoundaryElements = (startComment, endComment) => {
if (!startComment?.parentNode || startComment.parentNode !== endComment?.parentNode) {
return {
firstEl: null,
lastEl: null,
}
}
let firstEl = null
let lastEl = null
let node = startComment.nextSibling
while (node && node !== endComment) {
if (node.nodeType === elementNodeType) {
if (!firstEl) {
firstEl = node
}
lastEl = node
}
node = node.nextSibling
}
return {
firstEl,
lastEl,
}
}
const queryBoundaryMarkerRanges = (root, nodeIndex) => {
const startsById = new Map()
const ranges = []
walkDomNodes(root, node => {
const marker = parseAstroBoundaryComment(node)
if (!marker || !nodeIndex.has(marker.sourceId)) {
return
}
if (marker.boundary === 'start') {
if (!startsById.has(marker.sourceId)) {
startsById.set(marker.sourceId, [])
}
startsById.get(marker.sourceId).push(node)
return
}
const starts = startsById.get(marker.sourceId)
const startComment = starts?.pop()
if (!startComment) {
return
}
const { firstEl, lastEl } = getBoundaryElements(startComment, node)
if (!firstEl) {
return
}
ranges.push({
sourceId: marker.sourceId,
firstEl,
lastEl: lastEl || firstEl,
startComment,
endComment: node,
})
})
return ranges
}
const getElementMarkerId = (element, markerAttribute) => {
if (!element || typeof element.getAttribute !== 'function') {
return null
}
return element.getAttribute(markerAttribute)
}
const isAstroIslandElement = element => {
const tagName = element?.tagName || element?.nodeName || element?.localName || ''
return `${tagName}`.toLowerCase() === 'astro-island'
}
const canOverwritePgId = currentValue =>
!currentValue || currentValue.startsWith(astroSourceIdPrefix)
const mirrorAstroSourceIdToPgId = (element, sourceId, options = {}) => {
if (
options.mirrorPgId === false ||
!sourceId ||
!element ||
typeof element.getAttribute !== 'function' ||
typeof element.setAttribute !== 'function'
) {
return false
}
const currentPgId = element.getAttribute(pinegrowMarkerAttribute)
if (currentPgId === sourceId) {
return true
}
if (!canOverwritePgId(currentPgId)) {
return false
}
element.setAttribute(pinegrowMarkerAttribute, sourceId)
return true
}
const createAstroElCacheEntry = ({
boundary = null,
element,
firstElement = null,
lastElement = null,
manifest,
markerAttribute = defaultMarkerAttribute,
node,
mirroredPgId = false,
}) => {
const firstEl = firstElement || element
const lastEl = lastElement || firstEl
const isBoundaryRange = Boolean(boundary)
const isIsland = isBoundaryRange && isAstroIslandElement(firstEl)
const sourceRange = {
start: node.sourceStart ?? null,
end: node.sourceEnd ?? null,
status: node.sourceRangeStatus || 'unknown',
}
return {
el: firstEl,
framework: astroFrameworkKey,
entryKind: 'source-node',
treeScopes: {
pageTree: true,
appTree: false,
},
isAstro: true,
isAstroSourceDomEntry: true,
isAstroComponent: false,
isAppTreeComponent: false,
sourceId: node.id,
pgId: node.id,
key: node.id,
localFile: null,
sourceFile: manifest.sourceFile || null,
nodeType: node.type || null,
name: node.name || '',
source: {
id: node.id,
file: manifest.sourceFile || null,
range: sourceRange,
nodeType: node.type || null,
name: node.name || '',
},
component: null,
owners: [],
sourceRange,
sourceStart: sourceRange.start,
sourceEnd: sourceRange.end,
sourceRangeStatus: sourceRange.status,
marker: {
...(node.marker || {}),
liveAttribute: markerAttribute,
pinegrowAttribute: pinegrowMarkerAttribute,
mirroredPgId,
boundary,
},
editability: node.editability || null,
attributes: node.attributes || [],
isFragment: isBoundaryRange,
isRootFragment: false,
isIsland,
rootEl: null,
firstEl,
lastEl,
instance: createAstroSyntheticInstance(node, firstEl),
vnode: null,
}
}
const createAstroComponentEntry = ({ entries, manifest, root }) => {
const sourceFile = manifest?.sourceFile
const rootElement = getRootElement(root)
const isPageFile = isAstroPageSourceFile(sourceFile)
const isPageRoot = isPageFile && rootElement
const isMarkerless = !entries.length
if (!sourceFile || (!entries.length && !rootElement)) {
return null
}
const orderedEntries = sortEntriesByDocumentPosition(entries)
const firstEntry = orderedEntries[0]
const lastEntry = orderedEntries[orderedEntries.length - 1]
const componentId = `astro-component:${sourceFile}`
const firstEl = isPageRoot || isMarkerless ? rootElement : getEntryFirstElement(firstEntry)
const lastEl = isPageRoot || isMarkerless ? null : getEntryLastElement(lastEntry)
const componentName = getBasename(sourceFile)
const entryKind = isPageRoot ? 'page-root' : 'component-boundary'
const sourceRangeStatus = isMarkerless ? 'markerless-component-file' : 'component-file'
const editabilityReasons = ['astro-component-file']
if (isMarkerless) {
editabilityReasons.push('astro-markerless-app-tree-entry')
}
return {
el: firstEl,
framework: astroFrameworkKey,
entryKind,
treeScopes: {
pageTree: false,
appTree: true,
},
isAstro: true,
isAstroSourceDomEntry: false,
isAstroComponent: true,
isAppTreeComponent: true,
isAstroPageRoot: Boolean(isPageRoot),
isAstroMarkerlessComponent: Boolean(isMarkerless),
sourceId: componentId,
pgId: null,
key: null,
localFile: sourceFile,
sourceFile,
nodeType: 'component-file',
name: componentName,
source: {
id: componentId,
file: sourceFile,
range: {
start: null,
end: null,
status: sourceRangeStatus,
},
nodeType: 'component-file',
name: componentName,
},
component: {
file: sourceFile,
name: componentName,
kind: isPageFile ? 'page' : 'component',
},
owners: [],
sourceRange: {
start: null,
end: null,
status: sourceRangeStatus,
},
sourceStart: null,
sourceEnd: null,
sourceRangeStatus,
marker: null,
editability: {
mode: 'inspect',
operations: ['select', 'open-source-file'],
reasons: editabilityReasons,
},
attributes: [],
state: Array.isArray(manifest.state) ? manifest.state : [],
isFragment: false,
isRootFragment: false,
isIsland: false,
rootEl: null,
firstEl,
lastEl,
instance: createAstroComponentSyntheticInstance(manifest, componentId, firstEl),
vnode: null,
}
}
const createAstroComponentEntries = ({ entries, manifest, root }) => {
const componentEntry = createAstroComponentEntry({ entries, manifest, root })
return componentEntry ? [componentEntry] : []
}
const scanAstroSourceDomMarkers = (root, manifest, options = {}) => {
const markerAttribute = getMarkerAttribute(manifest, options)
const entries = []
const missing = []
if (manifest?.status !== 'ready') {
return {
status: 'unavailable',
markerAttribute,
entries,
componentEntries: [],
missing,
reason: manifest?.reason || 'Astro source manifest is unavailable.',
}
}
if (!root || typeof root.querySelectorAll !== 'function') {
return {
status: 'unavailable',
markerAttribute,
entries,
componentEntries: [],
missing,
reason: 'A DOM root with querySelectorAll() is required.',
}
}
const nodeIndex = createNodeIndex(manifest)
queryMarkerElements(root, markerAttribute).forEach(element => {
const sourceId = getElementMarkerId(element, markerAttribute)
const node = nodeIndex.get(sourceId)
if (!node) {
if (options.reportMissingMarkers) {
missing.push({ element, sourceId })
}
return
}
const mirroredPgId = markerAttribute === pinegrowMarkerAttribute
? false
: mirrorAstroSourceIdToPgId(element, sourceId, options)
entries.push(createAstroElCacheEntry({
element,
manifest,
markerAttribute,
node,
mirroredPgId,
}))
})
queryBoundaryMarkerRanges(root, nodeIndex).forEach(boundary => {
const node = nodeIndex.get(boundary.sourceId)
entries.push(createAstroElCacheEntry({
boundary: {
strategy: 'boundary-comment',
startComment: boundary.startComment,
endComment: boundary.endComment,
},
element: boundary.firstEl,
firstElement: boundary.firstEl,
lastElement: boundary.lastEl,
manifest,
markerAttribute,
node,
mirroredPgId: false,
}))
})
return {
status: 'ready',
markerAttribute,
entries,
componentEntries: createAstroComponentEntries({ entries, manifest, root }),
missing,
}
}
const ensurePinegrowAstroBridge = (win = getDefaultWindow()) => {
if (!win) {
return null
}
if (!win.pinegrow) {
win.pinegrow = {}
}
if (typeof win.pinegrow.reactiveFromContext !== 'function') {
win.pinegrow.reactiveFromContext = value => value
}
if (typeof win.pinegrow.refFromContext !== 'function') {
win.pinegrow.refFromContext = createFallbackRef
}
if (typeof win.pinegrow.computedFromContext !== 'function') {
win.pinegrow.computedFromContext = createFallbackComputed
}
if (typeof win.pinegrow.watchFromContext !== 'function') {
win.pinegrow.watchFromContext = createFallbackWatch
}
win.pinegrow.elCache = createReactiveMap(win.pinegrow, win.pinegrow.elCache)
if (!win.pinegrow.astro) {
win.pinegrow.astro = {}
}
win.pinegrow.astro.sourceManifests = createReactiveMap(
win.pinegrow,
win.pinegrow.astro.sourceManifests
)
return win.pinegrow
}
const isAstroEntryForSource = (entry, sourceKey) =>
entry?.framework === astroFrameworkKey &&
(entry.localFile === sourceKey || entry.sourceFile === sourceKey)
const removeAstroEntriesForManifest = (elCache, manifest) => {
const sourceKey = getManifestSourceKey(manifest)
let removed = 0
const elements = []
if (!sourceKey) {
return { elements, removed }
}
Array.from(elCache.entries()).forEach(([element, entries]) => {
const currentEntries = normalizeElCacheEntries(entries)
const nextEntries = currentEntries.filter(entry => !isAstroEntryForSource(entry, sourceKey))
const removedForElement = currentEntries.length - nextEntries.length
removed += removedForElement
if (removedForElement) {
elements.push(element)
}
if (nextEntries.length) {
elCache.set(element, nextEntries)
} else {
elCache.delete(element)
}
})
return { elements, removed }
}
const upsertAstroEntry = (elCache, entry) => {
const existingEntries = normalizeElCacheEntries(elCache.get(entry.el))
const nextEntries = existingEntries.filter(existingEntry =>
existingEntry.framework !== astroFrameworkKey ||
existingEntry.sourceId !== entry.sourceId ||
existingEntry.localFile !== entry.localFile
)
nextEntries.push(entry)
elCache.set(entry.el, nextEntries)
}
const refreshAstroElCache = (manifest, options = {}) => {
const win = options.win || getDefaultWindow()
const root = options.root || win?.document || null
const pinegrow = ensurePinegrowAstroBridge(win)
const scan = scanAstroSourceDomMarkers(root, manifest, options)
if (!pinegrow) {
return {
...scan,
cached: 0,
removed: 0,
reason: scan.reason || 'A browser window is required.',
}
}
if (scan.status !== 'ready') {
return {
...scan,
cached: 0,
removed: 0,
}
}
const removal = options.clearPrevious === false
? { elements: [], removed: 0 }
: removeAstroEntriesForManifest(pinegrow.elCache, manifest)
const updatedElements = new Set(removal.elements)
const cacheEntries = [...scan.entries, ...(scan.componentEntries || [])]
cacheEntries.forEach(entry => {
upsertAstroEntry(pinegrow.elCache, entry)
updatedElements.add(entry.el)
})
updatedElements.forEach(element => {
if (pinegrow.elUpdateHanderFn) {
pinegrow.elUpdateHanderFn(element)
}
})
const sourceKey = getManifestSourceKey(manifest)
if (sourceKey) {
pinegrow.astro.sourceManifests.set(sourceKey, manifest)
}
return {
...scan,
cached: cacheEntries.length,
removed: removal.removed,
}
}
const createAstroRuntimeBridge = (manifest, options = {}) => ({
manifest,
scan: root => scanAstroSourceDomMarkers(
root || options.root || options.win?.document || getDefaultWindow()?.document,
manifest,
options
),
refresh: refreshOptions => refreshAstroElCache(manifest, { ...options, ...refreshOptions }),
})
export {
createAstroComponentEntries,
createAstroElCacheEntry,
createAstroRuntimeBridge,
ensurePinegrowAstroBridge,
refreshAstroElCache,
scanAstroSourceDomMarkers,
}

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

/*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
/*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/
/*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*/
/*! ../../../src/framework-mgmt/pinegrow-config-manager.js */
/*! ../../../src/framework-mgmt/transform-plugins.js */
/*! ../../packages/tailwindcss-plugin/host/bridge.js */
/*! ../../packages/tailwindcss-plugin/host/tailwind-css-entry.js */
/*! ../../tailwindcss-plugin/host/bridge.js */
/*! ../contrib/parseqs.js */
/*! ../contrib/yeast.js */
/*! ../globalThis.js */
/*! ../helpers/regeneratorRuntime */
/*! ../transport.js */
/*! ../util.js */
/*! ./arrayLikeToArray.js */
/*! ./arrayWithHoles.js */
/*! ./arrayWithoutHoles.js */
/*! ./binary-extensions.json */
/*! ./binary.js */
/*! ./browser.js */
/*! ./buffer-util */
/*! ./common */
/*! ./commons.js */
/*! ./constants */
/*! ./contrib/backo2.js */
/*! ./contrib/parseqs.js */
/*! ./contrib/parseuri.js */
/*! ./decodePacket.js */
/*! ./design-panel-theme-files.js */
/*! ./encodePacket.js */
/*! ./event-target */
/*! ./extension */
/*! ./fallback */
/*! ./globalThis.js */
/*! ./is-binary.js */
/*! ./iterableToArray.js */
/*! ./iterableToArrayLimit.js */
/*! ./lib/compile */
/*! ./lib/constants */
/*! ./lib/expand */
/*! ./lib/fsevents-handler */
/*! ./lib/nodefs-handler */
/*! ./lib/parse */
/*! ./lib/picomatch */
/*! ./lib/receiver.js */
/*! ./lib/sender.js */
/*! ./lib/stream.js */
/*! ./lib/stringify */
/*! ./lib/websocket-server.js */
/*! ./lib/websocket.js */
/*! ./limiter */
/*! ./manager.js */
/*! ./node-gyp-build.js */
/*! ./node.js */
/*! ./nonIterableRest.js */
/*! ./nonIterableSpread.js */
/*! ./objectWithoutPropertiesLoose.js */
/*! ./on.js */
/*! ./parse */
/*! ./permessage-deflate */
/*! ./plugin-watch-policy.js */
/*! ./plugin-watched-files.js */
/*! ./polling.js */
/*! ./receiver */
/*! ./scan */
/*! ./sender */
/*! ./socket.js */
/*! ./stringify */
/*! ./subprotocol */
/*! ./toPrimitive.js */
/*! ./toPropertyKey.js */
/*! ./transport.js */
/*! ./transports/index.js */
/*! ./transports/websocket-constructor.js */
/*! ./typeof.js */
/*! ./unsupportedIterableToArray.js */
/*! ./url.js */
/*! ./util.js */
/*! ./utils */
/*! ./validation */
/*! ./websocket */
/*! ./websocket-constructor.js */
/*! ./websocket.js */
/*! ./xmlhttprequest.js */
/*! @babel/runtime/helpers/asyncToGenerator */
/*! @babel/runtime/helpers/classCallCheck */
/*! @babel/runtime/helpers/createClass */
/*! @babel/runtime/helpers/defineProperty */
/*! @babel/runtime/helpers/objectWithoutProperties */
/*! @babel/runtime/helpers/slicedToArray */
/*! @babel/runtime/helpers/toConsumableArray */
/*! @babel/runtime/helpers/typeof */
/*! @babel/runtime/regenerator */
/*! @socket.io/component-emitter */
/*! anymatch */
/*! binary-extensions */
/*! braces */
/*! child_process */
/*! chokidar */
/*! crypto */
/*! debug */
/*! engine.io-client */
/*! engine.io-parser */
/*! events */
/*! fill-range */
/*! fs */
/*! fsevents */
/*! glob-parent */
/*! has-flag */
/*! http */
/*! https */
/*! https://mths.be/punycode v1.4.1 by @mathias */
/*! is-binary-path */
/*! is-extglob */
/*! is-glob */
/*! is-number */
/*! module */
/*! ms */
/*! net */
/*! node-gyp-build */
/*! normalize-path */
/*! os */
/*! path */
/*! picomatch */
/*! readdirp */
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/*! socket.io-client */
/*! socket.io-parser */
/*! stream */
/*! supports-color */
/*! tls */
/*! to-regex-range */
/*! tty */
/*! url */
/*! utf-8-validate */
/*! util */
/*! ws */
/*! xmlhttprequest-ssl */
/*! zlib */
/*!*********************!*\
!*** external "fs" ***!
\*********************/
/*!*********************!*\
!*** external "os" ***!
\*********************/
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*!**********************!*\
!*** external "net" ***!
\**********************/
/*!**********************!*\
!*** external "tls" ***!
\**********************/
/*!**********************!*\
!*** external "tty" ***!
\**********************/
/*!**********************!*\
!*** external "url" ***!
\**********************/
/*!***********************!*\
!*** external "http" ***!
\***********************/
/*!***********************!*\
!*** external "path" ***!
\***********************/
/*!***********************!*\
!*** external "util" ***!
\***********************/
/*!***********************!*\
!*** external "zlib" ***!
\***********************/
/*!************************!*\
!*** external "https" ***!
\************************/
/*!*************************!*\
!*** external "crypto" ***!
\*************************/
/*!*************************!*\
!*** external "events" ***!
\*************************/
/*!*************************!*\
!*** external "module" ***!
\*************************/
/*!*************************!*\
!*** external "stream" ***!
\*************************/
/*!***************************!*\
!*** external "fsevents" ***!
\***************************/
/*!********************************!*\
!*** external "child_process" ***!
\********************************/
/*!************************************!*\
!*** ./src/plugin-watch-policy.js ***!
\************************************/
/*!*************************************!*\
!*** ./node_modules/ws/wrapper.mjs ***!
\*************************************/
/*!*************************************!*\
!*** ./src/plugin-watched-files.js ***!
\*************************************/
/*!**************************************!*\
!*** ../../node_modules/ms/index.js ***!
\**************************************/
/*!***************************************!*\
!*** ./node_modules/ws/lib/sender.js ***!
\***************************************/
/*!***************************************!*\
!*** ./node_modules/ws/lib/stream.js ***!
\***************************************/
/*!****************************************!*\
!*** ./node_modules/ws/lib/limiter.js ***!
\****************************************/
/*!*****************************************!*\
!*** ./node_modules/ws/lib/receiver.js ***!
\*****************************************/
/*!*****************************************!*\
!*** ./src/design-panel-theme-files.js ***!
\*****************************************/
/*!******************************************!*\
!*** ../../node_modules/braces/index.js ***!
\******************************************/
/*!******************************************!*\
!*** ./node_modules/ws/lib/constants.js ***!
\******************************************/
/*!******************************************!*\
!*** ./node_modules/ws/lib/extension.js ***!
\******************************************/
/*!******************************************!*\
!*** ./node_modules/ws/lib/websocket.js ***!
\******************************************/
/*!*******************************************!*\
!*** ../../node_modules/is-glob/index.js ***!
\*******************************************/
/*!*******************************************!*\
!*** ./node_modules/ws/lib/validation.js ***!
\*******************************************/
/*!********************************************!*\
!*** ../../node_modules/anymatch/index.js ***!
\********************************************/
/*!********************************************!*\
!*** ../../node_modules/chokidar/index.js ***!
\********************************************/
/*!********************************************!*\
!*** ../../node_modules/debug/src/node.js ***!
\********************************************/
/*!********************************************!*\
!*** ../../node_modules/has-flag/index.js ***!
\********************************************/
/*!********************************************!*\
!*** ../../node_modules/readdirp/index.js ***!
\********************************************/
/*!********************************************!*\
!*** ../tailwindcss-plugin/host/bridge.js ***!
\********************************************/
/*!********************************************!*\
!*** ./node_modules/ws/lib/buffer-util.js ***!
\********************************************/
/*!********************************************!*\
!*** ./node_modules/ws/lib/subprotocol.js ***!
\********************************************/
/*!*********************************************!*\
!*** ../../node_modules/debug/src/index.js ***!
\*********************************************/
/*!*********************************************!*\
!*** ../../node_modules/is-number/index.js ***!
\*********************************************/
/*!*********************************************!*\
!*** ../../node_modules/picomatch/index.js ***!
\*********************************************/
/*!*********************************************!*\
!*** ./node_modules/ws/lib/event-target.js ***!
\*********************************************/
/*!**********************************************!*\
!*** ../../node_modules/braces/lib/parse.js ***!
\**********************************************/
/*!**********************************************!*\
!*** ../../node_modules/braces/lib/utils.js ***!
\**********************************************/
/*!**********************************************!*\
!*** ../../node_modules/debug/src/common.js ***!
\**********************************************/
/*!**********************************************!*\
!*** ../../node_modules/fill-range/index.js ***!
\**********************************************/
/*!**********************************************!*\
!*** ../../node_modules/is-extglob/index.js ***!
\**********************************************/
/*!***********************************************!*\
!*** ../../node_modules/braces/lib/expand.js ***!
\***********************************************/
/*!***********************************************!*\
!*** ../../node_modules/debug/src/browser.js ***!
\***********************************************/
/*!***********************************************!*\
!*** ../../node_modules/glob-parent/index.js ***!
\***********************************************/
/*!************************************************!*\
!*** ../../node_modules/braces/lib/compile.js ***!
\************************************************/
/*!************************************************!*\
!*** ../../node_modules/picomatch/lib/scan.js ***!
\************************************************/
/*!*************************************************!*\
!*** ../../node_modules/picomatch/lib/parse.js ***!
\*************************************************/
/*!*************************************************!*\
!*** ../../node_modules/picomatch/lib/utils.js ***!
\*************************************************/
/*!*************************************************!*\
!*** ./node_modules/ws/lib/websocket-server.js ***!
\*************************************************/
/*!**************************************************!*\
!*** ../../node_modules/braces/lib/constants.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/braces/lib/stringify.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/is-binary-path/index.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/node-gyp-build/index.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/normalize-path/index.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/supports-color/index.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/to-regex-range/index.js ***!
\**************************************************/
/*!**************************************************!*\
!*** ../../node_modules/utf-8-validate/index.js ***!
\**************************************************/
/*!***************************************************!*\
!*** ./node_modules/ws/lib/permessage-deflate.js ***!
\***************************************************/
/*!****************************************************!*\
!*** ../../node_modules/chokidar/lib/constants.js ***!
\****************************************************/
/*!*****************************************************!*\
!*** ../../node_modules/binary-extensions/index.js ***!
\*****************************************************/
/*!*****************************************************!*\
!*** ../../node_modules/picomatch/lib/constants.js ***!
\*****************************************************/
/*!*****************************************************!*\
!*** ../../node_modules/picomatch/lib/picomatch.js ***!
\*****************************************************/
/*!*****************************************************!*\
!*** ../../node_modules/utf-8-validate/fallback.js ***!
\*****************************************************/
/*!*****************************************************!*\
!*** ../../src/framework-mgmt/transform-plugins.js ***!
\*****************************************************/
/*!********************************************************!*\
!*** ../tailwindcss-plugin/host/tailwind-css-entry.js ***!
\********************************************************/
/*!*********************************************************!*\
!*** ../../node_modules/chokidar/lib/nodefs-handler.js ***!
\*********************************************************/
/*!**********************************************************!*\
!*** ./node_modules/engine.io-parser/build/esm/index.js ***!
\**********************************************************/
/*!***********************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/typeof.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ../../node_modules/chokidar/lib/fsevents-handler.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ../../node_modules/node-gyp-build/node-gyp-build.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ../../src/framework-mgmt/pinegrow-config-manager.js ***!
\***********************************************************/
/*!************************************************************!*\
!*** ./node_modules/engine.io-parser/build/esm/commons.js ***!
\************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/on.js ***!
\*************************************************************/
/*!**************************************************************!*\
!*** ../../node_modules/@babel/runtime/regenerator/index.js ***!
\**************************************************************/
/*!**************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/url.js ***!
\**************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/util.js ***!
\***************************************************************/
/*!****************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/createClass.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/index.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/index.js ***!
\****************************************************************/
/*!*****************************************************************!*\
!*** ../../node_modules/@socket.io/component-emitter/index.mjs ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/socket.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/engine.io-parser/build/esm/decodePacket.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/engine.io-parser/build/esm/encodePacket.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/socket.js ***!
\*****************************************************************/
/*!******************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/slicedToArray.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/manager.js ***!
\******************************************************************/
/*!*******************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/defineProperty.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ../../node_modules/binary-extensions/binary-extensions.json ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ../../node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js ***!
\*******************************************************************/
/*!********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/iterableToArray.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ../../node_modules/socket.io-parser/build/esm-debug/index.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transport.js ***!
\********************************************************************/
/*!*********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ../../node_modules/socket.io-parser/build/esm-debug/binary.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/globalThis.js ***!
\*********************************************************************/
/*!**********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
\**********************************************************************/
/*!***********************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
\***********************************************************************/
/*!************************************************************************!*\
!*** ../../node_modules/socket.io-parser/build/esm-debug/is-binary.js ***!
\************************************************************************/
/*!************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/contrib/yeast.js ***!
\************************************************************************/
/*!*************************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
\*************************************************************************/
/*!*************************************************************************!*\
!*** ./node_modules/socket.io-client/build/esm-debug/contrib/backo2.js ***!
\*************************************************************************/
/*!**************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js ***!
\**************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js ***!
\***************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transports/index.js ***!
\***************************************************************************/
/*!****************************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***!
\****************************************************************************/
/*!*****************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transports/polling.js ***!
\*****************************************************************************/
/*!*******************************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
\*******************************************************************************/
/*!*******************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transports/websocket.js ***!
\*******************************************************************************/
/*!*********************************************************************************!*\
!*** ../../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***!
\*********************************************************************************/
/*!************************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transports/xmlhttprequest.js ***!
\************************************************************************************/
/*!*******************************************************************************************!*\
!*** ./node_modules/engine.io-client/build/esm-debug/transports/websocket-constructor.js ***!
\*******************************************************************************************/
/**
* Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
*
* This can be used with JS designed for browsers to improve reuse of code and
* allow the use of existing libraries.
*
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
*
* @author Dan DeFelippi <dan@driverdan.com>
* @contributor David Ellis <d.f.ellis@ieee.org>
* @license MIT
*/
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const pkg = require('./index.cjs')
const pinegrowAstro = pkg.pinegrowAstro || pkg.default
const liveDesigner = pkg.liveDesigner
const moveLiveDesignerPluginBeforeAstroBuild = pkg.moveLiveDesignerPluginBeforeAstroBuild
const resolveAstroLiveDesignerOptions = pkg.resolveAstroLiveDesignerOptions
export {
liveDesigner,
moveLiveDesignerPluginBeforeAstroBuild,
pinegrowAstro,
resolveAstroLiveDesignerOptions,
}
export default pinegrowAstro
(()=>{var e={748:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},314:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},850:(e,t,r)=>{var n=r(748);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},290:(e,t,r)=>{var n=r(739);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},912:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},193:e=>{e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u,i,l=[],s=!0,a=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=u.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(a)throw o}}return l}},e.exports.__esModule=!0,e.exports.default=e.exports},147:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},96:e=>{e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},681:(e,t,r)=>{var n=r(314),o=r(193),u=r(121),i=r(147);e.exports=function(e,t){return n(e)||o(e,t)||u(e,t)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},408:(e,t,r)=>{var n=r(850),o=r(912),u=r(121),i=r(96);e.exports=function(e){return n(e)||o(e)||u(e)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},64:(e,t,r)=>{var n=r(425).default;e.exports=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},739:(e,t,r)=>{var n=r(425).default,o=r(64);e.exports=function(e){var t=o(e,"string");return"symbol"===n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},425:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},121:(e,t,r)=>{var n=r(748);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return e[n](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{createAstroComponentEntries:()=>S,createAstroElCacheEntry:()=>E,createAstroRuntimeBridge:()=>F,ensurePinegrowAstroBridge:()=>C,refreshAstroElCache:()=>M,scanAstroSourceDomMarkers:()=>_});var e=r(681),t=r(290),o=r(408);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?u(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l="data-pg-id",s="data-pg-id",a="astro",c=function(e){return{get value(){return e()}}},f=function(e){return{value:e}},d=function(e,t){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).immediate&&"function"==typeof t&&t(function(e){return"function"==typeof e?e():null==e?void 0:e.value}(e),void 0),function(){}},p=function(e,t){return{uid:"astro:".concat(e.id),isMounted:!0,isUnmounted:!1,parent:null,type:{__name:e.name||"AstroElement",__file:null},props:{},attrs:{},slots:{},subTree:{el:t},appContext:null}},m=function(){return"undefined"!=typeof window?window:null},v=function(e,t){var r=function(e){return e&&"function"==typeof e.get&&"function"==typeof e.set&&"function"==typeof e.delete&&"function"==typeof e.entries}(t)?t:new Map,n=null==e?void 0:e.reactiveFromContext;return"function"==typeof n?n(r):r},y=function(e){return(null==e?void 0:e.sourceFile)||(null==e?void 0:e.id)||null},g=function(e){return Array.isArray(e)?e:[]},b=function(e){return(null==e?void 0:e.firstEl)||(null==e?void 0:e.el)||null},x=function(e){return"".concat(e||"").replace(/\\/g,"/")},h=function(e){return e&&x(e).split("/").pop()||""},w=function(e,t,r){return{uid:t,isMounted:!0,isUnmounted:!1,parent:null,type:{__name:h(null==e?void 0:e.sourceFile)||"AstroComponent",__file:(null==e?void 0:e.sourceFile)||null},props:{},attrs:{},slots:{},subTree:{el:r},appContext:null}},A=function e(t,r){t&&(r(t),function(e){return Array.from((null==e?void 0:e.childNodes)||[])}(t).forEach((function(t){return e(t,r)})))},E=function(e){var t,r,n=e.boundary,o=void 0===n?null:n,u=e.element,c=e.firstElement,f=void 0===c?null:c,d=e.lastElement,m=void 0===d?null:d,v=e.manifest,y=e.markerAttribute,g=void 0===y?l:y,b=e.node,x=e.mirroredPgId,h=void 0!==x&&x,w=f||u,A=m||w,E=Boolean(o),S=E&&function(e){var t=(null==e?void 0:e.tagName)||(null==e?void 0:e.nodeName)||(null==e?void 0:e.localName)||"";return"astro-island"==="".concat(t).toLowerCase()}(w),_={start:null!==(t=b.sourceStart)&&void 0!==t?t:null,end:null!==(r=b.sourceEnd)&&void 0!==r?r:null,status:b.sourceRangeStatus||"unknown"};return{el:w,framework:a,entryKind:"source-node",treeScopes:{pageTree:!0,appTree:!1},isAstro:!0,isAstroSourceDomEntry:!0,isAstroComponent:!1,isAppTreeComponent:!1,sourceId:b.id,pgId:b.id,key:b.id,localFile:null,sourceFile:v.sourceFile||null,nodeType:b.type||null,name:b.name||"",source:{id:b.id,file:v.sourceFile||null,range:_,nodeType:b.type||null,name:b.name||""},component:null,owners:[],sourceRange:_,sourceStart:_.start,sourceEnd:_.end,sourceRangeStatus:_.status,marker:i(i({},b.marker||{}),{},{liveAttribute:g,pinegrowAttribute:s,mirroredPgId:h,boundary:o}),editability:b.editability||null,attributes:b.attributes||[],isFragment:E,isRootFragment:!1,isIsland:S,rootEl:null,firstEl:w,lastEl:A,instance:p(b,w),vnode:null}},S=function(e){var t=function(e){var t=e.entries,r=e.manifest,n=e.root,u=null==r?void 0:r.sourceFile,i=function(e){return e?e.documentElement?e.documentElement:e.body?e.body:e.firstElementChild?e.firstElementChild:1===e.nodeType?e:null:null}(n),l=function(e){return/(^|\/)src\/pages\/.+\.astro$/i.test(x(e))}(u),s=l&&i,c=!t.length;if(!u||!t.length&&!i)return null;var f,d=function(e){return o(e).sort((function(e,t){var r=b(e),n=b(t);if(!r||!n||r===n||"function"!=typeof r.compareDocumentPosition)return 0;var o=r.compareDocumentPosition(n);return 2&o?1:4&o?-1:0}))}(t),p=d[0],m=d[d.length-1],v="astro-component:".concat(u),y=s||c?i:b(p),g=s||c?null:(null==(f=m)?void 0:f.lastEl)||(null==f?void 0:f.el)||null,A=h(u),E=s?"page-root":"component-boundary",S=c?"markerless-component-file":"component-file",_=["astro-component-file"];return c&&_.push("astro-markerless-app-tree-entry"),{el:y,framework:a,entryKind:E,treeScopes:{pageTree:!1,appTree:!0},isAstro:!0,isAstroSourceDomEntry:!1,isAstroComponent:!0,isAppTreeComponent:!0,isAstroPageRoot:Boolean(s),isAstroMarkerlessComponent:Boolean(c),sourceId:v,pgId:null,key:null,localFile:u,sourceFile:u,nodeType:"component-file",name:A,source:{id:v,file:u,range:{start:null,end:null,status:S},nodeType:"component-file",name:A},component:{file:u,name:A,kind:l?"page":"component"},owners:[],sourceRange:{start:null,end:null,status:S},sourceStart:null,sourceEnd:null,sourceRangeStatus:S,marker:null,editability:{mode:"inspect",operations:["select","open-source-file"],reasons:_},attributes:[],state:Array.isArray(r.state)?r.state:[],isFragment:!1,isRootFragment:!1,isIsland:!1,rootEl:null,firstEl:y,lastEl:g,instance:w(r,v,y),vnode:null}}({entries:e.entries,manifest:e.manifest,root:e.root});return t?[t]:[]},_=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=function(e){var t;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).markerAttribute||(null==e||null===(t=e.marker)||void 0===t?void 0:t.attribute)||l}(t,r),o=[],u=[];if("ready"!==(null==t?void 0:t.status))return{status:"unavailable",markerAttribute:n,entries:o,componentEntries:[],missing:u,reason:(null==t?void 0:t.reason)||"Astro source manifest is unavailable."};if(!e||"function"!=typeof e.querySelectorAll)return{status:"unavailable",markerAttribute:n,entries:o,componentEntries:[],missing:u,reason:"A DOM root with querySelectorAll() is required."};var i=function(e){var t=new Map;return((null==e?void 0:e.nodes)||[]).forEach((function(e){null!=e&&e.id&&t.set(e.id,e)})),t}(t);return function(e,t){return e&&"function"==typeof e.querySelectorAll?Array.from(e.querySelectorAll("[".concat(t,"]"))):[]}(e,n).forEach((function(e){var l=function(e,t){return e&&"function"==typeof e.getAttribute?e.getAttribute(t):null}(e,n),a=i.get(l);if(a){var c=n!==s&&function(e,t){if(!1===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).mirrorPgId||!t||!e||"function"!=typeof e.getAttribute||"function"!=typeof e.setAttribute)return!1;var r,n=e.getAttribute(s);return n===t||!((r=n)&&!r.startsWith("pgastro-"))&&(e.setAttribute(s,t),!0)}(e,l,r);o.push(E({element:e,manifest:t,markerAttribute:n,node:a,mirroredPgId:c}))}else r.reportMissingMarkers&&u.push({element:e,sourceId:l})})),function(e,t){var r=new Map,n=[];return A(e,(function(e){var o=function(e){if(8!==(null==e?void 0:e.nodeType))return null;var t="".concat(e.nodeValue||"").trim().match(/^pgastro:(start|end):(.+)$/);return t?{boundary:t[1],sourceId:t[2]}:null}(e);if(o&&t.has(o.sourceId)){if("start"===o.boundary)return r.has(o.sourceId)||r.set(o.sourceId,[]),void r.get(o.sourceId).push(e);var u=r.get(o.sourceId),i=null==u?void 0:u.pop();if(i){var l=function(e,t){if(null==e||!e.parentNode||e.parentNode!==(null==t?void 0:t.parentNode))return{firstEl:null,lastEl:null};for(var r=null,n=null,o=e.nextSibling;o&&o!==t;)1===o.nodeType&&(r||(r=o),n=o),o=o.nextSibling;return{firstEl:r,lastEl:n}}(i,e),s=l.firstEl,a=l.lastEl;s&&n.push({sourceId:o.sourceId,firstEl:s,lastEl:a||s,startComment:i,endComment:e})}}})),n}(e,i).forEach((function(e){var r=i.get(e.sourceId);o.push(E({boundary:{strategy:"boundary-comment",startComment:e.startComment,endComment:e.endComment},element:e.firstEl,firstElement:e.firstEl,lastElement:e.lastEl,manifest:t,markerAttribute:n,node:r,mirroredPgId:!1}))})),{status:"ready",markerAttribute:n,entries:o,componentEntries:S({entries:o,manifest:t,root:e}),missing:u}},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m();return e?(e.pinegrow||(e.pinegrow={}),"function"!=typeof e.pinegrow.reactiveFromContext&&(e.pinegrow.reactiveFromContext=function(e){return e}),"function"!=typeof e.pinegrow.refFromContext&&(e.pinegrow.refFromContext=f),"function"!=typeof e.pinegrow.computedFromContext&&(e.pinegrow.computedFromContext=c),"function"!=typeof e.pinegrow.watchFromContext&&(e.pinegrow.watchFromContext=d),e.pinegrow.elCache=v(e.pinegrow,e.pinegrow.elCache),e.pinegrow.astro||(e.pinegrow.astro={}),e.pinegrow.astro.sourceManifests=v(e.pinegrow,e.pinegrow.astro.sourceManifests),e.pinegrow):null},M=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.win||m(),u=r.root||(null==n?void 0:n.document)||null,l=C(n),s=_(u,t,r);if(!l)return i(i({},s),{},{cached:0,removed:0,reason:s.reason||"A browser window is required."});if("ready"!==s.status)return i(i({},s),{},{cached:0,removed:0});var c=!1===r.clearPrevious?{elements:[],removed:0}:function(t,r){var n=y(r),o=0,u=[];return n?(Array.from(t.entries()).forEach((function(r){var i=e(r,2),l=i[0],s=i[1],c=g(s),f=c.filter((function(e){return!function(e,t){return(null==e?void 0:e.framework)===a&&(e.localFile===t||e.sourceFile===t)}(e,n)})),d=c.length-f.length;o+=d,d&&u.push(l),f.length?t.set(l,f):t.delete(l)})),{elements:u,removed:o}):{elements:u,removed:o}}(l.elCache,t),f=new Set(c.elements),d=[].concat(o(s.entries),o(s.componentEntries||[]));d.forEach((function(e){!function(e,t){var r=g(e.get(t.el)).filter((function(e){return e.framework!==a||e.sourceId!==t.sourceId||e.localFile!==t.localFile}));r.push(t),e.set(t.el,r)}(l.elCache,e),f.add(e.el)})),f.forEach((function(e){l.elUpdateHanderFn&&l.elUpdateHanderFn(e)}));var p=y(t);return p&&l.astro.sourceManifests.set(p,t),i(i({},s),{},{cached:d.length,removed:c.removed})},F=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{manifest:e,scan:function(r){var n,o;return _(r||t.root||(null===(n=t.win)||void 0===n?void 0:n.document)||(null===(o=m())||void 0===o?void 0:o.document),e,t)},refresh:function(r){return M(e,i(i({},t),r))}}}})(),module.exports=n})();
export {
createAstroComponentEntries,
createAstroElCacheEntry,
createAstroRuntimeBridge,
ensurePinegrowAstroBridge,
refreshAstroElCache,
scanAstroSourceDomMarkers,
} from '../adapters/astro/astro-runtime-bridge.js'
+12
-0

@@ -157,2 +157,6 @@ /*!

/*! ./plugin-watch-policy.js */
/*! ./plugin-watched-files.js */
/*! ./polling.js */

@@ -384,2 +388,6 @@

/*!************************************!*\
!*** ./src/plugin-watch-policy.js ***!
\************************************/
/*!*************************************!*\

@@ -389,2 +397,6 @@ !*** ./node_modules/ws/wrapper.mjs ***!

/*!*************************************!*\
!*** ./src/plugin-watched-files.js ***!
\*************************************/
/*!**************************************!*\

@@ -391,0 +403,0 @@ !*** ../../node_modules/ms/index.js ***!

+6
-2

@@ -1,4 +0,8 @@

import pkg from './index.cjs'
var liveDesigner = pkg.liveDesigner
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const pkg = require('./index.cjs')
const liveDesigner = pkg.liveDesigner
export { liveDesigner }
export default pkg

@@ -19,6 +19,22 @@ import {

if (!(winObj?.process?.client && winObj.process.client !== true)) {
if (!winObj.pinegrow) {
const isMapLike = value =>
value &&
typeof value.get === 'function' &&
typeof value.set === 'function' &&
typeof value.delete === 'function' &&
typeof value.entries === 'function'
const existingPinegrow = winObj.pinegrow || {}
const existingElCache = isMapLike(existingPinegrow.elCache) ? existingPinegrow.elCache : new Map()
const elCache = reactive(existingElCache)
if (
!winObj.pinegrow ||
winObj.pinegrow.elCache !== elCache ||
winObj.pinegrow.reactiveFromContext !== reactive ||
winObj.pinegrow.refFromContext !== ref ||
winObj.pinegrow.computedFromContext !== computed ||
winObj.pinegrow.watchFromContext !== watch
) {
// console.log('Cache initialized by Vue Plugin!')
const elCache = reactive(new Map())
const enrichWithComponentName = (elCacheObj, localFile) => {

@@ -32,3 +48,3 @@ return {

winObj.pinegrow = {
winObj.pinegrow = Object.assign(existingPinegrow, {
elCache,

@@ -45,3 +61,3 @@ // pgIdToElComputed,

// elUpdateHanderFn,
}
})
}

@@ -52,3 +68,3 @@ }

// pgId & key can be optional
const pgUpdateElCache = (hook, pgId, rootEl, key, localFile) => async vnode => {
const pgUpdateElCache = (hook, pgId, rootEl, key, localFile, sourceFile) => async vnode => {
if (!vnode) return

@@ -69,3 +85,5 @@ if (window?.process?.client && process?.client !== true) return

localFile = localFile || vnode.type.__file
if (!sourceFile) {
localFile = localFile || vnode.type.__file
}

@@ -212,10 +230,30 @@ let isRootFragment = false

if (sourceFile && pgId) {
elCacheObj.sourceFile = sourceFile
elCacheObj.framework = 'vue'
elCacheObj.entryKind = 'source-node'
elCacheObj.treeScopes = {
pageTree: true,
appTree: false,
}
}
let prevElCacheNodes = pinegrow.elCache.get(el)
if (prevElCacheNodes) {
let index = prevElCacheNodes.findIndex(elCacheObj => elCacheObj.instance.uid === instance.uid)
let index =
sourceFile && pgId
? prevElCacheNodes.findIndex(
prevElCacheObj =>
prevElCacheObj.instance.uid === instance.uid &&
prevElCacheObj.sourceFile === sourceFile &&
prevElCacheObj.pgId === pgId
)
: prevElCacheNodes.findIndex(elCacheObj => elCacheObj.instance.uid === instance.uid)
if (index > -1) {
const prevElCacheObj = prevElCacheNodes[index]
elCacheObj.localFile = elCacheObj.localFile || prevElCacheObj.localFile
if (!sourceFile) {
elCacheObj.localFile = elCacheObj.localFile || prevElCacheObj.localFile
}
if (elCacheObj.pgId && prevElCacheObj.pgId && elCacheObj.pgId !== prevElCacheObj.pgId) {

@@ -236,3 +274,7 @@ if (!prevElCacheNodes.map(prevElCacheNode => prevElCacheNode.pgId).includes(elCacheObj.pgId)) {

childVNodes.forEach(childVNode => {
pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key)(childVNode)
if (sourceFile) {
pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key, localFile, sourceFile)(childVNode)
} else {
pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key)(childVNode)
}
})

@@ -326,2 +368,1 @@ }

}
{
"name": "@pinegrow/vite-plugin",
"version": "3.0.75",
"version": "3.0.76-alpha.0",
"description": "Pinegrow Vite Plugin",

@@ -8,3 +8,5 @@ "type": "module",

"dist",
"./types.d.ts"
"./types.d.ts",
"./astro.d.ts",
"./astro-runtime.d.ts"
],

@@ -24,4 +26,22 @@ "main": "./dist/index.cjs",

},
"./dev/astro": {
"import": "./src/astro/index.dev.js",
"require": "./src/astro/index.dev.js"
},
"./dev/astro/runtime": {
"import": "./src/astro/runtime.js",
"require": "./src/astro/runtime.js"
},
"./vue": {
"import": "./dist/vue/index.js"
},
"./astro": {
"types": "./astro.d.ts",
"import": "./dist/astro/index.mjs",
"require": "./dist/astro/index.cjs"
},
"./astro/runtime": {
"types": "./astro-runtime.d.ts",
"import": "./dist/astro/runtime.mjs",
"require": "./dist/astro/runtime.cjs"
}

@@ -43,2 +63,5 @@ },

"build:vite-plugin:dev": "webpack -- --env mode=development vite",
"test": "node --test test/*.test.mjs",
"publish-alpha": "npm run increment-alpha-version && npm publish --tag alpha",
"increment-alpha-version": "npm version prerelease --preid=alpha",
"publish-beta": "npm run increment-beta-version && npm publish --tag beta",

@@ -52,3 +75,6 @@ "increment-beta-version": "npm version prerelease --preid=beta",

"magic-string": "^0.27.0"
},
"devDependencies": {
"@astrojs/compiler": "^2.2.1"
}
}

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