embedex 0.1.1 → 0.2.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/package.json +1 -1
- package/src/bin/processResult.js +7 -8
- package/src/bin/processResult.js.map +1 -1
- package/src/lib/internal/fileTypes.d.ts +6 -0
- package/src/lib/internal/fileTypes.js +13 -0
- package/src/lib/internal/fileTypes.js.map +1 -0
- package/src/lib/internal/processTargets.js +68 -33
- package/src/lib/internal/processTargets.js.map +1 -1
- package/src/lib/internal/types.d.ts +1 -2
- package/src/lib/types.d.ts +5 -2
package/package.json
CHANGED
package/src/bin/processResult.js
CHANGED
|
@@ -30,22 +30,21 @@ function processResult(params) {
|
|
|
30
30
|
code,
|
|
31
31
|
paths: { target: relative(target), examples: examples.map((path) => relative(path)) },
|
|
32
32
|
});
|
|
33
|
+
// eslint-disable-next-line default-case -- ignore so we get @typescript-eslint/switch-exhaustiveness-check
|
|
33
34
|
switch (code) {
|
|
34
35
|
case "NO_CHANGE": {
|
|
35
|
-
output.push(toOutput());
|
|
36
|
+
output.push(toOutput({ isError: false }));
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
38
|
-
case "NO_MATCH":
|
|
39
|
-
|
|
39
|
+
case "NO_MATCH":
|
|
40
|
+
case "UNSUPPORTED": {
|
|
41
|
+
output.push(toOutput({ isError: true }));
|
|
40
42
|
break;
|
|
41
43
|
}
|
|
42
44
|
case "UPDATE": {
|
|
43
|
-
output.push(toOutput(check));
|
|
45
|
+
output.push(toOutput({ isError: check }));
|
|
44
46
|
break;
|
|
45
47
|
}
|
|
46
|
-
default: {
|
|
47
|
-
throw new Error(`Unknown embed ${JSON.stringify(embed)}`);
|
|
48
|
-
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
return output.sort((a, b) => a.code.localeCompare(b.code));
|
|
@@ -53,7 +52,7 @@ function processResult(params) {
|
|
|
53
52
|
function createToOutput(params) {
|
|
54
53
|
const { code, paths } = params;
|
|
55
54
|
const { target, examples } = paths;
|
|
56
|
-
return (isError
|
|
55
|
+
return ({ isError }) => ({
|
|
57
56
|
code,
|
|
58
57
|
isError,
|
|
59
58
|
message: `${yoctocolors_cjs_1.default.green(code)} ${yoctocolors_cjs_1.default.gray(target)} -> ${yoctocolors_cjs_1.default.gray(examples.join(", "))}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processResult.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/bin/processResult.ts"],"names":[],"mappings":";;AAYA,kBAEC;AAED,
|
|
1
|
+
{"version":3,"file":"processResult.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/bin/processResult.ts"],"names":[],"mappings":";;AAYA,kBAEC;AAED,sCA8DC;;AA9ED,yCAAqD;AAErD,8EAAqC;AAUrC,SAAgB,GAAG,CAAC,GAAG,QAAkB;IACvC,OAAO,yBAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,aAAa,CAAC,MAK7B;IACC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,SAAS,QAAQ,CAAC,IAAY;QAC5B,OAAO,IAAA,oBAAY,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CACT,GAAG,CACD,eAAe,EACf,QAAQ;aACL,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aACtF,IAAI,CAAC,MAAM,CAAC,CAChB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O,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC1C,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,cAAc,CAAC,MAAsD;IAC5E,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEnC,OAAO,CAAC,EAAE,OAAO,EAAwB,EAAE,EAAE,CAAC,CAAC;QAC7C,IAAI;QACJ,OAAO;QACP,OAAO,EAAE,GAAG,yBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,yBAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,yBAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;KAC/F,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const SUPPORTED_FILE_EXTENSIONS: readonly ["cts", "md", "mdx", "mts", "ts", "tsx"];
|
|
2
|
+
export type SupportedFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
|
|
3
|
+
type FileExtension = string;
|
|
4
|
+
export declare function getFileExtension(path: string): FileExtension;
|
|
5
|
+
export declare function isSupportedFileExtension(fileExtension: FileExtension): fileExtension is SupportedFileExtension;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFileExtension = getFileExtension;
|
|
4
|
+
exports.isSupportedFileExtension = isSupportedFileExtension;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const SUPPORTED_FILE_EXTENSIONS = ["cts", "md", "mdx", "mts", "ts", "tsx"];
|
|
7
|
+
function getFileExtension(path) {
|
|
8
|
+
return (0, node_path_1.extname)(path).slice(1);
|
|
9
|
+
}
|
|
10
|
+
function isSupportedFileExtension(fileExtension) {
|
|
11
|
+
return SUPPORTED_FILE_EXTENSIONS.includes(fileExtension);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=fileTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTypes.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/fileTypes.ts"],"names":[],"mappings":";;AAOA,4CAEC;AAED,4DAIC;AAfD,yCAAoC;AAEpC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAKpF,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,SAAgB,wBAAwB,CACtC,aAA4B;IAE5B,OAAO,yBAAyB,CAAC,QAAQ,CAAC,aAAuC,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -2,44 +2,77 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processTargets = processTargets;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
|
+
const fileTypes_1 = require("./fileTypes");
|
|
6
|
+
const TARGET_CONFIG = {
|
|
7
|
+
typeDoc: {
|
|
8
|
+
pattern: /(`{3,4})(typescript|ts)\n(\s+)\*\s+\/\/\s(.+)\n[\S\s]*?\1/g,
|
|
9
|
+
prefix: "*",
|
|
10
|
+
},
|
|
11
|
+
markdown: {
|
|
12
|
+
pattern: /(`{3,4})(typescript|ts)\n(\s*)\/\/\s(.+)\n[\S\s]*?\1/g,
|
|
13
|
+
prefix: "",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const CONFIG_BY_FILE_EXTENSION = {
|
|
17
|
+
cts: TARGET_CONFIG.typeDoc,
|
|
18
|
+
md: TARGET_CONFIG.markdown,
|
|
19
|
+
mdx: TARGET_CONFIG.markdown,
|
|
20
|
+
mts: TARGET_CONFIG.typeDoc,
|
|
21
|
+
ts: TARGET_CONFIG.typeDoc,
|
|
22
|
+
tsx: TARGET_CONFIG.typeDoc,
|
|
23
|
+
};
|
|
5
24
|
function processTargets(params) {
|
|
6
|
-
const {
|
|
25
|
+
const { targetMap, ...rest } = params;
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const entry of targetMap.entries()) {
|
|
28
|
+
result.push(processTarget({ ...rest, entry }));
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function processTarget(params) {
|
|
33
|
+
const { cwd, exampleMap, entry } = params;
|
|
34
|
+
const [target, { content, examples }] = entry;
|
|
7
35
|
function absolutePath(path) {
|
|
8
36
|
return (0, node_path_1.join)(cwd, path);
|
|
9
37
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const matches = matchAll({ content, exists: (example) => examples.has(absolutePath(example)) });
|
|
14
|
-
if (matches.length === 0) {
|
|
15
|
-
result.push({ code: "NO_MATCH", paths: { target, examples: [] } });
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
let updatedContent = content;
|
|
19
|
-
for (const { fullMatch, language, indent, example } of matches) {
|
|
20
|
-
const exampleContent = exampleMap.get(absolutePath(example));
|
|
21
|
-
const codeBlock = exampleContent.content.includes("```") ? "````" : "```";
|
|
22
|
-
const replacement = `${codeBlock}${language}\n${prefixLines({
|
|
23
|
-
content: [
|
|
24
|
-
`// ${example}`,
|
|
25
|
-
...exampleContent.content.replace("*/", "*\\/").split("\n"),
|
|
26
|
-
codeBlock,
|
|
27
|
-
],
|
|
28
|
-
indent,
|
|
29
|
-
})}`;
|
|
30
|
-
updatedContent = updatedContent.replaceAll(fullMatch, replacement);
|
|
31
|
-
}
|
|
32
|
-
const paths = { examples: matches.map((m) => absolutePath(m.example)), target };
|
|
33
|
-
result.push(content === updatedContent
|
|
34
|
-
? { code: "NO_CHANGE", paths }
|
|
35
|
-
: { code: "UPDATE", paths, updatedContent });
|
|
36
|
-
}
|
|
38
|
+
const fileExtension = (0, fileTypes_1.getFileExtension)(target);
|
|
39
|
+
if (!(0, fileTypes_1.isSupportedFileExtension)(fileExtension)) {
|
|
40
|
+
return { code: "UNSUPPORTED", paths: { target, examples: [] } };
|
|
37
41
|
}
|
|
38
|
-
|
|
42
|
+
const targetConfig = CONFIG_BY_FILE_EXTENSION[fileExtension];
|
|
43
|
+
const matches = matchAll({
|
|
44
|
+
content,
|
|
45
|
+
exists: (example) => examples.has(absolutePath(example)),
|
|
46
|
+
targetConfig,
|
|
47
|
+
});
|
|
48
|
+
if (matches.length === 0) {
|
|
49
|
+
return { code: "NO_MATCH", paths: { target, examples: [] } };
|
|
50
|
+
}
|
|
51
|
+
let updatedContent = content;
|
|
52
|
+
for (const { fullMatch, language, indent, example } of matches) {
|
|
53
|
+
const exampleContent = exampleMap.get(absolutePath(example));
|
|
54
|
+
// Escape code blocks
|
|
55
|
+
const codeBlock = exampleContent.content.includes("```") ? "````" : "```";
|
|
56
|
+
const replacement = `${codeBlock}${language}\n${prefixLines({
|
|
57
|
+
content: [
|
|
58
|
+
`// ${example}`,
|
|
59
|
+
// Escape comment blocks
|
|
60
|
+
...exampleContent.content.replaceAll("*/", "*\\/").split("\n"),
|
|
61
|
+
codeBlock,
|
|
62
|
+
],
|
|
63
|
+
indent,
|
|
64
|
+
prefix: targetConfig.prefix,
|
|
65
|
+
})}`;
|
|
66
|
+
updatedContent = updatedContent.replaceAll(fullMatch, replacement);
|
|
67
|
+
}
|
|
68
|
+
const paths = { examples: matches.map((m) => absolutePath(m.example)), target };
|
|
69
|
+
return content === updatedContent
|
|
70
|
+
? { code: "NO_CHANGE", paths }
|
|
71
|
+
: { code: "UPDATE", paths, updatedContent };
|
|
39
72
|
}
|
|
40
73
|
function matchAll(params) {
|
|
41
|
-
const { content, exists } = params;
|
|
42
|
-
return [...content.matchAll(
|
|
74
|
+
const { content, exists, targetConfig } = params;
|
|
75
|
+
return [...content.matchAll(targetConfig.pattern)]
|
|
43
76
|
.map((match) => {
|
|
44
77
|
const [fullMatch, , language, indent, example] = match;
|
|
45
78
|
return isDefined(fullMatch) &&
|
|
@@ -53,11 +86,13 @@ function matchAll(params) {
|
|
|
53
86
|
.filter(isDefined);
|
|
54
87
|
}
|
|
55
88
|
function prefixLines(params) {
|
|
56
|
-
const { content, indent } = params;
|
|
89
|
+
const { content, indent, prefix } = params;
|
|
90
|
+
const blankLinePrefix = `${indent}${prefix}`;
|
|
91
|
+
const linePrefix = prefix ? `${blankLinePrefix} ` : blankLinePrefix;
|
|
57
92
|
return content
|
|
58
93
|
.map((line) => {
|
|
59
94
|
const trimmed = line.trim();
|
|
60
|
-
return trimmed ? `${
|
|
95
|
+
return trimmed ? `${linePrefix}${line}` : blankLinePrefix;
|
|
61
96
|
})
|
|
62
97
|
.join("\n");
|
|
63
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTargets.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/processTargets.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"processTargets.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/processTargets.ts"],"names":[],"mappings":";;AAgCA,wCAeC;AA/CD,yCAAiC;AAGjC,2CAIqB;AAGrB,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,4DAA4D;QACrE,MAAM,EAAE,GAAG;KACZ;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,uDAAuD;QAChE,MAAM,EAAE,EAAE;KACX;CACF,CAAC;AAIF,MAAM,wBAAwB,GAAiD;IAC7E,GAAG,EAAE,aAAa,CAAC,OAA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EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;IAC5D,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,SAAS,CAAI,KAAoB;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC"}
|
|
@@ -4,9 +4,8 @@ export interface Example {
|
|
|
4
4
|
targets: TargetPath[];
|
|
5
5
|
}
|
|
6
6
|
export type ExampleMap = ReadonlyMap<ExamplePath, Example>;
|
|
7
|
-
interface Target {
|
|
7
|
+
export interface Target {
|
|
8
8
|
content: string;
|
|
9
9
|
examples: ReadonlySet<ExamplePath>;
|
|
10
10
|
}
|
|
11
11
|
export type TargetMap = ReadonlyMap<TargetPath, Target>;
|
|
12
|
-
export {};
|
package/src/lib/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface EmbedParams {
|
|
|
5
5
|
examplesGlob: string;
|
|
6
6
|
write: boolean;
|
|
7
7
|
}
|
|
8
|
-
export type Code = "NO_CHANGE" | "NO_MATCH" | "UPDATE";
|
|
8
|
+
export type Code = "NO_CHANGE" | "NO_MATCH" | "UNSUPPORTED" | "UPDATE";
|
|
9
9
|
export interface Result {
|
|
10
10
|
code: Code;
|
|
11
11
|
paths: {
|
|
@@ -19,11 +19,14 @@ export type NoMatch = Result & {
|
|
|
19
19
|
export type NoChange = Result & {
|
|
20
20
|
code: "NO_CHANGE";
|
|
21
21
|
};
|
|
22
|
+
export type Unsupported = Result & {
|
|
23
|
+
code: "UNSUPPORTED";
|
|
24
|
+
};
|
|
22
25
|
export type Updated = Result & {
|
|
23
26
|
code: "UPDATE";
|
|
24
27
|
updatedContent: string;
|
|
25
28
|
};
|
|
26
|
-
export type Embed = NoMatch | Updated | NoChange;
|
|
29
|
+
export type Embed = NoMatch | Updated | NoChange | Unsupported;
|
|
27
30
|
export interface EmbedResult {
|
|
28
31
|
embeds: Embed[];
|
|
29
32
|
examples: Array<{
|