markdown-magic 4.0.0 → 4.0.2

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 (108) hide show
  1. package/package.json +20 -17
  2. package/src/index.js +3 -2
  3. package/types/_tests/config.d.ts +4 -0
  4. package/types/_tests/config.d.ts.map +1 -0
  5. package/types/_tests/errors.test.d.ts +2 -0
  6. package/types/_tests/errors.test.d.ts.map +1 -0
  7. package/types/_tests/fixtures/js/simple.d.ts +8 -0
  8. package/types/_tests/fixtures/js/simple.d.ts.map +1 -0
  9. package/types/_tests/fixtures/local-code-file-lines.d.ts +1 -0
  10. package/types/_tests/fixtures/local-code-file-lines.d.ts.map +1 -0
  11. package/types/_tests/fixtures/local-code-file.d.ts +2 -0
  12. package/types/_tests/fixtures/local-code-file.d.ts.map +1 -0
  13. package/types/_tests/fixtures/local-code-id.d.ts +3 -0
  14. package/types/_tests/fixtures/local-code-id.d.ts.map +1 -0
  15. package/types/_tests/transforms-toc.test.d.ts +2 -0
  16. package/types/_tests/transforms-toc.test.d.ts.map +1 -0
  17. package/types/_tests/transforms.test.d.ts +2 -0
  18. package/types/_tests/transforms.test.d.ts.map +1 -0
  19. package/types/_tests/utils/diff.d.ts +3 -0
  20. package/types/_tests/utils/diff.d.ts.map +1 -0
  21. package/types/cli.d.ts +3 -0
  22. package/types/cli.d.ts.map +1 -0
  23. package/types/src/argparse/argparse.d.ts +33 -0
  24. package/types/src/argparse/argparse.d.ts.map +1 -0
  25. package/types/src/argparse/argparse.test.d.ts +2 -0
  26. package/types/src/argparse/argparse.test.d.ts.map +1 -0
  27. package/types/src/argparse/index.d.ts +3 -0
  28. package/types/src/argparse/index.d.ts.map +1 -0
  29. package/types/src/argparse/splitOutsideQuotes.d.ts +2 -0
  30. package/types/src/argparse/splitOutsideQuotes.d.ts.map +1 -0
  31. package/types/src/argparse/splitOutsideQuotes.test.d.ts +2 -0
  32. package/types/src/argparse/splitOutsideQuotes.test.d.ts.map +1 -0
  33. package/types/src/cli-run.d.ts +4 -0
  34. package/types/src/cli-run.d.ts.map +1 -0
  35. package/types/src/cli-run.test.d.ts +2 -0
  36. package/types/src/cli-run.test.d.ts.map +1 -0
  37. package/types/src/defaults.d.ts +5 -0
  38. package/types/src/defaults.d.ts.map +1 -0
  39. package/types/src/globparse.d.ts +18 -0
  40. package/types/src/globparse.d.ts.map +1 -0
  41. package/types/src/globparse.test.d.ts +2 -0
  42. package/types/src/globparse.test.d.ts.map +1 -0
  43. package/types/src/index.d.ts +189 -0
  44. package/types/src/index.d.ts.map +1 -0
  45. package/types/src/index.test.d.ts +2 -0
  46. package/types/src/index.test.d.ts.map +1 -0
  47. package/types/src/process-contents.d.ts +3 -0
  48. package/types/src/process-contents.d.ts.map +1 -0
  49. package/types/src/transforms/code/index.d.ts +35 -0
  50. package/types/src/transforms/code/index.d.ts.map +1 -0
  51. package/types/src/transforms/code/resolve-github-file.d.ts +24 -0
  52. package/types/src/transforms/code/resolve-github-file.d.ts.map +1 -0
  53. package/types/src/transforms/code/resolve-github-file.test.d.ts +2 -0
  54. package/types/src/transforms/code/resolve-github-file.test.d.ts.map +1 -0
  55. package/types/src/transforms/file.d.ts +3 -0
  56. package/types/src/transforms/file.d.ts.map +1 -0
  57. package/types/src/transforms/fileTree.d.ts +35 -0
  58. package/types/src/transforms/fileTree.d.ts.map +1 -0
  59. package/types/src/transforms/index.d.ts +9 -0
  60. package/types/src/transforms/index.d.ts.map +1 -0
  61. package/types/src/transforms/install.d.ts +25 -0
  62. package/types/src/transforms/install.d.ts.map +1 -0
  63. package/types/src/transforms/remote.d.ts +3 -0
  64. package/types/src/transforms/remote.d.ts.map +1 -0
  65. package/types/src/transforms/sectionToc.d.ts +3 -0
  66. package/types/src/transforms/sectionToc.d.ts.map +1 -0
  67. package/types/src/transforms/toc.d.ts +31 -0
  68. package/types/src/transforms/toc.d.ts.map +1 -0
  69. package/types/src/transforms/wordCount.d.ts +3 -0
  70. package/types/src/transforms/wordCount.d.ts.map +1 -0
  71. package/types/src/types.d.ts +11 -0
  72. package/types/src/types.d.ts.map +1 -0
  73. package/types/src/utils/details.d.ts +3 -0
  74. package/types/src/utils/details.d.ts.map +1 -0
  75. package/types/src/utils/format-md.d.ts +2 -0
  76. package/types/src/utils/format-md.d.ts.map +1 -0
  77. package/types/src/utils/fs.d.ts +29 -0
  78. package/types/src/utils/fs.d.ts.map +1 -0
  79. package/types/src/utils/fs.test.d.ts +2 -0
  80. package/types/src/utils/fs.test.d.ts.map +1 -0
  81. package/types/src/utils/hash-file.d.ts +2 -0
  82. package/types/src/utils/hash-file.d.ts.map +1 -0
  83. package/types/src/utils/index.d.ts +25 -0
  84. package/types/src/utils/index.d.ts.map +1 -0
  85. package/types/src/utils/load-config.d.ts +2 -0
  86. package/types/src/utils/load-config.d.ts.map +1 -0
  87. package/types/src/utils/logs.d.ts +11 -0
  88. package/types/src/utils/logs.d.ts.map +1 -0
  89. package/types/src/utils/regex-timeout.d.ts +2 -0
  90. package/types/src/utils/regex-timeout.d.ts.map +1 -0
  91. package/types/src/utils/regex.d.ts +7 -0
  92. package/types/src/utils/regex.d.ts.map +1 -0
  93. package/types/src/utils/remoteRequest.d.ts +3 -0
  94. package/types/src/utils/remoteRequest.d.ts.map +1 -0
  95. package/types/src/utils/sortOrder.d.ts +3 -0
  96. package/types/src/utils/sortOrder.d.ts.map +1 -0
  97. package/types/src/utils/string-break.d.ts +3 -0
  98. package/types/src/utils/string-break.d.ts.map +1 -0
  99. package/types/src/utils/syntax.d.ts +77 -0
  100. package/types/src/utils/syntax.d.ts.map +1 -0
  101. package/types/src/utils/text.d.ts +146 -0
  102. package/types/src/utils/text.d.ts.map +1 -0
  103. package/types/src/utils/text.test.d.ts +2 -0
  104. package/types/src/utils/text.test.d.ts.map +1 -0
  105. package/types/src/utils/toc.d.ts +67 -0
  106. package/types/src/utils/toc.d.ts.map +1 -0
  107. package/types/src/utils/toposort.d.ts +7 -0
  108. package/types/src/utils/toposort.d.ts.map +1 -0
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "markdown-magic",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Automatically update markdown files with content from external sources",
5
- "main": "index.js",
5
+ "main": "src/index.js",
6
6
  "bin": {
7
7
  "markdown": "./cli.js",
8
8
  "md-magic": "./cli.js",
@@ -14,8 +14,19 @@
14
14
  "package.json",
15
15
  "package-lock.json",
16
16
  "src",
17
- "cli.js"
17
+ "cli.js",
18
+ "types"
18
19
  ],
