@docusaurus/utils 2.0.0-beta.16 → 2.0.0-beta.17
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.js +1 -2
- package/lib/constants.js.map +1 -1
- package/lib/dataFileUtils.js +4 -4
- package/lib/dataFileUtils.js.map +1 -1
- package/lib/emitUtils.d.ts +23 -0
- package/lib/emitUtils.d.ts.map +1 -0
- package/lib/emitUtils.js +90 -0
- package/lib/emitUtils.js.map +1 -0
- package/lib/gitUtils.js +2 -2
- package/lib/gitUtils.js.map +1 -1
- package/lib/globUtils.js +3 -3
- package/lib/globUtils.js.map +1 -1
- package/lib/hashUtils.js +1 -1
- package/lib/hashUtils.js.map +1 -1
- package/lib/i18nUtils.d.ts +17 -0
- package/lib/i18nUtils.d.ts.map +1 -0
- package/lib/i18nUtils.js +40 -0
- package/lib/i18nUtils.js.map +1 -0
- package/lib/index.d.ts +5 -49
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +43 -249
- package/lib/index.js.map +1 -1
- package/lib/jsUtils.d.ts +17 -0
- package/lib/jsUtils.d.ts.map +1 -0
- package/lib/jsUtils.js +72 -0
- package/lib/jsUtils.js.map +1 -0
- package/lib/markdownLinks.js +1 -1
- package/lib/markdownLinks.js.map +1 -1
- package/lib/markdownParser.js +5 -6
- package/lib/markdownParser.js.map +1 -1
- package/lib/pathUtils.d.ts +1 -0
- package/lib/pathUtils.d.ts.map +1 -1
- package/lib/pathUtils.js +9 -2
- package/lib/pathUtils.js.map +1 -1
- package/lib/slugger.js +2 -2
- package/lib/slugger.js.map +1 -1
- package/lib/tags.js +2 -3
- package/lib/tags.js.map +1 -1
- package/lib/urlUtils.d.ts +11 -0
- package/lib/urlUtils.d.ts.map +1 -1
- package/lib/urlUtils.js +56 -1
- package/lib/urlUtils.js.map +1 -1
- package/lib/webpackUtils.js +1 -1
- package/lib/webpackUtils.js.map +1 -1
- package/package.json +4 -4
- package/src/emitUtils.ts +113 -0
- package/src/i18nUtils.ts +58 -0
- package/src/index.ts +26 -300
- package/src/jsUtils.ts +88 -0
- package/src/pathUtils.ts +8 -2
- package/src/urlUtils.ts +53 -0
package/lib/constants.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
var _a;
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
9
|
exports.WEBPACK_URL_LOADER_LIMIT = exports.DEFAULT_PLUGIN_ID = exports.DEFAULT_PORT = exports.THEME_PATH = exports.OUTPUT_STATIC_ASSETS_DIR_NAME = exports.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;
|
|
11
10
|
exports.NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
|
|
@@ -23,5 +22,5 @@ exports.THEME_PATH = `${exports.SRC_DIR_NAME}/theme`;
|
|
|
23
22
|
exports.DEFAULT_PORT = 3000;
|
|
24
23
|
exports.DEFAULT_PLUGIN_ID = 'default';
|
|
25
24
|
// Temporary fix for https://github.com/facebook/docusaurus/issues/5493
|
|
26
|
-
exports.WEBPACK_URL_LOADER_LIMIT =
|
|
25
|
+
exports.WEBPACK_URL_LOADER_LIMIT = process.env.WEBPACK_URL_LOADER_LIMIT ?? 10000;
|
|
27
26
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,kBAAkB,GAAG,QAAQ,CACxC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACnC,EAAE,CACH,CAAC;AACW,QAAA,kBAAkB,GAAG,QAAQ,CACxC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACnC,EAAE,CACH,CAAC;AAEF,8CAA8C;AACjC,QAAA,sBAAsB,GAAG,OAAO,CAAC;AAE9C,6CAA6C;AAChC,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAElD,QAAA,sBAAsB,GACjC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,iBAAiB,CAAC;AAExD,QAAA,wBAAwB,GACnC,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,aAAa,CAAC;AAEtD,QAAA,YAAY,GAAG,KAAK,CAAC;AACrB,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,6BAA6B,GAAG,QAAQ,CAAC,CAAC,gEAAgE;AAC1G,QAAA,UAAU,GAAG,GAAG,oBAAY,QAAQ,CAAC;AACrC,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,uEAAuE;AAC1D,QAAA,wBAAwB,GACnC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,KAAK,CAAC"}
|
package/lib/dataFileUtils.js
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getFolderContainingFile = exports.findFolderContainingFile = exports.getContentPathList = exports.getDataFileData = exports.getDataFilePath = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const fs_extra_1 =
|
|
12
|
-
const js_yaml_1 =
|
|
13
|
-
const path_1 =
|
|
11
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
13
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
14
|
const index_1 = require("./index");
|
|
15
|
-
const logger_1 =
|
|
15
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
16
16
|
async function getDataFilePath({ filePath, contentPaths, }) {
|
|
17
17
|
// Loads a localized data file in priority
|
|
18
18
|
const contentPath = await findFolderContainingFile(getContentPathList(contentPaths), filePath);
|
package/lib/dataFileUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFileUtils.js","sourceRoot":"","sources":["../src/dataFileUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"dataFileUtils.js","sourceRoot":"","sources":["../src/dataFileUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,gEAA0B;AAC1B,8DAA2B;AAC3B,wDAAwB;AACxB,mCAA4C;AAE5C,wEAAwC;AAOjC,KAAK,UAAU,eAAe,CAAC,EACpC,QAAQ,EACR,YAAY,GACG;IACf,0CAA0C;IAC1C,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAChD,kBAAkB,CAAC,YAAY,CAAC,EAChC,QAAQ,CACT,CAAC;IACF,IAAI,WAAW,EAAE;QACf,OAAO,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;KACzC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAbD,0CAaC;AAED;;;GAGG;AACI,KAAK,UAAU,eAAe,CACnC,MAA2C,EAC3C,QAAiC;IAEjC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IACD,IAAI;QACF,MAAM,aAAa,GAAG,MAAM,kBAAE,CAAC,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code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
export declare function generate(generatedFilesDir: string, file: string, content: string, skipCache?: boolean): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Generate unique chunk name given a module path.
|
|
11
|
+
*/
|
|
12
|
+
export declare function genChunkName(modulePath: string, prefix?: string, preferredName?: string, shortId?: boolean): string;
|
|
13
|
+
/**
|
|
14
|
+
* @param permalink The URL that the HTML file corresponds to, without base URL
|
|
15
|
+
* @param outDir Full path to the output directory
|
|
16
|
+
* @param trailingSlash The site config option. If provided, only one path will
|
|
17
|
+
* be read.
|
|
18
|
+
* @returns This returns a buffer, which you have to decode string yourself if
|
|
19
|
+
* needed. (Not always necessary since the output isn't for human consumption
|
|
20
|
+
* anyways, and most HTML manipulation libs accept buffers)
|
|
21
|
+
*/
|
|
22
|
+
export declare function readOutputHTMLFile(permalink: string, outDir: string, trailingSlash: boolean | undefined): Promise<Buffer>;
|
|
23
|
+
//# sourceMappingURL=emitUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitUtils.d.ts","sourceRoot":"","sources":["../src/emitUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH,wBAAsB,QAAQ,CAC5B,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,OAA+C,GACzD,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAID;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,GAAE,OAA+C,GACvD,MAAM,CAiBR;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,OAAO,GAAG,SAAS,GACjC,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
package/lib/emitUtils.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.readOutputHTMLFile = exports.genChunkName = exports.generate = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
+
const crypto_1 = require("crypto");
|
|
14
|
+
const hashUtils_1 = require("./hashUtils");
|
|
15
|
+
const jsUtils_1 = require("./jsUtils");
|
|
16
|
+
const fileHash = new Map();
|
|
17
|
+
async function generate(generatedFilesDir, file, content, skipCache = process.env.NODE_ENV === 'production') {
|
|
18
|
+
const filepath = path_1.default.join(generatedFilesDir, file);
|
|
19
|
+
if (skipCache) {
|
|
20
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath));
|
|
21
|
+
await fs_extra_1.default.writeFile(filepath, content);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
let lastHash = fileHash.get(filepath);
|
|
25
|
+
// If file already exists but its not in runtime cache yet,
|
|
26
|
+
// we try to calculate the content hash and then compare
|
|
27
|
+
// This is to avoid unnecessary overwriting and we can reuse old file.
|
|
28
|
+
if (!lastHash && (await fs_extra_1.default.pathExists(filepath))) {
|
|
29
|
+
const lastContent = await fs_extra_1.default.readFile(filepath, 'utf8');
|
|
30
|
+
lastHash = (0, crypto_1.createHash)('md5').update(lastContent).digest('hex');
|
|
31
|
+
fileHash.set(filepath, lastHash);
|
|
32
|
+
}
|
|
33
|
+
const currentHash = (0, crypto_1.createHash)('md5').update(content).digest('hex');
|
|
34
|
+
if (lastHash !== currentHash) {
|
|
35
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath));
|
|
36
|
+
await fs_extra_1.default.writeFile(filepath, content);
|
|
37
|
+
fileHash.set(filepath, currentHash);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.generate = generate;
|
|
41
|
+
const chunkNameCache = new Map();
|
|
42
|
+
/**
|
|
43
|
+
* Generate unique chunk name given a module path.
|
|
44
|
+
*/
|
|
45
|
+
function genChunkName(modulePath, prefix, preferredName, shortId = process.env.NODE_ENV === 'production') {
|
|
46
|
+
let chunkName = chunkNameCache.get(modulePath);
|
|
47
|
+
if (!chunkName) {
|
|
48
|
+
if (shortId) {
|
|
49
|
+
chunkName = (0, hashUtils_1.simpleHash)(modulePath, 8);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
let str = modulePath;
|
|
53
|
+
if (preferredName) {
|
|
54
|
+
const shortHash = (0, hashUtils_1.simpleHash)(modulePath, 3);
|
|
55
|
+
str = `${preferredName}${shortHash}`;
|
|
56
|
+
}
|
|
57
|
+
const name = str === '/' ? 'index' : (0, hashUtils_1.docuHash)(str);
|
|
58
|
+
chunkName = prefix ? `${prefix}---${name}` : name;
|
|
59
|
+
}
|
|
60
|
+
chunkNameCache.set(modulePath, chunkName);
|
|
61
|
+
}
|
|
62
|
+
return chunkName;
|
|
63
|
+
}
|
|
64
|
+
exports.genChunkName = genChunkName;
|
|
65
|
+
/**
|
|
66
|
+
* @param permalink The URL that the HTML file corresponds to, without base URL
|
|
67
|
+
* @param outDir Full path to the output directory
|
|
68
|
+
* @param trailingSlash The site config option. If provided, only one path will
|
|
69
|
+
* be read.
|
|
70
|
+
* @returns This returns a buffer, which you have to decode string yourself if
|
|
71
|
+
* needed. (Not always necessary since the output isn't for human consumption
|
|
72
|
+
* anyways, and most HTML manipulation libs accept buffers)
|
|
73
|
+
*/
|
|
74
|
+
async function readOutputHTMLFile(permalink, outDir, trailingSlash) {
|
|
75
|
+
const withTrailingSlashPath = path_1.default.join(outDir, permalink, 'index.html');
|
|
76
|
+
const withoutTrailingSlashPath = path_1.default.join(outDir, `${permalink.replace(/\/$/, '')}.html`);
|
|
77
|
+
if (trailingSlash) {
|
|
78
|
+
return fs_extra_1.default.readFile(withTrailingSlashPath);
|
|
79
|
+
}
|
|
80
|
+
else if (trailingSlash === false) {
|
|
81
|
+
return fs_extra_1.default.readFile(withoutTrailingSlashPath);
|
|
82
|
+
}
|
|
83
|
+
const HTMLPath = await (0, jsUtils_1.findAsyncSequential)([withTrailingSlashPath, withoutTrailingSlashPath], fs_extra_1.default.pathExists);
|
|
84
|
+
if (!HTMLPath) {
|
|
85
|
+
throw new Error(`Expected output HTML file to be found at ${withTrailingSlashPath}`);
|
|
86
|
+
}
|
|
87
|
+
return fs_extra_1.default.readFile(HTMLPath);
|
|
88
|
+
}
|
|
89
|
+
exports.readOutputHTMLFile = readOutputHTMLFile;
|
|
90
|
+
//# sourceMappingURL=emitUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitUtils.js","sourceRoot":"","sources":["../src/emitUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,gEAA0B;AAC1B,mCAAkC;AAClC,2CAAiD;AACjD,uCAA8C;AAE9C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEpC,KAAK,UAAU,QAAQ,CAC5B,iBAAyB,EACzB,IAAY,EACZ,OAAe,EACf,YAAqB,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAE1D,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAEpD,IAAI,SAAS,EAAE;QACb,MAAM,kBAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;Q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E,wBAAwB,CAAC,EACjD,kBAAE,CAAC,UAAU,CACd,CAAC;IACF,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,4CAA4C,qBAAqB,EAAE,CACpE,CAAC;KACH;IACD,OAAO,kBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAzBD,gDAyBC"}
|
package/lib/gitUtils.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getFileCommitDate = exports.GitNotFoundError = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const path_1 =
|
|
12
|
-
const shelljs_1 =
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
|
|
13
13
|
class GitNotFoundError extends Error {
|
|
14
14
|
}
|
|
15
15
|
exports.GitNotFoundError = GitNotFoundError;
|
package/lib/gitUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitUtils.js","sourceRoot":"","sources":["../src/gitUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"gitUtils.js","sourceRoot":"","sources":["../src/gitUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,8DAA4B;AAE5B,MAAa,gBAAiB,SAAQ,KAAK;CAAG;AAA9C,4CAA8C;AAEvC,MAAM,iBAAiB,GAAG,CAC/B,IAAY,EACZ,EACE,GAAG,GAAG,QAAQ,EACd,aAAa,GAAG,KAAK,GAItB,EAKD,EAAE;IACF,IAAI,CAAC,iBAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,gBAAgB,CACxB,uCAAuC,IAAI,iCAAiC,CAC7E,CAAC;KACH;IAED,IAAI,CAAC,iBAAK,CAA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M,IAAI,KAAK,CACb,gDAAgD,IAAI,6BAA6B,MAAM,EAAE,CAC1F,CAAC;KACH;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAExC,IAAI,aAAa,EAAE;QACjB,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAC,CAAC;KACvD;IACD,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,CAAC;AAC3B,CAAC,CAAC;AAhFW,QAAA,iBAAiB,qBAgF5B"}
|
package/lib/globUtils.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.createAbsoluteFilePathMatcher = exports.createMatcher = exports.GlobExcludeDefault = exports.Globby = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
// Globby/Micromatch are the 2 libs we use in Docusaurus consistently
|
|
12
|
-
const micromatch_1 =
|
|
13
|
-
const path_1 =
|
|
12
|
+
const micromatch_1 = tslib_1.__importDefault(require("micromatch")); // Note: Micromatch is used by Globby
|
|
13
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
14
|
var globby_1 = require("globby");
|
|
15
|
-
Object.defineProperty(exports, "Globby", { enumerable: true, get: function () { return
|
|
15
|
+
Object.defineProperty(exports, "Globby", { enumerable: true, get: function () { return tslib_1.__importDefault(globby_1).default; } });
|
|
16
16
|
// The default patterns we ignore when globbing
|
|
17
17
|
// using _ prefix for exclusion by convention
|
|
18
18
|
exports.GlobExcludeDefault = [
|
package/lib/globUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globUtils.js","sourceRoot":"","sources":["../src/globUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,qEAAq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B,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,CAAC,gBAAwB,EAAE,EAAE,CAClC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACnD,CAAC;AAtBD,sEAsBC"}
|
package/lib/hashUtils.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.docuHash = exports.simpleHash = exports.md5Hash = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const crypto_1 = require("crypto");
|
|
12
|
-
const lodash_1 =
|
|
12
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
13
|
const pathUtils_1 = require("./pathUtils");
|
|
14
14
|
function md5Hash(str) {
|
|
15
15
|
return (0, crypto_1.createHash)('md5').update(str).digest('hex');
|
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,
|
|
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,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAFD,gCAEC;AAED,+DAA+D;AAC/D;;;;;GAKG;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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { TranslationFileContent, TranslationFile } from '@docusaurus/types';
|
|
8
|
+
export declare function mergeTranslations(contents: TranslationFileContent[]): TranslationFileContent;
|
|
9
|
+
export declare function updateTranslationFileMessages(translationFile: TranslationFile, updateMessage: (message: string) => string): TranslationFile;
|
|
10
|
+
export declare function getPluginI18nPath({ siteDir, locale, pluginName, pluginId, subPaths, }: {
|
|
11
|
+
siteDir: string;
|
|
12
|
+
locale: string;
|
|
13
|
+
pluginName: string;
|
|
14
|
+
pluginId?: string | undefined;
|
|
15
|
+
subPaths?: string[];
|
|
16
|
+
}): string;
|
|
17
|
+
//# sourceMappingURL=i18nUtils.d.ts.map
|
|
@@ -0,0 +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;AAID,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GACzC,eAAe,CAQjB;AAED,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
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getPluginI18nPath = exports.updateTranslationFileMessages = exports.mergeTranslations = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
function mergeTranslations(contents) {
|
|
15
|
+
return contents.reduce((acc, content) => ({ ...acc, ...content }), {});
|
|
16
|
+
}
|
|
17
|
+
exports.mergeTranslations = mergeTranslations;
|
|
18
|
+
// Useful to update all the messages of a translation file
|
|
19
|
+
// Used in tests to simulate translations
|
|
20
|
+
function updateTranslationFileMessages(translationFile, updateMessage) {
|
|
21
|
+
return {
|
|
22
|
+
...translationFile,
|
|
23
|
+
content: lodash_1.default.mapValues(translationFile.content, (translation) => ({
|
|
24
|
+
...translation,
|
|
25
|
+
message: updateMessage(translation.message),
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.updateTranslationFileMessages = updateTranslationFileMessages;
|
|
30
|
+
function getPluginI18nPath({ siteDir, locale, pluginName, pluginId = constants_1.DEFAULT_PLUGIN_ID, subPaths = [], }) {
|
|
31
|
+
return path_1.default.join(siteDir, 'i18n',
|
|
32
|
+
// namespace first by locale: convenient to work in a single folder for a
|
|
33
|
+
// translator
|
|
34
|
+
locale,
|
|
35
|
+
// Make it convenient to use for single-instance
|
|
36
|
+
// ie: return "docs", not "docs-default" nor "docs/default"
|
|
37
|
+
`${pluginName}${pluginId === constants_1.DEFAULT_PLUGIN_ID ? '' : `-${pluginId}`}`, ...subPaths);
|
|
38
|
+
}
|
|
39
|
+
exports.getPluginI18nPath = getPluginI18nPath;
|
|
40
|
+
//# sourceMappingURL=i18nUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18nUtils.js","sourceRoot":"","sources":["../src/i18nUtils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,wDAAwB;AACxB,4DAAuB;AAEvB,2CAA8C;AAE9C,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,0DAA0D;AAC1D,yCAAyC;AACzC,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,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,MAAM;IACN,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,63 +4,19 @@
|
|
|
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
|
-
/// <reference types="node" />
|
|
8
|
-
import type { ReportingSeverity, TranslationFileContent, TranslationFile } from '@docusaurus/types';
|
|
9
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, STATIC_DIR_NAME, OUTPUT_STATIC_ASSETS_DIR_NAME, THEME_PATH, DEFAULT_PORT, DEFAULT_PLUGIN_ID, WEBPACK_URL_LOADER_LIMIT, } from './constants';
|
|
8
|
+
export { generate, genChunkName, readOutputHTMLFile } from './emitUtils';
|
|
10
9
|
export { getFileCommitDate, GitNotFoundError } from './gitUtils';
|
|
11
|
-
export {
|
|
10
|
+
export { mergeTranslations, updateTranslationFileMessages, getPluginI18nPath, } from './i18nUtils';
|
|
11
|
+
export { removeSuffix, removePrefix, getElementsAround, mapAsyncSequential, findAsyncSequential, reportMessage, } from './jsUtils';
|
|
12
|
+
export { normalizeUrl, getEditUrl, fileToPath, encodePath, isValidPathname, resolvePathname, addLeadingSlash, addTrailingSlash, removeTrailingSlash, } from './urlUtils';
|
|
12
13
|
export { type Tag, type FrontMatterTag, type TaggedItemGroup, normalizeFrontMatterTag, normalizeFrontMatterTags, groupTaggedItems, } from './tags';
|
|
13
14
|
export { parseMarkdownHeadingId, createExcerpt, parseFrontMatter, parseMarkdownContentTitle, parseMarkdownString, } from './markdownParser';
|
|
14
15
|
export { type ContentPaths, type BrokenMarkdownLink, type ReplaceMarkdownLinksParams, type ReplaceMarkdownLinksReturn, replaceMarkdownLinks, } from './markdownLinks';
|
|
15
16
|
export { type SluggerOptions, type Slugger, createSlugger } from './slugger';
|
|
16
|
-
export { isNameTooLong, shortName, posixPath, toMessageRelativeFilePath, aliasedSitePath, escapePath, } from './pathUtils';
|
|
17
|
+
export { isNameTooLong, shortName, posixPath, toMessageRelativeFilePath, aliasedSitePath, escapePath, addTrailingPathSeparator, } from './pathUtils';
|
|
17
18
|
export { md5Hash, simpleHash, docuHash } from './hashUtils';
|
|
18
19
|
export { Globby, GlobExcludeDefault, createMatcher, createAbsoluteFilePathMatcher, } from './globUtils';
|
|
19
20
|
export { getFileLoaderUtils } from './webpackUtils';
|
|
20
21
|
export { getDataFilePath, getDataFileData, getContentPathList, findFolderContainingFile, getFolderContainingFile, } from './dataFileUtils';
|
|
21
|
-
export declare function generate(generatedFilesDir: string, file: string, content: string, skipCache?: boolean): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Convert filepath to url path.
|
|
24
|
-
* Example: 'index.md' -> '/', 'foo/bar.js' -> '/foo/bar',
|
|
25
|
-
*/
|
|
26
|
-
export declare function fileToPath(file: string): string;
|
|
27
|
-
export declare function encodePath(userPath: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Generate unique chunk name given a module path.
|
|
30
|
-
*/
|
|
31
|
-
export declare function genChunkName(modulePath: string, prefix?: string, preferredName?: string, shortId?: boolean): string;
|
|
32
|
-
export declare function isValidPathname(str: string): boolean;
|
|
33
|
-
export declare function resolvePathname(to: string, from?: string): string;
|
|
34
|
-
export declare function addLeadingSlash(str: string): string;
|
|
35
|
-
export declare function addTrailingPathSeparator(str: string): string;
|
|
36
|
-
export declare function addTrailingSlash(str: string): string;
|
|
37
|
-
export declare function removeTrailingSlash(str: string): string;
|
|
38
|
-
export declare function removeSuffix(str: string, suffix: string): string;
|
|
39
|
-
export declare function removePrefix(str: string, prefix: string): string;
|
|
40
|
-
export declare function getElementsAround<T>(array: T[], aroundIndex: number): {
|
|
41
|
-
next: T | undefined;
|
|
42
|
-
previous: T | undefined;
|
|
43
|
-
};
|
|
44
|
-
export declare function getPluginI18nPath({ siteDir, locale, pluginName, pluginId, subPaths, }: {
|
|
45
|
-
siteDir: string;
|
|
46
|
-
locale: string;
|
|
47
|
-
pluginName: string;
|
|
48
|
-
pluginId?: string | undefined;
|
|
49
|
-
subPaths?: string[];
|
|
50
|
-
}): string;
|
|
51
|
-
/**
|
|
52
|
-
* @param permalink The URL that the HTML file corresponds to, without base URL
|
|
53
|
-
* @param outDir Full path to the output directory
|
|
54
|
-
* @param trailingSlash The site config option. If provided, only one path will
|
|
55
|
-
* be read.
|
|
56
|
-
* @returns This returns a buffer, which you have to decode string yourself if
|
|
57
|
-
* needed. (Not always necessary since the output isn't for human consumption
|
|
58
|
-
* anyways, and most HTML manipulation libs accept buffers)
|
|
59
|
-
*/
|
|
60
|
-
export declare function readOutputHTMLFile(permalink: string, outDir: string, trailingSlash: boolean | undefined): Promise<Buffer>;
|
|
61
|
-
export declare function mapAsyncSequential<T, R>(array: T[], action: (t: T) => Promise<R>): Promise<R[]>;
|
|
62
|
-
export declare function findAsyncSequential<T>(array: T[], predicate: (t: T) => Promise<boolean>): Promise<T | undefined>;
|
|
63
|
-
export declare function reportMessage(message: string, reportingSeverity: ReportingSeverity): void;
|
|
64
|
-
export declare function mergeTranslations(contents: TranslationFileContent[]): TranslationFileContent;
|
|
65
|
-
export declare function updateTranslationFileMessages(translationFile: TranslationFile, updateMessage: (message: string) => string): TranslationFile;
|
|
66
22
|
//# sourceMappingURL=index.d.ts.map
|
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
|
|
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,eAAe,EACf,6BAA6B,EAC7B,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AACvE,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,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,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,GAAG,EACR,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,gBA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