@xyd-js/plugin-docs 0.0.0-build-87e0566-20251013171826 → 0.0.0-build-6675456-20251014012658
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 +1 -32
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/src/presets/docs/settings.ts +3 -42
package/dist/index.js
CHANGED
|
@@ -5800,6 +5800,7 @@ var js_yaml_default = jsYaml;
|
|
|
5800
5800
|
|
|
5801
5801
|
// src/presets/docs/settings.ts
|
|
5802
5802
|
import { getThemeColors } from "@code-hike/lighter";
|
|
5803
|
+
import { replaceEnvVars } from "@xyd-js/cli-sdk";
|
|
5803
5804
|
var extensions = ["tsx", "ts", "json"];
|
|
5804
5805
|
async function readSettings() {
|
|
5805
5806
|
const dirPath = process.cwd();
|
|
@@ -6005,38 +6006,6 @@ async function loadEnvFiles(dirPath) {
|
|
|
6005
6006
|
console.warn("\u26A0\uFE0F Error loading .env files:", error);
|
|
6006
6007
|
}
|
|
6007
6008
|
}
|
|
6008
|
-
function replaceEnvVars(obj) {
|
|
6009
|
-
if (obj === null || obj === void 0) {
|
|
6010
|
-
return obj;
|
|
6011
|
-
}
|
|
6012
|
-
if (typeof obj === "string") {
|
|
6013
|
-
if (obj.includes("$")) {
|
|
6014
|
-
return obj.replace(/\$([A-Z_][A-Z0-9_]*)/g, (match, varName) => {
|
|
6015
|
-
const envValue = process.env[varName];
|
|
6016
|
-
if (envValue === void 0) {
|
|
6017
|
-
console.warn(
|
|
6018
|
-
`
|
|
6019
|
-
\u26A0\uFE0F Environment variable "${varName}" is not set, keeping placeholder: ${match}`
|
|
6020
|
-
);
|
|
6021
|
-
return match;
|
|
6022
|
-
}
|
|
6023
|
-
return envValue;
|
|
6024
|
-
});
|
|
6025
|
-
}
|
|
6026
|
-
return obj;
|
|
6027
|
-
}
|
|
6028
|
-
if (Array.isArray(obj)) {
|
|
6029
|
-
return obj.map((item) => replaceEnvVars(item));
|
|
6030
|
-
}
|
|
6031
|
-
if (typeof obj === "object") {
|
|
6032
|
-
const result = {};
|
|
6033
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
6034
|
-
result[key] = replaceEnvVars(value);
|
|
6035
|
-
}
|
|
6036
|
-
return result;
|
|
6037
|
-
}
|
|
6038
|
-
return obj;
|
|
6039
|
-
}
|
|
6040
6009
|
function isUrl(str3) {
|
|
6041
6010
|
try {
|
|
6042
6011
|
new URL(str3);
|