20
+ "scripts": {
21
+ "types": "tsc --emitDeclarationOnly --outDir types",
22
+ "docs": "node examples/generate-readme.js",
23
+ "test": "uvu . '.test.([mc]js|[jt]sx?)$'",
24
+ "cli": "node ./cli.js --path 'README.md' --config ./markdown.config.js",
25
+ "postpublish": "git push origin && git push origin --tags",
26
+ "release:patch": "pnpm version patch --git-tag-version && pnpm publish",
27
+ "release:minor": "pnpm version minor --git-tag-version && pnpm publish",
28
+ "release:major": "pnpm version major --git-tag-version && pnpm publish"
29
+ },
19
30
  "author": "David Wells",
20
31
  "license": "MIT",
21
32
  "homepage": "https://github.com/DavidWells/markdown-magic#readme",
@@ -25,6 +36,9 @@
25
36
  },
26
37
  "dependencies": {
27
38
  "@davidwells/md-utils": "0.0.53",
39
+ "comment-block-parser": "1.1.0",
40
+ "comment-block-replacer": "0.1.1",
41
+ "comment-block-transformer": "0.2.0",
28
42
  "globrex": "^0.1.2",
29
43
  "gray-matter": "^4.0.3",
30
44
  "is-glob": "^4.0.3",
@@ -38,10 +52,7 @@
38
52
  "punycode": "^2.3.1",
39
53
  "smart-glob": "^1.0.2",
40
54
  "string-width": "^4.2.3",
41
- "sync-request": "^6.1.0",
42
- "comment-block-transformer": "0.1.1",
43
- "comment-block-replacer": "0.1.0",
44
- "comment-block-parser": "1.0.7"
55
+ "sync-request": "^6.1.0"
45
56
  },
