embedex 0.1.0 → 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/README.md +18 -12
- package/package.json +16 -3
- package/src/bin/cli.js +3 -3
- package/src/bin/cli.js.map +1 -1
- package/src/bin/processResult.js +7 -6
- package/src/bin/processResult.js.map +1 -1
- package/src/lib/embed.d.ts +1 -1
- package/src/lib/embed.js +3 -3
- package/src/lib/embed.js.map +1 -1
- package/src/lib/internal/createExampleMap.d.ts +3 -3
- package/src/lib/internal/createExampleMap.js +1 -1
- package/src/lib/internal/createExampleMap.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.d.ts +2 -2
- package/src/lib/internal/processTargets.js +69 -29
- package/src/lib/internal/processTargets.js.map +1 -1
- package/src/lib/internal/types.d.ts +4 -5
- package/src/lib/types.d.ts +7 -4
- package/static/logo.png +0 -0
package/README.md
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
<p align="center">
|
|
3
|
-
<img alt="embedex logo." src="./static/logo.png" width=320>
|
|
4
|
-
</p>
|
|
1
|
+
# embedex <!-- omit from toc -->
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
A command-line interface (CLI) that embeds examples into TypeDoc comments.
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
You can write code directly in TypeDoc comments using the [`@example` tag](https://typedoc.org/tags/example/), but keeping them up to date and guaranteed runnable is challenging since they aren't type-checked, linted, or tested.
|
|
9
6
|
|
|
10
|
-
While [`typedoc-plugin-include-example`](https://github.com/ferdodo/typedoc-plugin-include-example) embeds code into the resulting TypeDoc,
|
|
7
|
+
While [`typedoc-plugin-include-example`](https://github.com/ferdodo/typedoc-plugin-include-example) embeds code into the resulting TypeDoc, the examples aren't in your code, so IDEs cannot show them on hover.
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
Keep your examples up to date, running, and showing on hover in IDEs with `embedex`.
|
|
13
10
|
|
|
14
11
|
## Table of contents <!-- omit from toc -->
|
|
15
12
|
|
|
@@ -20,8 +17,16 @@ Ensure your example code runs and shows up in your IDE with `embedex`.
|
|
|
20
17
|
|
|
21
18
|
## Install
|
|
22
19
|
|
|
20
|
+
Install as a dev dependency in your project:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install --save-dev embedex
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or globally:
|
|
27
|
+
|
|
23
28
|
```sh
|
|
24
|
-
npm install
|
|
29
|
+
npm install --global embedex
|
|
25
30
|
```
|
|
26
31
|
|
|
27
32
|
## Usage
|
|
@@ -76,13 +81,14 @@ npm install -D embedex
|
|
|
76
81
|
```
|
|
77
82
|
Usage: embedex [options]
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
A command-line interface (CLI) that embeds examples into TypeDoc comments.
|
|
80
85
|
|
|
81
86
|
Options:
|
|
82
87
|
-V, --version output the version number
|
|
83
88
|
-e, --examplesGlob <pattern> examples glob pattern (default: "examples/**/*.ts")
|
|
84
|
-
-c, --check
|
|
85
|
-
|
|
89
|
+
-c, --check verify if examples are correctly embedded without making changes,
|
|
90
|
+
exits with non-zero code if updates are needed; useful for CI/CD
|
|
91
|
+
pipelines (default: false)
|
|
86
92
|
-v, --verbose show verbose output (default: false)
|
|
87
93
|
-h, --help display help for command
|
|
88
94
|
```
|
package/package.json
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedex",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "A command-line interface (CLI) that embeds examples into TypeDoc comments.",
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"embedex": "./src/bin/cli.js"
|
|
7
7
|
},
|
|
8
|
+
"bugs": "https://github.com/ClipboardHealth/core-utils/issues",
|
|
8
9
|
"dependencies": {
|
|
9
10
|
"@commander-js/extra-typings": "12.1.0",
|
|
10
11
|
"glob": "11.0.0",
|
|
11
12
|
"tslib": "2.8.0",
|
|
12
13
|
"yoctocolors-cjs": "2.1.2"
|
|
13
14
|
},
|
|
14
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"documentation",
|
|
18
|
+
"embed",
|
|
19
|
+
"examples",
|
|
20
|
+
"typedoc",
|
|
21
|
+
"typescript"
|
|
22
|
+
],
|
|
15
23
|
"license": "MIT",
|
|
16
24
|
"main": "./src/index.js",
|
|
17
25
|
"publishConfig": {
|
|
18
26
|
"access": "public"
|
|
19
27
|
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"directory": "packages/embedex",
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/ClipboardHealth/core-utils.git"
|
|
32
|
+
},
|
|
20
33
|
"type": "commonjs",
|
|
21
34
|
"typings": "./src/index.d.ts",
|
|
22
35
|
"types": "./src/index.d.ts"
|
package/src/bin/cli.js
CHANGED
|
@@ -7,10 +7,10 @@ const embed_1 = require("../lib/embed");
|
|
|
7
7
|
const processResult_1 = require("./processResult");
|
|
8
8
|
const program = new extra_typings_1.Command()
|
|
9
9
|
.name(package_json_1.name)
|
|
10
|
-
.description(
|
|
10
|
+
.description(package_json_1.description)
|
|
11
11
|
.version(String(package_json_1.version))
|
|
12
12
|
.addOption(new extra_typings_1.Option("-e, --examplesGlob <pattern>", "examples glob pattern").default("examples/**/*.ts"))
|
|
13
|
-
.addOption(new extra_typings_1.Option("-c, --check", "
|
|
13
|
+
.addOption(new extra_typings_1.Option("-c, --check", "verify if examples 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();
|
|
@@ -21,8 +21,8 @@ if (verbose) {
|
|
|
21
21
|
console.log((0, processResult_1.dim)("cwd:\n ", cwd));
|
|
22
22
|
}
|
|
23
23
|
(0, embed_1.embed)({
|
|
24
|
-
examplesGlob,
|
|
25
24
|
cwd,
|
|
25
|
+
examplesGlob,
|
|
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,
|
|
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,8BAA8B,EAAE,uBAAuB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAChG;KACA,SAAS,CACR,IAAI,sBAAM,CACR,aAAa,EACb,8IAA8I,CAC/I,CAAC,OAAO,CAAC,KAAK,CAAC,CACjB;KACA,SAAS,CAAC,IAAI,sBAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAEhF,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAC/B,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;AACjD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1B,IAAI,OAAO,EAAE,CAAC;IACZ,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAG,EAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAG,EAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,IAAA,aAAK,EAAC;IACJ,GAAG;IACH,YAAY;IACZ,KAAK,EAAE,CAAC,KAAK;CACd,CAAC;KACC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,IAAA,6BAAa,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,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
|
@@ -30,18 +30,19 @@ 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
|
|
33
|
+
// eslint-disable-next-line default-case -- ignore so we get @typescript-eslint/switch-exhaustiveness-check
|
|
34
34
|
switch (code) {
|
|
35
35
|
case "NO_CHANGE": {
|
|
36
|
-
output.push(toOutput());
|
|
36
|
+
output.push(toOutput({ isError: false }));
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
|
-
case "NO_MATCH":
|
|
40
|
-
|
|
39
|
+
case "NO_MATCH":
|
|
40
|
+
case "UNSUPPORTED": {
|
|
41
|
+
output.push(toOutput({ isError: true }));
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
case "UPDATE": {
|
|
44
|
-
output.push(toOutput(check));
|
|
45
|
+
output.push(toOutput({ isError: check }));
|
|
45
46
|
break;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -51,7 +52,7 @@ function processResult(params) {
|
|
|
51
52
|
function createToOutput(params) {
|
|
52
53
|
const { code, paths } = params;
|
|
53
54
|
const { target, examples } = paths;
|
|
54
|
-
return (isError
|
|
55
|
+
return ({ isError }) => ({
|
|
55
56
|
code,
|
|
56
57
|
isError,
|
|
57
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,C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C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;KAC/F,CAAC,CAAC;AACL,CAAC"}
|
package/src/lib/embed.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EmbedParams, type EmbedResult } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Embed examples into TypeDoc comments.
|
|
4
4
|
*/
|
|
5
5
|
export declare function embed(params: Readonly<EmbedParams>): Promise<EmbedResult>;
|
package/src/lib/embed.js
CHANGED
|
@@ -6,13 +6,13 @@ const createExampleMap_1 = require("./internal/createExampleMap");
|
|
|
6
6
|
const createTargetMap_1 = require("./internal/createTargetMap");
|
|
7
7
|
const processTargets_1 = require("./internal/processTargets");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Embed examples into TypeDoc comments.
|
|
10
10
|
*/
|
|
11
11
|
async function embed(params) {
|
|
12
12
|
const { examplesGlob: globPattern, cwd, write } = params;
|
|
13
|
-
const exampleMap = await (0, createExampleMap_1.createExampleMap)({
|
|
13
|
+
const exampleMap = await (0, createExampleMap_1.createExampleMap)({ cwd, globPattern });
|
|
14
14
|
const targetMap = await (0, createTargetMap_1.createTargetMap)({ exampleMap });
|
|
15
|
-
const embeds = (0, processTargets_1.processTargets)({
|
|
15
|
+
const embeds = (0, processTargets_1.processTargets)({ cwd, exampleMap, targetMap });
|
|
16
16
|
await Promise.all(embeds.map(async (embed) => {
|
|
17
17
|
if (write && embed.code === "UPDATE") {
|
|
18
18
|
await (0, promises_1.writeFile)(embed.paths.target, embed.updatedContent);
|
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,sBA0BC;AApCD,+CAA6C;AAE7C,kEAA+D;AAC/D,gEAA6D;AAC7D,8DAA2D;AAG3D;;GAEG;AACI,KAAK,UAAU,KA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CAAC,OAAO;SACvB,CAAC,CAAC;QACH,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;SAC9B,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExampleMap } from "./types";
|
|
2
|
-
export declare function createExampleMap(params: {
|
|
3
|
-
globPattern: string;
|
|
2
|
+
export declare function createExampleMap(params: Readonly<{
|
|
4
3
|
cwd: string;
|
|
5
|
-
|
|
4
|
+
globPattern: string;
|
|
5
|
+
}>): Promise<ExampleMap>;
|
|
@@ -6,7 +6,7 @@ const node_path_1 = require("node:path");
|
|
|
6
6
|
const glob_1 = require("glob");
|
|
7
7
|
const EXAMPLE_MARKER_PREFIX = "// ";
|
|
8
8
|
async function createExampleMap(params) {
|
|
9
|
-
const {
|
|
9
|
+
const { cwd, globPattern } = params;
|
|
10
10
|
const exampleMap = new Map();
|
|
11
11
|
const paths = await (0, glob_1.glob)(globPattern, { absolute: true, cwd, nodir: true });
|
|
12
12
|
for await (const path of paths) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExampleMap.js","sourceRoot":"","sources":["../../../../../../packages/embedex/src/lib/internal/createExampleMap.ts"],"names":[],"mappings":";;AAUA,
|
|
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"}
|
|
@@ -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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Embed } from "../types";
|
|
2
2
|
import { type ExampleMap, type TargetMap } from "./types";
|
|
3
3
|
export declare function processTargets(params: Readonly<{
|
|
4
|
-
exampleMap: ExampleMap;
|
|
5
4
|
cwd: string;
|
|
6
|
-
|
|
5
|
+
exampleMap: Readonly<ExampleMap>;
|
|
6
|
+
targetMap: Readonly<TargetMap>;
|
|
7
7
|
}>): Embed[];
|
|
@@ -2,41 +2,79 @@
|
|
|
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 replacement = `\`\`\`${language}\n${prefixLines({
|
|
22
|
-
content: [`// ${example}`, ...exampleContent.content.split("\n"), `\`\`\``],
|
|
23
|
-
indent,
|
|
24
|
-
})}`;
|
|
25
|
-
updatedContent = updatedContent.replaceAll(fullMatch, replacement);
|
|
26
|
-
}
|
|
27
|
-
const paths = { examples: matches.map((m) => absolutePath(m.example)), target };
|
|
28
|
-
result.push(content === updatedContent
|
|
29
|
-
? { code: "NO_CHANGE", paths }
|
|
30
|
-
: { code: "UPDATE", paths, updatedContent });
|
|
31
|
-
}
|
|
38
|
+
const fileExtension = (0, fileTypes_1.getFileExtension)(target);
|
|
39
|
+
if (!(0, fileTypes_1.isSupportedFileExtension)(fileExtension)) {
|
|
40
|
+
return { code: "UNSUPPORTED", paths: { target, examples: [] } };
|
|
32
41
|
}
|
|
33
|
-
|
|
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 };
|
|
34
72
|
}
|
|
35
73
|
function matchAll(params) {
|
|
36
|
-
const { content, exists } = params;
|
|
37
|
-
return [...content.matchAll(
|
|
74
|
+
const { content, exists, targetConfig } = params;
|
|
75
|
+
return [...content.matchAll(targetConfig.pattern)]
|
|
38
76
|
.map((match) => {
|
|
39
|
-
const [fullMatch, language, indent, example] = match;
|
|
77
|
+
const [fullMatch, , language, indent, example] = match;
|
|
40
78
|
return isDefined(fullMatch) &&
|
|
41
79
|
isDefined(language) &&
|
|
42
80
|
isDefined(indent) &&
|
|
@@ -48,11 +86,13 @@ function matchAll(params) {
|
|
|
48
86
|
.filter(isDefined);
|
|
49
87
|
}
|
|
50
88
|
function prefixLines(params) {
|
|
51
|
-
const { content, indent } = params;
|
|
89
|
+
const { content, indent, prefix } = params;
|
|
90
|
+
const blankLinePrefix = `${indent}${prefix}`;
|
|
91
|
+
const linePrefix = prefix ? `${blankLinePrefix} ` : blankLinePrefix;
|
|
52
92
|
return content
|
|
53
93
|
.map((line) => {
|
|
54
94
|
const trimmed = line.trim();
|
|
55
|
-
return trimmed ? `${
|
|
95
|
+
return trimmed ? `${linePrefix}${line}` : blankLinePrefix;
|
|
56
96
|
})
|
|
57
97
|
.join("\n");
|
|
58
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,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,GAAG,EAAE,aAAa,CAAC,OAAO;CAClB,CAAC;AAEX,SAAgB,cAAc,CAC5B,MAIE;IAEF,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAEtC,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CAAC,MAItB;IACC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC;IAE9C,SAAS,YAAY,CAAC,IAAY;QAChC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AAC,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAClB,MAAgF;IAEhF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE3C,MAAM,eAAe,GAAG,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7C,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;IAEpE,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,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"}
|
|
@@ -3,10 +3,9 @@ export interface Example {
|
|
|
3
3
|
content: string;
|
|
4
4
|
targets: TargetPath[];
|
|
5
5
|
}
|
|
6
|
-
export type ExampleMap =
|
|
7
|
-
interface Target {
|
|
6
|
+
export type ExampleMap = ReadonlyMap<ExamplePath, Example>;
|
|
7
|
+
export interface Target {
|
|
8
8
|
content: string;
|
|
9
|
-
examples:
|
|
9
|
+
examples: ReadonlySet<ExamplePath>;
|
|
10
10
|
}
|
|
11
|
-
export type TargetMap =
|
|
12
|
-
export {};
|
|
11
|
+
export type TargetMap = ReadonlyMap<TargetPath, Target>;
|
package/src/lib/types.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export type ExamplePath = string;
|
|
2
2
|
export type TargetPath = string;
|
|
3
3
|
export interface EmbedParams {
|
|
4
|
-
examplesGlob: string;
|
|
5
4
|
cwd: string;
|
|
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: {
|
|
12
|
-
target: TargetPath;
|
|
13
12
|
examples: ExamplePath[];
|
|
13
|
+
target: TargetPath;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export type NoMatch = Result & {
|
|
@@ -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<{
|
package/static/logo.png
DELETED
|
Binary file
|