@pinegrow/vite-plugin
Advanced tools
@@ -157,6 +157,2 @@ /*! | ||
| /*! ./plugin-watch-policy.js */ | ||
| /*! ./plugin-watched-files.js */ | ||
| /*! ./polling.js */ | ||
@@ -388,6 +384,2 @@ | ||
| /*!************************************!*\ | ||
| !*** ./src/plugin-watch-policy.js ***! | ||
| \************************************/ | ||
| /*!*************************************!*\ | ||
@@ -397,6 +389,2 @@ !*** ./node_modules/ws/wrapper.mjs ***! | ||
| /*!*************************************!*\ | ||
| !*** ./src/plugin-watched-files.js ***! | ||
| \*************************************/ | ||
| /*!**************************************!*\ | ||
@@ -403,0 +391,0 @@ !*** ../../node_modules/ms/index.js ***! |
+2
-6
@@ -1,8 +0,4 @@ | ||
| import { createRequire } from 'node:module' | ||
| const require = createRequire(import.meta.url) | ||
| const pkg = require('./index.cjs') | ||
| const liveDesigner = pkg.liveDesigner | ||
| import pkg from './index.cjs' | ||
| var liveDesigner = pkg.liveDesigner | ||
| export { liveDesigner } | ||
| export default pkg |
+11
-52
@@ -19,22 +19,6 @@ import { | ||
| if (!(winObj?.process?.client && winObj.process.client !== true)) { | ||
| const isMapLike = value => | ||
| value && | ||
| typeof value.get === 'function' && | ||
| typeof value.set === 'function' && | ||
| typeof value.delete === 'function' && | ||
| typeof value.entries === 'function' | ||
| if (!winObj.pinegrow) { | ||
| // console.log('Cache initialized by Vue Plugin!') | ||
| const elCache = reactive(new Map()) | ||
| 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 enrichWithComponentName = (elCacheObj, localFile) => { | ||
@@ -48,3 +32,3 @@ return { | ||
| winObj.pinegrow = Object.assign(existingPinegrow, { | ||
| winObj.pinegrow = { | ||
| elCache, | ||
@@ -61,3 +45,3 @@ // pgIdToElComputed, | ||
| // elUpdateHanderFn, | ||
| }) | ||
| } | ||
| } | ||
@@ -68,3 +52,3 @@ } | ||
| // pgId & key can be optional | ||
| const pgUpdateElCache = (hook, pgId, rootEl, key, localFile, sourceFile) => async vnode => { | ||
| const pgUpdateElCache = (hook, pgId, rootEl, key, localFile) => async vnode => { | ||
| if (!vnode) return | ||
@@ -85,5 +69,3 @@ if (window?.process?.client && process?.client !== true) return | ||
| if (!sourceFile) { | ||
| localFile = localFile || vnode.type.__file | ||
| } | ||
| localFile = localFile || vnode.type.__file | ||
@@ -230,30 +212,10 @@ 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 = | ||
| sourceFile && pgId | ||
| ? prevElCacheNodes.findIndex( | ||
| prevElCacheObj => | ||
| prevElCacheObj.instance.uid === instance.uid && | ||
| prevElCacheObj.sourceFile === sourceFile && | ||
| prevElCacheObj.pgId === pgId | ||
| ) | ||
| : prevElCacheNodes.findIndex(elCacheObj => elCacheObj.instance.uid === instance.uid) | ||
| let index = prevElCacheNodes.findIndex(elCacheObj => elCacheObj.instance.uid === instance.uid) | ||
| if (index > -1) { | ||
| const prevElCacheObj = prevElCacheNodes[index] | ||
| if (!sourceFile) { | ||
| elCacheObj.localFile = elCacheObj.localFile || prevElCacheObj.localFile | ||
| } | ||
| elCacheObj.localFile = elCacheObj.localFile || prevElCacheObj.localFile | ||
| if (elCacheObj.pgId && prevElCacheObj.pgId && elCacheObj.pgId !== prevElCacheObj.pgId) { | ||
@@ -274,7 +236,3 @@ if (!prevElCacheNodes.map(prevElCacheNode => prevElCacheNode.pgId).includes(elCacheObj.pgId)) { | ||
| childVNodes.forEach(childVNode => { | ||
| if (sourceFile) { | ||
| pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key, localFile, sourceFile)(childVNode) | ||
| } else { | ||
| pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key)(childVNode) | ||
| } | ||
| pgUpdateElCache(hook, pgId, isRootFragment ? el : rootEl, key)(childVNode) | ||
| }) | ||
@@ -368,1 +326,2 @@ } | ||
| } | ||
+2
-28
| { | ||
| "name": "@pinegrow/vite-plugin", | ||
| "version": "3.0.76-alpha.1", | ||
| "version": "3.0.76-alpha.2", | ||
| "description": "Pinegrow Vite Plugin", | ||
@@ -8,5 +8,3 @@ "type": "module", | ||
| "dist", | ||
| "./types.d.ts", | ||
| "./astro.d.ts", | ||
| "./astro-runtime.d.ts" | ||
| "./types.d.ts" | ||
| ], | ||
@@ -26,22 +24,4 @@ "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" | ||
| } | ||
@@ -63,5 +43,2 @@ }, | ||
| "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", | ||
@@ -75,6 +52,3 @@ "increment-beta-version": "npm version prerelease --preid=beta", | ||
| "magic-string": "^0.27.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@astrojs/compiler": "^2.2.1" | ||
| } | ||
| } |
| 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 |
-17
| 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 astroStateSnapshotAttribute = 'data-pg-astro-state' | ||
| const astroStateSnapshotJsonAttribute = 'data-pg-astro-state-json' | ||
| const astroStateSnapshotSourceAttribute = 'data-pg-astro-source' | ||
| 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 createStateSnapshotKey = record => `${record?.type || ''}:${record?.key || ''}` | ||
| const decodeAstroSnapshotValue = value => { | ||
| if (!value || typeof value !== 'object' || Array.isArray(value)) { | ||
| return value | ||
| } | ||
| if (value.__pinegrowAstroType === 'undefined') { | ||
| return undefined | ||
| } | ||
| if (value.__pinegrowAstroType === 'bigint') { | ||
| return `${value.value || ''}n` | ||
| } | ||
| if (value.__pinegrowAstroType === 'function') { | ||
| return '[function]' | ||
| } | ||
| if (value.__pinegrowAstroType === 'symbol') { | ||
| return value.value || '[symbol]' | ||
| } | ||
| return value | ||
| } | ||
| const queryAstroStateSnapshotPayloads = (root, sourceFile) => { | ||
| if (!root || typeof root.querySelectorAll !== 'function' || !sourceFile) { | ||
| return [] | ||
| } | ||
| let elements = [] | ||
| try { | ||
| elements = Array.from(root.querySelectorAll(`[${astroStateSnapshotAttribute}]`)) | ||
| } catch (_error) { | ||
| return [] | ||
| } | ||
| return elements | ||
| .map(element => { | ||
| const source = element.getAttribute?.(astroStateSnapshotSourceAttribute) | ||
| const json = element.getAttribute?.(astroStateSnapshotJsonAttribute) | ||
| if (source !== sourceFile || !json) { | ||
| return null | ||
| } | ||
| try { | ||
| return JSON.parse(json) | ||
| } catch (_error) { | ||
| return null | ||
| } | ||
| }) | ||
| .filter(Boolean) | ||
| } | ||
| const createAstroStateSnapshotIndex = (root, sourceFile) => { | ||
| const index = new Map() | ||
| queryAstroStateSnapshotPayloads(root, sourceFile).forEach(payload => { | ||
| ;(payload.entries || []).forEach(entry => { | ||
| if (!entry || typeof entry.type !== 'string' || typeof entry.key !== 'string') { | ||
| return | ||
| } | ||
| index.set(createStateSnapshotKey(entry), { | ||
| value: decodeAstroSnapshotValue(entry.value), | ||
| source: payload.sourceFile || sourceFile, | ||
| version: payload.version || null, | ||
| }) | ||
| }) | ||
| }) | ||
| return index | ||
| } | ||
| const applyAstroStateSnapshots = (state, snapshotIndex) => { | ||
| if (!Array.isArray(state) || !snapshotIndex?.size) { | ||
| return state | ||
| } | ||
| return state.map(record => { | ||
| const snapshot = snapshotIndex.get(createStateSnapshotKey(record)) | ||
| if (!snapshot) { | ||
| return record | ||
| } | ||
| return { | ||
| ...record, | ||
| sourceValue: record.sourceValue ?? record.value, | ||
| value: snapshot.value, | ||
| valueStatus: 'server-snapshot', | ||
| snapshot: { | ||
| source: snapshot.source, | ||
| version: snapshot.version, | ||
| }, | ||
| } | ||
| }) | ||
| } | ||
| 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 sourceSnapshot = manifest.sourceSnapshot || null | ||
| const snapshotId = sourceSnapshot?.id || null | ||
| 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, | ||
| snapshotId, | ||
| sourceSnapshot, | ||
| 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 || '', | ||
| ...(sourceSnapshot ? { snapshot: sourceSnapshot } : {}), | ||
| }, | ||
| 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, stateSnapshotIndex = null }) => { | ||
| const sourceFile = manifest?.sourceFile | ||
| const sourceSnapshot = manifest?.sourceSnapshot || null | ||
| const snapshotId = sourceSnapshot?.id || null | ||
| 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, | ||
| snapshotId, | ||
| sourceSnapshot, | ||
| 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, | ||
| ...(sourceSnapshot ? { snapshot: sourceSnapshot } : {}), | ||
| }, | ||
| 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: applyAstroStateSnapshots( | ||
| Array.isArray(manifest.state) ? manifest.state : [], | ||
| stateSnapshotIndex | ||
| ), | ||
| 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, | ||
| stateSnapshotIndex: createAstroStateSnapshotIndex(root, manifest?.sourceFile), | ||
| }) | ||
| 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,l,i=[],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)&&(i.push(n.value),i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{if(!s&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(a)throw o}}return i}},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),l=r(147);e.exports=function(e,t){return n(e)||o(e,t)||u(e,t)||l()},e.exports.__esModule=!0,e.exports.default=e.exports},408:(e,t,r)=>{var n=r(850),o=r(912),u=r(121),l=r(96);e.exports=function(e){return n(e)||o(e)||u(e)||l()},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:()=>I,createAstroElCacheEntry:()=>C,createAstroRuntimeBridge:()=>k,ensurePinegrowAstroBridge:()=>F,refreshAstroElCache:()=>O,scanAstroSourceDomMarkers:()=>M});var e=r(681),t=r(290),o=r(425),u=r(408);function l(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?l(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s="data-pg-id",a="data-pg-id",c="astro",p=function(e){return{get value(){return e()}}},d=function(e){return{value:e}},f=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(){}},m=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}},v=function(){return"undefined"!=typeof window?window:null},y=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},g=function(e){return(null==e?void 0:e.sourceFile)||(null==e?void 0:e.id)||null},b=function(e){return Array.isArray(e)?e:[]},h=function(e){return(null==e?void 0:e.firstEl)||(null==e?void 0:e.el)||null},x=function(e){return"".concat(e||"").replace(/\\/g,"/")},A=function(e){return e&&x(e).split("/").pop()||""},w=function(e,t,r){return{uid:t,isMounted:!0,isUnmounted:!1,parent:null,type:{__name:A(null==e?void 0:e.sourceFile)||"AstroComponent",__file:(null==e?void 0:e.sourceFile)||null},props:{},attrs:{},slots:{},subTree:{el:r},appContext:null}},E=function(e){return"".concat((null==e?void 0:e.type)||"",":").concat((null==e?void 0:e.key)||"")},S=function(e,t){var r=new Map;return function(e,t){if(!e||"function"!=typeof e.querySelectorAll||!t)return[];var r=[];try{r=Array.from(e.querySelectorAll("[".concat("data-pg-astro-state","]")))}catch(e){return[]}return r.map((function(e){var r,n,o=null===(r=e.getAttribute)||void 0===r?void 0:r.call(e,"data-pg-astro-source"),u=null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"data-pg-astro-state-json");if(o!==t||!u)return null;try{return JSON.parse(u)}catch(e){return null}})).filter(Boolean)}(e,t).forEach((function(e){(e.entries||[]).forEach((function(n){var u;n&&"string"==typeof n.type&&"string"==typeof n.key&&r.set(E(n),{value:(u=n.value,!u||"object"!==o(u)||Array.isArray(u)?u:"undefined"!==u.__pinegrowAstroType?"bigint"===u.__pinegrowAstroType?"".concat(u.value||"","n"):"function"===u.__pinegrowAstroType?"[function]":"symbol"===u.__pinegrowAstroType?u.value||"[symbol]":u:void 0),source:e.sourceFile||t,version:e.version||null})}))})),r},_=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)})))},C=function(e){var t,r,n=e.boundary,o=void 0===n?null:n,u=e.element,l=e.firstElement,p=void 0===l?null:l,d=e.lastElement,f=void 0===d?null:d,v=e.manifest,y=e.markerAttribute,g=void 0===y?s:y,b=e.node,h=e.mirroredPgId,x=void 0!==h&&h,A=p||u,w=f||A,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()}(A),_=v.sourceSnapshot||null,C=(null==_?void 0:_.id)||null,I={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:A,framework:c,entryKind:"source-node",treeScopes:{pageTree:!0,appTree:!1},isAstro:!0,isAstroSourceDomEntry:!0,isAstroComponent:!1,isAppTreeComponent:!1,sourceId:b.id,pgId:b.id,snapshotId:C,sourceSnapshot:_,key:b.id,localFile:null,sourceFile:v.sourceFile||null,nodeType:b.type||null,name:b.name||"",source:i({id:b.id,file:v.sourceFile||null,range:I,nodeType:b.type||null,name:b.name||""},_?{snapshot:_}:{}),component:null,owners:[],sourceRange:I,sourceStart:I.start,sourceEnd:I.end,sourceRangeStatus:I.status,marker:i(i({},b.marker||{}),{},{liveAttribute:g,pinegrowAttribute:a,mirroredPgId:x,boundary:o}),editability:b.editability||null,attributes:b.attributes||[],isFragment:E,isRootFragment:!1,isIsland:S,rootEl:null,firstEl:A,lastEl:w,instance:m(b,A),vnode:null}},I=function(e){var t=e.entries,r=e.manifest,n=e.root,o=function(e){var t=e.entries,r=e.manifest,n=e.root,o=e.stateSnapshotIndex,l=void 0===o?null:o,s=null==r?void 0:r.sourceFile,a=(null==r?void 0:r.sourceSnapshot)||null,p=(null==a?void 0:a.id)||null,d=function(e){return e?e.documentElement?e.documentElement:e.body?e.body:e.firstElementChild?e.firstElementChild:1===e.nodeType?e:null:null}(n),f=function(e){return/(^|\/)src\/pages\/.+\.astro$/i.test(x(e))}(s),m=f&&d,v=!t.length;if(!s||!t.length&&!d)return null;var y,g,b,S=function(e){return u(e).sort((function(e,t){var r=h(e),n=h(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),_=S[0],C=S[S.length-1],I="astro-component:".concat(s),M=m||v?d:h(_),F=m||v?null:(null==(y=C)?void 0:y.lastEl)||(null==y?void 0:y.el)||null,O=A(s),k=m?"page-root":"component-boundary",j=v?"markerless-component-file":"component-file",P=["astro-component-file"];return v&&P.push("astro-markerless-app-tree-entry"),{el:M,framework:c,entryKind:k,treeScopes:{pageTree:!1,appTree:!0},isAstro:!0,isAstroSourceDomEntry:!1,isAstroComponent:!0,isAppTreeComponent:!0,isAstroPageRoot:Boolean(m),isAstroMarkerlessComponent:Boolean(v),sourceId:I,pgId:null,snapshotId:p,sourceSnapshot:a,key:null,localFile:s,sourceFile:s,nodeType:"component-file",name:O,source:i({id:I,file:s,range:{start:null,end:null,status:j},nodeType:"component-file",name:O},a?{snapshot:a}:{}),component:{file:s,name:O,kind:f?"page":"component"},owners:[],sourceRange:{start:null,end:null,status:j},sourceStart:null,sourceEnd:null,sourceRangeStatus:j,marker:null,editability:{mode:"inspect",operations:["select","open-source-file"],reasons:P},attributes:[],state:(g=Array.isArray(r.state)?r.state:[],b=l,Array.isArray(g)&&null!=b&&b.size?g.map((function(e){var t,r=b.get(E(e));return r?i(i({},e),{},{sourceValue:null!==(t=e.sourceValue)&&void 0!==t?t:e.value,value:r.value,valueStatus:"server-snapshot",snapshot:{source:r.source,version:r.version}}):e})):g),isFragment:!1,isRootFragment:!1,isIsland:!1,rootEl:null,firstEl:M,lastEl:F,instance:w(r,I,M),vnode:null}}({entries:t,manifest:r,root:n,stateSnapshotIndex:S(n,null==r?void 0:r.sourceFile)});return o?[o]:[]},M=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)||s}(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 l=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 i=function(e,t){return e&&"function"==typeof e.getAttribute?e.getAttribute(t):null}(e,n),s=l.get(i);if(s){var c=n!==a&&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(a);return n===t||!((r=n)&&!r.startsWith("pgastro-"))&&(e.setAttribute(a,t),!0)}(e,i,r);o.push(C({element:e,manifest:t,markerAttribute:n,node:s,mirroredPgId:c}))}else r.reportMissingMarkers&&u.push({element:e,sourceId:i})})),function(e,t){var r=new Map,n=[];return _(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),l=null==u?void 0:u.pop();if(l){var i=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}}(l,e),s=i.firstEl,a=i.lastEl;s&&n.push({sourceId:o.sourceId,firstEl:s,lastEl:a||s,startComment:l,endComment:e})}}})),n}(e,l).forEach((function(e){var r=l.get(e.sourceId);o.push(C({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:I({entries:o,manifest:t,root:e}),missing:u}},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v();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=d),"function"!=typeof e.pinegrow.computedFromContext&&(e.pinegrow.computedFromContext=p),"function"!=typeof e.pinegrow.watchFromContext&&(e.pinegrow.watchFromContext=f),e.pinegrow.elCache=y(e.pinegrow,e.pinegrow.elCache),e.pinegrow.astro||(e.pinegrow.astro={}),e.pinegrow.astro.sourceManifests=y(e.pinegrow,e.pinegrow.astro.sourceManifests),e.pinegrow):null},O=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.win||v(),o=r.root||(null==n?void 0:n.document)||null,l=F(n),s=M(o,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 a=!1===r.clearPrevious?{elements:[],removed:0}:function(t,r){var n=g(r),o=0,u=[];return n?(Array.from(t.entries()).forEach((function(r){var l=e(r,2),i=l[0],s=l[1],a=b(s),p=a.filter((function(e){return!function(e,t){return(null==e?void 0:e.framework)===c&&(e.localFile===t||e.sourceFile===t)}(e,n)})),d=a.length-p.length;o+=d,d&&u.push(i),p.length?t.set(i,p):t.delete(i)})),{elements:u,removed:o}):{elements:u,removed:o}}(l.elCache,t),p=new Set(a.elements),d=[].concat(u(s.entries),u(s.componentEntries||[]));d.forEach((function(e){!function(e,t){var r=b(e.get(t.el)).filter((function(e){return e.framework!==c||e.sourceId!==t.sourceId||e.localFile!==t.localFile}));r.push(t),e.set(t.el,r)}(l.elCache,e),p.add(e.el)})),p.forEach((function(e){l.elUpdateHanderFn&&l.elUpdateHanderFn(e)}));var f=g(t);return f&&l.astro.sourceManifests.set(f,t),i(i({},s),{},{cached:d.length,removed:a.removed})},k=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{manifest:e,scan:function(r){var n,o;return M(r||t.root||(null===(n=t.win)||void 0===n?void 0:n.document)||(null===(o=v())||void 0===o?void 0:o.document),e,t)},refresh:function(r){return O(e,i(i({},t),r))}}}})(),module.exports=n})(); |
| export { | ||
| createAstroComponentEntries, | ||
| createAstroElCacheEntry, | ||
| createAstroRuntimeBridge, | ||
| ensurePinegrowAstroBridge, | ||
| refreshAstroElCache, | ||
| scanAstroSourceDomMarkers, | ||
| } from '../adapters/astro/astro-runtime-bridge.js' |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%3
-40%29
-46.3%10
-44.44%950952
-52.62%8
-50%405
-69.18%