@doikayt/tooling-core 1.4.15

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.
Files changed (61) hide show
  1. package/README.md +380 -0
  2. package/dist/cli/generateHelp.d.ts +2 -0
  3. package/dist/cli/generateHelp.js +53 -0
  4. package/dist/cli/listFilesToProcess.d.ts +9 -0
  5. package/dist/cli/listFilesToProcess.js +47 -0
  6. package/dist/cli/parseStandardCli.d.ts +10 -0
  7. package/dist/cli/parseStandardCli.js +197 -0
  8. package/dist/cli/printHelp.d.ts +2 -0
  9. package/dist/cli/printHelp.js +4 -0
  10. package/dist/cli/runCli.d.ts +9 -0
  11. package/dist/cli/runCli.js +93 -0
  12. package/dist/cli/runLinkValidation.d.ts +2 -0
  13. package/dist/cli/runLinkValidation.js +32 -0
  14. package/dist/cli/runPlugin.d.ts +3 -0
  15. package/dist/cli/runPlugin.js +13 -0
  16. package/dist/cli/types.d.ts +23 -0
  17. package/dist/cli/types.js +1 -0
  18. package/dist/index.d.ts +29 -0
  19. package/dist/index.js +22 -0
  20. package/dist/markdown/extractLinks.d.ts +9 -0
  21. package/dist/markdown/extractLinks.js +71 -0
  22. package/dist/markdown/findMarker.d.ts +31 -0
  23. package/dist/markdown/findMarker.js +72 -0
  24. package/dist/markdown/injectBetweenMarkers.d.ts +1 -0
  25. package/dist/markdown/injectBetweenMarkers.js +10 -0
  26. package/dist/markdown/parseHeadings.d.ts +2 -0
  27. package/dist/markdown/parseHeadings.js +31 -0
  28. package/dist/markdown/slugHeading.d.ts +8 -0
  29. package/dist/markdown/slugHeading.js +9 -0
  30. package/dist/markdown/types.d.ts +51 -0
  31. package/dist/markdown/types.js +1 -0
  32. package/dist/markdown/validateExternalLink.d.ts +2 -0
  33. package/dist/markdown/validateExternalLink.js +82 -0
  34. package/dist/markdown/validateFragmentLink.d.ts +8 -0
  35. package/dist/markdown/validateFragmentLink.js +19 -0
  36. package/dist/markdown/validateMarkdownLinks.d.ts +2 -0
  37. package/dist/markdown/validateMarkdownLinks.js +84 -0
  38. package/dist/markdown/validateRelativeLink.d.ts +12 -0
  39. package/dist/markdown/validateRelativeLink.js +62 -0
  40. package/dist/policy/RunnerPolicy.d.ts +7 -0
  41. package/dist/policy/RunnerPolicy.js +1 -0
  42. package/dist/policy/createRunnerPolicy.d.ts +3 -0
  43. package/dist/policy/createRunnerPolicy.js +36 -0
  44. package/dist/repository/RepositoryRunner.d.ts +24 -0
  45. package/dist/repository/RepositoryRunner.js +93 -0
  46. package/dist/repository/createTransformProcessor.d.ts +5 -0
  47. package/dist/repository/createTransformProcessor.js +17 -0
  48. package/dist/repository/types.d.ts +16 -0
  49. package/dist/repository/types.js +1 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/dist/util/concurrency.d.ts +6 -0
  52. package/dist/util/concurrency.js +18 -0
  53. package/dist/util/debugLog.d.ts +7 -0
  54. package/dist/util/debugLog.js +9 -0
  55. package/dist/util/extractFirstSentence.d.ts +12 -0
  56. package/dist/util/extractFirstSentence.js +25 -0
  57. package/dist/util/toErrorMessage.d.ts +1 -0
  58. package/dist/util/toErrorMessage.js +3 -0
  59. package/dist/util/walkFiles.d.ts +18 -0
  60. package/dist/util/walkFiles.js +49 -0
  61. package/package.json +47 -0
@@ -0,0 +1,18 @@
1
+ export declare const DEFAULT_EXCLUDE_DIRS: readonly string[];
2
+ export interface WalkOptions {
3
+ rootDir: string;
4
+ extensions?: string[];
5
+ excludeDirs?: string[];
6
+ }
7
+ /**
8
+ * Deterministic filesystem walker.
9
+ *
10
+ * Guarantees:
11
+ * - Lexicographically sorted directory traversal
12
+ * - Lexicographically sorted final result
13
+ * - Deterministic behavior across repeated runs
14
+ *
15
+ * Default behavior:
16
+ * - Uses DEFAULT_EXCLUDE_DIRS unless over-ride provided
17
+ */
18
+ export declare function walkFiles(options: WalkOptions): string[];
@@ -0,0 +1,49 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ export const DEFAULT_EXCLUDE_DIRS = ["node_modules"];
4
+ /**
5
+ * Deterministic filesystem walker.
6
+ *
7
+ * Guarantees:
8
+ * - Lexicographically sorted directory traversal
9
+ * - Lexicographically sorted final result
10
+ * - Deterministic behavior across repeated runs
11
+ *
12
+ * Default behavior:
13
+ * - Uses DEFAULT_EXCLUDE_DIRS unless over-ride provided
14
+ */
15
+ export function walkFiles(options) {
16
+ const rootDir = options.rootDir;
17
+ const extensions = options.extensions;
18
+ const excludeDirs = options.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
19
+ const results = [];
20
+ function walk(currentDir) {
21
+ const entries = fs
22
+ .readdirSync(currentDir, { withFileTypes: true })
23
+ .sort((a, b) => a.name.localeCompare(b.name));
24
+ for (const entry of entries) {
25
+ const fullPath = path.join(currentDir, entry.name);
26
+ if (entry.isDirectory()) {
27
+ if (excludeDirs.includes(entry.name)) {
28
+ continue;
29
+ }
30
+ walk(fullPath);
31
+ }
32
+ else if (entry.isFile()) {
33
+ if (!extensions || extensions.length === 0) {
34
+ results.push(fullPath);
35
+ }
36
+ else {
37
+ for (const ext of extensions) {
38
+ if (entry.name.endsWith(ext)) {
39
+ results.push(fullPath);
40
+ break;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ walk(rootDir);
48
+ return results.sort((a, b) => a.localeCompare(b));
49
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@doikayt/tooling-core",
3
+ "version": "1.4.15",
4
+ "type": "module",
5
+ "engines": {
6
+ "node": ">=22"
7
+ },
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "types": "./dist/index.d.ts",
15
+ "files": [
16
+ "dist/",
17
+ "README.md"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/doikayt/build-tools.git",
25
+ "directory": "javascript/tooling-core"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/doikayt/build-tools/issues"
29
+ },
30
+ "homepage": "https://github.com/doikayt/build-tools/tree/main/javascript/tooling-core",
31
+ "scripts": {
32
+ "prepack": "npx nx build @doikayt/tooling-core 1>&2"
33
+ },
34
+ "devDependencies": {
35
+ "@types/mdast": "^4.0.4",
36
+ "@types/node": "^18.16.0",
37
+ "@types/unist": "^3.0.3",
38
+ "typescript": "^5.4.0",
39
+ "vitest": "^4.0.18"
40
+ },
41
+ "dependencies": {
42
+ "github-slugger": "^2.0.0",
43
+ "remark-parse": "^11.0.0",
44
+ "unified": "^11.0.5",
45
+ "unist-util-visit": "^5.1.0"
46
+ }
47
+ }