embedex 0.2.0 → 0.3.1
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 +84 -50
- package/package.json +3 -2
- package/src/bin/cli.js +5 -5
- package/src/bin/cli.js.map +1 -1
- package/src/bin/processResult.js +12 -13
- package/src/bin/processResult.js.map +1 -1
- package/src/lib/embed.d.ts +1 -1
- package/src/lib/embed.js +13 -16
- package/src/lib/embed.js.map +1 -1
- package/src/lib/internal/createDestinationMap.d.ts +4 -0
- package/src/lib/internal/createDestinationMap.js +22 -0
- package/src/lib/internal/createDestinationMap.js.map +1 -0
- package/src/lib/internal/createSourceMap.d.ts +5 -0
- package/src/lib/internal/{createExampleMap.js → createSourceMap.js} +12 -12
- package/src/lib/internal/createSourceMap.js.map +1 -0
- package/src/lib/internal/processDestinations.d.ts +7 -0
- package/src/lib/internal/processDestinations.js +87 -0
- package/src/lib/internal/processDestinations.js.map +1 -0
- package/src/lib/internal/types.d.ts +7 -7
- package/src/lib/types.d.ts +13 -16
- package/src/lib/internal/createExampleMap.d.ts +0 -5
- package/src/lib/internal/createExampleMap.js.map +0 -1
- package/src/lib/internal/createTargetMap.d.ts +0 -4
- package/src/lib/internal/createTargetMap.js +0 -22
- package/src/lib/internal/createTargetMap.js.map +0 -1
- package/src/lib/internal/fileTypes.d.ts +0 -6
- package/src/lib/internal/fileTypes.js +0 -13
- package/src/lib/internal/fileTypes.js.map +0 -1
- package/src/lib/internal/processTargets.d.ts +0 -7
- package/src/lib/internal/processTargets.js +0 -102
- package/src/lib/internal/processTargets.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# embedex <!-- omit from toc -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Embed shared text and code snippets from source files into destination files. For example:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Embed TypeScript examples into TypeDoc comments and your README.
|
|
6
|
+
- Embed a Markdown snippet into multiple JSDoc comments.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Keep your examples up to date, running, and showing on hover in IDEs with `embedex`.
|
|
8
|
+
`embedex` helps ensure a single source of truth while ensuring sources are up-to-date with the code they are documenting, runnable, linted, tested, and show on hover in IDEs.
|
|
10
9
|
|
|
11
10
|
## Table of contents <!-- omit from toc -->
|
|
12
11
|
|
|
@@ -31,66 +30,101 @@ npm install --global embedex
|
|
|
31
30
|
|
|
32
31
|
## Usage
|
|
33
32
|
|
|
34
|
-
1. Add
|
|
33
|
+
1. Add a source file to the `./examples` directory (configurable). The first line is a comma-separated list of destination file paths to embed the source's file contents into. `./examples/greeter.ts`:
|
|
35
34
|
|
|
36
35
|
```ts
|
|
37
|
-
// src/greeter.ts
|
|
36
|
+
// README.md,src/greeter.ts
|
|
38
37
|
import { greet } from "@my-scope/greeter";
|
|
39
38
|
|
|
40
39
|
greet("world");
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
42
|
+
2. In the destination file, add an `<embedex source="..."></embedex>` tag that includes the source file's path.
|
|
43
|
+
|
|
44
|
+
1. `./README.md`:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
# greeter
|
|
48
|
+
|
|
49
|
+
Greets a person by name.
|
|
50
|
+
|
|
51
|
+
<embedex source="examples/greeter.ts">
|
|
52
|
+
</embedex>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. `./src/greeter.ts`:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
/**
|
|
59
|
+
* Greets a person by name.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <embedex source="examples/greeter.ts">
|
|
63
|
+
* </embedex>
|
|
64
|
+
*/
|
|
65
|
+
function greet(name: string) {
|
|
66
|
+
console.log(`Hello, ${name}!`);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
3. Run `npx embedex`.
|
|
71
|
+
4. The source is embedded! `./src/greeter.ts`:
|
|
72
|
+
|
|
73
|
+
1. `./README.md`:
|
|
74
|
+
|
|
75
|
+
````
|
|
76
|
+
# greeter
|
|
77
|
+
|
|
78
|
+
Greets a person by name.
|
|
79
|
+
|
|
80
|
+
<embedex source="examples/greeter.ts">
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { greet } from "@my-scope/greeter";
|
|
84
|
+
|
|
85
|
+
greet("world");
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
</embedex>
|
|
89
|
+
````
|
|
90
|
+
|
|
91
|
+
2. `./src/greeter.ts`:
|
|
92
|
+
|
|
93
|
+
````ts
|
|
94
|
+
/**
|
|
95
|
+
* Greets a person by name.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* <embedex source="examples/greeter.ts">
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { greet } from "@my-scope/greeter";
|
|
102
|
+
*
|
|
103
|
+
* greet("world");
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* </embedex>
|
|
107
|
+
*/
|
|
108
|
+
function greet(name: string) {
|
|
109
|
+
console.log(`Hello, ${name}!`);
|
|
110
|
+
}
|
|
111
|
+
````
|
|
78
112
|
|
|
79
113
|
## Reference
|
|
80
114
|
|
|
81
115
|
```
|
|
82
116
|
Usage: embedex [options]
|
|
83
117
|
|
|
84
|
-
|
|
118
|
+
Embed shared text and code snippets from source files into destination files.
|
|
85
119
|
|
|
86
120
|
Options:
|
|
87
|
-
-V, --version
|
|
88
|
-
-e, --
|
|
89
|
-
-c, --check
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-v, --verbose
|
|
93
|
-
-h, --help
|
|
121
|
+
-V, --version output the version number
|
|
122
|
+
-e, --sourcesGlob <pattern> sources glob pattern (default: "examples/**/*.{md,ts}")
|
|
123
|
+
-c, --check verify if sources are correctly embedded without making changes,
|
|
124
|
+
exits with non-zero code if updates are needed; useful for CI/CD
|
|
125
|
+
pipelines (default: false)
|
|
126
|
+
-v, --verbose show verbose output (default: false)
|
|
127
|
+
-h, --help display help for command
|
|
94
128
|
```
|
|
95
129
|
|
|
96
130
|
## Local development commands
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedex",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Embed shared text and code snippets from source files into destination files.",
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"bin": {
|
|
6
6
|
"embedex": "./src/bin/cli.js"
|
|
7
7
|
},
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"documentation",
|
|
18
18
|
"embed",
|
|
19
19
|
"examples",
|
|
20
|
+
"snippets",
|
|
20
21
|
"typedoc",
|
|
21
22
|
"typescript"
|
|
22
23
|
],
|
package/src/bin/cli.js
CHANGED
|
@@ -9,20 +9,20 @@ const program = new extra_typings_1.Command()
|
|
|
9
9
|
.name(package_json_1.name)
|
|
10
10
|
.description(package_json_1.description)
|
|
11
11
|
.version(String(package_json_1.version))
|
|
12
|
-
.addOption(new extra_typings_1.Option("-e, --
|
|
13
|
-
.addOption(new extra_typings_1.Option("-c, --check", "verify if
|
|
12
|
+
.addOption(new extra_typings_1.Option("-e, --sourcesGlob <pattern>", "sources glob pattern").default("examples/**/*.{md,ts}"))
|
|
13
|
+
.addOption(new extra_typings_1.Option("-c, --check", "verify if sources are correctly embedded without making changes, exits with non-zero code if updates are needed; useful for CI/CD pipelines").default(false))
|
|
14
14
|
.addOption(new extra_typings_1.Option("-v, --verbose", "show verbose output").default(false));
|
|
15
15
|
program.parse();
|
|
16
16
|
const options = program.opts();
|
|
17
|
-
const { check,
|
|
17
|
+
const { check, sourcesGlob, verbose } = options;
|
|
18
18
|
const cwd = process.cwd();
|
|
19
19
|
if (verbose) {
|
|
20
|
-
console.log((0, processResult_1.dim)("
|
|
20
|
+
console.log((0, processResult_1.dim)("sourcesGlob:\n ", sourcesGlob));
|
|
21
21
|
console.log((0, processResult_1.dim)("cwd:\n ", cwd));
|
|
22
22
|
}
|
|
23
23
|
(0, embed_1.embed)({
|
|
24
24
|
cwd,
|
|
25
|
-
|
|
25
|
+
sourcesGlob,
|
|
26
26
|
write: !check,
|
|
27
27
|
})
|
|
28
28
|
.then((result) => {
|
package/src/bin/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/bin/cli.ts"],"names":[],"mappings":";;;AACA,+DAA8D;AAE9D,qDAAgE;AAChE,wCAAqC;AACrC,mDAAqD;AAErD,MAAM,OAAO,GAAG,IAAI,uBAAO,EAAE;KAC1B,IAAI,CAAC,mBAAI,CAAC;KACV,WAAW,CAAC,0BAAW,CAAC;KACxB,OAAO,CAAC,MAAM,CAAC,sBAAO,CAAC,CAAC;KACxB,SAAS,CACR,IAAI,sBAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/bin/cli.ts"],"names":[],"mappings":";;;AACA,+DAA8D;AAE9D,qDAAgE;AAChE,wCAAqC;AACrC,mDAAqD;AAErD,MAAM,OAAO,GAAG,IAAI,uBAAO,EAAE;KAC1B,IAAI,CAAC,mBAAI,CAAC;KACV,WAAW,CAAC,0BAAW,CAAC;K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C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/src/bin/processResult.js
CHANGED
|
@@ -10,25 +10,25 @@ function dim(...messages) {
|
|
|
10
10
|
}
|
|
11
11
|
function processResult(params) {
|
|
12
12
|
const { check, result, cwd, verbose } = params;
|
|
13
|
-
const { embeds,
|
|
13
|
+
const { embeds, sources, destinations } = result;
|
|
14
14
|
function relative(path) {
|
|
15
15
|
return (0, node_path_1.relative)(cwd, path);
|
|
16
16
|
}
|
|
17
|
+
function format(item) {
|
|
18
|
+
const items = "destinations" in item ? item.destinations : item.sources;
|
|
19
|
+
return `${relative(item.path)} -> ${items.map((item) => relative(item)).join(", ")}`;
|
|
20
|
+
}
|
|
17
21
|
if (verbose) {
|
|
18
|
-
console.log(dim("
|
|
19
|
-
|
|
20
|
-
.join("\n ")));
|
|
21
|
-
console.log(dim("targets:\n ", targets
|
|
22
|
-
.map(({ path, examples }) => `${relative(path)} -> ${examples.map(relative).join(", ")}`)
|
|
23
|
-
.join("\n ")));
|
|
22
|
+
console.log(dim("sources:\n ", sources.map(format).join("\n ")));
|
|
23
|
+
console.log(dim("destinations:\n ", destinations.map(format).join("\n ")));
|
|
24
24
|
}
|
|
25
25
|
const output = [];
|
|
26
26
|
for (const embed of embeds) {
|
|
27
27
|
const { code, paths } = embed;
|
|
28
|
-
const {
|
|
28
|
+
const { destination, sources } = paths;
|
|
29
29
|
const toOutput = createToOutput({
|
|
30
30
|
code,
|
|
31
|
-
paths: {
|
|
31
|
+
paths: { destination: relative(destination), sources: sources.map((path) => relative(path)) },
|
|
32
32
|
});
|
|
33
33
|
// eslint-disable-next-line default-case -- ignore so we get @typescript-eslint/switch-exhaustiveness-check
|
|
34
34
|
switch (code) {
|
|
@@ -36,8 +36,7 @@ function processResult(params) {
|
|
|
36
36
|
output.push(toOutput({ isError: false }));
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
|
-
case "NO_MATCH":
|
|
40
|
-
case "UNSUPPORTED": {
|
|
39
|
+
case "NO_MATCH": {
|
|
41
40
|
output.push(toOutput({ isError: true }));
|
|
42
41
|
break;
|
|
43
42
|
}
|
|
@@ -51,11 +50,11 @@ function processResult(params) {
|
|
|
51
50
|
}
|
|
52
51
|
function createToOutput(params) {
|
|
53
52
|
const { code, paths } = params;
|
|
54
|
-
const {
|
|
53
|
+
const { destination, sources } = paths;
|
|
55
54
|
return ({ isError }) => ({
|
|
56
55
|
code,
|
|
57
56
|
isError,
|
|
58
|
-
message: `${yoctocolors_cjs_1.default.green(code)} ${yoctocolors_cjs_1.default.gray(
|
|
57
|
+
message: `${yoctocolors_cjs_1.default.green(code)} ${yoctocolors_cjs_1.default.gray(destination)} -> ${yoctocolors_cjs_1.default.gray(sources.join(", "))}`,
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
//# sourceMappingURL=processResult.js.map
|
|
@@ -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,sCAoDC;;AApED,yCAAqD;AAErD,8EAAqC;AA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AAI;QACJ,OAAO;QACP,OAAO,EAAE,GAAG,yBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,yBAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,yBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;KACnG,CAAC,CAAC;AACL,CAAC"}
|
package/src/lib/embed.d.ts
CHANGED
package/src/lib/embed.js
CHANGED
|
@@ -2,31 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.embed = embed;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const createDestinationMap_1 = require("./internal/createDestinationMap");
|
|
6
|
+
const createSourceMap_1 = require("./internal/createSourceMap");
|
|
7
|
+
const processDestinations_1 = require("./internal/processDestinations");
|
|
8
8
|
/**
|
|
9
|
-
* Embed
|
|
9
|
+
* Embed sources into destinations.
|
|
10
10
|
*/
|
|
11
11
|
async function embed(params) {
|
|
12
|
-
const {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const embeds = (0,
|
|
12
|
+
const { sourcesGlob, cwd, write } = params;
|
|
13
|
+
const sourceMap = await (0, createSourceMap_1.createSourceMap)({ cwd, sourcesGlob });
|
|
14
|
+
const destinationMap = await (0, createDestinationMap_1.createDestinationMap)({ sourceMap });
|
|
15
|
+
const embeds = (0, processDestinations_1.processDestinations)({ cwd, sourceMap, destinationMap });
|
|
16
16
|
await Promise.all(embeds.map(async (embed) => {
|
|
17
17
|
if (write && embed.code === "UPDATE") {
|
|
18
|
-
await (0, promises_1.writeFile)(embed.paths.
|
|
18
|
+
await (0, promises_1.writeFile)(embed.paths.destination, embed.updatedContent);
|
|
19
19
|
}
|
|
20
20
|
}));
|
|
21
21
|
return {
|
|
22
22
|
embeds,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
targets: [...targetMap.entries()].map(([key, value]) => ({
|
|
28
|
-
path: key,
|
|
29
|
-
examples: [...value.examples],
|
|
23
|
+
sources: [...sourceMap.entries()].map(([path, { destinations }]) => ({ path, destinations })),
|
|
24
|
+
destinations: [...destinationMap.entries()].map(([path, { sources }]) => ({
|
|
25
|
+
path,
|
|
26
|
+
sources: [...sources],
|
|
30
27
|
})),
|
|
31
28
|
};
|
|
32
29
|
}
|
package/src/lib/embed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/lib/embed.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../../../../../packages/embedex/src/lib/embed.ts"],"names":[],"mappings":";;AAUA,sBAuBC;AAjCD,+CAA6C;AAE7C,0EAAuE;AACvE,gEAA6D;AAC7D,wEAAqE;AAGrE;;GAEG;AACI,KAAK,UAAU,KAAK,CAAC,MAA6B;IACvD,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC3C,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,MAAM,IAAA,2CAAoB,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjE,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;IAEvE,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzB,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrC,MAAM,IAAA,oBAAS,EAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO;QACL,MAAM;QACN,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QAC7F,YAAY,EAAE,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACxE,IAAI;YACJ,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;SACtB,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDestinationMap = createDestinationMap;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
async function createDestinationMap(params) {
|
|
6
|
+
const { sourceMap } = params;
|
|
7
|
+
const uniqueDestinationPaths = new Set([...sourceMap.values()].flatMap(({ destinations }) => destinations));
|
|
8
|
+
const destinationContents = new Map();
|
|
9
|
+
await Promise.all([...uniqueDestinationPaths].map(async (path) => {
|
|
10
|
+
destinationContents.set(path, await (0, promises_1.readFile)(path, "utf8"));
|
|
11
|
+
}));
|
|
12
|
+
return new Map([...uniqueDestinationPaths].map((destinationPath) => [
|
|
13
|
+
destinationPath,
|
|
14
|
+
{
|
|
15
|
+
content: destinationContents.get(destinationPath),
|
|
16
|
+
sources: new Set([...sourceMap.entries()]
|
|
17
|
+
.filter(([_, { destinations }]) => destinations.includes(destinationPath))
|
|
18
|
+
.map(([sourcePath]) => sourcePath)),
|
|
19
|
+
},
|
|
20
|
+
]));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=createDestinationMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDestinationMap.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/createDestinationMap.ts"],"names":[],"mappings":";;AAKA,oDA4BC;AAjCD,+CAA4C;AAKrC,KAAK,UAAU,oBAAoB,CACxC,MAAoD;IAEpD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE7B,MAAM,sBAAsB,GAAG,IAAI,GAAG,CACpC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,CACpE,CAAC;IACF,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC/D,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,sBAAsB,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7C,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,GAAG,CACZ,CAAC,GAAG,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC;QACnD,eAAe;QACf;YACE,OAAO,EAAE,mBAAmB,CAAC,GAAG,CAAC,eAAe,CAAE;YAClD,OAAO,EAAE,IAAI,GAAG,CACd,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;iBACrB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;iBACzE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CACrC;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createSourceMap = createSourceMap;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const glob_1 = require("glob");
|
|
7
|
-
const
|
|
8
|
-
async function
|
|
9
|
-
const { cwd,
|
|
10
|
-
const
|
|
11
|
-
const paths = await (0, glob_1.glob)(
|
|
7
|
+
const SOURCE_MARKER_PREFIX = "// ";
|
|
8
|
+
async function createSourceMap(params) {
|
|
9
|
+
const { cwd, sourcesGlob } = params;
|
|
10
|
+
const sourceMap = new Map();
|
|
11
|
+
const paths = await (0, glob_1.glob)(sourcesGlob, { absolute: true, cwd, nodir: true });
|
|
12
12
|
for await (const path of paths) {
|
|
13
13
|
const content = await (0, promises_1.readFile)(path, "utf8");
|
|
14
14
|
const [first, ...rest] = content.split("\n");
|
|
15
|
-
if (first?.startsWith(
|
|
16
|
-
|
|
15
|
+
if (first?.startsWith(SOURCE_MARKER_PREFIX)) {
|
|
16
|
+
sourceMap.set(path, {
|
|
17
17
|
content: rest.join("\n"),
|
|
18
|
-
|
|
19
|
-
.replace(
|
|
18
|
+
destinations: first
|
|
19
|
+
.replace(SOURCE_MARKER_PREFIX, "")
|
|
20
20
|
.split(",")
|
|
21
21
|
.map((t) => (0, node_path_1.join)(cwd, t.trim())),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return sourceMap;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=createSourceMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSourceMap.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/createSourceMap.ts"],"names":[],"mappings":";;AAUA,0CAsBC;AAhCD,+CAA4C;AAC5C,yCAAiC;AAEjC,+BAA4B;AAK5B,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE5B,KAAK,UAAU,eAAe,CACnC,MAAsD;IAEtD,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAChD,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5E,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC5C,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE;gBAClB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACxB,YAAY,EAAE,KAAK;qBAChB,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;qBACjC,KAAK,CAAC,GAAG,CAAC;qBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;aACnC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Embed } from "../types";
|
|
2
|
+
import { type DestinationMap, type SourceMap } from "./types";
|
|
3
|
+
export declare function processDestinations(params: Readonly<{
|
|
4
|
+
cwd: string;
|
|
5
|
+
sourceMap: Readonly<SourceMap>;
|
|
6
|
+
destinationMap: Readonly<DestinationMap>;
|
|
7
|
+
}>): Embed[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processDestinations = processDestinations;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const CODE_FENCE_ID_BY_FILE_EXTENSION = {
|
|
6
|
+
cjs: "js",
|
|
7
|
+
cts: "ts",
|
|
8
|
+
js: "js",
|
|
9
|
+
jsx: "js",
|
|
10
|
+
md: "",
|
|
11
|
+
mdx: "",
|
|
12
|
+
mjs: "js",
|
|
13
|
+
mts: "ts",
|
|
14
|
+
ts: "ts",
|
|
15
|
+
tsx: "ts",
|
|
16
|
+
};
|
|
17
|
+
function processDestinations(params) {
|
|
18
|
+
const { cwd, destinationMap, sourceMap } = params;
|
|
19
|
+
const result = [];
|
|
20
|
+
for (const entry of destinationMap.entries()) {
|
|
21
|
+
result.push(processDestination({ cwd, entry, sourceMap }));
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
function processDestination(params) {
|
|
26
|
+
const { cwd, sourceMap, entry } = params;
|
|
27
|
+
const [destination, { content, sources }] = entry;
|
|
28
|
+
function absolutePath(path) {
|
|
29
|
+
return (0, node_path_1.join)(cwd, path);
|
|
30
|
+
}
|
|
31
|
+
const matches = matchAll({ content, exists: (source) => sources.has(absolutePath(source)) });
|
|
32
|
+
if (matches.length === 0) {
|
|
33
|
+
return { code: "NO_MATCH", paths: { destination, sources: [] } };
|
|
34
|
+
}
|
|
35
|
+
let updatedContent = content;
|
|
36
|
+
for (const { fullMatch, prefix, sourcePath } of matches) {
|
|
37
|
+
const { content } = sourceMap.get(absolutePath(sourcePath));
|
|
38
|
+
updatedContent = updatedContent.replaceAll(fullMatch, createReplacement({ content, sourcePath, prefix }));
|
|
39
|
+
}
|
|
40
|
+
const paths = { sources: matches.map((m) => absolutePath(m.sourcePath)), destination };
|
|
41
|
+
return content === updatedContent
|
|
42
|
+
? { code: "NO_CHANGE", paths }
|
|
43
|
+
: { code: "UPDATE", paths, updatedContent };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A regex to match the embedex tag.
|
|
47
|
+
*
|
|
48
|
+
* Matching groups:
|
|
49
|
+
* 1. The block's prefix
|
|
50
|
+
* 2. The source file path
|
|
51
|
+
*/
|
|
52
|
+
const REGEX = /^(.*)<embedex source="(.+?)">\n[\S\s]*?<\/embedex>/gm;
|
|
53
|
+
function matchAll(params) {
|
|
54
|
+
const { content, exists } = params;
|
|
55
|
+
return [...content.matchAll(REGEX)]
|
|
56
|
+
.map((match) => {
|
|
57
|
+
const [fullMatch, prefix, sourcePath] = match;
|
|
58
|
+
return isDefined(fullMatch) &&
|
|
59
|
+
isDefined(prefix) &&
|
|
60
|
+
isDefined(sourcePath) &&
|
|
61
|
+
exists(sourcePath)
|
|
62
|
+
? { fullMatch, prefix, sourcePath }
|
|
63
|
+
: undefined;
|
|
64
|
+
})
|
|
65
|
+
.filter(isDefined);
|
|
66
|
+
}
|
|
67
|
+
function createReplacement(params) {
|
|
68
|
+
const { content, sourcePath, prefix } = params;
|
|
69
|
+
const contentHasCodeFence = content.includes("```");
|
|
70
|
+
const backticks = contentHasCodeFence ? "````" : "```";
|
|
71
|
+
const codeFenceId = CODE_FENCE_ID_BY_FILE_EXTENSION[(0, node_path_1.extname)(sourcePath).slice(1)];
|
|
72
|
+
const escapedContent = content.replaceAll("*/", "*\\/").trimEnd().split("\n");
|
|
73
|
+
const lines = [
|
|
74
|
+
`<embedex source="${sourcePath}">`,
|
|
75
|
+
"",
|
|
76
|
+
...(codeFenceId === ""
|
|
77
|
+
? escapedContent
|
|
78
|
+
: [`${backticks}${codeFenceId ?? ""}`, ...escapedContent, backticks]),
|
|
79
|
+
"",
|
|
80
|
+
"</embedex>",
|
|
81
|
+
];
|
|
82
|
+
return lines.map((line) => `${prefix}${line}`.trimEnd()).join("\n");
|
|
83
|
+
}
|
|
84
|
+
function isDefined(value) {
|
|
85
|
+
return value !== null && value !== undefined;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=processDestinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processDestinations.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/processDestinations.ts"],"names":[],"mappings":";;AAkBA,kDAeC;AAjCD,yCAA0C;AAK1C,MAAM,+BAA+B,GAAqC;IACxE,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,IAAI;IACT,EAAE,EAAE,EAAE;IACN,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,IAAI;CACD,CAAC;AAEX,SAAgB,mBAAmB,CACjC,MAIE;IAEF,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAElD,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,kBAAkB,CAAC,MAI3B;IACC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC;IAElD,SAAS,YAAY,CAAC,IAAY;QAChC,OAAO,IAAA,gBAAI,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAA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C,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,SAAS,CAAI,KAAoB;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export interface
|
|
1
|
+
import { type DestinationPath, type SourcePath } from "../types";
|
|
2
|
+
export interface Source {
|
|
3
3
|
content: string;
|
|
4
|
-
|
|
4
|
+
destinations: DestinationPath[];
|
|
5
5
|
}
|
|
6
|
-
export type
|
|
7
|
-
export interface
|
|
6
|
+
export type SourceMap = ReadonlyMap<SourcePath, Source>;
|
|
7
|
+
export interface Destination {
|
|
8
8
|
content: string;
|
|
9
|
-
|
|
9
|
+
sources: ReadonlySet<SourcePath>;
|
|
10
10
|
}
|
|
11
|
-
export type
|
|
11
|
+
export type DestinationMap = ReadonlyMap<DestinationPath, Destination>;
|
package/src/lib/types.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
1
|
+
export type SourcePath = string;
|
|
2
|
+
export type DestinationPath = string;
|
|
3
3
|
export interface EmbedParams {
|
|
4
4
|
cwd: string;
|
|
5
|
-
|
|
5
|
+
sourcesGlob: string;
|
|
6
6
|
write: boolean;
|
|
7
7
|
}
|
|
8
|
-
export type Code = "NO_CHANGE" | "NO_MATCH" | "
|
|
8
|
+
export type Code = "NO_CHANGE" | "NO_MATCH" | "UPDATE";
|
|
9
9
|
export interface Result {
|
|
10
10
|
code: Code;
|
|
11
11
|
paths: {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
sources: SourcePath[];
|
|
13
|
+
destination: DestinationPath;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export type NoMatch = Result & {
|
|
@@ -19,22 +19,19 @@ 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
|
-
};
|
|
25
22
|
export type Updated = Result & {
|
|
26
23
|
code: "UPDATE";
|
|
27
24
|
updatedContent: string;
|
|
28
25
|
};
|
|
29
|
-
export type Embed = NoMatch | Updated | NoChange
|
|
26
|
+
export type Embed = NoMatch | Updated | NoChange;
|
|
30
27
|
export interface EmbedResult {
|
|
31
28
|
embeds: Embed[];
|
|
32
|
-
|
|
33
|
-
path:
|
|
34
|
-
|
|
29
|
+
sources: Array<{
|
|
30
|
+
path: SourcePath;
|
|
31
|
+
destinations: DestinationPath[];
|
|
35
32
|
}>;
|
|
36
|
-
|
|
37
|
-
path:
|
|
38
|
-
|
|
33
|
+
destinations: Array<{
|
|
34
|
+
path: DestinationPath;
|
|
35
|
+
sources: SourcePath[];
|
|
39
36
|
}>;
|
|
40
37
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createExampleMap.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/createExampleMap.ts"],"names":[],"mappings":";;AAUA,4CAsBC;AAhCD,+CAA4C;AAC5C,yCAAiC;AAEjC,+BAA4B;AAK5B,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE7B,KAAK,UAAU,gBAAgB,CACpC,MAAsD;IAEtD,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;IACnD,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5E,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,KAAK,EAAE,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC7C,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE;gBACnB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACxB,OAAO,EAAE,KAAK;qBACX,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC;qBAClC,KAAK,CAAC,GAAG,CAAC;qBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;aACnC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTargetMap = createTargetMap;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
|
-
async function createTargetMap(params) {
|
|
6
|
-
const { exampleMap } = params;
|
|
7
|
-
const uniqueTargetPaths = new Set([...exampleMap.values()].flatMap(({ targets }) => targets));
|
|
8
|
-
const targetContents = new Map();
|
|
9
|
-
await Promise.all([...uniqueTargetPaths].map(async (path) => {
|
|
10
|
-
targetContents.set(path, await (0, promises_1.readFile)(path, "utf8"));
|
|
11
|
-
}));
|
|
12
|
-
return new Map([...uniqueTargetPaths].map((targetPath) => [
|
|
13
|
-
targetPath,
|
|
14
|
-
{
|
|
15
|
-
content: targetContents.get(targetPath),
|
|
16
|
-
examples: new Set([...exampleMap.entries()]
|
|
17
|
-
.filter(([_, { targets }]) => targets.includes(targetPath))
|
|
18
|
-
.map(([examplePath]) => examplePath)),
|
|
19
|
-
},
|
|
20
|
-
]));
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=createTargetMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTargetMap.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/createTargetMap.ts"],"names":[],"mappings":";;AAKA,0CA0BC;AA/BD,+CAA4C;AAKrC,KAAK,UAAU,eAAe,CACnC,MAAsD;IAEtD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9B,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9F,MAAM,cAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;IACrD,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,iBAAiB,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACxC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,IAAI,GAAG,CACZ,CAAC,GAAG,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC;QACzC,UAAU;QACV;YACE,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,UAAU,CAAE;YACxC,QAAQ,EAAE,IAAI,GAAG,CACf,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;iBACtB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;iBAC1D,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CACvC;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processTargets = processTargets;
|
|
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
|
-
};
|
|
24
|
-
function processTargets(params) {
|
|
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;
|
|
35
|
-
function absolutePath(path) {
|
|
36
|
-
return (0, node_path_1.join)(cwd, path);
|
|
37
|
-
}
|
|
38
|
-
const fileExtension = (0, fileTypes_1.getFileExtension)(target);
|
|
39
|
-
if (!(0, fileTypes_1.isSupportedFileExtension)(fileExtension)) {
|
|
40
|
-
return { code: "UNSUPPORTED", paths: { target, examples: [] } };
|
|
41
|
-
}
|
|
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 };
|
|
72
|
-
}
|
|
73
|
-
function matchAll(params) {
|
|
74
|
-
const { content, exists, targetConfig } = params;
|
|
75
|
-
return [...content.matchAll(targetConfig.pattern)]
|
|
76
|
-
.map((match) => {
|
|
77
|
-
const [fullMatch, , language, indent, example] = match;
|
|
78
|
-
return isDefined(fullMatch) &&
|
|
79
|
-
isDefined(language) &&
|
|
80
|
-
isDefined(indent) &&
|
|
81
|
-
isDefined(example) &&
|
|
82
|
-
exists(example)
|
|
83
|
-
? { fullMatch, language, indent, example }
|
|
84
|
-
: undefined;
|
|
85
|
-
})
|
|
86
|
-
.filter(isDefined);
|
|
87
|
-
}
|
|
88
|
-
function prefixLines(params) {
|
|
89
|
-
const { content, indent, prefix } = params;
|
|
90
|
-
const blankLinePrefix = `${indent}${prefix}`;
|
|
91
|
-
const linePrefix = prefix ? `${blankLinePrefix} ` : blankLinePrefix;
|
|
92
|
-
return content
|
|
93
|
-
.map((line) => {
|
|
94
|
-
const trimmed = line.trim();
|
|
95
|
-
return trimmed ? `${linePrefix}${line}` : blankLinePrefix;
|
|
96
|
-
})
|
|
97
|
-
.join("\n");
|
|
98
|
-
}
|
|
99
|
-
function isDefined(value) {
|
|
100
|
-
return value !== null && value !== undefined;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=processTargets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO;IAC1B,EAAE,EAAE,aAAa,CAAC,QAAQ;IAC1B,GAAG,EAAE,aAAa,CAAC,QAAQ;IAC3B,GAAG,EAAE,aAAa,CAAC,OAAO;IAC1B,EAAE,EAAE,aAAa,CAAC,OAAO;IACzB,GA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