@docusaurus/utils 0.0.0-4759 → 0.0.0-4760
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/lib/constants.d.ts +49 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +53 -8
- package/lib/constants.js.map +1 -1
- package/lib/dataFileUtils.d.ts +38 -2
- package/lib/dataFileUtils.d.ts.map +1 -1
- package/lib/dataFileUtils.js +34 -7
- package/lib/dataFileUtils.js.map +1 -1
- package/lib/emitUtils.d.ts +12 -0
- package/lib/emitUtils.d.ts.map +1 -1
- package/lib/emitUtils.js +22 -3
- package/lib/emitUtils.js.map +1 -1
- package/lib/gitUtils.d.ts +42 -2
- package/lib/gitUtils.d.ts.map +1 -1
- package/lib/gitUtils.js +2 -2
- package/lib/gitUtils.js.map +1 -1
- package/lib/globUtils.d.ts +27 -0
- package/lib/globUtils.d.ts.map +1 -1
- package/lib/globUtils.js +28 -10
- package/lib/globUtils.js.map +1 -1
- package/lib/hashUtils.d.ts +5 -4
- package/lib/hashUtils.d.ts.map +1 -1
- package/lib/hashUtils.js +6 -5
- package/lib/hashUtils.js.map +1 -1
- package/lib/i18nUtils.d.ts +11 -0
- package/lib/i18nUtils.d.ts.map +1 -1
- package/lib/i18nUtils.js +12 -3
- package/lib/i18nUtils.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/jsUtils.d.ts +32 -4
- package/lib/jsUtils.d.ts.map +1 -1
- package/lib/jsUtils.js +35 -13
- package/lib/jsUtils.js.map +1 -1
- package/lib/markdownLinks.d.ts +45 -4
- package/lib/markdownLinks.d.ts.map +1 -1
- package/lib/markdownLinks.js +17 -8
- package/lib/markdownLinks.js.map +1 -1
- package/lib/markdownUtils.d.ts +80 -9
- package/lib/markdownUtils.d.ts.map +1 -1
- package/lib/markdownUtils.js +61 -10
- package/lib/markdownUtils.js.map +1 -1
- package/lib/pathUtils.d.ts +1 -1
- package/lib/pathUtils.d.ts.map +1 -1
- package/lib/pathUtils.js +2 -2
- package/lib/pathUtils.js.map +1 -1
- package/lib/slugger.d.ts +10 -0
- package/lib/slugger.d.ts.map +1 -1
- package/lib/slugger.js +4 -0
- package/lib/slugger.js.map +1 -1
- package/lib/tags.d.ts +31 -10
- package/lib/tags.d.ts.map +1 -1
- package/lib/tags.js +38 -24
- package/lib/tags.js.map +1 -1
- package/lib/urlUtils.d.ts +45 -2
- package/lib/urlUtils.d.ts.map +1 -1
- package/lib/urlUtils.js +48 -6
- package/lib/urlUtils.js.map +1 -1
- package/lib/webpackUtils.d.ts +5 -0
- package/lib/webpackUtils.d.ts.map +1 -1
- package/lib/webpackUtils.js +6 -2
- package/lib/webpackUtils.js.map +1 -1
- package/package.json +4 -4
- package/src/constants.ts +59 -7
- package/src/dataFileUtils.ts +43 -10
- package/src/emitUtils.ts +24 -5
- package/src/gitUtils.ts +46 -4
- package/src/globUtils.ts +29 -13
- package/src/hashUtils.ts +6 -5
- package/src/i18nUtils.ts +13 -4
- package/src/index.ts +3 -6
- package/src/jsUtils.ts +34 -20
- package/src/markdownLinks.ts +58 -22
- package/src/markdownUtils.ts +101 -23
- package/src/pathUtils.ts +2 -2
- package/src/slugger.ts +13 -1
- package/src/tags.ts +37 -25
- package/src/urlUtils.ts +49 -6
- package/src/webpackUtils.ts +10 -2
package/lib/hashUtils.d.ts
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
/** Thin wrapper around `crypto.createHash("md5")`. */
|
|
7
8
|
export declare function md5Hash(str: string): string;
|
|
9
|
+
/** Creates an MD5 hash and truncates it to the given length. */
|
|
8
10
|
export declare function simpleHash(str: string, length: number): string;
|
|
9
11
|
/**
|
|
10
|
-
* Given an input string, convert to kebab-case and append a hash
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* filename per OS. Avoids ERRNAMETOOLONG error.
|
|
12
|
+
* Given an input string, convert to kebab-case and append a hash, avoiding name
|
|
13
|
+
* collision. Also removes part of the string if its larger than the allowed
|
|
14
|
+
* filename per OS, avoiding `ERRNAMETOOLONG` error.
|
|
14
15
|
*/
|
|
15
16
|
export declare function docuHash(str: string): string;
|
|
16
17
|
//# sourceMappingURL=hashUtils.d.ts.map
|
package/lib/hashUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashUtils.d.ts","sourceRoot":"","sources":["../src/hashUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAGD
|
|
1
|
+
{"version":3,"file":"hashUtils.d.ts","sourceRoot":"","sources":["../src/hashUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAGD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU5C"}
|
package/lib/hashUtils.js
CHANGED
|
@@ -11,20 +11,21 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const crypto_1 = require("crypto");
|
|
12
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
13
|
const pathUtils_1 = require("./pathUtils");
|
|
14
|
+
/** Thin wrapper around `crypto.createHash("md5")`. */
|
|
14
15
|
function md5Hash(str) {
|
|
15
16
|
return (0, crypto_1.createHash)('md5').update(str).digest('hex');
|
|
16
17
|
}
|
|
17
18
|
exports.md5Hash = md5Hash;
|
|
19
|
+
/** Creates an MD5 hash and truncates it to the given length. */
|
|
18
20
|
function simpleHash(str, length) {
|
|
19
|
-
return md5Hash(str).
|
|
21
|
+
return md5Hash(str).substring(0, length);
|
|
20
22
|
}
|
|
21
23
|
exports.simpleHash = simpleHash;
|
|
22
24
|
// Based on https://github.com/gatsbyjs/gatsby/pull/21518/files
|
|
23
25
|
/**
|
|
24
|
-
* Given an input string, convert to kebab-case and append a hash
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* filename per OS. Avoids ERRNAMETOOLONG error.
|
|
26
|
+
* Given an input string, convert to kebab-case and append a hash, avoiding name
|
|
27
|
+
* collision. Also removes part of the string if its larger than the allowed
|
|
28
|
+
* filename per OS, avoiding `ERRNAMETOOLONG` error.
|
|
28
29
|
*/
|
|
29
30
|
function docuHash(str) {
|
|
30
31
|
if (str === '/') {
|
package/lib/hashUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashUtils.js","sourceRoot":"","sources":["../src/hashUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,mCAAkC;AAClC,4DAAuB;AACvB,2CAAqD;AAErD,SAAgB,OAAO,CAAC,GAAW;IACjC,OAAO,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC;AAED,SAAgB,UAAU,CAAC,GAAW,EAAE,MAAc;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"hashUtils.js","sourceRoot":"","sources":["../src/hashUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,mCAAkC;AAClC,4DAAuB;AACvB,2CAAqD;AAErD,sDAAsD;AACtD,SAAgB,OAAO,CAAC,GAAW;IACjC,OAAO,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC;AAED,gEAAgE;AAChE,SAAgB,UAAU,CAAC,GAAW,EAAE,MAAc;IACpD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;AAFD,gCAEC;AAED,+DAA+D;AAC/D;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,IAAI,GAAG,KAAK,GAAG,EAAE;QACf,OAAO,OAAO,CAAC;KAChB;IACD,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,GAAG,gBAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE,CAAC;IACtD,IAAI,IAAA,yBAAa,EAAC,UAAU,CAAC,EAAE;QAC7B,OAAO,GAAG,IAAA,qBAAS,EAAC,gBAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC;KACtD;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAVD,4BAUC"}
|
package/lib/i18nUtils.d.ts
CHANGED
|
@@ -5,8 +5,19 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { TranslationFileContent, TranslationFile } from '@docusaurus/types';
|
|
8
|
+
/**
|
|
9
|
+
* Takes a list of translation file contents, and shallow-merges them into one.
|
|
10
|
+
*/
|
|
8
11
|
export declare function mergeTranslations(contents: TranslationFileContent[]): TranslationFileContent;
|
|
12
|
+
/**
|
|
13
|
+
* Useful to update all the messages of a translation file. Used in tests to
|
|
14
|
+
* simulate translations.
|
|
15
|
+
*/
|
|
9
16
|
export declare function updateTranslationFileMessages(translationFile: TranslationFile, updateMessage: (message: string) => string): TranslationFile;
|
|
17
|
+
/**
|
|
18
|
+
* Takes everything needed and constructs a plugin i18n path. Plugins should
|
|
19
|
+
* expect everything it needs for translations to be found under this path.
|
|
20
|
+
*/
|
|
10
21
|
export declare function getPluginI18nPath({ siteDir, locale, pluginName, pluginId, subPaths, }: {
|
|
11
22
|
siteDir: string;
|
|
12
23
|
locale: string;
|
package/lib/i18nUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18nUtils.d.ts","sourceRoot":"","sources":["../src/i18nUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAC,sBAAsB,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAG/E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,sBAAsB,EAAE,GACjC,sBAAsB,CAExB;
|
|
1
|
+
{"version":3,"file":"i18nUtils.d.ts","sourceRoot":"","sources":["../src/i18nUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAC,sBAAsB,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAG/E;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,sBAAsB,EAAE,GACjC,sBAAsB,CAExB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GACzC,eAAe,CAQjB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,UAAU,EACV,QAA4B,EAC5B,QAAa,GACd,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,MAAM,CAYT"}
|
package/lib/i18nUtils.js
CHANGED
|
@@ -11,12 +11,17 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
|
+
/**
|
|
15
|
+
* Takes a list of translation file contents, and shallow-merges them into one.
|
|
16
|
+
*/
|
|
14
17
|
function mergeTranslations(contents) {
|
|
15
18
|
return contents.reduce((acc, content) => ({ ...acc, ...content }), {});
|
|
16
19
|
}
|
|
17
20
|
exports.mergeTranslations = mergeTranslations;
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Useful to update all the messages of a translation file. Used in tests to
|
|
23
|
+
* simulate translations.
|
|
24
|
+
*/
|
|
20
25
|
function updateTranslationFileMessages(translationFile, updateMessage) {
|
|
21
26
|
return {
|
|
22
27
|
...translationFile,
|
|
@@ -27,8 +32,12 @@ function updateTranslationFileMessages(translationFile, updateMessage) {
|
|
|
27
32
|
};
|
|
28
33
|
}
|
|
29
34
|
exports.updateTranslationFileMessages = updateTranslationFileMessages;
|
|
35
|
+
/**
|
|
36
|
+
* Takes everything needed and constructs a plugin i18n path. Plugins should
|
|
37
|
+
* expect everything it needs for translations to be found under this path.
|
|
38
|
+
*/
|
|
30
39
|
function getPluginI18nPath({ siteDir, locale, pluginName, pluginId = constants_1.DEFAULT_PLUGIN_ID, subPaths = [], }) {
|
|
31
|
-
return path_1.default.join(siteDir,
|
|
40
|
+
return path_1.default.join(siteDir, constants_1.I18N_DIR_NAME,
|
|
32
41
|
// namespace first by locale: convenient to work in a single folder for a
|
|
33
42
|
// translator
|
|
34
43
|
locale,
|
package/lib/i18nUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18nUtils.js","sourceRoot":"","sources":["../src/i18nUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,4DAAuB;AAEvB,
|
|
1
|
+
{"version":3,"file":"i18nUtils.js","sourceRoot":"","sources":["../src/i18nUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,4DAAuB;AAEvB,2CAA6D;AAE7D;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,QAAkC;IAElC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,GAAG,EAAE,GAAG,OAAO,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC;AAJD,8CAIC;AAED;;;GAGG;AACH,SAAgB,6BAA6B,CAC3C,eAAgC,EAChC,aAA0C;IAE1C,OAAO;QACL,GAAG,eAAe;QAClB,OAAO,EAAE,gBAAC,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC9D,GAAG,WAAW;YACd,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAXD,sEAWC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,UAAU,EACV,QAAQ,GAAG,6BAAiB,EAC5B,QAAQ,GAAG,EAAE,GAOd;IACC,OAAO,cAAI,CAAC,IAAI,CACd,OAAO,EACP,yBAAa;IACb,yEAAyE;IACzE,aAAa;IACb,MAAM;IACN,gDAAgD;IAChD,2DAA2D;IAC3D,GAAG,UAAU,GAAG,QAAQ,KAAK,6BAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,EACtE,GAAG,QAAQ,CACZ,CAAC;AACJ,CAAC;AAxBD,8CAwBC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { NODE_MAJOR_VERSION, NODE_MINOR_VERSION, DEFAULT_BUILD_DIR_NAME, DEFAULT_CONFIG_FILE_NAME, BABEL_CONFIG_FILE_NAME, GENERATED_FILES_DIR_NAME, SRC_DIR_NAME,
|
|
7
|
+
export { NODE_MAJOR_VERSION, NODE_MINOR_VERSION, DEFAULT_BUILD_DIR_NAME, DEFAULT_CONFIG_FILE_NAME, BABEL_CONFIG_FILE_NAME, GENERATED_FILES_DIR_NAME, SRC_DIR_NAME, DEFAULT_STATIC_DIR_NAME, OUTPUT_STATIC_ASSETS_DIR_NAME, THEME_PATH, I18N_DIR_NAME, CODE_TRANSLATIONS_FILE_NAME, DEFAULT_PORT, DEFAULT_PLUGIN_ID, WEBPACK_URL_LOADER_LIMIT, } from './constants';
|
|
8
8
|
export { generate, genChunkName, readOutputHTMLFile } from './emitUtils';
|
|
9
9
|
export { getFileCommitDate, FileNotTrackedError, GitNotFoundError, } from './gitUtils';
|
|
10
10
|
export { mergeTranslations, updateTranslationFileMessages, getPluginI18nPath, } from './i18nUtils';
|
|
11
|
-
export { removeSuffix, removePrefix,
|
|
11
|
+
export { removeSuffix, removePrefix, mapAsyncSequential, findAsyncSequential, reportMessage, } from './jsUtils';
|
|
12
12
|
export { normalizeUrl, getEditUrl, fileToPath, encodePath, isValidPathname, resolvePathname, addLeadingSlash, addTrailingSlash, removeTrailingSlash, hasSSHProtocol, buildHttpsUrl, buildSshUrl, } from './urlUtils';
|
|
13
|
-
export { type Tag, type FrontMatterTag,
|
|
13
|
+
export { type Tag, type FrontMatterTag, normalizeFrontMatterTags, groupTaggedItems, } from './tags';
|
|
14
14
|
export { parseMarkdownHeadingId, createExcerpt, parseFrontMatter, parseMarkdownContentTitle, parseMarkdownString, writeMarkdownHeadingId, type WriteHeadingIDOptions, } from './markdownUtils';
|
|
15
|
-
export { type ContentPaths, type BrokenMarkdownLink,
|
|
15
|
+
export { type ContentPaths, type BrokenMarkdownLink, replaceMarkdownLinks, } from './markdownLinks';
|
|
16
16
|
export { type SluggerOptions, type Slugger, createSlugger } from './slugger';
|
|
17
17
|
export { isNameTooLong, shortName, posixPath, toMessageRelativeFilePath, aliasedSitePath, escapePath, addTrailingPathSeparator, } from './pathUtils';
|
|
18
18
|
export { md5Hash, simpleHash, docuHash } from './hashUtils';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EACvB,6BAA6B,EAC7B,UAAU,EACV,aAAa,EACb,2BAA2B,EAC3B,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AAC3E,OAAO,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,yBAAyB,EACzB,eAAe,EACf,UAAU,EACV,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,aAAa,EACb,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.replaceMarkdownLinks = exports.writeMarkdownHeadingId = exports.parseMarkdownString = exports.parseMarkdownContentTitle = exports.parseFrontMatter = exports.createExcerpt = exports.parseMarkdownHeadingId = exports.groupTaggedItems = exports.normalizeFrontMatterTags = exports.
|
|
9
|
+
exports.replaceMarkdownLinks = exports.writeMarkdownHeadingId = exports.parseMarkdownString = exports.parseMarkdownContentTitle = exports.parseFrontMatter = exports.createExcerpt = exports.parseMarkdownHeadingId = exports.groupTaggedItems = exports.normalizeFrontMatterTags = exports.buildSshUrl = exports.buildHttpsUrl = exports.hasSSHProtocol = exports.removeTrailingSlash = exports.addTrailingSlash = exports.addLeadingSlash = exports.resolvePathname = exports.isValidPathname = exports.encodePath = exports.fileToPath = exports.getEditUrl = exports.normalizeUrl = exports.reportMessage = exports.findAsyncSequential = exports.mapAsyncSequential = exports.removePrefix = exports.removeSuffix = exports.getPluginI18nPath = exports.updateTranslationFileMessages = exports.mergeTranslations = exports.GitNotFoundError = exports.FileNotTrackedError = exports.getFileCommitDate = exports.readOutputHTMLFile = exports.genChunkName = exports.generate = exports.WEBPACK_URL_LOADER_LIMIT = exports.DEFAULT_PLUGIN_ID = exports.DEFAULT_PORT = exports.CODE_TRANSLATIONS_FILE_NAME = exports.I18N_DIR_NAME = exports.THEME_PATH = exports.OUTPUT_STATIC_ASSETS_DIR_NAME = exports.DEFAULT_STATIC_DIR_NAME = exports.SRC_DIR_NAME = exports.GENERATED_FILES_DIR_NAME = exports.BABEL_CONFIG_FILE_NAME = exports.DEFAULT_CONFIG_FILE_NAME = exports.DEFAULT_BUILD_DIR_NAME = exports.NODE_MINOR_VERSION = exports.NODE_MAJOR_VERSION = void 0;
|
|
10
10
|
exports.getFolderContainingFile = exports.findFolderContainingFile = exports.getContentPathList = exports.getDataFileData = exports.getDataFilePath = exports.getFileLoaderUtils = exports.createAbsoluteFilePathMatcher = exports.createMatcher = exports.GlobExcludeDefault = exports.Globby = exports.docuHash = exports.simpleHash = exports.md5Hash = exports.addTrailingPathSeparator = exports.escapePath = exports.aliasedSitePath = exports.toMessageRelativeFilePath = exports.posixPath = exports.shortName = exports.isNameTooLong = exports.createSlugger = void 0;
|
|
11
11
|
var constants_1 = require("./constants");
|
|
12
12
|
Object.defineProperty(exports, "NODE_MAJOR_VERSION", { enumerable: true, get: function () { return constants_1.NODE_MAJOR_VERSION; } });
|
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "DEFAULT_CONFIG_FILE_NAME", { enumerable: true, g
|
|
|
16
16
|
Object.defineProperty(exports, "BABEL_CONFIG_FILE_NAME", { enumerable: true, get: function () { return constants_1.BABEL_CONFIG_FILE_NAME; } });
|
|
17
17
|
Object.defineProperty(exports, "GENERATED_FILES_DIR_NAME", { enumerable: true, get: function () { return constants_1.GENERATED_FILES_DIR_NAME; } });
|
|
18
18
|
Object.defineProperty(exports, "SRC_DIR_NAME", { enumerable: true, get: function () { return constants_1.SRC_DIR_NAME; } });
|
|
19
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "DEFAULT_STATIC_DIR_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_STATIC_DIR_NAME; } });
|
|
20
20
|
Object.defineProperty(exports, "OUTPUT_STATIC_ASSETS_DIR_NAME", { enumerable: true, get: function () { return constants_1.OUTPUT_STATIC_ASSETS_DIR_NAME; } });
|
|
21
21
|
Object.defineProperty(exports, "THEME_PATH", { enumerable: true, get: function () { return constants_1.THEME_PATH; } });
|
|
22
|
+
Object.defineProperty(exports, "I18N_DIR_NAME", { enumerable: true, get: function () { return constants_1.I18N_DIR_NAME; } });
|
|
23
|
+
Object.defineProperty(exports, "CODE_TRANSLATIONS_FILE_NAME", { enumerable: true, get: function () { return constants_1.CODE_TRANSLATIONS_FILE_NAME; } });
|
|
22
24
|
Object.defineProperty(exports, "DEFAULT_PORT", { enumerable: true, get: function () { return constants_1.DEFAULT_PORT; } });
|
|
23
25
|
Object.defineProperty(exports, "DEFAULT_PLUGIN_ID", { enumerable: true, get: function () { return constants_1.DEFAULT_PLUGIN_ID; } });
|
|
24
26
|
Object.defineProperty(exports, "WEBPACK_URL_LOADER_LIMIT", { enumerable: true, get: function () { return constants_1.WEBPACK_URL_LOADER_LIMIT; } });
|
|
@@ -37,7 +39,6 @@ Object.defineProperty(exports, "getPluginI18nPath", { enumerable: true, get: fun
|
|
|
37
39
|
var jsUtils_1 = require("./jsUtils");
|
|
38
40
|
Object.defineProperty(exports, "removeSuffix", { enumerable: true, get: function () { return jsUtils_1.removeSuffix; } });
|
|
39
41
|
Object.defineProperty(exports, "removePrefix", { enumerable: true, get: function () { return jsUtils_1.removePrefix; } });
|
|
40
|
-
Object.defineProperty(exports, "getElementsAround", { enumerable: true, get: function () { return jsUtils_1.getElementsAround; } });
|
|
41
42
|
Object.defineProperty(exports, "mapAsyncSequential", { enumerable: true, get: function () { return jsUtils_1.mapAsyncSequential; } });
|
|
42
43
|
Object.defineProperty(exports, "findAsyncSequential", { enumerable: true, get: function () { return jsUtils_1.findAsyncSequential; } });
|
|
43
44
|
Object.defineProperty(exports, "reportMessage", { enumerable: true, get: function () { return jsUtils_1.reportMessage; } });
|
|
@@ -55,7 +56,6 @@ Object.defineProperty(exports, "hasSSHProtocol", { enumerable: true, get: functi
|
|
|
55
56
|
Object.defineProperty(exports, "buildHttpsUrl", { enumerable: true, get: function () { return urlUtils_1.buildHttpsUrl; } });
|
|
56
57
|
Object.defineProperty(exports, "buildSshUrl", { enumerable: true, get: function () { return urlUtils_1.buildSshUrl; } });
|
|
57
58
|
var tags_1 = require("./tags");
|
|
58
|
-
Object.defineProperty(exports, "normalizeFrontMatterTag", { enumerable: true, get: function () { return tags_1.normalizeFrontMatterTag; } });
|
|
59
59
|
Object.defineProperty(exports, "normalizeFrontMatterTags", { enumerable: true, get: function () { return tags_1.normalizeFrontMatterTags; } });
|
|
60
60
|
Object.defineProperty(exports, "groupTaggedItems", { enumerable: true, get: function () { return tags_1.groupTaggedItems; } });
|
|
61
61
|
var markdownUtils_1 = require("./markdownUtils");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,yCAgBqB;AAfnB,+GAAA,kBAAkB,OAAA;AAClB,+GAAA,kBAAkB,OAAA;AAClB,mHAAA,sBAAsB,OAAA;AACtB,qHAAA,wBAAwB,OAAA;AACxB,mHAAA,sBAAsB,OAAA;AACtB,qHAAA,wBAAwB,OAAA;AACxB,yGAAA,YAAY,OAAA;AACZ,oHAAA,uBAAuB,OAAA;AACvB,0HAAA,6BAA6B,OAAA;AAC7B,uGAAA,UAAU,OAAA;AACV,0GAAA,aAAa,OAAA;AACb,wHAAA,2BAA2B,OAAA;AAC3B,yGAAA,YAAY,OAAA;AACZ,8GAAA,iBAAiB,OAAA;AACjB,qHAAA,wBAAwB,OAAA;AAE1B,yCAAuE;AAA/D,qGAAA,QAAQ,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AAClD,uCAIoB;AAHlB,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AACnB,4GAAA,gBAAgB,OAAA;AAElB,yCAIqB;AAHnB,8GAAA,iBAAiB,OAAA;AACjB,0HAAA,6BAA6B,OAAA;AAC7B,8GAAA,iBAAiB,OAAA;AAEnB,qCAMmB;AALjB,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,8GAAA,mBAAmB,OAAA;AACnB,wGAAA,aAAa,OAAA;AAEf,uCAaoB;AAZlB,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AACV,sGAAA,UAAU,OAAA;AACV,sGAAA,UAAU,OAAA;AACV,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,0GAAA,cAAc,OAAA;AACd,yGAAA,aAAa,OAAA;AACb,uGAAA,WAAW,OAAA;AAEb,+BAKgB;AAFd,gHAAA,wBAAwB,OAAA;AACxB,wGAAA,gBAAgB,OAAA;AAElB,iDAQyB;AAPvB,uHAAA,sBAAsB,OAAA;AACtB,8GAAA,aAAa,OAAA;AACb,iHAAA,gBAAgB,OAAA;AAChB,0HAAA,yBAAyB,OAAA;AACzB,oHAAA,mBAAmB,OAAA;AACnB,uHAAA,sBAAsB,OAAA;AAGxB,iDAIyB;AADvB,qHAAA,oBAAoB,OAAA;AAEtB,qCAA2E;AAAhC,wGAAA,aAAa,OAAA;AACxD,yCAQqB;AAPnB,0GAAA,aAAa,OAAA;AACb,sGAAA,SAAS,OAAA;AACT,sGAAA,SAAS,OAAA;AACT,sHAAA,yBAAyB,OAAA;AACzB,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AACV,qHAAA,wBAAwB,OAAA;AAE1B,yCAA0D;AAAlD,oGAAA,OAAO,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,qGAAA,QAAQ,OAAA;AACrC,yCAKqB;AAJnB,mGAAA,MAAM,OAAA;AACN,+GAAA,kBAAkB,OAAA;AAClB,0GAAA,aAAa,OAAA;AACb,0HAAA,6BAA6B,OAAA;AAE/B,+CAAkD;AAA1C,kHAAA,kBAAkB,OAAA;AAC1B,iDAMyB;AALvB,gHAAA,eAAe,OAAA;AACf,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA;AAClB,yHAAA,wBAAwB,OAAA;AACxB,wHAAA,uBAAuB,OAAA"}
|
package/lib/jsUtils.d.ts
CHANGED
|
@@ -5,13 +5,41 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { ReportingSeverity } from '@docusaurus/types';
|
|
8
|
+
/** Removes a given string suffix from `str`. */
|
|
8
9
|
export declare function removeSuffix(str: string, suffix: string): string;
|
|
10
|
+
/** Removes a given string prefix from `str`. */
|
|
9
11
|
export declare function removePrefix(str: string, prefix: string): string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `Array#map` for async operations where order matters.
|
|
14
|
+
* @param array The array to traverse.
|
|
15
|
+
* @param action An async action to be performed on every array item. Will be
|
|
16
|
+
* awaited before working on the next.
|
|
17
|
+
* @returns The list of results returned from every `action(item)`
|
|
18
|
+
*/
|
|
14
19
|
export declare function mapAsyncSequential<T, R>(array: T[], action: (t: T) => Promise<R>): Promise<R[]>;
|
|
20
|
+
/**
|
|
21
|
+
* `Array#find` for async operations where order matters.
|
|
22
|
+
* @param array The array to traverse.
|
|
23
|
+
* @param predicate An async predicate to be called on every array item. Should
|
|
24
|
+
* return a boolean indicating whether the currently element should be returned.
|
|
25
|
+
* @returns The function immediately returns the first item on which `predicate`
|
|
26
|
+
* returns `true`, or `undefined` if none matches the predicate.
|
|
27
|
+
*/
|
|
15
28
|
export declare function findAsyncSequential<T>(array: T[], predicate: (t: T) => Promise<boolean>): Promise<T | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Takes a message and reports it according to the severity that the user wants.
|
|
31
|
+
*
|
|
32
|
+
* - `ignore`: completely no-op
|
|
33
|
+
* - `log`: uses the `INFO` log level
|
|
34
|
+
* - `warn`: uses the `WARN` log level
|
|
35
|
+
* - `error`: uses the `ERROR` log level
|
|
36
|
+
* - `throw`: aborts the process, throws the error.
|
|
37
|
+
*
|
|
38
|
+
* Since the logger doesn't have logging level filters yet, these severities
|
|
39
|
+
* mostly just differ by their colors.
|
|
40
|
+
*
|
|
41
|
+
* @throws In addition to throwing when `reportingSeverity === "throw"`, this
|
|
42
|
+
* function also throws if `reportingSeverity` is not one of the above.
|
|
43
|
+
*/
|
|
16
44
|
export declare function reportMessage(message: string, reportingSeverity: ReportingSeverity): void;
|
|
17
45
|
//# sourceMappingURL=jsUtils.d.ts.map
|
package/lib/jsUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsUtils.d.ts","sourceRoot":"","sources":["../src/jsUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAGzD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"jsUtils.d.ts","sourceRoot":"","sources":["../src/jsUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAGzD,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,CAOd;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,iBAAiB,GACnC,IAAI,CAoBN"}
|
package/lib/jsUtils.js
CHANGED
|
@@ -6,31 +6,30 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.reportMessage = exports.findAsyncSequential = exports.mapAsyncSequential = exports.
|
|
9
|
+
exports.reportMessage = exports.findAsyncSequential = exports.mapAsyncSequential = exports.removePrefix = exports.removeSuffix = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
/** Removes a given string suffix from `str`. */
|
|
12
13
|
function removeSuffix(str, suffix) {
|
|
13
14
|
if (suffix === '') {
|
|
14
|
-
|
|
15
|
+
// str.slice(0, 0) is ""
|
|
16
|
+
return str;
|
|
15
17
|
}
|
|
16
18
|
return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;
|
|
17
19
|
}
|
|
18
20
|
exports.removeSuffix = removeSuffix;
|
|
21
|
+
/** Removes a given string prefix from `str`. */
|
|
19
22
|
function removePrefix(str, prefix) {
|
|
20
23
|
return str.startsWith(prefix) ? str.slice(prefix.length) : str;
|
|
21
24
|
}
|
|
22
25
|
exports.removePrefix = removePrefix;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const next = aroundIndex === max ? undefined : array[aroundIndex + 1];
|
|
31
|
-
return { previous, next };
|
|
32
|
-
}
|
|
33
|
-
exports.getElementsAround = getElementsAround;
|
|
26
|
+
/**
|
|
27
|
+
* `Array#map` for async operations where order matters.
|
|
28
|
+
* @param array The array to traverse.
|
|
29
|
+
* @param action An async action to be performed on every array item. Will be
|
|
30
|
+
* awaited before working on the next.
|
|
31
|
+
* @returns The list of results returned from every `action(item)`
|
|
32
|
+
*/
|
|
34
33
|
async function mapAsyncSequential(array, action) {
|
|
35
34
|
const results = [];
|
|
36
35
|
for (const t of array) {
|
|
@@ -40,6 +39,14 @@ async function mapAsyncSequential(array, action) {
|
|
|
40
39
|
return results;
|
|
41
40
|
}
|
|
42
41
|
exports.mapAsyncSequential = mapAsyncSequential;
|
|
42
|
+
/**
|
|
43
|
+
* `Array#find` for async operations where order matters.
|
|
44
|
+
* @param array The array to traverse.
|
|
45
|
+
* @param predicate An async predicate to be called on every array item. Should
|
|
46
|
+
* return a boolean indicating whether the currently element should be returned.
|
|
47
|
+
* @returns The function immediately returns the first item on which `predicate`
|
|
48
|
+
* returns `true`, or `undefined` if none matches the predicate.
|
|
49
|
+
*/
|
|
43
50
|
async function findAsyncSequential(array, predicate) {
|
|
44
51
|
for (const t of array) {
|
|
45
52
|
if (await predicate(t)) {
|
|
@@ -49,6 +56,21 @@ async function findAsyncSequential(array, predicate) {
|
|
|
49
56
|
return undefined;
|
|
50
57
|
}
|
|
51
58
|
exports.findAsyncSequential = findAsyncSequential;
|
|
59
|
+
/**
|
|
60
|
+
* Takes a message and reports it according to the severity that the user wants.
|
|
61
|
+
*
|
|
62
|
+
* - `ignore`: completely no-op
|
|
63
|
+
* - `log`: uses the `INFO` log level
|
|
64
|
+
* - `warn`: uses the `WARN` log level
|
|
65
|
+
* - `error`: uses the `ERROR` log level
|
|
66
|
+
* - `throw`: aborts the process, throws the error.
|
|
67
|
+
*
|
|
68
|
+
* Since the logger doesn't have logging level filters yet, these severities
|
|
69
|
+
* mostly just differ by their colors.
|
|
70
|
+
*
|
|
71
|
+
* @throws In addition to throwing when `reportingSeverity === "throw"`, this
|
|
72
|
+
* function also throws if `reportingSeverity` is not one of the above.
|
|
73
|
+
*/
|
|
52
74
|
function reportMessage(message, reportingSeverity) {
|
|
53
75
|
switch (reportingSeverity) {
|
|
54
76
|
case 'ignore':
|
package/lib/jsUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsUtils.js","sourceRoot":"","sources":["../src/jsUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,wEAAwC;AAExC,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,OAAO,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"jsUtils.js","sourceRoot":"","sources":["../src/jsUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,wEAAwC;AAExC,gDAAgD;AAChD,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,wBAAwB;QACxB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACnE,CAAC;AAND,oCAMC;AAED,gDAAgD;AAChD,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACjE,CAAC;AAFD,oCAEC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,KAAU,EACV,MAA4B;IAE5B,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAVD,gDAUC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,KAAU,EACV,SAAqC;IAErC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,IAAI,MAAM,SAAS,CAAC,CAAC,CAAC,EAAE;YACtB,OAAO,CAAC,CAAC;SACV;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAVD,kDAUC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,aAAa,CAC3B,OAAe,EACf,iBAAoC;IAEpC,QAAQ,iBAAiB,EAAE;QACzB,KAAK,QAAQ;YACX,MAAM;QACR,KAAK,KAAK;YACR,gBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,MAAM;YACT,gBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,OAAO;YACV,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,OAAO;YACV,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B;YACE,MAAM,IAAI,KAAK,CACb,yCAAyC,iBAAiB,GAAG,CAC9D,CAAC;KACL;AACH,CAAC;AAvBD,sCAuBC"}
|
package/lib/markdownLinks.d.ts
CHANGED
|
@@ -4,25 +4,66 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Content plugins have a base path and a localized path to source content from.
|
|
9
|
+
* We will look into the localized path in priority.
|
|
10
|
+
*/
|
|
7
11
|
export declare type ContentPaths = {
|
|
12
|
+
/**
|
|
13
|
+
* The absolute path to the base content directory, like `"<siteDir>/docs"`.
|
|
14
|
+
*/
|
|
8
15
|
contentPath: string;
|
|
16
|
+
/**
|
|
17
|
+
* The absolute path to the localized content directory, like
|
|
18
|
+
* `"<siteDir>/i18n/zh-Hans/plugin-content-docs"`.
|
|
19
|
+
*/
|
|
9
20
|
contentPathLocalized: string;
|
|
10
21
|
};
|
|
22
|
+
/** Data structure representing each broken Markdown link to be reported. */
|
|
11
23
|
export declare type BrokenMarkdownLink<T extends ContentPaths> = {
|
|
24
|
+
/** Absolute path to the file containing this link. */
|
|
12
25
|
filePath: string;
|
|
26
|
+
/**
|
|
27
|
+
* This is generic because it may contain extra metadata like version name,
|
|
28
|
+
* which the reporter can provide for context.
|
|
29
|
+
*/
|
|
13
30
|
contentPaths: T;
|
|
31
|
+
/**
|
|
32
|
+
* The content of the link, like `"./brokenFile.md"`
|
|
33
|
+
*/
|
|
14
34
|
link: string;
|
|
15
35
|
};
|
|
16
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Takes a Markdown file and replaces relative file references with their URL
|
|
38
|
+
* counterparts, e.g. `[link](./intro.md)` => `[link](/docs/intro)`, preserving
|
|
39
|
+
* everything else.
|
|
40
|
+
*
|
|
41
|
+
* This method uses best effort to find a matching file. The file reference can
|
|
42
|
+
* be relative to the directory of the current file (most likely) or any of the
|
|
43
|
+
* content paths (so `/tutorials/intro.md` can be resolved as
|
|
44
|
+
* `<siteDir>/docs/tutorials/intro.md`). Links that contain the `http(s):` or
|
|
45
|
+
* `@site/` prefix will always be ignored.
|
|
46
|
+
*/
|
|
47
|
+
export declare function replaceMarkdownLinks<T extends ContentPaths>({ siteDir, fileString, filePath, contentPaths, sourceToPermalink, }: {
|
|
48
|
+
/** Absolute path to the site directory, used to resolve aliased paths. */
|
|
17
49
|
siteDir: string;
|
|
50
|
+
/** The Markdown file content to be processed. */
|
|
18
51
|
fileString: string;
|
|
52
|
+
/** Absolute path to the current file containing `fileString`. */
|
|
19
53
|
filePath: string;
|
|
54
|
+
/** The content paths which the file reference may live in. */
|
|
20
55
|
contentPaths: T;
|
|
56
|
+
/**
|
|
57
|
+
* A map from source paths to their URLs. Source paths are `@site` aliased.
|
|
58
|
+
*/
|
|
21
59
|
sourceToPermalink: Record<string, string>;
|
|
22
|
-
}
|
|
23
|
-
|
|
60
|
+
}): {
|
|
61
|
+
/**
|
|
62
|
+
* The content with all Markdown file references replaced with their URLs.
|
|
63
|
+
* Unresolved links are left as-is.
|
|
64
|
+
*/
|
|
24
65
|
newContent: string;
|
|
66
|
+
/** The list of broken links, */
|
|
25
67
|
brokenMarkdownLinks: BrokenMarkdownLink<T>[];
|
|
26
68
|
};
|
|
27
|
-
export declare function replaceMarkdownLinks<T extends ContentPaths>({ siteDir, fileString, filePath, contentPaths, sourceToPermalink, }: ReplaceMarkdownLinksParams<T>): ReplaceMarkdownLinksReturn<T>;
|
|
28
69
|
//# sourceMappingURL=markdownLinks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownLinks.d.ts","sourceRoot":"","sources":["../src/markdownLinks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"markdownLinks.d.ts","sourceRoot":"","sources":["../src/markdownLinks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,4EAA4E;AAC5E,oBAAY,kBAAkB,CAAC,CAAC,SAAS,YAAY,IAAI;IACvD,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,YAAY,EAAE,EAC3D,OAAO,EACP,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,iBAAiB,GAClB,EAAE;IACD,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,YAAY,EAAE,CAAC,CAAC;IAChB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,GAAG;IACF;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9C,CAuEA"}
|
package/lib/markdownLinks.js
CHANGED
|
@@ -9,9 +9,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.replaceMarkdownLinks = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const dataFileUtils_1 = require("./dataFileUtils");
|
|
12
13
|
const pathUtils_1 = require("./pathUtils");
|
|
14
|
+
/**
|
|
15
|
+
* Takes a Markdown file and replaces relative file references with their URL
|
|
16
|
+
* counterparts, e.g. `[link](./intro.md)` => `[link](/docs/intro)`, preserving
|
|
17
|
+
* everything else.
|
|
18
|
+
*
|
|
19
|
+
* This method uses best effort to find a matching file. The file reference can
|
|
20
|
+
* be relative to the directory of the current file (most likely) or any of the
|
|
21
|
+
* content paths (so `/tutorials/intro.md` can be resolved as
|
|
22
|
+
* `<siteDir>/docs/tutorials/intro.md`). Links that contain the `http(s):` or
|
|
23
|
+
* `@site/` prefix will always be ignored.
|
|
24
|
+
*/
|
|
13
25
|
function replaceMarkdownLinks({ siteDir, fileString, filePath, contentPaths, sourceToPermalink, }) {
|
|
14
|
-
const { contentPath, contentPathLocalized } = contentPaths;
|
|
15
26
|
const brokenMarkdownLinks = [];
|
|
16
27
|
// Replace internal markdown linking (except in fenced blocks).
|
|
17
28
|
let fencedBlock = false;
|
|
@@ -34,19 +45,17 @@ function replaceMarkdownLinks({ siteDir, fileString, filePath, contentPaths, sou
|
|
|
34
45
|
}
|
|
35
46
|
let modifiedLine = line;
|
|
36
47
|
// Replace inline-style links or reference-style links e.g:
|
|
37
|
-
// This is [Document 1](doc1.md)
|
|
38
|
-
//
|
|
39
|
-
// [doc1]: doc1.md -> we replace this doc1.md with correct link
|
|
48
|
+
// This is [Document 1](doc1.md)
|
|
49
|
+
// [doc1]: doc1.md
|
|
40
50
|
const mdRegex = /(?:\]\(|\]:\s*)(?!https?:\/\/|@site\/)(?<filename>[^'")\]\s>]+\.mdx?)/g;
|
|
41
51
|
let mdMatch = mdRegex.exec(modifiedLine);
|
|
42
52
|
while (mdMatch !== null) {
|
|
43
53
|
// Replace it to correct html link.
|
|
44
54
|
const mdLink = mdMatch.groups.filename;
|
|
45
55
|
const sourcesToTry = [
|
|
46
|
-
path_1.default.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
];
|
|
56
|
+
path_1.default.dirname(filePath),
|
|
57
|
+
...(0, dataFileUtils_1.getContentPathList)(contentPaths),
|
|
58
|
+
].map((p) => path_1.default.join(p, decodeURIComponent(mdLink)));
|
|
50
59
|
const aliasedSourceMatch = sourcesToTry
|
|
51
60
|
.map((source) => (0, pathUtils_1.aliasedSitePath)(source, siteDir))
|
|
52
61
|
.find((source) => sourceToPermalink[source]);
|
package/lib/markdownLinks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownLinks.js","sourceRoot":"","sources":["../src/markdownLinks.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,2CAA4C;
|
|
1
|
+
{"version":3,"file":"markdownLinks.js","sourceRoot":"","sources":["../src/markdownLinks.ts"],"names":[],"mappings":"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"}
|
package/lib/markdownUtils.d.ts
CHANGED
|
@@ -4,34 +4,105 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { type SluggerOptions } from './slugger';
|
|
8
|
+
/**
|
|
9
|
+
* Parses custom ID from a heading. The ID must be composed of letters,
|
|
10
|
+
* underscores, and dashes only.
|
|
11
|
+
*
|
|
12
|
+
* @param heading e.g. `## Some heading {#some-heading}` where the last
|
|
13
|
+
* character must be `}` for the ID to be recognized
|
|
14
|
+
*/
|
|
7
15
|
export declare function parseMarkdownHeadingId(heading: string): {
|
|
16
|
+
/**
|
|
17
|
+
* The heading content sans the ID part, right-trimmed. e.g. `## Some heading`
|
|
18
|
+
*/
|
|
8
19
|
text: string;
|
|
20
|
+
/** The heading ID. e.g. `some-heading` */
|
|
9
21
|
id?: string;
|
|
10
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates an excerpt of a Markdown file. This function will:
|
|
25
|
+
*
|
|
26
|
+
* - Ignore h1 headings (setext or atx)
|
|
27
|
+
* - Ignore import/export
|
|
28
|
+
* - Ignore code blocks
|
|
29
|
+
*
|
|
30
|
+
* And for the first contentful line, it will strip away most Markdown
|
|
31
|
+
* syntax, including HTML tags, emphasis, links (keeping the text), etc.
|
|
32
|
+
*/
|
|
11
33
|
export declare function createExcerpt(fileString: string): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Takes a raw Markdown file content, and parses the front matter using
|
|
36
|
+
* gray-matter. Worth noting that gray-matter accepts TOML and other markup
|
|
37
|
+
* languages as well.
|
|
38
|
+
*
|
|
39
|
+
* @throws Throws when gray-matter throws. e.g.:
|
|
40
|
+
* ```md
|
|
41
|
+
* ---
|
|
42
|
+
* foo: : bar
|
|
43
|
+
* ---
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
12
46
|
export declare function parseFrontMatter(markdownFileContent: string): {
|
|
47
|
+
/** Front matter as parsed by gray-matter. */
|
|
13
48
|
frontMatter: Record<string, unknown>;
|
|
49
|
+
/** The remaining content, trimmed. */
|
|
14
50
|
content: string;
|
|
15
51
|
};
|
|
16
|
-
|
|
52
|
+
declare type ParseMarkdownContentTitleOptions = {
|
|
53
|
+
/**
|
|
54
|
+
* If `true`, the matching title will be removed from the returned content.
|
|
55
|
+
* We can promise that at least one empty line will be left between the
|
|
56
|
+
* content before and after, but you shouldn't make too much assumption
|
|
57
|
+
* about what's left.
|
|
58
|
+
*/
|
|
17
59
|
removeContentTitle?: boolean;
|
|
18
|
-
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Takes the raw Markdown content, without front matter, and tries to find an h1
|
|
63
|
+
* title (setext or atx) to be used as metadata.
|
|
64
|
+
*
|
|
65
|
+
* It only searches until the first contentful paragraph, ignoring import/export
|
|
66
|
+
* declarations.
|
|
67
|
+
*
|
|
68
|
+
* It will try to convert markdown to reasonable text, but won't be best effort,
|
|
69
|
+
* since it's only used as a fallback when `frontMatter.title` is not provided.
|
|
70
|
+
* For now, we just unwrap inline code (``# `config.js` `` => `config.js`).
|
|
71
|
+
*/
|
|
72
|
+
export declare function parseMarkdownContentTitle(contentUntrimmed: string, options?: ParseMarkdownContentTitleOptions): {
|
|
73
|
+
/** The content, optionally without the content title. */
|
|
19
74
|
content: string;
|
|
75
|
+
/** The title, trimmed and without the `#`. */
|
|
20
76
|
contentTitle: string | undefined;
|
|
21
77
|
};
|
|
22
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Makes a full-round parse.
|
|
80
|
+
*
|
|
81
|
+
* @throws Throws when `parseFrontMatter` throws, usually because of invalid
|
|
82
|
+
* syntax.
|
|
83
|
+
*/
|
|
84
|
+
export declare function parseMarkdownString(markdownFileContent: string, options?: ParseMarkdownContentTitleOptions): {
|
|
85
|
+
/** @see {@link parseFrontMatter} */
|
|
23
86
|
frontMatter: Record<string, unknown>;
|
|
24
|
-
|
|
87
|
+
/** @see {@link parseMarkdownContentTitle} */
|
|
25
88
|
contentTitle: string | undefined;
|
|
89
|
+
/** @see {@link createExcerpt} */
|
|
26
90
|
excerpt: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Content without front matter and (optionally) without title, depending on
|
|
93
|
+
* the `removeContentTitle` option.
|
|
94
|
+
*/
|
|
95
|
+
content: string;
|
|
27
96
|
};
|
|
28
|
-
export declare
|
|
29
|
-
|
|
30
|
-
}): ParsedMarkdown;
|
|
31
|
-
export declare type WriteHeadingIDOptions = {
|
|
32
|
-
maintainCase?: boolean;
|
|
97
|
+
export declare type WriteHeadingIDOptions = SluggerOptions & {
|
|
98
|
+
/** Overwrite existing heading IDs. */
|
|
33
99
|
overwrite?: boolean;
|
|
34
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Takes Markdown content, returns new content with heading IDs written.
|
|
103
|
+
* Respects existing IDs (unless `overwrite=true`) and never generates colliding
|
|
104
|
+
* IDs (through the slugger).
|
|
105
|
+
*/
|
|
35
106
|
export declare function writeMarkdownHeadingId(content: string, options?: WriteHeadingIDOptions): string;
|
|
36
107
|
export {};
|
|
37
108
|
//# sourceMappingURL=markdownUtils.d.ts.map
|