text-runner-engine 7.5.0 → 7.5.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/LICENSE +23 -0
- package/dist/actions/actions.d.ts +1 -1
- package/dist/actions/actions.js +1 -0
- package/dist/actions/built-in/check-image.d.ts +2 -2
- package/dist/actions/built-in/check-image.js +4 -4
- package/dist/actions/built-in/check-link.d.ts +2 -2
- package/dist/actions/built-in/check-link.js +17 -21
- package/dist/actions/built-in/test.d.ts +1 -1
- package/dist/actions/export.d.ts +1 -1
- package/dist/actions/external-action-manager.d.ts +2 -2
- package/dist/actions/external-action-manager.js +3 -2
- package/dist/actions/finder.d.ts +3 -3
- package/dist/actions/finder.js +10 -9
- package/dist/actions/index.d.ts +5 -5
- package/dist/actions/name.js +1 -1
- package/dist/activities/extract-dynamic.d.ts +2 -2
- package/dist/activities/extract-images-and-links.d.ts +1 -1
- package/dist/activities/normalize-action-name.d.ts +1 -1
- package/dist/activities/normalize-action-name.js +1 -1
- package/dist/ast/index.d.ts +1 -1
- package/dist/ast/index.js +1 -1
- package/dist/ast/node-list.d.ts +1 -1
- package/dist/ast/node-list.js +4 -4
- package/dist/ast/node.js +1 -1
- package/dist/commands/command.d.ts +1 -1
- package/dist/commands/debug.d.ts +3 -3
- package/dist/commands/debug.js +2 -2
- package/dist/commands/dynamic.d.ts +3 -3
- package/dist/commands/dynamic.js +1 -1
- package/dist/commands/run.d.ts +3 -3
- package/dist/commands/run.js +1 -1
- package/dist/commands/static.d.ts +3 -3
- package/dist/commands/static.js +1 -1
- package/dist/commands/unused.d.ts +3 -3
- package/dist/commands/unused.js +1 -1
- package/dist/configuration/data.d.ts +2 -2
- package/dist/configuration/defaults.d.ts +1 -1
- package/dist/configuration/defaults.js +1 -1
- package/dist/configuration/publication.js +1 -1
- package/dist/configuration/publications.d.ts +2 -2
- package/dist/errors/user-error.d.ts +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/filesystem/absolute-dir.js +1 -1
- package/dist/filesystem/absolute-file.js +2 -2
- package/dist/filesystem/full-dir.js +1 -1
- package/dist/filesystem/full-file.js +3 -3
- package/dist/filesystem/full-link.d.ts +1 -1
- package/dist/filesystem/full-link.js +5 -5
- package/dist/filesystem/full-path.d.ts +1 -1
- package/dist/filesystem/full-path.js +2 -2
- package/dist/filesystem/get-filenames.d.ts +1 -1
- package/dist/filesystem/has-directory.js +2 -2
- package/dist/filesystem/is-markdown-file.js +2 -2
- package/dist/filesystem/relative-link.d.ts +2 -2
- package/dist/filesystem/source-dir.js +1 -1
- package/dist/filesystem/unknown-link.d.ts +1 -1
- package/dist/helpers/add-leading-dot-unless-empty.js +1 -1
- package/dist/helpers/add-leading-slash.js +1 -1
- package/dist/helpers/add-trailing-slash.js +1 -1
- package/dist/helpers/trim-extension.js +1 -1
- package/dist/link-targets/find.d.ts +1 -1
- package/dist/link-targets/list.d.ts +3 -3
- package/dist/link-targets/target-url.js +0 -1
- package/dist/parsers/html/html-parser.d.ts +2 -2
- package/dist/parsers/html/html-parser.js +6 -4
- package/dist/parsers/html/parse-html-files.d.ts +2 -2
- package/dist/parsers/html/parse-html-files.js +1 -1
- package/dist/parsers/markdown/closing-tag-parser.d.ts +2 -2
- package/dist/parsers/markdown/md-parser.js +2 -2
- package/dist/parsers/markdown/open-node-tracker.d.ts +2 -2
- package/dist/parsers/markdown/parse.d.ts +2 -2
- package/dist/parsers/markdown/parse.js +1 -1
- package/dist/parsers/tag-mapper.d.ts +1 -1
- package/dist/parsers/tag-mapper.js +5 -5
- package/dist/run/activity-collector.d.ts +3 -3
- package/dist/run/name-refiner.d.ts +1 -1
- package/dist/run/output-collector.d.ts +1 -1
- package/dist/run/output-collector.js +3 -2
- package/dist/run/parallel.d.ts +5 -5
- package/dist/run/run-activity.d.ts +5 -5
- package/dist/run/run-activity.js +1 -1
- package/dist/run/sequential.d.ts +5 -5
- package/dist/run/stopwatch.js +2 -2
- package/dist/workspace/create.d.ts +1 -1
- package/dist/workspace/create.js +1 -1
- package/package.json +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
SPDX-License-Identifier: ISC
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Kevin Goslar
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software
|
|
6
|
+
for any purpose with or without fee is hereby granted,
|
|
7
|
+
provided that the above copyright notice
|
|
8
|
+
and this permission notice appear in all copies.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED “AS IS”
|
|
11
|
+
AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
12
|
+
WITH REGARD TO THIS SOFTWARE
|
|
13
|
+
INCLUDING ALL IMPLIED WARRANTIES
|
|
14
|
+
OF MERCHANTABILITY AND FITNESS.
|
|
15
|
+
|
|
16
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
17
|
+
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
|
18
|
+
OR ANY DAMAGES WHATSOEVER
|
|
19
|
+
RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
22
|
+
ARISING OUT OF OR IN CONNECTION WITH
|
|
23
|
+
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/dist/actions/actions.js
CHANGED
|
@@ -10,6 +10,7 @@ export class Actions {
|
|
|
10
10
|
names() {
|
|
11
11
|
return Object.keys(this.list).sort();
|
|
12
12
|
}
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: too many possible types here
|
|
13
14
|
register(fileBasedName, action) {
|
|
14
15
|
if (typeof action === "function") {
|
|
15
16
|
this.list[fileBasedName] = action;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as actions from "../index.js";
|
|
1
|
+
import type * as actions from "../index.js";
|
|
2
2
|
/** The "checkImage" action checks for broken images. */
|
|
3
|
-
export declare function checkImage(action: actions.Args): Promise<number |
|
|
3
|
+
export declare function checkImage(action: actions.Args): Promise<number | undefined>;
|
|
4
4
|
//# sourceMappingURL=check-image.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
import got, { HTTPError, TimeoutError } from "got";
|
|
3
3
|
import * as files from "../../filesystem/index.js";
|
|
4
4
|
/** The "checkImage" action checks for broken images. */
|
|
@@ -16,15 +16,15 @@ export async function checkImage(action) {
|
|
|
16
16
|
else {
|
|
17
17
|
// local image here
|
|
18
18
|
const imageFullFile = new files.FullFilePath(imagePath.startsWith("/") ? imagePath : node.location.file.directory().joinStr(imagePath));
|
|
19
|
-
|
|
20
|
-
return result;
|
|
19
|
+
await checkLocalImage(imageFullFile, action.configuration);
|
|
21
20
|
}
|
|
21
|
+
return;
|
|
22
22
|
}
|
|
23
23
|
async function checkLocalImage(image, c) {
|
|
24
24
|
try {
|
|
25
25
|
await fs.stat(c.sourceDir.joinFullFile(image).platformified());
|
|
26
26
|
}
|
|
27
|
-
catch (
|
|
27
|
+
catch (_err) {
|
|
28
28
|
throw new Error(`image ${image.unixified()} does not exist`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Args } from "../index.js";
|
|
1
|
+
import type { Args } from "../index.js";
|
|
2
2
|
/** The "checkLink" action checks for broken hyperlinks. */
|
|
3
|
-
export declare function checkLink(action: Args): Promise<Args["SKIPPING"] |
|
|
3
|
+
export declare function checkLink(action: Args): Promise<Args["SKIPPING"] | undefined>;
|
|
4
4
|
//# sourceMappingURL=check-link.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
import got, { HTTPError, TimeoutError } from "got";
|
|
3
3
|
import { errorMessage } from "../../errors/error.js";
|
|
4
4
|
import { UserError } from "../../errors/user-error.js";
|
|
@@ -20,16 +20,15 @@ export async function checkLink(action) {
|
|
|
20
20
|
return action.SKIPPING;
|
|
21
21
|
}
|
|
22
22
|
if (helpers.isLinkToAnchorInSameFile(target)) {
|
|
23
|
-
|
|
24
|
-
return
|
|
23
|
+
checkLinkToAnchorInSameFile(action.location.file, target, action);
|
|
24
|
+
return;
|
|
25
25
|
}
|
|
26
26
|
if (helpers.isLinkToAnchorInOtherFile(target)) {
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
checkLinkToAnchorInOtherFile(action.location, target, action);
|
|
28
|
+
return;
|
|
29
29
|
}
|
|
30
30
|
if (helpers.isExternalLink(target)) {
|
|
31
|
-
|
|
32
|
-
return result;
|
|
31
|
+
return await checkExternalLink(target, action);
|
|
33
32
|
}
|
|
34
33
|
await checkLinkToFilesystem(target, action);
|
|
35
34
|
return;
|
|
@@ -60,35 +59,32 @@ function checkLinkToAnchorInOtherFile(containingLocation, target, action) {
|
|
|
60
59
|
const absoluteLink = link.absolutify(containingLocation, action.configuration.publications);
|
|
61
60
|
const anchorName = absoluteLink.anchor();
|
|
62
61
|
const fullPath = absoluteLink.localize(action.configuration.publications, action.configuration.defaultFile);
|
|
62
|
+
let fullFile;
|
|
63
63
|
try {
|
|
64
|
-
|
|
64
|
+
fullFile = fullPath.toFullFilePath();
|
|
65
65
|
}
|
|
66
|
-
catch (
|
|
66
|
+
catch (_e) {
|
|
67
67
|
throw new Error(`link to non-existing file ${fullPath.unixified()}`);
|
|
68
68
|
}
|
|
69
69
|
if (!action.linkTargets.hasFile(fullFile)) {
|
|
70
70
|
throw new Error(`link to anchor #${anchorName} in non-existing file ${helpers.removeLeadingSlash(fullFile.unixified())}`);
|
|
71
71
|
}
|
|
72
72
|
if (!action.linkTargets.hasAnchor(fullFile, anchorName)) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.map(anchor => `#${anchor}`)
|
|
76
|
-
.join(", ")}`);
|
|
73
|
+
const anchors = action.linkTargets.getAnchors(fullFile).map(anchor => `#${anchor}`);
|
|
74
|
+
throw new UserError(`link to non-existing anchor ${`#${anchorName}`} in ${fullFile.unixified()}`, `File ${fullFile.unixified()} contains these anchors: ${anchors.join(", ")}`);
|
|
77
75
|
}
|
|
78
76
|
if (action.linkTargets.anchorType(fullFile, anchorName) === "heading") {
|
|
79
|
-
action.name(`link to heading ${fullFile.unixified()
|
|
77
|
+
action.name(`link to heading ${`${fullFile.unixified()}#${anchorName}`}`);
|
|
80
78
|
}
|
|
81
79
|
else {
|
|
82
80
|
action.name(`link to ${fullFile.unixified()}#${anchorName}`);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
function checkLinkToAnchorInSameFile(file, target, action) {
|
|
86
|
-
const anchorName = target.
|
|
84
|
+
const anchorName = target.substring(1);
|
|
87
85
|
if (!action.linkTargets.hasAnchor(file, anchorName)) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.map(anchor => `#${anchor}`)
|
|
91
|
-
.join(", ")}`, action.location);
|
|
86
|
+
const anchors = action.linkTargets.getAnchors(file).map(anchor => `#${anchor}`);
|
|
87
|
+
throw new UserError(`link to non-existing local anchor ${target}`, `These local anchors exist: ${anchors.join(", ")}`, action.location);
|
|
92
88
|
}
|
|
93
89
|
if (action.linkTargets.anchorType(file, anchorName) === "heading") {
|
|
94
90
|
action.name(`link to local heading ${target}`);
|
|
@@ -112,7 +108,7 @@ async function checkLinkToFilesystem(target, action) {
|
|
|
112
108
|
return;
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
|
-
catch (
|
|
111
|
+
catch (_e) {
|
|
116
112
|
// we can ignore errors here since we keep checking the file below
|
|
117
113
|
}
|
|
118
114
|
}
|
|
@@ -120,7 +116,7 @@ async function checkLinkToFilesystem(target, action) {
|
|
|
120
116
|
try {
|
|
121
117
|
await fs.stat(fullPath);
|
|
122
118
|
}
|
|
123
|
-
catch (
|
|
119
|
+
catch (_err) {
|
|
124
120
|
throw new Error(`link to non-existing local file ${linkedFile.unixified()}`);
|
|
125
121
|
}
|
|
126
122
|
}
|
package/dist/actions/export.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as actions from "./index.js";
|
|
1
|
+
import type * as actions from "./index.js";
|
|
2
2
|
export type Action = CbAction | PromiseAction | SyncAction;
|
|
3
3
|
export type CbAction = (action: actions.Args, done: DoneFunction) => void;
|
|
4
4
|
/** continuous-passing-style callback function */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Activity } from "../activities/index.js";
|
|
2
|
-
import { Action, FunctionRepo } from "./index.js";
|
|
1
|
+
import type { Activity } from "../activities/index.js";
|
|
2
|
+
import type { Action, FunctionRepo } from "./index.js";
|
|
3
3
|
/** ExternalActionManager provides external actions from their own NPM modules */
|
|
4
4
|
export declare class ExternalActionManager {
|
|
5
5
|
actions: FunctionRepo;
|
|
@@ -15,10 +15,11 @@ export class ExternalActionManager {
|
|
|
15
15
|
if (parts.length > 2) {
|
|
16
16
|
throw new UserError(`Too many slashes in action name "${activity.actionName}"`, "Activities are only allowed to have one slash in them: to separate the npm module name from the action name", activity.location);
|
|
17
17
|
}
|
|
18
|
-
const moduleName =
|
|
18
|
+
const moduleName = `textrun-${parts[0]}`;
|
|
19
19
|
const wantAction = actions.name(parts[1]);
|
|
20
|
+
let module;
|
|
20
21
|
try {
|
|
21
|
-
|
|
22
|
+
module = await import(moduleName);
|
|
22
23
|
}
|
|
23
24
|
catch (e) {
|
|
24
25
|
if (!(e instanceof Error)) {
|
package/dist/actions/finder.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as activities from "../activities/index.js";
|
|
2
|
-
import * as files from "../filesystem/index.js";
|
|
1
|
+
import type * as activities from "../activities/index.js";
|
|
2
|
+
import type * as files from "../filesystem/index.js";
|
|
3
3
|
import { Actions } from "./actions.js";
|
|
4
4
|
import { ExternalActionManager } from "./external-action-manager.js";
|
|
5
|
-
import { Action } from "./index.js";
|
|
5
|
+
import type { Action } from "./index.js";
|
|
6
6
|
/** ActionFinder provides runnable action instances for activities. */
|
|
7
7
|
export declare class Finder {
|
|
8
8
|
private readonly builtinActions;
|
package/dist/actions/finder.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import * as url from "url";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import * as url from "node:url";
|
|
4
4
|
import * as actions from "../actions/index.js";
|
|
5
5
|
import { UserError } from "../errors/user-error.js";
|
|
6
6
|
import { Actions } from "./actions.js";
|
|
@@ -27,10 +27,10 @@ export class Finder {
|
|
|
27
27
|
}
|
|
28
28
|
/** actionFor provides the action function for the given Activity. */
|
|
29
29
|
async actionFor(activity) {
|
|
30
|
-
return (this.builtinActions.get(activity.actionName)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return (this.builtinActions.get(activity.actionName) ||
|
|
31
|
+
this.customActions.get(activity.actionName) ||
|
|
32
|
+
(await this.externalActions.get(activity)) ||
|
|
33
|
+
this.errorUnknownAction(activity));
|
|
34
34
|
}
|
|
35
35
|
/** customActionNames returns the names of all built-in actions. */
|
|
36
36
|
customActionNames() {
|
|
@@ -65,10 +65,11 @@ export async function builtinActionFilePaths() {
|
|
|
65
65
|
return result;
|
|
66
66
|
}
|
|
67
67
|
export async function customActionFilePaths(dir) {
|
|
68
|
+
let files;
|
|
68
69
|
try {
|
|
69
|
-
|
|
70
|
+
files = await fs.readdir(dir);
|
|
70
71
|
}
|
|
71
|
-
catch (
|
|
72
|
+
catch (_e) {
|
|
72
73
|
// it's okay if there is no dir with custom actions
|
|
73
74
|
return [];
|
|
74
75
|
}
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as ast from "../ast/index.js";
|
|
2
|
-
import * as config from "../configuration/index.js";
|
|
3
|
-
import * as files from "../filesystem/index.js";
|
|
4
|
-
import * as linkTargets from "../link-targets/index.js";
|
|
5
|
-
import * as run from "../run/index.js";
|
|
1
|
+
import type * as ast from "../ast/index.js";
|
|
2
|
+
import type * as config from "../configuration/index.js";
|
|
3
|
+
import type * as files from "../filesystem/index.js";
|
|
4
|
+
import type * as linkTargets from "../link-targets/index.js";
|
|
5
|
+
import type * as run from "../run/index.js";
|
|
6
6
|
export { Finder } from "./finder.js";
|
|
7
7
|
export * from "./name.js";
|
|
8
8
|
/** A user-defined or built-in function that tests an active block */
|
package/dist/actions/name.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ast from "../ast/index.js";
|
|
2
|
-
import { List } from "./index.js";
|
|
1
|
+
import type * as ast from "../ast/index.js";
|
|
2
|
+
import type { List } from "./index.js";
|
|
3
3
|
/** returns all activities found in the given ast.NodeLists */
|
|
4
4
|
export declare function extractDynamic(docs: ast.NodeList[], regionMarker: string): List;
|
|
5
5
|
//# sourceMappingURL=extract-dynamic.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ast from "../ast/index.js";
|
|
2
|
-
import { List } from "./index.js";
|
|
2
|
+
import type { List } from "./index.js";
|
|
3
3
|
/** extracts activities that check images and links from the given ActivityLists */
|
|
4
4
|
export declare function extractImagesAndLinks(ASTs: ast.NodeList[]): List;
|
|
5
5
|
//# sourceMappingURL=extract-images-and-links.d.ts.map
|
|
@@ -8,6 +8,6 @@ export function normalizeActionName(actionName, location) {
|
|
|
8
8
|
if (parts.length > 2) {
|
|
9
9
|
throw new UserError(`Illegal activity name: "${actionName}" contains ${parts.length} slashes`, "", location);
|
|
10
10
|
}
|
|
11
|
-
return parts[0]
|
|
11
|
+
return `${parts[0]}/${slugify(parts[1])}`;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=normalize-action-name.js.map
|
package/dist/ast/index.d.ts
CHANGED
package/dist/ast/index.js
CHANGED
package/dist/ast/node-list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node, NodeScaffoldDataReadonly } from "./node.js";
|
|
1
|
+
import { Node, type NodeScaffoldDataReadonly } from "./node.js";
|
|
2
2
|
export declare class NodeList extends Array<Node> {
|
|
3
3
|
/** Creates a new ast.NodeList containing an Node scaffoldedd from the given data */
|
|
4
4
|
static scaffold(data?: NodeScaffoldDataReadonly): NodeList;
|
package/dist/ast/node-list.js
CHANGED
|
@@ -10,7 +10,7 @@ export class NodeList extends Array {
|
|
|
10
10
|
/** Returns whether this ast.NodeList contains a node of the given type. */
|
|
11
11
|
hasNodeOfType(nodeType) {
|
|
12
12
|
const types = [nodeType];
|
|
13
|
-
types.push(nodeType
|
|
13
|
+
types.push(`${nodeType}_open`);
|
|
14
14
|
return this.some(node => types.includes(node.type));
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -66,7 +66,7 @@ ${new Error().stack}`);
|
|
|
66
66
|
const expectedTypes = [];
|
|
67
67
|
for (const nodeType of nodeTypes) {
|
|
68
68
|
expectedTypes.push(nodeType);
|
|
69
|
-
expectedTypes.push(nodeType
|
|
69
|
+
expectedTypes.push(`${nodeType}_open`);
|
|
70
70
|
}
|
|
71
71
|
for (const node of this) {
|
|
72
72
|
if (expectedTypes.includes(node.type)) {
|
|
@@ -101,7 +101,7 @@ ${new Error().stack}`);
|
|
|
101
101
|
textInNodeOfType(...nodeTypes) {
|
|
102
102
|
for (const nodeType of nodeTypes) {
|
|
103
103
|
if (!nodeType.endsWith("_open")) {
|
|
104
|
-
nodeTypes.push(nodeType
|
|
104
|
+
nodeTypes.push(`${nodeType}_open`);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
return this.textInNode(this.nodeOfTypes(...nodeTypes));
|
|
@@ -119,7 +119,7 @@ ${new Error().stack}`);
|
|
|
119
119
|
textInNodesOfType(...nodeTypes) {
|
|
120
120
|
for (const nodeType of nodeTypes) {
|
|
121
121
|
if (!nodeType.endsWith("_open")) {
|
|
122
|
-
nodeTypes.push(nodeType
|
|
122
|
+
nodeTypes.push(`${nodeType}_open`);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
return this.nodesOfTypes(...nodeTypes).map(node => this.textInNode(node));
|
package/dist/ast/node.js
CHANGED
|
@@ -25,7 +25,7 @@ export class Node {
|
|
|
25
25
|
if (!this.isOpeningNode()) {
|
|
26
26
|
throw new Error("not an opening node");
|
|
27
27
|
}
|
|
28
|
-
return this.type.replace("open", "")
|
|
28
|
+
return `${this.type.replace("open", "")}close`;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Returns the content of the "href" attribute for link tags,
|
package/dist/commands/debug.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as configuration from "../configuration/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
4
|
-
import { Command } from "./command.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
|
+
import type { Command } from "./command.js";
|
|
5
5
|
export declare const DebugSubCommandValues: readonly ["activities", "ast", "images", "links", "linkTargets"];
|
|
6
6
|
export type DebugSubcommand = (typeof DebugSubCommandValues)[number];
|
|
7
7
|
export declare class Debug implements Command {
|
package/dist/commands/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import * as util from "util";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import * as util from "node:util";
|
|
3
3
|
import * as activities from "../activities/index.js";
|
|
4
4
|
import * as ast from "../ast/index.js";
|
|
5
5
|
import * as configuration from "../configuration/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as configuration from "../configuration/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
4
|
-
import { Command } from "./command.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
|
+
import type { Command } from "./command.js";
|
|
5
5
|
export declare class Dynamic implements Command {
|
|
6
6
|
emitter: EventEmitter;
|
|
7
7
|
userConfig: configuration.APIData;
|
package/dist/commands/dynamic.js
CHANGED
package/dist/commands/run.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as configuration from "../configuration/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
4
|
-
import * as command from "./index.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
|
+
import type * as command from "./index.js";
|
|
5
5
|
/** executes "text-runner run", prints everything, returns the number of errors encountered */
|
|
6
6
|
export declare class Run implements command.Command {
|
|
7
7
|
emitter: EventEmitter;
|
package/dist/commands/run.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as configuration from "../configuration/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
4
|
-
import { Command } from "./command.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
|
+
import type { Command } from "./command.js";
|
|
5
5
|
export declare class Static implements Command {
|
|
6
6
|
emitter: EventEmitter;
|
|
7
7
|
userConfig: configuration.APIData;
|
package/dist/commands/static.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as actions from "../actions/index.js";
|
|
3
3
|
import { extractImagesAndLinks } from "../activities/extract-images-and-links.js";
|
|
4
4
|
import * as configuration from "../configuration/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import * as configuration from "../configuration/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
4
|
-
import { Command } from "./command.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
|
+
import type { Command } from "./command.js";
|
|
5
5
|
export declare class Unused implements Command {
|
|
6
6
|
emitter: EventEmitter;
|
|
7
7
|
userConfig: configuration.APIData;
|
package/dist/commands/unused.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as files from "../filesystem/index.js";
|
|
2
|
-
import { Publications } from "./publications.js";
|
|
1
|
+
import type * as files from "../filesystem/index.js";
|
|
2
|
+
import type { Publications } from "./publications.js";
|
|
3
3
|
/** configuration values used by the Text-Runner API */
|
|
4
4
|
export type APIData = Partial<CompleteAPIData>;
|
|
5
5
|
/** a full set of configuration values used by the Text-Runner API */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as configuration from "./index.js";
|
|
1
|
+
import type * as configuration from "./index.js";
|
|
2
2
|
export declare function addDefaults(partial: configuration.APIData): Promise<configuration.Data>;
|
|
3
3
|
/** provides the default configuration values to use when no values are provided via CLI or config file */
|
|
4
4
|
export declare function defaults(): configuration.CompleteAPIData;
|
|
@@ -16,7 +16,7 @@ export class Publication {
|
|
|
16
16
|
* according to the rules of this publication
|
|
17
17
|
*/
|
|
18
18
|
publish(localPath) {
|
|
19
|
-
const re = new RegExp(
|
|
19
|
+
const re = new RegExp(`^${this.localPath}`);
|
|
20
20
|
const linkPath = helpers.addLeadingSlash(localPath.unixified()).replace(re, this.publicPath);
|
|
21
21
|
const result = new files.FullLink(linkPath);
|
|
22
22
|
if (this.publicExtension == null) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as files from "../filesystem/index.js";
|
|
2
|
-
import { Publication, PublicationConfig } from "./publication.js";
|
|
1
|
+
import type * as files from "../filesystem/index.js";
|
|
2
|
+
import { Publication, type PublicationConfig } from "./publication.js";
|
|
3
3
|
export declare class Publications extends Array<Publication> {
|
|
4
4
|
static fromConfigs(configs?: PublicationConfig[]): Publications;
|
|
5
5
|
forFilePath(filePath: files.FullPath): Publication | undefined;
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as path from "path";
|
|
1
|
+
import * as path from "node:path";
|
|
2
2
|
import * as files from "./index.js";
|
|
3
3
|
/** represents an absolute path to a file, i.e. from filesystem root to the file */
|
|
4
4
|
export class AbsoluteFilePath {
|
|
@@ -7,7 +7,7 @@ export class AbsoluteFilePath {
|
|
|
7
7
|
}
|
|
8
8
|
/** provides the directory that contains this file */
|
|
9
9
|
directory() {
|
|
10
|
-
return new files.AbsoluteDirPath(path.dirname(this.value)
|
|
10
|
+
return new files.AbsoluteDirPath(`${path.dirname(this.value)}/`);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* provides this file path with platform specific path separators,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as path from "path";
|
|
1
|
+
import * as path from "node:path";
|
|
2
2
|
import * as files from "./index.js";
|
|
3
|
-
const sepRE = new RegExp(
|
|
3
|
+
const sepRE = new RegExp(`\\${path.sep}`, "g");
|
|
4
4
|
/**
|
|
5
5
|
* represents a full path to a file,
|
|
6
6
|
* i.e. a path from the document base to a file.
|
|
@@ -11,7 +11,7 @@ export class FullFilePath {
|
|
|
11
11
|
}
|
|
12
12
|
/** Returns the directory that contains this file */
|
|
13
13
|
directory() {
|
|
14
|
-
return new files.FullPath(path.dirname(this.value)
|
|
14
|
+
return new files.FullPath(`${path.dirname(this.value)}/`);
|
|
15
15
|
}
|
|
16
16
|
/** Returns the file extension of this path */
|
|
17
17
|
extName() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as path from "path";
|
|
1
|
+
import * as path from "node:path";
|
|
2
2
|
import * as helpers from "../helpers/index.js";
|
|
3
3
|
import * as files from "./index.js";
|
|
4
4
|
/**
|
|
@@ -19,7 +19,7 @@ export class FullLink {
|
|
|
19
19
|
* with the given relative link appended
|
|
20
20
|
*/
|
|
21
21
|
append(segment) {
|
|
22
|
-
return new FullLink(helpers.straightenLink(this.value
|
|
22
|
+
return new FullLink(helpers.straightenLink(`${this.value}/${segment.value}`));
|
|
23
23
|
}
|
|
24
24
|
/** Returns a link to the containing directory */
|
|
25
25
|
directory() {
|
|
@@ -57,7 +57,7 @@ export class FullLink {
|
|
|
57
57
|
* with the new enclosing directory
|
|
58
58
|
*/
|
|
59
59
|
rebase(oldPath, newPath) {
|
|
60
|
-
const re = new RegExp(
|
|
60
|
+
const re = new RegExp(`^${oldPath}`);
|
|
61
61
|
return new FullLink(this.value.replace(re, newPath));
|
|
62
62
|
}
|
|
63
63
|
urlDecoded() {
|
|
@@ -65,11 +65,11 @@ export class FullLink {
|
|
|
65
65
|
}
|
|
66
66
|
/** Returns a link that contains the given anchor */
|
|
67
67
|
withAnchor(anchor) {
|
|
68
|
-
return new FullLink(this.withoutAnchor().value
|
|
68
|
+
return new FullLink(`${this.withoutAnchor().value}#${anchor}`);
|
|
69
69
|
}
|
|
70
70
|
/** Returns another FullLink instance that uses the given file extension */
|
|
71
71
|
withExtension(newExtension) {
|
|
72
|
-
const extRE = new RegExp(path.extname(this.value)
|
|
72
|
+
const extRE = new RegExp(`${path.extname(this.value)}$`);
|
|
73
73
|
return new FullLink(this.value.replace(extRE, helpers.addLeadingDotUnlessEmpty(newExtension)));
|
|
74
74
|
}
|
|
75
75
|
/** Returns a link that is this link without the anchor */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as path from "path";
|
|
1
|
+
import * as path from "node:path";
|
|
2
2
|
import * as helpers from "../helpers/index.js";
|
|
3
3
|
import * as files from "./index.js";
|
|
4
4
|
/**
|
|
@@ -18,7 +18,7 @@ export class FullPath {
|
|
|
18
18
|
if (this.isDirectory()) {
|
|
19
19
|
return this;
|
|
20
20
|
}
|
|
21
|
-
return new FullPath(path.dirname(this.value)
|
|
21
|
+
return new FullPath(`${path.dirname(this.value)}/`);
|
|
22
22
|
}
|
|
23
23
|
/** Returns the file extension of this path */
|
|
24
24
|
extName() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
export async function hasDirectory(dirname) {
|
|
3
3
|
try {
|
|
4
4
|
const stats = await fs.stat(dirname);
|
|
5
5
|
return stats.isDirectory();
|
|
6
6
|
}
|
|
7
|
-
catch (
|
|
7
|
+
catch (_e) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
export async function isMarkdownFile(filepath) {
|
|
3
3
|
try {
|
|
4
4
|
const fileStats = await fs.stat(filepath);
|
|
5
5
|
return filepath.endsWith(".md") && fileStats.isFile();
|
|
6
6
|
}
|
|
7
|
-
catch (
|
|
7
|
+
catch (_e) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as configuration from "../configuration/index.js";
|
|
2
|
-
import * as files from "./index.js";
|
|
1
|
+
import type * as configuration from "../configuration/index.js";
|
|
2
|
+
import type * as files from "./index.js";
|
|
3
3
|
/**
|
|
4
4
|
* A link relative to the current location,
|
|
5
5
|
* i.e. a link not starting with '/'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ast from "../ast/index.js";
|
|
2
|
-
import * as files from "../filesystem/index.js";
|
|
3
|
-
import { Target, Types } from "./index.js";
|
|
1
|
+
import type * as ast from "../ast/index.js";
|
|
2
|
+
import type * as files from "../filesystem/index.js";
|
|
3
|
+
import type { Target, Types } from "./index.js";
|
|
4
4
|
export declare class List {
|
|
5
5
|
readonly targets: Record<string, Target[]>;
|
|
6
6
|
constructor();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-expect-error: no types available
|
|
2
2
|
import anchor from "anchor-markdown-header";
|
|
3
3
|
export function targetURL(targetName) {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
5
4
|
const link = anchor(targetName, "github.com");
|
|
6
5
|
return link.substring(link.indexOf("#") + 1, link.indexOf(")"));
|
|
7
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as parse5 from "parse5";
|
|
2
2
|
import * as ast from "../../ast/index.js";
|
|
3
|
-
import * as files from "../../filesystem/index.js";
|
|
4
|
-
import { TagMapper } from "../tag-mapper.js";
|
|
3
|
+
import type * as files from "../../filesystem/index.js";
|
|
4
|
+
import type { TagMapper } from "../tag-mapper.js";
|
|
5
5
|
/** Parser converts HTML5 source into the standardized AST format. */
|
|
6
6
|
export declare class Parser {
|
|
7
7
|
private readonly tagMapper;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as util from "node:util";
|
|
1
2
|
import * as parse5 from "parse5";
|
|
2
|
-
import * as util from "util";
|
|
3
3
|
import * as ast from "../../ast/index.js";
|
|
4
4
|
/** Parser converts HTML5 source into the standardized AST format. */
|
|
5
5
|
export class Parser {
|
|
@@ -44,7 +44,7 @@ export class Parser {
|
|
|
44
44
|
return this.standardizeTextNode(node, startingLocation);
|
|
45
45
|
}
|
|
46
46
|
if (!instanceOfElement(node)) {
|
|
47
|
-
throw new Error(
|
|
47
|
+
throw new Error(`unknown tree node: ${util.inspect(node, false, Infinity)}`);
|
|
48
48
|
}
|
|
49
49
|
if (this.tagMapper.isStandaloneTag(node.nodeName)) {
|
|
50
50
|
return this.standardizeStandaloneNode(node, startingLocation);
|
|
@@ -53,6 +53,7 @@ export class Parser {
|
|
|
53
53
|
}
|
|
54
54
|
/** converts the given HTML tag with open and closing tag into the standard format */
|
|
55
55
|
standardizeOpenCloseTag(node, startingLocation) {
|
|
56
|
+
var _a;
|
|
56
57
|
const result = new ast.NodeList();
|
|
57
58
|
const attributes = standardizeHTMLAttributes(node.attrs);
|
|
58
59
|
// store the opening node
|
|
@@ -92,8 +93,8 @@ export class Parser {
|
|
|
92
93
|
else {
|
|
93
94
|
throw new Error(`cannot determine end line for node ${node}`);
|
|
94
95
|
}
|
|
95
|
-
if (!node.sourceCodeLocation || (node.sourceCodeLocation
|
|
96
|
-
const tag =
|
|
96
|
+
if (!node.sourceCodeLocation || ((_a = node.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.endTag)) {
|
|
97
|
+
const tag = `/${node.tagName}`;
|
|
97
98
|
result.push(new ast.Node({
|
|
98
99
|
attributes: {},
|
|
99
100
|
content: "",
|
|
@@ -144,6 +145,7 @@ export function standardizeHTMLAttributes(attrs) {
|
|
|
144
145
|
}
|
|
145
146
|
return result;
|
|
146
147
|
}
|
|
148
|
+
// biome-ignore lint/suspicious/noExplicitAny: there are too many possible node types here
|
|
147
149
|
function instanceOfElement(object) {
|
|
148
150
|
return !!object.nodeName && !!object.tagName && !!object.attrs;
|
|
149
151
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ast from "../../ast/index.js";
|
|
1
|
+
import type * as ast from "../../ast/index.js";
|
|
2
2
|
import * as files from "../../filesystem/index.js";
|
|
3
|
-
import { TagMapper } from "../tag-mapper.js";
|
|
3
|
+
import type { TagMapper } from "../tag-mapper.js";
|
|
4
4
|
/** returns the standard AST for the HTML files with the given paths */
|
|
5
5
|
export declare function parseHTMLFiles(filenames: files.FullFilePath[], sourceDir: files.SourceDir, tagMapper: TagMapper): Promise<ast.NodeList[]>;
|
|
6
6
|
//# sourceMappingURL=parse-html-files.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ast from "../../ast/index.js";
|
|
2
|
-
import * as files from "../../filesystem/index.js";
|
|
3
|
-
import { TagMapper } from "../tag-mapper.js";
|
|
2
|
+
import type * as files from "../../filesystem/index.js";
|
|
3
|
+
import type { TagMapper } from "../tag-mapper.js";
|
|
4
4
|
/** ClosingTagParser parses HTML blocks containing just a closing tag. */
|
|
5
5
|
export declare class ClosingTagParser {
|
|
6
6
|
private readonly closingTagRE;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as util from "node:util";
|
|
1
2
|
import MarkdownIt from "markdown-it";
|
|
2
|
-
import * as util from "util";
|
|
3
3
|
import * as ast from "../../ast/index.js";
|
|
4
4
|
import { UserError } from "../../errors/user-error.js";
|
|
5
5
|
import * as files from "../../filesystem/index.js";
|
|
@@ -163,7 +163,7 @@ export class MarkdownParser {
|
|
|
163
163
|
attributes: standardizeMarkdownItAttributes(node.attrs),
|
|
164
164
|
content: "",
|
|
165
165
|
location,
|
|
166
|
-
tag:
|
|
166
|
+
tag: `/${node.tag}`,
|
|
167
167
|
type: `${node.tag}_close`
|
|
168
168
|
}));
|
|
169
169
|
return result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ast from "../../ast/index.js";
|
|
2
|
-
import * as files from "../../filesystem/index.js";
|
|
1
|
+
import type * as ast from "../../ast/index.js";
|
|
2
|
+
import type * as files from "../../filesystem/index.js";
|
|
3
3
|
/** helps find open MarkdownIt AST nodes */
|
|
4
4
|
export declare class OpenNodeTracker {
|
|
5
5
|
private readonly entries;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ast from "../../ast/index.js";
|
|
2
|
-
import * as files from "../../filesystem/index.js";
|
|
1
|
+
import type * as ast from "../../ast/index.js";
|
|
2
|
+
import type * as files from "../../filesystem/index.js";
|
|
3
3
|
/** returns the standard AST for the Markdown files given as paths relative to the given sourceDir */
|
|
4
4
|
export declare function parse(filenames: files.FullFilePath[], sourceDir: files.SourceDir): Promise<ast.NodeList[]>;
|
|
5
5
|
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
2
|
import { MarkdownParser } from "./md-parser.js";
|
|
3
3
|
/** returns the standard AST for the Markdown files given as paths relative to the given sourceDir */
|
|
4
4
|
export async function parse(filenames, sourceDir) {
|
|
@@ -44,7 +44,7 @@ export class TagMapper {
|
|
|
44
44
|
}
|
|
45
45
|
// handle generic closing tag
|
|
46
46
|
if (type.endsWith("_close")) {
|
|
47
|
-
return
|
|
47
|
+
return `/${type.substring(0, type.length - 6)}`;
|
|
48
48
|
}
|
|
49
49
|
// handle generic stand-alone tag
|
|
50
50
|
return type;
|
|
@@ -65,10 +65,10 @@ export class TagMapper {
|
|
|
65
65
|
}
|
|
66
66
|
// here it is an unknown tag, we assume it is opening-closing
|
|
67
67
|
if (tag.startsWith("/")) {
|
|
68
|
-
return
|
|
68
|
+
return `${tag.substring(1)}_close`;
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
|
-
return
|
|
71
|
+
return `${tag}_open`;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
/** Calculates the mappings from HTML tags to MarkdownIt types */
|
|
@@ -83,8 +83,8 @@ export class TagMapper {
|
|
|
83
83
|
createTypeTagMappings() {
|
|
84
84
|
const result = new Map();
|
|
85
85
|
for (const [type, tag] of TagMapper.OPEN_CLOSE_MAPPINGS) {
|
|
86
|
-
result.set(
|
|
87
|
-
result.set(
|
|
86
|
+
result.set(`${type}_open`, tag);
|
|
87
|
+
result.set(`${type}_close`, `/${tag}`);
|
|
88
88
|
}
|
|
89
89
|
for (const [type, tag] of TagMapper.STANDALONE_MAPPINGS) {
|
|
90
90
|
result.set(type, tag);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Activity } from "../activities/index.js";
|
|
2
|
-
import { Command } from "../commands/index.js";
|
|
3
|
-
import * as events from "../events/index.js";
|
|
1
|
+
import type { Activity } from "../activities/index.js";
|
|
2
|
+
import type { Command } from "../commands/index.js";
|
|
3
|
+
import type * as events from "../events/index.js";
|
|
4
4
|
import { StopWatch } from "./stopwatch.js";
|
|
5
5
|
/** Statistics about a run of Text-Runner */
|
|
6
6
|
interface ActivityResult {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as util from "util";
|
|
1
|
+
import * as util from "node:util";
|
|
2
2
|
/** simulates console.log to collect output from a running action */
|
|
3
3
|
export class OutputCollector {
|
|
4
4
|
constructor() {
|
|
@@ -6,6 +6,7 @@ export class OutputCollector {
|
|
|
6
6
|
this.content = [];
|
|
7
7
|
}
|
|
8
8
|
/** appends to the output with a newline */
|
|
9
|
+
// biome-ignore lint/suspicious/noExplicitAny: we want to allow any argument here for debugging variables
|
|
9
10
|
log(...args) {
|
|
10
11
|
const stringified = [];
|
|
11
12
|
for (const arg of args) {
|
|
@@ -16,7 +17,7 @@ export class OutputCollector {
|
|
|
16
17
|
stringified.push(util.inspect(arg, false, Infinity));
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
this.content.push(stringified.join(" ")
|
|
20
|
+
this.content.push(`${stringified.join(" ")}\n`);
|
|
20
21
|
}
|
|
21
22
|
/** returns the "log" function to be used by actions */
|
|
22
23
|
logFn() {
|
package/dist/run/parallel.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as actions from "../actions/index.js";
|
|
2
|
-
import * as activities from "../activities/index.js";
|
|
3
|
-
import * as commands from "../commands/index.js";
|
|
4
|
-
import * as configuration from "../configuration/index.js";
|
|
5
|
-
import * as linkTargets from "../link-targets/index.js";
|
|
1
|
+
import type * as actions from "../actions/index.js";
|
|
2
|
+
import type * as activities from "../activities/index.js";
|
|
3
|
+
import type * as commands from "../commands/index.js";
|
|
4
|
+
import type * as configuration from "../configuration/index.js";
|
|
5
|
+
import type * as linkTargets from "../link-targets/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Executes the given activities in parallel.
|
|
8
8
|
* Returns the errors they produce.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as actions from "../actions/index.js";
|
|
2
|
-
import { Activity } from "../activities/index.js";
|
|
3
|
-
import * as commands from "../commands/index.js";
|
|
4
|
-
import * as configuration from "../configuration/index.js";
|
|
5
|
-
import * as linkTargets from "../link-targets/index.js";
|
|
1
|
+
import type * as actions from "../actions/index.js";
|
|
2
|
+
import type { Activity } from "../activities/index.js";
|
|
3
|
+
import type * as commands from "../commands/index.js";
|
|
4
|
+
import type * as configuration from "../configuration/index.js";
|
|
5
|
+
import type * as linkTargets from "../link-targets/index.js";
|
|
6
6
|
/** runs the given activity, indicates whether it encountered an error */
|
|
7
7
|
export declare function runActivity(activity: Activity, actionFinder: actions.Finder, configuration: configuration.Data, targets: linkTargets.List, emitter: commands.Command): Promise<boolean>;
|
|
8
8
|
//# sourceMappingURL=run-activity.d.ts.map
|
package/dist/run/run-activity.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as util from "node:util";
|
|
1
2
|
import humanize from "humanize-string";
|
|
2
|
-
import * as util from "util";
|
|
3
3
|
import { isUserError, UserError } from "../errors/user-error.js";
|
|
4
4
|
import { errorMessage } from "../text-runner.js";
|
|
5
5
|
import { NameRefiner } from "./name-refiner.js";
|
package/dist/run/sequential.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as actions from "../actions/index.js";
|
|
2
|
-
import * as activities from "../activities/index.js";
|
|
3
|
-
import * as commands from "../commands/index.js";
|
|
4
|
-
import * as configuration from "../configuration/index.js";
|
|
5
|
-
import * as linkTargets from "../link-targets/index.js";
|
|
1
|
+
import type * as actions from "../actions/index.js";
|
|
2
|
+
import type * as activities from "../activities/index.js";
|
|
3
|
+
import type * as commands from "../commands/index.js";
|
|
4
|
+
import type * as configuration from "../configuration/index.js";
|
|
5
|
+
import type * as linkTargets from "../link-targets/index.js";
|
|
6
6
|
export declare function sequential(activities: activities.List, actionFinder: actions.Finder, configuration: configuration.Data, linkTargets: linkTargets.List, emitter: commands.Command): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=sequential.d.ts.map
|
package/dist/run/stopwatch.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** StopWatch allows to measure the difference between time periods */
|
|
2
2
|
export class StopWatch {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.startTime =
|
|
4
|
+
this.startTime = Date.now();
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Duration returns a human-readable description of the difference
|
|
8
8
|
* between the current time and when this StopWatch was created.
|
|
9
9
|
*/
|
|
10
10
|
duration() {
|
|
11
|
-
const endTime =
|
|
11
|
+
const endTime = Date.now();
|
|
12
12
|
const milliseconds = endTime - this.startTime;
|
|
13
13
|
if (milliseconds > 1000) {
|
|
14
14
|
return `${Math.round(milliseconds / 1000)}s`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as configuration from "../configuration/index.js";
|
|
1
|
+
import type * as configuration from "../configuration/index.js";
|
|
2
2
|
/** creates the temp directory to run the tests in */
|
|
3
3
|
export declare function create(config: configuration.Data): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=create.d.ts.map
|
package/dist/workspace/create.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "text-runner-engine",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.1",
|
|
4
4
|
"description": "Tests documentation written in MarkDown",
|
|
5
5
|
"homepage": "https://github.com/kevgo/text-runner",
|
|
6
6
|
"repository": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc -p tsconfig-build.json",
|
|
20
20
|
"doc": "text-runner",
|
|
21
|
-
"fix": "
|
|
22
|
-
"lint": "
|
|
21
|
+
"fix": "biome check --write --unsafe && dprint fmt && sort-package-json --quiet",
|
|
22
|
+
"lint": "biome check --error-on-warnings && dprint check && sort-package-json --check --quiet && depcheck",
|
|
23
23
|
"reset": "rm -rf dist && yarn run build",
|
|
24
24
|
"stats": "find . -type f | grep -v /node_modules/ | grep -v /dist/ | grep -v \\./\\.git/ | grep -v \\./\\.vscode/ | grep -v \\./tmp/ | xargs scc",
|
|
25
25
|
"unit": "node --test --import tsx 'src/**/*.test.ts'"
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"assert-no-diff": "4.1.0",
|
|
42
42
|
"tsx": "4.21.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ffa7b993386ef88d6f199373e97d9c39e3ea3ac4"
|
|
45
45
|
}
|