@xyd-js/documan 0.1.0-xyd.73 → 0.1.0-xyd.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -611,7 +611,10 @@ async function postWorkspaceSetup(settings) {
|
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
function nodeInstallPackages(hostPath) {
|
|
614
|
-
|
|
614
|
+
let cmd = process.env.XYD_NODE_PM ? `${process.env.XYD_NODE_PM} i` : "npm i";
|
|
615
|
+
if (process.env.XYD_DEV_MODE) {
|
|
616
|
+
cmd = "pnpm i";
|
|
617
|
+
}
|
|
615
618
|
const execOptions = {
|
|
616
619
|
cwd: hostPath,
|
|
617
620
|
env: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/build.ts","../src/utils.ts","../src/const.ts","../src/cli.ts","../src/dev.ts","../src/install.ts"],"sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { build as viteBuild, Plugin as VitePlugin } from 'vite';\nimport tsconfigPaths from \"vite-tsconfig-paths\";\n\nimport { appInit, calculateFolderChecksum, commonVitePlugins, getAppRoot, getBuildPath, getHostPath, postWorkspaceSetup, preWorkspaceSetup, storeChecksum } from \"./utils\";\n\n// Define the main function to run the builds\nexport async function build() {\n const skip = await preWorkspaceSetup({\n force: true\n })\n\n const inited = await appInit()\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n\n const commonRunVitePlugins = commonVitePlugins(respPluginDocs, resolvedPlugins)\n const appRoot = getAppRoot();\n\n if (!skip) {\n await postWorkspaceSetup(respPluginDocs.settings)\n\n const newChecksum = calculateFolderChecksum(getHostPath());\n storeChecksum(newChecksum);\n }\n\n {\n await setupInstallableEnvironmentV2()\n }\n\n try {\n // Build the client-side bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n plugins: [\n ...commonRunVitePlugins,\n\n tsconfigPaths(),\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n }\n },\n });\n\n // Build the SSR bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n build: {\n ssr: true\n },\n plugins: [\n fixManifestPlugin(appRoot),\n ...commonRunVitePlugins,\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n }\n },\n });\n } catch (error) {\n console.error('Build failed:', error); // TODO: better message\n }\n}\n\nfunction setupInstallableEnvironmentV2() {\n // TODO: probably we should have better mechanism - maybe bundle?\n\n const buildDir = getBuildPath()\n\n const packageJsonPath = path.join(buildDir, 'package.json');\n\n const packageJsonContent = {\n type: \"module\",\n scripts: {},\n dependencies: {\n },\n devDependencies: {}\n };\n\n // Ensure the build directory exists\n if (!fs.existsSync(buildDir)) {\n fs.mkdirSync(buildDir, { recursive: true });\n }\n\n // Write the package.json file\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), 'utf8');\n\n // Create symlink to node_modules\n const buildNodeModulesPath = path.join(buildDir, 'node_modules');\n const dirname = path.dirname(fileURLToPath(import.meta.url));\n let workspaceNodeModulesPath = '';\n if (process.env.XYD_DEV_MODE) {\n workspaceNodeModulesPath = path.resolve(dirname, '../../../node_modules');\n } else {\n workspaceNodeModulesPath = path.resolve(dirname, '../../../');\n }\n\n console.log(\"workspaceNodeModulesPath\", workspaceNodeModulesPath)\n\n // Remove existing symlink or directory if it exists\n if (fs.existsSync(buildNodeModulesPath)) {\n if (fs.lstatSync(buildNodeModulesPath).isSymbolicLink()) {\n fs.unlinkSync(buildNodeModulesPath);\n } else {\n fs.rmSync(buildNodeModulesPath, { recursive: true, force: true });\n }\n }\n\n // Create symlink to workspace node_modules\n fs.symlinkSync(workspaceNodeModulesPath, buildNodeModulesPath, 'dir');\n\n // TOOD: symlink to node_modules\n}\n\n// TODO: not so good solution\n// fixManifestPlugin is needed for fixing server manifest for react-router cuz we use different `root` and output\nfunction fixManifestPlugin(\n appRoot: string\n): VitePlugin {\n const manifestPath = path.join(\n getBuildPath(),\n \"./server/.vite/manifest.json\"\n );\n\n return {\n name: \"xyd-fix-rr-manifest\",\n apply: 'build', // run after manifest is generated\n // 2) after bundle is written, compute prefix and strip it\n writeBundle(_, bundle) {\n const cwdDir = process.cwd();\n let prefix = path.relative(appRoot, cwdDir).replace(/\\\\/g, \"/\");\n if (prefix) prefix += \"/\";\n\n // escape for RegExp\n const esc = prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const stripRe = new RegExp(`^${esc}`);\n\n for (const fileName in bundle) {\n const asset = bundle[fileName];\n\n if (asset.type !== \"asset\") continue;\n\n // A) fix manifest.json (client or SSR) keys + entry.src\n if (fileName.endsWith(\"manifest.json\")) {\n const manifest = JSON.parse(asset.source.toString());\n const fixed: Record<string, any> = {};\n\n for (const key of Object.keys(manifest)) {\n const entry = manifest[key];\n const newKey = key.replace(stripRe, \"\");\n if (typeof entry.src === \"string\") {\n entry.src = entry.src.replace(stripRe, \"\");\n }\n fixed[newKey] = entry;\n }\n\n asset.source = JSON.stringify(fixed, null, 2);\n fs.writeFileSync(manifestPath, asset.source, 'utf8');\n\n }\n\n // B) fix any CSS asset metadata (originalFileNames)\n // TODO: FINISH if it will be needed\n // if (fileName.endsWith(\".css\") && Array.isArray(asset.originalFileNames)) {\n // asset.originalFileNames = asset.originalFileNames.map((orig) =>\n // orig.replace(stripRe, \"\")\n // );\n // }\n }\n\n },\n }\n}","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { execSync, ExecSyncOptions } from \"node:child_process\";\nimport crypto from \"node:crypto\";\n\nimport { createServer, PluginOption as VitePluginOption, Plugin as VitePlugin } from \"vite\";\nimport { reactRouter } from \"@react-router/dev/vite\";\nimport { IconSet } from '@iconify/tools';\n\nimport { readSettings, pluginDocs, type PluginDocsOptions, PluginOutput } from \"@xyd-js/plugin-docs\";\nimport { vitePlugins as xydContentVitePlugins } from \"@xyd-js/content/vite\";\nimport { Integrations, Plugins, Settings } from \"@xyd-js/core\";\nimport type { IconLibrary } from \"@xyd-js/core\";\nimport type { Plugin, PluginConfig } from \"@xyd-js/plugins\";\nimport { type UniformPlugin } from \"@xyd-js/uniform\";\n\nimport { BUILD_FOLDER_PATH, CACHE_FOLDER_PATH, HOST_FOLDER_PATH } from \"./const\";\nimport { CLI } from './cli';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport async function appInit(options?: PluginDocsOptions) {\n const readPreloadSettings = await readSettings() // TODO: in the future better solution - currently we load settings twice (pluginDocs and here)\n if (!readPreloadSettings) {\n return null\n }\n\n const preloadSettings = typeof readPreloadSettings === \"string\" ? JSON.parse(readPreloadSettings) : readPreloadSettings\n\n {\n if (!preloadSettings.integrations?.search) {\n preloadSettings.integrations = {\n ...(preloadSettings.integrations || {}),\n search: {\n orama: true\n }\n }\n }\n\n const plugins = integrationsToPlugins(preloadSettings.integrations)\n if (preloadSettings.plugins) {\n preloadSettings.plugins = [...plugins, ...preloadSettings.plugins]\n } else {\n preloadSettings.plugins = plugins\n }\n }\n\n let resolvedPlugins: PluginConfig[] = []\n {\n resolvedPlugins = await loadPlugins(preloadSettings) || []\n const userUniformVitePlugins: UniformPlugin<any>[] = []\n const componentPlugins: any[] = [] // TODO: fix any\n\n resolvedPlugins?.forEach(p => {\n if (p.uniform) {\n userUniformVitePlugins.push(...p.uniform)\n }\n if (p.components) {\n componentPlugins.push(...p.components)\n }\n })\n globalThis.__xydUserUniformVitePlugins = userUniformVitePlugins\n globalThis.__xydUserComponents = componentPlugins\n }\n\n const respPluginDocs = await pluginDocs(options)\n if (!respPluginDocs) {\n throw new Error(\"PluginDocs not found\")\n }\n if (!respPluginDocs.settings) {\n throw new Error(\"Settings not found in respPluginDocs\")\n }\n respPluginDocs.settings.plugins = [\n ...(respPluginDocs.settings?.plugins || []),\n ...(preloadSettings.plugins || [])\n ]\n\n globalThis.__xydBasePath = respPluginDocs.basePath\n globalThis.__xydSettings = respPluginDocs.settings\n globalThis.__xydPagePathMapping = respPluginDocs.pagePathMapping\n\n return {\n respPluginDocs,\n resolvedPlugins\n }\n}\n\nfunction virtualComponentsPlugin() {\n return {\n name: 'xyd-plugin-virtual-components',\n resolveId(id) {\n if (id === 'virtual:xyd-user-components') {\n return id + '.jsx'; // Return the module with .jsx extension\n }\n return null;\n },\n async load(id) {\n if (id === 'virtual:xyd-user-components.jsx') {\n const userComponents = globalThis.__xydUserComponents || []\n\n // If we have components with dist paths, pre-bundle them at build time\n if (userComponents.length > 0 && userComponents[0]?.dist) {\n // Generate imports for all components\n const imports = userComponents.map((component, index) =>\n `import Component${index} from '${component.dist}';`\n ).join('\\n');\n\n // Generate component objects for all components\n const componentObjects = userComponents.map((component, index) =>\n `{\n component: Component${index},\n name: '${component.name}',\n dist: '${component.dist}'\n }`\n ).join(',\\n ');\n\n // This will be resolved by Vite at build time\n return `\n // Pre-bundled at build time - no async loading needed\n ${imports}\n \n export const components = [\n ${componentObjects}\n ];\n `\n }\n\n // Fallback to runtime loading\n return `\n export const components = globalThis.__xydUserComponents || {}\n `\n }\n return null;\n },\n };\n}\n\nexport function virtualProvidersPlugin(\n settings: Settings\n): VitePluginOption {\n return {\n name: 'xyd-plugin-virtual-providers',\n enforce: 'pre',\n resolveId(id) {\n if (id === 'virtual:xyd-analytics-providers') {\n return id\n }\n },\n async load(id) {\n if (id === 'virtual:xyd-analytics-providers') {\n const providers = Object.keys(settings?.integrations?.analytics || {})\n const imports = providers.map(provider =>\n `import { default as ${provider}Provider } from '@pluganalytics/provider-${provider}'`\n ).join('\\n')\n\n const cases = providers.map(provider =>\n `case '${provider}': return ${provider}Provider`\n ).join('\\n')\n\n return `\n ${imports}\n\n export const loadProvider = async (provider) => {\n switch (provider) {\n ${cases}\n default:\n console.error(\\`Provider \\${provider} not found\\`)\n return null\n }\n }\n `\n }\n }\n }\n}\n\nexport function commonVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n const userVitePlugins = resolvedPlugins.map(p => p.vite).flat() || []\n\n return [\n ...(xydContentVitePlugins({\n toc: {\n maxDepth: respPluginDocs.settings.theme?.maxTocDepth || 2,\n },\n settings: respPluginDocs.settings,\n }) as VitePlugin[]),\n ...respPluginDocs.vitePlugins,\n\n reactRouter(),\n\n virtualComponentsPlugin(),\n virtualProvidersPlugin(respPluginDocs.settings),\n pluginIconSet(respPluginDocs.settings),\n\n ...userVitePlugins,\n ]\n}\n\nexport function pluginIconSet(settings: Settings): VitePluginOption {\n const DEFAULT_ICON_SET = \"lucide\";\n\n async function fetchIconSet(name: string, version?: string): Promise<{ icons: any, iconSet: IconSet }> {\n // If it's a URL, use it directly\n if (name.startsWith('http://') || name.startsWith('https://')) {\n try {\n const iconsResp = await fetch(name);\n const iconsData = await iconsResp.json();\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (error) {\n console.warn(`Failed to fetch from URL ${name}:`, error);\n }\n }\n\n // Try to read from file system\n const tryReadFile = (filePath: string) => {\n try {\n if (!fs.existsSync(filePath)) {\n console.warn(`File does not exist: ${filePath}`);\n return null;\n }\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n try {\n const iconsData = JSON.parse(fileContent);\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (parseError) {\n console.warn(`Invalid JSON in file ${filePath}:`, parseError);\n return null;\n }\n } catch (error) {\n console.warn(`Failed to read file ${filePath}:`, error);\n return null;\n }\n };\n\n\n if (path.isAbsolute(name)) {\n const result = tryReadFile(name);\n if (result) return result;\n }\n\n if (name.startsWith(\".\")) {\n const fullPath = path.join(process.cwd(), name);\n const result = tryReadFile(fullPath);\n if (result) return result;\n }\n\n // Fallback to CDN\n const cdnUrl = version\n ? `https://cdn.jsdelivr.net/npm/@iconify-json/${name}@${version}/icons.json`\n : `https://cdn.jsdelivr.net/npm/@iconify-json/${name}/icons.json`;\n\n try {\n const iconsResp = await fetch(cdnUrl);\n const iconsData = await iconsResp.json();\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (error) {\n throw new Error(`Failed to load icon set from any source (file or CDN): ${name}`);\n }\n }\n\n async function processIconSet(iconSet: IconSet, icons: any, noPrefix?: boolean): Promise<Map<string, { svg: string }>> {\n const resp = new Map<string, { svg: string }>();\n\n for (const icon of Object.keys(icons.icons)) {\n const svg = iconSet.toSVG(icon);\n if (!svg) continue;\n\n let prefix = noPrefix ? undefined : iconSet.prefix;\n // If prefix is undefined, it means this is the default set and should not have a prefix\n const iconName = prefix ? `${prefix}:${icon}` : icon;\n resp.set(iconName, { svg: svg.toString() });\n }\n\n return resp;\n }\n\n async function addIconsToMap(resp: Map<string, { svg: string }>, name: string, version?: string, noPrefix?: boolean): Promise<void> {\n const { icons, iconSet } = await fetchIconSet(name, version);\n const newIcons = await processIconSet(iconSet, icons, noPrefix);\n newIcons.forEach((value, key) => resp.set(key, value));\n }\n\n async function processIconLibrary(library: string | IconLibrary | (string | IconLibrary)[]): Promise<Map<string, { svg: string }>> {\n const resp = new Map<string, { svg: string }>();\n\n if (typeof library === 'string') {\n // Single icon set as default\n await addIconsToMap(resp, library);\n } else if (Array.isArray(library)) {\n // Multiple icon sets\n for (const item of library) {\n if (typeof item === 'string') {\n // String items are treated as default set\n await addIconsToMap(resp, item);\n } else {\n // IconLibrary configuration\n const { name, version, default: isDefault, noprefix } = item;\n const noPrefix = isDefault || noprefix === true;\n await addIconsToMap(resp, name, version, noPrefix);\n }\n }\n } else {\n // Single IconLibrary configuration\n const { name, version, default: isDefault, noprefix } = library;\n const noPrefix = isDefault || noprefix === true;\n await addIconsToMap(resp, name, version, noPrefix);\n }\n\n return resp;\n }\n\n return {\n name: 'xyd-plugin-icon-set',\n enforce: 'pre',\n resolveId(id) {\n if (id === 'virtual:xyd-icon-set') {\n return id;\n }\n },\n async load(id) {\n if (id === 'virtual:xyd-icon-set') {\n let resp: Map<string, { svg: string }>;\n\n // Handle theme icons configuration\n if (settings.theme?.icons?.library) {\n resp = await processIconLibrary(settings.theme.icons.library);\n } else {\n resp = await processIconLibrary([\n {\n name: DEFAULT_ICON_SET,\n default: true,\n }\n ]);\n }\n\n return `\n export const iconSet = ${JSON.stringify(Object.fromEntries(resp))};\n `;\n }\n }\n } as VitePlugin\n}\n\nexport function getHostPath() {\n if (process.env.XYD_DEV_MODE) {\n if (process.env.XYD_HOST) {\n return path.resolve(process.env.XYD_HOST)\n }\n\n\n return path.join(__dirname, \"../../../\", HOST_FOLDER_PATH)\n }\n\n return path.join(process.cwd(), HOST_FOLDER_PATH)\n}\n\nexport function getAppRoot() {\n return getHostPath()\n}\n\n// TODO: in the future get from settings\nexport function getPublicPath() {\n return path.join(process.cwd(), 'public')\n}\n\nexport function getBuildPath() {\n return path.join(\n process.cwd(),\n BUILD_FOLDER_PATH\n );\n}\n\nexport function getDocsPluginBasePath() {\n return path.join(getHostPath(), \"./plugins/xyd-plugin-docs\")\n}\n\nasync function loadPlugins(\n settings: Settings,\n) {\n const resolvedPlugins: PluginConfig[] = []\n\n for (const plugin of settings.plugins || []) {\n let pluginName: string\n let pluginArgs: any[] = []\n\n if (typeof plugin === \"string\") {\n pluginName = plugin\n pluginArgs = []\n } else if (Array.isArray(plugin)) {\n pluginName = plugin[0]\n pluginArgs = plugin.slice(1)\n } else {\n console.error(`Currently only string and array plugins are supported, got: ${plugin}`)\n return []\n }\n\n let mod: any // TODO: fix type\n try {\n mod = await import(pluginName)\n } catch (e) {\n pluginName = path.join(process.cwd(), pluginName)\n\n // TODO: find better solution? use this every time?\n const pluginPreview = await createServer({\n optimizeDeps: {\n include: [],\n },\n });\n mod = await pluginPreview.ssrLoadModule(pluginName);\n }\n\n if (!mod.default) {\n console.error(`Plugin ${plugin} has no default export`)\n continue\n }\n\n let pluginInstance = mod.default(...pluginArgs) as (PluginConfig | Plugin)\n if (typeof pluginInstance === \"function\") {\n const plug = pluginInstance(settings)\n\n resolvedPlugins.push(plug)\n\n continue\n }\n\n resolvedPlugins.push(pluginInstance);\n\n }\n\n return resolvedPlugins\n}\n\nfunction integrationsToPlugins(integrations: Integrations) {\n const plugins: Plugins = []\n let foundSearchIntegation = 0\n\n if (integrations?.search?.orama) {\n if (typeof integrations.search.orama === \"boolean\") {\n plugins.push(\"@xyd-js/plugin-orama\")\n } else {\n plugins.push([\"@xyd-js/plugin-orama\", integrations.search.orama])\n }\n foundSearchIntegation++\n }\n\n if (integrations?.search?.algolia) {\n plugins.push([\"@xyd-js/plugin-algolia\", integrations.search.algolia])\n foundSearchIntegation++\n }\n\n if (foundSearchIntegation > 1) {\n throw new Error(\"Only one search integration is allowed\")\n }\n\n return plugins\n}\n\nexport async function preWorkspaceSetup(options: {\n force?: boolean\n} = {}) {\n await ensureFoldersExist()\n\n // Check if we can skip the setup\n if (!options.force) {\n if (await shouldSkipHostSetup()) {\n return true\n }\n }\n\n const hostTemplate = process.env.XYD_DEV_MODE\n ? path.resolve(__dirname, \"../../xyd-host\")\n : path.resolve(__dirname, \"../../host\")\n\n const hostPath = getHostPath()\n\n await copyHostTemplate(hostTemplate, hostPath)\n\n // Calculate and store new checksum after setup\n\n // Handle plugin-docs pages\n let pluginDocsPath: string | Error\n if (process.env.XYD_DEV_MODE) {\n pluginDocsPath = path.resolve(__dirname, \"../../xyd-plugin-docs\")\n } else {\n pluginDocsPath = path.resolve(__dirname, \"../../plugin-docs\")\n }\n\n const pagesSourcePath = path.join(pluginDocsPath, \"src/pages\")\n const pagesTargetPath = path.join(hostPath, \"plugins/xyd-plugin-docs/src/pages\")\n\n if (fs.existsSync(pagesSourcePath)) {\n await copyHostTemplate(pagesSourcePath, pagesTargetPath)\n } else {\n console.warn(`Pages source path does not exist: ${pagesSourcePath}`)\n }\n}\n\nexport function calculateFolderChecksum(folderPath: string): string {\n const hash = crypto.createHash('sha256');\n const ignorePatterns = [...getGitignorePatterns(folderPath), '.xydchecksum', \"node_modules\", \"dist\", \".react-router\", \"package-lock.json\", \"pnpm-lock.yaml\"];\n\n function processFile(filePath: string) {\n const relativePath = path.relative(folderPath, filePath);\n const content = fs.readFileSync(filePath);\n hash.update(relativePath);\n hash.update(content);\n }\n\n function processDirectory(dirPath: string) {\n const entries = fs.readdirSync(dirPath, { withFileTypes: true });\n\n // Sort entries to ensure consistent order\n entries.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const entry of entries) {\n const sourceEntry = path.join(dirPath, entry.name)\n\n // Skip if the entry matches any ignore pattern\n if (shouldIgnoreEntry(entry.name, ignorePatterns)) {\n continue\n }\n\n // Skip .git directory\n if (entry.name === '.git') {\n continue\n }\n\n if (entry.isDirectory()) {\n processDirectory(sourceEntry)\n } else {\n processFile(sourceEntry)\n }\n }\n }\n\n processDirectory(folderPath);\n return hash.digest('hex');\n}\n\n// TODO: xyd-host .gitignore is not copied to npm registry \nfunction getGitignorePatterns(folderPath: string): string[] {\n const gitignorePath = path.join(folderPath, '.gitignore')\n if (fs.existsSync(gitignorePath)) {\n const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8')\n return gitignoreContent\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line && !line.startsWith('#'))\n }\n return []\n}\n\nfunction shouldIgnoreEntry(entryName: string, ignorePatterns: string[]): boolean {\n return ignorePatterns.some(pattern => {\n const regex = new RegExp(pattern.replace(/\\*/g, '.*'))\n return regex.test(entryName)\n })\n}\n\nasync function copyHostTemplate(sourcePath: string, targetPath: string) {\n if (!fs.existsSync(sourcePath)) {\n throw new Error(`Host template source path does not exist: ${sourcePath}`)\n }\n\n // Clean target directory if it exists\n if (fs.existsSync(targetPath)) {\n fs.rmSync(targetPath, { recursive: true, force: true })\n }\n\n // Create target directory\n fs.mkdirSync(targetPath, { recursive: true })\n\n const ignorePatterns = getGitignorePatterns(sourcePath)\n\n // Copy all files and directories recursively\n const entries = fs.readdirSync(sourcePath, { withFileTypes: true })\n\n for (const entry of entries) {\n const sourceEntry = path.join(sourcePath, entry.name)\n const targetEntry = path.join(targetPath, entry.name)\n\n // Skip if the entry matches any ignore pattern\n if (shouldIgnoreEntry(entry.name, ignorePatterns)) {\n continue\n }\n\n // Skip .git directory\n if (entry.name === '.git') {\n continue\n }\n\n if (entry.isDirectory()) {\n await copyHostTemplate(sourceEntry, targetEntry)\n } else {\n fs.copyFileSync(sourceEntry, targetEntry)\n\n // Handle package.json modifications for local development\n if (entry.name === 'package.json' && process.env.XYD_DEV_MODE) {\n const packageJsonPath = targetEntry\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n packageJson.name = \"xyd-host-dev\"\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n }\n }\n }\n}\n\nasync function ensureFoldersExist() {\n const folders = [CACHE_FOLDER_PATH]\n for (const folder of folders) {\n const fullPath = path.resolve(process.cwd(), folder)\n if (!fs.existsSync(fullPath)) {\n fs.mkdirSync(fullPath, { recursive: true })\n }\n }\n}\n\n// TODO: in the future buil-in xyd plugins should be installable via code\nexport async function postWorkspaceSetup(settings: Settings) {\n const spinner = new CLI('dots');\n\n try {\n spinner.startSpinner('Installing xyd framework...');\n\n const hostPath = getHostPath()\n const packageJsonPath = path.join(hostPath, 'package.json')\n\n if (!fs.existsSync(packageJsonPath)) {\n console.warn('No package.json found in host path')\n return\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n\n // Initialize dependencies if they don't exist\n if (!packageJson.dependencies) {\n packageJson.dependencies = {}\n }\n for (const plugin of settings.plugins || []) {\n let pluginName: string\n\n if (typeof plugin === \"string\") {\n pluginName = plugin\n } else if (Array.isArray(plugin)) {\n pluginName = plugin[0]\n } else {\n continue\n }\n\n if (pluginName.startsWith(\"@xyd-js/\")) {\n continue // TODO: currently we don't install built-in xyd plugins - they are defined in host\n }\n\n // Check if it's a valid npm package name\n // Valid formats: name or @scope/name\n // Invalid: ./path/to/file.js or /absolute/path\n const isValidNpmPackage = /^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(pluginName)\n\n if (isValidNpmPackage) {\n // Search for matching dependencies in host's package.json\n const hostPackageJsonPath = path.join(hostPath, 'package.json')\n if (fs.existsSync(hostPackageJsonPath)) {\n const hostPackageJson = JSON.parse(fs.readFileSync(hostPackageJsonPath, 'utf-8'))\n const deps = hostPackageJson.dependencies || {}\n\n // Find matching dependency\n const matchingDep = Object.entries(deps).find(([depName]) => {\n return depName === pluginName\n })\n\n if (matchingDep) {\n packageJson.dependencies[pluginName] = matchingDep[1]\n } else {\n console.warn(`no matching dependency found for: ${pluginName} in: ${hostPackageJsonPath}`)\n }\n } else {\n console.warn(`no host package.json found in: ${hostPath}`)\n }\n } else if (!pluginName.startsWith('.') && !pluginName.startsWith('/')) {\n // Only warn if it's not a local file path (doesn't start with . or /)\n console.warn(`invalid plugin name: ${pluginName}`)\n }\n }\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n\n await nodeInstallPackages(hostPath)\n\n spinner.stopSpinner();\n spinner.log('✔ Local xyd framework installed successfully');\n } catch (error) {\n spinner.stopSpinner();\n spinner.error('❌ Failed to install xyd framework');\n throw error;\n }\n}\n\nfunction nodeInstallPackages(hostPath: string) {\n const cmd = process.env.XYD_DEV_MODE ? 'pnpm i' : 'pnpm i' // TODO: issues with pnpm in production mode\n const execOptions: ExecSyncOptions = {\n cwd: hostPath,\n env: {\n ...process.env,\n NODE_ENV: \"\" // since 'production' does not install it well,\n }\n }\n const customRegistry = process.env.XYD_NPM_REGISTRY || process.env.npm_config_registry\n if (customRegistry) {\n if (!execOptions.env) {\n execOptions.env = {}\n }\n execOptions.env[\"npm_config_registry\"] = customRegistry\n }\n\n if (process.env.XYD_VERBOSE) {\n execOptions.stdio = 'inherit'\n }\n execSync(cmd, execOptions)\n}\n\nasync function shouldSkipHostSetup(): Promise<boolean> {\n const hostPath = getHostPath();\n\n // If host folder doesn't exist, we need to set it up\n if (!fs.existsSync(hostPath)) {\n return false;\n }\n\n const currentChecksum = calculateFolderChecksum(hostPath);\n const storedChecksum = getStoredChecksum();\n\n // If no stored checksum or checksums don't match, we need to set up\n if (!storedChecksum || storedChecksum !== currentChecksum) {\n return false;\n }\n\n return true;\n}\n\nfunction getStoredChecksum(): string | null {\n const checksumPath = path.join(getHostPath(), '.xydchecksum');\n if (!fs.existsSync(checksumPath)) {\n return null;\n }\n try {\n return fs.readFileSync(checksumPath, 'utf-8').trim();\n } catch (error) {\n console.error('Error reading checksum file:', error);\n return null;\n }\n}\n\nexport function storeChecksum(checksum: string): void {\n const checksumPath = path.join(getHostPath(), '.xydchecksum');\n try {\n fs.writeFileSync(checksumPath, checksum);\n } catch (error) {\n console.error('Error writing checksum file:', error);\n }\n}\n\n","export const HOST_FOLDER_PATH = \".xyd/host\"\nexport const CACHE_FOLDER_PATH = \".xyd/.cache\"\nexport const BUILD_FOLDER_PATH = \".xyd/build\"\n\nexport const SUPPORTED_SETTINGS_FILES = [\n 'docs.json',\n 'docs.ts',\n 'docs.tsx'\n]\n\nexport const SUPPORTED_CONTENT_FILES = [\n '.md',\n '.mdx',\n]\n\n","import readline from 'node:readline';\nimport cliSpinners from 'cli-spinners';\n\ninterface Spinner {\n frames: string[];\n interval: number;\n}\n\ntype SpinnerName = keyof typeof cliSpinners;\n\nexport class CLI {\n private spinner: Spinner;\n private spinnerInterval: NodeJS.Timeout | null = null;\n private currentFrame = 0;\n private currentMessage = '';\n private isSpinning = false;\n\n constructor(spinnerType: SpinnerName = 'dots') {\n this.spinner = cliSpinners[spinnerType] as Spinner;\n }\n\n public startSpinner(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n\n this.currentMessage = message;\n this.isSpinning = true;\n this.currentFrame = 0;\n\n // Write initial message\n this.write(`${this.spinner.frames[0]} ${this.currentMessage}`);\n\n this.spinnerInterval = setInterval(() => {\n const frame = this.spinner.frames[this.currentFrame];\n this.write(`${frame} ${this.currentMessage}`);\n this.currentFrame = (this.currentFrame + 1) % this.spinner.frames.length;\n }, this.spinner.interval);\n }\n\n public stopSpinner() {\n if (this.spinnerInterval) {\n clearInterval(this.spinnerInterval);\n this.spinnerInterval = null;\n }\n this.isSpinning = false;\n \n this.clearLine();\n }\n\n private clearLine() {\n readline.clearLine(process.stdout, 0);\n readline.cursorTo(process.stdout, 0);\n }\n\n private write(message: string) {\n this.clearLine();\n process.stdout.write(message);\n }\n\n public log(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n console.log(message);\n }\n\n public error(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n console.error(message);\n }\n\n private updateMessage(message: string) {\n this.currentMessage = message;\n }\n\n}\n\n// Export a singleton instance\nexport const cli = new CLI(); ","import path from \"node:path\";\nimport fs from \"node:fs\";\n\nimport { createServer, searchForWorkspaceRoot, ViteDevServer, Plugin as VitePlugin } from \"vite\";\n\nimport { readSettings } from \"@xyd-js/plugin-docs\";\nimport { API, APIFile, Navigation, SidebarNavigation, } from \"@xyd-js/core\";\n\nimport { appInit, calculateFolderChecksum, commonVitePlugins, getAppRoot, getDocsPluginBasePath, getHostPath, getPublicPath, postWorkspaceSetup, preWorkspaceSetup, storeChecksum } from \"./utils\";\nimport { CACHE_FOLDER_PATH, SUPPORTED_SETTINGS_FILES, SUPPORTED_CONTENT_FILES } from \"./const\";\nimport { CLI } from \"./cli\";\n\n// TODO: !!! BETTER TIMER / DEBUG API !!!\nif (!process.env.ENABLE_TIMERS) {\n ['time', 'timeLog', 'timeEnd'].forEach(method => {\n console[method] = () => {\n };\n });\n}\n\n// TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\nconst fullReloadOptions = {\n \"theme.name\": true,\n \"theme.icons\": true,\n \"theme.integrations\": true,\n \"theme.banner\": true,\n\n\n \"navigation.header\": true,\n \"navigation.segments\": true,\n\n \"engine\": true,\n}\n\n/**\n * Extracts a nested property from an object using dot notation\n * @param obj - The object to extract from\n * @param path - The dot-notation path (e.g., \"theme.banner\")\n * @returns The value at the path or null if not found\n */\nfunction extractNestedProperty(obj: any, path: string): any {\n const keys = path.split('.');\n let current = obj;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = current[key];\n } else {\n return null;\n }\n }\n\n return current;\n}\n\n/**\n * Compares two values for changes, handling deep comparison for objects\n */\nfunction hasValueChanged(oldValue: any, newValue: any): boolean {\n // If one is null/undefined and the other isn't, there's a change\n if (!oldValue && newValue) return true;\n if (oldValue && !newValue) return true;\n if (!oldValue && !newValue) return false;\n\n // Deep comparison using JSON.stringify for objects/arrays\n const oldStr = JSON.stringify(oldValue);\n const newStr = JSON.stringify(newValue);\n\n return oldStr !== newStr;\n}\n\n/**\n * Checks if any of the properties in fullReloadOptions have changed\n */\nfunction hasFullReloadPropertiesChanged(oldSettings: any, newSettings: any): boolean {\n for (const [propertyPath, shouldCheck] of Object.entries(fullReloadOptions)) {\n if (shouldCheck) {\n const oldValue = extractNestedProperty(oldSettings, propertyPath);\n const newValue = extractNestedProperty(newSettings, propertyPath);\n\n if (hasValueChanged(oldValue, newValue)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\ninterface DevOptions {\n port?: number\n}\n\nlet RELOADING = false\n\nexport async function dev(options?: DevOptions) {\n const spinner = new CLI('dots');\n spinner.startSpinner('Preparing local xyd instance...');\n\n const skip = await preWorkspaceSetup()\n\n const inited = await appInit()\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n \n const allowCwd = searchForWorkspaceRoot(process.cwd())\n const appRoot = getAppRoot()\n const commonRunVitePlugins = commonVitePlugins(respPluginDocs, resolvedPlugins)\n spinner.stopSpinner();\n\n if (!skip) {\n await postWorkspaceSetup(respPluginDocs.settings)\n\n const newChecksum = calculateFolderChecksum(getHostPath());\n storeChecksum(newChecksum);\n }\n\n // ⚠️ \n spinner.log('✔ Local xyd instance is ready');\n\n let server: ViteDevServer | null = null\n\n const port = options?.port ?? parseInt(process.env.XYD_PORT ?? \"5175\")\n\n // Store initial settings for comparison\n // let initialSettings = respPluginDocs.settings;\n\n let USE_CONTEXT_ISSUE_PACKAGES: string[] = []\n {\n // TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\n if (process.env.XYD_DEV_MODE) {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"react-github-btn\",\n \"radix-ui\",\n \"@code-hike/lighter\",\n \"lucide-react\",\n \"openux-js\",\n \"pluganalytics\",\n ];\n } else {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"@xyd-js/theme-cosmo\",\n \"@xyd-js/theme-opener\",\n \"@xyd-js/theme-picasso\",\n \"@xyd-js/theme-poetry\"\n ]\n }\n }\n\n const preview = await createServer({\n root: appRoot,\n publicDir: '/public',\n server: {\n allowedHosts: [],\n port: port,\n fs: {\n allow: [\n allowCwd,\n appRoot,\n ]\n }\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n },\n // preserveSymlinks: true\n },\n build: {\n rollupOptions: {\n external: []\n },\n },\n ssr: {\n external: [],\n },\n optimizeDeps: {\n include: [\n \"react/jsx-runtime\",\n ...USE_CONTEXT_ISSUE_PACKAGES,\n ],\n // exclude: [\"react\", \"react-dom\"]\n },\n plugins: [\n ...commonRunVitePlugins,\n\n {\n name: 'xyd-configureServer',\n configureServer(s) {\n server = s\n }\n }\n ],\n });\n\n\n // Set up manual file watcher for markdown files TODO: better way? + HMR only for specific components instead or reload a pag\n const watcher = fs.watch(allowCwd, { recursive: true }, async (eventType, filename) => {\n if (RELOADING) {\n return\n }\n\n if (!filename) {\n console.log(\"[xyd:dev-watcher] Received empty filename\");\n return;\n }\n\n if (!server) {\n console.log(\"[xyd:dev-watcher] Server not ready\");\n return\n }\n\n const filePath = path.join(allowCwd, filename);\n if (filePath.includes(CACHE_FOLDER_PATH)) {\n return\n }\n\n const publicPathReload = filePath.includes(getPublicPath())\n if (publicPathReload) {\n const relativePath = path.relative(allowCwd, filePath);\n const urlPath = '/' + relativePath.replace(/\\\\/g, '/');\n\n // TODO: touch layout + settings\n preview.ws.send({\n type: 'full-reload',\n path: urlPath,\n });\n return\n }\n\n let apiPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings?.api) {\n apiPaths = resolveApiFilePaths(process.cwd(), respPluginDocs.settings.api)\n }\n const apiChanged = !!apiPaths[filePath]\n const isSettingsFile = SUPPORTED_SETTINGS_FILES.some(ext => filePath.endsWith(ext))\n const isContentFile = SUPPORTED_CONTENT_FILES.some(ext => filePath.endsWith(ext))\n const isWatchFile = isSettingsFile || isContentFile || apiChanged\n if (!isWatchFile) {\n return\n }\n\n if (isContentFile && eventType !== 'rename') {\n console.log('🔄 Content file changed, refresh...', eventType);\n\n invalidateSettings(server)\n await touchLayoutPage()\n // console.log('✔ xyd instance reloaded\\n');\n\n return\n }\n\n const renameContentFile = isContentFile && eventType === 'rename'\n\n if (isSettingsFile || renameContentFile) {\n if (renameContentFile) {\n console.log('🔄 Content file renamed, refresh...');\n } else {\n console.log('🔄 Settings file changed, refresh...');\n }\n\n // TODO: better way to handle that - we need this cuz otherwise its inifiite reloads\n if (respPluginDocs?.settings.engine?.uniform?.store) {\n await appInit({\n disableFSWrite: true,\n })\n } else {\n await appInit() // TODO: !!! IN THE FUTURE MORE EFFICIENT WAY !!!\n }\n\n // Re-read settings to get the updated values\n const newSettings = await readSettings();\n if (typeof newSettings !== 'object') {\n console.log(\"[xyd:dev-watcher] Settings is not an object\");\n return\n } \n\n invalidateSettings(server)\n await touchReactRouterConfig()\n await touchLayoutPage()\n server.ws.send({ type: 'full-reload' }); \n }\n });\n\n // Log any watcher errors\n watcher.on('error', (error) => {\n console.error(\"[xyd:dev] File watcher error:\", error);\n });\n\n await preview.listen(port);\n if (respPluginDocs.settings.navigation) {\n await optimizeDepsFix(port, respPluginDocs.settings.navigation)\n }\n\n preview.printUrls();\n preview.bindCLIShortcuts({ print: true });\n\n // Clean up watcher when server is closed\n preview.httpServer?.once('close', () => {\n watcher.close();\n });\n}\n\n/**\n * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks api.*, \n * resolves all referenced files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveApiFilePaths(\n basePath: string,\n api: API\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const apis = [api.openapi, api.graphql, api.sources].filter((s): s is APIFile => s !== undefined)\n\n apis.forEach(section => {\n flattenApiFile(section).forEach(p => {\n const apiAbsPath = path.resolve(basePath, p)\n result[apiAbsPath] = true\n })\n })\n\n return result\n}\n\n\n/**\n * Given any APIFile-ish value, returns an array of the raw source-paths.\n */\nfunction flattenApiFile(file?: APIFile): string[] {\n if (!file) return []\n\n // single string\n if (typeof file === 'string') {\n return [file]\n }\n\n // array of anything\n if (Array.isArray(file)) {\n return file.flatMap(flattenApiFile)\n }\n\n // object: either a nested config, or a map of name→file\n if (typeof file === 'object') {\n const obj = file as Record<string, any>\n\n // explicit nested entry\n if (typeof obj.source === 'string') {\n return [obj.source]\n }\n\n // fallback: treat as { key: APIFile } map\n return Object.values(obj).flatMap(flattenApiFile)\n }\n\n // everything else (e.g. numbers, booleans) gets dropped\n return []\n}\n\n/**\n * Extracts the first page from navigation settings\n */\nfunction getFirstPageFromNavigation(navigation: Navigation): string | null {\n if (!navigation?.sidebar?.length) {\n return null;\n }\n\n function extractFirstPage(pages: SidebarNavigation): string | null {\n for (const page of pages) {\n if (typeof page === 'string') {\n return normalizePagePath(page);\n }\n\n if (typeof page === 'object') {\n // Handle SidebarRoute\n if ('route' in page && page.pages) {\n const firstPage = extractFirstPage(page.pages);\n if (firstPage) return firstPage;\n }\n\n // Handle Sidebar with pages\n if ('pages' in page && page.pages) {\n const firstPage = extractFirstPage(page.pages as SidebarNavigation);\n if (firstPage) return firstPage;\n }\n\n // Handle VirtualPage\n if ('page' in page && typeof page.page === 'string') {\n return normalizePagePath(page.page);\n }\n }\n }\n return null;\n }\n\n return extractFirstPage(navigation.sidebar);\n}\n\n/**\n * Normalizes a page path by removing .md/.mdx extensions and handling index pages\n */\nfunction normalizePagePath(pagePath: string): string {\n // Remove .md or .mdx extension if present\n let normalized = pagePath.replace(/\\.(md|mdx)$/, '');\n\n // If the path ends with 'index', remove it to get the directory\n if (normalized.endsWith('/index') || normalized === 'index') {\n normalized = normalized.replace(/\\/?index$/, '');\n }\n\n // Ensure it doesn't start with a slash for consistency\n if (normalized.startsWith('/')) {\n normalized = normalized.slice(1);\n }\n\n return normalized;\n}\n\n/**\n * Fetches the first page to preload it\n */\nasync function fetchFirstPage(firstPage: string, port: number) {\n const urlsToTry = [\n `http://localhost:${port}/${firstPage}`,\n `http://localhost:${port}/${firstPage}/`,\n `http://localhost:${port}/${firstPage}.html`,\n `http://localhost:${port}/${firstPage}/index.html`\n ];\n\n for (const url of urlsToTry) {\n try {\n const response = await fetch(url);\n if (response.ok) {\n return; // Success, exit early\n }\n } catch (error) {\n // Continue to next URL if this one fails\n continue;\n }\n }\n}\n\nfunction invalidateSettings(server: ViteDevServer) {\n const virtualId = 'virtual:xyd-settings';\n const resolvedId = virtualId + '.jsx';\n const mod = server.moduleGraph.getModuleById(resolvedId);\n if (!mod) {\n console.log(\"[xyd:dev-watcher] Settings module not found\");\n return\n }\n\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({\n type: 'update',\n updates: [\n {\n type: 'js-update',\n path: `/@id/${resolvedId}`,\n acceptedPath: `/@id/${resolvedId}`,\n timestamp: Date.now(),\n },\n ],\n });\n}\n\nasync function touchReactRouterConfig() {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"react-router.config.ts\")\n await fs.promises.utimes(hostReactRouterConfig, new Date(), new Date());\n}\n\nasync function touchLayoutPage() {\n const docsPluginBasePath = getDocsPluginBasePath()\n const layoutPath = path.join(docsPluginBasePath, \"./src/pages/layout.tsx\")\n await fs.promises.utimes(layoutPath, new Date(), new Date());\n}\n\nasync function experimentalInvalidateAndTouchPages(server: ViteDevServer) {\n const docsPluginBasePath = getDocsPluginBasePath()\n\n const layoutPath = path.join(docsPluginBasePath, \"./src/pages/layout.tsx\")\n const layoutModule = server.moduleGraph.getModuleById(layoutPath);\n\n const pagePath = path.join(docsPluginBasePath, \"./src/pages/page.tsx\")\n const pageModule = server.moduleGraph.getModuleById(pagePath);\n\n const pageModules = layoutModule && pageModule\n if (!pageModules) {\n console.log(\"[xyd:dev-watcher] Pages modules not found\");\n return\n }\n\n server.moduleGraph.invalidateModule(layoutModule);\n server.moduleGraph.invalidateModule(pageModule);\n\n await fs.promises.utimes(layoutPath, new Date(), new Date());\n await fs.promises.utimes(pagePath, new Date(), new Date());\n}\n\n\n// TODO: finish\nasync function experimentalInvalidateVite(server: ViteDevServer) {\n // Get all modules from the module graph and invalidate them\n const allModules = Array.from(server.moduleGraph.urlToModuleMap.values());\n let invalidatedCount = 0;\n\n for (const module of allModules) {\n if (module) {\n server.moduleGraph.invalidateModule(module);\n invalidatedCount++;\n }\n }\n\n // Also invalidate the host router config\n try {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"react-router.config.ts\")\n await fs.promises.utimes(hostReactRouterConfig, new Date(), new Date());\n } catch (e) {\n console.error(e)\n }\n\n server.ws.send({ type: 'full-reload' });\n return;\n}\n\n// TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\nasync function optimizeDepsFix(port: number, navigation: Navigation) {\n // TODO: ITS A WORKAROUND FOR NOW, IN THE FUTURE WE NEED TO DO IT BETTER \n // ITS FOR OPTIMZE DEPS FIX\n // find first page from respPluginDocs.settings navigation and do fetch for it \n const firstPage = getFirstPageFromNavigation(navigation);\n if (firstPage) {\n await fetchFirstPage(firstPage, port);\n }\n}\n","import fs from 'node:fs';\n\nimport { preWorkspaceSetup, postWorkspaceSetup, getHostPath } from './utils';\nimport { readSettings } from '@xyd-js/plugin-docs';\n\n\nexport async function install() {\n const settings = await readSettings() // TODO: in the future better solution - currently we load settings twice (pluginDocs and here)\n if (!settings) {\n throw new Error(\"cannot preload settings\")\n }\n if (typeof settings === \"string\") {\n throw new Error(\"install does not support string settings\")\n }\n\n // Clear the host folder if it exists\n const hostPath = getHostPath();\n if (fs.existsSync(hostPath)) {\n fs.rmSync(hostPath, { recursive: true, force: true });\n }\n\n // Run pre-workspace setup\n await preWorkspaceSetup({\n force: true,\n });\n\n // Run post-workspace setup with empty settings\n // The actual settings will be loaded during the build/dev process\n await postWorkspaceSetup(settings);\n}"],"mappings":";AAAA,OAAOA,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,iBAAAC,sBAAqB;AAE9B,SAAS,SAAS,iBAAuC;AACzD,OAAO,mBAAmB;;;ACL1B,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,qBAAqB;AAC9B,SAAS,gBAAiC;AAC1C,OAAO,YAAY;AAEnB,SAAS,oBAA4E;AACrF,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAExB,SAAS,cAAc,kBAAwD;AAC/E,SAAS,eAAe,6BAA6B;;;ACX9C,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAE1B,IAAM,2BAA2B;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACJ;AAEO,IAAM,0BAA0B;AAAA,EACnC;AAAA,EACA;AACJ;;;ACbA,OAAO,cAAc;AACrB,OAAO,iBAAiB;AASjB,IAAM,MAAN,MAAU;AAAA,EACL;AAAA,EACA,kBAAyC;AAAA,EACzC,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,aAAa;AAAA,EAErB,YAAY,cAA2B,QAAQ;AAC3C,SAAK,UAAU,YAAY,WAAW;AAAA,EAC1C;AAAA,EAEO,aAAa,SAAiB;AAC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AAqB,sBAAsB;AACjD,QAAM,aAAaC,MAAK,KAAK,oBAAoB,wBAAwB;AACzE,QAAMD,IAAG,SAAS,OAAO,YAAY,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC/D;AAoDA,eAAe,gBAAgB,MAAc,YAAwB;AAIjE,QAAM,YAAY,2BAA2B,UAAU;AACvD,MAAI,WAAW;AACX,UAAM,eAAe,WAAW,IAAI;AAAA,EACxC;AACJ;;;AChiBA,OAAOG,SAAQ;AAGf,SAAS,gBAAAC,qBAAoB;AAG7B,eAAsB,UAAU;AAC5B,QAAM,WAAW,MAAMA,cAAa;AACpC,MAAI,CAAC,UAAU;AACX,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACA,MAAI,OAAO,aAAa,UAAU;AAC9B,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAGA,QAAM,WAAW,YAAY;AAC7B,MAAIC,IAAG,WAAW,QAAQ,GAAG;AACzB,IAAAA,IAAG,OAAO,UAAU,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EACxD;AAGA,QAAM,kBAAkB;AAAA,IACpB,OAAO;AAAA,EACX,CAAC;AAID,QAAM,mBAAmB,QAAQ;AACrC;","names":["path","fs","fileURLToPath","path","fs","fileURLToPath","path","fs","createServer","readSettings","createServer","fs","path","readSettings","fs","readSettings","fs"]}
|
|
1
|
+
{"version":3,"sources":["../src/build.ts","../src/utils.ts","../src/const.ts","../src/cli.ts","../src/dev.ts","../src/install.ts"],"sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { build as viteBuild, Plugin as VitePlugin } from 'vite';\nimport tsconfigPaths from \"vite-tsconfig-paths\";\n\nimport { appInit, calculateFolderChecksum, commonVitePlugins, getAppRoot, getBuildPath, getHostPath, postWorkspaceSetup, preWorkspaceSetup, storeChecksum } from \"./utils\";\n\n// Define the main function to run the builds\nexport async function build() {\n const skip = await preWorkspaceSetup({\n force: true\n })\n\n const inited = await appInit()\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n\n const commonRunVitePlugins = commonVitePlugins(respPluginDocs, resolvedPlugins)\n const appRoot = getAppRoot();\n\n if (!skip) {\n await postWorkspaceSetup(respPluginDocs.settings)\n\n const newChecksum = calculateFolderChecksum(getHostPath());\n storeChecksum(newChecksum);\n }\n\n {\n await setupInstallableEnvironmentV2()\n }\n\n try {\n // Build the client-side bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n plugins: [\n ...commonRunVitePlugins,\n\n tsconfigPaths(),\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n }\n },\n });\n\n // Build the SSR bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n build: {\n ssr: true\n },\n plugins: [\n fixManifestPlugin(appRoot),\n ...commonRunVitePlugins,\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n }\n },\n });\n } catch (error) {\n console.error('Build failed:', error); // TODO: better message\n }\n}\n\nfunction setupInstallableEnvironmentV2() {\n // TODO: probably we should have better mechanism - maybe bundle?\n\n const buildDir = getBuildPath()\n\n const packageJsonPath = path.join(buildDir, 'package.json');\n\n const packageJsonContent = {\n type: \"module\",\n scripts: {},\n dependencies: {\n },\n devDependencies: {}\n };\n\n // Ensure the build directory exists\n if (!fs.existsSync(buildDir)) {\n fs.mkdirSync(buildDir, { recursive: true });\n }\n\n // Write the package.json file\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), 'utf8');\n\n // Create symlink to node_modules\n const buildNodeModulesPath = path.join(buildDir, 'node_modules');\n const dirname = path.dirname(fileURLToPath(import.meta.url));\n let workspaceNodeModulesPath = '';\n if (process.env.XYD_DEV_MODE) {\n workspaceNodeModulesPath = path.resolve(dirname, '../../../node_modules');\n } else {\n workspaceNodeModulesPath = path.resolve(dirname, '../../../');\n }\n\n console.log(\"workspaceNodeModulesPath\", workspaceNodeModulesPath)\n\n // Remove existing symlink or directory if it exists\n if (fs.existsSync(buildNodeModulesPath)) {\n if (fs.lstatSync(buildNodeModulesPath).isSymbolicLink()) {\n fs.unlinkSync(buildNodeModulesPath);\n } else {\n fs.rmSync(buildNodeModulesPath, { recursive: true, force: true });\n }\n }\n\n // Create symlink to workspace node_modules\n fs.symlinkSync(workspaceNodeModulesPath, buildNodeModulesPath, 'dir');\n\n // TOOD: symlink to node_modules\n}\n\n// TODO: not so good solution\n// fixManifestPlugin is needed for fixing server manifest for react-router cuz we use different `root` and output\nfunction fixManifestPlugin(\n appRoot: string\n): VitePlugin {\n const manifestPath = path.join(\n getBuildPath(),\n \"./server/.vite/manifest.json\"\n );\n\n return {\n name: \"xyd-fix-rr-manifest\",\n apply: 'build', // run after manifest is generated\n // 2) after bundle is written, compute prefix and strip it\n writeBundle(_, bundle) {\n const cwdDir = process.cwd();\n let prefix = path.relative(appRoot, cwdDir).replace(/\\\\/g, \"/\");\n if (prefix) prefix += \"/\";\n\n // escape for RegExp\n const esc = prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const stripRe = new RegExp(`^${esc}`);\n\n for (const fileName in bundle) {\n const asset = bundle[fileName];\n\n if (asset.type !== \"asset\") continue;\n\n // A) fix manifest.json (client or SSR) keys + entry.src\n if (fileName.endsWith(\"manifest.json\")) {\n const manifest = JSON.parse(asset.source.toString());\n const fixed: Record<string, any> = {};\n\n for (const key of Object.keys(manifest)) {\n const entry = manifest[key];\n const newKey = key.replace(stripRe, \"\");\n if (typeof entry.src === \"string\") {\n entry.src = entry.src.replace(stripRe, \"\");\n }\n fixed[newKey] = entry;\n }\n\n asset.source = JSON.stringify(fixed, null, 2);\n fs.writeFileSync(manifestPath, asset.source, 'utf8');\n\n }\n\n // B) fix any CSS asset metadata (originalFileNames)\n // TODO: FINISH if it will be needed\n // if (fileName.endsWith(\".css\") && Array.isArray(asset.originalFileNames)) {\n // asset.originalFileNames = asset.originalFileNames.map((orig) =>\n // orig.replace(stripRe, \"\")\n // );\n // }\n }\n\n },\n }\n}","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { execSync, ExecSyncOptions } from \"node:child_process\";\nimport crypto from \"node:crypto\";\n\nimport { createServer, PluginOption as VitePluginOption, Plugin as VitePlugin } from \"vite\";\nimport { reactRouter } from \"@react-router/dev/vite\";\nimport { IconSet } from '@iconify/tools';\n\nimport { readSettings, pluginDocs, type PluginDocsOptions, PluginOutput } from \"@xyd-js/plugin-docs\";\nimport { vitePlugins as xydContentVitePlugins } from \"@xyd-js/content/vite\";\nimport { Integrations, Plugins, Settings } from \"@xyd-js/core\";\nimport type { IconLibrary } from \"@xyd-js/core\";\nimport type { Plugin, PluginConfig } from \"@xyd-js/plugins\";\nimport { type UniformPlugin } from \"@xyd-js/uniform\";\n\nimport { BUILD_FOLDER_PATH, CACHE_FOLDER_PATH, HOST_FOLDER_PATH } from \"./const\";\nimport { CLI } from './cli';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport async function appInit(options?: PluginDocsOptions) {\n const readPreloadSettings = await readSettings() // TODO: in the future better solution - currently we load settings twice (pluginDocs and here)\n if (!readPreloadSettings) {\n return null\n }\n\n const preloadSettings = typeof readPreloadSettings === \"string\" ? JSON.parse(readPreloadSettings) : readPreloadSettings\n\n {\n if (!preloadSettings.integrations?.search) {\n preloadSettings.integrations = {\n ...(preloadSettings.integrations || {}),\n search: {\n orama: true\n }\n }\n }\n\n const plugins = integrationsToPlugins(preloadSettings.integrations)\n if (preloadSettings.plugins) {\n preloadSettings.plugins = [...plugins, ...preloadSettings.plugins]\n } else {\n preloadSettings.plugins = plugins\n }\n }\n\n let resolvedPlugins: PluginConfig[] = []\n {\n resolvedPlugins = await loadPlugins(preloadSettings) || []\n const userUniformVitePlugins: UniformPlugin<any>[] = []\n const componentPlugins: any[] = [] // TODO: fix any\n\n resolvedPlugins?.forEach(p => {\n if (p.uniform) {\n userUniformVitePlugins.push(...p.uniform)\n }\n if (p.components) {\n componentPlugins.push(...p.components)\n }\n })\n globalThis.__xydUserUniformVitePlugins = userUniformVitePlugins\n globalThis.__xydUserComponents = componentPlugins\n }\n\n const respPluginDocs = await pluginDocs(options)\n if (!respPluginDocs) {\n throw new Error(\"PluginDocs not found\")\n }\n if (!respPluginDocs.settings) {\n throw new Error(\"Settings not found in respPluginDocs\")\n }\n respPluginDocs.settings.plugins = [\n ...(respPluginDocs.settings?.plugins || []),\n ...(preloadSettings.plugins || [])\n ]\n\n globalThis.__xydBasePath = respPluginDocs.basePath\n globalThis.__xydSettings = respPluginDocs.settings\n globalThis.__xydPagePathMapping = respPluginDocs.pagePathMapping\n\n return {\n respPluginDocs,\n resolvedPlugins\n }\n}\n\nfunction virtualComponentsPlugin() {\n return {\n name: 'xyd-plugin-virtual-components',\n resolveId(id) {\n if (id === 'virtual:xyd-user-components') {\n return id + '.jsx'; // Return the module with .jsx extension\n }\n return null;\n },\n async load(id) {\n if (id === 'virtual:xyd-user-components.jsx') {\n const userComponents = globalThis.__xydUserComponents || []\n\n // If we have components with dist paths, pre-bundle them at build time\n if (userComponents.length > 0 && userComponents[0]?.dist) {\n // Generate imports for all components\n const imports = userComponents.map((component, index) =>\n `import Component${index} from '${component.dist}';`\n ).join('\\n');\n\n // Generate component objects for all components\n const componentObjects = userComponents.map((component, index) =>\n `{\n component: Component${index},\n name: '${component.name}',\n dist: '${component.dist}'\n }`\n ).join(',\\n ');\n\n // This will be resolved by Vite at build time\n return `\n // Pre-bundled at build time - no async loading needed\n ${imports}\n \n export const components = [\n ${componentObjects}\n ];\n `\n }\n\n // Fallback to runtime loading\n return `\n export const components = globalThis.__xydUserComponents || {}\n `\n }\n return null;\n },\n };\n}\n\nexport function virtualProvidersPlugin(\n settings: Settings\n): VitePluginOption {\n return {\n name: 'xyd-plugin-virtual-providers',\n enforce: 'pre',\n resolveId(id) {\n if (id === 'virtual:xyd-analytics-providers') {\n return id\n }\n },\n async load(id) {\n if (id === 'virtual:xyd-analytics-providers') {\n const providers = Object.keys(settings?.integrations?.analytics || {})\n const imports = providers.map(provider =>\n `import { default as ${provider}Provider } from '@pluganalytics/provider-${provider}'`\n ).join('\\n')\n\n const cases = providers.map(provider =>\n `case '${provider}': return ${provider}Provider`\n ).join('\\n')\n\n return `\n ${imports}\n\n export const loadProvider = async (provider) => {\n switch (provider) {\n ${cases}\n default:\n console.error(\\`Provider \\${provider} not found\\`)\n return null\n }\n }\n `\n }\n }\n }\n}\n\nexport function commonVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n const userVitePlugins = resolvedPlugins.map(p => p.vite).flat() || []\n\n return [\n ...(xydContentVitePlugins({\n toc: {\n maxDepth: respPluginDocs.settings.theme?.maxTocDepth || 2,\n },\n settings: respPluginDocs.settings,\n }) as VitePlugin[]),\n ...respPluginDocs.vitePlugins,\n\n reactRouter(),\n\n virtualComponentsPlugin(),\n virtualProvidersPlugin(respPluginDocs.settings),\n pluginIconSet(respPluginDocs.settings),\n\n ...userVitePlugins,\n ]\n}\n\nexport function pluginIconSet(settings: Settings): VitePluginOption {\n const DEFAULT_ICON_SET = \"lucide\";\n\n async function fetchIconSet(name: string, version?: string): Promise<{ icons: any, iconSet: IconSet }> {\n // If it's a URL, use it directly\n if (name.startsWith('http://') || name.startsWith('https://')) {\n try {\n const iconsResp = await fetch(name);\n const iconsData = await iconsResp.json();\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (error) {\n console.warn(`Failed to fetch from URL ${name}:`, error);\n }\n }\n\n // Try to read from file system\n const tryReadFile = (filePath: string) => {\n try {\n if (!fs.existsSync(filePath)) {\n console.warn(`File does not exist: ${filePath}`);\n return null;\n }\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n try {\n const iconsData = JSON.parse(fileContent);\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (parseError) {\n console.warn(`Invalid JSON in file ${filePath}:`, parseError);\n return null;\n }\n } catch (error) {\n console.warn(`Failed to read file ${filePath}:`, error);\n return null;\n }\n };\n\n\n if (path.isAbsolute(name)) {\n const result = tryReadFile(name);\n if (result) return result;\n }\n\n if (name.startsWith(\".\")) {\n const fullPath = path.join(process.cwd(), name);\n const result = tryReadFile(fullPath);\n if (result) return result;\n }\n\n // Fallback to CDN\n const cdnUrl = version\n ? `https://cdn.jsdelivr.net/npm/@iconify-json/${name}@${version}/icons.json`\n : `https://cdn.jsdelivr.net/npm/@iconify-json/${name}/icons.json`;\n\n try {\n const iconsResp = await fetch(cdnUrl);\n const iconsData = await iconsResp.json();\n const iconSet = new IconSet(iconsData);\n return { icons: iconsData, iconSet };\n } catch (error) {\n throw new Error(`Failed to load icon set from any source (file or CDN): ${name}`);\n }\n }\n\n async function processIconSet(iconSet: IconSet, icons: any, noPrefix?: boolean): Promise<Map<string, { svg: string }>> {\n const resp = new Map<string, { svg: string }>();\n\n for (const icon of Object.keys(icons.icons)) {\n const svg = iconSet.toSVG(icon);\n if (!svg) continue;\n\n let prefix = noPrefix ? undefined : iconSet.prefix;\n // If prefix is undefined, it means this is the default set and should not have a prefix\n const iconName = prefix ? `${prefix}:${icon}` : icon;\n resp.set(iconName, { svg: svg.toString() });\n }\n\n return resp;\n }\n\n async function addIconsToMap(resp: Map<string, { svg: string }>, name: string, version?: string, noPrefix?: boolean): Promise<void> {\n const { icons, iconSet } = await fetchIconSet(name, version);\n const newIcons = await processIconSet(iconSet, icons, noPrefix);\n newIcons.forEach((value, key) => resp.set(key, value));\n }\n\n async function processIconLibrary(library: string | IconLibrary | (string | IconLibrary)[]): Promise<Map<string, { svg: string }>> {\n const resp = new Map<string, { svg: string }>();\n\n if (typeof library === 'string') {\n // Single icon set as default\n await addIconsToMap(resp, library);\n } else if (Array.isArray(library)) {\n // Multiple icon sets\n for (const item of library) {\n if (typeof item === 'string') {\n // String items are treated as default set\n await addIconsToMap(resp, item);\n } else {\n // IconLibrary configuration\n const { name, version, default: isDefault, noprefix } = item;\n const noPrefix = isDefault || noprefix === true;\n await addIconsToMap(resp, name, version, noPrefix);\n }\n }\n } else {\n // Single IconLibrary configuration\n const { name, version, default: isDefault, noprefix } = library;\n const noPrefix = isDefault || noprefix === true;\n await addIconsToMap(resp, name, version, noPrefix);\n }\n\n return resp;\n }\n\n return {\n name: 'xyd-plugin-icon-set',\n enforce: 'pre',\n resolveId(id) {\n if (id === 'virtual:xyd-icon-set') {\n return id;\n }\n },\n async load(id) {\n if (id === 'virtual:xyd-icon-set') {\n let resp: Map<string, { svg: string }>;\n\n // Handle theme icons configuration\n if (settings.theme?.icons?.library) {\n resp = await processIconLibrary(settings.theme.icons.library);\n } else {\n resp = await processIconLibrary([\n {\n name: DEFAULT_ICON_SET,\n default: true,\n }\n ]);\n }\n\n return `\n export const iconSet = ${JSON.stringify(Object.fromEntries(resp))};\n `;\n }\n }\n } as VitePlugin\n}\n\nexport function getHostPath() {\n if (process.env.XYD_DEV_MODE) {\n if (process.env.XYD_HOST) {\n return path.resolve(process.env.XYD_HOST)\n }\n\n\n return path.join(__dirname, \"../../../\", HOST_FOLDER_PATH)\n }\n\n return path.join(process.cwd(), HOST_FOLDER_PATH)\n}\n\nexport function getAppRoot() {\n return getHostPath()\n}\n\n// TODO: in the future get from settings\nexport function getPublicPath() {\n return path.join(process.cwd(), 'public')\n}\n\nexport function getBuildPath() {\n return path.join(\n process.cwd(),\n BUILD_FOLDER_PATH\n );\n}\n\nexport function getDocsPluginBasePath() {\n return path.join(getHostPath(), \"./plugins/xyd-plugin-docs\")\n}\n\nasync function loadPlugins(\n settings: Settings,\n) {\n const resolvedPlugins: PluginConfig[] = []\n\n for (const plugin of settings.plugins || []) {\n let pluginName: string\n let pluginArgs: any[] = []\n\n if (typeof plugin === \"string\") {\n pluginName = plugin\n pluginArgs = []\n } else if (Array.isArray(plugin)) {\n pluginName = plugin[0]\n pluginArgs = plugin.slice(1)\n } else {\n console.error(`Currently only string and array plugins are supported, got: ${plugin}`)\n return []\n }\n\n let mod: any // TODO: fix type\n try {\n mod = await import(pluginName)\n } catch (e) {\n pluginName = path.join(process.cwd(), pluginName)\n\n // TODO: find better solution? use this every time?\n const pluginPreview = await createServer({\n optimizeDeps: {\n include: [],\n },\n });\n mod = await pluginPreview.ssrLoadModule(pluginName);\n }\n\n if (!mod.default) {\n console.error(`Plugin ${plugin} has no default export`)\n continue\n }\n\n let pluginInstance = mod.default(...pluginArgs) as (PluginConfig | Plugin)\n if (typeof pluginInstance === \"function\") {\n const plug = pluginInstance(settings)\n\n resolvedPlugins.push(plug)\n\n continue\n }\n\n resolvedPlugins.push(pluginInstance);\n\n }\n\n return resolvedPlugins\n}\n\nfunction integrationsToPlugins(integrations: Integrations) {\n const plugins: Plugins = []\n let foundSearchIntegation = 0\n\n if (integrations?.search?.orama) {\n if (typeof integrations.search.orama === \"boolean\") {\n plugins.push(\"@xyd-js/plugin-orama\")\n } else {\n plugins.push([\"@xyd-js/plugin-orama\", integrations.search.orama])\n }\n foundSearchIntegation++\n }\n\n if (integrations?.search?.algolia) {\n plugins.push([\"@xyd-js/plugin-algolia\", integrations.search.algolia])\n foundSearchIntegation++\n }\n\n if (foundSearchIntegation > 1) {\n throw new Error(\"Only one search integration is allowed\")\n }\n\n return plugins\n}\n\nexport async function preWorkspaceSetup(options: {\n force?: boolean\n} = {}) {\n await ensureFoldersExist()\n\n // Check if we can skip the setup\n if (!options.force) {\n if (await shouldSkipHostSetup()) {\n return true\n }\n }\n\n const hostTemplate = process.env.XYD_DEV_MODE\n ? path.resolve(__dirname, \"../../xyd-host\")\n : path.resolve(__dirname, \"../../host\")\n\n const hostPath = getHostPath()\n\n await copyHostTemplate(hostTemplate, hostPath)\n\n // Calculate and store new checksum after setup\n\n // Handle plugin-docs pages\n let pluginDocsPath: string | Error\n if (process.env.XYD_DEV_MODE) {\n pluginDocsPath = path.resolve(__dirname, \"../../xyd-plugin-docs\")\n } else {\n pluginDocsPath = path.resolve(__dirname, \"../../plugin-docs\")\n }\n\n const pagesSourcePath = path.join(pluginDocsPath, \"src/pages\")\n const pagesTargetPath = path.join(hostPath, \"plugins/xyd-plugin-docs/src/pages\")\n\n if (fs.existsSync(pagesSourcePath)) {\n await copyHostTemplate(pagesSourcePath, pagesTargetPath)\n } else {\n console.warn(`Pages source path does not exist: ${pagesSourcePath}`)\n }\n}\n\nexport function calculateFolderChecksum(folderPath: string): string {\n const hash = crypto.createHash('sha256');\n const ignorePatterns = [...getGitignorePatterns(folderPath), '.xydchecksum', \"node_modules\", \"dist\", \".react-router\", \"package-lock.json\", \"pnpm-lock.yaml\"];\n\n function processFile(filePath: string) {\n const relativePath = path.relative(folderPath, filePath);\n const content = fs.readFileSync(filePath);\n hash.update(relativePath);\n hash.update(content);\n }\n\n function processDirectory(dirPath: string) {\n const entries = fs.readdirSync(dirPath, { withFileTypes: true });\n\n // Sort entries to ensure consistent order\n entries.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const entry of entries) {\n const sourceEntry = path.join(dirPath, entry.name)\n\n // Skip if the entry matches any ignore pattern\n if (shouldIgnoreEntry(entry.name, ignorePatterns)) {\n continue\n }\n\n // Skip .git directory\n if (entry.name === '.git') {\n continue\n }\n\n if (entry.isDirectory()) {\n processDirectory(sourceEntry)\n } else {\n processFile(sourceEntry)\n }\n }\n }\n\n processDirectory(folderPath);\n return hash.digest('hex');\n}\n\n// TODO: xyd-host .gitignore is not copied to npm registry \nfunction getGitignorePatterns(folderPath: string): string[] {\n const gitignorePath = path.join(folderPath, '.gitignore')\n if (fs.existsSync(gitignorePath)) {\n const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8')\n return gitignoreContent\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line && !line.startsWith('#'))\n }\n return []\n}\n\nfunction shouldIgnoreEntry(entryName: string, ignorePatterns: string[]): boolean {\n return ignorePatterns.some(pattern => {\n const regex = new RegExp(pattern.replace(/\\*/g, '.*'))\n return regex.test(entryName)\n })\n}\n\nasync function copyHostTemplate(sourcePath: string, targetPath: string) {\n if (!fs.existsSync(sourcePath)) {\n throw new Error(`Host template source path does not exist: ${sourcePath}`)\n }\n\n // Clean target directory if it exists\n if (fs.existsSync(targetPath)) {\n fs.rmSync(targetPath, { recursive: true, force: true })\n }\n\n // Create target directory\n fs.mkdirSync(targetPath, { recursive: true })\n\n const ignorePatterns = getGitignorePatterns(sourcePath)\n\n // Copy all files and directories recursively\n const entries = fs.readdirSync(sourcePath, { withFileTypes: true })\n\n for (const entry of entries) {\n const sourceEntry = path.join(sourcePath, entry.name)\n const targetEntry = path.join(targetPath, entry.name)\n\n // Skip if the entry matches any ignore pattern\n if (shouldIgnoreEntry(entry.name, ignorePatterns)) {\n continue\n }\n\n // Skip .git directory\n if (entry.name === '.git') {\n continue\n }\n\n if (entry.isDirectory()) {\n await copyHostTemplate(sourceEntry, targetEntry)\n } else {\n fs.copyFileSync(sourceEntry, targetEntry)\n\n // Handle package.json modifications for local development\n if (entry.name === 'package.json' && process.env.XYD_DEV_MODE) {\n const packageJsonPath = targetEntry\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n packageJson.name = \"xyd-host-dev\"\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n }\n }\n }\n}\n\nasync function ensureFoldersExist() {\n const folders = [CACHE_FOLDER_PATH]\n for (const folder of folders) {\n const fullPath = path.resolve(process.cwd(), folder)\n if (!fs.existsSync(fullPath)) {\n fs.mkdirSync(fullPath, { recursive: true })\n }\n }\n}\n\n// TODO: in the future buil-in xyd plugins should be installable via code\nexport async function postWorkspaceSetup(settings: Settings) {\n const spinner = new CLI('dots');\n\n try {\n spinner.startSpinner('Installing xyd framework...');\n\n const hostPath = getHostPath()\n const packageJsonPath = path.join(hostPath, 'package.json')\n\n if (!fs.existsSync(packageJsonPath)) {\n console.warn('No package.json found in host path')\n return\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))\n\n // Initialize dependencies if they don't exist\n if (!packageJson.dependencies) {\n packageJson.dependencies = {}\n }\n for (const plugin of settings.plugins || []) {\n let pluginName: string\n\n if (typeof plugin === \"string\") {\n pluginName = plugin\n } else if (Array.isArray(plugin)) {\n pluginName = plugin[0]\n } else {\n continue\n }\n\n if (pluginName.startsWith(\"@xyd-js/\")) {\n continue // TODO: currently we don't install built-in xyd plugins - they are defined in host\n }\n\n // Check if it's a valid npm package name\n // Valid formats: name or @scope/name\n // Invalid: ./path/to/file.js or /absolute/path\n const isValidNpmPackage = /^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(pluginName)\n\n if (isValidNpmPackage) {\n // Search for matching dependencies in host's package.json\n const hostPackageJsonPath = path.join(hostPath, 'package.json')\n if (fs.existsSync(hostPackageJsonPath)) {\n const hostPackageJson = JSON.parse(fs.readFileSync(hostPackageJsonPath, 'utf-8'))\n const deps = hostPackageJson.dependencies || {}\n\n // Find matching dependency\n const matchingDep = Object.entries(deps).find(([depName]) => {\n return depName === pluginName\n })\n\n if (matchingDep) {\n packageJson.dependencies[pluginName] = matchingDep[1]\n } else {\n console.warn(`no matching dependency found for: ${pluginName} in: ${hostPackageJsonPath}`)\n }\n } else {\n console.warn(`no host package.json found in: ${hostPath}`)\n }\n } else if (!pluginName.startsWith('.') && !pluginName.startsWith('/')) {\n // Only warn if it's not a local file path (doesn't start with . or /)\n console.warn(`invalid plugin name: ${pluginName}`)\n }\n }\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n\n await nodeInstallPackages(hostPath)\n\n spinner.stopSpinner();\n spinner.log('✔ Local xyd framework installed successfully');\n } catch (error) {\n spinner.stopSpinner();\n spinner.error('❌ Failed to install xyd framework');\n throw error;\n }\n}\n\nfunction nodeInstallPackages(hostPath: string) {\n let cmd = process.env.XYD_NODE_PM ? `${process.env.XYD_NODE_PM} i` : 'npm i'\n if (process.env.XYD_DEV_MODE) {\n cmd = \"pnpm i\"\n }\n const execOptions: ExecSyncOptions = {\n cwd: hostPath,\n env: {\n ...process.env,\n NODE_ENV: \"\" // since 'production' does not install it well,\n }\n }\n const customRegistry = process.env.XYD_NPM_REGISTRY || process.env.npm_config_registry\n if (customRegistry) {\n if (!execOptions.env) {\n execOptions.env = {}\n }\n execOptions.env[\"npm_config_registry\"] = customRegistry\n }\n\n if (process.env.XYD_VERBOSE) {\n execOptions.stdio = 'inherit'\n }\n execSync(cmd, execOptions)\n}\n\nasync function shouldSkipHostSetup(): Promise<boolean> {\n const hostPath = getHostPath();\n\n // If host folder doesn't exist, we need to set it up\n if (!fs.existsSync(hostPath)) {\n return false;\n }\n\n const currentChecksum = calculateFolderChecksum(hostPath);\n const storedChecksum = getStoredChecksum();\n\n // If no stored checksum or checksums don't match, we need to set up\n if (!storedChecksum || storedChecksum !== currentChecksum) {\n return false;\n }\n\n return true;\n}\n\nfunction getStoredChecksum(): string | null {\n const checksumPath = path.join(getHostPath(), '.xydchecksum');\n if (!fs.existsSync(checksumPath)) {\n return null;\n }\n try {\n return fs.readFileSync(checksumPath, 'utf-8').trim();\n } catch (error) {\n console.error('Error reading checksum file:', error);\n return null;\n }\n}\n\nexport function storeChecksum(checksum: string): void {\n const checksumPath = path.join(getHostPath(), '.xydchecksum');\n try {\n fs.writeFileSync(checksumPath, checksum);\n } catch (error) {\n console.error('Error writing checksum file:', error);\n }\n}\n\n","export const HOST_FOLDER_PATH = \".xyd/host\"\nexport const CACHE_FOLDER_PATH = \".xyd/.cache\"\nexport const BUILD_FOLDER_PATH = \".xyd/build\"\n\nexport const SUPPORTED_SETTINGS_FILES = [\n 'docs.json',\n 'docs.ts',\n 'docs.tsx'\n]\n\nexport const SUPPORTED_CONTENT_FILES = [\n '.md',\n '.mdx',\n]\n\n","import readline from 'node:readline';\nimport cliSpinners from 'cli-spinners';\n\ninterface Spinner {\n frames: string[];\n interval: number;\n}\n\ntype SpinnerName = keyof typeof cliSpinners;\n\nexport class CLI {\n private spinner: Spinner;\n private spinnerInterval: NodeJS.Timeout | null = null;\n private currentFrame = 0;\n private currentMessage = '';\n private isSpinning = false;\n\n constructor(spinnerType: SpinnerName = 'dots') {\n this.spinner = cliSpinners[spinnerType] as Spinner;\n }\n\n public startSpinner(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n\n this.currentMessage = message;\n this.isSpinning = true;\n this.currentFrame = 0;\n\n // Write initial message\n this.write(`${this.spinner.frames[0]} ${this.currentMessage}`);\n\n this.spinnerInterval = setInterval(() => {\n const frame = this.spinner.frames[this.currentFrame];\n this.write(`${frame} ${this.currentMessage}`);\n this.currentFrame = (this.currentFrame + 1) % this.spinner.frames.length;\n }, this.spinner.interval);\n }\n\n public stopSpinner() {\n if (this.spinnerInterval) {\n clearInterval(this.spinnerInterval);\n this.spinnerInterval = null;\n }\n this.isSpinning = false;\n \n this.clearLine();\n }\n\n private clearLine() {\n readline.clearLine(process.stdout, 0);\n readline.cursorTo(process.stdout, 0);\n }\n\n private write(message: string) {\n this.clearLine();\n process.stdout.write(message);\n }\n\n public log(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n console.log(message);\n }\n\n public error(message: string) {\n if (this.isSpinning) {\n this.stopSpinner();\n }\n console.error(message);\n }\n\n private updateMessage(message: string) {\n this.currentMessage = message;\n }\n\n}\n\n// Export a singleton instance\nexport const cli = new CLI(); ","import path from \"node:path\";\nimport fs from \"node:fs\";\n\nimport { createServer, searchForWorkspaceRoot, ViteDevServer, Plugin as VitePlugin } from \"vite\";\n\nimport { readSettings } from \"@xyd-js/plugin-docs\";\nimport { API, APIFile, Navigation, SidebarNavigation, } from \"@xyd-js/core\";\n\nimport { appInit, calculateFolderChecksum, commonVitePlugins, getAppRoot, getDocsPluginBasePath, getHostPath, getPublicPath, postWorkspaceSetup, preWorkspaceSetup, storeChecksum } from \"./utils\";\nimport { CACHE_FOLDER_PATH, SUPPORTED_SETTINGS_FILES, SUPPORTED_CONTENT_FILES } from \"./const\";\nimport { CLI } from \"./cli\";\n\n// TODO: !!! BETTER TIMER / DEBUG API !!!\nif (!process.env.ENABLE_TIMERS) {\n ['time', 'timeLog', 'timeEnd'].forEach(method => {\n console[method] = () => {\n };\n });\n}\n\n// TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\nconst fullReloadOptions = {\n \"theme.name\": true,\n \"theme.icons\": true,\n \"theme.integrations\": true,\n \"theme.banner\": true,\n\n\n \"navigation.header\": true,\n \"navigation.segments\": true,\n\n \"engine\": true,\n}\n\n/**\n * Extracts a nested property from an object using dot notation\n * @param obj - The object to extract from\n * @param path - The dot-notation path (e.g., \"theme.banner\")\n * @returns The value at the path or null if not found\n */\nfunction extractNestedProperty(obj: any, path: string): any {\n const keys = path.split('.');\n let current = obj;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = current[key];\n } else {\n return null;\n }\n }\n\n return current;\n}\n\n/**\n * Compares two values for changes, handling deep comparison for objects\n */\nfunction hasValueChanged(oldValue: any, newValue: any): boolean {\n // If one is null/undefined and the other isn't, there's a change\n if (!oldValue && newValue) return true;\n if (oldValue && !newValue) return true;\n if (!oldValue && !newValue) return false;\n\n // Deep comparison using JSON.stringify for objects/arrays\n const oldStr = JSON.stringify(oldValue);\n const newStr = JSON.stringify(newValue);\n\n return oldStr !== newStr;\n}\n\n/**\n * Checks if any of the properties in fullReloadOptions have changed\n */\nfunction hasFullReloadPropertiesChanged(oldSettings: any, newSettings: any): boolean {\n for (const [propertyPath, shouldCheck] of Object.entries(fullReloadOptions)) {\n if (shouldCheck) {\n const oldValue = extractNestedProperty(oldSettings, propertyPath);\n const newValue = extractNestedProperty(newSettings, propertyPath);\n\n if (hasValueChanged(oldValue, newValue)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\ninterface DevOptions {\n port?: number\n}\n\nlet RELOADING = false\n\nexport async function dev(options?: DevOptions) {\n const spinner = new CLI('dots');\n spinner.startSpinner('Preparing local xyd instance...');\n\n const skip = await preWorkspaceSetup()\n\n const inited = await appInit()\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n \n const allowCwd = searchForWorkspaceRoot(process.cwd())\n const appRoot = getAppRoot()\n const commonRunVitePlugins = commonVitePlugins(respPluginDocs, resolvedPlugins)\n spinner.stopSpinner();\n\n if (!skip) {\n await postWorkspaceSetup(respPluginDocs.settings)\n\n const newChecksum = calculateFolderChecksum(getHostPath());\n storeChecksum(newChecksum);\n }\n\n // ⚠️ \n spinner.log('✔ Local xyd instance is ready');\n\n let server: ViteDevServer | null = null\n\n const port = options?.port ?? parseInt(process.env.XYD_PORT ?? \"5175\")\n\n // Store initial settings for comparison\n // let initialSettings = respPluginDocs.settings;\n\n let USE_CONTEXT_ISSUE_PACKAGES: string[] = []\n {\n // TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\n if (process.env.XYD_DEV_MODE) {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"react-github-btn\",\n \"radix-ui\",\n \"@code-hike/lighter\",\n \"lucide-react\",\n \"openux-js\",\n \"pluganalytics\",\n ];\n } else {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"@xyd-js/theme-cosmo\",\n \"@xyd-js/theme-opener\",\n \"@xyd-js/theme-picasso\",\n \"@xyd-js/theme-poetry\"\n ]\n }\n }\n\n const preview = await createServer({\n root: appRoot,\n publicDir: '/public',\n server: {\n allowedHosts: [],\n port: port,\n fs: {\n allow: [\n allowCwd,\n appRoot,\n ]\n }\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser'\n },\n // preserveSymlinks: true\n },\n build: {\n rollupOptions: {\n external: []\n },\n },\n ssr: {\n external: [],\n },\n optimizeDeps: {\n include: [\n \"react/jsx-runtime\",\n ...USE_CONTEXT_ISSUE_PACKAGES,\n ],\n // exclude: [\"react\", \"react-dom\"]\n },\n plugins: [\n ...commonRunVitePlugins,\n\n {\n name: 'xyd-configureServer',\n configureServer(s) {\n server = s\n }\n }\n ],\n });\n\n\n // Set up manual file watcher for markdown files TODO: better way? + HMR only for specific components instead or reload a pag\n const watcher = fs.watch(allowCwd, { recursive: true }, async (eventType, filename) => {\n if (RELOADING) {\n return\n }\n\n if (!filename) {\n console.log(\"[xyd:dev-watcher] Received empty filename\");\n return;\n }\n\n if (!server) {\n console.log(\"[xyd:dev-watcher] Server not ready\");\n return\n }\n\n const filePath = path.join(allowCwd, filename);\n if (filePath.includes(CACHE_FOLDER_PATH)) {\n return\n }\n\n const publicPathReload = filePath.includes(getPublicPath())\n if (publicPathReload) {\n const relativePath = path.relative(allowCwd, filePath);\n const urlPath = '/' + relativePath.replace(/\\\\/g, '/');\n\n // TODO: touch layout + settings\n preview.ws.send({\n type: 'full-reload',\n path: urlPath,\n });\n return\n }\n\n let apiPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings?.api) {\n apiPaths = resolveApiFilePaths(process.cwd(), respPluginDocs.settings.api)\n }\n const apiChanged = !!apiPaths[filePath]\n const isSettingsFile = SUPPORTED_SETTINGS_FILES.some(ext => filePath.endsWith(ext))\n const isContentFile = SUPPORTED_CONTENT_FILES.some(ext => filePath.endsWith(ext))\n const isWatchFile = isSettingsFile || isContentFile || apiChanged\n if (!isWatchFile) {\n return\n }\n\n if (isContentFile && eventType !== 'rename') {\n console.log('🔄 Content file changed, refresh...', eventType);\n\n invalidateSettings(server)\n await touchLayoutPage()\n // console.log('✔ xyd instance reloaded\\n');\n\n return\n }\n\n const renameContentFile = isContentFile && eventType === 'rename'\n\n if (isSettingsFile || renameContentFile) {\n if (renameContentFile) {\n console.log('🔄 Content file renamed, refresh...');\n } else {\n console.log('🔄 Settings file changed, refresh...');\n }\n\n // TODO: better way to handle that - we need this cuz otherwise its inifiite reloads\n if (respPluginDocs?.settings.engine?.uniform?.store) {\n await appInit({\n disableFSWrite: true,\n })\n } else {\n await appInit() // TODO: !!! IN THE FUTURE MORE EFFICIENT WAY !!!\n }\n\n // Re-read settings to get the updated values\n const newSettings = await readSettings();\n if (typeof newSettings !== 'object') {\n console.log(\"[xyd:dev-watcher] Settings is not an object\");\n return\n } \n\n invalidateSettings(server)\n await touchReactRouterConfig()\n await touchLayoutPage()\n server.ws.send({ type: 'full-reload' }); \n }\n });\n\n // Log any watcher errors\n watcher.on('error', (error) => {\n console.error(\"[xyd:dev] File watcher error:\", error);\n });\n\n await preview.listen(port);\n if (respPluginDocs.settings.navigation) {\n await optimizeDepsFix(port, respPluginDocs.settings.navigation)\n }\n\n preview.printUrls();\n preview.bindCLIShortcuts({ print: true });\n\n // Clean up watcher when server is closed\n preview.httpServer?.once('close', () => {\n watcher.close();\n });\n}\n\n/**\n * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks api.*, \n * resolves all referenced files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveApiFilePaths(\n basePath: string,\n api: API\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const apis = [api.openapi, api.graphql, api.sources].filter((s): s is APIFile => s !== undefined)\n\n apis.forEach(section => {\n flattenApiFile(section).forEach(p => {\n const apiAbsPath = path.resolve(basePath, p)\n result[apiAbsPath] = true\n })\n })\n\n return result\n}\n\n\n/**\n * Given any APIFile-ish value, returns an array of the raw source-paths.\n */\nfunction flattenApiFile(file?: APIFile): string[] {\n if (!file) return []\n\n // single string\n if (typeof file === 'string') {\n return [file]\n }\n\n // array of anything\n if (Array.isArray(file)) {\n return file.flatMap(flattenApiFile)\n }\n\n // object: either a nested config, or a map of name→file\n if (typeof file === 'object') {\n const obj = file as Record<string, any>\n\n // explicit nested entry\n if (typeof obj.source === 'string') {\n return [obj.source]\n }\n\n // fallback: treat as { key: APIFile } map\n return Object.values(obj).flatMap(flattenApiFile)\n }\n\n // everything else (e.g. numbers, booleans) gets dropped\n return []\n}\n\n/**\n * Extracts the first page from navigation settings\n */\nfunction getFirstPageFromNavigation(navigation: Navigation): string | null {\n if (!navigation?.sidebar?.length) {\n return null;\n }\n\n function extractFirstPage(pages: SidebarNavigation): string | null {\n for (const page of pages) {\n if (typeof page === 'string') {\n return normalizePagePath(page);\n }\n\n if (typeof page === 'object') {\n // Handle SidebarRoute\n if ('route' in page && page.pages) {\n const firstPage = extractFirstPage(page.pages);\n if (firstPage) return firstPage;\n }\n\n // Handle Sidebar with pages\n if ('pages' in page && page.pages) {\n const firstPage = extractFirstPage(page.pages as SidebarNavigation);\n if (firstPage) return firstPage;\n }\n\n // Handle VirtualPage\n if ('page' in page && typeof page.page === 'string') {\n return normalizePagePath(page.page);\n }\n }\n }\n return null;\n }\n\n return extractFirstPage(navigation.sidebar);\n}\n\n/**\n * Normalizes a page path by removing .md/.mdx extensions and handling index pages\n */\nfunction normalizePagePath(pagePath: string): string {\n // Remove .md or .mdx extension if present\n let normalized = pagePath.replace(/\\.(md|mdx)$/, '');\n\n // If the path ends with 'index', remove it to get the directory\n if (normalized.endsWith('/index') || normalized === 'index') {\n normalized = normalized.replace(/\\/?index$/, '');\n }\n\n // Ensure it doesn't start with a slash for consistency\n if (normalized.startsWith('/')) {\n normalized = normalized.slice(1);\n }\n\n return normalized;\n}\n\n/**\n * Fetches the first page to preload it\n */\nasync function fetchFirstPage(firstPage: string, port: number) {\n const urlsToTry = [\n `http://localhost:${port}/${firstPage}`,\n `http://localhost:${port}/${firstPage}/`,\n `http://localhost:${port}/${firstPage}.html`,\n `http://localhost:${port}/${firstPage}/index.html`\n ];\n\n for (const url of urlsToTry) {\n try {\n const response = await fetch(url);\n if (response.ok) {\n return; // Success, exit early\n }\n } catch (error) {\n // Continue to next URL if this one fails\n continue;\n }\n }\n}\n\nfunction invalidateSettings(server: ViteDevServer) {\n const virtualId = 'virtual:xyd-settings';\n const resolvedId = virtualId + '.jsx';\n const mod = server.moduleGraph.getModuleById(resolvedId);\n if (!mod) {\n console.log(\"[xyd:dev-watcher] Settings module not found\");\n return\n }\n\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({\n type: 'update',\n updates: [\n {\n type: 'js-update',\n path: `/@id/${resolvedId}`,\n acceptedPath: `/@id/${resolvedId}`,\n timestamp: Date.now(),\n },\n ],\n });\n}\n\nasync function touchReactRouterConfig() {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"react-router.config.ts\")\n await fs.promises.utimes(hostReactRouterConfig, new Date(), new Date());\n}\n\nasync function touchLayoutPage() {\n const docsPluginBasePath = getDocsPluginBasePath()\n const layoutPath = path.join(docsPluginBasePath, \"./src/pages/layout.tsx\")\n await fs.promises.utimes(layoutPath, new Date(), new Date());\n}\n\nasync function experimentalInvalidateAndTouchPages(server: ViteDevServer) {\n const docsPluginBasePath = getDocsPluginBasePath()\n\n const layoutPath = path.join(docsPluginBasePath, \"./src/pages/layout.tsx\")\n const layoutModule = server.moduleGraph.getModuleById(layoutPath);\n\n const pagePath = path.join(docsPluginBasePath, \"./src/pages/page.tsx\")\n const pageModule = server.moduleGraph.getModuleById(pagePath);\n\n const pageModules = layoutModule && pageModule\n if (!pageModules) {\n console.log(\"[xyd:dev-watcher] Pages modules not found\");\n return\n }\n\n server.moduleGraph.invalidateModule(layoutModule);\n server.moduleGraph.invalidateModule(pageModule);\n\n await fs.promises.utimes(layoutPath, new Date(), new Date());\n await fs.promises.utimes(pagePath, new Date(), new Date());\n}\n\n\n// TODO: finish\nasync function experimentalInvalidateVite(server: ViteDevServer) {\n // Get all modules from the module graph and invalidate them\n const allModules = Array.from(server.moduleGraph.urlToModuleMap.values());\n let invalidatedCount = 0;\n\n for (const module of allModules) {\n if (module) {\n server.moduleGraph.invalidateModule(module);\n invalidatedCount++;\n }\n }\n\n // Also invalidate the host router config\n try {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"react-router.config.ts\")\n await fs.promises.utimes(hostReactRouterConfig, new Date(), new Date());\n } catch (e) {\n console.error(e)\n }\n\n server.ws.send({ type: 'full-reload' });\n return;\n}\n\n// TODO: !!! IN THE FUTURE BETTER SOLUTION !!!\nasync function optimizeDepsFix(port: number, navigation: Navigation) {\n // TODO: ITS A WORKAROUND FOR NOW, IN THE FUTURE WE NEED TO DO IT BETTER \n // ITS FOR OPTIMZE DEPS FIX\n // find first page from respPluginDocs.settings navigation and do fetch for it \n const firstPage = getFirstPageFromNavigation(navigation);\n if (firstPage) {\n await fetchFirstPage(firstPage, port);\n }\n}\n","import fs from 'node:fs';\n\nimport { preWorkspaceSetup, postWorkspaceSetup, getHostPath } from './utils';\nimport { readSettings } from '@xyd-js/plugin-docs';\n\n\nexport async function install() {\n const settings = await readSettings() // TODO: in the future better solution - currently we load settings twice (pluginDocs and here)\n if (!settings) {\n throw new Error(\"cannot preload settings\")\n }\n if (typeof settings === \"string\") {\n throw new Error(\"install does not support string settings\")\n }\n\n // Clear the host folder if it exists\n const hostPath = getHostPath();\n if (fs.existsSync(hostPath)) {\n fs.rmSync(hostPath, { recursive: true, force: true });\n }\n\n // Run pre-workspace setup\n await preWorkspaceSetup({\n force: true,\n });\n\n // Run post-workspace setup with empty settings\n // The actual settings will be loaded during the build/dev process\n await postWorkspaceSetup(settings);\n}"],"mappings":";AAAA,OAAOA,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,iBAAAC,sBAAqB;AAE9B,SAAS,SAAS,iBAAuC;AACzD,OAAO,mBAAmB;;;ACL1B,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,qBAAqB;AAC9B,SAAS,gBAAiC;AAC1C,OAAO,YAAY;AAEnB,SAAS,oBAA4E;AACrF,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAExB,SAAS,cAAc,kBAAwD;AAC/E,SAAS,eAAe,6BAA6B;;;ACX9C,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAE1B,IAAM,2BAA2B;AAAA,EACpC;AAAA,EACA;AAAA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A,IACN,SAAS;AAAA,MACL;AAAA,QACI,MAAM;AAAA,QACN,MAAM,QAAQ,UAAU;AAAA,QACxB,cAAc,QAAQ,UAAU;AAAA,QAChC,WAAW,KAAK,IAAI;AAAA,MACxB;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;AAEA,eAAe,yBAAyB;AACpC,QAAM,WAAW,YAAY;AAC7B,QAAM,wBAAwBA,MAAK,KAAK,UAAU,wBAAwB;AAC1E,QAAMD,IAAG,SAAS,OAAO,uBAAuB,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC1E;AAEA,eAAe,kBAAkB;AAC7B,QAAM,qBAAqB,sBAAsB;AACjD,QAAM,aAAaC,MAAK,KAAK,oBAAoB,wBAAwB;AACzE,QAAMD,IAAG,SAAS,OAAO,YAAY,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC/D;AAoDA,eAAe,gBAAgB,MAAc,YAAwB;AAIjE,QAAM,YAAY,2BAA2B,UAAU;AACvD,MAAI,WAAW;AACX,UAAM,eAAe,WAAW,IAAI;AAAA,EACxC;AACJ;;;AChiBA,OAAOG,SAAQ;AAGf,SAAS,gBAAAC,qBAAoB;AAG7B,eAAsB,UAAU;AAC5B,QAAM,WAAW,MAAMA,cAAa;AACpC,MAAI,CAAC,UAAU;AACX,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACA,MAAI,OAAO,aAAa,UAAU;AAC9B,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAGA,QAAM,WAAW,YAAY;AAC7B,MAAIC,IAAG,WAAW,QAAQ,GAAG;AACzB,IAAAA,IAAG,OAAO,UAAU,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EACxD;AAGA,QAAM,kBAAkB;AAAA,IACpB,OAAO;AAAA,EACX,CAAC;AAID,QAAM,mBAAmB,QAAQ;AACrC;","names":["path","fs","fileURLToPath","path","fs","fileURLToPath","path","fs","createServer","readSettings","createServer","fs","path","readSettings","fs","readSettings","fs"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/documan",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.85",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"@react-router/serve": "^7.6.2",
|
|
20
20
|
"cli-spinners": "^3.0.0",
|
|
21
21
|
"vite-tsconfig-paths": "^5.1.4",
|
|
22
|
-
"@xyd-js/
|
|
23
|
-
"@xyd-js/
|
|
24
|
-
"@xyd-js/
|
|
25
|
-
"@xyd-js/uniform": "0.1.0-xyd.
|
|
26
|
-
"@xyd-js/
|
|
22
|
+
"@xyd-js/content": "0.1.0-xyd.67",
|
|
23
|
+
"@xyd-js/plugin-docs": "0.1.0-xyd.56",
|
|
24
|
+
"@xyd-js/core": "0.1.0-xyd.66",
|
|
25
|
+
"@xyd-js/uniform": "0.1.0-xyd.68",
|
|
26
|
+
"@xyd-js/plugins": "0.1.0-xyd.53"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@mdx-js/rollup": "^3.1.0",
|