@xyd-js/documan 0.0.0-build-6675456-20251014012658 → 0.0.0-build-1f6458c-20251015205119
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 +268 -44
- package/dist/index.js.map +1 -1
- package/package.json +12 -8
package/dist/index.js
CHANGED
|
@@ -109,10 +109,19 @@ import { fileURLToPath } from "url";
|
|
|
109
109
|
import { execSync as execSync2 } from "child_process";
|
|
110
110
|
import crypto from "crypto";
|
|
111
111
|
import { realpathSync } from "fs";
|
|
112
|
-
import
|
|
112
|
+
import * as fsPromises from "fs/promises";
|
|
113
|
+
import { toMarkdown } from "mdast-util-to-markdown";
|
|
114
|
+
import { u } from "unist-builder";
|
|
115
|
+
import matter from "gray-matter";
|
|
116
|
+
import {
|
|
117
|
+
createServer
|
|
118
|
+
} from "vite";
|
|
113
119
|
import { reactRouter } from "@react-router/dev/vite";
|
|
114
120
|
import { IconSet } from "@iconify/tools";
|
|
115
|
-
import {
|
|
121
|
+
import {
|
|
122
|
+
readSettings,
|
|
123
|
+
pluginDocs
|
|
124
|
+
} from "@xyd-js/plugin-docs";
|
|
116
125
|
import { vitePlugins as xydContentVitePlugins } from "@xyd-js/content/vite";
|
|
117
126
|
|
|
118
127
|
// ../xyd-plugin-supademo/package.json
|
|
@@ -480,6 +489,116 @@ async function installComponent(config, componentName) {
|
|
|
480
489
|
// src/utils.ts
|
|
481
490
|
var __filename = fileURLToPath(import.meta.url);
|
|
482
491
|
var __dirname = path2.dirname(__filename);
|
|
492
|
+
async function parseFrontmatterAndCreateAST(settings, content, filePath) {
|
|
493
|
+
if (settings?.ai?.llmsTxt === false) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
try {
|
|
497
|
+
const { data: fm } = matter(content) || { data: {} };
|
|
498
|
+
const title = fm?.title || "";
|
|
499
|
+
const description = fm?.description || "";
|
|
500
|
+
if (!title) {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
const rawPath = filePath.replace(/^\/+/, "/");
|
|
504
|
+
const aiBaseUrl = typeof settings?.ai?.llmsTxt !== "string" ? settings?.ai?.llmsTxt?.baseUrl : "";
|
|
505
|
+
const isAbsolute = /^https?:\/\//i.test(rawPath);
|
|
506
|
+
const url = isAbsolute ? rawPath : aiBaseUrl ? aiBaseUrl.replace(/\/$/, "") + rawPath : rawPath;
|
|
507
|
+
const linkNode = u("link", { url }, [u("text", title)]);
|
|
508
|
+
const paragraphChildren = [linkNode];
|
|
509
|
+
if (description) {
|
|
510
|
+
paragraphChildren.push(u("text", `: ${description}`));
|
|
511
|
+
}
|
|
512
|
+
const paragraphNode = u("paragraph", paragraphChildren);
|
|
513
|
+
const listItemNode = u("listItem", [paragraphNode]);
|
|
514
|
+
return listItemNode;
|
|
515
|
+
} catch (error) {
|
|
516
|
+
console.warn(`Failed to parse frontmatter for ${filePath}:`, error);
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function buildLLMsMarkdownAST(settings, rawRouteFiles, markdownItems) {
|
|
521
|
+
const aiLlms = settings?.ai?.llmsTxt;
|
|
522
|
+
if (aiLlms === false) {
|
|
523
|
+
return "";
|
|
524
|
+
}
|
|
525
|
+
const looksLikePath = isLLMsTxtPath(settings);
|
|
526
|
+
if (looksLikePath) {
|
|
527
|
+
const tryPaths = lookupPaths(aiLlms) || [];
|
|
528
|
+
for (const pth of tryPaths) {
|
|
529
|
+
const exists = fs.existsSync(pth);
|
|
530
|
+
if (!exists) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const value = fs.readFileSync(pth, "utf8");
|
|
534
|
+
const normalized = value.split("\n").map((line) => line.replace(/^\s+(#{1,6}\s+)/, "$1")).join("\n").trim();
|
|
535
|
+
return normalized;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
let h1Title = "";
|
|
539
|
+
const pathMappingIndex = globalThis.__xydPagePathMapping["index"];
|
|
540
|
+
if (pathMappingIndex) {
|
|
541
|
+
const indexContent = rawRouteFiles[normalizePath(pathMappingIndex)];
|
|
542
|
+
if (indexContent) {
|
|
543
|
+
try {
|
|
544
|
+
const { data } = matter(indexContent) || { data: {} };
|
|
545
|
+
if (data?.title && typeof data.title === "string") {
|
|
546
|
+
h1Title = data.title;
|
|
547
|
+
}
|
|
548
|
+
} catch {
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
let summaryText = "";
|
|
553
|
+
const extraBlocks = [];
|
|
554
|
+
if (aiLlms && typeof aiLlms === "object") {
|
|
555
|
+
const obj = aiLlms;
|
|
556
|
+
if (typeof obj.title === "string" && obj.title.trim()) {
|
|
557
|
+
h1Title = obj.title.trim();
|
|
558
|
+
}
|
|
559
|
+
if (typeof obj.summary === "string" && obj.summary.trim()) {
|
|
560
|
+
summaryText = obj.summary.trim();
|
|
561
|
+
}
|
|
562
|
+
if (obj.sections && typeof obj.sections === "object") {
|
|
563
|
+
for (const key of Object.keys(obj.sections)) {
|
|
564
|
+
const sec = obj.sections[key];
|
|
565
|
+
if (!sec || typeof sec !== "object") continue;
|
|
566
|
+
const sTitle = sec.title;
|
|
567
|
+
const sUrl = sec.url;
|
|
568
|
+
const sDescription = sec.description;
|
|
569
|
+
if (!sTitle) continue;
|
|
570
|
+
extraBlocks.push(u("heading", { depth: 2 }, [u("text", sTitle)]));
|
|
571
|
+
if (sUrl) {
|
|
572
|
+
const linkNode = u("link", { url: sUrl }, [u("text", sTitle)]);
|
|
573
|
+
const paraChildren = [linkNode];
|
|
574
|
+
if (sDescription) paraChildren.push(u("text", `: ${sDescription}`));
|
|
575
|
+
const listItem = u("listItem", [u("paragraph", paraChildren)]);
|
|
576
|
+
extraBlocks.push(
|
|
577
|
+
u("list", { ordered: false, spread: false }, [listItem])
|
|
578
|
+
);
|
|
579
|
+
} else if (sDescription) {
|
|
580
|
+
extraBlocks.push(u("paragraph", [u("text", sDescription)]));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
const children = [];
|
|
586
|
+
children.push(u("heading", { depth: 1 }, [u("text", h1Title)]));
|
|
587
|
+
if (summaryText) {
|
|
588
|
+
children.push(u("paragraph", [u("text", summaryText)]));
|
|
589
|
+
}
|
|
590
|
+
children.push(u("heading", { depth: 2 }, [u("text", "Docs")]));
|
|
591
|
+
children.push(u("list", { ordered: false, spread: false }, markdownItems));
|
|
592
|
+
if (extraBlocks.length) {
|
|
593
|
+
children.push(...extraBlocks);
|
|
594
|
+
}
|
|
595
|
+
const root = u("root", children);
|
|
596
|
+
return toMarkdown(root, {
|
|
597
|
+
bullet: "-",
|
|
598
|
+
bulletOther: "*",
|
|
599
|
+
bulletOrdered: "."
|
|
600
|
+
});
|
|
601
|
+
}
|
|
483
602
|
var ANALYTICS_INTEGRATION_DEPENDENCIES = {
|
|
484
603
|
livesession: {
|
|
485
604
|
"@pluganalytics/provider-livesession": "0.0.0-pre.7"
|
|
@@ -491,6 +610,15 @@ var EXTERNAL_XYD_PLUGINS = {
|
|
|
491
610
|
"@xyd-js/plugin-intercom": package_default3.version,
|
|
492
611
|
"@xyd-js/plugin-livechat": package_default4.version
|
|
493
612
|
};
|
|
613
|
+
function isLLMsTxtPath(settings) {
|
|
614
|
+
const aiLlms = settings?.ai?.llmsTxt;
|
|
615
|
+
if (typeof aiLlms === "string" && aiLlms?.trim()) {
|
|
616
|
+
const value = aiLlms;
|
|
617
|
+
const looksLikePath = /\.(md|mdx|txt)$/i.test(value) || !value.includes("\n") && !value.startsWith("#") && !value.startsWith("- ");
|
|
618
|
+
return looksLikePath;
|
|
619
|
+
}
|
|
620
|
+
return false;
|
|
621
|
+
}
|
|
494
622
|
async function appInit(options) {
|
|
495
623
|
const readPreloadSettings = await readSettings();
|
|
496
624
|
if (!readPreloadSettings) {
|
|
@@ -562,9 +690,7 @@ async function appInit(options) {
|
|
|
562
690
|
}
|
|
563
691
|
const head = p.head;
|
|
564
692
|
if (head?.length && preloadSettings?.theme?.head) {
|
|
565
|
-
preloadSettings.theme.head.push(
|
|
566
|
-
...head
|
|
567
|
-
);
|
|
693
|
+
preloadSettings.theme.head.push(...head);
|
|
568
694
|
}
|
|
569
695
|
});
|
|
570
696
|
globalThis.__xydUserUniformVitePlugins = userUniformVitePlugins;
|
|
@@ -594,12 +720,16 @@ async function appInit(options) {
|
|
|
594
720
|
globalThis.__xydSettings = respPluginDocs.settings;
|
|
595
721
|
globalThis.__xydPagePathMapping = respPluginDocs.pagePathMapping;
|
|
596
722
|
globalThis.__xydHasIndexPage = respPluginDocs.hasIndexPage;
|
|
597
|
-
globalThis.__xydSettingsClone = JSON.parse(
|
|
723
|
+
globalThis.__xydSettingsClone = JSON.parse(
|
|
724
|
+
JSON.stringify(respPluginDocs.settings)
|
|
725
|
+
);
|
|
726
|
+
globalThis.__xydRawRouteFiles = {};
|
|
598
727
|
if (respPluginDocs.settings.integrations?.diagrams) {
|
|
599
728
|
if (!componentExists("diagrams")) {
|
|
600
729
|
await componentsInstall("diagrams");
|
|
601
730
|
}
|
|
602
731
|
}
|
|
732
|
+
await pluginLLMMarkdown(respPluginDocs);
|
|
603
733
|
return {
|
|
604
734
|
respPluginDocs,
|
|
605
735
|
resolvedPlugins
|
|
@@ -660,9 +790,7 @@ function virtualProvidersPlugin(settings) {
|
|
|
660
790
|
const imports = providers.map(
|
|
661
791
|
(provider) => `import { default as ${provider}Provider } from '@pluganalytics/provider-${provider}'`
|
|
662
792
|
).join("\n");
|
|
663
|
-
const cases = providers.map(
|
|
664
|
-
(provider) => `case '${provider}': return ${provider}Provider`
|
|
665
|
-
).join("\n");
|
|
793
|
+
const cases = providers.map((provider) => `case '${provider}': return ${provider}Provider`).join("\n");
|
|
666
794
|
return `
|
|
667
795
|
${imports}
|
|
668
796
|
|
|
@@ -696,10 +824,66 @@ async function commonVitePlugins(respPluginDocs, resolvedPlugins) {
|
|
|
696
824
|
...userVitePlugins
|
|
697
825
|
];
|
|
698
826
|
}
|
|
827
|
+
async function pluginLLMMarkdown(respPluginDocs) {
|
|
828
|
+
const paths = Object.keys(globalThis.__xydPagePathMapping || {});
|
|
829
|
+
const rawRouteFiles = {};
|
|
830
|
+
const llmsItems = [];
|
|
831
|
+
for (const key of paths) {
|
|
832
|
+
const mappingPath = globalThis.__xydPagePathMapping[key];
|
|
833
|
+
const savePath = path2.join(process.cwd(), mappingPath);
|
|
834
|
+
const savePathExt = path2.extname(savePath);
|
|
835
|
+
if (savePathExt === ".md" || savePathExt === ".mdx") {
|
|
836
|
+
try {
|
|
837
|
+
await fsPromises.stat(savePath);
|
|
838
|
+
} catch (e) {
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
const content = await fsPromises.readFile(savePath, "utf8");
|
|
842
|
+
const formattedKey = normalizePath(key);
|
|
843
|
+
const keyWithExt = formattedKey.endsWith(savePathExt) ? formattedKey : `${formattedKey}${savePathExt}`;
|
|
844
|
+
rawRouteFiles[keyWithExt] = content;
|
|
845
|
+
const listItem = await parseFrontmatterAndCreateAST(
|
|
846
|
+
respPluginDocs.settings,
|
|
847
|
+
content,
|
|
848
|
+
keyWithExt
|
|
849
|
+
);
|
|
850
|
+
if (listItem) {
|
|
851
|
+
llmsItems.push(listItem);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
if (respPluginDocs.settings?.ai?.llmsTxt !== false) {
|
|
856
|
+
let foundUserLLMsTxt = false;
|
|
857
|
+
for (const pth of lookupPaths("llms.txt")) {
|
|
858
|
+
const exists = fs.existsSync(pth);
|
|
859
|
+
if (!exists) {
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
const llmContent = fs.readFileSync(pth, "utf8");
|
|
863
|
+
rawRouteFiles["/llms.txt"] = llmContent;
|
|
864
|
+
foundUserLLMsTxt = true;
|
|
865
|
+
break;
|
|
866
|
+
}
|
|
867
|
+
if (!foundUserLLMsTxt && (llmsItems.length > 0 || respPluginDocs.settings?.ai?.llmsTxt)) {
|
|
868
|
+
const llmsContent = buildLLMsMarkdownAST(
|
|
869
|
+
respPluginDocs.settings,
|
|
870
|
+
rawRouteFiles,
|
|
871
|
+
llmsItems
|
|
872
|
+
);
|
|
873
|
+
rawRouteFiles["/llms.txt"] = llmsContent;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
globalThis.__xydRawRouteFiles = {
|
|
877
|
+
...globalThis.__xydRawRouteFiles,
|
|
878
|
+
...rawRouteFiles
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function normalizePath(p) {
|
|
882
|
+
const formattedKey = p.startsWith("/") ? p : `/${p}`;
|
|
883
|
+
return formattedKey;
|
|
884
|
+
}
|
|
699
885
|
function commonPostInstallVitePlugins(respPluginDocs, resolvedPlugins) {
|
|
700
|
-
return [
|
|
701
|
-
vitePluginThemePresets(respPluginDocs.settings)
|
|
702
|
-
];
|
|
886
|
+
return [vitePluginThemePresets(respPluginDocs.settings)];
|
|
703
887
|
}
|
|
704
888
|
async function vitePluginThemePresets(settings) {
|
|
705
889
|
const themeName = settings.theme?.name;
|
|
@@ -709,9 +893,15 @@ async function vitePluginThemePresets(settings) {
|
|
|
709
893
|
const __dirname2 = path2.dirname(__filename2);
|
|
710
894
|
let themeRoot = "";
|
|
711
895
|
if (process.env.XYD_CLI) {
|
|
712
|
-
themeRoot = path2.join(
|
|
896
|
+
themeRoot = path2.join(
|
|
897
|
+
getHostPath(),
|
|
898
|
+
`node_modules/@xyd-js/theme-${themeName}/dist`
|
|
899
|
+
);
|
|
713
900
|
} else {
|
|
714
|
-
themeRoot = path2.join(
|
|
901
|
+
themeRoot = path2.join(
|
|
902
|
+
path2.resolve(__dirname2, "../../"),
|
|
903
|
+
`xyd-theme-${themeName}/dist`
|
|
904
|
+
);
|
|
715
905
|
}
|
|
716
906
|
const presetsDir = path2.join(themeRoot, "presets");
|
|
717
907
|
let cssFiles = [];
|
|
@@ -795,7 +985,9 @@ function pluginIconSet(settings) {
|
|
|
795
985
|
const iconSet = new IconSet(iconsData);
|
|
796
986
|
return { icons: iconsData, iconSet };
|
|
797
987
|
} catch (error) {
|
|
798
|
-
throw new Error(
|
|
988
|
+
throw new Error(
|
|
989
|
+
`Failed to load icon set from any source (file or CDN): ${name}`
|
|
990
|
+
);
|
|
799
991
|
}
|
|
800
992
|
}
|
|
801
993
|
async function processIconSet(iconSet, icons, noPrefix) {
|
|
@@ -864,10 +1056,7 @@ function pluginIconSet(settings) {
|
|
|
864
1056
|
};
|
|
865
1057
|
}
|
|
866
1058
|
function getXydFolderPath() {
|
|
867
|
-
return path2.join(
|
|
868
|
-
process.cwd(),
|
|
869
|
-
XYD_FOLDER_PATH
|
|
870
|
-
);
|
|
1059
|
+
return path2.join(process.cwd(), XYD_FOLDER_PATH);
|
|
871
1060
|
}
|
|
872
1061
|
function getCLIRoot() {
|
|
873
1062
|
const cliPath = realpathSync(process.argv[1]);
|
|
@@ -901,10 +1090,7 @@ function getPublicPath() {
|
|
|
901
1090
|
return path2.join(process.cwd(), "public");
|
|
902
1091
|
}
|
|
903
1092
|
function getBuildPath() {
|
|
904
|
-
return path2.join(
|
|
905
|
-
process.cwd(),
|
|
906
|
-
BUILD_FOLDER_PATH
|
|
907
|
-
);
|
|
1093
|
+
return path2.join(process.cwd(), BUILD_FOLDER_PATH);
|
|
908
1094
|
}
|
|
909
1095
|
function getDocsPluginBasePath() {
|
|
910
1096
|
return path2.join(getHostPath(), "./plugins/xyd-plugin-docs");
|
|
@@ -925,14 +1111,20 @@ async function loadPlugins(settings, options) {
|
|
|
925
1111
|
pluginName = plugin[0];
|
|
926
1112
|
pluginArgs = plugin.slice(1);
|
|
927
1113
|
} else {
|
|
928
|
-
console.error(
|
|
1114
|
+
console.error(
|
|
1115
|
+
`Currently only string and array plugins are supported, got: ${plugin}`
|
|
1116
|
+
);
|
|
929
1117
|
return [];
|
|
930
1118
|
}
|
|
931
1119
|
let mod;
|
|
932
1120
|
try {
|
|
933
1121
|
mod = await import(pluginName);
|
|
934
1122
|
} catch (e) {
|
|
935
|
-
pluginName = path2.join(
|
|
1123
|
+
pluginName = path2.join(
|
|
1124
|
+
process.cwd(),
|
|
1125
|
+
".xyd/host/node_modules",
|
|
1126
|
+
pluginName
|
|
1127
|
+
);
|
|
936
1128
|
const pluginPreview = await createServer({
|
|
937
1129
|
optimizeDeps: {
|
|
938
1130
|
include: []
|
|
@@ -992,22 +1184,13 @@ function integrationsToPlugins(integrations) {
|
|
|
992
1184
|
plugins.push(["@xyd-js/plugin-supademo", integrations[".apps"].supademo]);
|
|
993
1185
|
}
|
|
994
1186
|
if (integrations?.support?.chatwoot) {
|
|
995
|
-
plugins.push([
|
|
996
|
-
"@xyd-js/plugin-chatwoot",
|
|
997
|
-
integrations.support.chatwoot
|
|
998
|
-
]);
|
|
1187
|
+
plugins.push(["@xyd-js/plugin-chatwoot", integrations.support.chatwoot]);
|
|
999
1188
|
}
|
|
1000
1189
|
if (integrations?.support?.intercom) {
|
|
1001
|
-
plugins.push([
|
|
1002
|
-
"@xyd-js/plugin-intercom",
|
|
1003
|
-
integrations.support.intercom
|
|
1004
|
-
]);
|
|
1190
|
+
plugins.push(["@xyd-js/plugin-intercom", integrations.support.intercom]);
|
|
1005
1191
|
}
|
|
1006
1192
|
if (integrations?.support?.livechat) {
|
|
1007
|
-
plugins.push([
|
|
1008
|
-
"@xyd-js/plugin-livechat",
|
|
1009
|
-
integrations.support.livechat
|
|
1010
|
-
]);
|
|
1193
|
+
plugins.push(["@xyd-js/plugin-livechat", integrations.support.livechat]);
|
|
1011
1194
|
}
|
|
1012
1195
|
return plugins;
|
|
1013
1196
|
}
|
|
@@ -1028,7 +1211,10 @@ async function preWorkspaceSetup(options = {}) {
|
|
|
1028
1211
|
pluginDocsPath = path2.resolve(__dirname, "../../plugin-docs");
|
|
1029
1212
|
}
|
|
1030
1213
|
const pagesSourcePath = path2.join(pluginDocsPath, "src/pages");
|
|
1031
|
-
const pagesTargetPath = path2.join(
|
|
1214
|
+
const pagesTargetPath = path2.join(
|
|
1215
|
+
hostPath,
|
|
1216
|
+
"plugins/xyd-plugin-docs/src/pages"
|
|
1217
|
+
);
|
|
1032
1218
|
if (fs.existsSync(pagesSourcePath)) {
|
|
1033
1219
|
await copyHostTemplate(pagesSourcePath, pagesTargetPath);
|
|
1034
1220
|
} else {
|
|
@@ -1037,7 +1223,16 @@ async function preWorkspaceSetup(options = {}) {
|
|
|
1037
1223
|
}
|
|
1038
1224
|
function calculateFolderChecksum(folderPath) {
|
|
1039
1225
|
const hash = crypto.createHash("sha256");
|
|
1040
|
-
const ignorePatterns = [
|
|
1226
|
+
const ignorePatterns = [
|
|
1227
|
+
...getGitignorePatterns(folderPath),
|
|
1228
|
+
".xydchecksum",
|
|
1229
|
+
"node_modules",
|
|
1230
|
+
"dist",
|
|
1231
|
+
".react-router",
|
|
1232
|
+
"package-lock.json",
|
|
1233
|
+
"pnpm-lock.yaml",
|
|
1234
|
+
"cliComponents.json"
|
|
1235
|
+
];
|
|
1041
1236
|
function processFile(filePath) {
|
|
1042
1237
|
const relativePath = path2.relative(folderPath, filePath);
|
|
1043
1238
|
const content = fs.readFileSync(filePath);
|
|
@@ -1104,7 +1299,9 @@ async function copyHostTemplate(sourcePath, targetPath) {
|
|
|
1104
1299
|
fs.copyFileSync(sourceEntry, targetEntry);
|
|
1105
1300
|
if (entry.name === "package.json" && process.env.XYD_DEV_MODE) {
|
|
1106
1301
|
const packageJsonPath = targetEntry;
|
|
1107
|
-
const packageJson = JSON.parse(
|
|
1302
|
+
const packageJson = JSON.parse(
|
|
1303
|
+
fs.readFileSync(packageJsonPath, "utf-8")
|
|
1304
|
+
);
|
|
1108
1305
|
packageJson.name = "xyd-host-dev";
|
|
1109
1306
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
1110
1307
|
}
|
|
@@ -1168,7 +1365,9 @@ async function hostPackageJson() {
|
|
|
1168
1365
|
}
|
|
1169
1366
|
async function setupIntegationDependencies(settings) {
|
|
1170
1367
|
const dependencies = {};
|
|
1171
|
-
for (const [key, value] of Object.entries(
|
|
1368
|
+
for (const [key, value] of Object.entries(
|
|
1369
|
+
ANALYTICS_INTEGRATION_DEPENDENCIES
|
|
1370
|
+
)) {
|
|
1172
1371
|
const analytics = settings.integrations?.analytics?.[key];
|
|
1173
1372
|
if (analytics) {
|
|
1174
1373
|
for (const [depName, depVersion] of Object.entries(value)) {
|
|
@@ -1201,11 +1400,15 @@ async function setupPluginDependencies(settings, install2 = false) {
|
|
|
1201
1400
|
const cwdPackageJsonPath = path2.join(process.cwd(), "package.json");
|
|
1202
1401
|
let userDeps = {};
|
|
1203
1402
|
if (fs.existsSync(cwdPackageJsonPath)) {
|
|
1204
|
-
const cwdPackageJson = JSON.parse(
|
|
1403
|
+
const cwdPackageJson = JSON.parse(
|
|
1404
|
+
fs.readFileSync(cwdPackageJsonPath, "utf-8")
|
|
1405
|
+
);
|
|
1205
1406
|
userDeps = cwdPackageJson.dependencies || {};
|
|
1206
1407
|
}
|
|
1207
1408
|
if (fs.existsSync(hostPackageJsonPath)) {
|
|
1208
|
-
const hostPackageJson2 = JSON.parse(
|
|
1409
|
+
const hostPackageJson2 = JSON.parse(
|
|
1410
|
+
fs.readFileSync(hostPackageJsonPath, "utf-8")
|
|
1411
|
+
);
|
|
1209
1412
|
const deps = hostPackageJson2.dependencies || {};
|
|
1210
1413
|
const matchingUserDep = Object.entries(userDeps).find(([depName]) => {
|
|
1211
1414
|
return depName === pluginName;
|
|
@@ -1281,7 +1484,9 @@ function pmInstall() {
|
|
|
1281
1484
|
return bunInstall();
|
|
1282
1485
|
}
|
|
1283
1486
|
default: {
|
|
1284
|
-
console.warn(
|
|
1487
|
+
console.warn(
|
|
1488
|
+
`Unknown package manager: ${process.env.XYD_NODE_PM}, falling back to npm`
|
|
1489
|
+
);
|
|
1285
1490
|
return npmInstall();
|
|
1286
1491
|
}
|
|
1287
1492
|
}
|
|
@@ -1363,6 +1568,24 @@ function getStoredChecksum() {
|
|
|
1363
1568
|
return null;
|
|
1364
1569
|
}
|
|
1365
1570
|
}
|
|
1571
|
+
function lookupPaths(value) {
|
|
1572
|
+
const basePath = globalThis.__xydBasePath;
|
|
1573
|
+
const tryPaths = [];
|
|
1574
|
+
if (path2.isAbsolute(value)) {
|
|
1575
|
+
tryPaths.push(value);
|
|
1576
|
+
} else {
|
|
1577
|
+
tryPaths.push(
|
|
1578
|
+
path2.join(process.cwd(), value),
|
|
1579
|
+
path2.join(process.cwd(), "public", value),
|
|
1580
|
+
path2.join(getAppRoot(), value),
|
|
1581
|
+
path2.join(getHostPath(), value)
|
|
1582
|
+
);
|
|
1583
|
+
if (typeof basePath === "string" && basePath) {
|
|
1584
|
+
tryPaths.push(path2.join(basePath, value));
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
return tryPaths;
|
|
1588
|
+
}
|
|
1366
1589
|
function storeChecksum(checksum) {
|
|
1367
1590
|
const checksumPath = path2.join(getHostPath(), ".xydchecksum");
|
|
1368
1591
|
try {
|
|
@@ -1832,6 +2055,7 @@ async function dev(options) {
|
|
|
1832
2055
|
if (isContentFile && !renameContentFile) {
|
|
1833
2056
|
console.log("\u{1F504} Content file changed, refresh...");
|
|
1834
2057
|
invalidateSettings(server);
|
|
2058
|
+
pluginLLMMarkdown(respPluginDocs);
|
|
1835
2059
|
await touchLayoutPage();
|
|
1836
2060
|
console.log("\u2714 xyd content file changed\n");
|
|
1837
2061
|
return;
|