intlayer-editor 7.1.0-canary.2 → 7.1.1-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/client/dist/assets/{CodeBlockShiki-BSALDQ1I.js → CodeBlockShiki-DjZrDqS2.js} +3 -3
- package/client/dist/assets/{bundle-web-CDKQVXX6.js → bundle-web-ByW6N4oT.js} +1 -1
- package/client/dist/assets/{index-BVgTO6SK.css → index-C_dK2Oqm.css} +35 -8
- package/client/dist/assets/{index-RhJD8Pnc.js → index-DTNRLJtJ.js} +13 -14
- package/client/dist/index.html +2 -2
- package/package.json +22 -30
- package/server/dist/_virtual/rolldown_runtime.cjs +4 -0
- package/server/dist/_virtual/rolldown_runtime.mjs +31 -0
- package/server/dist/controllers/dictionary.controller.cjs +2 -2
- package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.mjs +1 -1
- package/server/dist/index.cjs +1 -1
- package/server/dist/index.mjs +1 -1
- package/server/dist/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.cjs +99 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs +98 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +36 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +35 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.cjs +18 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs +17 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.cjs +25 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs +24 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.cjs +72 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +71 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.cjs +1744 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs +1744 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.cjs +116 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +116 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.cjs +66 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.cjs.map +1 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.mjs +65 -0
- package/server/dist/packages/@intlayer/chokidar/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
//#region ../@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs
|
|
6
|
+
const hereDirname = () => {
|
|
7
|
+
try {
|
|
8
|
+
return dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
} catch {
|
|
10
|
+
return typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const findDistRoot = (startDir) => {
|
|
14
|
+
let dir = startDir;
|
|
15
|
+
for (let i = 0; i < 12; i++) {
|
|
16
|
+
if (basename(dir) === "dist") return dir;
|
|
17
|
+
const parent = resolve(dir, "..");
|
|
18
|
+
if (parent === dir) break;
|
|
19
|
+
dir = parent;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
const normalizeFrameFile = (file) => {
|
|
24
|
+
if (!file) return null;
|
|
25
|
+
try {
|
|
26
|
+
if (file.startsWith("file://")) return fileURLToPath(file);
|
|
27
|
+
} catch {}
|
|
28
|
+
return file;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns the directory of the *caller* module that invoked readAsset.
|
|
32
|
+
* Prefers non-virtual frames; falls back to the first real frame.
|
|
33
|
+
*/
|
|
34
|
+
const getCallerDir = () => {
|
|
35
|
+
const prev = Error.prepareStackTrace;
|
|
36
|
+
try {
|
|
37
|
+
Error.prepareStackTrace = (_, structured) => structured;
|
|
38
|
+
const err = /* @__PURE__ */ new Error();
|
|
39
|
+
Error.captureStackTrace(err, getCallerDir);
|
|
40
|
+
/** @type {import('node:vm').CallSite[]} */
|
|
41
|
+
const frames = err.stack || [];
|
|
42
|
+
const isVirtualPath = (p) => p.includes(`${sep}_virtual${sep}`) || p.includes("/_virtual/");
|
|
43
|
+
for (const frame of frames) {
|
|
44
|
+
const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
|
|
45
|
+
if (!file) continue;
|
|
46
|
+
if (file.includes("node:internal") || file.includes(`${sep}internal${sep}modules${sep}`)) continue;
|
|
47
|
+
if (!isVirtualPath(file)) return dirname(file);
|
|
48
|
+
}
|
|
49
|
+
for (const frame of frames) {
|
|
50
|
+
const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
|
|
51
|
+
if (file) return dirname(file);
|
|
52
|
+
}
|
|
53
|
+
} catch {} finally {
|
|
54
|
+
Error.prepareStackTrace = prev;
|
|
55
|
+
}
|
|
56
|
+
return hereDirname();
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Read an asset copied from src/** to dist/assets/**.
|
|
60
|
+
* - './' or '../' is resolved relative to the *caller module's* emitted directory.
|
|
61
|
+
* - otherwise, treat as src-relative.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} relPath - e.g. './PROMPT.md' or 'utils/AI/askDocQuestion/embeddings/<fileKey>.json'
|
|
64
|
+
* @param {BufferEncoding} [encoding='utf8']
|
|
65
|
+
*/
|
|
66
|
+
const readAsset = (relPath, encoding = "utf8") => {
|
|
67
|
+
const here = hereDirname();
|
|
68
|
+
const distRoot = findDistRoot(here) ?? resolve(here, "..", "..", "dist");
|
|
69
|
+
const assetsRoot = join(distRoot, "assets");
|
|
70
|
+
const tried = [];
|
|
71
|
+
/**
|
|
72
|
+
* Transform dist/(esm|cjs)/... and _virtual/ prefix to clean subpath (Windows-safe)
|
|
73
|
+
*/
|
|
74
|
+
const callerSubpath = relative(distRoot, getCallerDir()).split("\\").join("/").replace(/^(?:dist\/)?(?:esm|cjs)\//, "").replace(/^_virtual\//, "");
|
|
75
|
+
if (relPath.startsWith("./") || relPath.startsWith("../")) {
|
|
76
|
+
const fromCallerAbs = resolve(assetsRoot, callerSubpath, relPath);
|
|
77
|
+
tried.push(fromCallerAbs);
|
|
78
|
+
if (existsSync(fromCallerAbs)) return readFileSync(fromCallerAbs, encoding);
|
|
79
|
+
}
|
|
80
|
+
const directPath = join(assetsRoot, relPath);
|
|
81
|
+
tried.push(directPath);
|
|
82
|
+
if (existsSync(directPath)) return readFileSync(directPath, encoding);
|
|
83
|
+
if (callerSubpath) {
|
|
84
|
+
const nested = join(assetsRoot, callerSubpath, relPath);
|
|
85
|
+
tried.push(nested);
|
|
86
|
+
if (existsSync(nested)) return readFileSync(nested, encoding);
|
|
87
|
+
}
|
|
88
|
+
const msg = [
|
|
89
|
+
"readAsset: file not found.",
|
|
90
|
+
"Searched:",
|
|
91
|
+
...tried.map((p) => `- ${p}`)
|
|
92
|
+
].join("\n");
|
|
93
|
+
throw new Error(msg);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { readAsset };
|
|
98
|
+
//# sourceMappingURL=_utils_asset.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_utils_asset.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n//#region \\0utils:asset\nconst hereDirname = () => {\n\ttry {\n\t\treturn dirname(fileURLToPath(import.meta.url));\n\t} catch {\n\t\treturn typeof __dirname !== \"undefined\" ? __dirname : process.cwd();\n\t}\n};\nconst findDistRoot = (startDir) => {\n\tlet dir = startDir;\n\tfor (let i = 0; i < 12; i++) {\n\t\tif (basename(dir) === \"dist\") return dir;\n\t\tconst parent = resolve(dir, \"..\");\n\t\tif (parent === dir) break;\n\t\tdir = parent;\n\t}\n\treturn null;\n};\nconst normalizeFrameFile = (file) => {\n\tif (!file) return null;\n\ttry {\n\t\tif (file.startsWith(\"file://\")) return fileURLToPath(file);\n\t} catch {}\n\treturn file;\n};\n/**\n* Returns the directory of the *caller* module that invoked readAsset.\n* Prefers non-virtual frames; falls back to the first real frame.\n*/\nconst getCallerDir = () => {\n\tconst prev = Error.prepareStackTrace;\n\ttry {\n\t\tError.prepareStackTrace = (_, structured) => structured;\n\t\tconst err = /* @__PURE__ */ new Error();\n\t\tError.captureStackTrace(err, getCallerDir);\n\t\t/** @type {import('node:vm').CallSite[]} */\n\t\tconst frames = err.stack || [];\n\t\tconst isVirtualPath = (p) => p.includes(`${sep}_virtual${sep}`) || p.includes(\"/_virtual/\");\n\t\tfor (const frame of frames) {\n\t\t\tconst file = normalizeFrameFile(typeof frame.getFileName === \"function\" ? frame.getFileName() : null);\n\t\t\tif (!file) continue;\n\t\t\tif (file.includes(\"node:internal\") || file.includes(`${sep}internal${sep}modules${sep}`)) continue;\n\t\t\tif (!isVirtualPath(file)) return dirname(file);\n\t\t}\n\t\tfor (const frame of frames) {\n\t\t\tconst file = normalizeFrameFile(typeof frame.getFileName === \"function\" ? frame.getFileName() : null);\n\t\t\tif (file) return dirname(file);\n\t\t}\n\t} catch {} finally {\n\t\tError.prepareStackTrace = prev;\n\t}\n\treturn hereDirname();\n};\n/**\n* Read an asset copied from src/** to dist/assets/**.\n* - './' or '../' is resolved relative to the *caller module's* emitted directory.\n* - otherwise, treat as src-relative.\n*\n* @param {string} relPath - e.g. './PROMPT.md' or 'utils/AI/askDocQuestion/embeddings/<fileKey>.json'\n* @param {BufferEncoding} [encoding='utf8']\n*/\nconst readAsset = (relPath, encoding = \"utf8\") => {\n\tconst here = hereDirname();\n\tconst distRoot = findDistRoot(here) ?? resolve(here, \"..\", \"..\", \"dist\");\n\tconst assetsRoot = join(distRoot, \"assets\");\n\tconst tried = [];\n\t/**\n\t* Transform dist/(esm|cjs)/... and _virtual/ prefix to clean subpath (Windows-safe)\n\t*/\n\tconst callerSubpath = relative(distRoot, getCallerDir()).split(\"\\\\\").join(\"/\").replace(/^(?:dist\\/)?(?:esm|cjs)\\//, \"\").replace(/^_virtual\\//, \"\");\n\tif (relPath.startsWith(\"./\") || relPath.startsWith(\"../\")) {\n\t\tconst fromCallerAbs = resolve(assetsRoot, callerSubpath, relPath);\n\t\ttried.push(fromCallerAbs);\n\t\tif (existsSync(fromCallerAbs)) return readFileSync(fromCallerAbs, encoding);\n\t}\n\tconst directPath = join(assetsRoot, relPath);\n\ttried.push(directPath);\n\tif (existsSync(directPath)) return readFileSync(directPath, encoding);\n\tif (callerSubpath) {\n\t\tconst nested = join(assetsRoot, callerSubpath, relPath);\n\t\ttried.push(nested);\n\t\tif (existsSync(nested)) return readFileSync(nested, encoding);\n\t}\n\tconst msg = [\n\t\t\"readAsset: file not found.\",\n\t\t\"Searched:\",\n\t\t...tried.map((p) => `- ${p}`)\n\t].join(\"\\n\");\n\tthrow new Error(msg);\n};\n\n//#endregion\nexport { readAsset };"],"mappings":";;;;;AAKA,MAAM,oBAAoB;AACzB,KAAI;AACH,SAAO,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;SACvC;AACP,SAAO,OAAO,cAAc,cAAc,YAAY,QAAQ,KAAK;;;AAGrE,MAAM,gBAAgB,aAAa;CAClC,IAAI,MAAM;AACV,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK;AAC5B,MAAI,SAAS,IAAI,KAAK,OAAQ,QAAO;EACrC,MAAM,SAAS,QAAQ,KAAK,KAAK;AACjC,MAAI,WAAW,IAAK;AACpB,QAAM;;AAEP,QAAO;;AAER,MA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,eAAe,GAAG;AAClJ,KAAI,QAAQ,WAAW,KAAK,IAAI,QAAQ,WAAW,MAAM,EAAE;EAC1D,MAAM,gBAAgB,QAAQ,YAAY,eAAe,QAAQ;AACjE,QAAM,KAAK,cAAc;AACzB,MAAI,WAAW,cAAc,CAAE,QAAO,aAAa,eAAe,SAAS;;CAE5E,MAAM,aAAa,KAAK,YAAY,QAAQ;AAC5C,OAAM,KAAK,WAAW;AACtB,KAAI,WAAW,WAAW,CAAE,QAAO,aAAa,YAAY,SAAS;AACrE,KAAI,eAAe;EAClB,MAAM,SAAS,KAAK,YAAY,eAAe,QAAQ;AACvD,QAAM,KAAK,OAAO;AAClB,MAAI,WAAW,OAAO,CAAE,QAAO,aAAa,QAAQ,SAAS;;CAE9D,MAAM,MAAM;EACX;EACA;EACA,GAAG,MAAM,KAAK,MAAM,KAAK,IAAI;EAC7B,CAAC,KAAK,KAAK;AACZ,OAAM,IAAI,MAAM,IAAI"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__utils_asset = require('../_virtual/_utils_asset.cjs');
|
|
3
|
+
let __intlayer_config = require("@intlayer/config");
|
|
4
|
+
|
|
5
|
+
//#region ../@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs
|
|
6
|
+
const getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {
|
|
7
|
+
let fileTemplate;
|
|
8
|
+
switch (format) {
|
|
9
|
+
case "ts":
|
|
10
|
+
fileTemplate = "./tsTemplate.txt";
|
|
11
|
+
break;
|
|
12
|
+
case "cjs":
|
|
13
|
+
fileTemplate = "./cjsTemplate.txt";
|
|
14
|
+
break;
|
|
15
|
+
case "json":
|
|
16
|
+
fileTemplate = "./jsonTemplate.txt";
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
fileTemplate = "./esmTemplate.txt";
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
const fileContent = require__utils_asset.readAsset(fileTemplate);
|
|
23
|
+
const camelCaseKey = (0, __intlayer_config.kebabCaseToCamelCase)(key);
|
|
24
|
+
const nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);
|
|
25
|
+
const fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {
|
|
26
|
+
if (typeof value === "object") return `\n '${key$1}': ${JSON.stringify(value)},`;
|
|
27
|
+
if (typeof value === "boolean" || typeof value === "number") return `\n '${key$1}': ${value},`;
|
|
28
|
+
if (typeof value === "string") return `\n '${key$1}': '${value}',`;
|
|
29
|
+
return `\n '${key$1}': ${value},`;
|
|
30
|
+
}).join("");
|
|
31
|
+
return fileContent.replace("{{key}}", key).replaceAll("{{name}}", nonCapitalizedCamelCaseKey).replace("{{fileParams}}", fileParamsString);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.getContentDeclarationFileTemplate = getContentDeclarationFileTemplate;
|
|
36
|
+
//# sourceMappingURL=getContentDeclarationFileTemplate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":["readAsset"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs"],"sourcesContent":["import { readAsset } from \"../_virtual/_utils_asset.mjs\";\nimport { kebabCaseToCamelCase } from \"@intlayer/config\";\n\n//#region src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts\nconst getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {\n\tlet fileTemplate;\n\tswitch (format) {\n\t\tcase \"ts\":\n\t\t\tfileTemplate = \"./tsTemplate.txt\";\n\t\t\tbreak;\n\t\tcase \"cjs\":\n\t\t\tfileTemplate = \"./cjsTemplate.txt\";\n\t\t\tbreak;\n\t\tcase \"json\":\n\t\t\tfileTemplate = \"./jsonTemplate.txt\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfileTemplate = \"./esmTemplate.txt\";\n\t\t\tbreak;\n\t}\n\tconst fileContent = readAsset(fileTemplate);\n\tconst camelCaseKey = kebabCaseToCamelCase(key);\n\tconst nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\tconst fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {\n\t\tif (typeof value === \"object\") return `\\n '${key$1}': ${JSON.stringify(value)},`;\n\t\tif (typeof value === \"boolean\" || typeof value === \"number\") return `\\n '${key$1}': ${value},`;\n\t\tif (typeof value === \"string\") return `\\n '${key$1}': '${value}',`;\n\t\treturn `\\n '${key$1}': ${value},`;\n\t}).join(\"\");\n\treturn fileContent.replace(\"{{key}}\", key).replaceAll(\"{{name}}\", nonCapitalizedCamelCaseKey).replace(\"{{fileParams}}\", fileParamsString);\n};\n\n//#endregion\nexport { getContentDeclarationFileTemplate };\n//# sourceMappingURL=getContentDeclarationFileTemplate.mjs.map"],"mappings":";;;;;AAIA,MAAM,oCAAoC,OAAO,KAAK,QAAQ,aAAa,EAAE,KAAK;CACjF,IAAI;AACJ,SAAQ,QAAR;EACC,KAAK;AACJ,kBAAe;AACf;EACD,KAAK;AACJ,kBAAe;AACf;EACD,KAAK;AACJ,kBAAe;AACf;EACD;AACC,kBAAe;AACf;;CAEF,MAAM,cAAcA,+BAAU,aAAa;CAC3C,MAAM,2DAAoC,IAAI;CAC9C,MAAM,6BAA6B,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAC/F,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAK,EAAE,CAAC,KAAK,CAAC,OAAO,WAAW;AACnH,MAAI,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,KAAK,KAAK,UAAU,MAAM,CAAC;AAC/E,MAAI,OAAO,UAAU,aAAa,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,KAAK,MAAM;AAC7F,MAAI,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,MAAM,MAAM;AAChE,SAAO,QAAQ,MAAM,KAAK,MAAM;GAC/B,CAAC,KAAK,GAAG;AACX,QAAO,YAAY,QAAQ,WAAW,IAAI,CAAC,WAAW,YAAY,2BAA2B,CAAC,QAAQ,kBAAkB,iBAAiB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readAsset } from "../_virtual/_utils_asset.mjs";
|
|
2
|
+
import { kebabCaseToCamelCase } from "@intlayer/config";
|
|
3
|
+
|
|
4
|
+
//#region ../@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs
|
|
5
|
+
const getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {
|
|
6
|
+
let fileTemplate;
|
|
7
|
+
switch (format) {
|
|
8
|
+
case "ts":
|
|
9
|
+
fileTemplate = "./tsTemplate.txt";
|
|
10
|
+
break;
|
|
11
|
+
case "cjs":
|
|
12
|
+
fileTemplate = "./cjsTemplate.txt";
|
|
13
|
+
break;
|
|
14
|
+
case "json":
|
|
15
|
+
fileTemplate = "./jsonTemplate.txt";
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
fileTemplate = "./esmTemplate.txt";
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
const fileContent = readAsset(fileTemplate);
|
|
22
|
+
const camelCaseKey = kebabCaseToCamelCase(key);
|
|
23
|
+
const nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);
|
|
24
|
+
const fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {
|
|
25
|
+
if (typeof value === "object") return `\n '${key$1}': ${JSON.stringify(value)},`;
|
|
26
|
+
if (typeof value === "boolean" || typeof value === "number") return `\n '${key$1}': ${value},`;
|
|
27
|
+
if (typeof value === "string") return `\n '${key$1}': '${value}',`;
|
|
28
|
+
return `\n '${key$1}': ${value},`;
|
|
29
|
+
}).join("");
|
|
30
|
+
return fileContent.replace("{{key}}", key).replaceAll("{{name}}", nonCapitalizedCamelCaseKey).replace("{{fileParams}}", fileParamsString);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { getContentDeclarationFileTemplate };
|
|
35
|
+
//# sourceMappingURL=getContentDeclarationFileTemplate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContentDeclarationFileTemplate.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs"],"sourcesContent":["import { readAsset } from \"../_virtual/_utils_asset.mjs\";\nimport { kebabCaseToCamelCase } from \"@intlayer/config\";\n\n//#region src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts\nconst getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {\n\tlet fileTemplate;\n\tswitch (format) {\n\t\tcase \"ts\":\n\t\t\tfileTemplate = \"./tsTemplate.txt\";\n\t\t\tbreak;\n\t\tcase \"cjs\":\n\t\t\tfileTemplate = \"./cjsTemplate.txt\";\n\t\t\tbreak;\n\t\tcase \"json\":\n\t\t\tfileTemplate = \"./jsonTemplate.txt\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfileTemplate = \"./esmTemplate.txt\";\n\t\t\tbreak;\n\t}\n\tconst fileContent = readAsset(fileTemplate);\n\tconst camelCaseKey = kebabCaseToCamelCase(key);\n\tconst nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\tconst fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {\n\t\tif (typeof value === \"object\") return `\\n '${key$1}': ${JSON.stringify(value)},`;\n\t\tif (typeof value === \"boolean\" || typeof value === \"number\") return `\\n '${key$1}': ${value},`;\n\t\tif (typeof value === \"string\") return `\\n '${key$1}': '${value}',`;\n\t\treturn `\\n '${key$1}': ${value},`;\n\t}).join(\"\");\n\treturn fileContent.replace(\"{{key}}\", key).replaceAll(\"{{name}}\", nonCapitalizedCamelCaseKey).replace(\"{{fileParams}}\", fileParamsString);\n};\n\n//#endregion\nexport { getContentDeclarationFileTemplate };\n//# sourceMappingURL=getContentDeclarationFileTemplate.mjs.map"],"mappings":";;;;AAIA,MAAM,oCAAoC,OAAO,KAAK,QAAQ,aAAa,EAAE,KAAK;CACjF,IAAI;AACJ,SAAQ,QAAR;EACC,KAAK;AACJ,kBAAe;AACf;EACD,KAAK;AACJ,kBAAe;AACf;EACD,KAAK;AACJ,kBAAe;AACf;EACD;AACC,kBAAe;AACf;;CAEF,MAAM,cAAc,UAAU,aAAa;CAC3C,MAAM,eAAe,qBAAqB,IAAI;CAC9C,MAAM,6BAA6B,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAC/F,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAK,EAAE,CAAC,KAAK,CAAC,OAAO,WAAW;AACnH,MAAI,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,KAAK,KAAK,UAAU,MAAM,CAAC;AAC/E,MAAI,OAAO,UAAU,aAAa,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,KAAK,MAAM;AAC7F,MAAI,OAAO,UAAU,SAAU,QAAO,QAAQ,MAAM,MAAM,MAAM;AAChE,SAAO,QAAQ,MAAM,KAAK,MAAM;GAC/B,CAAC,KAAK,GAAG;AACX,QAAO,YAAY,QAAQ,WAAW,IAAI,CAAC,WAAW,YAAY,2BAA2B,CAAC,QAAQ,kBAAkB,iBAAiB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs
|
|
3
|
+
const getFormatFromExtension = (extension) => {
|
|
4
|
+
switch (extension) {
|
|
5
|
+
case ".ts":
|
|
6
|
+
case ".tsx": return "ts";
|
|
7
|
+
case ".cjs":
|
|
8
|
+
case ".cjsx": return "cjs";
|
|
9
|
+
case ".mjs": return "esm";
|
|
10
|
+
case ".json":
|
|
11
|
+
case ".json5": return "json";
|
|
12
|
+
}
|
|
13
|
+
return "esm";
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.getFormatFromExtension = getFormatFromExtension;
|
|
18
|
+
//# sourceMappingURL=getFormatFromExtension.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormatFromExtension.cjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs"],"sourcesContent":["//#region src/utils/getFormatFromExtension.ts\nconst getFormatFromExtension = (extension) => {\n\tswitch (extension) {\n\t\tcase \".ts\":\n\t\tcase \".tsx\": return \"ts\";\n\t\tcase \".cjs\":\n\t\tcase \".cjsx\": return \"cjs\";\n\t\tcase \".mjs\": return \"esm\";\n\t\tcase \".json\":\n\t\tcase \".json5\": return \"json\";\n\t}\n\treturn \"esm\";\n};\nconst getExtensionFromFormat = (format) => {\n\tswitch (format) {\n\t\tcase \"ts\": return \".ts\";\n\t\tcase \"cjs\": return \".cjs\";\n\t\tcase \"json\": return \".json\";\n\t\tcase \"esm\": return \".mjs\";\n\t}\n\treturn \".mjs\";\n};\n\n//#endregion\nexport { getExtensionFromFormat, getFormatFromExtension };\n//# sourceMappingURL=getFormatFromExtension.mjs.map"],"mappings":";;AACA,MAAM,0BAA0B,cAAc;AAC7C,SAAQ,WAAR;EACC,KAAK;EACL,KAAK,OAAQ,QAAO;EACpB,KAAK;EACL,KAAK,QAAS,QAAO;EACrB,KAAK,OAAQ,QAAO;EACpB,KAAK;EACL,KAAK,SAAU,QAAO;;AAEvB,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs
|
|
2
|
+
const getFormatFromExtension = (extension) => {
|
|
3
|
+
switch (extension) {
|
|
4
|
+
case ".ts":
|
|
5
|
+
case ".tsx": return "ts";
|
|
6
|
+
case ".cjs":
|
|
7
|
+
case ".cjsx": return "cjs";
|
|
8
|
+
case ".mjs": return "esm";
|
|
9
|
+
case ".json":
|
|
10
|
+
case ".json5": return "json";
|
|
11
|
+
}
|
|
12
|
+
return "esm";
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getFormatFromExtension };
|
|
17
|
+
//# sourceMappingURL=getFormatFromExtension.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormatFromExtension.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/utils/getFormatFromExtension.mjs"],"sourcesContent":["//#region src/utils/getFormatFromExtension.ts\nconst getFormatFromExtension = (extension) => {\n\tswitch (extension) {\n\t\tcase \".ts\":\n\t\tcase \".tsx\": return \"ts\";\n\t\tcase \".cjs\":\n\t\tcase \".cjsx\": return \"cjs\";\n\t\tcase \".mjs\": return \"esm\";\n\t\tcase \".json\":\n\t\tcase \".json5\": return \"json\";\n\t}\n\treturn \"esm\";\n};\nconst getExtensionFromFormat = (format) => {\n\tswitch (format) {\n\t\tcase \"ts\": return \".ts\";\n\t\tcase \"cjs\": return \".cjs\";\n\t\tcase \"json\": return \".json\";\n\t\tcase \"esm\": return \".mjs\";\n\t}\n\treturn \".mjs\";\n};\n\n//#endregion\nexport { getExtensionFromFormat, getFormatFromExtension };\n//# sourceMappingURL=getFormatFromExtension.mjs.map"],"mappings":";AACA,MAAM,0BAA0B,cAAc;AAC7C,SAAQ,WAAR;EACC,KAAK;EACL,KAAK,OAAQ,QAAO;EACpB,KAAK;EACL,KAAK,QAAS,QAAO;EACrB,KAAK,OAAQ,QAAO;EACpB,KAAK;EACL,KAAK,SAAU,QAAO;;AAEvB,QAAO"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_config = require("@intlayer/config");
|
|
3
|
+
|
|
4
|
+
//#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs
|
|
5
|
+
const detectFormatCommand = (configuration) => {
|
|
6
|
+
const { formatCommand } = configuration.content;
|
|
7
|
+
const projectRequire = (0, __intlayer_config.getProjectRequire)();
|
|
8
|
+
if (formatCommand) return formatCommand;
|
|
9
|
+
try {
|
|
10
|
+
projectRequire.resolve("prettier");
|
|
11
|
+
return "prettier --write \"{{file}}\" --log-level silent";
|
|
12
|
+
} catch (_error) {}
|
|
13
|
+
try {
|
|
14
|
+
projectRequire.resolve("biome");
|
|
15
|
+
return "biome format \"{{file}}\" --write --log-level none";
|
|
16
|
+
} catch (_error) {}
|
|
17
|
+
try {
|
|
18
|
+
projectRequire.resolve("eslint");
|
|
19
|
+
return "eslint --fix \"{{file}}\" --quiet";
|
|
20
|
+
} catch (_error) {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.detectFormatCommand = detectFormatCommand;
|
|
25
|
+
//# sourceMappingURL=detectFormatCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs"],"sourcesContent":["import { getProjectRequire } from \"@intlayer/config\";\n\n//#region src/writeContentDeclaration/detectFormatCommand.ts\nconst detectFormatCommand = (configuration) => {\n\tconst { formatCommand } = configuration.content;\n\tconst projectRequire = getProjectRequire();\n\tif (formatCommand) return formatCommand;\n\ttry {\n\t\tprojectRequire.resolve(\"prettier\");\n\t\treturn \"prettier --write \\\"{{file}}\\\" --log-level silent\";\n\t} catch (_error) {}\n\ttry {\n\t\tprojectRequire.resolve(\"biome\");\n\t\treturn \"biome format \\\"{{file}}\\\" --write --log-level none\";\n\t} catch (_error) {}\n\ttry {\n\t\tprojectRequire.resolve(\"eslint\");\n\t\treturn \"eslint --fix \\\"{{file}}\\\" --quiet\";\n\t} catch (_error) {}\n};\n\n//#endregion\nexport { detectFormatCommand };\n//# sourceMappingURL=detectFormatCommand.mjs.map"],"mappings":";;;;AAGA,MAAM,uBAAuB,kBAAkB;CAC9C,MAAM,EAAE,kBAAkB,cAAc;CACxC,MAAM,2DAAoC;AAC1C,KAAI,cAAe,QAAO;AAC1B,KAAI;AACH,iBAAe,QAAQ,WAAW;AAClC,SAAO;UACC,QAAQ;AACjB,KAAI;AACH,iBAAe,QAAQ,QAAQ;AAC/B,SAAO;UACC,QAAQ;AACjB,KAAI;AACH,iBAAe,QAAQ,SAAS;AAChC,SAAO;UACC,QAAQ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getProjectRequire } from "@intlayer/config";
|
|
2
|
+
|
|
3
|
+
//#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs
|
|
4
|
+
const detectFormatCommand = (configuration) => {
|
|
5
|
+
const { formatCommand } = configuration.content;
|
|
6
|
+
const projectRequire = getProjectRequire();
|
|
7
|
+
if (formatCommand) return formatCommand;
|
|
8
|
+
try {
|
|
9
|
+
projectRequire.resolve("prettier");
|
|
10
|
+
return "prettier --write \"{{file}}\" --log-level silent";
|
|
11
|
+
} catch (_error) {}
|
|
12
|
+
try {
|
|
13
|
+
projectRequire.resolve("biome");
|
|
14
|
+
return "biome format \"{{file}}\" --write --log-level none";
|
|
15
|
+
} catch (_error) {}
|
|
16
|
+
try {
|
|
17
|
+
projectRequire.resolve("eslint");
|
|
18
|
+
return "eslint --fix \"{{file}}\" --quiet";
|
|
19
|
+
} catch (_error) {}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { detectFormatCommand };
|
|
24
|
+
//# sourceMappingURL=detectFormatCommand.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectFormatCommand.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/detectFormatCommand.mjs"],"sourcesContent":["import { getProjectRequire } from \"@intlayer/config\";\n\n//#region src/writeContentDeclaration/detectFormatCommand.ts\nconst detectFormatCommand = (configuration) => {\n\tconst { formatCommand } = configuration.content;\n\tconst projectRequire = getProjectRequire();\n\tif (formatCommand) return formatCommand;\n\ttry {\n\t\tprojectRequire.resolve(\"prettier\");\n\t\treturn \"prettier --write \\\"{{file}}\\\" --log-level silent\";\n\t} catch (_error) {}\n\ttry {\n\t\tprojectRequire.resolve(\"biome\");\n\t\treturn \"biome format \\\"{{file}}\\\" --write --log-level none\";\n\t} catch (_error) {}\n\ttry {\n\t\tprojectRequire.resolve(\"eslint\");\n\t\treturn \"eslint --fix \\\"{{file}}\\\" --quiet\";\n\t} catch (_error) {}\n};\n\n//#endregion\nexport { detectFormatCommand };\n//# sourceMappingURL=detectFormatCommand.mjs.map"],"mappings":";;;AAGA,MAAM,uBAAuB,kBAAkB;CAC9C,MAAM,EAAE,kBAAkB,cAAc;CACxC,MAAM,iBAAiB,mBAAmB;AAC1C,KAAI,cAAe,QAAO;AAC1B,KAAI;AACH,iBAAe,QAAQ,WAAW;AAClC,SAAO;UACC,QAAQ;AACjB,KAAI;AACH,iBAAe,QAAQ,QAAQ;AAC/B,SAAO;UACC,QAAQ;AACjB,KAAI;AACH,iBAAe,QAAQ,SAAS;AAChC,SAAO;UACC,QAAQ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_config = require("@intlayer/config");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
let __intlayer_core = require("@intlayer/core");
|
|
6
|
+
let __intlayer_types = require("@intlayer/types");
|
|
7
|
+
|
|
8
|
+
//#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs
|
|
9
|
+
/**
|
|
10
|
+
* Write file plugin
|
|
11
|
+
*/
|
|
12
|
+
const writeFilePlugin = {
|
|
13
|
+
id: "write-file-plugin",
|
|
14
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === __intlayer_types.NodeType.File,
|
|
15
|
+
transform: (node) => {
|
|
16
|
+
const fileContent = node.content;
|
|
17
|
+
const filePath = node.fixedPath;
|
|
18
|
+
if (typeof fileContent !== "string") throw new Error("File content must be a string");
|
|
19
|
+
if (typeof filePath !== "string") throw new Error("File path must be a string");
|
|
20
|
+
try {
|
|
21
|
+
const absoluteFilePath = (0, node_path.join)(process.cwd(), filePath);
|
|
22
|
+
const fileDirectory = (0, node_path.dirname)(absoluteFilePath);
|
|
23
|
+
if (!(0, node_fs.existsSync)(fileDirectory)) (0, node_fs.mkdirSync)(fileDirectory, { recursive: true });
|
|
24
|
+
(0, node_fs.writeFileSync)(absoluteFilePath, fileContent);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new Error(`${__intlayer_config.x} Error writing file to ${(0, __intlayer_config.colorizePath)(filePath)}: ${error}`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
nodeType: __intlayer_types.NodeType.File,
|
|
30
|
+
[__intlayer_types.NodeType.File]: node.file
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Markdown file plugin
|
|
36
|
+
*/
|
|
37
|
+
const markdownFilePlugin = {
|
|
38
|
+
id: "markdown-file-plugin",
|
|
39
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === __intlayer_types.NodeType.Markdown,
|
|
40
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
41
|
+
return {
|
|
42
|
+
nodeType: __intlayer_types.NodeType.Markdown,
|
|
43
|
+
[__intlayer_types.NodeType.Markdown]: deepTransformNode$1(node.markdown, props)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Insertion file plugin
|
|
49
|
+
*/
|
|
50
|
+
const insertionFilePlugin = {
|
|
51
|
+
id: "insertion-file-plugin",
|
|
52
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === __intlayer_types.NodeType.Insertion,
|
|
53
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
54
|
+
return {
|
|
55
|
+
nodeType: __intlayer_types.NodeType.Insertion,
|
|
56
|
+
[__intlayer_types.NodeType.Insertion]: deepTransformNode$1(node.insertion, props)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const processContentDeclarationContent = async (dictionary) => (0, __intlayer_core.deepTransformNode)(dictionary, {
|
|
61
|
+
dictionaryKey: dictionary.key,
|
|
62
|
+
keyPath: [],
|
|
63
|
+
plugins: [
|
|
64
|
+
writeFilePlugin,
|
|
65
|
+
markdownFilePlugin,
|
|
66
|
+
insertionFilePlugin
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.processContentDeclarationContent = processContentDeclarationContent;
|
|
72
|
+
//# sourceMappingURL=processContentDeclarationContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processContentDeclarationContent.cjs","names":["NodeType","x"],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { colorizePath, x } from \"@intlayer/config\";\nimport { dirname, join } from \"node:path\";\nimport { deepTransformNode } from \"@intlayer/core\";\nimport { NodeType } from \"@intlayer/types\";\n\n//#region src/writeContentDeclaration/processContentDeclarationContent.ts\n/**\n* Write file plugin\n*/\nconst writeFilePlugin = {\n\tid: \"write-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.File,\n\ttransform: (node) => {\n\t\tconst fileContent = node.content;\n\t\tconst filePath = node.fixedPath;\n\t\tif (typeof fileContent !== \"string\") throw new Error(\"File content must be a string\");\n\t\tif (typeof filePath !== \"string\") throw new Error(\"File path must be a string\");\n\t\ttry {\n\t\t\tconst absoluteFilePath = join(process.cwd(), filePath);\n\t\t\tconst fileDirectory = dirname(absoluteFilePath);\n\t\t\tif (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });\n\t\t\twriteFileSync(absoluteFilePath, fileContent);\n\t\t} catch (error) {\n\t\t\tthrow new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);\n\t\t}\n\t\treturn {\n\t\t\tnodeType: NodeType.File,\n\t\t\t[NodeType.File]: node.file\n\t\t};\n\t}\n};\n/**\n* Markdown file plugin\n*/\nconst markdownFilePlugin = {\n\tid: \"markdown-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.Markdown,\n\ttransform: (node, props, deepTransformNode$1) => {\n\t\treturn {\n\t\t\tnodeType: NodeType.Markdown,\n\t\t\t[NodeType.Markdown]: deepTransformNode$1(node.markdown, props)\n\t\t};\n\t}\n};\n/**\n* Insertion file plugin\n*/\nconst insertionFilePlugin = {\n\tid: \"insertion-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.Insertion,\n\ttransform: (node, props, deepTransformNode$1) => {\n\t\treturn {\n\t\t\tnodeType: NodeType.Insertion,\n\t\t\t[NodeType.Insertion]: deepTransformNode$1(node.insertion, props)\n\t\t};\n\t}\n};\nconst processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {\n\tdictionaryKey: dictionary.key,\n\tkeyPath: [],\n\tplugins: [\n\t\twriteFilePlugin,\n\t\tmarkdownFilePlugin,\n\t\tinsertionFilePlugin\n\t]\n});\n\n//#endregion\nexport { processContentDeclarationContent };\n//# sourceMappingURL=processContent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|
|
|
1
|
+
import { colorizePath, x } from "@intlayer/config";
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { deepTransformNode } from "@intlayer/core";
|
|
5
|
+
import { NodeType } from "@intlayer/types";
|
|
6
|
+
|
|
7
|
+
//#region ../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs
|
|
8
|
+
/**
|
|
9
|
+
* Write file plugin
|
|
10
|
+
*/
|
|
11
|
+
const writeFilePlugin = {
|
|
12
|
+
id: "write-file-plugin",
|
|
13
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.File,
|
|
14
|
+
transform: (node) => {
|
|
15
|
+
const fileContent = node.content;
|
|
16
|
+
const filePath = node.fixedPath;
|
|
17
|
+
if (typeof fileContent !== "string") throw new Error("File content must be a string");
|
|
18
|
+
if (typeof filePath !== "string") throw new Error("File path must be a string");
|
|
19
|
+
try {
|
|
20
|
+
const absoluteFilePath = join(process.cwd(), filePath);
|
|
21
|
+
const fileDirectory = dirname(absoluteFilePath);
|
|
22
|
+
if (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });
|
|
23
|
+
writeFileSync(absoluteFilePath, fileContent);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
nodeType: NodeType.File,
|
|
29
|
+
[NodeType.File]: node.file
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Markdown file plugin
|
|
35
|
+
*/
|
|
36
|
+
const markdownFilePlugin = {
|
|
37
|
+
id: "markdown-file-plugin",
|
|
38
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
|
|
39
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
40
|
+
return {
|
|
41
|
+
nodeType: NodeType.Markdown,
|
|
42
|
+
[NodeType.Markdown]: deepTransformNode$1(node.markdown, props)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Insertion file plugin
|
|
48
|
+
*/
|
|
49
|
+
const insertionFilePlugin = {
|
|
50
|
+
id: "insertion-file-plugin",
|
|
51
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Insertion,
|
|
52
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
53
|
+
return {
|
|
54
|
+
nodeType: NodeType.Insertion,
|
|
55
|
+
[NodeType.Insertion]: deepTransformNode$1(node.insertion, props)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {
|
|
60
|
+
dictionaryKey: dictionary.key,
|
|
61
|
+
keyPath: [],
|
|
62
|
+
plugins: [
|
|
63
|
+
writeFilePlugin,
|
|
64
|
+
markdownFilePlugin,
|
|
65
|
+
insertionFilePlugin
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { processContentDeclarationContent };
|
|
71
|
+
//# sourceMappingURL=processContentDeclarationContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processContentDeclarationContent.mjs","names":[],"sources":["../../../../../../../../../@intlayer/chokidar/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { colorizePath, x } from \"@intlayer/config\";\nimport { dirname, join } from \"node:path\";\nimport { deepTransformNode } from \"@intlayer/core\";\nimport { NodeType } from \"@intlayer/types\";\n\n//#region src/writeContentDeclaration/processContentDeclarationContent.ts\n/**\n* Write file plugin\n*/\nconst writeFilePlugin = {\n\tid: \"write-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.File,\n\ttransform: (node) => {\n\t\tconst fileContent = node.content;\n\t\tconst filePath = node.fixedPath;\n\t\tif (typeof fileContent !== \"string\") throw new Error(\"File content must be a string\");\n\t\tif (typeof filePath !== \"string\") throw new Error(\"File path must be a string\");\n\t\ttry {\n\t\t\tconst absoluteFilePath = join(process.cwd(), filePath);\n\t\t\tconst fileDirectory = dirname(absoluteFilePath);\n\t\t\tif (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });\n\t\t\twriteFileSync(absoluteFilePath, fileContent);\n\t\t} catch (error) {\n\t\t\tthrow new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);\n\t\t}\n\t\treturn {\n\t\t\tnodeType: NodeType.File,\n\t\t\t[NodeType.File]: node.file\n\t\t};\n\t}\n};\n/**\n* Markdown file plugin\n*/\nconst markdownFilePlugin = {\n\tid: \"markdown-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.Markdown,\n\ttransform: (node, props, deepTransformNode$1) => {\n\t\treturn {\n\t\t\tnodeType: NodeType.Markdown,\n\t\t\t[NodeType.Markdown]: deepTransformNode$1(node.markdown, props)\n\t\t};\n\t}\n};\n/**\n* Insertion file plugin\n*/\nconst insertionFilePlugin = {\n\tid: \"insertion-file-plugin\",\n\tcanHandle: (node) => typeof node === \"object\" && node?.nodeType === NodeType.Insertion,\n\ttransform: (node, props, deepTransformNode$1) => {\n\t\treturn {\n\t\t\tnodeType: NodeType.Insertion,\n\t\t\t[NodeType.Insertion]: deepTransformNode$1(node.insertion, props)\n\t\t};\n\t}\n};\nconst processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {\n\tdictionaryKey: dictionary.key,\n\tkeyPath: [],\n\tplugins: [\n\t\twriteFilePlugin,\n\t\tmarkdownFilePlugin,\n\t\tinsertionFilePlugin\n\t]\n});\n\n//#endregion\nexport { processContentDeclarationContent };\n//# sourceMappingURL=processContentDeclarationContent.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,kBA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