@intlayer/config 6.1.6 → 7.0.0-canary.0
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 +34 -0
- package/dist/cjs/alias.cjs +27 -100
- package/dist/cjs/alias.cjs.map +1 -1
- package/dist/cjs/built.cjs +7 -25
- package/dist/cjs/built.cjs.map +1 -1
- package/dist/cjs/bundleJSFile.cjs +30 -51
- package/dist/cjs/bundleJSFile.cjs.map +1 -1
- package/dist/cjs/client.cjs +19 -52
- package/dist/cjs/configFile/buildConfigurationFields.cjs +100 -657
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/configFile/getConfiguration.cjs +60 -114
- package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
- package/dist/cjs/configFile/index.cjs +8 -25
- package/dist/cjs/configFile/loadConfigurationFile.cjs +22 -47
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs +49 -55
- package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
- package/dist/cjs/defaultValues/build.cjs +23 -35
- package/dist/cjs/defaultValues/build.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +68 -70
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/defaultValues/editor.cjs +29 -41
- package/dist/cjs/defaultValues/editor.cjs.map +1 -1
- package/dist/cjs/defaultValues/index.cjs +62 -0
- package/dist/cjs/defaultValues/index.cjs.map +1 -0
- package/dist/cjs/defaultValues/internationalization.cjs +23 -34
- package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
- package/dist/cjs/defaultValues/log.cjs +17 -29
- package/dist/cjs/defaultValues/log.cjs.map +1 -1
- package/dist/cjs/defaultValues/routing.cjs +38 -0
- package/dist/cjs/defaultValues/routing.cjs.map +1 -0
- package/dist/cjs/extractErrorMessage.cjs +95 -0
- package/dist/cjs/extractErrorMessage.cjs.map +1 -0
- package/dist/cjs/index.cjs +67 -98
- package/dist/cjs/loadEnvFile.cjs +30 -51
- package/dist/cjs/loadEnvFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleFile.cjs +74 -0
- package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -0
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs +86 -0
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -0
- package/dist/cjs/loadExternalFile/parseFileContent.cjs +67 -0
- package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -0
- package/dist/cjs/loadExternalFile/transpileTSToMJS.cjs +60 -0
- package/dist/cjs/loadExternalFile/transpileTSToMJS.cjs.map +1 -0
- package/dist/cjs/logger.cjs +124 -152
- package/dist/cjs/logger.cjs.map +1 -1
- package/dist/cjs/package.cjs +12 -0
- package/dist/cjs/package.cjs.map +1 -0
- package/dist/cjs/retryManager.cjs +42 -49
- package/dist/cjs/retryManager.cjs.map +1 -1
- package/dist/cjs/utils/ESMxCJSHelpers.cjs +24 -33
- package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
- package/dist/cjs/utils/cache.cjs +426 -0
- package/dist/cjs/utils/cache.cjs.map +1 -0
- package/dist/cjs/utils/clearModuleCache.cjs +23 -46
- package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +95 -0
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -0
- package/dist/cjs/utils/getExtension.cjs +12 -35
- package/dist/cjs/utils/getExtension.cjs.map +1 -1
- package/dist/cjs/utils/getPackageJsonPath.cjs +37 -0
- package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -0
- package/dist/cjs/utils/logStack.cjs +16 -0
- package/dist/cjs/utils/logStack.cjs.map +1 -0
- package/dist/cjs/utils/normalizePath.cjs +15 -27
- package/dist/cjs/utils/normalizePath.cjs.map +1 -1
- package/dist/esm/_virtual/rolldown_runtime.mjs +17 -0
- package/dist/esm/alias.mjs +23 -74
- package/dist/esm/alias.mjs.map +1 -1
- package/dist/esm/built.mjs +5 -3
- package/dist/esm/built.mjs.map +1 -1
- package/dist/esm/bundleJSFile.mjs +26 -25
- package/dist/esm/bundleJSFile.mjs.map +1 -1
- package/dist/esm/client.mjs +4 -31
- package/dist/esm/configFile/buildConfigurationFields.mjs +97 -674
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/configFile/getConfiguration.mjs +52 -75
- package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
- package/dist/esm/configFile/index.mjs +5 -3
- package/dist/esm/configFile/loadConfigurationFile.mjs +22 -23
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs +45 -30
- package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
- package/dist/esm/defaultValues/build.mjs +16 -11
- package/dist/esm/defaultValues/build.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +48 -34
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/defaultValues/editor.mjs +17 -11
- package/dist/esm/defaultValues/editor.mjs.map +1 -1
- package/dist/esm/defaultValues/index.mjs +21 -0
- package/dist/esm/defaultValues/index.mjs.map +1 -0
- package/dist/esm/defaultValues/internationalization.mjs +13 -7
- package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
- package/dist/esm/defaultValues/log.mjs +10 -4
- package/dist/esm/defaultValues/log.mjs.map +1 -1
- package/dist/esm/defaultValues/routing.mjs +25 -0
- package/dist/esm/defaultValues/routing.mjs.map +1 -0
- package/dist/esm/extractErrorMessage.mjs +94 -0
- package/dist/esm/extractErrorMessage.mjs.map +1 -0
- package/dist/esm/index.mjs +18 -61
- package/dist/esm/loadEnvFile.mjs +27 -17
- package/dist/esm/loadEnvFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleFile.mjs +68 -0
- package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -0
- package/dist/esm/loadExternalFile/loadExternalFile.mjs +81 -0
- package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -0
- package/dist/esm/loadExternalFile/parseFileContent.mjs +63 -0
- package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -0
- package/dist/esm/loadExternalFile/transpileTSToMJS.mjs +55 -0
- package/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +1 -0
- package/dist/esm/logger.mjs +110 -115
- package/dist/esm/logger.mjs.map +1 -1
- package/dist/esm/package.mjs +6 -0
- package/dist/esm/package.mjs.map +1 -0
- package/dist/esm/retryManager.mjs +40 -23
- package/dist/esm/retryManager.mjs.map +1 -1
- package/dist/esm/utils/ESMxCJSHelpers.mjs +20 -6
- package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
- package/dist/esm/utils/cache.mjs +414 -0
- package/dist/esm/utils/cache.mjs.map +1 -0
- package/dist/esm/utils/clearModuleCache.mjs +22 -21
- package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +94 -0
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -0
- package/dist/esm/utils/getExtension.mjs +11 -11
- package/dist/esm/utils/getExtension.mjs.map +1 -1
- package/dist/esm/utils/getPackageJsonPath.mjs +33 -0
- package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -0
- package/dist/esm/utils/logStack.mjs +16 -0
- package/dist/esm/utils/logStack.mjs.map +1 -0
- package/dist/esm/utils/normalizePath.mjs +14 -3
- package/dist/esm/utils/normalizePath.mjs.map +1 -1
- package/dist/types/alias.d.ts +20 -12
- package/dist/types/alias.d.ts.map +1 -1
- package/dist/types/built.d.ts +7 -6
- package/dist/types/built.d.ts.map +1 -1
- package/dist/types/bundleJSFile.d.ts +97 -93
- package/dist/types/bundleJSFile.d.ts.map +1 -1
- package/dist/types/client.d.ts +3 -5
- package/dist/types/configFile/buildConfigurationFields.d.ts +7 -2
- package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
- package/dist/types/configFile/getConfiguration.d.ts +19 -15
- package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
- package/dist/types/configFile/index.d.ts +4 -3
- package/dist/types/configFile/loadConfigurationFile.d.ts +8 -3
- package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
- package/dist/types/configFile/searchConfigurationFile.d.ts +6 -4
- package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
- package/dist/types/defaultValues/build.d.ts +10 -4
- package/dist/types/defaultValues/build.d.ts.map +1 -1
- package/dist/types/defaultValues/content.d.ts +23 -16
- package/dist/types/defaultValues/content.d.ts.map +1 -1
- package/dist/types/defaultValues/editor.d.ts +14 -9
- package/dist/types/defaultValues/editor.d.ts.map +1 -1
- package/dist/types/defaultValues/index.d.ts +14 -0
- package/dist/types/defaultValues/index.d.ts.map +1 -0
- package/dist/types/defaultValues/internationalization.d.ts +12 -6
- package/dist/types/defaultValues/internationalization.d.ts.map +1 -1
- package/dist/types/defaultValues/log.d.ts +7 -2
- package/dist/types/defaultValues/log.d.ts.map +1 -1
- package/dist/types/defaultValues/routing.d.ts +14 -0
- package/dist/types/defaultValues/routing.d.ts.map +1 -0
- package/dist/types/extractErrorMessage.d.ts +5 -0
- package/dist/types/extractErrorMessage.d.ts.map +1 -0
- package/dist/types/index.d.ts +21 -17
- package/dist/types/loadEnvFile.d.ts +8 -5
- package/dist/types/loadEnvFile.d.ts.map +1 -1
- package/dist/types/loadExternalFile/bundleFile.d.ts +10 -0
- package/dist/types/loadExternalFile/bundleFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/loadExternalFile.d.ts +25 -0
- package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/parseFileContent.d.ts +29 -0
- package/dist/types/loadExternalFile/parseFileContent.d.ts.map +1 -0
- package/dist/types/loadExternalFile/transpileTSToMJS.d.ts +9 -0
- package/dist/types/loadExternalFile/transpileTSToMJS.d.ts.map +1 -0
- package/dist/types/logger.d.ts +41 -37
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/retryManager.d.ts +26 -8
- package/dist/types/retryManager.d.ts.map +1 -1
- package/dist/types/utils/ESMxCJSHelpers.d.ts +16 -2
- package/dist/types/utils/ESMxCJSHelpers.d.ts.map +1 -1
- package/dist/types/utils/cache.d.ts +50 -0
- package/dist/types/utils/cache.d.ts.map +1 -0
- package/dist/types/utils/clearModuleCache.d.ts +4 -1
- package/dist/types/utils/clearModuleCache.d.ts.map +1 -1
- package/dist/types/utils/extractErrorMessage.d.ts +5 -0
- package/dist/types/utils/extractErrorMessage.d.ts.map +1 -0
- package/dist/types/utils/getExtension.d.ts +6 -2
- package/dist/types/utils/getExtension.d.ts.map +1 -1
- package/dist/types/utils/getPackageJsonPath.d.ts +10 -0
- package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -0
- package/dist/types/utils/logStack.d.ts +7 -0
- package/dist/types/utils/logStack.d.ts.map +1 -0
- package/dist/types/utils/normalizePath.d.ts +4 -1
- package/dist/types/utils/normalizePath.d.ts.map +1 -1
- package/package.json +40 -35
- package/LICENSE +0 -202
- package/dist/cjs/client.cjs.map +0 -1
- package/dist/cjs/configFile/index.cjs.map +0 -1
- package/dist/cjs/defaultValues/middleware.cjs +0 -47
- package/dist/cjs/defaultValues/middleware.cjs.map +0 -1
- package/dist/cjs/getSandboxContext.cjs +0 -64
- package/dist/cjs/getSandboxContext.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/loadExternalFile.cjs +0 -105
- package/dist/cjs/loadExternalFile.cjs.map +0 -1
- package/dist/cjs/types/config.cjs +0 -17
- package/dist/cjs/types/config.cjs.map +0 -1
- package/dist/cjs/types/locales.cjs +0 -310
- package/dist/cjs/types/locales.cjs.map +0 -1
- package/dist/esm/client.mjs.map +0 -1
- package/dist/esm/configFile/index.mjs.map +0 -1
- package/dist/esm/defaultValues/middleware.mjs +0 -17
- package/dist/esm/defaultValues/middleware.mjs.map +0 -1
- package/dist/esm/getSandboxContext.mjs +0 -40
- package/dist/esm/getSandboxContext.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/loadExternalFile.mjs +0 -81
- package/dist/esm/loadExternalFile.mjs.map +0 -1
- package/dist/esm/types/config.mjs +0 -1
- package/dist/esm/types/config.mjs.map +0 -1
- package/dist/esm/types/locales.mjs +0 -286
- package/dist/esm/types/locales.mjs.map +0 -1
- package/dist/types/client.d.ts.map +0 -1
- package/dist/types/configFile/index.d.ts.map +0 -1
- package/dist/types/defaultValues/middleware.d.ts +0 -8
- package/dist/types/defaultValues/middleware.d.ts.map +0 -1
- package/dist/types/getSandboxContext.d.ts +0 -4
- package/dist/types/getSandboxContext.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/loadExternalFile.d.ts +0 -8
- package/dist/types/loadExternalFile.d.ts.map +0 -1
- package/dist/types/types/config.d.ts +0 -659
- package/dist/types/types/config.d.ts.map +0 -1
- package/dist/types/types/locales.d.ts +0 -564
- package/dist/types/types/locales.d.ts.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/extractErrorMessage.ts
|
|
3
|
+
const extractErrorMessage = (error) => {
|
|
4
|
+
const trimToSingleLine = (text) => text.split(/\r?\n/).map((s) => s.trim()).filter(Boolean)[0] ?? text.trim();
|
|
5
|
+
const looksLikeJson = (value) => {
|
|
6
|
+
const s = value.trim();
|
|
7
|
+
if (!s) return false;
|
|
8
|
+
const first = s[0];
|
|
9
|
+
return first === "{" || first === "[" || first === "\"";
|
|
10
|
+
};
|
|
11
|
+
const sanitizeUnexpectedTokenMessage = (text) => {
|
|
12
|
+
const t = text.trim();
|
|
13
|
+
if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {
|
|
14
|
+
const quoted = t.match(/"([^"]+)"/);
|
|
15
|
+
if (quoted?.[1]) return quoted[1];
|
|
16
|
+
const afterColon = t.split(":").slice(1).join(":").trim();
|
|
17
|
+
if (afterColon) return afterColon;
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
const pickFieldsFromObject = (value, seen) => {
|
|
22
|
+
if (!value || typeof value !== "object") return void 0;
|
|
23
|
+
if (seen.has(value)) return void 0;
|
|
24
|
+
seen.add(value);
|
|
25
|
+
const obj = value;
|
|
26
|
+
if (typeof obj.message === "string" && obj.message.trim()) return obj.message;
|
|
27
|
+
if (typeof obj.error_description === "string" && obj.error_description.trim()) return obj.error_description;
|
|
28
|
+
if (typeof obj.error === "string" && obj.error.trim()) return obj.error;
|
|
29
|
+
const title = typeof obj.title === "string" ? obj.title.trim() : "";
|
|
30
|
+
const code = typeof obj.code === "string" ? obj.code.trim() : "";
|
|
31
|
+
if (title && code) return `${title} (${code})`;
|
|
32
|
+
if (title) return title;
|
|
33
|
+
if (code) return code;
|
|
34
|
+
if (typeof obj.statusText === "string" && obj.statusText.trim()) return obj.statusText;
|
|
35
|
+
const response = obj.response;
|
|
36
|
+
if (response && typeof response === "object") {
|
|
37
|
+
const data$1 = response.data;
|
|
38
|
+
const fromData$1 = pickFieldsFromObject(data$1, seen);
|
|
39
|
+
if (fromData$1) return fromData$1;
|
|
40
|
+
}
|
|
41
|
+
const data = obj.data;
|
|
42
|
+
const fromData = pickFieldsFromObject(data, seen);
|
|
43
|
+
if (fromData) return fromData;
|
|
44
|
+
const cause = obj.cause;
|
|
45
|
+
const fromCause = pickFieldsFromObject(cause, seen) ?? (typeof cause?.message === "string" ? cause.message : void 0);
|
|
46
|
+
if (fromCause) return fromCause;
|
|
47
|
+
const errors = obj.errors;
|
|
48
|
+
if (Array.isArray(errors)) for (const item of errors) {
|
|
49
|
+
const fromItem = pickFieldsFromObject(item, seen);
|
|
50
|
+
if (fromItem) return fromItem;
|
|
51
|
+
if (typeof item?.message === "string") return item.message;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const tryParseJsonString = (maybeJson) => {
|
|
55
|
+
if (!looksLikeJson(maybeJson)) return void 0;
|
|
56
|
+
try {
|
|
57
|
+
const parsed = JSON.parse(maybeJson);
|
|
58
|
+
const picked = pickFieldsFromObject(parsed, /* @__PURE__ */ new Set());
|
|
59
|
+
if (picked) return picked;
|
|
60
|
+
if (typeof parsed === "string") return parsed;
|
|
61
|
+
return;
|
|
62
|
+
} catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
if (typeof error === "string") {
|
|
67
|
+
const cleaned = sanitizeUnexpectedTokenMessage(error);
|
|
68
|
+
return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);
|
|
69
|
+
}
|
|
70
|
+
if (error && typeof error === "object") {
|
|
71
|
+
if (error instanceof Error) {
|
|
72
|
+
const cleaned = sanitizeUnexpectedTokenMessage(error.message);
|
|
73
|
+
const fromMessage = tryParseJsonString(cleaned);
|
|
74
|
+
if (fromMessage) return trimToSingleLine(fromMessage);
|
|
75
|
+
const fromCause = extractErrorMessage(error.cause);
|
|
76
|
+
if (fromCause && fromCause !== "An unknown error occurred") return trimToSingleLine(fromCause);
|
|
77
|
+
return trimToSingleLine(cleaned);
|
|
78
|
+
}
|
|
79
|
+
const fromObject = pickFieldsFromObject(error, /* @__PURE__ */ new Set());
|
|
80
|
+
if (fromObject) {
|
|
81
|
+
const cleaned = sanitizeUnexpectedTokenMessage(fromObject);
|
|
82
|
+
return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
return trimToSingleLine(JSON.stringify(error));
|
|
86
|
+
} catch {
|
|
87
|
+
return trimToSingleLine(String(error));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return "An unknown error occurred";
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.extractErrorMessage = extractErrorMessage;
|
|
95
|
+
//# sourceMappingURL=extractErrorMessage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractErrorMessage.cjs","names":["data","fromData"],"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted?.[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n // Check for message first (highest priority)\n if (typeof obj.message === 'string' && obj.message.trim()) {\n return obj.message;\n }\n\n // Check for error_description\n if (\n typeof obj.error_description === 'string' &&\n obj.error_description.trim()\n ) {\n return obj.error_description;\n }\n\n // Check for error\n if (typeof obj.error === 'string' && obj.error.trim()) {\n return obj.error;\n }\n\n // Handle title and code combination\n const title = typeof obj.title === 'string' ? obj.title.trim() : '';\n const code = typeof obj.code === 'string' ? obj.code.trim() : '';\n\n if (title && code) {\n return `${title} (${code})`;\n }\n\n if (title) {\n return title;\n }\n\n if (code) {\n return code;\n }\n\n // Check for statusText\n if (typeof obj.statusText === 'string' && obj.statusText.trim()) {\n return obj.statusText;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine(serialized);\n } catch {\n return trimToSingleLine(String(error));\n }\n }\n\n return 'An unknown error occurred';\n};\n"],"mappings":"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"}
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/utils/getExtension.ts
|
|
3
|
+
const getExtension = (configuration, format) => {
|
|
4
|
+
const outputFormats = configuration.build.outputFormat;
|
|
5
|
+
if (format === "cjs") return "cjs";
|
|
6
|
+
if (format === "esm") return "mjs";
|
|
7
|
+
if (outputFormats.includes("cjs")) return "cjs";
|
|
8
|
+
if (outputFormats.includes("esm")) return "mjs";
|
|
9
|
+
return "cjs";
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getExtension_exports = {};
|
|
20
|
-
__export(getExtension_exports, {
|
|
21
|
-
getExtension: () => getExtension
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getExtension_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
const getExtension = (configuration = (0, import_config.getConfiguration)(), format) => {
|
|
26
|
-
const outputFormats = configuration.build.outputFormat;
|
|
27
|
-
if (format === "cjs") return "cjs";
|
|
28
|
-
if (format === "esm") return "mjs";
|
|
29
|
-
if (outputFormats.includes("cjs")) return "cjs";
|
|
30
|
-
if (outputFormats.includes("esm")) return "mjs";
|
|
31
|
-
return "cjs";
|
|
32
|
-
};
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
getExtension
|
|
36
|
-
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.getExtension = getExtension;
|
|
37
14
|
//# sourceMappingURL=getExtension.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/getExtension.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"getExtension.cjs","names":[],"sources":["../../../src/utils/getExtension.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\n\nexport const getExtension = (\n configuration: IntlayerConfig,\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'cjs') return 'cjs';\n if (format === 'esm') return 'mjs';\n\n if (outputFormats.includes('cjs')) return 'cjs';\n if (outputFormats.includes('esm')) return 'mjs';\n\n return 'cjs';\n};\n"],"mappings":";;AAEA,MAAa,gBACX,eACA,WACG;CACH,MAAM,gBAAgB,cAAc,MAAM;AAE1C,KAAI,WAAW,MAAO,QAAO;AAC7B,KAAI,WAAW,MAAO,QAAO;AAE7B,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAC1C,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAE1C,QAAO"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils_cache = require('./cache.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
7
|
+
|
|
8
|
+
//#region src/utils/getPackageJsonPath.ts
|
|
9
|
+
const isESModule = typeof require("url").pathToFileURL(__filename).href === "string";
|
|
10
|
+
const MAX_LEVELS = 15;
|
|
11
|
+
const getPackageJsonPath = (startDir = process.cwd()) => {
|
|
12
|
+
const checkedCache = require_utils_cache.cache.get("packageJsonPath", startDir);
|
|
13
|
+
if (checkedCache) return checkedCache;
|
|
14
|
+
let currentDir = startDir;
|
|
15
|
+
for (let level = 0; level < MAX_LEVELS; level++) {
|
|
16
|
+
const packageJsonPath = (0, node_path.join)(currentDir, "package.json");
|
|
17
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) {
|
|
18
|
+
require_utils_cache.cache.set("packageJsonPath", startDir, {
|
|
19
|
+
packageJsonPath,
|
|
20
|
+
baseDir: currentDir
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
packageJsonPath,
|
|
24
|
+
baseDir: currentDir
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const parentDir = (0, node_path.dirname)(currentDir);
|
|
28
|
+
if (parentDir === currentDir) break;
|
|
29
|
+
currentDir = parentDir;
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Could not find package.json in current directory or any of the ${MAX_LEVELS} parent directories. Searched from: ${process.cwd()}`);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.getPackageJsonPath = getPackageJsonPath;
|
|
36
|
+
exports.isESModule = isESModule;
|
|
37
|
+
//# sourceMappingURL=getPackageJsonPath.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPackageJsonPath.cjs","names":["cache"],"sources":["../../../src/utils/getPackageJsonPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cache } from './cache';\n\nexport const isESModule = typeof import.meta.url === 'string';\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 = cache.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 cache.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: ${process.cwd()}`\n );\n};\n"],"mappings":";;;;;;;;AAIA,MAAa,aAAa,yDAA2B;AAErD,MAAM,aAAa;AAOnB,MAAa,sBACX,WAAmB,QAAQ,KAAK,KACP;CACzB,MAAM,eAAeA,0BAAM,IACzB,mBACA,SACD;AAED,KAAI,aAAc,QAAO;CAEzB,IAAI,aAAa;AAEjB,MAAK,IAAI,QAAQ,GAAG,QAAQ,YAAY,SAAS;EAC/C,MAAM,sCAAuB,YAAY,eAAe;AAExD,8BAAe,gBAAgB,EAAE;AAC/B,6BAAM,IAAI,mBAAmB,UAAU;IACrC;IACA,SAAS;IACV,CAAC;AAEF,UAAO;IAAE;IAAiB,SAAS;IAAY;;EAGjD,MAAM,mCAAoB,WAAW;AAGrC,MAAI,cAAc,WAChB;AAGF,eAAa;;AAGf,OAAM,IAAI,MACR,kEAAkE,WAAW,sCAAsC,QAAQ,KAAK,GACjI"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_logger = require('../logger.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/logStack.ts
|
|
4
|
+
const logStack = (message, options = { limit: 50 }) => {
|
|
5
|
+
Error.stackTraceLimit = options.limit;
|
|
6
|
+
try {
|
|
7
|
+
throw new Error("test");
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.log(require_logger.colorize(message, require_logger.ANSIColors.YELLOW));
|
|
10
|
+
console.log(require_logger.colorize(error.stack ?? "", require_logger.ANSIColors.BLUE));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.logStack = logStack;
|
|
16
|
+
//# sourceMappingURL=logStack.cjs.map
|
|
@@ -0,0 +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":";;;AAEA,MAAa,YACX,SACA,UAA6B,EAAE,OAAO,IAAI,KACvC;AACH,OAAM,kBAAkB,QAAQ;AAEhC,KAAI;AACF,QAAM,IAAI,MAAM,OAAO;UAChB,OAAO;AACd,UAAQ,IAAIA,wBAAS,SAASC,0BAAW,OAAO,CAAC;AACjD,UAAQ,IAAID,wBAAU,MAAgB,SAAS,IAAIC,0BAAW,KAAK,CAAC"}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var normalizePath_exports = {};
|
|
20
|
-
__export(normalizePath_exports, {
|
|
21
|
-
normalizePath: () => normalizePath
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(normalizePath_exports);
|
|
1
|
+
|
|
2
|
+
//#region src/utils/normalizePath.ts
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a path for glob by replacing backslashes with forward slashes
|
|
5
|
+
*
|
|
6
|
+
* Utils for Windows compatibility, as Glob pattern as `**\\*.js` is not supported
|
|
7
|
+
*
|
|
8
|
+
* C:\\Users\\John\\Desktop\\test.txt -> C:/Users/John/Desktop/test.txt
|
|
9
|
+
*
|
|
10
|
+
* @param path - The path to normalize
|
|
11
|
+
* @returns The normalized path
|
|
12
|
+
*/
|
|
24
13
|
const normalizePath = (path) => path.replace(/\\/g, "/");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.normalizePath = normalizePath;
|
|
29
17
|
//# sourceMappingURL=normalizePath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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":";;;;;;;;;;;;AAUA,MAAa,iBAAiB,SAAyB,KAAK,QAAQ,OAAO,IAAI"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
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) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { __export, __require };
|
package/dist/esm/alias.mjs
CHANGED
|
@@ -1,78 +1,27 @@
|
|
|
1
|
-
import { join, relative } from "path";
|
|
2
|
-
import { getConfiguration } from "./configFile/getConfiguration.mjs";
|
|
3
1
|
import { getExtension } from "./utils/getExtension.mjs";
|
|
4
2
|
import { normalizePath } from "./utils/normalizePath.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const normalizedUnmergedDictionariesPath = formatter(
|
|
26
|
-
normalizePath(relativeUnmergedDictionariesPath)
|
|
27
|
-
);
|
|
28
|
-
const remoteDictionariesPath = join(
|
|
29
|
-
mainDir,
|
|
30
|
-
`remote_dictionaries.${extension}`
|
|
31
|
-
);
|
|
32
|
-
const relativeRemoteDictionariesPath = relative(
|
|
33
|
-
baseDir,
|
|
34
|
-
remoteDictionariesPath
|
|
35
|
-
);
|
|
36
|
-
const normalizedRemoteDictionariesPath = formatter(
|
|
37
|
-
normalizePath(relativeRemoteDictionariesPath)
|
|
38
|
-
);
|
|
39
|
-
const dynamicDictionariesPath = join(
|
|
40
|
-
mainDir,
|
|
41
|
-
`dynamic_dictionaries.${extension}`
|
|
42
|
-
);
|
|
43
|
-
const relativeDynamicDictionariesPath = relative(
|
|
44
|
-
baseDir,
|
|
45
|
-
dynamicDictionariesPath
|
|
46
|
-
);
|
|
47
|
-
const normalizedDynamicDictionariesPath = formatter(
|
|
48
|
-
normalizePath(relativeDynamicDictionariesPath)
|
|
49
|
-
);
|
|
50
|
-
const fetchDictionariesPath = join(
|
|
51
|
-
mainDir,
|
|
52
|
-
`fetch_dictionaries.${extension}`
|
|
53
|
-
);
|
|
54
|
-
const relativeFetchDictionariesPath = relative(
|
|
55
|
-
baseDir,
|
|
56
|
-
fetchDictionariesPath
|
|
57
|
-
);
|
|
58
|
-
const normalizedFetchDictionariesPath = formatter(
|
|
59
|
-
normalizePath(relativeFetchDictionariesPath)
|
|
60
|
-
);
|
|
61
|
-
const configurationPath = join(configDir, `configuration.json`);
|
|
62
|
-
const relativeConfigurationPath = relative(baseDir, configurationPath);
|
|
63
|
-
const normalizedConfigurationPath = formatter(
|
|
64
|
-
normalizePath(relativeConfigurationPath)
|
|
65
|
-
);
|
|
66
|
-
return {
|
|
67
|
-
"@intlayer/dictionaries-entry": normalizedDictionariesPath,
|
|
68
|
-
"@intlayer/unmerged-dictionaries-entry": normalizedUnmergedDictionariesPath,
|
|
69
|
-
"@intlayer/remote-dictionaries-entry": normalizedRemoteDictionariesPath,
|
|
70
|
-
"@intlayer/dynamic-dictionaries-entry": normalizedDynamicDictionariesPath,
|
|
71
|
-
"@intlayer/fetch-dictionaries-entry": normalizedFetchDictionariesPath,
|
|
72
|
-
"@intlayer/config/built": normalizedConfigurationPath
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
export {
|
|
76
|
-
getAlias
|
|
3
|
+
import { join, relative } from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/alias.ts
|
|
6
|
+
const getAlias = ({ configuration, format = "esm", formatter = (value) => value }) => {
|
|
7
|
+
const extension = getExtension(configuration, format);
|
|
8
|
+
const { mainDir, configDir, baseDir } = configuration.content;
|
|
9
|
+
const fixedDictionariesPath = formatter(normalizePath(relative(baseDir, join(mainDir, `dictionaries.${extension}`))));
|
|
10
|
+
const fixedUnmergedDictionariesPath = formatter(normalizePath(relative(baseDir, join(mainDir, `unmerged_dictionaries.${extension}`))));
|
|
11
|
+
const fixedRemoteDictionariesPath = formatter(normalizePath(relative(baseDir, join(mainDir, `remote_dictionaries.${extension}`))));
|
|
12
|
+
const fixedDynamicDictionariesPath = formatter(normalizePath(relative(baseDir, join(mainDir, `dynamic_dictionaries.${extension}`))));
|
|
13
|
+
const fixedFetchDictionariesPath = formatter(normalizePath(relative(baseDir, join(mainDir, `fetch_dictionaries.${extension}`))));
|
|
14
|
+
const fixedConfigurationPath = formatter(normalizePath(relative(baseDir, join(configDir, `configuration.json`))));
|
|
15
|
+
return {
|
|
16
|
+
"@intlayer/dictionaries-entry": fixedDictionariesPath,
|
|
17
|
+
"@intlayer/unmerged-dictionaries-entry": fixedUnmergedDictionariesPath,
|
|
18
|
+
"@intlayer/remote-dictionaries-entry": fixedRemoteDictionariesPath,
|
|
19
|
+
"@intlayer/dynamic-dictionaries-entry": fixedDynamicDictionariesPath,
|
|
20
|
+
"@intlayer/fetch-dictionaries-entry": fixedFetchDictionariesPath,
|
|
21
|
+
"@intlayer/config/built": fixedConfigurationPath
|
|
22
|
+
};
|
|
77
23
|
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getAlias };
|
|
78
27
|
//# sourceMappingURL=alias.mjs.map
|
package/dist/esm/alias.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/alias.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport
|
|
1
|
+
{"version":3,"file":"alias.mjs","names":[],"sources":["../../src/alias.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { getExtension } from './utils/getExtension';\nimport { normalizePath } from './utils/normalizePath';\n\nexport type GetAliasOptions = {\n configuration: IntlayerConfig;\n format?: 'esm' | 'cjs';\n formatter?: (value: string) => string;\n};\n\nexport const getAlias = ({\n configuration,\n format = 'esm',\n formatter = (value: string) => value,\n}: GetAliasOptions) => {\n const extension = getExtension(configuration, format);\n\n const { mainDir, configDir, baseDir } = configuration.content;\n\n /**\n * Dictionaries\n */\n const dictionariesPath = join(mainDir, `dictionaries.${extension}`);\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n const fixedDictionariesPath = formatter(\n normalizePath(relativeDictionariesPath)\n );\n\n /**\n * Unmerged dictionaries\n */\n const unmergedDictionariesPath = join(\n mainDir,\n `unmerged_dictionaries.${extension}`\n );\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n const fixedUnmergedDictionariesPath = formatter(\n normalizePath(relativeUnmergedDictionariesPath)\n );\n\n /**\n * Remote dictionaries\n */\n const remoteDictionariesPath = join(\n mainDir,\n `remote_dictionaries.${extension}`\n );\n const relativeRemoteDictionariesPath = relative(\n baseDir,\n remoteDictionariesPath\n );\n const fixedRemoteDictionariesPath = formatter(\n normalizePath(relativeRemoteDictionariesPath)\n );\n\n /**\n * Dynamic dictionaries\n */\n const dynamicDictionariesPath = join(\n mainDir,\n `dynamic_dictionaries.${extension}`\n );\n const relativeDynamicDictionariesPath = relative(\n baseDir,\n dynamicDictionariesPath\n );\n const fixedDynamicDictionariesPath = formatter(\n normalizePath(relativeDynamicDictionariesPath)\n );\n\n /**\n * Fetch dictionaries\n */\n const fetchDictionariesPath = join(\n mainDir,\n `fetch_dictionaries.${extension}`\n );\n const relativeFetchDictionariesPath = relative(\n baseDir,\n fetchDictionariesPath\n );\n const fixedFetchDictionariesPath = formatter(\n normalizePath(relativeFetchDictionariesPath)\n );\n\n /**\n * Configuration\n */\n const configurationPath = join(configDir, `configuration.json`);\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n const fixedConfigurationPath = formatter(\n normalizePath(relativeConfigurationPath)\n );\n\n return {\n '@intlayer/dictionaries-entry': fixedDictionariesPath,\n '@intlayer/unmerged-dictionaries-entry': fixedUnmergedDictionariesPath,\n '@intlayer/remote-dictionaries-entry': fixedRemoteDictionariesPath,\n '@intlayer/dynamic-dictionaries-entry': fixedDynamicDictionariesPath,\n '@intlayer/fetch-dictionaries-entry': fixedFetchDictionariesPath,\n '@intlayer/config/built': fixedConfigurationPath,\n };\n};\n"],"mappings":";;;;;AAWA,MAAa,YAAY,EACvB,eACA,SAAS,OACT,aAAa,UAAkB,YACV;CACrB,MAAM,YAAY,aAAa,eAAe,OAAO;CAErD,MAAM,EAAE,SAAS,WAAW,YAAY,cAAc;CAOtD,MAAM,wBAAwB,UAC5B,cAF+B,SAAS,SADjB,KAAK,SAAS,gBAAgB,YAAY,CACC,CAE3B,CACxC;CAaD,MAAM,gCAAgC,UACpC,cALuC,SACvC,SAL+B,KAC/B,SACA,yBAAyB,YAC1B,CAIA,CAEgD,CAChD;CAaD,MAAM,8BAA8B,UAClC,cALqC,SACrC,SAL6B,KAC7B,SACA,uBAAuB,YACxB,CAIA,CAE8C,CAC9C;CAaD,MAAM,+BAA+B,UACnC,cALsC,SACtC,SAL8B,KAC9B,SACA,wBAAwB,YACzB,CAIA,CAE+C,CAC/C;CAaD,MAAM,6BAA6B,UACjC,cALoC,SACpC,SAL4B,KAC5B,SACA,sBAAsB,YACvB,CAIA,CAE6C,CAC7C;CAOD,MAAM,yBAAyB,UAC7B,cAFgC,SAAS,SADjB,KAAK,WAAW,qBAAqB,CACO,CAE5B,CACzC;AAED,QAAO;EACL,gCAAgC;EAChC,yCAAyC;EACzC,uCAAuC;EACvC,wCAAwC;EACxC,sCAAsC;EACtC,0BAA0B;EAC3B"}
|
package/dist/esm/built.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getConfiguration } from "./configFile/getConfiguration.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/built.ts
|
|
2
4
|
const configuration = getConfiguration();
|
|
3
5
|
var built_default = configuration;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { built_default as default };
|
|
7
9
|
//# sourceMappingURL=built.mjs.map
|
package/dist/esm/built.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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 { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration = getConfiguration();\n\nexport default configuration;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"built.mjs","names":["configuration: IntlayerConfig"],"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":";;;AAQA,MAAMA,gBAAgC,kBAAkB;AAExD,oBAAe"}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { build } from "esbuild";
|
|
2
|
+
|
|
3
|
+
//#region src/bundleJSFile.ts
|
|
2
4
|
const commonBuildOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
5
|
+
bundle: true,
|
|
6
|
+
format: "cjs",
|
|
7
|
+
platform: "node",
|
|
8
|
+
target: "es2019",
|
|
9
|
+
sourcemap: false,
|
|
10
|
+
logLevel: "silent",
|
|
11
|
+
write: true,
|
|
12
|
+
packages: "external",
|
|
13
|
+
loader: {
|
|
14
|
+
".js": "js",
|
|
15
|
+
".jsx": "jsx",
|
|
16
|
+
".mjs": "js",
|
|
17
|
+
".ts": "ts",
|
|
18
|
+
".tsx": "tsx",
|
|
19
|
+
".cjs": "js",
|
|
20
|
+
".json": "json",
|
|
21
|
+
".md": "text",
|
|
22
|
+
".mdx": "text"
|
|
23
|
+
}
|
|
23
24
|
};
|
|
24
25
|
const bundleJSFile = async (buildOptions) => await build({
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
...commonBuildOptions,
|
|
27
|
+
...buildOptions
|
|
27
28
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { bundleJSFile };
|
|
31
32
|
//# sourceMappingURL=bundleJSFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundleJSFile.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"bundleJSFile.mjs","names":[],"sources":["../../src/bundleJSFile.ts"],"sourcesContent":["import { type BuildOptions, build } from 'esbuild';\n\nconst commonBuildOptions = {\n bundle: true,\n format: 'cjs',\n platform: 'node',\n target: 'es2019',\n sourcemap: false,\n logLevel: 'silent',\n write: true,\n // Bundle relative/local files, but keep bare module imports external\n packages: 'external',\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n} as const;\n\nexport const bundleJSFile = async (buildOptions: BuildOptions) =>\n await build({\n ...commonBuildOptions,\n ...buildOptions,\n });\n"],"mappings":";;;AAEA,MAAM,qBAAqB;CACzB,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,WAAW;CACX,UAAU;CACV,OAAO;CAEP,UAAU;CACV,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ;EACT;CACF;AAED,MAAa,eAAe,OAAO,iBACjC,MAAM,MAAM;CACV,GAAG;CACH,GAAG;CACJ,CAAC"}
|
package/dist/esm/client.mjs
CHANGED
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
colorizeKey,
|
|
6
|
-
colorizeLocales,
|
|
7
|
-
colorizeNumber,
|
|
8
|
-
colorizePath,
|
|
9
|
-
getAppLogger,
|
|
10
|
-
logger,
|
|
11
|
-
spinnerFrames,
|
|
12
|
-
v,
|
|
13
|
-
x
|
|
14
|
-
} from "./logger.mjs";
|
|
15
|
-
import { Locales } from "./types/locales.mjs";
|
|
16
|
-
export {
|
|
17
|
-
ANSIColors,
|
|
18
|
-
Locales,
|
|
19
|
-
clock,
|
|
20
|
-
colon,
|
|
21
|
-
colorizeKey,
|
|
22
|
-
colorizeLocales,
|
|
23
|
-
colorizeNumber,
|
|
24
|
-
colorizePath,
|
|
25
|
-
getAppLogger,
|
|
26
|
-
logger,
|
|
27
|
-
spinnerFrames,
|
|
28
|
-
v,
|
|
29
|
-
x
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=client.mjs.map
|
|
1
|
+
import { ANSIColors, clock, colon, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, getAppLogger, logger, spinnerFrames, v, x } from "./logger.mjs";
|
|
2
|
+
import { defaultValues_exports } from "./defaultValues/index.mjs";
|
|
3
|
+
|
|
4
|
+
export { ANSIColors, defaultValues_exports as DefaultValues, clock, colon, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, getAppLogger, logger, spinnerFrames, v, x };
|