@intlayer/config 8.1.2 → 8.1.3
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/cjs/_virtual/_rolldown/runtime.cjs +1 -43
- package/dist/cjs/built.cjs +1 -7
- package/dist/cjs/built.cjs.map +1 -1
- package/dist/cjs/client.cjs +1 -40
- package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -188
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/configFile/getConfiguration.cjs +1 -70
- package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
- package/dist/cjs/configFile/index.cjs +1 -10
- package/dist/cjs/configFile/loadConfigurationFile.cjs +1 -33
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -51
- package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
- package/dist/cjs/defaultValues/build.cjs +1 -29
- package/dist/cjs/defaultValues/build.cjs.map +1 -1
- package/dist/cjs/defaultValues/compiler.cjs +1 -24
- package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +1 -56
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/defaultValues/dictionary.cjs +1 -26
- package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
- package/dist/cjs/defaultValues/editor.cjs +1 -41
- package/dist/cjs/defaultValues/editor.cjs.map +1 -1
- package/dist/cjs/defaultValues/index.cjs +1 -78
- package/dist/cjs/defaultValues/internationalization.cjs +1 -27
- package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
- package/dist/cjs/defaultValues/log.cjs +1 -21
- package/dist/cjs/defaultValues/log.cjs.map +1 -1
- package/dist/cjs/defaultValues/routing.cjs +1 -35
- package/dist/cjs/defaultValues/routing.cjs.map +1 -1
- package/dist/cjs/defaultValues/system.cjs +1 -47
- package/dist/cjs/defaultValues/system.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -81
- package/dist/cjs/loadEnvFile.cjs +1 -36
- package/dist/cjs/loadEnvFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleFile.cjs +1 -71
- package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs +2 -0
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs.map +1 -0
- package/dist/cjs/loadExternalFile/index.cjs +1 -0
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -79
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -77
- package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -63
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
- package/dist/cjs/logger.cjs +1 -150
- package/dist/cjs/logger.cjs.map +1 -1
- package/dist/cjs/node.cjs +1 -0
- package/dist/cjs/utils/ESMxCJSHelpers.cjs +1 -27
- package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
- package/dist/cjs/utils/alias.cjs +2 -0
- package/dist/cjs/utils/alias.cjs.map +1 -0
- package/dist/cjs/utils/cacheDisk.cjs +1 -162
- package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
- package/dist/cjs/utils/cacheMemory.cjs +1 -269
- package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
- package/dist/cjs/utils/clearModuleCache.cjs +1 -26
- package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
- package/dist/cjs/utils/compareVersions.cjs +1 -38
- package/dist/cjs/utils/compareVersions.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +1 -95
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
- package/dist/cjs/utils/getExtension.cjs +1 -14
- package/dist/cjs/utils/getExtension.cjs.map +1 -1
- package/dist/cjs/utils/getPackageJsonPath.cjs +1 -35
- package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -0
- package/dist/cjs/utils/logStack.cjs +1 -16
- package/dist/cjs/utils/logStack.cjs.map +1 -1
- package/dist/cjs/utils/normalizePath.cjs +1 -17
- package/dist/cjs/utils/normalizePath.cjs.map +1 -1
- package/dist/cjs/utils/retryManager.cjs +2 -0
- package/dist/cjs/utils/retryManager.cjs.map +1 -0
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs +1 -13
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs +1 -16
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/index.cjs +1 -10
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs +1 -14
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs +1 -19
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -22
- package/dist/esm/built.mjs +1 -7
- package/dist/esm/built.mjs.map +1 -1
- package/dist/esm/client.mjs +1 -11
- package/dist/esm/configFile/buildConfigurationFields.mjs +1 -186
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/configFile/getConfiguration.mjs +1 -67
- package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
- package/dist/esm/configFile/index.mjs +1 -5
- package/dist/esm/configFile/loadConfigurationFile.mjs +1 -32
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs +1 -48
- package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
- package/dist/esm/defaultValues/build.mjs +1 -18
- package/dist/esm/defaultValues/build.mjs.map +1 -1
- package/dist/esm/defaultValues/compiler.mjs +1 -19
- package/dist/esm/defaultValues/compiler.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +1 -43
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/defaultValues/dictionary.mjs +1 -16
- package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
- package/dist/esm/defaultValues/editor.mjs +1 -26
- package/dist/esm/defaultValues/editor.mjs.map +1 -1
- package/dist/esm/defaultValues/index.mjs +1 -24
- package/dist/esm/defaultValues/internationalization.mjs +1 -17
- package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
- package/dist/esm/defaultValues/log.mjs +1 -13
- package/dist/esm/defaultValues/log.mjs.map +1 -1
- package/dist/esm/defaultValues/routing.mjs +1 -22
- package/dist/esm/defaultValues/routing.mjs.map +1 -1
- package/dist/esm/defaultValues/system.mjs +1 -30
- package/dist/esm/defaultValues/system.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -28
- package/dist/esm/loadEnvFile.mjs +1 -32
- package/dist/esm/loadEnvFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleFile.mjs +1 -67
- package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleJSFile.mjs +2 -0
- package/dist/esm/loadExternalFile/bundleJSFile.mjs.map +1 -0
- package/dist/esm/loadExternalFile/index.mjs +1 -0
- package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -75
- package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -73
- package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +1 -60
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
- package/dist/esm/logger.mjs +1 -133
- package/dist/esm/logger.mjs.map +1 -1
- package/dist/esm/node.mjs +1 -0
- package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -24
- package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
- package/dist/esm/utils/alias.mjs +2 -0
- package/dist/esm/utils/alias.mjs.map +1 -0
- package/dist/esm/utils/cacheDisk.mjs +1 -159
- package/dist/esm/utils/cacheDisk.mjs.map +1 -1
- package/dist/esm/utils/cacheMemory.mjs +1 -261
- package/dist/esm/utils/cacheMemory.mjs.map +1 -1
- package/dist/esm/utils/clearModuleCache.mjs +1 -25
- package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
- package/dist/esm/utils/compareVersions.mjs +1 -36
- package/dist/esm/utils/compareVersions.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +1 -93
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
- package/dist/esm/utils/getExtension.mjs +1 -12
- package/dist/esm/utils/getExtension.mjs.map +1 -1
- package/dist/esm/utils/getPackageJsonPath.mjs +1 -32
- package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -0
- package/dist/esm/utils/logStack.mjs +1 -15
- package/dist/esm/utils/logStack.mjs.map +1 -1
- package/dist/esm/utils/normalizePath.mjs +1 -15
- package/dist/esm/utils/normalizePath.mjs.map +1 -1
- package/dist/esm/utils/retryManager.mjs +2 -0
- package/dist/esm/utils/retryManager.mjs.map +1 -0
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs +1 -11
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs +1 -14
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/index.mjs +1 -6
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs +1 -12
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs +1 -17
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs.map +1 -1
- package/dist/types/index.d.ts +15 -9
- package/dist/types/{bundleJSFile.d.ts → loadExternalFile/bundleJSFile.d.ts} +1 -1
- package/dist/types/loadExternalFile/bundleJSFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/index.d.ts +6 -0
- package/dist/types/loadExternalFile/loadExternalFile.d.ts +2 -3
- package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -1
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +2 -3
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +1 -1
- package/dist/types/node.d.ts +5 -0
- package/dist/types/{alias.d.ts → utils/alias.d.ts} +1 -1
- package/dist/types/utils/alias.d.ts.map +1 -0
- package/dist/types/utils/getPackageJsonPath.d.ts +1 -2
- package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/{retryManager.d.ts → utils/retryManager.d.ts} +1 -1
- package/dist/types/utils/retryManager.d.ts.map +1 -0
- package/package.json +42 -10
- package/dist/cjs/alias.cjs +0 -30
- package/dist/cjs/alias.cjs.map +0 -1
- package/dist/cjs/bundleJSFile.cjs +0 -34
- package/dist/cjs/bundleJSFile.cjs.map +0 -1
- package/dist/cjs/retryManager.cjs +0 -46
- package/dist/cjs/retryManager.cjs.map +0 -1
- package/dist/esm/alias.mjs +0 -28
- package/dist/esm/alias.mjs.map +0 -1
- package/dist/esm/bundleJSFile.mjs +0 -32
- package/dist/esm/bundleJSFile.mjs.map +0 -1
- package/dist/esm/retryManager.mjs +0 -45
- package/dist/esm/retryManager.mjs.map +0 -1
- package/dist/types/alias.d.ts.map +0 -1
- package/dist/types/bundleJSFile.d.ts.map +0 -1
- package/dist/types/retryManager.d.ts.map +0 -1
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_cacheMemory = require('./cacheMemory.cjs');
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
let node_fs = require("node:fs");
|
|
6
|
-
|
|
7
|
-
//#region src/utils/getPackageJsonPath.ts
|
|
8
|
-
const isESModule = typeof require("url").pathToFileURL(__filename).href === "string";
|
|
9
|
-
const MAX_LEVELS = 15;
|
|
10
|
-
const getPackageJsonPath = (startDir = process.cwd()) => {
|
|
11
|
-
const checkedCache = require_utils_cacheMemory.cacheMemory.get("packageJsonPath", startDir);
|
|
12
|
-
if (checkedCache) return checkedCache;
|
|
13
|
-
let currentDir = startDir;
|
|
14
|
-
for (let level = 0; level < MAX_LEVELS; level++) {
|
|
15
|
-
const packageJsonPath = (0, node_path.join)(currentDir, "package.json");
|
|
16
|
-
if ((0, node_fs.existsSync)(packageJsonPath)) {
|
|
17
|
-
require_utils_cacheMemory.cacheMemory.set("packageJsonPath", startDir, {
|
|
18
|
-
packageJsonPath,
|
|
19
|
-
baseDir: currentDir
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
packageJsonPath,
|
|
23
|
-
baseDir: currentDir
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const parentDir = (0, node_path.dirname)(currentDir);
|
|
27
|
-
if (parentDir === currentDir) break;
|
|
28
|
-
currentDir = parentDir;
|
|
29
|
-
}
|
|
30
|
-
throw new Error(`Could not find package.json in current directory or any of the ${MAX_LEVELS} parent directories. Searched from: ${startDir}`);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.getPackageJsonPath = getPackageJsonPath;
|
|
35
|
-
exports.isESModule = isESModule;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./cacheMemory.cjs`);let t=require(`node:path`),n=require(`node:fs`);const r=(r=process.cwd())=>{let i=e.cacheMemory.get(`packageJsonPath`,r);if(i)return i;let a=r;for(let i=0;i<15;i++){let i=(0,t.join)(a,`package.json`);if((0,n.existsSync)(i))return e.cacheMemory.set(`packageJsonPath`,r,{packageJsonPath:i,baseDir:a}),{packageJsonPath:i,baseDir:a};let o=(0,t.dirname)(a);if(o===a)break;a=o}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${r}`)};exports.getPackageJsonPath=r;
|
|
36
2
|
//# sourceMappingURL=getPackageJsonPath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageJsonPath.cjs","names":["cacheMemory"],"sources":["../../../src/utils/getPackageJsonPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cacheMemory } from './cacheMemory';\n\
|
|
1
|
+
{"version":3,"file":"getPackageJsonPath.cjs","names":["cacheMemory"],"sources":["../../../src/utils/getPackageJsonPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cacheMemory } from './cacheMemory';\n\nconst MAX_LEVELS = 15;\n\ntype PackageJsonPathCache = {\n packageJsonPath: string;\n baseDir: string;\n};\n\nexport const getPackageJsonPath = (\n startDir: string = process.cwd()\n): PackageJsonPathCache => {\n const checkedCache = cacheMemory.get<PackageJsonPathCache>(\n 'packageJsonPath',\n startDir\n );\n\n if (checkedCache) return checkedCache;\n\n let currentDir = startDir;\n\n for (let level = 0; level < MAX_LEVELS; level++) {\n const packageJsonPath = join(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n cacheMemory.set('packageJsonPath', startDir, {\n packageJsonPath,\n baseDir: currentDir,\n });\n\n return { packageJsonPath, baseDir: currentDir };\n }\n\n const parentDir = dirname(currentDir);\n\n // If we've reached the root directory, stop\n if (parentDir === currentDir) {\n break;\n }\n\n currentDir = parentDir;\n }\n\n throw new Error(\n `Could not find package.json in current directory or any of the ${MAX_LEVELS} parent directories. Searched from: ${startDir}`\n );\n};\n"],"mappings":"qMAIA,MAOa,GACX,EAAmB,QAAQ,KAAK,GACP,CACzB,IAAM,EAAeA,EAAAA,YAAY,IAC/B,kBACA,EACD,CAED,GAAI,EAAc,OAAO,EAEzB,IAAI,EAAa,EAEjB,IAAK,IAAI,EAAQ,EAAG,EAAQ,GAAY,IAAS,CAC/C,IAAM,GAAA,EAAA,EAAA,MAAuB,EAAY,eAAe,CAExD,IAAA,EAAA,EAAA,YAAe,EAAgB,CAM7B,OALA,EAAA,YAAY,IAAI,kBAAmB,EAAU,CAC3C,kBACA,QAAS,EACV,CAAC,CAEK,CAAE,kBAAiB,QAAS,EAAY,CAGjD,IAAM,GAAA,EAAA,EAAA,SAAoB,EAAW,CAGrC,GAAI,IAAc,EAChB,MAGF,EAAa,EAGf,MAAU,MACR,wGAAmH,IACpH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./cacheMemory.cjs`),t=require(`./getPackageJsonPath.cjs`),n=require(`./normalizePath.cjs`),r=require(`./ESMxCJSHelpers.cjs`),i=require(`./extractErrorMessage.cjs`),a=require(`./logStack.cjs`),o=require(`./stringFormatter/camelCaseToKebabCase.cjs`),s=require(`./stringFormatter/camelCaseToSentence.cjs`),c=require(`./stringFormatter/kebabCaseToCamelCase.cjs`),l=require(`./stringFormatter/toLowerCamelCase.cjs`),u=require(`./getExtension.cjs`),d=require(`./alias.cjs`),f=require(`./cacheDisk.cjs`),p=require(`./clearModuleCache.cjs`),m=require(`./compareVersions.cjs`),h=require(`./retryManager.cjs`);exports.cacheDisk=f.cacheDisk,exports.cacheMemory=e.cacheMemory,exports.camelCaseToKebabCase=o.camelCaseToKebabCase,exports.camelCaseToSentence=s.camelCaseToSentence,exports.clearAllCache=e.clearAllCache,exports.clearCache=e.clearCache,exports.clearModuleCache=p.clearModuleCache,exports.compareVersions=m.compareVersions,exports.computeKeyId=e.computeKeyId,exports.configESMxCJSRequire=r.configESMxCJSRequire,exports.extractErrorMessage=i.extractErrorMessage,exports.getAlias=d.getAlias,exports.getCache=e.getCache,exports.getExtension=u.getExtension,exports.getPackageJsonPath=t.getPackageJsonPath,exports.getProjectRequire=r.getProjectRequire,exports.isESModule=r.isESModule,exports.kebabCaseToCamelCase=c.kebabCaseToCamelCase,exports.logStack=a.logStack,exports.normalizePath=n.normalizePath,exports.retryManager=h.retryManager,exports.setCache=e.setCache,exports.stableStringify=e.stableStringify,exports.toLowerCamelCase=l.toLowerCamelCase;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_logger = require('../logger.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/utils/logStack.ts
|
|
5
|
-
const logStack = (message, options = { limit: 50 }) => {
|
|
6
|
-
Error.stackTraceLimit = options.limit;
|
|
7
|
-
try {
|
|
8
|
-
throw new Error("test");
|
|
9
|
-
} catch (error) {
|
|
10
|
-
console.log(require_logger.colorize(message, require_logger.ANSIColors.YELLOW));
|
|
11
|
-
console.log(require_logger.colorize(error.stack ?? "", require_logger.ANSIColors.BLUE));
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
exports.logStack = logStack;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../logger.cjs`),t=(t,n={limit:50})=>{Error.stackTraceLimit=n.limit;try{throw Error(`test`)}catch(n){console.log(e.colorize(t,e.ANSIColors.YELLOW)),console.log(e.colorize(n.stack??``,e.ANSIColors.BLUE))}};exports.logStack=t;
|
|
17
2
|
//# sourceMappingURL=logStack.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStack.cjs","names":["colorize","ANSIColors"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import { ANSIColors, colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"logStack.cjs","names":["colorize","ANSIColors"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import { ANSIColors, colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":"oGAEa,GACX,EACA,EAA6B,CAAE,MAAO,GAAI,GACvC,CACH,MAAM,gBAAkB,EAAQ,MAEhC,GAAI,CACF,MAAU,MAAM,OAAO,OAChB,EAAO,CACd,QAAQ,IAAIA,EAAAA,SAAS,EAASC,EAAAA,WAAW,OAAO,CAAC,CACjD,QAAQ,IAAID,EAAAA,SAAU,EAAgB,OAAS,GAAIC,EAAAA,WAAW,KAAK,CAAC"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/normalizePath.ts
|
|
4
|
-
/**
|
|
5
|
-
* Normalize a path for glob by replacing backslashes with forward slashes
|
|
6
|
-
*
|
|
7
|
-
* Utils for Windows compatibility, as Glob pattern as `**\\*.js` is not supported
|
|
8
|
-
*
|
|
9
|
-
* C:\\Users\\John\\Desktop\\test.txt -> C:/Users/John/Desktop/test.txt
|
|
10
|
-
*
|
|
11
|
-
* @param path - The path to normalize
|
|
12
|
-
* @returns The normalized path
|
|
13
|
-
*/
|
|
14
|
-
const normalizePath = (path) => path.replace(/\\/g, "/");
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
exports.normalizePath = normalizePath;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e.replace(/\\/g,`/`);exports.normalizePath=e;
|
|
18
2
|
//# sourceMappingURL=normalizePath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePath.cjs","names":[],"sources":["../../../src/utils/normalizePath.ts"],"sourcesContent":["/**\n * Normalize a path for glob by replacing backslashes with forward slashes\n *\n * Utils for Windows compatibility, as Glob pattern as `**\\\\*.js` is not supported\n *\n * C:\\\\Users\\\\John\\\\Desktop\\\\test.txt -> C:/Users/John/Desktop/test.txt\n *\n * @param path - The path to normalize\n * @returns The normalized path\n */\nexport const normalizePath = (path: string): string => path.replace(/\\\\/g, '/');\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizePath.cjs","names":[],"sources":["../../../src/utils/normalizePath.ts"],"sourcesContent":["/**\n * Normalize a path for glob by replacing backslashes with forward slashes\n *\n * Utils for Windows compatibility, as Glob pattern as `**\\\\*.js` is not supported\n *\n * C:\\\\Users\\\\John\\\\Desktop\\\\test.txt -> C:/Users/John/Desktop/test.txt\n *\n * @param path - The path to normalize\n * @returns The normalized path\n */\nexport const normalizePath = (path: string): string => path.replace(/\\\\/g, '/');\n"],"mappings":"mEAUA,MAAa,EAAiB,GAAyB,EAAK,QAAQ,MAAO,IAAI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../logger.cjs`),t=require(`./extractErrorMessage.cjs`),n=(n,{maxRetry:r=3,delay:i=0,onError:a,onMaxTryReached:o}={})=>async(...s)=>{let c;for(let l=0;l<=r;l++)try{return await n(...s)}catch(n){c=n;let s=t.extractErrorMessage(n);if(l>=r){if(o)return o?.({error:s,attempt:l,maxRetry:r}),null;throw n}a?a?.({error:s,attempt:l,maxRetry:r}):e.logger(s,{level:`error`}),i>0&&await new Promise(e=>setTimeout(e,i))}throw c??Error(`Unexpected: retry loop completed without result`)};exports.retryManager=n;
|
|
2
|
+
//# sourceMappingURL=retryManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryManager.cjs","names":["extractErrorMessage"],"sources":["../../../src/utils/retryManager.ts"],"sourcesContent":["import { logger } from '../logger';\nimport { extractErrorMessage } from './extractErrorMessage';\n\nexport type RetryManagerOptions = {\n /** maximum number of retries before giving up */\n maxRetry?: number;\n /** delay between attempts, in milliseconds */\n delay?: number;\n /** function to call when an error occurs */\n onError?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n /** function to call when the maximum number of retries is reached */\n onMaxTryReached?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n};\n\nconst DEFAULT_MAX_RETRY = 3;\nconst DEFAULT_DELAY = 0;\n\n/**\n * Wrap an async function `fn` so it’s retried on failure.\n *\n * @param fn The async function to wrap\n * @param options { maxRetry, delay }\n * @returns A new function with the same signature as `fn`\n */\nexport const retryManager =\n <Args extends any[], R>(\n fn: (...args: Args) => Promise<R>,\n {\n maxRetry = DEFAULT_MAX_RETRY,\n delay = DEFAULT_DELAY,\n onError,\n onMaxTryReached,\n }: RetryManagerOptions = {}\n ): ((...args: Args) => Promise<R>) =>\n // ───────────────────────────────^ returned wrapper function\n async (...args: Args): Promise<R> => {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= maxRetry; attempt++) {\n try {\n return await fn(...args);\n } catch (err) {\n lastError = err;\n const error = extractErrorMessage(err);\n\n // If this was the last attempt, handle max retry reached\n if (attempt >= maxRetry) {\n if (onMaxTryReached) {\n onMaxTryReached?.({ error, attempt, maxRetry });\n return null as R;\n }\n\n // Otherwise, throw the error\n throw err;\n }\n\n if (onError) {\n onError?.({ error, attempt, maxRetry });\n } else {\n logger(error, {\n level: 'error',\n });\n }\n\n // Wait before retrying\n if (delay > 0) {\n await new Promise((res) => setTimeout(res, delay));\n }\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw (\n lastError ?? new Error('Unexpected: retry loop completed without result')\n );\n };\n"],"mappings":"2IAgCa,GAET,EACA,CACE,WAAW,EACX,QAAQ,EACR,UACA,mBACuB,EAAE,GAG7B,MAAO,GAAG,IAA2B,CACnC,IAAI,EAEJ,IAAK,IAAI,EAAU,EAAG,GAAW,EAAU,IACzC,GAAI,CACF,OAAO,MAAM,EAAG,GAAG,EAAK,OACjB,EAAK,CACZ,EAAY,EACZ,IAAM,EAAQA,EAAAA,oBAAoB,EAAI,CAGtC,GAAI,GAAW,EAAU,CACvB,GAAI,EAEF,OADA,IAAkB,CAAE,QAAO,UAAS,WAAU,CAAC,CACxC,KAIT,MAAM,EAGJ,EACF,IAAU,CAAE,QAAO,UAAS,WAAU,CAAC,CAEvC,EAAA,OAAO,EAAO,CACZ,MAAO,QACR,CAAC,CAIA,EAAQ,GACV,MAAM,IAAI,QAAS,GAAQ,WAAW,EAAK,EAAM,CAAC,CAMxD,MACE,GAAiB,MAAM,kDAAkD"}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/stringFormatter/camelCaseToKebabCase.ts
|
|
4
|
-
/**
|
|
5
|
-
* Convert a string to kebab-case
|
|
6
|
-
* e.g. "MyNewComponent" => "my-new-component"
|
|
7
|
-
*/
|
|
8
|
-
const camelCaseToKebabCase = (str) => {
|
|
9
|
-
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
exports.camelCaseToKebabCase = camelCaseToKebabCase;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e.replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase();exports.camelCaseToKebabCase=e;
|
|
14
2
|
//# sourceMappingURL=camelCaseToKebabCase.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camelCaseToKebabCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/camelCaseToKebabCase.ts"],"sourcesContent":["/**\n * Convert a string to kebab-case\n * e.g. \"MyNewComponent\" => \"my-new-component\"\n */\nexport const camelCaseToKebabCase = (str: string): string => {\n // Split on transition from lower->upper: \"MyNewComponent\" => [\"My\", \"New\", \"Component\"]\n // Then lowercase each chunk and join by \"-\"\n return str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')\n .toLowerCase();\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"camelCaseToKebabCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/camelCaseToKebabCase.ts"],"sourcesContent":["/**\n * Convert a string to kebab-case\n * e.g. \"MyNewComponent\" => \"my-new-component\"\n */\nexport const camelCaseToKebabCase = (str: string): string => {\n // Split on transition from lower->upper: \"MyNewComponent\" => [\"My\", \"New\", \"Component\"]\n // Then lowercase each chunk and join by \"-\"\n return str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')\n .toLowerCase();\n};\n"],"mappings":"mEAIA,MAAa,EAAwB,GAG5B,EACJ,QAAQ,kBAAmB,QAAQ,CACnC,QAAQ,uBAAwB,QAAQ,CACxC,aAAa"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/stringFormatter/camelCaseToSentence.ts
|
|
4
|
-
/**
|
|
5
|
-
* Convert a string to sentence case
|
|
6
|
-
* e.g. 'my-new-component' → 'My new component'
|
|
7
|
-
*/
|
|
8
|
-
const camelCaseToSentence = (value) => {
|
|
9
|
-
if (!value) return "";
|
|
10
|
-
if (typeof value !== "string") return "";
|
|
11
|
-
const withSpaces = value.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2");
|
|
12
|
-
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1).toLowerCase();
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
exports.camelCaseToSentence = camelCaseToSentence;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>{if(!e||typeof e!=`string`)return``;let t=e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()};exports.camelCaseToSentence=e;
|
|
17
2
|
//# sourceMappingURL=camelCaseToSentence.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camelCaseToSentence.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/camelCaseToSentence.ts"],"sourcesContent":["/**\n * Convert a string to sentence case\n * e.g. 'my-new-component' → 'My new component'\n */\nexport const camelCaseToSentence = (value: string): string => {\n if (!value) return '';\n if (typeof value !== 'string') return '';\n\n // Insert space before all caps that follow lowercase letters\n const withSpaces = value\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n // Insert space between sequences like \"XMLParser\" → \"XML Parser\"\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');\n\n // Lowercase everything except the first character\n return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1).toLowerCase();\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"camelCaseToSentence.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/camelCaseToSentence.ts"],"sourcesContent":["/**\n * Convert a string to sentence case\n * e.g. 'my-new-component' → 'My new component'\n */\nexport const camelCaseToSentence = (value: string): string => {\n if (!value) return '';\n if (typeof value !== 'string') return '';\n\n // Insert space before all caps that follow lowercase letters\n const withSpaces = value\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n // Insert space between sequences like \"XMLParser\" → \"XML Parser\"\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');\n\n // Lowercase everything except the first character\n return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1).toLowerCase();\n};\n"],"mappings":"mEAIA,MAAa,EAAuB,GAA0B,CAE5D,GADI,CAAC,GACD,OAAO,GAAU,SAAU,MAAO,GAGtC,IAAM,EAAa,EAChB,QAAQ,kBAAmB,QAAQ,CAEnC,QAAQ,wBAAyB,QAAQ,CAG5C,OAAO,EAAW,OAAO,EAAE,CAAC,aAAa,CAAG,EAAW,MAAM,EAAE,CAAC,aAAa"}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_utils_stringFormatter_camelCaseToKebabCase = require('./camelCaseToKebabCase.cjs');
|
|
3
|
-
const require_utils_stringFormatter_camelCaseToSentence = require('./camelCaseToSentence.cjs');
|
|
4
|
-
const require_utils_stringFormatter_kebabCaseToCamelCase = require('./kebabCaseToCamelCase.cjs');
|
|
5
|
-
const require_utils_stringFormatter_toLowerCamelCase = require('./toLowerCamelCase.cjs');
|
|
6
|
-
|
|
7
|
-
exports.camelCaseToKebabCase = require_utils_stringFormatter_camelCaseToKebabCase.camelCaseToKebabCase;
|
|
8
|
-
exports.camelCaseToSentence = require_utils_stringFormatter_camelCaseToSentence.camelCaseToSentence;
|
|
9
|
-
exports.kebabCaseToCamelCase = require_utils_stringFormatter_kebabCaseToCamelCase.kebabCaseToCamelCase;
|
|
10
|
-
exports.toLowerCamelCase = require_utils_stringFormatter_toLowerCamelCase.toLowerCamelCase;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./camelCaseToKebabCase.cjs`),t=require(`./camelCaseToSentence.cjs`),n=require(`./kebabCaseToCamelCase.cjs`),r=require(`./toLowerCamelCase.cjs`);exports.camelCaseToKebabCase=e.camelCaseToKebabCase,exports.camelCaseToSentence=t.camelCaseToSentence,exports.kebabCaseToCamelCase=n.kebabCaseToCamelCase,exports.toLowerCamelCase=r.toLowerCamelCase;
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/stringFormatter/kebabCaseToCamelCase.ts
|
|
4
|
-
const kebabCaseToCamelCase = (name) => {
|
|
5
|
-
return name.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((word) => {
|
|
6
|
-
const lowerWord = word.toLowerCase();
|
|
7
|
-
let capitalized = lowerWord.charAt(0).toUpperCase() + lowerWord.slice(1);
|
|
8
|
-
capitalized = capitalized.replace(/(\d)([a-z])/g, (_, number, char) => number + char.toUpperCase());
|
|
9
|
-
return capitalized;
|
|
10
|
-
}).join("");
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
exports.kebabCaseToCamelCase = kebabCaseToCamelCase;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>{let t=e.toLowerCase(),n=t.charAt(0).toUpperCase()+t.slice(1);return n=n.replace(/(\d)([a-z])/g,(e,t,n)=>t+n.toUpperCase()),n}).join(``);exports.kebabCaseToCamelCase=e;
|
|
15
2
|
//# sourceMappingURL=kebabCaseToCamelCase.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kebabCaseToCamelCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/kebabCaseToCamelCase.ts"],"sourcesContent":["export const kebabCaseToCamelCase = (name: string): string => {\n return name\n .split(/[^a-zA-Z0-9]+/) // Split on any non-alphanumeric character\n .filter(Boolean) // Remove any empty strings\n .map((word) => {\n // Convert the entire word to lowercase first\n const lowerWord = word.toLowerCase();\n\n // Capitalize the first character\n let capitalized = lowerWord.charAt(0).toUpperCase() + lowerWord.slice(1);\n\n // Capitalize any letter that follows a number\n capitalized = capitalized.replace(\n /(\\d)([a-z])/g,\n (_, number, char) => number + char.toUpperCase()\n );\n\n return capitalized;\n })\n .join(''); // Concatenate all parts into a single string\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"kebabCaseToCamelCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/kebabCaseToCamelCase.ts"],"sourcesContent":["export const kebabCaseToCamelCase = (name: string): string => {\n return name\n .split(/[^a-zA-Z0-9]+/) // Split on any non-alphanumeric character\n .filter(Boolean) // Remove any empty strings\n .map((word) => {\n // Convert the entire word to lowercase first\n const lowerWord = word.toLowerCase();\n\n // Capitalize the first character\n let capitalized = lowerWord.charAt(0).toUpperCase() + lowerWord.slice(1);\n\n // Capitalize any letter that follows a number\n capitalized = capitalized.replace(\n /(\\d)([a-z])/g,\n (_, number, char) => number + char.toUpperCase()\n );\n\n return capitalized;\n })\n .join(''); // Concatenate all parts into a single string\n};\n"],"mappings":"mEAAA,MAAa,EAAwB,GAC5B,EACJ,MAAM,gBAAgB,CACtB,OAAO,QAAQ,CACf,IAAK,GAAS,CAEb,IAAM,EAAY,EAAK,aAAa,CAGhC,EAAc,EAAU,OAAO,EAAE,CAAC,aAAa,CAAG,EAAU,MAAM,EAAE,CAQxE,MALA,GAAc,EAAY,QACxB,gBACC,EAAG,EAAQ,IAAS,EAAS,EAAK,aAAa,CACjD,CAEM,GACP,CACD,KAAK,GAAG"}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/stringFormatter/toLowerCamelCase.ts
|
|
4
|
-
/**
|
|
5
|
-
* Convert a string to lowerCamelCase
|
|
6
|
-
* e.g. "MyComponent" => "myComponent"
|
|
7
|
-
* e.g. "auth-middleware" => "authMiddleware"
|
|
8
|
-
*/
|
|
9
|
-
const toLowerCamelCase = (str) => {
|
|
10
|
-
if (!str) return "";
|
|
11
|
-
if (str.includes("-")) return str.split("-").map((word, index) => {
|
|
12
|
-
if (index === 0) return word.toLowerCase();
|
|
13
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
14
|
-
}).join("");
|
|
15
|
-
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
exports.toLowerCamelCase = toLowerCamelCase;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>e?e.includes(`-`)?e.split(`-`).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``):e.charAt(0).toLowerCase()+e.slice(1):``;exports.toLowerCamelCase=e;
|
|
20
2
|
//# sourceMappingURL=toLowerCamelCase.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toLowerCamelCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/toLowerCamelCase.ts"],"sourcesContent":["/**\n * Convert a string to lowerCamelCase\n * e.g. \"MyComponent\" => \"myComponent\"\n * e.g. \"auth-middleware\" => \"authMiddleware\"\n */\nexport const toLowerCamelCase = (str: string): string => {\n if (!str) {\n return '';\n }\n\n // Handle kebab-case: \"auth-middleware\" => \"authMiddleware\"\n if (str.includes('-')) {\n return str\n .split('-')\n .map((word, index) => {\n if (index === 0) {\n return word.toLowerCase();\n }\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n }\n\n // Handle PascalCase: \"MyComponent\" => \"myComponent\"\n return str.charAt(0).toLowerCase() + str.slice(1);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toLowerCamelCase.cjs","names":[],"sources":["../../../../src/utils/stringFormatter/toLowerCamelCase.ts"],"sourcesContent":["/**\n * Convert a string to lowerCamelCase\n * e.g. \"MyComponent\" => \"myComponent\"\n * e.g. \"auth-middleware\" => \"authMiddleware\"\n */\nexport const toLowerCamelCase = (str: string): string => {\n if (!str) {\n return '';\n }\n\n // Handle kebab-case: \"auth-middleware\" => \"authMiddleware\"\n if (str.includes('-')) {\n return str\n .split('-')\n .map((word, index) => {\n if (index === 0) {\n return word.toLowerCase();\n }\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n }\n\n // Handle PascalCase: \"MyComponent\" => \"myComponent\"\n return str.charAt(0).toLowerCase() + str.slice(1);\n};\n"],"mappings":"mEAKA,MAAa,EAAoB,GAC1B,EAKD,EAAI,SAAS,IAAI,CACZ,EACJ,MAAM,IAAI,CACV,KAAK,EAAM,IACN,IAAU,EACL,EAAK,aAAa,CAEpB,EAAK,OAAO,EAAE,CAAC,aAAa,CAAG,EAAK,MAAM,EAAE,CAAC,aAAa,CACjE,CACD,KAAK,GAAG,CAIN,EAAI,OAAO,EAAE,CAAC,aAAa,CAAG,EAAI,MAAM,EAAE,CAjBxC"}
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) {
|
|
6
|
-
__defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
if (!no_symbols) {
|
|
12
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
17
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
18
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { __exportAll, __require };
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});export{t as __exportAll,n as __require};
|
package/dist/esm/built.mjs
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/built.ts
|
|
4
|
-
const configuration = getConfiguration();
|
|
5
|
-
|
|
6
|
-
//#endregion
|
|
7
|
-
export { configuration as default };
|
|
1
|
+
import{getConfiguration as e}from"./configFile/getConfiguration.mjs";const t=e();export{t as default};
|
|
8
2
|
//# sourceMappingURL=built.mjs.map
|
package/dist/esm/built.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built.mjs","names":[],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nexport default configuration;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"built.mjs","names":[],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nexport default configuration;\n"],"mappings":"qEAQA,MAAM,EAAgC,GAAkB"}
|
package/dist/esm/client.mjs
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import { normalizePath } from "./utils/
|
|
2
|
-
import { ANSIColors, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, getAppLogger, getPrefix, logger, removeColor, setPrefix, spinnerFrames, v, x } from "./logger.mjs";
|
|
3
|
-
import { defaultValues_exports } from "./defaultValues/index.mjs";
|
|
4
|
-
import { extractErrorMessage } from "./utils/extractErrorMessage.mjs";
|
|
5
|
-
import { logStack } from "./utils/logStack.mjs";
|
|
6
|
-
import { camelCaseToKebabCase } from "./utils/stringFormatter/camelCaseToKebabCase.mjs";
|
|
7
|
-
import { camelCaseToSentence } from "./utils/stringFormatter/camelCaseToSentence.mjs";
|
|
8
|
-
import { kebabCaseToCamelCase } from "./utils/stringFormatter/kebabCaseToCamelCase.mjs";
|
|
9
|
-
import { toLowerCamelCase } from "./utils/stringFormatter/toLowerCamelCase.mjs";
|
|
10
|
-
|
|
11
|
-
export { ANSIColors, defaultValues_exports as DefaultValues, camelCaseToKebabCase, camelCaseToSentence, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, extractErrorMessage, getAppLogger, getPrefix, kebabCaseToCamelCase, logStack, logger, normalizePath, removeColor, setPrefix, spinnerFrames, toLowerCamelCase, v, x };
|
|
1
|
+
import{ANSIColors as e,clock as t,colon as n,colorize as r,colorizeKey as i,colorizeLocales as a,colorizeNumber as o,colorizePath as s,getAppLogger as c,getPrefix as l,logger as u,removeColor as d,setPrefix as f,spinnerFrames as p,v as m,x as h}from"./logger.mjs";import{normalizePath as g}from"./utils/normalizePath.mjs";import{defaultValues_exports as _}from"./defaultValues/index.mjs";import{extractErrorMessage as v}from"./utils/extractErrorMessage.mjs";import{logStack as y}from"./utils/logStack.mjs";import{camelCaseToKebabCase as b}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as x}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as S}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as C}from"./utils/stringFormatter/toLowerCamelCase.mjs";export{e as ANSIColors,_ as DefaultValues,b as camelCaseToKebabCase,x as camelCaseToSentence,t as clock,n as colon,r as colorize,i as colorizeKey,a as colorizeLocales,o as colorizeNumber,s as colorizePath,v as extractErrorMessage,c as getAppLogger,l as getPrefix,S as kebabCaseToCamelCase,y as logStack,u as logger,g as normalizePath,d as removeColor,f as setPrefix,p as spinnerFrames,C as toLowerCamelCase,m as v,h as x};
|
|
@@ -1,187 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { normalizePath } from "../utils/normalizePath.mjs";
|
|
3
|
-
import { BUILD_MODE, CACHE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from "../defaultValues/build.mjs";
|
|
4
|
-
import { COMPILER_ENABLED, COMPILER_EXCLUDE_PATTERN, COMPILER_OUTPUT_DIR, COMPILER_TRANSFORM_PATTERN } from "../defaultValues/compiler.mjs";
|
|
5
|
-
import { CODE_DIR, CONTENT_DIR, EXCLUDED_PATHS, FILE_EXTENSIONS, WATCH } from "../defaultValues/content.mjs";
|
|
6
|
-
import { CONTENT_AUTO_TRANSFORMATION, FILL, IMPORT_MODE, LOCATION } from "../defaultValues/dictionary.mjs";
|
|
7
|
-
import { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from "../defaultValues/editor.mjs";
|
|
8
|
-
import { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from "../defaultValues/internationalization.mjs";
|
|
9
|
-
import { MODE, PREFIX } from "../defaultValues/log.mjs";
|
|
10
|
-
import { BASE_PATH, ROUTING_MODE, STORAGE } from "../defaultValues/routing.mjs";
|
|
11
|
-
import { CACHE_DIR, CONFIG_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, FETCH_DICTIONARIES_DIR, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR } from "../defaultValues/system.mjs";
|
|
12
|
-
import { dirname, isAbsolute, join } from "node:path";
|
|
13
|
-
import { statSync } from "node:fs";
|
|
14
|
-
import packageJson from "@intlayer/types/package.json" with { type: "json" };
|
|
15
|
-
|
|
16
|
-
//#region src/configFile/buildConfigurationFields.ts
|
|
17
|
-
let storedConfiguration;
|
|
18
|
-
const buildInternationalizationFields = (customConfiguration) => ({
|
|
19
|
-
locales: customConfiguration?.locales ?? LOCALES,
|
|
20
|
-
requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,
|
|
21
|
-
strictMode: customConfiguration?.strictMode ?? STRICT_MODE,
|
|
22
|
-
defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE
|
|
23
|
-
});
|
|
24
|
-
const buildRoutingFields = (customConfiguration) => ({
|
|
25
|
-
mode: customConfiguration?.mode ?? ROUTING_MODE,
|
|
26
|
-
storage: customConfiguration?.storage ?? STORAGE,
|
|
27
|
-
basePath: customConfiguration?.basePath ?? BASE_PATH,
|
|
28
|
-
rewrite: customConfiguration?.rewrite
|
|
29
|
-
});
|
|
30
|
-
const buildContentFields = (customConfiguration, baseDir, logFunctions) => {
|
|
31
|
-
const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;
|
|
32
|
-
const projectBaseDir = customConfiguration?.baseDir ?? baseDir ?? process.cwd();
|
|
33
|
-
const optionalJoinBaseDir = (pathInput) => {
|
|
34
|
-
let absolutePath;
|
|
35
|
-
try {
|
|
36
|
-
absolutePath = __require.resolve(pathInput, { paths: [projectBaseDir] });
|
|
37
|
-
} catch {
|
|
38
|
-
absolutePath = isAbsolute(pathInput) ? pathInput : join(projectBaseDir, pathInput);
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
if (statSync(absolutePath).isFile()) return dirname(absolutePath);
|
|
42
|
-
} catch {
|
|
43
|
-
if (/\.[a-z0-9]+$/i.test(absolutePath)) return dirname(absolutePath);
|
|
44
|
-
}
|
|
45
|
-
return absolutePath;
|
|
46
|
-
};
|
|
47
|
-
const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir);
|
|
48
|
-
return {
|
|
49
|
-
fileExtensions,
|
|
50
|
-
baseDir: projectBaseDir,
|
|
51
|
-
contentDir,
|
|
52
|
-
codeDir: (customConfiguration?.codeDir ?? CODE_DIR).map(optionalJoinBaseDir),
|
|
53
|
-
excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,
|
|
54
|
-
watch: customConfiguration?.watch ?? WATCH,
|
|
55
|
-
formatCommand: customConfiguration?.formatCommand,
|
|
56
|
-
watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),
|
|
57
|
-
watchedFilesPatternWithPath: fileExtensions.flatMap((ext) => contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`))
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const buildSystemFields = (customConfiguration, contentConfig) => {
|
|
61
|
-
const projectBaseDir = contentConfig?.baseDir ?? process.cwd();
|
|
62
|
-
const optionalJoinBaseDir = (pathInput) => {
|
|
63
|
-
let absolutePath;
|
|
64
|
-
try {
|
|
65
|
-
absolutePath = __require.resolve(pathInput, { paths: [projectBaseDir] });
|
|
66
|
-
} catch {
|
|
67
|
-
absolutePath = isAbsolute(pathInput) ? pathInput : join(projectBaseDir, pathInput);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
if (statSync(absolutePath).isFile()) return dirname(absolutePath);
|
|
71
|
-
} catch {
|
|
72
|
-
if (/\.[a-z0-9]+$/i.test(absolutePath)) return dirname(absolutePath);
|
|
73
|
-
}
|
|
74
|
-
return absolutePath;
|
|
75
|
-
};
|
|
76
|
-
const dictionariesDir = optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR);
|
|
77
|
-
return {
|
|
78
|
-
moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),
|
|
79
|
-
unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),
|
|
80
|
-
remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),
|
|
81
|
-
dictionariesDir,
|
|
82
|
-
dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),
|
|
83
|
-
fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),
|
|
84
|
-
typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),
|
|
85
|
-
mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),
|
|
86
|
-
configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),
|
|
87
|
-
cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),
|
|
88
|
-
outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
const buildEditorFields = (customConfiguration) => ({
|
|
92
|
-
applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,
|
|
93
|
-
editorURL: customConfiguration?.editorURL ?? EDITOR_URL,
|
|
94
|
-
cmsURL: customConfiguration?.cmsURL ?? CMS_URL,
|
|
95
|
-
backendURL: customConfiguration?.backendURL ?? BACKEND_URL,
|
|
96
|
-
port: customConfiguration?.port ?? PORT,
|
|
97
|
-
enabled: customConfiguration?.enabled ?? IS_ENABLED,
|
|
98
|
-
clientId: customConfiguration?.clientId ?? void 0,
|
|
99
|
-
clientSecret: customConfiguration?.clientSecret ?? void 0,
|
|
100
|
-
dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,
|
|
101
|
-
liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,
|
|
102
|
-
liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,
|
|
103
|
-
liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`
|
|
104
|
-
});
|
|
105
|
-
const buildLogFields = (customConfiguration, logFunctions) => ({
|
|
106
|
-
mode: customConfiguration?.mode ?? MODE,
|
|
107
|
-
prefix: customConfiguration?.prefix ?? PREFIX,
|
|
108
|
-
error: logFunctions?.error,
|
|
109
|
-
log: logFunctions?.log,
|
|
110
|
-
info: logFunctions?.info,
|
|
111
|
-
warn: logFunctions?.warn
|
|
112
|
-
});
|
|
113
|
-
const buildAiFields = (customConfiguration) => ({
|
|
114
|
-
provider: customConfiguration?.provider,
|
|
115
|
-
apiKey: customConfiguration?.apiKey,
|
|
116
|
-
model: customConfiguration?.model,
|
|
117
|
-
temperature: customConfiguration?.temperature,
|
|
118
|
-
applicationContext: customConfiguration?.applicationContext,
|
|
119
|
-
baseURL: customConfiguration?.baseURL,
|
|
120
|
-
dataSerialization: customConfiguration?.dataSerialization
|
|
121
|
-
});
|
|
122
|
-
const buildBuildFields = (customConfiguration) => ({
|
|
123
|
-
mode: customConfiguration?.mode ?? BUILD_MODE,
|
|
124
|
-
optimize: customConfiguration?.optimize,
|
|
125
|
-
importMode: customConfiguration?.importMode,
|
|
126
|
-
traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,
|
|
127
|
-
outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,
|
|
128
|
-
cache: customConfiguration?.cache ?? CACHE,
|
|
129
|
-
require: customConfiguration?.require
|
|
130
|
-
});
|
|
131
|
-
const buildCompilerFields = (customConfiguration) => ({
|
|
132
|
-
enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,
|
|
133
|
-
transformPattern: customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,
|
|
134
|
-
excludePattern: customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,
|
|
135
|
-
outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR
|
|
136
|
-
});
|
|
137
|
-
const buildDictionaryFields = (customConfiguration) => {
|
|
138
|
-
const contentAutoTransformation = customConfiguration?.contentAutoTransformation ?? CONTENT_AUTO_TRANSFORMATION;
|
|
139
|
-
return {
|
|
140
|
-
fill: customConfiguration?.fill ?? FILL,
|
|
141
|
-
contentAutoTransformation: typeof contentAutoTransformation === "object" ? {
|
|
142
|
-
markdown: contentAutoTransformation.markdown ?? false,
|
|
143
|
-
html: contentAutoTransformation.html ?? false,
|
|
144
|
-
insertion: contentAutoTransformation.insertion ?? false
|
|
145
|
-
} : contentAutoTransformation,
|
|
146
|
-
location: customConfiguration?.location ?? LOCATION,
|
|
147
|
-
locale: customConfiguration?.locale,
|
|
148
|
-
title: customConfiguration?.title,
|
|
149
|
-
description: customConfiguration?.description,
|
|
150
|
-
tags: customConfiguration?.tags,
|
|
151
|
-
priority: customConfiguration?.priority,
|
|
152
|
-
importMode: customConfiguration?.importMode ?? IMPORT_MODE,
|
|
153
|
-
version: customConfiguration?.version
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Build the configuration fields by merging the default values with the custom configuration
|
|
158
|
-
*/
|
|
159
|
-
const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
|
|
160
|
-
const internationalizationConfig = buildInternationalizationFields(customConfiguration?.internationalization);
|
|
161
|
-
const routingConfig = buildRoutingFields(customConfiguration?.routing);
|
|
162
|
-
const contentConfig = buildContentFields(customConfiguration?.content, baseDir, logFunctions);
|
|
163
|
-
storedConfiguration = {
|
|
164
|
-
internationalization: internationalizationConfig,
|
|
165
|
-
routing: routingConfig,
|
|
166
|
-
content: contentConfig,
|
|
167
|
-
system: buildSystemFields(customConfiguration?.system, contentConfig),
|
|
168
|
-
editor: buildEditorFields(customConfiguration?.editor),
|
|
169
|
-
log: buildLogFields(customConfiguration?.log, logFunctions),
|
|
170
|
-
ai: buildAiFields(customConfiguration?.ai),
|
|
171
|
-
build: buildBuildFields(customConfiguration?.build),
|
|
172
|
-
compiler: buildCompilerFields(customConfiguration?.compiler),
|
|
173
|
-
dictionary: buildDictionaryFields(customConfiguration?.dictionary),
|
|
174
|
-
plugins: customConfiguration?.plugins,
|
|
175
|
-
schemas: customConfiguration?.schemas,
|
|
176
|
-
metadata: {
|
|
177
|
-
name: "Intlayer",
|
|
178
|
-
version: packageJson.version,
|
|
179
|
-
doc: `https://intlayer.org/docs`
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
return storedConfiguration;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
//#endregion
|
|
186
|
-
export { buildConfigurationFields };
|
|
1
|
+
import{__require as e}from"../_virtual/_rolldown/runtime.mjs";import{BUILD_MODE as t,CACHE as n,OUTPUT_FORMAT as r,TRAVERSE_PATTERN as i}from"../defaultValues/build.mjs";import{COMPILER_ENABLED as a,COMPILER_EXCLUDE_PATTERN as o,COMPILER_OUTPUT_DIR as s,COMPILER_TRANSFORM_PATTERN as c}from"../defaultValues/compiler.mjs";import{CODE_DIR as l,CONTENT_DIR as u,EXCLUDED_PATHS as d,FILE_EXTENSIONS as f,WATCH as p}from"../defaultValues/content.mjs";import{CONTENT_AUTO_TRANSFORMATION as m,FILL as ee,IMPORT_MODE as h,LOCATION as g}from"../defaultValues/dictionary.mjs";import{APPLICATION_URL as _,BACKEND_URL as v,CMS_URL as y,DICTIONARY_PRIORITY_STRATEGY as b,EDITOR_URL as x,IS_ENABLED as S,LIVE_SYNC as C,LIVE_SYNC_PORT as w,PORT as T}from"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as E,LOCALES as D,REQUIRED_LOCALES as O,STRICT_MODE as k}from"../defaultValues/internationalization.mjs";import{MODE as A,PREFIX as j}from"../defaultValues/log.mjs";import{BASE_PATH as M,ROUTING_MODE as N,STORAGE as P}from"../defaultValues/routing.mjs";import{CACHE_DIR as F,CONFIG_DIR as I,DICTIONARIES_DIR as L,DYNAMIC_DICTIONARIES_DIR as R,FETCH_DICTIONARIES_DIR as te,MAIN_DIR as z,MODULE_AUGMENTATION_DIR as B,REMOTE_DICTIONARIES_DIR as V,TYPES_DIR as H,UNMERGED_DICTIONARIES_DIR as U}from"../defaultValues/system.mjs";import{normalizePath as W}from"../utils/normalizePath.mjs";import{dirname as G,isAbsolute as K,join as q}from"node:path";import{statSync as J}from"node:fs";import Y from"@intlayer/types/package.json"with{type:"json"};let X;const Z=e=>({locales:e?.locales??D,requiredLocales:e?.requiredLocales??e?.locales??O,strictMode:e?.strictMode??k,defaultLocale:e?.defaultLocale??E}),Q=e=>({mode:e?.mode??N,storage:e?.storage??P,basePath:e?.basePath??M,rewrite:e?.rewrite}),ne=(t,n,r)=>{let i=t?.fileExtensions??f,a=t?.baseDir??n??process.cwd(),o=t=>{let n;try{n=e.resolve(t,{paths:[a]})}catch{n=K(t)?t:q(a,t)}try{if(J(n).isFile())return G(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return G(n)}return n},s=(t?.contentDir??u).map(o);return{fileExtensions:i,baseDir:a,contentDir:s,codeDir:(t?.codeDir??l).map(o),excludedPath:t?.excludedPath??d,watch:t?.watch??p,formatCommand:t?.formatCommand,watchedFilesPattern:i.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:i.flatMap(e=>s.map(t=>`${W(t)}/**/*${e}`))}},re=(t,n)=>{let r=n?.baseDir??process.cwd(),i=t=>{let n;try{n=e.resolve(t,{paths:[r]})}catch{n=K(t)?t:q(r,t)}try{if(J(n).isFile())return G(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return G(n)}return n},a=i(t?.dictionariesDir??L);return{moduleAugmentationDir:i(t?.moduleAugmentationDir??B),unmergedDictionariesDir:i(t?.unmergedDictionariesDir??U),remoteDictionariesDir:i(t?.remoteDictionariesDir??V),dictionariesDir:a,dynamicDictionariesDir:i(t?.dynamicDictionariesDir??R),fetchDictionariesDir:i(t?.fetchDictionariesDir??te),typesDir:i(t?.typesDir??H),mainDir:i(t?.mainDir??z),configDir:i(t?.configDir??I),cacheDir:i(t?.cacheDir??F),outputFilesPatternWithPath:`${W(a)}/**/*.json`}},ie=e=>({applicationURL:e?.applicationURL??_,editorURL:e?.editorURL??x,cmsURL:e?.cmsURL??y,backendURL:e?.backendURL??v,port:e?.port??T,enabled:e?.enabled??S,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??b,liveSync:e?.liveSync??C,liveSyncPort:e?.liveSyncPort??w,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??w}`}),ae=(e,t)=>({mode:e?.mode??A,prefix:e?.prefix??j,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),oe=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),$=e=>({mode:e?.mode??t,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??i,outputFormat:e?.outputFormat??r,cache:e?.cache??n,require:e?.require}),se=e=>({enabled:e?.enabled??a,transformPattern:e?.transformPattern??c,excludePattern:e?.excludePattern??o,outputDir:e?.outputDir??s}),ce=e=>{let t=e?.contentAutoTransformation??m;return{fill:e?.fill??ee,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??g,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??h,version:e?.version}},le=(e,t,n)=>{let r=Z(e?.internationalization),i=Q(e?.routing),a=ne(e?.content,t,n);return X={internationalization:r,routing:i,content:a,system:re(e?.system,a),editor:ie(e?.editor),log:ae(e?.log,n),ai:oe(e?.ai),build:$(e?.build),compiler:se(e?.compiler),dictionary:ce(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:Y.version,doc:`https://intlayer.org/docs`}},X};export{le as buildConfigurationFields};
|
|
187
2
|
//# sourceMappingURL=buildConfigurationFields.mjs.map
|