markdown-magic 3.7.0 → 4.0.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/cli.js +1 -1
- package/package.json +22 -26
- package/src/{cli.js → cli-run.js} +0 -0
- package/src/{cli.test.js → cli-run.test.js} +1 -1
- package/src/defaults.js +2 -2
- package/src/index.js +26 -20
- package/src/index.test.js +2 -2
- package/src/process-contents.js +2 -458
- package/src/transforms/code/index.js +6 -6
- package/src/transforms/fileTree.js +3 -3
- package/src/transforms/index.js +21 -21
- package/src/transforms/install.js +3 -3
- package/src/transforms/sectionToc.js +4 -4
- package/src/transforms/toc.js +5 -5
- package/src/transforms/wordCount.js +3 -2
- package/src/utils/fs.js +22 -0
- package/src/utils/fs.test.js +2 -2
- package/src/utils/index.js +21 -0
- package/src/utils/regex-timeout.js +1 -1
- package/src/utils/text.js +103 -11
- package/types/_tests/config.d.ts +4 -0
- package/types/_tests/config.d.ts.map +1 -0
- package/types/_tests/errors.test.d.ts +2 -0
- package/types/_tests/errors.test.d.ts.map +1 -0
- package/types/_tests/fixtures/js/simple.d.ts +8 -0
- package/types/_tests/fixtures/js/simple.d.ts.map +1 -0
- package/types/_tests/fixtures/local-code-file-lines.d.ts +1 -0
- package/types/_tests/fixtures/local-code-file-lines.d.ts.map +1 -0
- package/types/_tests/fixtures/local-code-file.d.ts +2 -0
- package/types/_tests/fixtures/local-code-file.d.ts.map +1 -0
- package/types/_tests/fixtures/local-code-id.d.ts +3 -0
- package/types/_tests/fixtures/local-code-id.d.ts.map +1 -0
- package/types/_tests/transforms-toc.test.d.ts +2 -0
- package/types/_tests/transforms-toc.test.d.ts.map +1 -0
- package/types/_tests/transforms.test.d.ts +2 -0
- package/types/_tests/transforms.test.d.ts.map +1 -0
- package/types/_tests/utils/diff.d.ts +3 -0
- package/types/_tests/utils/diff.d.ts.map +1 -0
- package/types/cli.d.ts +3 -0
- package/types/cli.d.ts.map +1 -0
- package/types/src/argparse/argparse.d.ts +33 -0
- package/types/src/argparse/argparse.d.ts.map +1 -0
- package/types/src/argparse/argparse.test.d.ts +2 -0
- package/types/src/argparse/argparse.test.d.ts.map +1 -0
- package/types/src/argparse/index.d.ts +3 -0
- package/types/src/argparse/index.d.ts.map +1 -0
- package/types/src/argparse/splitOutsideQuotes.d.ts +2 -0
- package/types/src/argparse/splitOutsideQuotes.d.ts.map +1 -0
- package/types/src/argparse/splitOutsideQuotes.test.d.ts +2 -0
- package/types/src/argparse/splitOutsideQuotes.test.d.ts.map +1 -0
- package/types/src/cli-run.d.ts +4 -0
- package/types/src/cli-run.d.ts.map +1 -0
- package/types/src/cli-run.test.d.ts +2 -0
- package/types/src/cli-run.test.d.ts.map +1 -0
- package/types/src/defaults.d.ts +5 -0
- package/types/src/defaults.d.ts.map +1 -0
- package/types/src/globparse.d.ts +18 -0
- package/types/src/globparse.d.ts.map +1 -0
- package/types/src/globparse.test.d.ts +2 -0
- package/types/src/globparse.test.d.ts.map +1 -0
- package/types/src/index.d.ts +189 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/index.test.d.ts +2 -0
- package/types/src/index.test.d.ts.map +1 -0
- package/types/src/process-contents.d.ts +3 -0
- package/types/src/process-contents.d.ts.map +1 -0
- package/types/src/transforms/code/index.d.ts +35 -0
- package/types/src/transforms/code/index.d.ts.map +1 -0
- package/types/src/transforms/code/resolve-github-file.d.ts +24 -0
- package/types/src/transforms/code/resolve-github-file.d.ts.map +1 -0
- package/types/src/transforms/code/resolve-github-file.test.d.ts +2 -0
- package/types/src/transforms/code/resolve-github-file.test.d.ts.map +1 -0
- package/types/src/transforms/file.d.ts +3 -0
- package/types/src/transforms/file.d.ts.map +1 -0
- package/types/src/transforms/fileTree.d.ts +35 -0
- package/types/src/transforms/fileTree.d.ts.map +1 -0
- package/types/src/transforms/index.d.ts +9 -0
- package/types/src/transforms/index.d.ts.map +1 -0
- package/types/src/transforms/install.d.ts +25 -0
- package/types/src/transforms/install.d.ts.map +1 -0
- package/types/src/transforms/remote.d.ts +3 -0
- package/types/src/transforms/remote.d.ts.map +1 -0
- package/types/src/transforms/sectionToc.d.ts +3 -0
- package/types/src/transforms/sectionToc.d.ts.map +1 -0
- package/types/src/transforms/toc.d.ts +31 -0
- package/types/src/transforms/toc.d.ts.map +1 -0
- package/types/src/transforms/wordCount.d.ts +3 -0
- package/types/src/transforms/wordCount.d.ts.map +1 -0
- package/types/src/types.d.ts +11 -0
- package/types/src/types.d.ts.map +1 -0
- package/types/src/utils/details.d.ts +3 -0
- package/types/src/utils/details.d.ts.map +1 -0
- package/types/src/utils/format-md.d.ts +2 -0
- package/types/src/utils/format-md.d.ts.map +1 -0
- package/types/src/utils/fs.d.ts +29 -0
- package/types/src/utils/fs.d.ts.map +1 -0
- package/types/src/utils/fs.test.d.ts +2 -0
- package/types/src/utils/fs.test.d.ts.map +1 -0
- package/types/src/utils/hash-file.d.ts +2 -0
- package/types/src/utils/hash-file.d.ts.map +1 -0
- package/types/src/utils/index.d.ts +25 -0
- package/types/src/utils/index.d.ts.map +1 -0
- package/types/src/utils/load-config.d.ts +2 -0
- package/types/src/utils/load-config.d.ts.map +1 -0
- package/types/src/utils/logs.d.ts +11 -0
- package/types/src/utils/logs.d.ts.map +1 -0
- package/types/src/utils/regex-timeout.d.ts +2 -0
- package/types/src/utils/regex-timeout.d.ts.map +1 -0
- package/types/src/utils/regex.d.ts +7 -0
- package/types/src/utils/regex.d.ts.map +1 -0
- package/types/src/utils/remoteRequest.d.ts +3 -0
- package/types/src/utils/remoteRequest.d.ts.map +1 -0
- package/types/src/utils/sortOrder.d.ts +3 -0
- package/types/src/utils/sortOrder.d.ts.map +1 -0
- package/types/src/utils/string-break.d.ts +3 -0
- package/types/src/utils/string-break.d.ts.map +1 -0
- package/types/src/utils/syntax.d.ts +77 -0
- package/types/src/utils/syntax.d.ts.map +1 -0
- package/types/src/utils/text.d.ts +146 -0
- package/types/src/utils/text.d.ts.map +1 -0
- package/types/src/utils/text.test.d.ts +2 -0
- package/types/src/utils/text.test.d.ts.map +1 -0
- package/types/src/utils/toc.d.ts +67 -0
- package/types/src/utils/toc.d.ts.map +1 -0
- package/types/src/utils/toposort.d.ts +7 -0
- package/types/src/utils/toposort.d.ts.map +1 -0
- package/README.md +0 -700
- package/src/block-parser-js.test.js +0 -171
- package/src/block-parser.js +0 -405
- package/src/block-parser.test.js +0 -481
- package/src/process-file.js +0 -66
package/src/utils/fs.js
CHANGED
|
@@ -9,10 +9,21 @@ const { readdir, stat, readFile } = fs
|
|
|
9
9
|
|
|
10
10
|
const IS_HIDDEN_FILE = /(^|[\\\/])\.[^\\\/\.]/g
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Check if value is a RegExp
|
|
14
|
+
* @param {any} thing - Value to check
|
|
15
|
+
* @returns {boolean} True if value is RegExp
|
|
16
|
+
*/
|
|
12
17
|
function isRegex(thing) {
|
|
13
18
|
return (thing instanceof RegExp)
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Write file with directory creation if needed
|
|
23
|
+
* @param {string} filePath - File path to write to
|
|
24
|
+
* @param {string} content - Content to write
|
|
25
|
+
* @returns {Promise<void>}
|
|
26
|
+
*/
|
|
16
27
|
async function writeFile(filePath, content) {
|
|
17
28
|
try {
|
|
18
29
|
await fs.writeFile(filePath, content)
|
|
@@ -69,6 +80,12 @@ async function escalade(start, callback) {
|
|
|
69
80
|
|
|
70
81
|
// }
|
|
71
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Convert absolute path to relative path
|
|
85
|
+
* @param {string} file - Absolute file path
|
|
86
|
+
* @param {string} cwd - Current working directory
|
|
87
|
+
* @returns {string} Relative path
|
|
88
|
+
*/
|
|
72
89
|
function convertToRelativePath(file, cwd) {
|
|
73
90
|
return file.replace(cwd, '').replace(/^\//, '')
|
|
74
91
|
}
|
|
@@ -165,6 +182,11 @@ function depth(string) {
|
|
|
165
182
|
return path.normalize(string).split(path.sep).length - 1;
|
|
166
183
|
}
|
|
167
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Check if path is local (not remote)
|
|
187
|
+
* @param {string} filePath - File path to check
|
|
188
|
+
* @returns {boolean} True if path is local
|
|
189
|
+
*/
|
|
168
190
|
function isLocalPath(filePath) {
|
|
169
191
|
if (filePath.startsWith('github.com/') || filePath.startsWith('raw.githubusercontent.com/')) return false
|
|
170
192
|
return _isLocalPath(filePath)
|
package/src/utils/fs.test.js
CHANGED
|
@@ -26,8 +26,8 @@ test('Finds file from dir', async () => {
|
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
test('getGitignoreContents', async () => {
|
|
29
|
-
const files = await getGitignoreContents()
|
|
30
|
-
|
|
29
|
+
const files = await getGitignoreContents(path.resolve(__dirname, '../../', '.gitignore'))
|
|
30
|
+
//*
|
|
31
31
|
console.log('files', files)
|
|
32
32
|
/** */
|
|
33
33
|
assert.is(Array.isArray(files), true)
|
package/src/utils/index.js
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
|
|
2
|
+
/**
|
|
3
|
+
* Filter function to get only unique values
|
|
4
|
+
* @param {any} value - Current value
|
|
5
|
+
* @param {number} index - Current index
|
|
6
|
+
* @param {any[]} self - Original array
|
|
7
|
+
* @returns {boolean} True if value is unique
|
|
8
|
+
*/
|
|
2
9
|
function onlyUnique(value, index, self) {
|
|
3
10
|
return self.indexOf(value) === index
|
|
4
11
|
}
|
|
5
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Get code location string in format path:line:column
|
|
15
|
+
* @param {string} srcPath - Source file path
|
|
16
|
+
* @param {string|number} line - Line number
|
|
17
|
+
* @param {string} [column='0'] - Column number
|
|
18
|
+
* @returns {string} Location string
|
|
19
|
+
*/
|
|
6
20
|
function getCodeLocation(srcPath, line, column = '0') {
|
|
7
21
|
return `${srcPath}:${line}:${column}`
|
|
8
22
|
}
|
|
9
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Pluralize word based on count
|
|
26
|
+
* @param {any[]|number} thing - Array or number to count
|
|
27
|
+
* @param {string} [single=''] - Singular form
|
|
28
|
+
* @param {string} [plural=''] - Plural form
|
|
29
|
+
* @returns {string} Singular or plural form
|
|
30
|
+
*/
|
|
10
31
|
function pluralize(thing, single = '', plural = '') {
|
|
11
32
|
const count = Array.isArray(thing) ? thing.length : Number(thing)
|
|
12
33
|
return count === 1 ? single : plural
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://stackoverflow.com/questions/38859506/cancel-regex-match-if-timeout
|
|
2
2
|
const util = require('util')
|
|
3
3
|
const vm = require('vm')
|
|
4
|
-
const { getBlockRegex } = require('
|
|
4
|
+
const { getBlockRegex } = require('comment-block-parser')
|
|
5
5
|
const { getSyntaxInfo } = require('./syntax')
|
|
6
6
|
|
|
7
7
|
const goodString = `
|
package/src/utils/text.js
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
const { syntaxMap } = require('./syntax')
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Split string into lines
|
|
5
|
+
* @param {string} str - Input string
|
|
6
|
+
* @returns {string[]} Array of lines
|
|
7
|
+
*/
|
|
3
8
|
function getLines(str = '') {
|
|
4
9
|
return str.split(/\r\n|\r|\n/)
|
|
5
10
|
}
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Get line count from string
|
|
14
|
+
* @param {string} str - Input string
|
|
15
|
+
* @returns {number} Number of lines
|
|
16
|
+
*/
|
|
7
17
|
function getLineCount(str = '') {
|
|
8
18
|
return getLines(str).length
|
|
9
19
|
}
|
|
10
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Get row and column position from character index
|
|
23
|
+
* @param {string} input - Input string
|
|
24
|
+
* @param {number} indexToFind - Character index to find
|
|
25
|
+
* @returns {{row: number, col: number}} Row and column position
|
|
26
|
+
*/
|
|
11
27
|
function getRowAndColumnFromCharPos(input, indexToFind) {
|
|
12
28
|
const preChunk = input.substr(0, indexToFind);
|
|
13
29
|
const row = preChunk.split('\n').length - 1
|
|
@@ -16,23 +32,50 @@ function getRowAndColumnFromCharPos(input, indexToFind) {
|
|
|
16
32
|
return { row, col }
|
|
17
33
|
};
|
|
18
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Get word count from string
|
|
37
|
+
* @param {string} str - Input string
|
|
38
|
+
* @returns {number} Word count
|
|
39
|
+
*/
|
|
19
40
|
function getWordCount(str = '') {
|
|
20
41
|
return str.trim().split(/\s+/).length
|
|
21
42
|
}
|
|
22
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Get first character from string
|
|
46
|
+
* @param {string} str - Input string
|
|
47
|
+
* @returns {string} First character
|
|
48
|
+
*/
|
|
23
49
|
function getFirstCharacter(str) {
|
|
24
50
|
return str.charAt(0)
|
|
25
51
|
}
|
|
26
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Get last character from string
|
|
55
|
+
* @param {string} str - Input string
|
|
56
|
+
* @returns {string} Last character
|
|
57
|
+
*/
|
|
27
58
|
function getLastCharacter(str) {
|
|
28
59
|
return str.substr(-1)
|
|
29
60
|
}
|
|
30
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Get leading spaces from text
|
|
64
|
+
* @param {string} text - Input text
|
|
65
|
+
* @returns {string} Leading spaces
|
|
66
|
+
*/
|
|
31
67
|
function getLeadingSpaces(text) {
|
|
32
68
|
const matches = text.match(/^\s*/)
|
|
33
69
|
return (matches && matches[0]) ? matches[0] : ''
|
|
34
70
|
}
|
|
35
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Get text between character positions
|
|
74
|
+
* @param {string} text - Input text
|
|
75
|
+
* @param {number} start - Start position
|
|
76
|
+
* @param {number} end - End position
|
|
77
|
+
* @returns {string} Text between positions
|
|
78
|
+
*/
|
|
36
79
|
function getTextBetweenChars(text, start, end) {
|
|
37
80
|
return text.slice(start, end)
|
|
38
81
|
}
|
|
@@ -56,6 +99,14 @@ function getTextBetweenWords(s, prefix, suffix) {
|
|
|
56
99
|
return s
|
|
57
100
|
}
|
|
58
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Replace text between character positions
|
|
104
|
+
* @param {string} str - Input string
|
|
105
|
+
* @param {number} start - Start position
|
|
106
|
+
* @param {number} end - End position
|
|
107
|
+
* @param {string} newStr - Replacement string
|
|
108
|
+
* @returns {string} Modified string
|
|
109
|
+
*/
|
|
59
110
|
function replaceTextBetweenChars(str = '', start, end, newStr) {
|
|
60
111
|
return str.substring(0, start) + newStr + str.substring(end)
|
|
61
112
|
}
|
|
@@ -77,22 +128,39 @@ function getTextBetweenLines(content, startLine, endLine) {
|
|
|
77
128
|
if (startDefined && !endDefined) {
|
|
78
129
|
return lines.slice(startLine - 1, startLine).join('')
|
|
79
130
|
}
|
|
80
|
-
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
if (startLine && endLine && Number(startLine) <= Number(endLine)) {
|
|
81
133
|
return lines.slice(startLine - 1, endLine).join('\n')
|
|
82
134
|
}
|
|
83
135
|
}
|
|
84
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Check if string is uppercase
|
|
139
|
+
* @param {string} str - Input string
|
|
140
|
+
* @returns {boolean} True if uppercase
|
|
141
|
+
*/
|
|
85
142
|
function isUpperCase(str) {
|
|
86
143
|
return str === str.toUpperCase()
|
|
87
144
|
}
|
|
88
145
|
|
|
89
146
|
// https://github.com/jamiebuilds/min-indent/blob/master/index.js
|
|
147
|
+
/**
|
|
148
|
+
* Find minimum indentation in string
|
|
149
|
+
* @param {string} string - Input string
|
|
150
|
+
* @returns {number} Minimum indentation level
|
|
151
|
+
*/
|
|
90
152
|
function findMinIndent(string) {
|
|
91
153
|
const match = string.match(/^[ \t]*(?=\S)/gm)
|
|
92
154
|
if (!match) return 0
|
|
93
155
|
return match.reduce((r, a) => Math.min(r, a.length), Infinity)
|
|
94
156
|
}
|
|
95
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Strip indentation from string
|
|
160
|
+
* @param {string} string - Input string
|
|
161
|
+
* @param {number} [indentation] - Indentation level to strip
|
|
162
|
+
* @returns {string} String with indentation stripped
|
|
163
|
+
*/
|
|
96
164
|
function stripIndent(string, indentation) {
|
|
97
165
|
const indent = typeof indentation !== 'undefined' ? indentation : findMinIndent(string);
|
|
98
166
|
if (indent === 0) {
|
|
@@ -105,7 +173,7 @@ function stripIndent(string, indentation) {
|
|
|
105
173
|
/**
|
|
106
174
|
* Trim leading & trailing spaces/line breaks in code and keeps the indentation of the first non-empty line
|
|
107
175
|
* @param {string|number} str
|
|
108
|
-
* @returns string
|
|
176
|
+
* @returns {string}
|
|
109
177
|
*/
|
|
110
178
|
function trimString(str = '') {
|
|
111
179
|
let content = (typeof str === 'number') ? str.toString() : str
|
|
@@ -113,6 +181,15 @@ function stripIndent(string, indentation) {
|
|
|
113
181
|
return content.replace(/^(?:[\t ]*(?:\r?\n|\r))+|\s+$/g, '')
|
|
114
182
|
}
|
|
115
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Add indentation to string
|
|
186
|
+
* @param {string} string - Input string
|
|
187
|
+
* @param {number} [count=1] - Number of indentations to add
|
|
188
|
+
* @param {object} [options={}] - Options for indentation
|
|
189
|
+
* @param {string} [options.indent=' '] - Character(s) to use for indentation
|
|
190
|
+
* @param {boolean} [options.includeEmptyLines=false] - Whether to indent empty lines
|
|
191
|
+
* @returns {string} Indented string
|
|
192
|
+
*/
|
|
116
193
|
function indentString(string, count = 1, options = {}) {
|
|
117
194
|
const {
|
|
118
195
|
indent = ' ',
|
|
@@ -130,8 +207,8 @@ function indentString(string, count = 1, options = {}) {
|
|
|
130
207
|
/**
|
|
131
208
|
* Removes the indentation of multiline strings
|
|
132
209
|
* @link https://github.com/victornpb/tiny-dedent/
|
|
133
|
-
* @param
|
|
134
|
-
* @
|
|
210
|
+
* @param {string} str - A template literal string
|
|
211
|
+
* @returns {string} A string without the indentation
|
|
135
212
|
*/
|
|
136
213
|
function dedentString(str) {
|
|
137
214
|
str = str.replace(/^[ \t]*\r?\n/, ''); // remove leading blank line
|
|
@@ -180,7 +257,7 @@ function stripCommentBlockOld(str, syntax = 'md') {
|
|
|
180
257
|
/**
|
|
181
258
|
* Strip out comment blocks
|
|
182
259
|
* @param {string} str
|
|
183
|
-
* @param {
|
|
260
|
+
* @param {import('../types').SyntaxType} syntax
|
|
184
261
|
* @returns {string} clean comment-less string
|
|
185
262
|
*/
|
|
186
263
|
function stripComments(str, syntax = 'md') {
|
|
@@ -298,33 +375,48 @@ function convertCommentSyntax(str, { from, to }) {
|
|
|
298
375
|
}
|
|
299
376
|
|
|
300
377
|
/**
|
|
301
|
-
*
|
|
302
|
-
* @param {string} str
|
|
303
|
-
* @returns
|
|
378
|
+
* Capitalize first letter
|
|
379
|
+
* @param {string} str - Input string
|
|
380
|
+
* @returns {string} String with first letter capitalized
|
|
304
381
|
*/
|
|
305
382
|
function capitalizeFirstLetter(str) {
|
|
306
383
|
return capitalize(str.charAt(0)) + str.slice(1)
|
|
307
384
|
}
|
|
308
385
|
|
|
309
386
|
/**
|
|
310
|
-
*
|
|
311
|
-
* @param {string} str
|
|
312
|
-
* @returns
|
|
387
|
+
* Capitalize string
|
|
388
|
+
* @param {string} str - Input string
|
|
389
|
+
* @returns {string} Capitalized string
|
|
313
390
|
*/
|
|
314
391
|
function capitalize(str = '') {
|
|
315
392
|
return str.toUpperCase()
|
|
316
393
|
}
|
|
317
394
|
|
|
395
|
+
/**
|
|
396
|
+
* Convert string to camelCase
|
|
397
|
+
* @param {string} str - Input string
|
|
398
|
+
* @returns {string} camelCase string
|
|
399
|
+
*/
|
|
318
400
|
function camelCase(str = '') {
|
|
319
401
|
return str.replace(/[-_ ](\w)/g, (_, c) => c.toUpperCase())
|
|
320
402
|
}
|
|
321
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Convert string to kebab-case
|
|
406
|
+
* @param {string} str - Input string
|
|
407
|
+
* @returns {string} kebab-case string
|
|
408
|
+
*/
|
|
322
409
|
function kebabCase(str = '') {
|
|
323
410
|
return str.replace(/\B([A-Z])/g, '-$1').toLowerCase()
|
|
324
411
|
}
|
|
325
412
|
|
|
326
413
|
const smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
|
|
327
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Convert string to Title Case
|
|
417
|
+
* @param {string} str - Input string
|
|
418
|
+
* @returns {string} Title Case string
|
|
419
|
+
*/
|
|
328
420
|
function toTitleCase(str = '') {
|
|
329
421
|
return str.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, (match, index, title) => {
|
|
330
422
|
if (index > 0
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../_tests/errors.test.js"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"local-code-file.d.ts","sourceRoot":"","sources":["../../../_tests/fixtures/local-code-file.js"],"names":[],"mappings":"AAYqB,4BAGpB"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"transforms-toc.test.d.ts","sourceRoot":"","sources":["../../_tests/transforms-toc.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.test.d.ts","sourceRoot":"","sources":["../../_tests/transforms.test.js"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"argparse.test.d.ts","sourceRoot":"","sources":["../../../src/argparse/argparse.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/argparse/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitOutsideQuotes.d.ts","sourceRoot":"","sources":["../../../src/argparse/splitOutsideQuotes.js"],"names":[],"mappings":"AAEA,oDAuEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitOutsideQuotes.test.d.ts","sourceRoot":"","sources":["../../../src/argparse/splitOutsideQuotes.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-run.d.ts","sourceRoot":"","sources":["../../src/cli-run.js"],"names":[],"mappings":";AAsBA,6FAoLC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-run.test.d.ts","sourceRoot":"","sources":["../../src/cli-run.test.js"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"globparse.test.d.ts","sourceRoot":"","sources":["../../src/globparse.test.js"],"names":[],"mappings":""}
|