@xyd-js/documan 0.1.0-build.193 → 0.1.0-build.196

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 CHANGED
@@ -115,6 +115,141 @@ import { IconSet } from "@iconify/tools";
115
115
  import { readSettings, pluginDocs } from "@xyd-js/plugin-docs";
116
116
  import { vitePlugins as xydContentVitePlugins } from "@xyd-js/content/vite";
117
117
 
118
+ // ../xyd-plugin-supademo/package.json
119
+ var package_default = {
120
+ name: "@xyd-js/plugin-supademo",
121
+ version: "0.1.0-build.23",
122
+ author: "",
123
+ description: "",
124
+ license: "MIT",
125
+ main: "./dist/index.js",
126
+ type: "module",
127
+ exports: {
128
+ "./package.json": "./package.json",
129
+ ".": {
130
+ import: "./dist/index.js"
131
+ }
132
+ },
133
+ scripts: {
134
+ clean: "rimraf build",
135
+ prebuild: "pnpm clean",
136
+ build: "tsup",
137
+ test: "vitest",
138
+ "test:coverage": "vitest run --coverage"
139
+ },
140
+ dependencies: {},
141
+ peerDependencies: {},
142
+ devDependencies: {
143
+ vite: "^7.0.0",
144
+ "@vitest/coverage-v8": "^1.6.1",
145
+ rimraf: "^3.0.2",
146
+ tsup: "^8.4.0",
147
+ vitest: "^1.6.1"
148
+ }
149
+ };
150
+
151
+ // ../xyd-plugin-chatwoot/package.json
152
+ var package_default2 = {
153
+ name: "@xyd-js/plugin-chatwoot",
154
+ version: "0.1.0-build.23",
155
+ author: "",
156
+ description: "",
157
+ license: "MIT",
158
+ main: "./dist/index.js",
159
+ type: "module",
160
+ exports: {
161
+ "./package.json": "./package.json",
162
+ ".": {
163
+ import: "./dist/index.js"
164
+ }
165
+ },
166
+ scripts: {
167
+ clean: "rimraf build",
168
+ prebuild: "pnpm clean",
169
+ build: "tsup",
170
+ test: "vitest",
171
+ "test:coverage": "vitest run --coverage"
172
+ },
173
+ dependencies: {},
174
+ peerDependencies: {
175
+ react: "^19.1.0",
176
+ "react-dom": "^19.1.0"
177
+ },
178
+ devDependencies: {
179
+ vite: "^7.0.0",
180
+ "@vitest/coverage-v8": "^1.6.1",
181
+ rimraf: "^3.0.2",
182
+ tsup: "^8.4.0",
183
+ vitest: "^1.6.1"
184
+ }
185
+ };
186
+
187
+ // ../xyd-plugin-intercom/package.json
188
+ var package_default3 = {
189
+ name: "@xyd-js/plugin-intercom",
190
+ version: "0.1.0-build.23",
191
+ author: "",
192
+ description: "",
193
+ license: "MIT",
194
+ main: "./dist/index.js",
195
+ type: "module",
196
+ exports: {
197
+ "./package.json": "./package.json",
198
+ ".": {
199
+ import: "./dist/index.js"
200
+ }
201
+ },
202
+ scripts: {
203
+ clean: "rimraf build",
204
+ prebuild: "pnpm clean",
205
+ build: "tsup",
206
+ test: "vitest",
207
+ "test:coverage": "vitest run --coverage"
208
+ },
209
+ dependencies: {},
210
+ peerDependencies: {},
211
+ devDependencies: {
212
+ vite: "^7.0.0",
213
+ "@vitest/coverage-v8": "^1.6.1",
214
+ rimraf: "^3.0.2",
215
+ tsup: "^8.4.0",
216
+ vitest: "^1.6.1"
217
+ }
218
+ };
219
+
220
+ // ../xyd-plugin-livechat/package.json
221
+ var package_default4 = {
222
+ name: "@xyd-js/plugin-livechat",
223
+ version: "0.1.0-build.23",
224
+ author: "",
225
+ description: "",
226
+ license: "MIT",
227
+ main: "./dist/index.js",
228
+ type: "module",
229
+ exports: {
230
+ "./package.json": "./package.json",
231
+ ".": {
232
+ import: "./dist/index.js"
233
+ }
234
+ },
235
+ scripts: {
236
+ clean: "rimraf build",
237
+ prebuild: "pnpm clean",
238
+ build: "tsup",
239
+ test: "vitest",
240
+ "test:coverage": "vitest run --coverage"
241
+ },
242
+ dependencies: {},
243
+ peerDependencies: {},
244
+ devDependencies: {
245
+ vite: "^7.0.0",
246
+ "@vitest/coverage-v8": "^1.6.1",
247
+ rimraf: "^3.0.2",
248
+ tsup: "^8.4.0",
249
+ vitest: "^1.6.1"
250
+ }
251
+ };
252
+
118
253
  // src/const.ts
119
254
  var XYD_FOLDER_PATH = ".xyd";
120
255
  var HOST_FOLDER_PATH = `${XYD_FOLDER_PATH}/host`;
@@ -346,10 +481,10 @@ var ANALYTICS_INTEGRATION_DEPENDENCIES = {
346
481
  }
347
482
  };
348
483
  var EXTERNAL_XYD_PLUGINS = {
349
- "@xyd-js/plugin-supademo": "0.0.0",
350
- "@xyd-js/plugin-chatwoot": "0.0.0",
351
- "@xyd-js/plugin-intercom": "0.0.0",
352
- "@xyd-js/plugin-livechat": "0.0.0"
484
+ "@xyd-js/plugin-supademo": package_default.version,
485
+ "@xyd-js/plugin-chatwoot": package_default2.version,
486
+ "@xyd-js/plugin-intercom": package_default3.version,
487
+ "@xyd-js/plugin-livechat": package_default4.version
353
488
  };
