@intlayer/editor-react 7.0.8 → 7.0.9-canary.2
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/README.md +6 -5
- package/dist/cjs/CommunicatorContext.cjs +2 -2
- package/dist/cjs/CommunicatorContext.cjs.map +1 -1
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs +10 -0
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/built.cjs +8 -0
- package/dist/cjs/config/dist/esm/built.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs +119 -0
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs +69 -0
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs +26 -0
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs +51 -0
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs +15 -0
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs +54 -0
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs +7 -0
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs +23 -0
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs +14 -0
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs +10 -0
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs +11 -0
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs +26 -0
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs +23 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs +47 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs +65 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +45 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/logger.cjs +47 -0
- package/dist/cjs/config/dist/esm/logger.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +15 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs +1128 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs +27 -0
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/cache.cjs +261 -0
- package/dist/cjs/config/dist/esm/utils/cache.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs +34 -0
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs +17 -0
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs.map +1 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.cjs +60 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.cjs +17 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.cjs +38 -0
- package/dist/cjs/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -0
- package/dist/cjs/core/dist/esm/types/dist/esm/nodeType.cjs +25 -0
- package/dist/cjs/core/dist/esm/types/dist/esm/nodeType.cjs.map +1 -0
- package/dist/cjs/editor/dist/esm/compareUrls.cjs +39 -0
- package/dist/cjs/editor/dist/esm/compareUrls.cjs.map +1 -0
- package/dist/cjs/editor/dist/esm/mergeIframeClick.cjs +22 -0
- package/dist/cjs/editor/dist/esm/mergeIframeClick.cjs.map +1 -0
- package/dist/cjs/editor/dist/esm/messagesKeys.cjs +19 -0
- package/dist/cjs/editor/dist/esm/messagesKeys.cjs.map +1 -0
- package/dist/cjs/types/dist/esm/nodeType.cjs +25 -0
- package/dist/cjs/types/dist/esm/nodeType.cjs.map +1 -0
- package/dist/esm/CommunicatorContext.mjs +2 -2
- package/dist/esm/CommunicatorContext.mjs.map +1 -1
- package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +11 -0
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/config/dist/esm/built.mjs +8 -0
- package/dist/esm/config/dist/esm/built.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +118 -0
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +67 -0
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +26 -0
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +50 -0
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/build.mjs +10 -0
- package/dist/esm/config/dist/esm/defaultValues/build.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/content.mjs +40 -0
- package/dist/esm/config/dist/esm/defaultValues/content.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +6 -0
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs +14 -0
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +11 -0
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/log.mjs +9 -0
- package/dist/esm/config/dist/esm/defaultValues/log.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs +8 -0
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadEnvFile.mjs +24 -0
- package/dist/esm/config/dist/esm/loadEnvFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +23 -0
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +47 -0
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +63 -0
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +44 -0
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +1 -0
- package/dist/esm/config/dist/esm/logger.mjs +45 -0
- package/dist/esm/config/dist/esm/logger.mjs.map +1 -0
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +14 -0
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +1128 -0
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +25 -0
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/cache.mjs +263 -0
- package/dist/esm/config/dist/esm/utils/cache.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +33 -0
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs +16 -0
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +1 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +60 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +17 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +38 -0
- package/dist/esm/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -0
- package/dist/esm/core/dist/esm/types/dist/esm/nodeType.mjs +24 -0
- package/dist/esm/core/dist/esm/types/dist/esm/nodeType.mjs.map +1 -0
- package/dist/esm/editor/dist/esm/compareUrls.mjs +38 -0
- package/dist/esm/editor/dist/esm/compareUrls.mjs.map +1 -0
- package/dist/esm/editor/dist/esm/mergeIframeClick.mjs +21 -0
- package/dist/esm/editor/dist/esm/mergeIframeClick.mjs.map +1 -0
- package/dist/esm/editor/dist/esm/messagesKeys.mjs +18 -0
- package/dist/esm/editor/dist/esm/messagesKeys.mjs.map +1 -0
- package/dist/esm/types/dist/esm/nodeType.mjs +24 -0
- package/dist/esm/types/dist/esm/nodeType.mjs.map +1 -0
- package/dist/types/CommunicatorContext.d.ts.map +1 -1
- package/dist/types/ConfigurationContext.d.ts +2 -2
- package/dist/types/EditorEnabledContext.d.ts +2 -2
- package/dist/types/useCrossURLPathState.d.ts +3 -3
- package/dist/types/useEditorLocale.d.ts +2 -2
- package/dist/types/useFocusUnmergedDictionary.d.ts +2 -2
- package/package.json +19 -17
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_nodeType = require('../types/dist/esm/nodeType.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs
|
|
4
|
+
const renameContentNodeByKeyPath = (dictionaryContent, newKey, keyPath) => {
|
|
5
|
+
let currentValue = dictionaryContent;
|
|
6
|
+
let parentValue = null;
|
|
7
|
+
let lastKey = null;
|
|
8
|
+
for (const keyObj of keyPath) {
|
|
9
|
+
parentValue = currentValue;
|
|
10
|
+
if (keyObj.type === require_nodeType.NodeType.Object || keyObj.type === require_nodeType.NodeType.Array) {
|
|
11
|
+
lastKey = keyObj.key;
|
|
12
|
+
currentValue = currentValue[keyObj.key];
|
|
13
|
+
}
|
|
14
|
+
if (keyObj.type === require_nodeType.NodeType.Translation || keyObj.type === require_nodeType.NodeType.Enumeration || keyObj.type === require_nodeType.NodeType.Condition) {
|
|
15
|
+
lastKey = keyObj.type;
|
|
16
|
+
currentValue = currentValue[keyObj.type][keyObj.key];
|
|
17
|
+
}
|
|
18
|
+
if (keyObj.type === require_nodeType.NodeType.Markdown || keyObj.type === require_nodeType.NodeType.ReactNode || keyObj.type === require_nodeType.NodeType.Insertion || keyObj.type === require_nodeType.NodeType.File) {
|
|
19
|
+
lastKey = keyObj.type;
|
|
20
|
+
currentValue = currentValue[keyObj.type];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue[lastKey] = currentValue;
|
|
24
|
+
else {
|
|
25
|
+
const newParentValue = {};
|
|
26
|
+
for (const key of Object.keys(parentValue)) if (key === lastKey && typeof newKey !== "undefined") newParentValue[newKey] = currentValue;
|
|
27
|
+
else newParentValue[key] = parentValue[key];
|
|
28
|
+
Object.keys(parentValue).forEach((key) => {
|
|
29
|
+
delete parentValue[key];
|
|
30
|
+
});
|
|
31
|
+
Object.assign(parentValue, newParentValue);
|
|
32
|
+
}
|
|
33
|
+
return dictionaryContent;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.renameContentNodeByKeyPath = renameContentNodeByKeyPath;
|
|
38
|
+
//# sourceMappingURL=renameContentNodeByKeyPath.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renameContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../../../../../core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs"],"sourcesContent":["import { NodeType } from \"../types/dist/esm/nodeType.mjs\";\n\n//#region src/dictionaryManipulator/renameContentNodeByKeyPath.ts\nconst renameContentNodeByKeyPath = (dictionaryContent, newKey, keyPath) => {\n\tlet currentValue = dictionaryContent;\n\tlet parentValue = null;\n\tlet lastKey = null;\n\tfor (const keyObj of keyPath) {\n\t\tparentValue = currentValue;\n\t\tif (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n\t\t\tlastKey = keyObj.key;\n\t\t\tcurrentValue = currentValue[keyObj.key];\n\t\t}\n\t\tif (keyObj.type === NodeType.Translation || keyObj.type === NodeType.Enumeration || keyObj.type === NodeType.Condition) {\n\t\t\tlastKey = keyObj.type;\n\t\t\tcurrentValue = currentValue[keyObj.type][keyObj.key];\n\t\t}\n\t\tif (keyObj.type === NodeType.Markdown || keyObj.type === NodeType.ReactNode || keyObj.type === NodeType.Insertion || keyObj.type === NodeType.File) {\n\t\t\tlastKey = keyObj.type;\n\t\t\tcurrentValue = currentValue[keyObj.type];\n\t\t}\n\t}\n\tif (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue[lastKey] = currentValue;\n\telse {\n\t\tconst newParentValue = {};\n\t\tfor (const key of Object.keys(parentValue)) if (key === lastKey && typeof newKey !== \"undefined\") newParentValue[newKey] = currentValue;\n\t\telse newParentValue[key] = parentValue[key];\n\t\tObject.keys(parentValue).forEach((key) => {\n\t\t\tdelete parentValue[key];\n\t\t});\n\t\tObject.assign(parentValue, newParentValue);\n\t}\n\treturn dictionaryContent;\n};\n\n//#endregion\nexport { renameContentNodeByKeyPath };\n//# sourceMappingURL=renameContentNodeByKeyPath.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B,mBAAmB,QAAQ,YAAY;CAC1E,IAAI,eAAe;CACnB,IAAI,cAAc;CAClB,IAAI,UAAU;AACd,MAAK,MAAM,UAAU,SAAS;AAC7B,gBAAc;AACd,MAAI,OAAO,SAASA,0BAAS,UAAU,OAAO,SAASA,0BAAS,OAAO;AACtE,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO;;AAEpC,MAAI,OAAO,SAASA,0BAAS,eAAe,OAAO,SAASA,0BAAS,eAAe,OAAO,SAASA,0BAAS,WAAW;AACvH,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO,MAAM,OAAO;;AAEjD,MAAI,OAAO,SAASA,0BAAS,YAAY,OAAO,SAASA,0BAAS,aAAa,OAAO,SAASA,0BAAS,aAAa,OAAO,SAASA,0BAAS,MAAM;AACnJ,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO;;;AAGrC,KAAI,eAAe,YAAY,KAAM,KAAI,MAAM,QAAQ,YAAY,CAAE,aAAY,WAAW;MACvF;EACJ,MAAM,iBAAiB,EAAE;AACzB,OAAK,MAAM,OAAO,OAAO,KAAK,YAAY,CAAE,KAAI,QAAQ,WAAW,OAAO,WAAW,YAAa,gBAAe,UAAU;MACtH,gBAAe,OAAO,YAAY;AACvC,SAAO,KAAK,YAAY,CAAC,SAAS,QAAQ;AACzC,UAAO,YAAY;IAClB;AACF,SAAO,OAAO,aAAa,eAAe;;AAE3C,QAAO"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../core/dist/esm/types/dist/esm/nodeType.mjs
|
|
3
|
+
let NodeType = /* @__PURE__ */ function(NodeType$1) {
|
|
4
|
+
NodeType$1["Translation"] = "translation";
|
|
5
|
+
NodeType$1["Enumeration"] = "enumeration";
|
|
6
|
+
NodeType$1["Condition"] = "condition";
|
|
7
|
+
NodeType$1["Insertion"] = "insertion";
|
|
8
|
+
NodeType$1["File"] = "file";
|
|
9
|
+
NodeType$1["Object"] = "object";
|
|
10
|
+
NodeType$1["Array"] = "array";
|
|
11
|
+
NodeType$1["Nested"] = "nested";
|
|
12
|
+
NodeType$1["ReactNode"] = "reactNode";
|
|
13
|
+
NodeType$1["Markdown"] = "markdown";
|
|
14
|
+
NodeType$1["Text"] = "text";
|
|
15
|
+
NodeType$1["Number"] = "number";
|
|
16
|
+
NodeType$1["Boolean"] = "boolean";
|
|
17
|
+
NodeType$1["Gender"] = "gender";
|
|
18
|
+
NodeType$1["Null"] = "null";
|
|
19
|
+
NodeType$1["Unknown"] = "unknown";
|
|
20
|
+
return NodeType$1;
|
|
21
|
+
}({});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.NodeType = NodeType;
|
|
25
|
+
//# sourceMappingURL=nodeType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeType.cjs","names":[],"sources":["../../../../../../../../../core/dist/esm/types/dist/esm/nodeType.mjs"],"sourcesContent":["//#region ../types/dist/esm/nodeType.mjs\nlet NodeType = /* @__PURE__ */ function(NodeType$1) {\n\tNodeType$1[\"Translation\"] = \"translation\";\n\tNodeType$1[\"Enumeration\"] = \"enumeration\";\n\tNodeType$1[\"Condition\"] = \"condition\";\n\tNodeType$1[\"Insertion\"] = \"insertion\";\n\tNodeType$1[\"File\"] = \"file\";\n\tNodeType$1[\"Object\"] = \"object\";\n\tNodeType$1[\"Array\"] = \"array\";\n\tNodeType$1[\"Nested\"] = \"nested\";\n\tNodeType$1[\"ReactNode\"] = \"reactNode\";\n\tNodeType$1[\"Markdown\"] = \"markdown\";\n\tNodeType$1[\"Text\"] = \"text\";\n\tNodeType$1[\"Number\"] = \"number\";\n\tNodeType$1[\"Boolean\"] = \"boolean\";\n\tNodeType$1[\"Gender\"] = \"gender\";\n\tNodeType$1[\"Null\"] = \"null\";\n\tNodeType$1[\"Unknown\"] = \"unknown\";\n\treturn NodeType$1;\n}({});\nconst formatNodeType = (nodeType, content, additionalAttributes) => ({\n\t...additionalAttributes,\n\tnodeType,\n\t[nodeType]: content\n});\n\n//#endregion\nexport { NodeType, formatNodeType };\n//# sourceMappingURL=nodeType.mjs.map"],"mappings":";;AACA,IAAI,WAA2B,yBAAS,YAAY;AACnD,YAAW,iBAAiB;AAC5B,YAAW,iBAAiB;AAC5B,YAAW,eAAe;AAC1B,YAAW,eAAe;AAC1B,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,WAAW;AACtB,YAAW,YAAY;AACvB,YAAW,eAAe;AAC1B,YAAW,cAAc;AACzB,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,aAAa;AACxB,YAAW,YAAY;AACvB,YAAW,UAAU;AACrB,YAAW,aAAa;AACxB,QAAO;EACN,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../editor/dist/esm/compareUrls.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Compare two URLs for equality.
|
|
5
|
+
* This function is used to determine if a message originates from the same origin.
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* // Example usage
|
|
9
|
+
* console.log(compareUrls("http://localhost:5173/", "http://localhost:5173")); // true
|
|
10
|
+
* console.log(compareUrls("http://localhost:5173", "http://localhost:5173?myParam=true")); // true
|
|
11
|
+
* console.log(compareUrls("http://localhost:5173/subpath", "http://localhost:5173")); // true
|
|
12
|
+
* console.log(compareUrls("http://localhost:5172", "http://localhost:5173")); // false
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param url1 - The first URL to compare.
|
|
16
|
+
* @param url2 - The second URL to compare.
|
|
17
|
+
* @returns Whether the two URLs are equal.
|
|
18
|
+
*/
|
|
19
|
+
const compareUrls = (url1, url2) => {
|
|
20
|
+
try {
|
|
21
|
+
const parsedUrl1 = new URL(url1);
|
|
22
|
+
const parsedUrl2 = new URL(url2);
|
|
23
|
+
if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;
|
|
24
|
+
const path1 = parsedUrl1.pathname.replace(/\/$/, "");
|
|
25
|
+
const path2 = parsedUrl2.pathname.replace(/\/$/, "");
|
|
26
|
+
if (path1 !== "" && path2 !== "" && path1 !== path2) return false;
|
|
27
|
+
return true;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error("Invalid URL(s)", error, {
|
|
30
|
+
url1,
|
|
31
|
+
url2
|
|
32
|
+
});
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.compareUrls = compareUrls;
|
|
39
|
+
//# sourceMappingURL=compareUrls.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareUrls.cjs","names":[],"sources":["../../../../../../editor/dist/esm/compareUrls.mjs"],"sourcesContent":["//#region src/compareUrls.ts\n/**\n* Compare two URLs for equality.\n* This function is used to determine if a message originates from the same origin.\n*\n* ```js\n* // Example usage\n* console.log(compareUrls(\"http://localhost:5173/\", \"http://localhost:5173\")); // true\n* console.log(compareUrls(\"http://localhost:5173\", \"http://localhost:5173?myParam=true\")); // true\n* console.log(compareUrls(\"http://localhost:5173/subpath\", \"http://localhost:5173\")); // true\n* console.log(compareUrls(\"http://localhost:5172\", \"http://localhost:5173\")); // false\n* ```\n*\n* @param url1 - The first URL to compare.\n* @param url2 - The second URL to compare.\n* @returns Whether the two URLs are equal.\n*/\nconst compareUrls = (url1, url2) => {\n\ttry {\n\t\tconst parsedUrl1 = new URL(url1);\n\t\tconst parsedUrl2 = new URL(url2);\n\t\tif (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;\n\t\tconst path1 = parsedUrl1.pathname.replace(/\\/$/, \"\");\n\t\tconst path2 = parsedUrl2.pathname.replace(/\\/$/, \"\");\n\t\tif (path1 !== \"\" && path2 !== \"\" && path1 !== path2) return false;\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"Invalid URL(s)\", error, {\n\t\t\turl1,\n\t\t\turl2\n\t\t});\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { compareUrls };\n//# sourceMappingURL=compareUrls.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,eAAe,MAAM,SAAS;AACnC,KAAI;EACH,MAAM,aAAa,IAAI,IAAI,KAAK;EAChC,MAAM,aAAa,IAAI,IAAI,KAAK;AAChC,MAAI,WAAW,aAAa,WAAW,YAAY,WAAW,aAAa,WAAW,YAAY,WAAW,SAAS,WAAW,KAAM,QAAO;EAC9I,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;EACpD,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;AACpD,MAAI,UAAU,MAAM,UAAU,MAAM,UAAU,MAAO,QAAO;AAC5D,SAAO;UACC,OAAO;AACf,UAAQ,MAAM,kBAAkB,OAAO;GACtC;GACA;GACA,CAAC;AACF,SAAO"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../editor/dist/esm/mergeIframeClick.mjs
|
|
3
|
+
const mergeIframeClick = (event) => {
|
|
4
|
+
const simulatedMouseDownEvent = new MouseEvent("mousedown", {
|
|
5
|
+
bubbles: true,
|
|
6
|
+
cancelable: true,
|
|
7
|
+
view: window
|
|
8
|
+
});
|
|
9
|
+
const simulatedClickEvent = new MouseEvent("click", {
|
|
10
|
+
bubbles: true,
|
|
11
|
+
cancelable: true,
|
|
12
|
+
view: window
|
|
13
|
+
});
|
|
14
|
+
Object.assign(simulatedClickEvent, { iframeData: event });
|
|
15
|
+
Object.assign(simulatedMouseDownEvent, { iframeData: event });
|
|
16
|
+
window.dispatchEvent(simulatedClickEvent);
|
|
17
|
+
window.dispatchEvent(simulatedMouseDownEvent);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.mergeIframeClick = mergeIframeClick;
|
|
22
|
+
//# sourceMappingURL=mergeIframeClick.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeIframeClick.cjs","names":[],"sources":["../../../../../../editor/dist/esm/mergeIframeClick.mjs"],"sourcesContent":["//#region src/mergeIframeClick.ts\nconst mergeIframeClick = (event) => {\n\tconst simulatedMouseDownEvent = new MouseEvent(\"mousedown\", {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tview: window\n\t});\n\tconst simulatedClickEvent = new MouseEvent(\"click\", {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tview: window\n\t});\n\tObject.assign(simulatedClickEvent, { iframeData: event });\n\tObject.assign(simulatedMouseDownEvent, { iframeData: event });\n\twindow.dispatchEvent(simulatedClickEvent);\n\twindow.dispatchEvent(simulatedMouseDownEvent);\n};\n\n//#endregion\nexport { mergeIframeClick };\n//# sourceMappingURL=mergeIframeClick.mjs.map"],"mappings":";;AACA,MAAM,oBAAoB,UAAU;CACnC,MAAM,0BAA0B,IAAI,WAAW,aAAa;EAC3D,SAAS;EACT,YAAY;EACZ,MAAM;EACN,CAAC;CACF,MAAM,sBAAsB,IAAI,WAAW,SAAS;EACnD,SAAS;EACT,YAAY;EACZ,MAAM;EACN,CAAC;AACF,QAAO,OAAO,qBAAqB,EAAE,YAAY,OAAO,CAAC;AACzD,QAAO,OAAO,yBAAyB,EAAE,YAAY,OAAO,CAAC;AAC7D,QAAO,cAAc,oBAAoB;AACzC,QAAO,cAAc,wBAAwB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../editor/dist/esm/messagesKeys.mjs
|
|
3
|
+
let MessageKey = /* @__PURE__ */ function(MessageKey$1) {
|
|
4
|
+
MessageKey$1["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
|
|
5
|
+
MessageKey$1["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
|
|
6
|
+
MessageKey$1["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
|
|
7
|
+
MessageKey$1["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
|
|
8
|
+
MessageKey$1["INTLAYER_HOVERED_CONTENT_CHANGED"] = "INTLAYER_HOVERED_CONTENT_CHANGED";
|
|
9
|
+
MessageKey$1["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
|
|
10
|
+
MessageKey$1["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
|
|
11
|
+
MessageKey$1["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
|
|
12
|
+
MessageKey$1["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
|
|
13
|
+
MessageKey$1["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
|
|
14
|
+
return MessageKey$1;
|
|
15
|
+
}({});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.MessageKey = MessageKey;
|
|
19
|
+
//# sourceMappingURL=messagesKeys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagesKeys.cjs","names":[],"sources":["../../../../../../editor/dist/esm/messagesKeys.mjs"],"sourcesContent":["//#region src/messagesKeys.ts\nlet MessageKey = /* @__PURE__ */ function(MessageKey$1) {\n\tMessageKey$1[\"INTLAYER_CONFIGURATION\"] = \"INTLAYER_CONFIGURATION\";\n\tMessageKey$1[\"INTLAYER_CURRENT_LOCALE\"] = \"INTLAYER_CURRENT_LOCALE\";\n\tMessageKey$1[\"INTLAYER_EDITOR_ENABLED\"] = \"INTLAYER_EDITOR_ENABLED\";\n\tMessageKey$1[\"INTLAYER_URL_CHANGE\"] = \"INTLAYER_URL_CHANGE\";\n\tMessageKey$1[\"INTLAYER_HOVERED_CONTENT_CHANGED\"] = \"INTLAYER_HOVERED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_FOCUSED_CONTENT_CHANGED\"] = \"INTLAYER_FOCUSED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_LOCALE_DICTIONARIES_CHANGED\"] = \"INTLAYER_LOCALE_DICTIONARIES_CHANGED\";\n\tMessageKey$1[\"INTLAYER_DISTANT_DICTIONARIES_CHANGED\"] = \"INTLAYER_DISTANT_DICTIONARIES_CHANGED\";\n\tMessageKey$1[\"INTLAYER_EDITED_CONTENT_CHANGED\"] = \"INTLAYER_EDITED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_IFRAME_CLICKED\"] = \"INTLAYER_IFRAME_CLICKED\";\n\treturn MessageKey$1;\n}({});\n\n//#endregion\nexport { MessageKey };\n//# sourceMappingURL=messagesKeys.mjs.map"],"mappings":";;AACA,IAAI,aAA6B,yBAAS,cAAc;AACvD,cAAa,4BAA4B;AACzC,cAAa,6BAA6B;AAC1C,cAAa,6BAA6B;AAC1C,cAAa,yBAAyB;AACtC,cAAa,sCAAsC;AACnD,cAAa,sCAAsC;AACnD,cAAa,0CAA0C;AACvD,cAAa,2CAA2C;AACxD,cAAa,qCAAqC;AAClD,cAAa,6BAA6B;AAC1C,QAAO;EACN,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../types/dist/esm/nodeType.mjs
|
|
3
|
+
let NodeType = /* @__PURE__ */ function(NodeType$1) {
|
|
4
|
+
NodeType$1["Translation"] = "translation";
|
|
5
|
+
NodeType$1["Enumeration"] = "enumeration";
|
|
6
|
+
NodeType$1["Condition"] = "condition";
|
|
7
|
+
NodeType$1["Insertion"] = "insertion";
|
|
8
|
+
NodeType$1["File"] = "file";
|
|
9
|
+
NodeType$1["Object"] = "object";
|
|
10
|
+
NodeType$1["Array"] = "array";
|
|
11
|
+
NodeType$1["Nested"] = "nested";
|
|
12
|
+
NodeType$1["ReactNode"] = "reactNode";
|
|
13
|
+
NodeType$1["Markdown"] = "markdown";
|
|
14
|
+
NodeType$1["Text"] = "text";
|
|
15
|
+
NodeType$1["Number"] = "number";
|
|
16
|
+
NodeType$1["Boolean"] = "boolean";
|
|
17
|
+
NodeType$1["Gender"] = "gender";
|
|
18
|
+
NodeType$1["Null"] = "null";
|
|
19
|
+
NodeType$1["Unknown"] = "unknown";
|
|
20
|
+
return NodeType$1;
|
|
21
|
+
}({});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.NodeType = NodeType;
|
|
25
|
+
//# sourceMappingURL=nodeType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeType.cjs","names":[],"sources":["../../../../../../types/dist/esm/nodeType.mjs"],"sourcesContent":["//#region src/nodeType.ts\nlet NodeType = /* @__PURE__ */ function(NodeType$1) {\n\tNodeType$1[\"Translation\"] = \"translation\";\n\tNodeType$1[\"Enumeration\"] = \"enumeration\";\n\tNodeType$1[\"Condition\"] = \"condition\";\n\tNodeType$1[\"Insertion\"] = \"insertion\";\n\tNodeType$1[\"File\"] = \"file\";\n\tNodeType$1[\"Object\"] = \"object\";\n\tNodeType$1[\"Array\"] = \"array\";\n\tNodeType$1[\"Nested\"] = \"nested\";\n\tNodeType$1[\"ReactNode\"] = \"reactNode\";\n\tNodeType$1[\"Markdown\"] = \"markdown\";\n\tNodeType$1[\"Text\"] = \"text\";\n\tNodeType$1[\"Number\"] = \"number\";\n\tNodeType$1[\"Boolean\"] = \"boolean\";\n\tNodeType$1[\"Gender\"] = \"gender\";\n\tNodeType$1[\"Null\"] = \"null\";\n\tNodeType$1[\"Unknown\"] = \"unknown\";\n\treturn NodeType$1;\n}({});\nconst formatNodeType = (nodeType, content, additionalAttributes) => ({\n\t...additionalAttributes,\n\tnodeType,\n\t[nodeType]: content\n});\n\n//#endregion\nexport { NodeType, formatNodeType };\n//# sourceMappingURL=nodeType.mjs.map"],"mappings":";;AACA,IAAI,WAA2B,yBAAS,YAAY;AACnD,YAAW,iBAAiB;AAC5B,YAAW,iBAAiB;AAC5B,YAAW,eAAe;AAC1B,YAAW,eAAe;AAC1B,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,WAAW;AACtB,YAAW,YAAY;AACvB,YAAW,eAAe;AAC1B,YAAW,cAAc;AACzB,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,aAAa;AACxB,YAAW,YAAY;AACvB,YAAW,UAAU;AACrB,YAAW,aAAa;AACxB,QAAO;EACN,EAAE,CAAC"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import configuration from "@intlayer/config/built";
|
|
5
5
|
import { createContext, useContext, useMemo, useRef } from "react";
|
|
6
|
-
import { v4 } from "uuid";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
|
|
9
8
|
//#region src/CommunicatorContext.tsx
|
|
9
|
+
const randomUUID = () => Math.random().toString(36).slice(2);
|
|
10
10
|
const { editor } = configuration ?? {};
|
|
11
11
|
const CommunicatorContext = createContext({
|
|
12
12
|
postMessage: () => null,
|
|
@@ -18,7 +18,7 @@ const CommunicatorContext = createContext({
|
|
|
18
18
|
senderId: ""
|
|
19
19
|
});
|
|
20
20
|
const CommunicatorProvider = ({ children, allowedOrigins, postMessage }) => {
|
|
21
|
-
const senderIdRef = useRef(
|
|
21
|
+
const senderIdRef = useRef(randomUUID());
|
|
22
22
|
const value = useMemo(() => ({
|
|
23
23
|
postMessage,
|
|
24
24
|
allowedOrigins,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunicatorContext.mjs","names":["CommunicatorProvider: FC<CommunicatorProviderProps>"
|
|
1
|
+
{"version":3,"file":"CommunicatorContext.mjs","names":["CommunicatorProvider: FC<CommunicatorProviderProps>"],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n useMemo,\n useRef,\n} from 'react';\n\nconst randomUUID = () => Math.random().toString(36).slice(2);\n\nexport type UseCrossPlatformStateProps = {\n postMessage: typeof window.postMessage;\n allowedOrigins?: string[];\n senderId: string;\n};\n\nconst { editor } = configuration ?? {};\n\nconst CommunicatorContext = createContext<UseCrossPlatformStateProps>({\n postMessage: () => null,\n allowedOrigins: [\n editor?.applicationURL,\n editor?.editorURL,\n editor?.cmsURL,\n ] as string[],\n senderId: '',\n});\n\nexport type CommunicatorProviderProps = PropsWithChildren<\n Omit<UseCrossPlatformStateProps, 'senderId'>\n>;\n\nexport const CommunicatorProvider: FC<CommunicatorProviderProps> = ({\n children,\n allowedOrigins,\n postMessage,\n}) => {\n // Create a stable, unique ID for the lifetime of this app/iframe instance.\n const senderIdRef = useRef(randomUUID());\n\n const value = useMemo(\n () => ({ postMessage, allowedOrigins, senderId: senderIdRef.current }),\n [postMessage, allowedOrigins, senderIdRef.current]\n );\n\n return (\n <CommunicatorContext.Provider value={value}>\n {children}\n </CommunicatorContext.Provider>\n );\n};\n\nexport const useCommunicator = () => useContext(CommunicatorContext);\n"],"mappings":";;;;;;;;AAYA,MAAM,mBAAmB,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE;AAQ5D,MAAM,EAAE,WAAW,iBAAiB,EAAE;AAEtC,MAAM,sBAAsB,cAA0C;CACpE,mBAAmB;CACnB,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACT;CACD,UAAU;CACX,CAAC;AAMF,MAAaA,wBAAuD,EAClE,UACA,gBACA,kBACI;CAEJ,MAAM,cAAc,OAAO,YAAY,CAAC;CAExC,MAAM,QAAQ,eACL;EAAE;EAAa;EAAgB,UAAU,YAAY;EAAS,GACrE;EAAC;EAAa;EAAgB,YAAY;EAAQ,CACnD;AAED,QACE,oBAAC,oBAAoB;EAAgB;EAClC;GAC4B;;AAInC,MAAa,wBAAwB,WAAW,oBAAoB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
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) {
|
|
3
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { __require };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __require as __require$1 } from "../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../config/dist/esm/_virtual/rolldown_runtime.mjs
|
|
4
|
+
var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __require$1 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$1 !== "undefined" ? __require$1 : a)[b] }) : x)(function(x) {
|
|
5
|
+
if (typeof __require$1 !== "undefined") return __require$1.apply(this, arguments);
|
|
6
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { __require };
|
|
11
|
+
//# sourceMappingURL=rolldown_runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown_runtime.mjs","names":[],"sources":["../../../../../../../config/dist/esm/_virtual/rolldown_runtime.mjs"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __export = (all) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\treturn target;\n};\nvar __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) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function.\");\n});\n\n//#endregion\nexport { __export, __require };"],"mappings":";;;AAUA,IAAI,YAA4B,kBAAE,MAAM,uBAAmB,4BAAwB,OAAO,UAAU,cAAc,IAAI,MAAM,GAAG,EAAE,MAAM,GAAG,OAAO,uBAAmB,4BAAwB,GAAG,IAAI,CAAC,GAAG,GAAG,SAAS,GAAG;AACrN,KAAI,uBAAmB,YAAa,oBAAe,MAAM,MAAM,UAAU;AACzE,OAAM,MAAM,6BAA6B,IAAI,mEAAmE;EAC/G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built.mjs","names":[],"sources":["../../../../../../config/dist/esm/built.mjs"],"sourcesContent":["import { getConfiguration } from \"./configFile/getConfiguration.mjs\";\n\n//#region src/built.ts\nconst configuration = getConfiguration();\nvar built_default = configuration;\n\n//#endregion\nexport { built_default as default };\n//# sourceMappingURL=built.mjs.map"],"mappings":";;;AAIA,IAAI,gBADkB,kBAAkB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { normalizePath } from "../utils/normalizePath.mjs";
|
|
2
|
+
import { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from "../defaultValues/build.mjs";
|
|
3
|
+
import { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from "../defaultValues/content.mjs";
|
|
4
|
+
import { FILL } from "../defaultValues/dictionary.mjs";
|
|
5
|
+
import { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from "../defaultValues/editor.mjs";
|
|
6
|
+
import { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from "../defaultValues/internationalization.mjs";
|
|
7
|
+
import { MODE, PREFIX } from "../defaultValues/log.mjs";
|
|
8
|
+
import { BASE_PATH, ROUTING_MODE, STORAGE } from "../defaultValues/routing.mjs";
|
|
9
|
+
import { isAbsolute, join } from "node:path";
|
|
10
|
+
|
|
11
|
+
//#region ../config/dist/esm/configFile/buildConfigurationFields.mjs
|
|
12
|
+
let storedConfiguration;
|
|
13
|
+
const buildInternationalizationFields = (customConfiguration) => ({
|
|
14
|
+
locales: customConfiguration?.locales ?? LOCALES,
|
|
15
|
+
requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,
|
|
16
|
+
strictMode: customConfiguration?.strictMode ?? STRICT_MODE,
|
|
17
|
+
defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE
|
|
18
|
+
});
|
|
19
|
+
const buildRoutingFields = (customConfiguration) => ({
|
|
20
|
+
mode: customConfiguration?.mode ?? ROUTING_MODE,
|
|
21
|
+
storage: customConfiguration?.storage ?? STORAGE,
|
|
22
|
+
basePath: customConfiguration?.basePath ?? BASE_PATH
|
|
23
|
+
});
|
|
24
|
+
const buildContentFields = (customConfiguration, baseDir) => {
|
|
25
|
+
const notDerivedContentConfig = {
|
|
26
|
+
fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,
|
|
27
|
+
baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
|
|
28
|
+
excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,
|
|
29
|
+
watch: customConfiguration?.watch ?? WATCH,
|
|
30
|
+
formatCommand: customConfiguration?.formatCommand
|
|
31
|
+
};
|
|
32
|
+
const optionalJoinBaseDir = (path) => {
|
|
33
|
+
if (isAbsolute(path)) return path;
|
|
34
|
+
return join(notDerivedContentConfig.baseDir, path);
|
|
35
|
+
};
|
|
36
|
+
const baseDirDerivedConfiguration = {
|
|
37
|
+
contentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),
|
|
38
|
+
moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),
|
|
39
|
+
unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),
|
|
40
|
+
remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),
|
|
41
|
+
dictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),
|
|
42
|
+
dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),
|
|
43
|
+
fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),
|
|
44
|
+
typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),
|
|
45
|
+
mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),
|
|
46
|
+
configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),
|
|
47
|
+
cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)
|
|
48
|
+
};
|
|
49
|
+
const patternsConfiguration = {
|
|
50
|
+
watchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),
|
|
51
|
+
watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),
|
|
52
|
+
outputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
...notDerivedContentConfig,
|
|
56
|
+
...baseDirDerivedConfiguration,
|
|
57
|
+
...patternsConfiguration
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const buildEditorFields = (customConfiguration) => ({
|
|
61
|
+
applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,
|
|
62
|
+
editorURL: customConfiguration?.editorURL ?? EDITOR_URL,
|
|
63
|
+
cmsURL: customConfiguration?.cmsURL ?? CMS_URL,
|
|
64
|
+
backendURL: customConfiguration?.backendURL ?? BACKEND_URL,
|
|
65
|
+
port: customConfiguration?.port ?? PORT,
|
|
66
|
+
enabled: customConfiguration?.enabled ?? IS_ENABLED,
|
|
67
|
+
clientId: customConfiguration?.clientId ?? void 0,
|
|
68
|
+
clientSecret: customConfiguration?.clientSecret ?? void 0,
|
|
69
|
+
dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,
|
|
70
|
+
liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,
|
|
71
|
+
liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,
|
|
72
|
+
liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`
|
|
73
|
+
});
|
|
74
|
+
const buildLogFields = (customConfiguration, logFunctions) => ({
|
|
75
|
+
mode: customConfiguration?.mode ?? MODE,
|
|
76
|
+
prefix: customConfiguration?.prefix ?? PREFIX,
|
|
77
|
+
error: logFunctions?.error,
|
|
78
|
+
log: logFunctions?.log,
|
|
79
|
+
info: logFunctions?.info,
|
|
80
|
+
warn: logFunctions?.warn
|
|
81
|
+
});
|
|
82
|
+
const buildAiFields = (customConfiguration) => ({
|
|
83
|
+
provider: customConfiguration?.provider,
|
|
84
|
+
apiKey: customConfiguration?.apiKey,
|
|
85
|
+
model: customConfiguration?.model,
|
|
86
|
+
temperature: customConfiguration?.temperature,
|
|
87
|
+
applicationContext: customConfiguration?.applicationContext
|
|
88
|
+
});
|
|
89
|
+
const buildBuildFields = (customConfiguration) => ({
|
|
90
|
+
optimize: customConfiguration?.optimize ?? OPTIMIZE,
|
|
91
|
+
importMode: customConfiguration?.importMode ?? IMPORT_MODE,
|
|
92
|
+
traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,
|
|
93
|
+
outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,
|
|
94
|
+
cache: customConfiguration?.cache ?? CACHE,
|
|
95
|
+
require: customConfiguration?.require
|
|
96
|
+
});
|
|
97
|
+
const buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });
|
|
98
|
+
/**
|
|
99
|
+
* Build the configuration fields by merging the default values with the custom configuration
|
|
100
|
+
*/
|
|
101
|
+
const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
|
|
102
|
+
storedConfiguration = {
|
|
103
|
+
internationalization: buildInternationalizationFields(customConfiguration?.internationalization),
|
|
104
|
+
routing: buildRoutingFields(customConfiguration?.routing),
|
|
105
|
+
content: buildContentFields(customConfiguration?.content, baseDir),
|
|
106
|
+
editor: buildEditorFields(customConfiguration?.editor),
|
|
107
|
+
log: buildLogFields(customConfiguration?.log, logFunctions),
|
|
108
|
+
ai: buildAiFields(customConfiguration?.ai),
|
|
109
|
+
build: buildBuildFields(customConfiguration?.build),
|
|
110
|
+
dictionary: buildDictionaryFields(customConfiguration?.dictionary),
|
|
111
|
+
plugins: customConfiguration?.plugins
|
|
112
|
+
};
|
|
113
|
+
return storedConfiguration;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
export { buildConfigurationFields };
|
|
118
|
+
//# sourceMappingURL=buildConfigurationFields.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../../../../../config/dist/esm/configFile/buildConfigurationFields.mjs"],"sourcesContent":["import { normalizePath } from \"../utils/normalizePath.mjs\";\nimport { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from \"../defaultValues/build.mjs\";\nimport { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from \"../defaultValues/content.mjs\";\nimport { FILL } from \"../defaultValues/dictionary.mjs\";\nimport { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from \"../defaultValues/editor.mjs\";\nimport { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from \"../defaultValues/internationalization.mjs\";\nimport { MODE, PREFIX } from \"../defaultValues/log.mjs\";\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from \"../defaultValues/routing.mjs\";\nimport { isAbsolute, join } from \"node:path\";\n\n//#region src/configFile/buildConfigurationFields.ts\nlet storedConfiguration;\nconst buildInternationalizationFields = (customConfiguration) => ({\n\tlocales: customConfiguration?.locales ?? LOCALES,\n\trequiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,\n\tstrictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\tdefaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE\n});\nconst buildRoutingFields = (customConfiguration) => ({\n\tmode: customConfiguration?.mode ?? ROUTING_MODE,\n\tstorage: customConfiguration?.storage ?? STORAGE,\n\tbasePath: customConfiguration?.basePath ?? BASE_PATH\n});\nconst buildContentFields = (customConfiguration, baseDir) => {\n\tconst notDerivedContentConfig = {\n\t\tfileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\t\tbaseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\t\texcludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\t\twatch: customConfiguration?.watch ?? WATCH,\n\t\tformatCommand: customConfiguration?.formatCommand\n\t};\n\tconst optionalJoinBaseDir = (path) => {\n\t\tif (isAbsolute(path)) return path;\n\t\treturn join(notDerivedContentConfig.baseDir, path);\n\t};\n\tconst baseDirDerivedConfiguration = {\n\t\tcontentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),\n\t\tmoduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),\n\t\tunmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),\n\t\tremoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),\n\t\tdictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),\n\t\tdynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),\n\t\tfetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),\n\t\ttypesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n\t\tmainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n\t\tconfigDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),\n\t\tcacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)\n\t};\n\tconst patternsConfiguration = {\n\t\twatchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),\n\t\twatchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),\n\t\toutputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`\n\t};\n\treturn {\n\t\t...notDerivedContentConfig,\n\t\t...baseDirDerivedConfiguration,\n\t\t...patternsConfiguration\n\t};\n};\nconst buildEditorFields = (customConfiguration) => ({\n\tapplicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\teditorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\tcmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\tbackendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\tport: customConfiguration?.port ?? PORT,\n\tenabled: customConfiguration?.enabled ?? IS_ENABLED,\n\tclientId: customConfiguration?.clientId ?? void 0,\n\tclientSecret: customConfiguration?.clientSecret ?? void 0,\n\tdictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,\n\tliveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\tliveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\tliveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`\n});\nconst buildLogFields = (customConfiguration, logFunctions) => ({\n\tmode: customConfiguration?.mode ?? MODE,\n\tprefix: customConfiguration?.prefix ?? PREFIX,\n\terror: logFunctions?.error,\n\tlog: logFunctions?.log,\n\tinfo: logFunctions?.info,\n\twarn: logFunctions?.warn\n});\nconst buildAiFields = (customConfiguration) => ({\n\tprovider: customConfiguration?.provider,\n\tapiKey: customConfiguration?.apiKey,\n\tmodel: customConfiguration?.model,\n\ttemperature: customConfiguration?.temperature,\n\tapplicationContext: customConfiguration?.applicationContext\n});\nconst buildBuildFields = (customConfiguration) => ({\n\toptimize: customConfiguration?.optimize ?? OPTIMIZE,\n\timportMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\ttraversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\toutputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\tcache: customConfiguration?.cache ?? CACHE,\n\trequire: customConfiguration?.require\n});\nconst buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });\n/**\n* Build the configuration fields by merging the default values with the custom configuration\n*/\nconst buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {\n\tstoredConfiguration = {\n\t\tinternationalization: buildInternationalizationFields(customConfiguration?.internationalization),\n\t\trouting: buildRoutingFields(customConfiguration?.routing),\n\t\tcontent: buildContentFields(customConfiguration?.content, baseDir),\n\t\teditor: buildEditorFields(customConfiguration?.editor),\n\t\tlog: buildLogFields(customConfiguration?.log, logFunctions),\n\t\tai: buildAiFields(customConfiguration?.ai),\n\t\tbuild: buildBuildFields(customConfiguration?.build),\n\t\tdictionary: buildDictionaryFields(customConfiguration?.dictionary),\n\t\tplugins: customConfiguration?.plugins\n\t};\n\treturn storedConfiguration;\n};\n\n//#endregion\nexport { buildConfigurationFields };\n//# sourceMappingURL=buildConfigurationFields.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI;AACJ,MAAM,mCAAmC,yBAAyB;CACjE,SAAS,qBAAqB,WAAW;CACzC,iBAAiB,qBAAqB,mBAAmB,qBAAqB,WAAW;CACzF,YAAY,qBAAqB,cAAc;CAC/C,eAAe,qBAAqB,iBAAiB;CACrD;AACD,MAAM,sBAAsB,yBAAyB;CACpD,MAAM,qBAAqB,QAAQ;CACnC,SAAS,qBAAqB,WAAW;CACzC,UAAU,qBAAqB,YAAY;CAC3C;AACD,MAAM,sBAAsB,qBAAqB,YAAY;CAC5D,MAAM,0BAA0B;EAC/B,gBAAgB,qBAAqB,kBAAkB;EACvD,SAAS,qBAAqB,WAAW,WAAW,QAAQ,KAAK;EACjE,cAAc,qBAAqB,gBAAgB;EACnD,OAAO,qBAAqB,SAAS;EACrC,eAAe,qBAAqB;EACpC;CACD,MAAM,uBAAuB,SAAS;AACrC,MAAI,WAAW,KAAK,CAAE,QAAO;AAC7B,SAAO,KAAK,wBAAwB,SAAS,KAAK;;CAEnD,MAAM,8BAA8B;EACnC,aAAa,qBAAqB,cAAc,aAAa,IAAI,oBAAoB;EACrF,uBAAuB,oBAAoB,qBAAqB,yBAAyB,wBAAwB;EACjH,yBAAyB,oBAAoB,qBAAqB,2BAA2B,0BAA0B;EACvH,uBAAuB,oBAAoB,qBAAqB,yBAAyB,wBAAwB;EACjH,iBAAiB,oBAAoB,qBAAqB,mBAAmB,iBAAiB;EAC9F,wBAAwB,oBAAoB,qBAAqB,0BAA0B,yBAAyB;EACpH,sBAAsB,oBAAoB,qBAAqB,wBAAwB,uBAAuB;EAC9G,UAAU,oBAAoB,qBAAqB,YAAY,UAAU;EACzE,SAAS,oBAAoB,qBAAqB,WAAW,SAAS;EACtE,WAAW,oBAAoB,qBAAqB,aAAa,WAAW;EAC5E,UAAU,oBAAoB,qBAAqB,YAAY,UAAU;EACzE;CACD,MAAM,wBAAwB;EAC7B,qBAAqB,wBAAwB,eAAe,KAAK,QAAQ,QAAQ,MAAM;EACvF,6BAA6B,wBAAwB,eAAe,SAAS,QAAQ,4BAA4B,WAAW,KAAK,eAAe,GAAG,cAAc,WAAW,CAAC,OAAO,MAAM,CAAC;EAC3L,4BAA4B,GAAG,cAAc,4BAA4B,gBAAgB,CAAC;EAC1F;AACD,QAAO;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH;;AAEF,MAAM,qBAAqB,yBAAyB;CACnD,gBAAgB,qBAAqB,kBAAkB;CACvD,WAAW,qBAAqB,aAAa;CAC7C,QAAQ,qBAAqB,UAAU;CACvC,YAAY,qBAAqB,cAAc;CAC/C,MAAM,qBAAqB,QAAQ;CACnC,SAAS,qBAAqB,WAAW;CACzC,UAAU,qBAAqB,YAAY,KAAK;CAChD,cAAc,qBAAqB,gBAAgB,KAAK;CACxD,4BAA4B,qBAAqB,8BAA8B;CAC/E,UAAU,qBAAqB,YAAY;CAC3C,cAAc,qBAAqB,gBAAgB;CACnD,aAAa,qBAAqB,eAAe,oBAAoB,qBAAqB,gBAAgB;CAC1G;AACD,MAAM,kBAAkB,qBAAqB,kBAAkB;CAC9D,MAAM,qBAAqB,QAAQ;CACnC,QAAQ,qBAAqB,UAAU;CACvC,OAAO,cAAc;CACrB,KAAK,cAAc;CACnB,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB;AACD,MAAM,iBAAiB,yBAAyB;CAC/C,UAAU,qBAAqB;CAC/B,QAAQ,qBAAqB;CAC7B,OAAO,qBAAqB;CAC5B,aAAa,qBAAqB;CAClC,oBAAoB,qBAAqB;CACzC;AACD,MAAM,oBAAoB,yBAAyB;CAClD,UAAU,qBAAqB,YAAY;CAC3C,YAAY,qBAAqB,cAAc;CAC/C,iBAAiB,qBAAqB,mBAAmB;CACzD,cAAc,qBAAqB,gBAAgB;CACnD,OAAO,qBAAqB,SAAS;CACrC,SAAS,qBAAqB;CAC9B;AACD,MAAM,yBAAyB,yBAAyB,EAAE,MAAM,qBAAqB,QAAQ,MAAM;;;;AAInG,MAAM,4BAA4B,qBAAqB,SAAS,iBAAiB;AAChF,uBAAsB;EACrB,sBAAsB,gCAAgC,qBAAqB,qBAAqB;EAChG,SAAS,mBAAmB,qBAAqB,QAAQ;EACzD,SAAS,mBAAmB,qBAAqB,SAAS,QAAQ;EAClE,QAAQ,kBAAkB,qBAAqB,OAAO;EACtD,KAAK,eAAe,qBAAqB,KAAK,aAAa;EAC3D,IAAI,cAAc,qBAAqB,GAAG;EAC1C,OAAO,iBAAiB,qBAAqB,MAAM;EACnD,YAAY,sBAAsB,qBAAqB,WAAW;EAClE,SAAS,qBAAqB;EAC9B;AACD,QAAO"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { logger } from "../logger.mjs";
|
|
2
|
+
import { cache } from "../utils/cache.mjs";
|
|
3
|
+
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
4
|
+
import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
|
|
5
|
+
import { searchConfigurationFile } from "./searchConfigurationFile.mjs";
|
|
6
|
+
import { loadConfigurationFile } from "./loadConfigurationFile.mjs";
|
|
7
|
+
import { relative } from "node:path";
|
|
8
|
+
import merge from "deepmerge";
|
|
9
|
+
|
|
10
|
+
//#region ../config/dist/esm/configFile/getConfiguration.mjs
|
|
11
|
+
/**
|
|
12
|
+
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
13
|
+
*/
|
|
14
|
+
const getConfigurationAndFilePath = (options) => {
|
|
15
|
+
let baseDir;
|
|
16
|
+
try {
|
|
17
|
+
baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;
|
|
18
|
+
} catch (_err) {
|
|
19
|
+
return {
|
|
20
|
+
configuration: buildConfigurationFields({}, options?.baseDir, options?.logFunctions),
|
|
21
|
+
configurationFilePath: void 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const cachedConfiguration = cache.get(options);
|
|
25
|
+
if (cachedConfiguration) return cachedConfiguration;
|
|
26
|
+
const { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);
|
|
27
|
+
if (options?.override?.log?.mode === "verbose") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);
|
|
28
|
+
let storedConfiguration;
|
|
29
|
+
if (configurationFilePath) storedConfiguration = buildConfigurationFields(loadConfigurationFile(configurationFilePath, {
|
|
30
|
+
projectRequire: options?.require,
|
|
31
|
+
envVarOptions: {
|
|
32
|
+
env: options?.env,
|
|
33
|
+
envFile: options?.envFile
|
|
34
|
+
},
|
|
35
|
+
additionalEnvVars: options?.additionalEnvVars,
|
|
36
|
+
aliases: options?.aliases
|
|
37
|
+
}), options?.baseDir, options?.logFunctions);
|
|
38
|
+
const projectRequireConfig = options?.require ? { build: {
|
|
39
|
+
require: options?.require,
|
|
40
|
+
cache: options?.cache
|
|
41
|
+
} } : {};
|
|
42
|
+
const configuration = merge(merge(storedConfiguration ?? {}, projectRequireConfig), options?.override ?? {});
|
|
43
|
+
cache.set(options, {
|
|
44
|
+
configuration,
|
|
45
|
+
configurationFilePath
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
configuration,
|
|
49
|
+
configurationFilePath
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
54
|
+
*/
|
|
55
|
+
const getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;
|
|
56
|
+
const logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {
|
|
57
|
+
if (numCustomConfiguration === 0) logger("Configuration file not found, using default configuration.", { isVerbose: true });
|
|
58
|
+
else {
|
|
59
|
+
const relativeOutputPath = relative(baseDir, configurationFilePath);
|
|
60
|
+
if (numCustomConfiguration === 1) logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });
|
|
61
|
+
else logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { getConfiguration };
|
|
67
|
+
//# sourceMappingURL=getConfiguration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../../../../../config/dist/esm/configFile/getConfiguration.mjs"],"sourcesContent":["import { logger } from \"../logger.mjs\";\nimport { cache } from \"../utils/cache.mjs\";\nimport { getPackageJsonPath } from \"../utils/getPackageJsonPath.mjs\";\nimport { buildConfigurationFields } from \"./buildConfigurationFields.mjs\";\nimport { searchConfigurationFile } from \"./searchConfigurationFile.mjs\";\nimport { loadConfigurationFile } from \"./loadConfigurationFile.mjs\";\nimport { relative } from \"node:path\";\nimport merge from \"deepmerge\";\n\n//#region src/configFile/getConfiguration.ts\n/**\n* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n*/\nconst getConfigurationAndFilePath = (options) => {\n\tlet baseDir;\n\ttry {\n\t\tbaseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n\t} catch (_err) {\n\t\treturn {\n\t\t\tconfiguration: buildConfigurationFields({}, options?.baseDir, options?.logFunctions),\n\t\t\tconfigurationFilePath: void 0\n\t\t};\n\t}\n\tconst cachedConfiguration = cache.get(options);\n\tif (cachedConfiguration) return cachedConfiguration;\n\tconst { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);\n\tif (options?.override?.log?.mode === \"verbose\") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n\tlet storedConfiguration;\n\tif (configurationFilePath) storedConfiguration = buildConfigurationFields(loadConfigurationFile(configurationFilePath, {\n\t\tprojectRequire: options?.require,\n\t\tenvVarOptions: {\n\t\t\tenv: options?.env,\n\t\t\tenvFile: options?.envFile\n\t\t},\n\t\tadditionalEnvVars: options?.additionalEnvVars,\n\t\taliases: options?.aliases\n\t}), options?.baseDir, options?.logFunctions);\n\tconst projectRequireConfig = options?.require ? { build: {\n\t\trequire: options?.require,\n\t\tcache: options?.cache\n\t} } : {};\n\tconst configuration = merge(merge(storedConfiguration ?? {}, projectRequireConfig), options?.override ?? {});\n\tcache.set(options, {\n\t\tconfiguration,\n\t\tconfigurationFilePath\n\t});\n\treturn {\n\t\tconfiguration,\n\t\tconfigurationFilePath\n\t};\n};\n/**\n* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n*/\nconst getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;\nconst logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {\n\tif (numCustomConfiguration === 0) logger(\"Configuration file not found, using default configuration.\", { isVerbose: true });\n\telse {\n\t\tconst relativeOutputPath = relative(baseDir, configurationFilePath);\n\t\tif (numCustomConfiguration === 1) logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });\n\t\telse logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });\n\t}\n};\n\n//#endregion\nexport { getConfiguration, getConfigurationAndFilePath };\n//# sourceMappingURL=getConfiguration.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,+BAA+B,YAAY;CAChD,IAAI;AACJ,KAAI;AACH,YAAU,SAAS,WAAW,oBAAoB,CAAC;UAC3C,MAAM;AACd,SAAO;GACN,eAAe,yBAAyB,EAAE,EAAE,SAAS,SAAS,SAAS,aAAa;GACpF,uBAAuB,KAAK;GAC5B;;CAEF,MAAM,sBAAsB,MAAM,IAAI,QAAQ;AAC9C,KAAI,oBAAqB,QAAO;CAChC,MAAM,EAAE,uBAAuB,2BAA2B,wBAAwB,QAAQ;AAC1F,KAAI,SAAS,UAAU,KAAK,SAAS,UAAW,qBAAoB,SAAS,wBAAwB,sBAAsB;CAC3H,IAAI;AACJ,KAAI,sBAAuB,uBAAsB,yBAAyB,sBAAsB,uBAAuB;EACtH,gBAAgB,SAAS;EACzB,eAAe;GACd,KAAK,SAAS;GACd,SAAS,SAAS;GAClB;EACD,mBAAmB,SAAS;EAC5B,SAAS,SAAS;EAClB,CAAC,EAAE,SAAS,SAAS,SAAS,aAAa;CAC5C,MAAM,uBAAuB,SAAS,UAAU,EAAE,OAAO;EACxD,SAAS,SAAS;EAClB,OAAO,SAAS;EAChB,EAAE,GAAG,EAAE;CACR,MAAM,gBAAgB,MAAM,MAAM,uBAAuB,EAAE,EAAE,qBAAqB,EAAE,SAAS,YAAY,EAAE,CAAC;AAC5G,OAAM,IAAI,SAAS;EAClB;EACA;EACA,CAAC;AACF,QAAO;EACN;EACA;EACA;;;;;AAKF,MAAM,oBAAoB,YAAY,4BAA4B,QAAQ,CAAC;AAC3E,MAAM,uBAAuB,SAAS,wBAAwB,0BAA0B;AACvF,KAAI,2BAA2B,EAAG,QAAO,8DAA8D,EAAE,WAAW,MAAM,CAAC;MACtH;EACJ,MAAM,qBAAqB,SAAS,SAAS,sBAAsB;AACnE,MAAI,2BAA2B,EAAG,QAAO,6BAA6B,mBAAmB,IAAI,EAAE,WAAW,MAAM,CAAC;MAC5G,QAAO,6CAA6C,mBAAmB,IAAI,EAAE,WAAW,MAAM,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { configESMxCJSRequire } from "../utils/ESMxCJSHelpers.mjs";
|
|
2
|
+
import { loadExternalFileSync } from "../loadExternalFile/loadExternalFile.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../config/dist/esm/configFile/loadConfigurationFile.mjs
|
|
5
|
+
const filterValidConfiguration = (configuration) => {
|
|
6
|
+
return configuration;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Load the configuration file from the given path
|
|
10
|
+
* Example of configuration file: intlayer.config.js
|
|
11
|
+
*
|
|
12
|
+
* Accepts JSON, JS, MJS and TS files as configuration
|
|
13
|
+
*/
|
|
14
|
+
const loadConfigurationFile = (configFilePath, options) => {
|
|
15
|
+
return filterValidConfiguration(loadExternalFileSync(configFilePath, {
|
|
16
|
+
...options,
|
|
17
|
+
aliases: {
|
|
18
|
+
...options?.aliases,
|
|
19
|
+
intlayer: configESMxCJSRequire.resolve("@intlayer/types")
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { loadConfigurationFile };
|
|
26
|
+
//# sourceMappingURL=loadConfigurationFile.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../../../../../config/dist/esm/configFile/loadConfigurationFile.mjs"],"sourcesContent":["import { configESMxCJSRequire } from \"../utils/ESMxCJSHelpers.mjs\";\nimport { loadExternalFileSync } from \"../loadExternalFile/loadExternalFile.mjs\";\n\n//#region src/configFile/loadConfigurationFile.ts\nconst filterValidConfiguration = (configuration) => {\n\treturn configuration;\n};\n/**\n* Load the configuration file from the given path\n* Example of configuration file: intlayer.config.js\n*\n* Accepts JSON, JS, MJS and TS files as configuration\n*/\nconst loadConfigurationFile = (configFilePath, options) => {\n\treturn filterValidConfiguration(loadExternalFileSync(configFilePath, {\n\t\t...options,\n\t\taliases: {\n\t\t\t...options?.aliases,\n\t\t\tintlayer: configESMxCJSRequire.resolve(\"@intlayer/types\")\n\t\t}\n\t}));\n};\n\n//#endregion\nexport { loadConfigurationFile };\n//# sourceMappingURL=loadConfigurationFile.mjs.map"],"mappings":";;;;AAIA,MAAM,4BAA4B,kBAAkB;AACnD,QAAO;;;;;;;;AAQR,MAAM,yBAAyB,gBAAgB,YAAY;AAC1D,QAAO,yBAAyB,qBAAqB,gBAAgB;EACpE,GAAG;EACH,SAAS;GACR,GAAG,SAAS;GACZ,UAAU,qBAAqB,QAAQ,kBAAkB;GACzD;EACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { logger } from "../logger.mjs";
|
|
2
|
+
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
|
|
6
|
+
//#region ../config/dist/esm/configFile/searchConfigurationFile.mjs
|
|
7
|
+
const EXTENSION = [
|
|
8
|
+
"ts",
|
|
9
|
+
"js",
|
|
10
|
+
"json",
|
|
11
|
+
"cjs",
|
|
12
|
+
"mjs",
|
|
13
|
+
""
|
|
14
|
+
];
|
|
15
|
+
const CONFIGURATION_FILE_NAME_1 = "intlayer.config";
|
|
16
|
+
const CONFIGURATION_FILE_NAME_2 = ".intlayerrc";
|
|
17
|
+
const configurationFiles = [...EXTENSION.filter((extension) => extension !== "").map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`), CONFIGURATION_FILE_NAME_2];
|
|
18
|
+
/**
|
|
19
|
+
* Search for the configuration file in the given path
|
|
20
|
+
*
|
|
21
|
+
* List of detected configuration files:
|
|
22
|
+
* - intlayer.config.ts
|
|
23
|
+
* - intlayer.config.js
|
|
24
|
+
* - intlayer.config.json
|
|
25
|
+
* - intlayer.config.cjs
|
|
26
|
+
* - intlayer.config.mjs
|
|
27
|
+
* - .intlayerrc
|
|
28
|
+
*/
|
|
29
|
+
const searchConfigurationFile = (startDir) => {
|
|
30
|
+
let configurationFilePath;
|
|
31
|
+
let numCustomConfiguration = 0;
|
|
32
|
+
const { baseDir } = getPackageJsonPath(startDir);
|
|
33
|
+
for (const fileName of configurationFiles) try {
|
|
34
|
+
const filePath = resolve(baseDir, fileName);
|
|
35
|
+
if (!existsSync(filePath)) {} else {
|
|
36
|
+
numCustomConfiguration += 1;
|
|
37
|
+
if (!configurationFilePath) configurationFilePath = filePath;
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
logger(`${fileName}: ${error}`, { level: "error" });
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
configurationFilePath,
|
|
44
|
+
numCustomConfiguration
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { searchConfigurationFile };
|
|
50
|
+
//# sourceMappingURL=searchConfigurationFile.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchConfigurationFile.mjs","names":[],"sources":["../../../../../../../config/dist/esm/configFile/searchConfigurationFile.mjs"],"sourcesContent":["import { logger } from \"../logger.mjs\";\nimport { getPackageJsonPath } from \"../utils/getPackageJsonPath.mjs\";\nimport { resolve } from \"node:path\";\nimport { existsSync } from \"node:fs\";\n\n//#region src/configFile/searchConfigurationFile.ts\nconst EXTENSION = [\n\t\"ts\",\n\t\"js\",\n\t\"json\",\n\t\"cjs\",\n\t\"mjs\",\n\t\"\"\n];\nconst CONFIGURATION_FILE_NAME_1 = \"intlayer.config\";\nconst CONFIGURATION_FILE_NAME_2 = \".intlayerrc\";\nconst configurationFiles = [...EXTENSION.filter((extension) => extension !== \"\").map((ext) => `${CONFIGURATION_FILE_NAME_1}.${ext}`), CONFIGURATION_FILE_NAME_2];\n/**\n* Search for the configuration file in the given path\n*\n* List of detected configuration files:\n* - intlayer.config.ts\n* - intlayer.config.js\n* - intlayer.config.json\n* - intlayer.config.cjs\n* - intlayer.config.mjs\n* - .intlayerrc\n*/\nconst searchConfigurationFile = (startDir) => {\n\tlet configurationFilePath;\n\tlet numCustomConfiguration = 0;\n\tconst { baseDir } = getPackageJsonPath(startDir);\n\tfor (const fileName of configurationFiles) try {\n\t\tconst filePath = resolve(baseDir, fileName);\n\t\tif (!existsSync(filePath)) {} else {\n\t\t\tnumCustomConfiguration += 1;\n\t\t\tif (!configurationFilePath) configurationFilePath = filePath;\n\t\t}\n\t} catch (error) {\n\t\tlogger(`${fileName}: ${error}`, { level: \"error\" });\n\t}\n\treturn {\n\t\tconfigurationFilePath,\n\t\tnumCustomConfiguration\n\t};\n};\n\n//#endregion\nexport { searchConfigurationFile };\n//# sourceMappingURL=searchConfigurationFile.mjs.map"],"mappings":";;;;;;AAMA,MAAM,YAAY;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;AACD,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,qBAAqB,CAAC,GAAG,UAAU,QAAQ,cAAc,cAAc,GAAG,CAAC,KAAK,QAAQ,GAAG,0BAA0B,GAAG,MAAM,EAAE,0BAA0B;;;;;;;;;;;;AAYhK,MAAM,2BAA2B,aAAa;CAC7C,IAAI;CACJ,IAAI,yBAAyB;CAC7B,MAAM,EAAE,YAAY,mBAAmB,SAAS;AAChD,MAAK,MAAM,YAAY,mBAAoB,KAAI;EAC9C,MAAM,WAAW,QAAQ,SAAS,SAAS;AAC3C,MAAI,CAAC,WAAW,SAAS,EAAE,QAAQ;AAClC,6BAA0B;AAC1B,OAAI,CAAC,sBAAuB,yBAAwB;;UAE7C,OAAO;AACf,SAAO,GAAG,SAAS,IAAI,SAAS,EAAE,OAAO,SAAS,CAAC;;AAEpD,QAAO;EACN;EACA;EACA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region ../config/dist/esm/defaultValues/build.mjs
|
|
2
|
+
const OPTIMIZE = false;
|
|
3
|
+
const IMPORT_MODE = "static";
|
|
4
|
+
const TRAVERSE_PATTERN = ["**/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx,vue,svelte,svte}", "!**/node_modules/**"];
|
|
5
|
+
const OUTPUT_FORMAT = ["cjs", "esm"];
|
|
6
|
+
const CACHE = true;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN };
|
|
10
|
+
//# sourceMappingURL=build.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../../../../../../config/dist/esm/defaultValues/build.mjs"],"sourcesContent":["import { __export } from \"../_virtual/rolldown_runtime.mjs\";\n\n//#region src/defaultValues/build.ts\nvar build_exports = /* @__PURE__ */ __export({\n\tCACHE: () => CACHE,\n\tIMPORT_MODE: () => IMPORT_MODE,\n\tOPTIMIZE: () => OPTIMIZE,\n\tOUTPUT_FORMAT: () => OUTPUT_FORMAT,\n\tTRAVERSE_PATTERN: () => TRAVERSE_PATTERN\n});\nconst OPTIMIZE = false;\nconst IMPORT_MODE = \"static\";\nconst TRAVERSE_PATTERN = [\"**/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx,vue,svelte,svte}\", \"!**/node_modules/**\"];\nconst OUTPUT_FORMAT = [\"cjs\", \"esm\"];\nconst CACHE = true;\n\n//#endregion\nexport { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN, build_exports };\n//# sourceMappingURL=build.mjs.map"],"mappings":";AAUA,MAAM,WAAW;AACjB,MAAM,cAAc;AACpB,MAAM,mBAAmB,CAAC,wDAAwD,sBAAsB;AACxG,MAAM,gBAAgB,CAAC,OAAO,MAAM;AACpC,MAAM,QAAQ"}
|