46
57
  "devDependencies": {
47
58
  "ansi-styles": "^4.2.1",
@@ -55,13 +66,5 @@
55
66
  "publishConfig": {
56
67
  "access": "public"
57
68
  },
58
- "scripts": {
59
- "types": "tsc --emitDeclarationOnly --outDir types",
60
- "docs": "node examples/generate-readme.js",
61
- "test": "uvu . '.test.([mc]js|[jt]sx?)$'",
62
- "cli": "node ./cli.js --path 'README.md' --config ./markdown.config.js",
63
- "release:patch": "pnpm publish --version patch && git push origin && git push origin --tags",
64
- "release:minor": "pnpm publish --version minor && git push origin && git push origin --tags",
65
- "release:major": "pnpm publish --version major && git push origin && git push origin --tags"
66
- }
67
- }
69
+ "gitHead": "546a15fac58d28315057449adf122a5ab8575901"
70
+ }
package/src/index.js CHANGED
@@ -501,10 +501,11 @@ async function markdownMagic(globOrOpts = {}, options = {}) {
501
501
  errors = missing.map((item, i) => {
502
502
  const errorMessage = `Missing ${item.missingTransforms.length} transforms in ${item.srcPath}`
503
503
  const issues = item.missingTransforms.map((trn) => {
504
+ const lines = trn.block && trn.block.lines ? trn.block.lines : trn.lines
504
505
  // logger('trn', trn)
505
506
  // const rowData = getRowAndColumnFromCharPos(item.updatedContents, trn.open.start)
506
- const location = `${item.srcPath}:${trn.lines[0]}:0`
507
- const message = `Transform "${trn.transform}" at line ${trn.lines[0]} does not exist. → ${location}`
507
+ const location = `${item.srcPath}:${lines[0]}:0`
508
+ const message = `Transform "${trn.transform}" at line ${lines[0]} does not exist. → ${location}`
508
509
  return {
509
510
  message,
510
511
  location
@@ -0,0 +1,4 @@
1
+ export const FIXTURE_DIR: string;
2
+ export const MARKDOWN_FIXTURE_DIR: string;
3
+ export const OUTPUT_DIR: string;
4
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../_tests/config.js"],"names":[],"mappings":"AACA,iCAAoD;AACpD,0CAAyD;AACzD,gCAAmD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=errors.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../_tests/errors.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * comment inside
3
+ */
4
+ /****************
5
+ comment inside
6
+ ******************/
7
+ declare var x: string;
8
+ //# sourceMappingURL=simple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../../../../_tests/fixtures/js/simple.js"],"names":[],"mappings":"AAqBA;;GAEG;AAIH;;mBAEmB;AAGnB,sBAAa"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=local-code-file-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-code-file-lines.d.ts","sourceRoot":"","sources":["../../../_tests/fixtures/local-code-file-lines.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export function run(): void;
2
+ //# sourceMappingURL=local-code-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-code-file.d.ts","sourceRoot":"","sources":["../../../_tests/fixtures/local-code-file.js"],"names":[],"mappings":"AAYqB,4BAGpB"}
@@ -0,0 +1,3 @@
1
+ declare function _exports(filePath: any, config: any): Promise<void>;
2
+ export = _exports;
3
+ //# sourceMappingURL=local-code-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-code-id.d.ts","sourceRoot":"","sources":["../../../_tests/fixtures/local-code-id.js"],"names":[],"mappings":"AAUiB,qEAyBhB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transforms-toc.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms-toc.test.d.ts","sourceRoot":"","sources":["../../_tests/transforms-toc.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transforms.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.test.d.ts","sourceRoot":"","sources":["../../_tests/transforms.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ declare function _exports(actual: any, expected: any): any;
2
+ export = _exports;
3
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../_tests/utils/diff.js"],"names":[],"mappings":"AA8HiB,2DAShB"}
package/types/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.js"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ export function uxParse(_rawArgv?: any[], opts?: {}): {
2
+ leadingCommands: string[];
3
+ extraParse: {};
4
+ mriOptionsOriginal: mri.Argv<{
5
+ [x: string]: any;
6
+ }>;
7
+ globGroups: any[];
8
+ rawArgv?: undefined;
9
+ mriOptionsClean?: undefined;
10
+ mriDiff?: undefined;
11
+ yargsParsed?: undefined;
12
+ mergedOptions?: undefined;
13
+ } | {
14
+ rawArgv: string;
15
+ leadingCommands: string[];
16
+ globGroups: any[];
17
+ extraParse: {};
18
+ mriOptionsOriginal: mri.Argv<{
19
+ [x: string]: any;
20
+ }>;
21
+ mriOptionsClean: {
22
+ [x: string]: any;
23
+ } & {
24
+ _: string[];
25
+ };
26
+ mriDiff: boolean;
27
+ yargsParsed: string;
28
+ mergedOptions: {
29
+ _: string[];
30
+ };
31
+ };
32
+ import mri = require("mri");
33
+ //# sourceMappingURL=argparse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argparse.d.ts","sourceRoot":"","sources":["../../../src/argparse/argparse.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2QC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=argparse.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argparse.test.d.ts","sourceRoot":"","sources":["../../../src/argparse/argparse.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { uxParse };
2
+ import { uxParse } from "./argparse";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/argparse/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export function splitOutsideQuotes(str: any): any[];
2
+ //# sourceMappingURL=splitOutsideQuotes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitOutsideQuotes.d.ts","sourceRoot":"","sources":["../../../src/argparse/splitOutsideQuotes.js"],"names":[],"mappings":"AAEA,oDAuEC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=splitOutsideQuotes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitOutsideQuotes.test.d.ts","sourceRoot":"","sources":["../../../src/argparse/splitOutsideQuotes.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { getGlobGroupsFromArgs } from "./globparse";
2
+ export function runCli(options: {}, rawArgv: any): Promise<import("./").MarkdownMagicResult>;
3
+ export { getGlobGroupsFromArgs };
4
+ //# sourceMappingURL=cli-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-run.d.ts","sourceRoot":"","sources":["../../src/cli-run.js"],"names":[],"mappings":";AAsBA,6FAoLC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli-run.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-run.test.d.ts","sourceRoot":"","sources":["../../src/cli-run.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export const SYNTAX: "md";
2
+ export const OPEN_WORD: "doc-gen";
3
+ export const CLOSE_WORD: "end-doc-gen";
4
+ export const DEFAULT_GLOB_PATTERN: "**/**.md";
5
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.js"],"names":[],"mappings":"AACA,qBAAe,IAAI,CAAA;AACnB,wBAAkB,SAAS,CAAA;AAC3B,yBAAmB,aAAa,CAAA;AAChC,mCAA6B,UAAU,CAAA"}
@@ -0,0 +1,18 @@
1
+ export function getGlobGroupsFromArgs(args: any, opts?: {}): {
2
+ globGroups: {
3
+ key: any;
4
+ rawKey: any;
5
+ values: any;
6
+ }[];
7
+ otherOpts: any[];
8
+ };
9
+ export function isArrayLike(str: any): boolean;
10
+ export function stringLooksLikeFile(value: any): boolean;
11
+ export function getValue(val: any): any;
12
+ export function trimLeadingDashes(value: any): any;
13
+ export function removeNodeModules(value?: string): boolean;
14
+ export function coerceStringToRegex(str: any): any;
15
+ export function convertToArray(str?: string): any;
16
+ export function addValue(value: any, currentCollection: any): any;
17
+ export function customIsGlob(arg: any): any;
18
+ //# sourceMappingURL=globparse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globparse.d.ts","sourceRoot":"","sources":["../../src/globparse.js"],"names":[],"mappings":"AA6EA;;;;;;;EA8EC;AA5ID,+CAGC;AAED,yDAOC;AAED,wCAEC;AAED,mDAEC;AAED,2DAKC;AAED,mDAOC;AAED,kDAGC;AAED,kEASC;AAED,4CAMC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=globparse.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globparse.test.d.ts","sourceRoot":"","sources":["../../src/globparse.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Allowed file syntaxes
3
+ */
4
+ export type SyntaxType = "md" | "js" | "yml" | "yaml";
5
+ /**
6
+ * Path to file, files or Glob string or Glob Array
7
+ */
8
+ export type FilePathsOrGlobs = string | Array<string>;
9
+ export type ProcessFileOptions = import("comment-block-replacer").ProcessFileOptions;
10
+ /**
11
+ * Configuration for markdown magic
12
+ *
13
+ * Below is the main config for `markdown-magic`
14
+ */
15
+ export type MarkdownMagicOptions = {
16
+ /**
17
+ * - Files to process.
18
+ */
19
+ files?: FilePathsOrGlobs;
20
+ /**
21
+ * - Custom commands to transform block contents, see transforms & custom transforms sections below.
22
+ */
23
+ transforms?: any;
24
+ /**
25
+ * - Output configuration
26
+ */
27
+ output?: OutputConfig;
28
+ /**
29
+ * - Syntax to parse
30
+ */
31
+ syntax?: SyntaxType;
32
+ /**
33
+ * - Opening match word
34
+ */
35
+ open?: string;
36
+ /**
37
+ * - Closing match word. If not defined will be same as opening word.
38
+ */
39
+ close?: string;
40
+ /**
41
+ * - Current working directory. Default process.cwd()
42
+ */
43
+ cwd?: string;
44
+ /**
45
+ * - Flatten files that are output
46
+ */
47
+ outputFlatten?: boolean;
48
+ /**
49
+ * - Use git glob for LARGE file directories
50
+ */
51
+ useGitGlob?: boolean;
52
+ /**
53
+ * - See planned execution of matched blocks
54
+ */
55
+ dryRun?: boolean;
56
+ /**
57
+ * - See debug details
58
+ */
59
+ debug?: boolean;
60
+ /**
61
+ * - Silence all console output
62
+ */
63
+ silent?: boolean;
64
+ /**
65
+ * - Apply transforms to source file. Default is true.
66
+ */
67
+ applyTransformsToSource?: boolean;
68
+ /**
69
+ * - Fail if transform functions are missing. Default skip blocks.
70
+ */
71
+ failOnMissingTransforms?: boolean;
72
+ /**
73
+ * - Fail if remote file is missing.
74
+ */
75
+ failOnMissingRemote?: boolean;
76
+ };
77
+ /**
78
+ * Optional output configuration
79
+ */
80
+ export type OutputConfig = {
81
+ /**
82
+ * - Change output path of new content. Default behavior is replacing the original file
83
+ */
84
+ directory?: string;
85
+ /**
86
+ * - Remove comments from output. Default is false.
87
+ */
88
+ removeComments?: boolean;
89
+ /**
90
+ * - Custom function for altering output paths
91
+ */
92
+ pathFormatter?: Function;
93
+ /**
94
+ * - Apply transforms to source file. Default is true. This is for when outputDir is set.
95
+ */
96
+ applyTransformsToSource?: boolean;
97
+ };
98
+ /**
99
+ * Result of markdown processing
100
+ */
101
+ export type MarkdownMagicResult = {
102
+ /**
103
+ * - Any errors encountered.
104
+ */
105
+ errors: any[];
106
+ /**
107
+ * - Modified files
108
+ */
109
+ filesChanged: Array<string>;
110
+ /**
111
+ * - md data
112
+ */
113
+ results: any[];
114
+ };
115
+ /**
116
+ * Allowed file syntaxes
117
+ * @typedef {'md' | 'js' | 'yml' | 'yaml'} SyntaxType
118
+ */
119
+ /**
120
+ * Path to file, files or Glob string or Glob Array
121
+ * @typedef {string|Array<string>} FilePathsOrGlobs
122
+ */
123
+ /**
124
+ * @typedef {import('comment-block-replacer').ProcessFileOptions} ProcessFileOptions
125
+ */
126
+ /**
127
+ * Configuration for markdown magic
128
+ *
129
+ * Below is the main config for `markdown-magic`
130
+ *
131
+ * @typedef {object} MarkdownMagicOptions
132
+ * @property {FilePathsOrGlobs} [files] - Files to process.
133
+ * @property {Object} [transforms = defaultTransforms] - Custom commands to transform block contents, see transforms & custom transforms sections below.
134
+ * @property {OutputConfig} [output] - Output configuration
135
+ * @property {SyntaxType} [syntax = 'md'] - Syntax to parse
136
+ * @property {string} [open = 'doc-gen'] - Opening match word
137
+ * @property {string} [close = 'end-doc-gen'] - Closing match word. If not defined will be same as opening word.
138
+ * @property {string} [cwd = process.cwd() ] - Current working directory. Default process.cwd()
139
+ * @property {boolean} [outputFlatten] - Flatten files that are output
140
+ * @property {boolean} [useGitGlob] - Use git glob for LARGE file directories
141
+ * @property {boolean} [dryRun = false] - See planned execution of matched blocks
142
+ * @property {boolean} [debug = false] - See debug details
143
+ * @property {boolean} [silent = false] - Silence all console output
144
+ * @property {boolean} [applyTransformsToSource = true] - Apply transforms to source file. Default is true.
145
+ * @property {boolean} [failOnMissingTransforms = false] - Fail if transform functions are missing. Default skip blocks.
146
+ * @property {boolean} [failOnMissingRemote = true] - Fail if remote file is missing.
147
+ */
148
+ /**
149
+ * Optional output configuration
150
+ * @typedef {object} OutputConfig
151
+ * @property {string} [directory] - Change output path of new content. Default behavior is replacing the original file
152
+ * @property {boolean} [removeComments = false] - Remove comments from output. Default is false.
153
+ * @property {function} [pathFormatter] - Custom function for altering output paths
154
+ * @property {boolean} [applyTransformsToSource = false] - Apply transforms to source file. Default is true. This is for when outputDir is set.
155
+ */
156
+ /**
157
+ * Result of markdown processing
158
+ *
159
+ * @typedef {object} MarkdownMagicResult
160
+ * @property {Array} errors - Any errors encountered.
161
+ * @property {Array<string>} filesChanged - Modified files
162
+ * @property {Array} results - md data
163
+ */
164
+ /**
165
+ * ### API
166
+ *
167
+ * Markdown Magic Instance
168
+ *
169
+ * ```js
170
+ * markdownMagic(globOrOpts, options)
171
+ * ```
172
+ *
173
+ * @param {FilePathsOrGlobs|MarkdownMagicOptions} globOrOpts - Files to process or config.
174
+ * @param {MarkdownMagicOptions} [options] - Markdown magic config
175
+ * @returns {Promise<MarkdownMagicResult>}
176
+ * @example
177
+ markdownMagic(['**.**.md'], options).then((result) => {
178
+ console.log(`Processing complete`, result)
179
+ })
180
+ */
181
+ export function markdownMagic(globOrOpts?: FilePathsOrGlobs | MarkdownMagicOptions, options?: MarkdownMagicOptions): Promise<MarkdownMagicResult>;
182
+ import { blockTransformer } from "comment-block-transformer";
183
+ import { processFile } from "comment-block-replacer";
184
+ export namespace stringUtils {
185
+ export { stringBreak };
186
+ }
187
+ import stringBreak = require("./utils/string-break");
188
+ export { parseMarkdown, blockTransformer, processFile };
189
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;yBAkDa,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM;;;;+BAK5B,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;iCAIpB,OAAO,wBAAwB,EAAE,kBAAkB;;;;;;;;;;YASlD,gBAAgB;;;;;;;;aAEhB,YAAY;;;;aACZ,UAAU;;;;WACV,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;;;oBACN,OAAO;;;;iBACP,OAAO;;;;aACP,OAAO;;;;YACP,OAAO;;;;aACP,OAAO;;;;8BACP,OAAO;;;;8BACP,OAAO;;;;0BACP,OAAO;;;;;;;;;gBAMP,MAAM;;;;qBACN,OAAO;;;;;;;;8BAEP,OAAO;;;;;;;;;;;;;kBAQP,KAAK,CAAC,MAAM,CAAC;;;;;;AAnD3B;;;GAGG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,2CARW,gBAAgB,GAAC,oBAAoB,YACrC,oBAAoB,GAClB,OAAO,CAAC,mBAAmB,CAAC,CA2lBxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/index.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { blockTransformer } from "comment-block-transformer";
2
+ export { blockTransformer as processContents };
3
+ //# sourceMappingURL=process-contents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-contents.d.ts","sourceRoot":"","sources":["../../src/process-contents.js"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ declare namespace _exports {
2
+ export { CodeTransformOptions };
3
+ }
4
+ declare function _exports(api: any): Promise<any>;
5
+ export = _exports;
6
+ /**
7
+ * Options for specifying source code to include in documentation.
8
+ */
9
+ type CodeTransformOptions = {
10
+ /**
11
+ * - The relative path to the code to include, or the URL where the raw code lives.
12
+ */
13
+ src: string;
14
+ /**
15
+ * - The syntax of the code. If not specified, it will be inferred by fileType.
16
+ */
17
+ syntax?: string;
18
+ /**
19
+ * - The header comment to add to the code snippet. Useful for pointing to relative source directory or adding live doc links.
20
+ */
21
+ header?: string;
22
+ /**
23
+ * - A range of lines of code to include from the file. The line range should be defined like "lines=22-44".
24
+ */
25
+ lines?: string;
26
+ /**
27
+ * - A section of code to include from the file. Defined like "section=SECTION_NAME". The code should have "// SECTION_NAME" surrounding the block of text.
28
+ */
29
+ section?: string;
30
+ /**
31
+ * - Remove multi-line comments that start with `//` from the code.
32
+ */
33
+ trimDeadCode?: boolean;
34
+ };
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transforms/code/index.js"],"names":[],"mappings":";;;AA+CiB,kDA8JhB;;;;;;;;;SAxLa,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;cACN,MAAM;;;;mBACN,OAAO"}
@@ -0,0 +1,24 @@
1
+ export function isGithubLink(str?: string): boolean;
2
+ export function isGithubRawLink(str?: string): boolean;
3
+ export function getGitHubFileContentsRaw(options: any): Promise<any>;
4
+ export function resolveGithubDetails(repoFilePath: any): {
5
+ repoOwner: any;
6
+ repoName: any;
7
+ filePath: any;
8
+ };
9
+ /**
10
+ * Resolves the contents of a file from a GitHub repository.
11
+ *
12
+ * @param {Object} options - The options for resolving the GitHub contents.
13
+ * @param {string} options.repoFilePath - The file path in the GitHub repository.
14
+ * @param {string} [options.accessToken] - The access token for authenticating with GitHub (optional).
15
+ * @param {boolean} [options.debug = false] - Whether to enable debug logging (optional).
16
+ * @returns {Promise<string>} - A promise that resolves to the contents of the file.
17
+ * @throws {Error} - If the GitHub link is invalid or if the file fetch fails.
18
+ */
19
+ export function resolveGithubContents({ repoFilePath, accessToken, debug }: {
20
+ repoFilePath: string;
21
+ accessToken?: string;
22
+ debug?: boolean;
23
+ }): Promise<string>;
24
+ //# sourceMappingURL=resolve-github-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-github-file.d.ts","sourceRoot":"","sources":["../../../../src/transforms/code/resolve-github-file.js"],"names":[],"mappings":"AASA,oDAEC;AAMD,uDAEC;AAoOD,qEA8CC;AA3QD;;;;EA8BC;AAED;;;;;;;;;GASG;AACH,4EANG;IAAyB,YAAY,EAA7B,MAAM;IACY,WAAW,GAA7B,MAAM;IACY,KAAK,GAAvB,OAAO;CACf,GAAU,OAAO,CAAC,MAAM,CAAC,CAwD3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolve-github-file.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-github-file.test.d.ts","sourceRoot":"","sources":["../../../../src/transforms/code/resolve-github-file.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ declare function _exports(api: any): any;
2
+ export = _exports;
3
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/transforms/file.js"],"names":[],"mappings":"AAKiB,yCA+ChB"}
@@ -0,0 +1,35 @@
1
+ declare namespace _exports {
2
+ export { FileTreeTransformOptions };
3
+ }
4
+ declare function _exports(api: any): string;
5
+ export = _exports;
6
+ /**
7
+ * Options for configuring the file tree table of contents.
8
+ */
9
+ type FileTreeTransformOptions = {
10
+ /**
11
+ * - The directory path to generate the file tree for. Default is `.` (current directory).
12
+ */
13
+ src?: string;
14
+ /**
15
+ * - Maximum depth to traverse in the directory tree. Default is `3`.
16
+ */
17
+ maxDepth?: number;
18
+ /**
19
+ * - Whether to include files in the tree or just directories. Default is `true`.
20
+ */
21
+ includeFiles?: boolean;
22
+ /**
23
+ * - Array of glob patterns to exclude from the tree.
24
+ */
25
+ exclude?: string[];
26
+ /**
27
+ * - Whether to show file sizes. Default is `false`.
28
+ */
29
+ showSize?: boolean;
30
+ /**
31
+ * - Output format: "tree" or "list". Default is `"tree"`.
32
+ */
33
+ format?: string;
34
+ };
35
+ //# sourceMappingURL=fileTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileTree.d.ts","sourceRoot":"","sources":["../../../src/transforms/fileTree.js"],"names":[],"mappings":";;;AAyBiB,qCAFJ,MAAM,CAoClB;;;;;;;;;UArDa,MAAM;;;;eACN,MAAM;;;;mBACN,OAAO;;;;cACP,MAAM,EAAE;;;;eACR,OAAO;;;;aACP,MAAM"}