{"version":3,"sources":["jsdelivr-header.js","/npm/@dhiwise/component-tagger@1.0.10/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,OAAO,eAAe,QAAS,aAAc,CAAE,OAAO,IAEtD,IAAI,KAAO,QAAQ,QACf,OAAS,QAAQ,iBACjB,KAAO,QAAQ,eACf,YAAc,QAAQ,gBAE1B,SAAS,yBAAyB,GAChC,IAAI,EAAI,OAAO,OAAO,MAatB,OAZI,GACF,OAAO,KAAK,GAAG,SAAQ,SAAU,GAC/B,GAAU,YAAN,EAAiB,CACnB,IAAI,EAAI,OAAO,yBAAyB,EAAG,GAC3C,OAAO,eAAe,EAAG,EAAG,EAAE,IAAM,EAAI,CACtC,YAAY,EACZ,IAAK,WAAc,OAAO,EAAE,EAAI,GAEpC,CACF,IAEF,EAAE,QAAU,EACL,OAAO,OAAO,EACvB,CAEA,IAAI,gBAA+B,yBAAyB,MAE5D,MAAM,4BAA8B,IAAI,IAAI,CACxC,WACA,WACA,aACA,WACA,mBAEE,yBAA2B,CAC7B,QACA,qBACA,oBACA,sBACA,oBACA,mBACA,oBACA,8BACA,8BACA,sBACA,kBACA,6BACA,eACA,kBAGE,qBAAuB,CACzB,WACA,gBACA,kBACA,OACA,cACA,gBACA,QACA,SACA,MACA,cACA,WACA,OACA,eACA,WACA,SACA,QACA,SACA,oBACA,qBACA,aACA,cACA,0BACA,iBACA,oBACA,uBACA,qBACA,yBACA,6BACA,wBACA,4BACA,sBACA,2BACA,sBACA,2BACA,qBACA,sBACA,uBACA,4BACA,sBACA,0BACA,qBACA,oBACA,sBACA,qBACA,sBACA,uBACA,qBACA,eACA,oBACA,gBACA,iBACA,eACA,gBACA,gBACA,gBACA,kBACA,gBACA,eACA,mBACA,iBACA,cACA,kBACA,WACA,iBACA,iBACA,oBACA,iBACA,iBACA,uBACA,uBACA,oBACA,mBACA,qBACA,sBACA,oBACA,uBACA,oBACA,qBACA,qBACA,oBACA,YACA,QACA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BAAyB,uBAAuB,MACrF,GAAmB,IAAI,EAAc,yBAAyB,uBAAuB,OAErF,EAAc,wBAAyB,CACvC,MAAM,EAAc,KAAK,UAAU,GACnC,IAAI,EAAiB,mBAAmB,GACpC,EAAc,kBACd,EAAe,OAAS,EAAc,mBACtC,EACI,EAAe,UAAU,EAAG,EAAc,kBACtC,OAEZ,GAAmB,IAAI,EAAc,4BAA4B,IACrE,CACA,EAAY,WAAuC,QAA3B,EAAK,EAAQ,KAAK,WAAwB,IAAP,EAAgB,EAAK,EAAG,GACnF,WAAW,EAAgB,WAAY,GACvC,GAAsB,IAG9B,EAAM,iBACN,EAAM,eAAiB,EACnB,EAAuB,GACvB,WAAW,UAAU,mBAAsC,IAAgB,GAE3E,EAAuB,EAChB,CACH,KAAM,EAAY,WAClB,IAAK,EAAc,WACb,EAAY,YAAY,CAAE,OAAO,IACjC,MAGP,IACX,CACA,MAAO,GAIH,OAFA,QAAQ,MAAM,yBAAyB,KAAiB,GACxD,EAAM,iBACC,IACX,GAEJ,WAAY,KACR,WAAW,kCAAmC,EAAc,EAEhE,SAAU,KACN,WAAW,gBAAgB,GAAQ,EAAc,EAG7D,CAEA,QAAQ,QAAU","file":"/npm/@dhiwise/component-tagger@1.0.10/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@dhiwise/component-tagger@1.0.10/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar path = require('path');\nvar parser = require('@babel/parser');\nvar core = require('@babel/core');\nvar MagicString = require('magic-string');\n\nfunction _interopNamespaceDefault(e) {\n  var n = Object.create(null);\n  if (e) {\n    Object.keys(e).forEach(function (k) {\n      if (k !== 'default') {\n        var d = Object.getOwnPropertyDescriptor(e, k);\n        Object.defineProperty(n, k, d.get ? d : {\n          enumerable: true,\n          get: function () { return e[k]; }\n        });\n      }\n    });\n  }\n  n.default = e;\n  return Object.freeze(n);\n}\n\nvar path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);\n\nconst REACT_STRUCTURAL_COMPONENTS = new Set([\n    'Fragment',\n    'Suspense',\n    'StrictMode',\n    'Profiler',\n    'React.Fragment',\n]);\nconst THREE_JS_IMPORT_PATTERNS = [\n    'three',\n    '@react-three/fiber',\n    '@react-three/drei',\n    '@react-three/rapier',\n    '@react-three/a11y',\n    '@react-three/csg',\n    '@react-three/flex',\n    '@react-three/gpu-pathtracer',\n    '@react-three/postprocessing',\n    '@react-three/cannon',\n    '@react-three/xr',\n    '@react-three/test-renderer',\n    'three/addons',\n    'three/examples',\n];\n// Three.js Fiber elements\nconst THREE_FIBER_ELEMENTS = [\n    'object3D',\n    'audioListener',\n    'positionalAudio',\n    'mesh',\n    'batchedMesh',\n    'instancedMesh',\n    'scene',\n    'sprite',\n    'lOD',\n    'skinnedMesh',\n    'skeleton',\n    'bone',\n    'lineSegments',\n    'lineLoop',\n    'points',\n    'group',\n    'camera',\n    'perspectiveCamera',\n    'orthographicCamera',\n    'cubeCamera',\n    'arrayCamera',\n    'instancedBufferGeometry',\n    'bufferGeometry',\n    'boxBufferGeometry',\n    'circleBufferGeometry',\n    'coneBufferGeometry',\n    'cylinderBufferGeometry',\n    'dodecahedronBufferGeometry',\n    'extrudeBufferGeometry',\n    'icosahedronBufferGeometry',\n    'latheBufferGeometry',\n    'octahedronBufferGeometry',\n    'planeBufferGeometry',\n    'polyhedronBufferGeometry',\n    'ringBufferGeometry',\n    'shapeBufferGeometry',\n    'sphereBufferGeometry',\n    'tetrahedronBufferGeometry',\n    'torusBufferGeometry',\n    'torusKnotBufferGeometry',\n    'tubeBufferGeometry',\n    'wireframeGeometry',\n    'tetrahedronGeometry',\n    'octahedronGeometry',\n    'icosahedronGeometry',\n    'dodecahedronGeometry',\n    'polyhedronGeometry',\n    'tubeGeometry',\n    'torusKnotGeometry',\n    'torusGeometry',\n    'sphereGeometry',\n    'ringGeometry',\n    'planeGeometry',\n    'latheGeometry',\n    'shapeGeometry',\n    'extrudeGeometry',\n    'edgesGeometry',\n    'coneGeometry',\n    'cylinderGeometry',\n    'circleGeometry',\n    'boxGeometry',\n    'capsuleGeometry',\n    'material',\n    'shadowMaterial',\n    'spriteMaterial',\n    'rawShaderMaterial',\n    'shaderMaterial',\n    'pointsMaterial',\n    'meshPhysicalMaterial',\n    'meshStandardMaterial',\n    'meshPhongMaterial',\n    'meshToonMaterial',\n    'meshNormalMaterial',\n    'meshLambertMaterial',\n    'meshDepthMaterial',\n    'meshDistanceMaterial',\n    'meshBasicMaterial',\n    'meshMatcapMaterial',\n    'lineDashedMaterial',\n    'lineBasicMaterial',\n    'primitive',\n    'light',\n    'spotLightShadow',\n    'spotLight',\n    'pointLight',\n    'rectAreaLight',\n    'hemisphereLight',\n    'directionalLightShadow',\n    'directionalLight',\n    'ambientLight',\n    'lightShadow',\n    'ambientLightProbe',\n    'hemisphereLightProbe',\n    'lightProbe',\n    'spotLightHelper',\n    'skeletonHelper',\n    'pointLightHelper',\n    'hemisphereLightHelper',\n    'gridHelper',\n    'polarGridHelper',\n    'directionalLightHelper',\n    'cameraHelper',\n    'boxHelper',\n    'box3Helper',\n    'planeHelper',\n    'arrowHelper',\n    'axesHelper',\n    'texture',\n    'videoTexture',\n    'dataTexture',\n    'dataTexture3D',\n    'compressedTexture',\n    'cubeTexture',\n    'canvasTexture',\n    'depthTexture',\n    'raycaster',\n    'vector2',\n    'vector3',\n    'vector4',\n    'euler',\n    'matrix3',\n    'matrix4',\n    'quaternion',\n    'bufferAttribute',\n    'float16BufferAttribute',\n    'float32BufferAttribute',\n    'float64BufferAttribute',\n    'int8BufferAttribute',\n    'int16BufferAttribute',\n    'int32BufferAttribute',\n    'uint8BufferAttribute',\n    'uint16BufferAttribute',\n    'uint32BufferAttribute',\n    'instancedBufferAttribute',\n    'color',\n    'fog',\n    'fogExp2',\n    'shape',\n    'colorShiftMaterial',\n];\n/**\n * Extracts all identifiers imported from Three.js packages in the given AST\n * @param ast The parsed AST of the code\n * @returns Set of imported Three.js identifiers\n */\nfunction getThreeJSImports(ast) {\n    const threeJSImports = new Set();\n    for (const node of ast.program.body) {\n        if (node.type === 'ImportDeclaration') {\n            const importDeclaration = node;\n            const source = importDeclaration.source.value;\n            // Check if the import source matches any Three.js pattern\n            const isThreeJSImport = THREE_JS_IMPORT_PATTERNS.some((pattern) => source === pattern || source.startsWith(pattern + '/'));\n            if (isThreeJSImport) {\n                for (const specifier of importDeclaration.specifiers) {\n                    if (specifier.type === 'ImportSpecifier') {\n                        // Named import: import { Box, Mesh } from '@react-three/drei'\n                        threeJSImports.add(specifier.local.name);\n                    }\n                    else if (specifier.type === 'ImportDefaultSpecifier') {\n                        // Default import: import Canvas from '@react-three/fiber'\n                        threeJSImports.add(specifier.local.name);\n                    }\n                    else if (specifier.type === 'ImportNamespaceSpecifier') {\n                        // Namespace import: import * as THREE from 'three'\n                        // We'll handle this as a special case where we need to check for THREE.* usage\n                        threeJSImports.add(`${specifier.local.name}.*`);\n                    }\n                }\n            }\n        }\n    }\n    return threeJSImports;\n}\n/**\n * Determines if a file should be processed based on its extension and path\n * @param filePath The path of the file to check\n * @param options Plugin options\n * @returns Boolean indicating if the file should be processed\n */\nfunction shouldProcessFile(filePath, options) {\n    const extensions = options.extensions || ['.jsx', '.tsx', '.js', '.ts'];\n    const ext = path__namespace.extname(filePath);\n    const skipPatterns = ['.test.', '.spec.', '__tests__', '__mocks__'];\n    const shouldSkip = skipPatterns.some((pattern) => filePath.includes(pattern));\n    return extensions.includes(ext) && !shouldSkip;\n}\n/**\n * Determines if an element should be tagged based on its name and options\n * @param elementName The name of the JSX element\n * @param options Plugin options\n * @param threeJSImports Set of imported Three.js identifiers\n * @returns Boolean indicating if the element should be tagged\n */\nfunction shouldTagElement(elementName, options, threeJSImports) {\n    if (options.includeElements && options.includeElements.length > 0) {\n        return options.includeElements.includes(elementName);\n    }\n    if (options.shouldTag) {\n        return options.shouldTag(elementName);\n    }\n    if (options.excludeElements &&\n        options.excludeElements.includes(elementName)) {\n        return false;\n    }\n    if (REACT_STRUCTURAL_COMPONENTS.has(elementName)) {\n        return false;\n    }\n    // Skip Three.js elements that are actually imported from Three.js packages\n    if (threeJSImports && isThreeJSElement(elementName, threeJSImports)) {\n        return false;\n    }\n    return true;\n}\n/**\n * Checks if an element name matches any imported Three.js identifier\n * @param elementName The JSX element name to check\n * @param threeJSImports Set of imported Three.js identifiers\n * @returns Boolean indicating if the element is from Three.js imports\n */\nfunction isThreeJSElement(elementName, threeJSImports) {\n    // Direct match for named/default imports\n    if (threeJSImports.has(elementName)) {\n        return true;\n    }\n    // Skip Three.js Fiber elements\n    if (THREE_FIBER_ELEMENTS.includes(elementName)) {\n        return true;\n    }\n    // Check for namespace imports (e.g., THREE.Box where THREE.* is imported)\n    for (const importedIdentifier of threeJSImports) {\n        if (importedIdentifier.endsWith('.*')) {\n            const namespace = importedIdentifier.slice(0, -2); // Remove \".*\"\n            if (elementName.startsWith(`${namespace}.`)) {\n                return true;\n            }\n        }\n    }\n    return false;\n}\n/**\n * Safely extracts a string value from a JSX attribute value\n * @param value The attribute value node\n * @returns The extracted string value or undefined\n */\nfunction extractStringValue(value) {\n    if (!value)\n        return undefined;\n    if (value.type === 'StringLiteral') {\n        return value.value;\n    }\n    if (value.type === 'JSXExpressionContainer') {\n        const expr = value.expression;\n        if (expr.type === 'StringLiteral') {\n            return expr.value;\n        }\n        if (expr.type === 'TemplateLiteral' && expr.quasis.length === 1) {\n            return expr.quasis[0].value.raw;\n        }\n        if (expr.type === 'BinaryExpression' && expr.operator === '+') {\n            const left = expr.left.type === 'StringLiteral' ? expr.left.value : '';\n            const right = expr.right.type === 'StringLiteral' ? expr.right.value : '';\n            return left + right;\n        }\n        if (expr.type === 'Identifier') {\n            return `[var:${expr.name}]`;\n        }\n    }\n    return undefined;\n}\n/**\n * Extract attributes from JSX opening element\n * @param node The JSX opening element node\n * @param options Plugin options\n * @returns Record of attribute names and values\n */\nfunction extractAttributes(node, options, currentElement) {\n    const attributes = {};\n    const defaultAttrs = [\n        'className',\n        'id',\n        'src',\n        'alt',\n        'href',\n        'type',\n        'name',\n        'value',\n    ];\n    const attrsToExtract = new Set([\n        ...defaultAttrs,\n        ...(options.extractAttributes || []),\n    ]);\n    for (const attr of node.attributes) {\n        if (attr.type === 'JSXAttribute' && attr.name.type === 'JSXIdentifier') {\n            const name = attr.name.name;\n            if (!attrsToExtract.has(name))\n                continue;\n            if (attr.value) {\n                const stringValue = extractStringValue(attr.value);\n                if (stringValue !== undefined) {\n                    attributes[name] = stringValue;\n                }\n            }\n            else {\n                attributes[name] = 'true';\n            }\n        }\n        else if (attr.type === 'JSXSpreadAttribute') {\n            attributes['[spread]'] = 'true';\n        }\n    }\n    let textContent = '';\n    if (currentElement && currentElement.children) {\n        textContent = currentElement.children\n            .map((child) => {\n            if (child.type === 'JSXText') {\n                return child.value.trim();\n            }\n            else if (child.type === 'JSXExpressionContainer') {\n                if (child.expression.type === 'StringLiteral') {\n                    return child.expression.value;\n                }\n            }\n            return '';\n        })\n            .filter(Boolean)\n            .join(' ')\n            .trim();\n    }\n    if (textContent) {\n        attributes['textContent'] = textContent;\n    }\n    return attributes;\n}\n/**\n * Get element name from JSX opening element\n * @param jsxNode The JSX opening element node\n * @returns The element name as a string\n */\nfunction getElementName(jsxNode) {\n    const name = jsxNode.name;\n    if (name.type === 'JSXIdentifier') {\n        return name.name;\n    }\n    if (name.type === 'JSXMemberExpression') {\n        // Handle nested expressions like Namespace.Component\n        return getMemberExpressionName(name);\n    }\n    // if (name.type === 'JSXNamespacedName') {\n    //   return `${name.namespace.name}:${name.name.name}`;\n    // }\n    return 'Unknown';\n}\n/**\n * Recursively builds the full name of a JSX member expression\n * @param expr The JSX member expression\n * @returns The full dotted name\n */\nfunction getMemberExpressionName(expr) {\n    // const propertyName = expr.property.name;\n    /*\n    else if (jsxNode.name.type === \"JSXMemberExpression\") {\n                              const memberExpr = jsxNode.name;\n                              elementName = `${(memberExpr.object as JSXIdentifier).name}.${(memberExpr.property as JSXIdentifier).name}`;\n                          } */\n    // if (expr.object.type === 'JSXMemberExpression') {\n    //   return `${expr.object as JSXIdentifier}`\n    //   return `${getMemberExpressionName(expr.object)}.${propertyName}`;\n    // }\n    // if (expr.object.type === 'JSXIdentifier') {\n    //   return `${expr.object.name}.${propertyName}`;\n    // }\n    const propertyName = `${expr.object.name}.${expr.property.name}`;\n    return propertyName;\n}\n/**\n * Sanitizes a string for use in HTML attributes\n * @param str The string to sanitize\n * @returns The sanitized string\n */\nfunction sanitizeAttributeValue(str) {\n    return str\n        .replace(/&/g, '&amp;')\n        .replace(/\"/g, '&quot;')\n        .replace(/'/g, '&#39;')\n        .replace(/</g, '&lt;')\n        .replace(/>/g, '&gt;');\n}\n/**\n * Creates a unique component ID based on file path and location\n * @param filePath The relative file path\n * @param line The line number\n * @param column The column number\n * @returns A unique component ID string\n */\nfunction createComponentId(filePath, line, column) {\n    return `${filePath}:${line}:${column}`;\n}\n/**\n * Logs a message if verbose mode is enabled\n * @param message The message to log\n * @param options Plugin options\n */\nfunction verboseLog(message, options) {\n    if (options.verbose) {\n        // eslint-disable-next-line no-console\n        console.log(`[component-tagger] ${message}`);\n    }\n}\n/**\n * Generates a summary of the tagging operation\n * @param stats The statistics object\n * @returns A formatted string with the summary\n */\nfunction generateSummary(stats) {\n    return `Component Tagger Summary:\n  - Total files scanned: ${stats.totalFiles}\n  - Files processed: ${stats.processedFiles}\n  - Elements tagged: ${stats.totalElements}`;\n}\n\n/**\n * Creates a Vite plugin that tags JSX components with data attributes\n * @param options Configuration options for the component tagger\n * @returns A Vite plugin\n */\nfunction createVitePlugin(options = {}) {\n    const pluginOptions = {\n        extensions: ['.jsx', '.tsx', '.js', '.ts'],\n        verbose: false,\n        attributePrefix: 'data-component',\n        includeContentAttribute: true,\n        maxContentLength: 1000,\n        includeLegacyAttributes: true,\n        sourceMaps: true,\n        excludeDirectories: [],\n        processNodeModules: false,\n        ...options,\n    };\n    const cwd = process.cwd();\n    const stats = {\n        totalFiles: 0,\n        processedFiles: 0,\n        totalElements: 0,\n    };\n    return {\n        name: 'vite-plugin-component-tagger',\n        enforce: 'pre',\n        transform: async (code, id) => {\n            if (!shouldProcessFile(id, pluginOptions)) {\n                return null;\n            }\n            if (id.includes('node_modules') && !pluginOptions.processNodeModules) {\n                return null;\n            }\n            if (pluginOptions.excludeDirectories &&\n                pluginOptions.excludeDirectories.some((dir) => id.includes(dir))) {\n                return null;\n            }\n            stats.totalFiles++;\n            const relativePath = path__namespace.relative(cwd, id);\n            verboseLog(`Processing file: ${relativePath}`, pluginOptions);\n            try {\n                const parserOptions = {\n                    sourceType: 'module',\n                    plugins: ['jsx', 'typescript'],\n                };\n                const ast = parser.parse(code, parserOptions);\n                // Collect Three.js imports for this file\n                const threeJSImports = getThreeJSImports(ast);\n                const magicString = new MagicString(code);\n                let changedElementsCount = 0;\n                const fileName = path__namespace.basename(id);\n                let currentElement = null;\n                core.traverse(ast, {\n                    JSXElement: (nodePath) => {\n                        currentElement = nodePath.node;\n                    },\n                    JSXOpeningElement: (nodePath) => {\n                        var _a, _b, _c, _d, _e, _f, _g;\n                        if (!currentElement)\n                            return;\n                        const jsxNode = nodePath.node;\n                        const elementName = getElementName(jsxNode);\n                        if (!shouldTagElement(elementName, pluginOptions, threeJSImports)) {\n                            return;\n                        }\n                        const jsxAttributes = extractAttributes(jsxNode, pluginOptions, currentElement);\n                        const content = { elementName };\n                        Object.entries(jsxAttributes).forEach(([key, value]) => {\n                            content[key] = value;\n                        });\n                        const line = (_c = (_b = (_a = jsxNode.loc) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.line) !== null && _c !== void 0 ? _c : 0;\n                        const col = (_f = (_e = (_d = jsxNode.loc) === null || _d === void 0 ? void 0 : _d.start) === null || _e === void 0 ? void 0 : _e.column) !== null && _f !== void 0 ? _f : 0;\n                        const dataComponentId = pluginOptions.generateComponentId\n                            ? pluginOptions.generateComponentId(relativePath, line, col)\n                            : createComponentId(relativePath, line, col);\n                        let attributesToAdd = ` ${pluginOptions.attributePrefix}-id=\"${sanitizeAttributeValue(dataComponentId)}\"`;\n                        if (pluginOptions.includeLegacyAttributes) {\n                            attributesToAdd += ` ${pluginOptions.attributePrefix}-path=\"${sanitizeAttributeValue(relativePath)}\"`;\n                            attributesToAdd += ` ${pluginOptions.attributePrefix}-line=\"${line}\"`;\n                            attributesToAdd += ` ${pluginOptions.attributePrefix}-file=\"${sanitizeAttributeValue(fileName)}\"`;\n                            attributesToAdd += ` ${pluginOptions.attributePrefix}-name=\"${sanitizeAttributeValue(elementName)}\"`;\n                        }\n                        if (pluginOptions.includeContentAttribute) {\n                            const contentJson = JSON.stringify(content);\n                            let encodedContent = encodeURIComponent(contentJson);\n                            if (pluginOptions.maxContentLength &&\n                                encodedContent.length > pluginOptions.maxContentLength) {\n                                encodedContent =\n                                    encodedContent.substring(0, pluginOptions.maxContentLength) +\n                                        '...';\n                            }\n                            attributesToAdd += ` ${pluginOptions.attributePrefix}-content=\"${encodedContent}\"`;\n                        }\n                        magicString.appendLeft((_g = jsxNode.name.end) !== null && _g !== void 0 ? _g : 0, attributesToAdd);\n                        verboseLog(attributesToAdd.toString(), pluginOptions);\n                        changedElementsCount++;\n                    },\n                });\n                stats.processedFiles++;\n                stats.totalElements += changedElementsCount;\n                if (changedElementsCount > 0) {\n                    verboseLog(`Tagged ${changedElementsCount} components in ${relativePath}`, pluginOptions);\n                }\n                if (changedElementsCount > 0) {\n                    return {\n                        code: magicString.toString(),\n                        map: pluginOptions.sourceMaps\n                            ? magicString.generateMap({ hires: true })\n                            : null,\n                    };\n                }\n                return null;\n            }\n            catch (error) {\n                // eslint-disable-next-line no-console\n                console.error(`Error processing file ${relativePath}:`, error);\n                stats.processedFiles++;\n                return null;\n            }\n        },\n        buildStart: () => {\n            verboseLog('Component tagger plugin started', pluginOptions);\n        },\n        buildEnd: () => {\n            verboseLog(generateSummary(stats), pluginOptions);\n        },\n    };\n}\n\nexports.default = createVitePlugin;\n\n"]}