354
489
  async function appInit(options) {
355
490
  const readPreloadSettings = await readSettings();
@@ -1095,6 +1230,10 @@ async function setupPluginDependencies(settings, install2 = false) {
1095
1230
  spinner.startSpinner("Installing plugin dependencies...");
1096
1231
  const packageJson = await hostPackageJson();
1097
1232
  const packageJsonPath = path2.join(hostPath, "package.json");
1233
+ packageJson.dependencies = {
1234
+ ...packageJson.dependencies,
1235
+ ...dependencies
1236
+ };
1098
1237
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
1099
1238
  await nodeInstallPackages(hostPath);
1100
1239
  spinner.stopSpinner();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js","../src/build.ts","../src/utils.ts","../src/const.ts","../src/cli.ts","../src/componentsInstall.ts","../src/dev.ts","../src/install.ts"],"sourcesContent":["let p = process || {}, argv = p.argv || [], env = p.env || {}\nlet isColorSupported =\n\t!(!!env.NO_COLOR || argv.includes(\"--no-color\")) &&\n\t(!!env.FORCE_COLOR || argv.includes(\"--color\") || p.platform === \"win32\" || ((p.stdout || {}).isTTY && env.TERM !== \"dumb\") || !!env.CI)\n\nlet formatter = (open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input, index = string.indexOf(close, open.length)\n\t\treturn ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\", cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet f = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: f(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: f(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: f(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: f(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: f(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: f(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: f(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: f(\"\\x1b[9m\", \"\\x1b[29m\"),\n\n\t\tblack: f(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: f(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: f(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: f(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: f(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: f(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: f(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: f(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\n\t\tbgBlack: f(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: f(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: f(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: f(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: f(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: f(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: f(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: f(\"\\x1b[47m\", \"\\x1b[49m\"),\n\n\t\tblackBright: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tredBright: f(\"\\x1b[91m\", \"\\x1b[39m\"),\n\t\tgreenBright: f(\"\\x1b[92m\", \"\\x1b[39m\"),\n\t\tyellowBright: f(\"\\x1b[93m\", \"\\x1b[39m\"),\n\t\tblueBright: f(\"\\x1b[94m\", \"\\x1b[39m\"),\n\t\tmagentaBright: f(\"\\x1b[95m\", \"\\x1b[39m\"),\n\t\tcyanBright: f(\"\\x1b[96m\", \"\\x1b[39m\"),\n\t\twhiteBright: f(\"\\x1b[97m\", \"\\x1b[39m\"),\n\n\t\tbgBlackBright: f(\"\\x1b[100m\", \"\\x1b[49m\"),\n\t\tbgRedBright: f(\"\\x1b[101m\", \"\\x1b[49m\"),\n\t\tbgGreenBright: f(\"\\x1b[102m\", \"\\x1b[49m\"),\n\t\tbgYellowBright: f(\"\\x1b[103m\", \"\\x1b[49m\"),\n\t\tbgBlueBright: f(\"\\x1b[104m\", \"\\x1b[49m\"),\n\t\tbgMagentaBright: f(\"\\x1b[105m\", \"\\x1b[49m\"),\n\t\tbgCyanBright: f(\"\\x1b[106m\", \"\\x1b[49m\"),\n\t\tbgWhiteBright: f(\"\\x1b[107m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","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 {\n appInit,\n calculateFolderChecksum,\n commonPostInstallVitePlugins,\n commonVitePlugins,\n getAppRoot,\n getBuildPath,\n getHostPath,\n getXydFolderPath,\n postWorkspaceSetup,\n preWorkspaceSetup,\n storeChecksum\n} 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 = await 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 const postInstallVitePlugins = commonPostInstallVitePlugins(respPluginDocs, resolvedPlugins)\n \n {\n await setupInstallableEnvironmentV2()\n }\n\n // Determine conditional externals based on settings\n const enableMermaid = !!respPluginDocs?.settings?.integrations?.diagrams\n const externalPackages = enableMermaid ? [] : [\"rehype-mermaid\"]\n\n try {\n // Build the client-side bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n plugins: [\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\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 // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n }\n },\n build: {\n rollupOptions: {\n external: externalPackages,\n },\n },\n ssr: {\n external: externalPackages,\n },\n // ssr: {\n // noExternal: [\"react\", \"react-dom\", \"react-router\"]\n // }\n });\n\n // Build the SSR bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n build: {\n ssr: true,\n rollupOptions: {\n external: externalPackages,\n },\n // rollupOptions: {\n // external: [\"@xyd-js/framework/hydration\", \"fs\"]\n // }\n },\n plugins: [\n fixManifestPlugin(appRoot),\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\n\n tsconfigPaths(),\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n // include: [\"react\", \"react-dom\", \"react/jsx-runtime\", \"react-router\"],\n // force: true\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser',\n // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n // react: path.resolve(workspaceNodeModulesPath, \"react\"),\n // \"react-dom\": path.resolve(workspaceNodeModulesPath, \"react-dom\")\n }\n },\n ssr: {\n external: externalPackages,\n },\n // ssr: {\n // noExternal: [\"react\", \"react-dom\", \"react-router\"]\n // }\n });\n } catch (error) {\n console.error('Build failed:', error); // TODO: better message\n }\n}\n\nfunction setupInstallableEnvironmentV2() {\n const symbolicXydNodeModules = path.join(getXydFolderPath(), \"node_modules\")\n const hostNodeModules = path.join(getHostPath(), \"node_modules\")\n\n if (fs.existsSync(symbolicXydNodeModules)) {\n if (fs.lstatSync(symbolicXydNodeModules).isSymbolicLink()) {\n fs.unlinkSync(symbolicXydNodeModules);\n } else {\n fs.rmSync(symbolicXydNodeModules, { recursive: true, force: true });\n }\n }\n fs.symlinkSync(hostNodeModules, symbolicXydNodeModules, 'dir');\n\n // const buildDir = getBuildPath();\n // const packageJsonPath = path.join(buildDir, 'package.json');\n\n // const packageJsonContent = {\n // type: \"module\",\n // scripts: {},\n // dependencies: {},\n // devDependencies: {}\n // };\n\n // if (!fs.existsSync(buildDir)) {\n // fs.mkdirSync(buildDir, {recursive: true});\n // }\n\n // fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), 'utf8');\n\n // const buildNodeModulesPath = path.join(buildDir, 'node_modules');\n // const dirname = path.dirname(fileURLToPath(import.meta.url));\n\n // let workspaceNodeModulesPath = '';\n // if (process.env.XYD_DEV_MODE) {\n // workspaceNodeModulesPath = path.resolve(dirname, '../../../node_modules');\n // } else {\n // // TODO: check if works for npm\n // workspaceNodeModulesPath = getXydFolderPath()\n // }\n\n // console.log(\"workspaceNodeModulesPath\", workspaceNodeModulesPath);\n\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 // fs.symlinkSync(workspaceNodeModulesPath, buildNodeModulesPath, 'dir');\n\n // return workspaceNodeModulesPath;\n}\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 // getAppRoot(),\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, { dirname } 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\";\nimport { realpathSync } from 'node:fs';\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 { HeadConfig, Integrations, Plugins, Settings } from \"@xyd-js/core\";\nimport type { IconLibrary, WebEditorNavigationItem } 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, XYD_FOLDER_PATH } from \"./const\";\nimport { CLI } from './cli';\nimport { componentDependencies, componentsInstall } from \"./componentsInstall\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst ANALYTICS_INTEGRATION_DEPENDENCIES = {\n livesession: {\n \"@pluganalytics/provider-livesession\": \"0.0.0-pre.7\"\n }\n}\n\nconst EXTERNAL_XYD_PLUGINS = {\n \"@xyd-js/plugin-supademo\": \"0.0.0\",\n \"@xyd-js/plugin-chatwoot\": \"0.0.0\",\n \"@xyd-js/plugin-intercom\": \"0.0.0\",\n \"@xyd-js/plugin-livechat\": \"0.0.0\"\n}\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: Settings = 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: LoadedPlugin[] = []\n {\n resolvedPlugins = await loadPlugins(preloadSettings, options) || []\n const userUniformVitePlugins: UniformPlugin<any>[] = []\n const componentPlugins: any[] = [] // TODO: fix any\n\n resolvedPlugins?.forEach((p: LoadedPlugin) => {\n if (p.uniform) {\n userUniformVitePlugins.push(...p.uniform)\n }\n if (p.components) {\n const components: any[] = []\n\n if (!Array.isArray(p.components) && typeof p.components === \"object\") {\n const mapComponents: any[] = []\n\n Object.keys(p.components).forEach((key) => {\n if (!p?.components?.[key]) {\n return\n }\n\n const component = p.components[key]\n\n mapComponents.push({\n component,\n name: key,\n })\n })\n\n p.components = mapComponents\n }\n\n if (Array.isArray(p.components)) {\n for (const component of p.components) {\n if (!component.component) {\n console.error(\"No component function\")\n continue\n }\n\n if (!component.name) {\n component.name = component.component.name\n }\n\n if (!component.dist) {\n component.dist = p._pluginPkg + \"/\" + component.name\n continue\n }\n\n if (!component.name) {\n console.error(\"No component name\")\n continue\n }\n }\n\n components.push(...p.components)\n }\n\n componentPlugins.push(...components)\n }\n\n const head = p.head\n if (head?.length && preloadSettings?.theme?.head) {\n preloadSettings.theme.head.push(\n ...head\n )\n }\n })\n\n globalThis.__xydUserUniformVitePlugins = userUniformVitePlugins\n globalThis.__xydUserComponents = componentPlugins\n }\n\n const respPluginDocs = await pluginDocs({\n ...options,\n appInit,\n })\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 if (respPluginDocs.settings?.theme) {\n respPluginDocs.settings.theme.head = [\n ...(respPluginDocs.settings?.theme?.head || []),\n ...(preloadSettings.theme?.head || []),\n ]\n }\n\n globalThis.__xydBasePath = respPluginDocs.basePath\n globalThis.__xydSettings = respPluginDocs.settings\n globalThis.__xydPagePathMapping = respPluginDocs.pagePathMapping\n globalThis.__xydHasIndexPage = respPluginDocs.hasIndexPage\n globalThis.__xydSettingsClone = JSON.parse(JSON.stringify(respPluginDocs.settings)) // TODO: finish\n\n // appearanceWebEditor(respPluginDocs.settings)\n\n if (respPluginDocs.settings.integrations?.diagrams) {\n if (!componentExists(\"diagrams\")) {\n await componentsInstall(\"diagrams\")\n }\n }\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]?.component) {\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 async function commonVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n const userVitePlugins = resolvedPlugins.map(p => p.vite).flat() || []\n\n return [\n ...(await xydContentVitePlugins({\n toc: {\n maxDepth: respPluginDocs.settings.theme?.writer?.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 commonPostInstallVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n\n return [\n vitePluginThemePresets(respPluginDocs.settings),\n ]\n}\n\n\nexport async function vitePluginThemePresets(settings: Settings) {\n const themeName = settings.theme?.name\n const VIRTUAL_ID = 'virtual:xyd-theme-presets';\n const RESOLVED_ID = '\\0' + VIRTUAL_ID;\n\n // Resolve theme folder using Node APIs\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n let themeRoot = \"\"\n if (process.env.XYD_CLI) {\n themeRoot = path.join(getHostPath(), `node_modules/@xyd-js/theme-${themeName}/dist`)\n } else {\n themeRoot = path.join(path.resolve(__dirname, \"../../\"), `xyd-theme-${themeName}/dist`)\n }\n\n const presetsDir = path.join(themeRoot, 'presets');\n\n // Read available CSS files\n let cssFiles: string[] = [];\n try {\n const files = fs.readdirSync(presetsDir);\n cssFiles = files.filter((f) => f.endsWith('.css'));\n } catch (err) {\n }\n\n // Build import statements and map entries\n const importStmts: string[] = [];\n const mapEntries: string[] = [];\n\n cssFiles.forEach((file, index) => {\n const name = file.replace(/\\.css$/, '');\n const varName = `preset${index}`;\n const pkgPath = `@xyd-js/theme-${themeName}/presets/${file}`;\n\n importStmts.push(`import ${varName} from '${pkgPath}?url';`);\n mapEntries.push(` '${name}': ${varName}`);\n });\n\n return {\n name: 'xyd:virtual-theme-presets',\n\n resolveId(id) {\n return id === VIRTUAL_ID ? RESOLVED_ID : null;\n },\n\n load(id) {\n if (id !== RESOLVED_ID) return null;\n\n return `\n${importStmts.join('\\n')}\n\nexport const presetUrls = {\n${mapEntries.join(',\\n')}\n};\n`;\n },\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, {\n svg: string\n }>> {\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, {\n svg: string\n }>, 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, {\n svg: string\n }>> {\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 getXydFolderPath() {\n return path.join(\n process.cwd(),\n XYD_FOLDER_PATH\n );\n}\n\nexport function getCLIRoot(): string {\n const cliPath = realpathSync(process.argv[1]);\n\n return path.dirname(path.dirname(cliPath));\n}\n\nexport function getCLIComponentsJsonPath(): string {\n return path.join(getCLIRoot(), 'cliComponents.json');\n}\n\nexport function componentExists(component: string): boolean {\n const cliComponentsJson = getCLIComponentsJsonPath();\n\n try {\n const components = JSON.parse(fs.readFileSync(cliComponentsJson, 'utf8'));\n return components[component] === true;\n } catch (error) {\n return false;\n }\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\ninterface LoadedPlugin extends PluginConfig {\n _pluginPkg: string\n}\n\nasync function loadPlugins(\n settings: Settings,\n options?: PluginDocsOptions\n) {\n const resolvedPlugins: LoadedPlugin[] = []\n\n if (settings.plugins?.length && !options?.doNotInstallPluginDependencies) {\n await setupPluginDependencies(settings, true)\n }\n\n const pluginSettingsFreeze = deepCloneAndFreeze(settings)\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(pluginSettingsFreeze)\n\n resolvedPlugins.push({\n ...plug,\n _pluginPkg: pluginName,\n })\n\n continue\n }\n\n resolvedPlugins.push({\n ...pluginInstance,\n _pluginPkg: pluginName,\n });\n }\n\n return resolvedPlugins\n}\n\nfunction deepCloneAndFreeze(obj) {\n if (obj === null || typeof obj !== 'object') return obj;\n\n const clone = Array.isArray(obj) ? [] : {};\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n clone[key] = deepCloneAndFreeze(obj[key]);\n }\n }\n\n return Object.freeze(clone);\n}\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 if (integrations?.[\".apps\"]?.supademo) {\n plugins.push([\"@xyd-js/plugin-supademo\", integrations[\".apps\"].supademo])\n }\n\n if (integrations?.support?.chatwoot) {\n plugins.push([\n \"@xyd-js/plugin-chatwoot\",\n integrations.support.chatwoot\n ])\n }\n\n if (integrations?.support?.intercom) {\n plugins.push([\n \"@xyd-js/plugin-intercom\",\n integrations.support.intercom\n ])\n }\n\n if (integrations?.support?.livechat) {\n plugins.push([\n \"@xyd-js/plugin-livechat\",\n integrations.support.livechat\n ])\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\", \"cliComponents.json\"];\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 const packageJson = await hostPackageJson()\n\n const integrationDeps = await setupIntegationDependencies(settings)\n const pluginDeps = await setupPluginDependencies(settings)\n\n packageJson.dependencies = {\n ...integrationDeps,\n ...packageJson.dependencies,\n ...pluginDeps,\n }\n\n // TODO: rename to plugins:[\"diagrams\"]\n if (settings.integrations?.diagrams) {\n const componentDeps = componentDependencies(\"diagrams\", true)\n\n if (componentDeps) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n ...componentDeps,\n }\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\n\nasync function hostPackageJson() {\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 let 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\n return packageJson\n}\n\nasync function setupIntegationDependencies(\n settings: Settings,\n) {\n const dependencies = {}\n\n for (const [key, value] of Object.entries(ANALYTICS_INTEGRATION_DEPENDENCIES)) {\n const analytics = settings.integrations?.analytics?.[key]\n if (analytics) {\n for (const [depName, depVersion] of Object.entries(value)) {\n dependencies[depName] = depVersion\n }\n }\n }\n\n return dependencies\n}\n\nasync function setupPluginDependencies(\n settings: Settings,\n install: boolean = false,\n) {\n const spinner = new CLI('dots');\n\n const hostPath = getHostPath()\n\n const 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/\") && (!EXTERNAL_XYD_PLUGINS[pluginName] || process.env.XYD_DEV_MODE === \"2\")) {\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 const xydPluginVersion = EXTERNAL_XYD_PLUGINS[pluginName]\n\n // Search for matching dependencies in host's package.json\n const hostPackageJsonPath = path.join(hostPath, 'package.json')\n\n const cwdPackageJsonPath = path.join(process.cwd(), 'package.json')\n let userDeps = {}\n if (fs.existsSync(cwdPackageJsonPath)) {\n const cwdPackageJson = JSON.parse(fs.readFileSync(cwdPackageJsonPath, 'utf-8'))\n userDeps = cwdPackageJson.dependencies || {}\n }\n\n if (fs.existsSync(hostPackageJsonPath)) {\n const hostPackageJson = JSON.parse(fs.readFileSync(hostPackageJsonPath, 'utf-8'))\n const deps = hostPackageJson.dependencies || {}\n\n const matchingUserDep = Object.entries(userDeps).find(([depName]) => {\n return depName === pluginName\n })\n\n // 1. first find in user deps\n if (matchingUserDep) {\n dependencies[pluginName] = matchingUserDep[1]\n } else {\n const matchingHostDep = Object.entries(deps).find(([depName]) => {\n return depName === pluginName\n })\n\n // 2. if not found in user deps, find in host deps\n if (matchingHostDep) {\n dependencies[pluginName] = matchingHostDep[1]\n }\n // 3. if not found in host deps, use xyd plugin version\n else if (xydPluginVersion) {\n dependencies[pluginName] = xydPluginVersion\n }\n // 4. otherwise use latest version\n else {\n dependencies[pluginName] = \"latest\"\n }\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\n if (install) {\n spinner.startSpinner('Installing plugin dependencies...');\n\n const packageJson = await hostPackageJson()\n const packageJsonPath = path.join(hostPath, 'package.json')\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n\n await nodeInstallPackages(hostPath)\n\n spinner.stopSpinner();\n spinner.log('✔ Plugin dependencies installed successfully');\n }\n\n return dependencies\n}\n\nexport function nodeInstallPackages(hostPath: string) {\n const cmdInstall = pmInstall()\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\n execSync(cmdInstall, execOptions)\n}\n\nexport function pmInstall() {\n if (process.env.XYD_NODE_PM) {\n switch (process.env.XYD_NODE_PM) {\n case 'npm': {\n return npmInstall();\n }\n case 'pnpm': {\n return pnpmInstall();\n }\n case 'bun': {\n return bunInstall();\n }\n default: {\n console.warn(`Unknown package manager: ${process.env.XYD_NODE_PM}, falling back to npm`);\n return npmInstall();\n }\n }\n }\n\n if (hasBun()) {\n return bunInstall()\n }\n\n const { pnpm } = runningPm()\n\n console.log(\"ℹ️ consider install `bun` for better performance \\n\");\n\n if (pnpm) {\n return pnpmInstall()\n }\n\n return npmInstall()\n}\n\nfunction hasBun(): boolean {\n try {\n execSync('bun --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction runningPm() {\n let pnpm = false\n let bun = false\n\n // Detect package manager from npm_execpath\n if (process.env.npm_execpath) {\n if (process.env.npm_execpath.includes('pnpm')) {\n pnpm = true\n } else if (process.env.npm_execpath.includes('bun')) {\n bun = true\n }\n }\n\n if (process.env.NODE_PATH) {\n const nodePath = process.env.NODE_PATH\n\n if (nodePath.includes('.pnpm')) {\n pnpm = true\n } else if (nodePath.includes('.bun')) {\n bun = true\n }\n }\n\n if (\n process.execPath.includes('bun') ||\n path.dirname(process.argv?.[1] || \"\").includes('bun')\n ) {\n bun = true\n }\n\n return {\n pnpm,\n bun\n }\n}\n\nfunction pnpmInstall() {\n return 'pnpm install'\n}\n\nfunction bunInstall() {\n return 'bun install'\n}\n\nfunction npmInstall() {\n return 'npm install'\n}\n\nexport async 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\n\n","export const XYD_FOLDER_PATH = \".xyd\"\nexport const HOST_FOLDER_PATH = `${XYD_FOLDER_PATH}/host`\nexport const CACHE_FOLDER_PATH = `${XYD_FOLDER_PATH}/.cache`\nexport const BUILD_FOLDER_PATH = `${XYD_FOLDER_PATH}/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 { execSync } from 'node:child_process';\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport path, { dirname, join } from 'node:path';\nimport colors from 'picocolors';\nimport { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\n\nimport { getCLIRoot, getHostPath, getCLIComponentsJsonPath, nodeInstallPackages } from './utils';\n\ninterface ComponentConfig {\n packages: string[];\n postInstall?: string[];\n xydModules?: string[];\n}\n\n// function resolveModule(dir, spec) {\n// try {\n// const requireFromDir = createRequire(pathToFileURL(dir));\n// const p = requireFromDir.resolve(spec);\n\n// return path.dirname(path.dirname(p)); // /@xyd-js/content/dist/index.js -> /@xyd-js/content\n// } catch {\n// return null;\n// }\n// }\n\nfunction resolveModuleV2(fromDir: string, pkgName: string) {\n const req = createRequire(import.meta.url);\n let entry;\n try {\n // Use Node’s resolver but start searching at fromDir\n entry = req.resolve(pkgName, { paths: [fromDir] });\n } catch {\n return null; // not found from this dir\n }\n\n // Walk up to the package.json that matches pkgName\n let dir = path.dirname(entry);\n while (true) {\n const pj = path.join(dir, 'package.json');\n if (existsSync(pj)) {\n try {\n const json = JSON.parse(readFileSync(pj, 'utf8'));\n if (json && json.name === pkgName) return dir;\n } catch { }\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nconst xydContentPath = resolveModuleV2(getCLIRoot(), '@xyd-js/content');\nconst COMPONENTS: Record<string, ComponentConfig> = {\n diagrams: {\n packages: ['rehype-mermaid@^3.0.0', 'playwright@^1.54.2'],\n postInstall: ['npx playwright install --with-deps chromium'],\n xydModules: [\n xydContentPath || \"\",\n ]\n }\n};\n\nexport async function componentsInstall(\n component: string,\n host?: boolean\n) {\n const config = resolveComponent(component, host)\n if (!config) {\n return false\n }\n\n await installComponent(config, component);\n\n if (!host) {\n saveComponent(component)\n }\n\n return true\n}\n\nfunction saveComponent(component: string) {\n const cliComponentsJson = getCLIComponentsJsonPath();\n\n // Check if components.json exists and if diagrams is already enabled\n let shouldWriteJson = true;\n try {\n const existingComponents = JSON.parse(readFileSync(cliComponentsJson, 'utf8'));\n if (existingComponents.diagrams === true) {\n shouldWriteJson = false;\n }\n } catch (error) {\n // File doesn't exist or is invalid JSON, so we should write it\n shouldWriteJson = true;\n }\n\n const componentsConfig = { [component]: true };\n writeFileSync(cliComponentsJson, JSON.stringify(componentsConfig, null, 2));\n console.debug(colors.green(`✅ Components configuration written to ${cliComponentsJson}`));\n}\n\nexport function resolveComponent(component: string, host?: boolean): ComponentConfig | false {\n if (!component) {\n console.error(colors.red('Error: Component name is required'));\n console.log(`Usage: xyd components install <component-name>`);\n console.log(`Available components: ${Object.keys(COMPONENTS).join(', ')}`);\n return false\n }\n\n if (!COMPONENTS[component]) {\n console.error(colors.red(`Error: Unknown component '${component}'`));\n console.log(`Available components: ${Object.keys(COMPONENTS).join(', ')}`);\n return false\n }\n\n\n const config = COMPONENTS[component];\n\n if (host) {\n config.xydModules = [\n path.resolve(getHostPath(), 'node_modules/@xyd-js/content'),\n getHostPath()\n ]\n }\n\n return config\n}\n\nexport function componentDependencies(config: ComponentConfig | string, host?: boolean) {\n const deps = {}\n\n if (typeof config === 'string') {\n const resolvedConfig = resolveComponent(config, host)\n\n if (!resolvedConfig) {\n return false\n }\n\n config = resolvedConfig\n }\n\n for (const pkg of config.packages) {\n const [pkgName, version] = pkg.includes('@') && !pkg.startsWith('@') ? pkg.split('@') : [pkg, 'latest'];\n deps[pkgName] = version;\n }\n\n return deps\n}\n\nasync function installComponent(\n config: ComponentConfig,\n componentName: string\n) {\n function install(\n pathname: string\n ) {\n if (!config) {\n return\n }\n\n console.log(\"\\n\", colors.gray(`Installing ${componentName} component...`));\n\n try {\n // Install packages using the CLI root path\n if (config.packages.length > 0) {\n console.log(colors.gray(`Installing packages: ${config.packages.join(', ')}`));\n\n // Update package.json with new dependencies\n const packageJsonPath = join(pathname, 'package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n const packageJsonOriginal = JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n\n // Add packages to dependencies\n for (const pkg of config.packages) {\n const [pkgName, version] = pkg.includes('@') && !pkg.startsWith('@') ? pkg.split('@') : [pkg, 'latest'];\n packageJson.dependencies = packageJson.dependencies || {};\n packageJson.dependencies[pkgName] = version;\n }\n\n\n writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n // Install packages using documan's nodeInstallPackages\n nodeInstallPackages(pathname);\n\n // TODO: better solution\n if (process.env.XYD_DEV_MODE) {\n writeFileSync(packageJsonPath, JSON.stringify(packageJsonOriginal, null, 2));\n }\n }\n\n // Run post-install commands\n if (config.postInstall) {\n for (const cmd of config.postInstall) {\n console.log(colors.gray(`Running: ${cmd}`));\n execSync(cmd, {\n cwd: pathname,\n stdio: 'inherit',\n encoding: 'utf8'\n });\n }\n }\n\n console.log(colors.green(`✅ ${componentName} component installed successfully!`));\n\n } catch (error) {\n console.error(colors.red(`❌ Failed to install ${componentName} component:`));\n console.error(error);\n process.exit(1);\n }\n }\n\n for (const module of config.xydModules || []) {\n install(module)\n }\n}\n\n","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, Settings, SidebarNavigation, } from \"@xyd-js/core\";\n\nimport { appInit, calculateFolderChecksum, commonPostInstallVitePlugins, 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 \"plugins\": true, // TODO: in the future better\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 // Handle null/undefined settings\n if (!oldSettings || !newSettings) {\n return oldSettings !== newSettings;\n }\n\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 let onUpdateCallback: (settings: Settings) => void = () => { }\n\n const inited = await appInit({\n onUpdate: (callback) => {\n // Store the callback to be called later with settings\n onUpdateCallback = callback\n }\n })\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n\n // TODO: allow only for cwd + .xyd folder\n const allowCwd = searchForWorkspaceRoot(process.cwd())\n const watchAllow = process.cwd()\n\n const appRoot = getAppRoot()\n const commonRunVitePlugins = await 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 const postInstallVitePlugins = commonPostInstallVitePlugins(respPluginDocs, resolvedPlugins)\n\n // ⚠️ \n spinner.log('✔ Local xyd instance is ready');\n spinner.log('🔄 Starting server...');\n\n let server: ViteDevServer | null = null\n\n const port = options?.port ?? parseInt(process.env.XYD_PORT ?? \"5175\")\n\n // Determine conditional externals based on settings\n const enableMermaid = !!respPluginDocs?.settings?.integrations?.diagrams\n const externalPackages = enableMermaid ? [] : [\"rehype-mermaid\"]\n const optimizeDepsExclude = enableMermaid ? [] : [\"rehype-mermaid\"]\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 \"@orama/orama\",\n \"@orama/react-components\",\n // TODO: optimize plugin deps only if loaded \n // \"@pluganalytics/provider-livesession\"\n ];\n } else {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"@xyd-js/theme-cosmo\",\n \"@xyd-js/theme-gusto\",\n \"@xyd-js/theme-opener\",\n \"@xyd-js/theme-picasso\",\n \"@xyd-js/theme-poetry\",\n \"@xyd-js/theme-solar\",\n // TODO: optimize plugin deps only if loaded \n // \"@pluganalytics/provider-livesession\"\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 // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n },\n // preserveSymlinks: true\n },\n build: {\n rollupOptions: {\n external: externalPackages\n },\n },\n ssr: {\n external: externalPackages,\n },\n optimizeDeps: {\n include: [\n \"react/jsx-runtime\",\n ...USE_CONTEXT_ISSUE_PACKAGES,\n ],\n exclude: optimizeDepsExclude,\n // exclude: [\"react\", \"react-dom\"]\n },\n plugins: [\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\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(watchAllow, { recursive: true }, async (eventType, filename) => {\n // console.log(\"WATCHER CHANGED\", RELOADING)\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(watchAllow, filename);\n if (filePath.includes(CACHE_FOLDER_PATH)) {\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\n let iconPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings) {\n iconPaths = resolveIconFilePaths(process.cwd(), respPluginDocs.settings)\n }\n\n let syntaxHighlightPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings) {\n syntaxHighlightPaths = resolveSyntaxHighlightFilePaths(process.cwd(), respPluginDocs.settings)\n }\n\n const apiChanged = !!apiPaths[filePath]\n const iconChanged = !!iconPaths[filePath]\n const syntaxHighlightChanged = !!syntaxHighlightPaths[filePath]\n\n const isSettingsFile = SUPPORTED_SETTINGS_FILES.some(ext => filePath.endsWith(ext))\n const isContentFile = SUPPORTED_CONTENT_FILES.some(ext => filePath.endsWith(ext))\n const isPublicPathReload = filePath.includes(getPublicPath())\n const isEnvFile = isEnvFilePath(filePath)\n const isWatchFile = isSettingsFile ||\n isContentFile ||\n apiChanged ||\n iconChanged ||\n syntaxHighlightChanged ||\n isPublicPathReload ||\n isEnvFile\n\n if (!isWatchFile) {\n return\n }\n\n const renameContentFile = isContentFile && eventType === 'rename'\n\n if (isContentFile && !renameContentFile) {\n console.log('🔄 Content file changed, refresh...');\n\n // invalidateSettingsOnly(server) // if invalidate settings will be needed then + with composer? cuz issues with this\n\n invalidateSettings(server)\n await touchLayoutPage()\n // await touchRootPage()\n\n // server.ws.send({ type: 'full-reload' });\n // invalidateSettings(server) // TODO: check if needed but some issues with this\n\n // setTimeout(() => {\n // server && invalidateSettings(server)\n // }, 1000)\n // await touchPage()\n\n console.log('✔ xyd content file changed\\n');\n\n return\n }\n\n const isReloadFile = isSettingsFile ||\n renameContentFile ||\n isPublicPathReload ||\n iconChanged ||\n apiChanged ||\n syntaxHighlightChanged ||\n isEnvFile\n\n if (isReloadFile) {\n if (renameContentFile) {\n console.log('🔄 Content file renamed, refresh...');\n } else if (isPublicPathReload) {\n console.log('🔄 Public path changed, refresh...');\n } else if (iconChanged) {\n console.log('🔄 Icon file changed, refresh...');\n invalidateIconSet(server)\n } else if (syntaxHighlightChanged) {\n console.log('🔄 Syntax highlight theme file changed, refresh...');\n } else if (apiChanged) {\n console.log('🔄 API file changed, refresh...');\n } else if (syntaxHighlightChanged) {\n console.log('🔄 Syntax highlight theme file changed, refresh...');\n } else if (isEnvFile) {\n console.log('🔄 Environment file changed, refresh...');\n // Environment variables affect settings processing, so we need a full reload\n await reloadServer(watcher, preview, options);\n return;\n } else {\n console.log('🔄 Settings file changed, refresh...');\n }\n\n let newSettings: Settings | null = null\n // TODO: better way to handle that - we need this cuz otherwise its inifiite reloads\n if (respPluginDocs?.settings.engine?.uniform?.store) {\n const resp = await appInit({\n disableFSWrite: true,\n doNotInstallPluginDependencies: true\n })\n\n const respSettings = resp?.respPluginDocs?.settings\n if (respSettings) {\n newSettings = respSettings\n }\n } else {\n const resp = await appInit({\n doNotInstallPluginDependencies: true\n }) // TODO: !!! IN THE FUTURE MORE EFFICIENT WAY !!!\n\n const respSettings = resp?.respPluginDocs?.settings\n if (respSettings) {\n newSettings = respSettings\n }\n }\n if (!newSettings) {\n console.log(\"[xyd:dev-watcher] Settings is not an object or is null\");\n return\n }\n\n {\n const needsFullReload = hasFullReloadPropertiesChanged(initialSettings, newSettings);\n\n if (needsFullReload) {\n console.log('🔄 Full reload properties changed, restarting server...');\n await reloadServer(watcher, preview, options);\n return;\n }\n }\n\n {\n invalidateSettings(server)\n onUpdateCallback(newSettings)\n await touchReactRouterConfig()\n await touchRootPage()\n await touchLayoutPage()\n // await touchPage()\n server.ws.send({ type: 'full-reload' });\n // TODO: in the future better solution\n }\n\n // Re-read settings to get the updated values\n // const newSettings = await readSettings();\n // if (typeof newSettings !== 'object' || newSettings === null) {\n // console.log(\"[xyd:dev-watcher] Settings is not an object or is null\");\n // return\n // }\n\n // Check if any full reload properties have changed\n // const needsFullReload = hasFullReloadPropertiesChanged(initialSettings, newSettings);\n\n // if (needsFullReload) {\n // console.log('🔄 Full reload properties changed, restarting server...');\n // RELOADING = true;\n\n // // Close the current server\n // watcher.close();\n // await preview.close();\n // RELOADING = false;\n\n // // Restart the dev server\n // await dev(options);\n // return;\n // }\n\n // Update the initial settings for next comparison\n // initialSettings = newSettings;\n\n // invalidateSettings(server)\n // await touchReactRouterConfig()\n // await touchLayoutPage()\n // await touchRootPage()\n\n // // Send full reload to ensure all components update\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 await optimizeDepsFix(port, respPluginDocs.settings.navigation)\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\nasync function reloadServer(\n watcher: fs.FSWatcher,\n preview: ViteDevServer,\n options?: DevOptions\n) {\n RELOADING = true;\n watcher.close();\n await preview.close();\n RELOADING = false;\n await dev(options);\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 * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks theme.icons.library, \n * resolves all referenced local files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveIconFilePaths(\n basePath: string,\n settings: any\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const icons = settings?.theme?.icons?.library\n if (!icons) {\n return result\n }\n\n // Helper function to check if a path is a local file path\n const isLocalPath = (path: string): boolean => {\n // Must start with ./ or / to be a local file path\n return path.startsWith('./') || path.startsWith('/')\n }\n\n // Handle single icon library\n if (typeof icons === 'string') {\n if (isLocalPath(icons)) {\n const iconAbsPath = path.resolve(basePath, icons)\n result[iconAbsPath] = true\n }\n return result\n }\n\n // Handle array of icon libraries\n if (Array.isArray(icons)) {\n icons.forEach(library => {\n if (typeof library === 'string') {\n if (isLocalPath(library)) {\n const iconAbsPath = path.resolve(basePath, library)\n result[iconAbsPath] = true\n }\n } else if (typeof library === 'object' && library.name) {\n if (isLocalPath(library.name)) {\n const iconAbsPath = path.resolve(basePath, library.name)\n result[iconAbsPath] = true\n }\n }\n })\n } else if (typeof icons === 'object' && icons.name) {\n // Handle single icon library object\n if (isLocalPath(icons.name)) {\n const iconAbsPath = path.resolve(basePath, icons.name)\n result[iconAbsPath] = true\n }\n }\n\n return result\n}\n\n/**\n * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks theme.coder.syntaxHighlight, \n * resolves all referenced local files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveSyntaxHighlightFilePaths(\n basePath: string,\n settings: any\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const syntaxHighlight = settings?.theme?.coder?.syntaxHighlight\n if (!syntaxHighlight) {\n return result\n }\n\n // Helper function to check if a path is a local file path\n const isLocalPath = (path: string): boolean => {\n // Must start with ./ or / to be a local file path\n return path.startsWith('./') || path.startsWith('/')\n }\n\n // Handle single syntax highlight theme\n if (typeof syntaxHighlight === 'string') {\n if (isLocalPath(syntaxHighlight)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, syntaxHighlight)\n result[syntaxHighlightAbsPath] = true\n }\n return result\n }\n\n // Handle array of syntax highlight themes\n if (Array.isArray(syntaxHighlight)) {\n syntaxHighlight.forEach(theme => {\n if (typeof theme === 'string') {\n if (isLocalPath(theme)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, theme)\n result[syntaxHighlightAbsPath] = true\n }\n } else if (typeof theme === 'object' && theme.name) {\n if (isLocalPath(theme.name)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, theme.name)\n result[syntaxHighlightAbsPath] = true\n }\n }\n })\n } else if (typeof syntaxHighlight === 'object' && syntaxHighlight.name) {\n // Handle single syntax highlight theme object\n if (isLocalPath(syntaxHighlight.name)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, syntaxHighlight.name)\n result[syntaxHighlightAbsPath] = 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 * Checks if a file path is an environment file\n */\nfunction isEnvFilePath(filePath: string): boolean {\n return filePath.endsWith('.env') ||\n filePath.endsWith('.env.local') ||\n filePath.endsWith('.env.development') ||\n filePath.endsWith('.env.production');\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 resolvedId = invalidateSettingsOnly(server)\n\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 console.debug('✅ [xyd:dev-watcher] Settings module invalidated and HMR update sent');\n}\n\nfunction invalidateSettingsOnly(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 // console.debug('🔄 [xyd:dev-watcher] Invalidating settings module...');\n server.moduleGraph.invalidateModule(mod);\n\n return resolvedId\n}\n\nfunction invalidateIconSet(server: ViteDevServer) {\n const virtualId = 'virtual:xyd-icon-set';\n const mod = server.moduleGraph.getModuleById(virtualId);\n\n // console.log(\"[xyd:dev-watcher] Looking for icon set module:\", virtualId);\n // console.log(\"[xyd:dev-watcher] Module found:\", !!mod);\n\n if (!mod) {\n console.log(\"[xyd:dev-watcher] Icon set module not found\");\n return\n }\n\n console.debug('🔄 [xyd:dev-watcher] Invalidating icon set module...');\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({\n type: 'update',\n updates: [\n {\n type: 'js-update',\n path: `/@id/${virtualId}`,\n acceptedPath: `/@id/${virtualId}`,\n timestamp: Date.now(),\n },\n ],\n });\n console.debug('✅ [xyd:dev-watcher] Icon set module invalidated and HMR update sent');\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 touchPage() {\n const docsPluginBasePath = getDocsPluginBasePath()\n const pagePath = path.join(docsPluginBasePath, \"./src/pages/page.tsx\")\n await fs.promises.utimes(pagePath, new Date(), new Date());\n}\n\nasync function touchRootPage() {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"./app/root.tsx\")\n await fs.promises.utimes(hostReactRouterConfig, 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// 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 let firstPage: null | string = \"\"\n if (navigation) {\n firstPage = getFirstPageFromNavigation(navigation);\n }\n await fetchFirstPage(firstPage || \"\", port);\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;AAAA;AAAA,QAAI,IAAI,WAAW,CAAC;AAApB,QAAuB,OAAO,EAAE,QAAQ,CAAC;AAAzC,QAA4C,MAAM,EAAE,OAAO,CAAC;AAC5D,QAAI,mBACH,EAAE,CAAC,CAAC,IAAI,YAAY,KAAK,SAAS,YAAY,OAC7C,CAAC,CAAC,IAAI,eAAe,KAAK,SAAS,SAAS,KAAK,EAAE,aAAa,YAAa,EAAE,UAAU,CAAC,GAAG,SAAS,IAAI,SAAS,UAAW,CAAC,CAAC,IAAI;AAEtI,QAAI,YAAY,CAAC,MAAM,OAAO,UAAU,SACvC,WAAS;AACR,UAAI,SAAS,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,KAAK,MAAM;AAClE,aAAO,CAAC,QAAQ,OAAO,aAAa,QAAQ,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO,SAAS;AAAA,IAC9F;AAED,QAAI,eAAe,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrD,UAAI,SAAS,IAAI,SAAS;AAC1B,SAAG;AACF,kBAAU,OAAO,UAAU,QAAQ,KAAK,IAAI;AAC5C,iBAAS,QAAQ,MAAM;AACvB,gBAAQ,OAAO,QAAQ,OAAO,MAAM;AAAA,MACrC,SAAS,CAAC;AACV,aAAO,SAAS,OAAO,UAAU,MAAM;AAAA,IACxC;AAEA,QAAI,eAAe,CAAC,UAAU,qBAAqB;AAClD,UAAI,IAAI,UAAU,YAAY,MAAM;AACpC,aAAO;AAAA,QACN,kBAAkB;AAAA,QAClB,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AwBA,MAAK,KAAK,UAAU,wBAAwB;AAC1E,QAAME,IAAG,SAAS,OAAO,uBAAuB,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC1E;AAEA,eAAe,kBAAkB;AAC7B,QAAM,qBAAqB,sBAAsB;AACjD,QAAM,aAAaF,MAAK,KAAK,oBAAoB,wBAAwB;AACzE,QAAME,IAAG,SAAS,OAAO,YAAY,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC/D;AAQA,eAAe,gBAAgB;AAC3B,QAAM,WAAW,YAAY;AAC7B,QAAM,wBAAwBC,MAAK,KAAK,UAAU,gBAAgB;AAClE,QAAMC,IAAG,SAAS,OAAO,uBAAuB,oBAAI,KAAK,GAAG,oBAAI,KAAK,CAAC;AAC1E;AAmDA,eAAe,gBAAgB,MAAc,YAAyB;AAIlE,MAAI,YAA2B;AAC/B,MAAI,YAAY;AACZ,gBAAY,2BAA2B,UAAU;AAAA,EACrD;AACA,QAAM,eAAe,aAAa,IAAI,IAAI;AAC9C;;;ACj2BA,OAAOC,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","path","execSync","colors","install","path","__filename","__dirname","install","hostPackageJson","execSync","path","fs","path","fs","createServer","path","createServer","fs","path","fs","fs","readSettings","fs"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js","../src/build.ts","../src/utils.ts","../../xyd-plugin-supademo/package.json","../../xyd-plugin-chatwoot/package.json","../../xyd-plugin-intercom/package.json","../../xyd-plugin-livechat/package.json","../src/const.ts","../src/cli.ts","../src/componentsInstall.ts","../src/dev.ts","../src/install.ts"],"sourcesContent":["let p = process || {}, argv = p.argv || [], env = p.env || {}\nlet isColorSupported =\n\t!(!!env.NO_COLOR || argv.includes(\"--no-color\")) &&\n\t(!!env.FORCE_COLOR || argv.includes(\"--color\") || p.platform === \"win32\" || ((p.stdout || {}).isTTY && env.TERM !== \"dumb\") || !!env.CI)\n\nlet formatter = (open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input, index = string.indexOf(close, open.length)\n\t\treturn ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\", cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet f = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: f(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: f(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: f(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: f(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: f(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: f(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: f(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: f(\"\\x1b[9m\", \"\\x1b[29m\"),\n\n\t\tblack: f(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: f(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: f(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: f(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: f(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: f(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: f(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: f(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\n\t\tbgBlack: f(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: f(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: f(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: f(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: f(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: f(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: f(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: f(\"\\x1b[47m\", \"\\x1b[49m\"),\n\n\t\tblackBright: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tredBright: f(\"\\x1b[91m\", \"\\x1b[39m\"),\n\t\tgreenBright: f(\"\\x1b[92m\", \"\\x1b[39m\"),\n\t\tyellowBright: f(\"\\x1b[93m\", \"\\x1b[39m\"),\n\t\tblueBright: f(\"\\x1b[94m\", \"\\x1b[39m\"),\n\t\tmagentaBright: f(\"\\x1b[95m\", \"\\x1b[39m\"),\n\t\tcyanBright: f(\"\\x1b[96m\", \"\\x1b[39m\"),\n\t\twhiteBright: f(\"\\x1b[97m\", \"\\x1b[39m\"),\n\n\t\tbgBlackBright: f(\"\\x1b[100m\", \"\\x1b[49m\"),\n\t\tbgRedBright: f(\"\\x1b[101m\", \"\\x1b[49m\"),\n\t\tbgGreenBright: f(\"\\x1b[102m\", \"\\x1b[49m\"),\n\t\tbgYellowBright: f(\"\\x1b[103m\", \"\\x1b[49m\"),\n\t\tbgBlueBright: f(\"\\x1b[104m\", \"\\x1b[49m\"),\n\t\tbgMagentaBright: f(\"\\x1b[105m\", \"\\x1b[49m\"),\n\t\tbgCyanBright: f(\"\\x1b[106m\", \"\\x1b[49m\"),\n\t\tbgWhiteBright: f(\"\\x1b[107m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","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 {\n appInit,\n calculateFolderChecksum,\n commonPostInstallVitePlugins,\n commonVitePlugins,\n getAppRoot,\n getBuildPath,\n getHostPath,\n getXydFolderPath,\n postWorkspaceSetup,\n preWorkspaceSetup,\n storeChecksum\n} 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 = await 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 const postInstallVitePlugins = commonPostInstallVitePlugins(respPluginDocs, resolvedPlugins)\n \n {\n await setupInstallableEnvironmentV2()\n }\n\n // Determine conditional externals based on settings\n const enableMermaid = !!respPluginDocs?.settings?.integrations?.diagrams\n const externalPackages = enableMermaid ? [] : [\"rehype-mermaid\"]\n\n try {\n // Build the client-side bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n plugins: [\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\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 // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n }\n },\n build: {\n rollupOptions: {\n external: externalPackages,\n },\n },\n ssr: {\n external: externalPackages,\n },\n // ssr: {\n // noExternal: [\"react\", \"react-dom\", \"react-router\"]\n // }\n });\n\n // Build the SSR bundle\n await viteBuild({\n mode: \"production\",\n root: appRoot,\n build: {\n ssr: true,\n rollupOptions: {\n external: externalPackages,\n },\n // rollupOptions: {\n // external: [\"@xyd-js/framework/hydration\", \"fs\"]\n // }\n },\n plugins: [\n fixManifestPlugin(appRoot),\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\n\n tsconfigPaths(),\n ],\n optimizeDeps: {\n include: [\"react/jsx-runtime\"],\n // include: [\"react\", \"react-dom\", \"react/jsx-runtime\", \"react-router\"],\n // force: true\n },\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n 'process.env': {}\n },\n resolve: {\n alias: {\n process: 'process/browser',\n // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n // react: path.resolve(workspaceNodeModulesPath, \"react\"),\n // \"react-dom\": path.resolve(workspaceNodeModulesPath, \"react-dom\")\n }\n },\n ssr: {\n external: externalPackages,\n },\n // ssr: {\n // noExternal: [\"react\", \"react-dom\", \"react-router\"]\n // }\n });\n } catch (error) {\n console.error('Build failed:', error); // TODO: better message\n }\n}\n\nfunction setupInstallableEnvironmentV2() {\n const symbolicXydNodeModules = path.join(getXydFolderPath(), \"node_modules\")\n const hostNodeModules = path.join(getHostPath(), \"node_modules\")\n\n if (fs.existsSync(symbolicXydNodeModules)) {\n if (fs.lstatSync(symbolicXydNodeModules).isSymbolicLink()) {\n fs.unlinkSync(symbolicXydNodeModules);\n } else {\n fs.rmSync(symbolicXydNodeModules, { recursive: true, force: true });\n }\n }\n fs.symlinkSync(hostNodeModules, symbolicXydNodeModules, 'dir');\n\n // const buildDir = getBuildPath();\n // const packageJsonPath = path.join(buildDir, 'package.json');\n\n // const packageJsonContent = {\n // type: \"module\",\n // scripts: {},\n // dependencies: {},\n // devDependencies: {}\n // };\n\n // if (!fs.existsSync(buildDir)) {\n // fs.mkdirSync(buildDir, {recursive: true});\n // }\n\n // fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), 'utf8');\n\n // const buildNodeModulesPath = path.join(buildDir, 'node_modules');\n // const dirname = path.dirname(fileURLToPath(import.meta.url));\n\n // let workspaceNodeModulesPath = '';\n // if (process.env.XYD_DEV_MODE) {\n // workspaceNodeModulesPath = path.resolve(dirname, '../../../node_modules');\n // } else {\n // // TODO: check if works for npm\n // workspaceNodeModulesPath = getXydFolderPath()\n // }\n\n // console.log(\"workspaceNodeModulesPath\", workspaceNodeModulesPath);\n\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 // fs.symlinkSync(workspaceNodeModulesPath, buildNodeModulesPath, 'dir');\n\n // return workspaceNodeModulesPath;\n}\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 // getAppRoot(),\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, { dirname } 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\";\nimport { realpathSync } from 'node:fs';\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 { HeadConfig, Integrations, Plugins, Settings } from \"@xyd-js/core\";\nimport type { IconLibrary, WebEditorNavigationItem } from \"@xyd-js/core\";\nimport type { Plugin, PluginConfig } from \"@xyd-js/plugins\";\nimport { type UniformPlugin } from \"@xyd-js/uniform\";\n\nimport pluginDemoVersion from \"../../xyd-plugin-supademo/package.json\";\nimport pluginChatwootVersion from \"../../xyd-plugin-chatwoot/package.json\";\nimport pluginIntercomVersion from \"../../xyd-plugin-intercom/package.json\";\nimport pluginLivechatVersion from \"../../xyd-plugin-livechat/package.json\";\n\nimport { BUILD_FOLDER_PATH, CACHE_FOLDER_PATH, HOST_FOLDER_PATH, XYD_FOLDER_PATH } from \"./const\";\nimport { CLI } from './cli';\nimport { componentDependencies, componentsInstall } from \"./componentsInstall\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst ANALYTICS_INTEGRATION_DEPENDENCIES = {\n livesession: {\n \"@pluganalytics/provider-livesession\": \"0.0.0-pre.7\"\n }\n}\n\nconst EXTERNAL_XYD_PLUGINS = {\n \"@xyd-js/plugin-supademo\": pluginDemoVersion.version,\n \"@xyd-js/plugin-chatwoot\": pluginChatwootVersion.version,\n \"@xyd-js/plugin-intercom\": pluginIntercomVersion.version,\n \"@xyd-js/plugin-livechat\": pluginLivechatVersion.version\n}\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: Settings = 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: LoadedPlugin[] = []\n {\n resolvedPlugins = await loadPlugins(preloadSettings, options) || []\n const userUniformVitePlugins: UniformPlugin<any>[] = []\n const componentPlugins: any[] = [] // TODO: fix any\n\n resolvedPlugins?.forEach((p: LoadedPlugin) => {\n if (p.uniform) {\n userUniformVitePlugins.push(...p.uniform)\n }\n if (p.components) {\n const components: any[] = []\n\n if (!Array.isArray(p.components) && typeof p.components === \"object\") {\n const mapComponents: any[] = []\n\n Object.keys(p.components).forEach((key) => {\n if (!p?.components?.[key]) {\n return\n }\n\n const component = p.components[key]\n\n mapComponents.push({\n component,\n name: key,\n })\n })\n\n p.components = mapComponents\n }\n\n if (Array.isArray(p.components)) {\n for (const component of p.components) {\n if (!component.component) {\n console.error(\"No component function\")\n continue\n }\n\n if (!component.name) {\n component.name = component.component.name\n }\n\n if (!component.dist) {\n component.dist = p._pluginPkg + \"/\" + component.name\n continue\n }\n\n if (!component.name) {\n console.error(\"No component name\")\n continue\n }\n }\n\n components.push(...p.components)\n }\n\n componentPlugins.push(...components)\n }\n\n const head = p.head\n if (head?.length && preloadSettings?.theme?.head) {\n preloadSettings.theme.head.push(\n ...head\n )\n }\n })\n\n globalThis.__xydUserUniformVitePlugins = userUniformVitePlugins\n globalThis.__xydUserComponents = componentPlugins\n }\n\n const respPluginDocs = await pluginDocs({\n ...options,\n appInit,\n })\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 if (respPluginDocs.settings?.theme) {\n respPluginDocs.settings.theme.head = [\n ...(respPluginDocs.settings?.theme?.head || []),\n ...(preloadSettings.theme?.head || []),\n ]\n }\n\n globalThis.__xydBasePath = respPluginDocs.basePath\n globalThis.__xydSettings = respPluginDocs.settings\n globalThis.__xydPagePathMapping = respPluginDocs.pagePathMapping\n globalThis.__xydHasIndexPage = respPluginDocs.hasIndexPage\n globalThis.__xydSettingsClone = JSON.parse(JSON.stringify(respPluginDocs.settings)) // TODO: finish\n\n // appearanceWebEditor(respPluginDocs.settings)\n\n if (respPluginDocs.settings.integrations?.diagrams) {\n if (!componentExists(\"diagrams\")) {\n await componentsInstall(\"diagrams\")\n }\n }\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]?.component) {\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 async function commonVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n const userVitePlugins = resolvedPlugins.map(p => p.vite).flat() || []\n\n return [\n ...(await xydContentVitePlugins({\n toc: {\n maxDepth: respPluginDocs.settings.theme?.writer?.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 commonPostInstallVitePlugins(\n respPluginDocs: PluginOutput,\n resolvedPlugins: PluginConfig[],\n) {\n\n return [\n vitePluginThemePresets(respPluginDocs.settings),\n ]\n}\n\n\nexport async function vitePluginThemePresets(settings: Settings) {\n const themeName = settings.theme?.name\n const VIRTUAL_ID = 'virtual:xyd-theme-presets';\n const RESOLVED_ID = '\\0' + VIRTUAL_ID;\n\n // Resolve theme folder using Node APIs\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n let themeRoot = \"\"\n if (process.env.XYD_CLI) {\n themeRoot = path.join(getHostPath(), `node_modules/@xyd-js/theme-${themeName}/dist`)\n } else {\n themeRoot = path.join(path.resolve(__dirname, \"../../\"), `xyd-theme-${themeName}/dist`)\n }\n\n const presetsDir = path.join(themeRoot, 'presets');\n\n // Read available CSS files\n let cssFiles: string[] = [];\n try {\n const files = fs.readdirSync(presetsDir);\n cssFiles = files.filter((f) => f.endsWith('.css'));\n } catch (err) {\n }\n\n // Build import statements and map entries\n const importStmts: string[] = [];\n const mapEntries: string[] = [];\n\n cssFiles.forEach((file, index) => {\n const name = file.replace(/\\.css$/, '');\n const varName = `preset${index}`;\n const pkgPath = `@xyd-js/theme-${themeName}/presets/${file}`;\n\n importStmts.push(`import ${varName} from '${pkgPath}?url';`);\n mapEntries.push(` '${name}': ${varName}`);\n });\n\n return {\n name: 'xyd:virtual-theme-presets',\n\n resolveId(id) {\n return id === VIRTUAL_ID ? RESOLVED_ID : null;\n },\n\n load(id) {\n if (id !== RESOLVED_ID) return null;\n\n return `\n${importStmts.join('\\n')}\n\nexport const presetUrls = {\n${mapEntries.join(',\\n')}\n};\n`;\n },\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, {\n svg: string\n }>> {\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, {\n svg: string\n }>, 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, {\n svg: string\n }>> {\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 getXydFolderPath() {\n return path.join(\n process.cwd(),\n XYD_FOLDER_PATH\n );\n}\n\nexport function getCLIRoot(): string {\n const cliPath = realpathSync(process.argv[1]);\n\n return path.dirname(path.dirname(cliPath));\n}\n\nexport function getCLIComponentsJsonPath(): string {\n return path.join(getCLIRoot(), 'cliComponents.json');\n}\n\nexport function componentExists(component: string): boolean {\n const cliComponentsJson = getCLIComponentsJsonPath();\n\n try {\n const components = JSON.parse(fs.readFileSync(cliComponentsJson, 'utf8'));\n return components[component] === true;\n } catch (error) {\n return false;\n }\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\ninterface LoadedPlugin extends PluginConfig {\n _pluginPkg: string\n}\n\nasync function loadPlugins(\n settings: Settings,\n options?: PluginDocsOptions\n) {\n const resolvedPlugins: LoadedPlugin[] = []\n\n if (settings.plugins?.length && !options?.doNotInstallPluginDependencies) {\n await setupPluginDependencies(settings, true)\n }\n\n const pluginSettingsFreeze = deepCloneAndFreeze(settings)\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(pluginSettingsFreeze)\n\n resolvedPlugins.push({\n ...plug,\n _pluginPkg: pluginName,\n })\n\n continue\n }\n\n resolvedPlugins.push({\n ...pluginInstance,\n _pluginPkg: pluginName,\n });\n }\n\n return resolvedPlugins\n}\n\nfunction deepCloneAndFreeze(obj) {\n if (obj === null || typeof obj !== 'object') return obj;\n\n const clone = Array.isArray(obj) ? [] : {};\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key)) {\n clone[key] = deepCloneAndFreeze(obj[key]);\n }\n }\n\n return Object.freeze(clone);\n}\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 if (integrations?.[\".apps\"]?.supademo) {\n plugins.push([\"@xyd-js/plugin-supademo\", integrations[\".apps\"].supademo])\n }\n\n if (integrations?.support?.chatwoot) {\n plugins.push([\n \"@xyd-js/plugin-chatwoot\",\n integrations.support.chatwoot\n ])\n }\n\n if (integrations?.support?.intercom) {\n plugins.push([\n \"@xyd-js/plugin-intercom\",\n integrations.support.intercom\n ])\n }\n\n if (integrations?.support?.livechat) {\n plugins.push([\n \"@xyd-js/plugin-livechat\",\n integrations.support.livechat\n ])\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\", \"cliComponents.json\"];\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 const packageJson = await hostPackageJson()\n\n const integrationDeps = await setupIntegationDependencies(settings)\n const pluginDeps = await setupPluginDependencies(settings)\n\n packageJson.dependencies = {\n ...integrationDeps,\n ...packageJson.dependencies,\n ...pluginDeps,\n }\n\n // TODO: rename to plugins:[\"diagrams\"]\n if (settings.integrations?.diagrams) {\n const componentDeps = componentDependencies(\"diagrams\", true)\n\n if (componentDeps) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n ...componentDeps,\n }\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\n\nasync function hostPackageJson() {\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 let 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\n return packageJson\n}\n\nasync function setupIntegationDependencies(\n settings: Settings,\n) {\n const dependencies = {}\n\n for (const [key, value] of Object.entries(ANALYTICS_INTEGRATION_DEPENDENCIES)) {\n const analytics = settings.integrations?.analytics?.[key]\n if (analytics) {\n for (const [depName, depVersion] of Object.entries(value)) {\n dependencies[depName] = depVersion\n }\n }\n }\n\n return dependencies\n}\n\nasync function setupPluginDependencies(\n settings: Settings,\n install: boolean = false,\n) {\n const spinner = new CLI('dots');\n\n const hostPath = getHostPath()\n\n const 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/\") && (!EXTERNAL_XYD_PLUGINS[pluginName] || process.env.XYD_DEV_MODE === \"2\")) {\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 const xydPluginVersion = EXTERNAL_XYD_PLUGINS[pluginName]\n\n // Search for matching dependencies in host's package.json\n const hostPackageJsonPath = path.join(hostPath, 'package.json')\n\n const cwdPackageJsonPath = path.join(process.cwd(), 'package.json')\n let userDeps = {}\n if (fs.existsSync(cwdPackageJsonPath)) {\n const cwdPackageJson = JSON.parse(fs.readFileSync(cwdPackageJsonPath, 'utf-8'))\n userDeps = cwdPackageJson.dependencies || {}\n }\n\n if (fs.existsSync(hostPackageJsonPath)) {\n const hostPackageJson = JSON.parse(fs.readFileSync(hostPackageJsonPath, 'utf-8'))\n const deps = hostPackageJson.dependencies || {}\n\n const matchingUserDep = Object.entries(userDeps).find(([depName]) => {\n return depName === pluginName\n })\n\n // 1. first find in user deps\n if (matchingUserDep) {\n dependencies[pluginName] = matchingUserDep[1]\n } else {\n const matchingHostDep = Object.entries(deps).find(([depName]) => {\n return depName === pluginName\n })\n\n // 2. if not found in user deps, find in host deps\n if (matchingHostDep) {\n dependencies[pluginName] = matchingHostDep[1]\n }\n // 3. if not found in host deps, use xyd plugin version\n else if (xydPluginVersion) {\n dependencies[pluginName] = xydPluginVersion\n }\n // 4. otherwise use latest version\n else {\n dependencies[pluginName] = \"latest\"\n }\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\n if (install) {\n spinner.startSpinner('Installing plugin dependencies...');\n\n const packageJson = await hostPackageJson()\n const packageJsonPath = path.join(hostPath, 'package.json')\n packageJson.dependencies = {\n ...packageJson.dependencies,\n ...dependencies\n }\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))\n\n await nodeInstallPackages(hostPath)\n\n spinner.stopSpinner();\n spinner.log('✔ Plugin dependencies installed successfully');\n }\n\n return dependencies\n}\n\nexport function nodeInstallPackages(hostPath: string) {\n const cmdInstall = pmInstall()\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\n execSync(cmdInstall, execOptions)\n}\n\nexport function pmInstall() {\n if (process.env.XYD_NODE_PM) {\n switch (process.env.XYD_NODE_PM) {\n case 'npm': {\n return npmInstall();\n }\n case 'pnpm': {\n return pnpmInstall();\n }\n case 'bun': {\n return bunInstall();\n }\n default: {\n console.warn(`Unknown package manager: ${process.env.XYD_NODE_PM}, falling back to npm`);\n return npmInstall();\n }\n }\n }\n\n if (hasBun()) {\n return bunInstall()\n }\n\n const { pnpm } = runningPm()\n\n console.log(\"ℹ️ consider install `bun` for better performance \\n\");\n\n if (pnpm) {\n return pnpmInstall()\n }\n\n return npmInstall()\n}\n\nfunction hasBun(): boolean {\n try {\n execSync('bun --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction runningPm() {\n let pnpm = false\n let bun = false\n\n // Detect package manager from npm_execpath\n if (process.env.npm_execpath) {\n if (process.env.npm_execpath.includes('pnpm')) {\n pnpm = true\n } else if (process.env.npm_execpath.includes('bun')) {\n bun = true\n }\n }\n\n if (process.env.NODE_PATH) {\n const nodePath = process.env.NODE_PATH\n\n if (nodePath.includes('.pnpm')) {\n pnpm = true\n } else if (nodePath.includes('.bun')) {\n bun = true\n }\n }\n\n if (\n process.execPath.includes('bun') ||\n path.dirname(process.argv?.[1] || \"\").includes('bun')\n ) {\n bun = true\n }\n\n return {\n pnpm,\n bun\n }\n}\n\nfunction pnpmInstall() {\n return 'pnpm install'\n}\n\nfunction bunInstall() {\n return 'bun install'\n}\n\nfunction npmInstall() {\n return 'npm install'\n}\n\nexport async 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\n\n","{\n \"name\": \"@xyd-js/plugin-supademo\",\n \"version\": \"0.1.0-build.23\",\n \"author\": \"\",\n \"description\": \"\",\n \"license\": \"MIT\",\n \"main\": \"./dist/index.js\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"import\": \"./dist/index.js\"\n }\n },\n \"scripts\": {\n \"clean\": \"rimraf build\",\n \"prebuild\": \"pnpm clean\",\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {},\n \"peerDependencies\": {},\n \"devDependencies\": {\n \"vite\": \"^7.0.0\",\n \"@vitest/coverage-v8\": \"^1.6.1\",\n \"rimraf\": \"^3.0.2\",\n \"tsup\": \"^8.4.0\",\n \"vitest\": \"^1.6.1\"\n }\n}","{\n \"name\": \"@xyd-js/plugin-chatwoot\",\n \"version\": \"0.1.0-build.23\",\n \"author\": \"\",\n \"description\": \"\",\n \"license\": \"MIT\",\n \"main\": \"./dist/index.js\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"import\": \"./dist/index.js\"\n }\n },\n \"scripts\": {\n \"clean\": \"rimraf build\",\n \"prebuild\": \"pnpm clean\",\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {},\n \"peerDependencies\": {\n \"react\": \"^19.1.0\",\n \"react-dom\": \"^19.1.0\"\n },\n \"devDependencies\": {\n \"vite\": \"^7.0.0\",\n \"@vitest/coverage-v8\": \"^1.6.1\",\n \"rimraf\": \"^3.0.2\",\n \"tsup\": \"^8.4.0\",\n \"vitest\": \"^1.6.1\"\n }\n}","{\n \"name\": \"@xyd-js/plugin-intercom\",\n \"version\": \"0.1.0-build.23\",\n \"author\": \"\",\n \"description\": \"\",\n \"license\": \"MIT\",\n \"main\": \"./dist/index.js\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"import\": \"./dist/index.js\"\n }\n },\n \"scripts\": {\n \"clean\": \"rimraf build\",\n \"prebuild\": \"pnpm clean\",\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {},\n \"peerDependencies\": {},\n \"devDependencies\": {\n \"vite\": \"^7.0.0\",\n \"@vitest/coverage-v8\": \"^1.6.1\",\n \"rimraf\": \"^3.0.2\",\n \"tsup\": \"^8.4.0\",\n \"vitest\": \"^1.6.1\"\n }\n}","{\n \"name\": \"@xyd-js/plugin-livechat\",\n \"version\": \"0.1.0-build.23\",\n \"author\": \"\",\n \"description\": \"\",\n \"license\": \"MIT\",\n \"main\": \"./dist/index.js\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": {\n \"import\": \"./dist/index.js\"\n }\n },\n \"scripts\": {\n \"clean\": \"rimraf build\",\n \"prebuild\": \"pnpm clean\",\n \"build\": \"tsup\",\n \"test\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\"\n },\n \"dependencies\": {},\n \"peerDependencies\": {},\n \"devDependencies\": {\n \"vite\": \"^7.0.0\",\n \"@vitest/coverage-v8\": \"^1.6.1\",\n \"rimraf\": \"^3.0.2\",\n \"tsup\": \"^8.4.0\",\n \"vitest\": \"^1.6.1\"\n }\n}","export const XYD_FOLDER_PATH = \".xyd\"\nexport const HOST_FOLDER_PATH = `${XYD_FOLDER_PATH}/host`\nexport const CACHE_FOLDER_PATH = `${XYD_FOLDER_PATH}/.cache`\nexport const BUILD_FOLDER_PATH = `${XYD_FOLDER_PATH}/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 { execSync } from 'node:child_process';\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport path, { dirname, join } from 'node:path';\nimport colors from 'picocolors';\nimport { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\n\nimport { getCLIRoot, getHostPath, getCLIComponentsJsonPath, nodeInstallPackages } from './utils';\n\ninterface ComponentConfig {\n packages: string[];\n postInstall?: string[];\n xydModules?: string[];\n}\n\n// function resolveModule(dir, spec) {\n// try {\n// const requireFromDir = createRequire(pathToFileURL(dir));\n// const p = requireFromDir.resolve(spec);\n\n// return path.dirname(path.dirname(p)); // /@xyd-js/content/dist/index.js -> /@xyd-js/content\n// } catch {\n// return null;\n// }\n// }\n\nfunction resolveModuleV2(fromDir: string, pkgName: string) {\n const req = createRequire(import.meta.url);\n let entry;\n try {\n // Use Node’s resolver but start searching at fromDir\n entry = req.resolve(pkgName, { paths: [fromDir] });\n } catch {\n return null; // not found from this dir\n }\n\n // Walk up to the package.json that matches pkgName\n let dir = path.dirname(entry);\n while (true) {\n const pj = path.join(dir, 'package.json');\n if (existsSync(pj)) {\n try {\n const json = JSON.parse(readFileSync(pj, 'utf8'));\n if (json && json.name === pkgName) return dir;\n } catch { }\n }\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nconst xydContentPath = resolveModuleV2(getCLIRoot(), '@xyd-js/content');\nconst COMPONENTS: Record<string, ComponentConfig> = {\n diagrams: {\n packages: ['rehype-mermaid@^3.0.0', 'playwright@^1.54.2'],\n postInstall: ['npx playwright install --with-deps chromium'],\n xydModules: [\n xydContentPath || \"\",\n ]\n }\n};\n\nexport async function componentsInstall(\n component: string,\n host?: boolean\n) {\n const config = resolveComponent(component, host)\n if (!config) {\n return false\n }\n\n await installComponent(config, component);\n\n if (!host) {\n saveComponent(component)\n }\n\n return true\n}\n\nfunction saveComponent(component: string) {\n const cliComponentsJson = getCLIComponentsJsonPath();\n\n // Check if components.json exists and if diagrams is already enabled\n let shouldWriteJson = true;\n try {\n const existingComponents = JSON.parse(readFileSync(cliComponentsJson, 'utf8'));\n if (existingComponents.diagrams === true) {\n shouldWriteJson = false;\n }\n } catch (error) {\n // File doesn't exist or is invalid JSON, so we should write it\n shouldWriteJson = true;\n }\n\n const componentsConfig = { [component]: true };\n writeFileSync(cliComponentsJson, JSON.stringify(componentsConfig, null, 2));\n console.debug(colors.green(`✅ Components configuration written to ${cliComponentsJson}`));\n}\n\nexport function resolveComponent(component: string, host?: boolean): ComponentConfig | false {\n if (!component) {\n console.error(colors.red('Error: Component name is required'));\n console.log(`Usage: xyd components install <component-name>`);\n console.log(`Available components: ${Object.keys(COMPONENTS).join(', ')}`);\n return false\n }\n\n if (!COMPONENTS[component]) {\n console.error(colors.red(`Error: Unknown component '${component}'`));\n console.log(`Available components: ${Object.keys(COMPONENTS).join(', ')}`);\n return false\n }\n\n\n const config = COMPONENTS[component];\n\n if (host) {\n config.xydModules = [\n path.resolve(getHostPath(), 'node_modules/@xyd-js/content'),\n getHostPath()\n ]\n }\n\n return config\n}\n\nexport function componentDependencies(config: ComponentConfig | string, host?: boolean) {\n const deps = {}\n\n if (typeof config === 'string') {\n const resolvedConfig = resolveComponent(config, host)\n\n if (!resolvedConfig) {\n return false\n }\n\n config = resolvedConfig\n }\n\n for (const pkg of config.packages) {\n const [pkgName, version] = pkg.includes('@') && !pkg.startsWith('@') ? pkg.split('@') : [pkg, 'latest'];\n deps[pkgName] = version;\n }\n\n return deps\n}\n\nasync function installComponent(\n config: ComponentConfig,\n componentName: string\n) {\n function install(\n pathname: string\n ) {\n if (!config) {\n return\n }\n\n console.log(\"\\n\", colors.gray(`Installing ${componentName} component...`));\n\n try {\n // Install packages using the CLI root path\n if (config.packages.length > 0) {\n console.log(colors.gray(`Installing packages: ${config.packages.join(', ')}`));\n\n // Update package.json with new dependencies\n const packageJsonPath = join(pathname, 'package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n const packageJsonOriginal = JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n\n // Add packages to dependencies\n for (const pkg of config.packages) {\n const [pkgName, version] = pkg.includes('@') && !pkg.startsWith('@') ? pkg.split('@') : [pkg, 'latest'];\n packageJson.dependencies = packageJson.dependencies || {};\n packageJson.dependencies[pkgName] = version;\n }\n\n\n writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n // Install packages using documan's nodeInstallPackages\n nodeInstallPackages(pathname);\n\n // TODO: better solution\n if (process.env.XYD_DEV_MODE) {\n writeFileSync(packageJsonPath, JSON.stringify(packageJsonOriginal, null, 2));\n }\n }\n\n // Run post-install commands\n if (config.postInstall) {\n for (const cmd of config.postInstall) {\n console.log(colors.gray(`Running: ${cmd}`));\n execSync(cmd, {\n cwd: pathname,\n stdio: 'inherit',\n encoding: 'utf8'\n });\n }\n }\n\n console.log(colors.green(`✅ ${componentName} component installed successfully!`));\n\n } catch (error) {\n console.error(colors.red(`❌ Failed to install ${componentName} component:`));\n console.error(error);\n process.exit(1);\n }\n }\n\n for (const module of config.xydModules || []) {\n install(module)\n }\n}\n\n","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, Settings, SidebarNavigation, } from \"@xyd-js/core\";\n\nimport { appInit, calculateFolderChecksum, commonPostInstallVitePlugins, 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 \"plugins\": true, // TODO: in the future better\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 // Handle null/undefined settings\n if (!oldSettings || !newSettings) {\n return oldSettings !== newSettings;\n }\n\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 let onUpdateCallback: (settings: Settings) => void = () => { }\n\n const inited = await appInit({\n onUpdate: (callback) => {\n // Store the callback to be called later with settings\n onUpdateCallback = callback\n }\n })\n if (!inited) {\n return\n }\n const { respPluginDocs, resolvedPlugins } = inited\n\n // TODO: allow only for cwd + .xyd folder\n const allowCwd = searchForWorkspaceRoot(process.cwd())\n const watchAllow = process.cwd()\n\n const appRoot = getAppRoot()\n const commonRunVitePlugins = await 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 const postInstallVitePlugins = commonPostInstallVitePlugins(respPluginDocs, resolvedPlugins)\n\n // ⚠️ \n spinner.log('✔ Local xyd instance is ready');\n spinner.log('🔄 Starting server...');\n\n let server: ViteDevServer | null = null\n\n const port = options?.port ?? parseInt(process.env.XYD_PORT ?? \"5175\")\n\n // Determine conditional externals based on settings\n const enableMermaid = !!respPluginDocs?.settings?.integrations?.diagrams\n const externalPackages = enableMermaid ? [] : [\"rehype-mermaid\"]\n const optimizeDepsExclude = enableMermaid ? [] : [\"rehype-mermaid\"]\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 \"@orama/orama\",\n \"@orama/react-components\",\n // TODO: optimize plugin deps only if loaded \n // \"@pluganalytics/provider-livesession\"\n ];\n } else {\n USE_CONTEXT_ISSUE_PACKAGES = [\n \"@xyd-js/theme-cosmo\",\n \"@xyd-js/theme-gusto\",\n \"@xyd-js/theme-opener\",\n \"@xyd-js/theme-picasso\",\n \"@xyd-js/theme-poetry\",\n \"@xyd-js/theme-solar\",\n // TODO: optimize plugin deps only if loaded \n // \"@pluganalytics/provider-livesession\"\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 // When rehype-mermaid is externalized, resolve it from CLI's node_modules\n ...(enableMermaid ? {} : { 'rehype-mermaid': path.resolve(getHostPath(), './node_modules/rehype-mermaid') })\n },\n // preserveSymlinks: true\n },\n build: {\n rollupOptions: {\n external: externalPackages\n },\n },\n ssr: {\n external: externalPackages,\n },\n optimizeDeps: {\n include: [\n \"react/jsx-runtime\",\n ...USE_CONTEXT_ISSUE_PACKAGES,\n ],\n exclude: optimizeDepsExclude,\n // exclude: [\"react\", \"react-dom\"]\n },\n plugins: [\n ...commonRunVitePlugins,\n ...postInstallVitePlugins,\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(watchAllow, { recursive: true }, async (eventType, filename) => {\n // console.log(\"WATCHER CHANGED\", RELOADING)\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(watchAllow, filename);\n if (filePath.includes(CACHE_FOLDER_PATH)) {\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\n let iconPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings) {\n iconPaths = resolveIconFilePaths(process.cwd(), respPluginDocs.settings)\n }\n\n let syntaxHighlightPaths: { [path: string]: boolean } = {}\n if (respPluginDocs?.settings) {\n syntaxHighlightPaths = resolveSyntaxHighlightFilePaths(process.cwd(), respPluginDocs.settings)\n }\n\n const apiChanged = !!apiPaths[filePath]\n const iconChanged = !!iconPaths[filePath]\n const syntaxHighlightChanged = !!syntaxHighlightPaths[filePath]\n\n const isSettingsFile = SUPPORTED_SETTINGS_FILES.some(ext => filePath.endsWith(ext))\n const isContentFile = SUPPORTED_CONTENT_FILES.some(ext => filePath.endsWith(ext))\n const isPublicPathReload = filePath.includes(getPublicPath())\n const isEnvFile = isEnvFilePath(filePath)\n const isWatchFile = isSettingsFile ||\n isContentFile ||\n apiChanged ||\n iconChanged ||\n syntaxHighlightChanged ||\n isPublicPathReload ||\n isEnvFile\n\n if (!isWatchFile) {\n return\n }\n\n const renameContentFile = isContentFile && eventType === 'rename'\n\n if (isContentFile && !renameContentFile) {\n console.log('🔄 Content file changed, refresh...');\n\n // invalidateSettingsOnly(server) // if invalidate settings will be needed then + with composer? cuz issues with this\n\n invalidateSettings(server)\n await touchLayoutPage()\n // await touchRootPage()\n\n // server.ws.send({ type: 'full-reload' });\n // invalidateSettings(server) // TODO: check if needed but some issues with this\n\n // setTimeout(() => {\n // server && invalidateSettings(server)\n // }, 1000)\n // await touchPage()\n\n console.log('✔ xyd content file changed\\n');\n\n return\n }\n\n const isReloadFile = isSettingsFile ||\n renameContentFile ||\n isPublicPathReload ||\n iconChanged ||\n apiChanged ||\n syntaxHighlightChanged ||\n isEnvFile\n\n if (isReloadFile) {\n if (renameContentFile) {\n console.log('🔄 Content file renamed, refresh...');\n } else if (isPublicPathReload) {\n console.log('🔄 Public path changed, refresh...');\n } else if (iconChanged) {\n console.log('🔄 Icon file changed, refresh...');\n invalidateIconSet(server)\n } else if (syntaxHighlightChanged) {\n console.log('🔄 Syntax highlight theme file changed, refresh...');\n } else if (apiChanged) {\n console.log('🔄 API file changed, refresh...');\n } else if (syntaxHighlightChanged) {\n console.log('🔄 Syntax highlight theme file changed, refresh...');\n } else if (isEnvFile) {\n console.log('🔄 Environment file changed, refresh...');\n // Environment variables affect settings processing, so we need a full reload\n await reloadServer(watcher, preview, options);\n return;\n } else {\n console.log('🔄 Settings file changed, refresh...');\n }\n\n let newSettings: Settings | null = null\n // TODO: better way to handle that - we need this cuz otherwise its inifiite reloads\n if (respPluginDocs?.settings.engine?.uniform?.store) {\n const resp = await appInit({\n disableFSWrite: true,\n doNotInstallPluginDependencies: true\n })\n\n const respSettings = resp?.respPluginDocs?.settings\n if (respSettings) {\n newSettings = respSettings\n }\n } else {\n const resp = await appInit({\n doNotInstallPluginDependencies: true\n }) // TODO: !!! IN THE FUTURE MORE EFFICIENT WAY !!!\n\n const respSettings = resp?.respPluginDocs?.settings\n if (respSettings) {\n newSettings = respSettings\n }\n }\n if (!newSettings) {\n console.log(\"[xyd:dev-watcher] Settings is not an object or is null\");\n return\n }\n\n {\n const needsFullReload = hasFullReloadPropertiesChanged(initialSettings, newSettings);\n\n if (needsFullReload) {\n console.log('🔄 Full reload properties changed, restarting server...');\n await reloadServer(watcher, preview, options);\n return;\n }\n }\n\n {\n invalidateSettings(server)\n onUpdateCallback(newSettings)\n await touchReactRouterConfig()\n await touchRootPage()\n await touchLayoutPage()\n // await touchPage()\n server.ws.send({ type: 'full-reload' });\n // TODO: in the future better solution\n }\n\n // Re-read settings to get the updated values\n // const newSettings = await readSettings();\n // if (typeof newSettings !== 'object' || newSettings === null) {\n // console.log(\"[xyd:dev-watcher] Settings is not an object or is null\");\n // return\n // }\n\n // Check if any full reload properties have changed\n // const needsFullReload = hasFullReloadPropertiesChanged(initialSettings, newSettings);\n\n // if (needsFullReload) {\n // console.log('🔄 Full reload properties changed, restarting server...');\n // RELOADING = true;\n\n // // Close the current server\n // watcher.close();\n // await preview.close();\n // RELOADING = false;\n\n // // Restart the dev server\n // await dev(options);\n // return;\n // }\n\n // Update the initial settings for next comparison\n // initialSettings = newSettings;\n\n // invalidateSettings(server)\n // await touchReactRouterConfig()\n // await touchLayoutPage()\n // await touchRootPage()\n\n // // Send full reload to ensure all components update\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 await optimizeDepsFix(port, respPluginDocs.settings.navigation)\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\nasync function reloadServer(\n watcher: fs.FSWatcher,\n preview: ViteDevServer,\n options?: DevOptions\n) {\n RELOADING = true;\n watcher.close();\n await preview.close();\n RELOADING = false;\n await dev(options);\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 * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks theme.icons.library, \n * resolves all referenced local files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveIconFilePaths(\n basePath: string,\n settings: any\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const icons = settings?.theme?.icons?.library\n if (!icons) {\n return result\n }\n\n // Helper function to check if a path is a local file path\n const isLocalPath = (path: string): boolean => {\n // Must start with ./ or / to be a local file path\n return path.startsWith('./') || path.startsWith('/')\n }\n\n // Handle single icon library\n if (typeof icons === 'string') {\n if (isLocalPath(icons)) {\n const iconAbsPath = path.resolve(basePath, icons)\n result[iconAbsPath] = true\n }\n return result\n }\n\n // Handle array of icon libraries\n if (Array.isArray(icons)) {\n icons.forEach(library => {\n if (typeof library === 'string') {\n if (isLocalPath(library)) {\n const iconAbsPath = path.resolve(basePath, library)\n result[iconAbsPath] = true\n }\n } else if (typeof library === 'object' && library.name) {\n if (isLocalPath(library.name)) {\n const iconAbsPath = path.resolve(basePath, library.name)\n result[iconAbsPath] = true\n }\n }\n })\n } else if (typeof icons === 'object' && icons.name) {\n // Handle single icon library object\n if (isLocalPath(icons.name)) {\n const iconAbsPath = path.resolve(basePath, icons.name)\n result[iconAbsPath] = true\n }\n }\n\n return result\n}\n\n/**\n * @todo: !!! in the future it should be created at different level !!!\n * \n * Walks theme.coder.syntaxHighlight, \n * resolves all referenced local files under `basePath`,\n * and returns a set of absolute paths.\n */\nexport function resolveSyntaxHighlightFilePaths(\n basePath: string,\n settings: any\n): Record<string, true> {\n const result: Record<string, true> = {}\n\n const syntaxHighlight = settings?.theme?.coder?.syntaxHighlight\n if (!syntaxHighlight) {\n return result\n }\n\n // Helper function to check if a path is a local file path\n const isLocalPath = (path: string): boolean => {\n // Must start with ./ or / to be a local file path\n return path.startsWith('./') || path.startsWith('/')\n }\n\n // Handle single syntax highlight theme\n if (typeof syntaxHighlight === 'string') {\n if (isLocalPath(syntaxHighlight)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, syntaxHighlight)\n result[syntaxHighlightAbsPath] = true\n }\n return result\n }\n\n // Handle array of syntax highlight themes\n if (Array.isArray(syntaxHighlight)) {\n syntaxHighlight.forEach(theme => {\n if (typeof theme === 'string') {\n if (isLocalPath(theme)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, theme)\n result[syntaxHighlightAbsPath] = true\n }\n } else if (typeof theme === 'object' && theme.name) {\n if (isLocalPath(theme.name)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, theme.name)\n result[syntaxHighlightAbsPath] = true\n }\n }\n })\n } else if (typeof syntaxHighlight === 'object' && syntaxHighlight.name) {\n // Handle single syntax highlight theme object\n if (isLocalPath(syntaxHighlight.name)) {\n const syntaxHighlightAbsPath = path.resolve(basePath, syntaxHighlight.name)\n result[syntaxHighlightAbsPath] = 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 * Checks if a file path is an environment file\n */\nfunction isEnvFilePath(filePath: string): boolean {\n return filePath.endsWith('.env') ||\n filePath.endsWith('.env.local') ||\n filePath.endsWith('.env.development') ||\n filePath.endsWith('.env.production');\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 resolvedId = invalidateSettingsOnly(server)\n\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 console.debug('✅ [xyd:dev-watcher] Settings module invalidated and HMR update sent');\n}\n\nfunction invalidateSettingsOnly(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 // console.debug('🔄 [xyd:dev-watcher] Invalidating settings module...');\n server.moduleGraph.invalidateModule(mod);\n\n return resolvedId\n}\n\nfunction invalidateIconSet(server: ViteDevServer) {\n const virtualId = 'virtual:xyd-icon-set';\n const mod = server.moduleGraph.getModuleById(virtualId);\n\n // console.log(\"[xyd:dev-watcher] Looking for icon set module:\", virtualId);\n // console.log(\"[xyd:dev-watcher] Module found:\", !!mod);\n\n if (!mod) {\n console.log(\"[xyd:dev-watcher] Icon set module not found\");\n return\n }\n\n console.debug('🔄 [xyd:dev-watcher] Invalidating icon set module...');\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({\n type: 'update',\n updates: [\n {\n type: 'js-update',\n path: `/@id/${virtualId}`,\n acceptedPath: `/@id/${virtualId}`,\n timestamp: Date.now(),\n },\n ],\n });\n console.debug('✅ [xyd:dev-watcher] Icon set module invalidated and HMR update sent');\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 touchPage() {\n const docsPluginBasePath = getDocsPluginBasePath()\n const pagePath = path.join(docsPluginBasePath, \"./src/pages/page.tsx\")\n await fs.promises.utimes(pagePath, new Date(), new Date());\n}\n\nasync function touchRootPage() {\n const hostPath = getHostPath()\n const hostReactRouterConfig = path.join(hostPath, \"./app/root.tsx\")\n await fs.promises.utimes(hostReactRouterConfig, 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// 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 let firstPage: null | string = \"\"\n if (navigation) {\n firstPage = getFirstPageFromNavigation(navigation);\n }\n await fetchFirstPage(firstPage || \"\", port);\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;AAAA;AAAA,QAAI,IAAI,WAAW,CAAC;AAApB,QAAuB,OAAO,EAAE,QAAQ,CAAC;AAAzC,QAA4C,MAAM,EAAE,OAAO,CAAC;AAC5D,QAAI,mBACH,EAAE,CAAC,CAAC,IAAI,YAAY,KAAK,SAAS,YAAY,OAC7C,CAAC,CAAC,IAAI,eAAe,KAAK,SAAS,SAAS,KAAK,EAAE,aAAa,YAAa,EAAE,UAAU,CAAC,GAAG,SAAS,IAAI,SAAS,UAAW,CAAC,CAAC,IAAI;AAEtI,QAAI,YAAY,CAAC,MAAM,OAAO,UAAU,SACvC,WAAS;AACR,UAAI,SAAS,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,KAAK,MAAM;AAClE,aAAO,CAAC,QAAQ,OAAO,aAAa,QAAQ,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO,SAAS;AAAA,IAC9F;AAED,QAAI,eAAe,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrD,UAAI,SAAS,IAAI,SAAS;AAC1B,SAA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","names":["path","fs","path","execSync","package_default","package_default","package_default","colors","install","path","package_default","__filename","__dirname","install","hostPackageJson","execSync","path","fs","path","fs","createServer","path","createServer","fs","path","fs","fs","readSettings","fs"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyd-js/documan",
3
- "version": "0.1.0-build.193",
3
+ "version": "0.1.0-build.196",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -19,14 +19,14 @@
19
19
  "@react-router/serve": "^7.7.1",
20
20
  "cli-spinners": "^3.0.0",
21
21
  "vite-tsconfig-paths": "^5.1.4",
22
- "@xyd-js/content": "0.1.0-build.175",
23
- "@xyd-js/plugins": "0.1.0-build.161",
24
- "@xyd-js/uniform": "0.1.0-build.176",
25
- "@xyd-js/core": "0.1.0-build.174",
26
- "@xyd-js/plugin-docs": "0.1.0-build.164"
22
+ "@xyd-js/content": "0.1.0-build.178",
23
+ "@xyd-js/plugin-docs": "0.1.0-build.167",
24
+ "@xyd-js/core": "0.1.0-build.177",
25
+ "@xyd-js/plugins": "0.1.0-build.164",
26
+ "@xyd-js/uniform": "0.1.0-build.179"
27
27
  },
28
28
  "peerDependencies": {
29
- "@xyd-js/host": "0.1.0-build.162"
29
+ "@xyd-js/host": "0.1.0-build.165"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@mdx-js/rollup": "^3.1.0",