@docusaurus/utils 0.0.0-4635 → 0.0.0-4639

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.
@@ -0,0 +1,23 @@
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
+ /// <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"}
@@ -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 = (0, tslib_1.__importDefault)(require("path"));
12
+ const fs_extra_1 = (0, 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 = readOutputHT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AC;AAtBD,oCAsBC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,kBAAkB,CACtC,SAAiB,EACjB,MAAc,EACd,aAAkC;IAElC,MAAM,qBAAqB,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACzE,MAAM,wBAAwB,GAAG,cAAI,CAAC,IAAI,CACxC,MAAM,EACN,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CACvC,CAAC;IACF,IAAI,aAAa,EAAE;QACjB,OAAO,kBAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;KAC3C;SAAM,IAAI,aAAa,KAAK,KAAK,EAAE;QAClC,OAAO,kBAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;KAC9C;IACD,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAmB,EACxC,CAAC,qBAAqB,EAAE,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"}
@@ -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"}
@@ -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 = (0, tslib_1.__importDefault)(require("path"));
12
+ const lodash_1 = (0, 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,6DAAwB;AACxB,iEAAuB;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 { normalizeUrl, getEditUrl } from './urlUtils';
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAO3B,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,iBAAiB,EAAE,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ACf,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
package/lib/index.js CHANGED
@@ -6,38 +6,50 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.genChunkName = exports.encodePath = exports.fileToPath = exports.generate = 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.escapePath = exports.aliasedSitePath = exports.toMessageRelativeFilePath = exports.posixPath = exports.shortName = exports.isNameTooLong = exports.createSlugger = exports.replaceMarkdownLinks = exports.parseMarkdownString = exports.parseMarkdownContentTitle = exports.parseFrontMatter = exports.createExcerpt = exports.parseMarkdownHeadingId = exports.groupTaggedItems = exports.normalizeFrontMatterTags = exports.normalizeFrontMatterTag = exports.getEditUrl = exports.normalizeUrl = exports.GitNotFoundError = exports.getFileCommitDate = 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;
10
- exports.updateTranslationFileMessages = exports.mergeTranslations = exports.reportMessage = exports.findAsyncSequential = exports.mapAsyncSequential = exports.readOutputHTMLFile = exports.getPluginI18nPath = exports.getElementsAround = exports.removePrefix = exports.removeSuffix = exports.removeTrailingSlash = exports.addTrailingSlash = exports.addTrailingPathSeparator = exports.addLeadingSlash = exports.resolvePathname = exports.isValidPathname = void 0;
11
- const tslib_1 = require("tslib");
12
- const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
13
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
14
- const crypto_1 = require("crypto");
15
- const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
16
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
17
- const url_1 = require("url");
18
- const resolve_pathname_1 = (0, tslib_1.__importDefault)(require("resolve-pathname"));
19
- const hashUtils_1 = require("./hashUtils");
20
- const constants_1 = require("./constants");
21
- var constants_2 = require("./constants");
22
- Object.defineProperty(exports, "NODE_MAJOR_VERSION", { enumerable: true, get: function () { return constants_2.NODE_MAJOR_VERSION; } });
23
- Object.defineProperty(exports, "NODE_MINOR_VERSION", { enumerable: true, get: function () { return constants_2.NODE_MINOR_VERSION; } });
24
- Object.defineProperty(exports, "DEFAULT_BUILD_DIR_NAME", { enumerable: true, get: function () { return constants_2.DEFAULT_BUILD_DIR_NAME; } });
25
- Object.defineProperty(exports, "DEFAULT_CONFIG_FILE_NAME", { enumerable: true, get: function () { return constants_2.DEFAULT_CONFIG_FILE_NAME; } });
26
- Object.defineProperty(exports, "BABEL_CONFIG_FILE_NAME", { enumerable: true, get: function () { return constants_2.BABEL_CONFIG_FILE_NAME; } });
27
- Object.defineProperty(exports, "GENERATED_FILES_DIR_NAME", { enumerable: true, get: function () { return constants_2.GENERATED_FILES_DIR_NAME; } });
28
- Object.defineProperty(exports, "SRC_DIR_NAME", { enumerable: true, get: function () { return constants_2.SRC_DIR_NAME; } });
29
- Object.defineProperty(exports, "STATIC_DIR_NAME", { enumerable: true, get: function () { return constants_2.STATIC_DIR_NAME; } });
30
- Object.defineProperty(exports, "OUTPUT_STATIC_ASSETS_DIR_NAME", { enumerable: true, get: function () { return constants_2.OUTPUT_STATIC_ASSETS_DIR_NAME; } });
31
- Object.defineProperty(exports, "THEME_PATH", { enumerable: true, get: function () { return constants_2.THEME_PATH; } });
32
- Object.defineProperty(exports, "DEFAULT_PORT", { enumerable: true, get: function () { return constants_2.DEFAULT_PORT; } });
33
- Object.defineProperty(exports, "DEFAULT_PLUGIN_ID", { enumerable: true, get: function () { return constants_2.DEFAULT_PLUGIN_ID; } });
34
- Object.defineProperty(exports, "WEBPACK_URL_LOADER_LIMIT", { enumerable: true, get: function () { return constants_2.WEBPACK_URL_LOADER_LIMIT; } });
9
+ exports.toMessageRelativeFilePath = exports.posixPath = exports.shortName = exports.isNameTooLong = exports.createSlugger = exports.replaceMarkdownLinks = exports.parseMarkdownString = exports.parseMarkdownContentTitle = exports.parseFrontMatter = exports.createExcerpt = exports.parseMarkdownHeadingId = exports.groupTaggedItems = exports.normalizeFrontMatterTags = exports.normalizeFrontMatterTag = 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.getElementsAround = exports.removePrefix = exports.removeSuffix = exports.getPluginI18nPath = exports.updateTranslationFileMessages = exports.mergeTranslations = exports.GitNotFoundError = exports.getFileCommitDate = exports.readOutputHTMLFile = exports.genChunkName = exports.generate = 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;
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 = void 0;
11
+ var constants_1 = require("./constants");
12
+ Object.defineProperty(exports, "NODE_MAJOR_VERSION", { enumerable: true, get: function () { return constants_1.NODE_MAJOR_VERSION; } });
13
+ Object.defineProperty(exports, "NODE_MINOR_VERSION", { enumerable: true, get: function () { return constants_1.NODE_MINOR_VERSION; } });
14
+ Object.defineProperty(exports, "DEFAULT_BUILD_DIR_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_BUILD_DIR_NAME; } });
15
+ Object.defineProperty(exports, "DEFAULT_CONFIG_FILE_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_CONFIG_FILE_NAME; } });
16
+ Object.defineProperty(exports, "BABEL_CONFIG_FILE_NAME", { enumerable: true, get: function () { return constants_1.BABEL_CONFIG_FILE_NAME; } });
17
+ Object.defineProperty(exports, "GENERATED_FILES_DIR_NAME", { enumerable: true, get: function () { return constants_1.GENERATED_FILES_DIR_NAME; } });
18
+ Object.defineProperty(exports, "SRC_DIR_NAME", { enumerable: true, get: function () { return constants_1.SRC_DIR_NAME; } });
19
+ Object.defineProperty(exports, "STATIC_DIR_NAME", { enumerable: true, get: function () { return constants_1.STATIC_DIR_NAME; } });
20
+ Object.defineProperty(exports, "OUTPUT_STATIC_ASSETS_DIR_NAME", { enumerable: true, get: function () { return constants_1.OUTPUT_STATIC_ASSETS_DIR_NAME; } });
21
+ Object.defineProperty(exports, "THEME_PATH", { enumerable: true, get: function () { return constants_1.THEME_PATH; } });
22
+ Object.defineProperty(exports, "DEFAULT_PORT", { enumerable: true, get: function () { return constants_1.DEFAULT_PORT; } });
23
+ Object.defineProperty(exports, "DEFAULT_PLUGIN_ID", { enumerable: true, get: function () { return constants_1.DEFAULT_PLUGIN_ID; } });
24
+ Object.defineProperty(exports, "WEBPACK_URL_LOADER_LIMIT", { enumerable: true, get: function () { return constants_1.WEBPACK_URL_LOADER_LIMIT; } });
25
+ var emitUtils_1 = require("./emitUtils");
26
+ Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return emitUtils_1.generate; } });
27
+ Object.defineProperty(exports, "genChunkName", { enumerable: true, get: function () { return emitUtils_1.genChunkName; } });
28
+ Object.defineProperty(exports, "readOutputHTMLFile", { enumerable: true, get: function () { return emitUtils_1.readOutputHTMLFile; } });
35
29
  var gitUtils_1 = require("./gitUtils");
36
30
  Object.defineProperty(exports, "getFileCommitDate", { enumerable: true, get: function () { return gitUtils_1.getFileCommitDate; } });
37
31
  Object.defineProperty(exports, "GitNotFoundError", { enumerable: true, get: function () { return gitUtils_1.GitNotFoundError; } });
32
+ var i18nUtils_1 = require("./i18nUtils");
33
+ Object.defineProperty(exports, "mergeTranslations", { enumerable: true, get: function () { return i18nUtils_1.mergeTranslations; } });
34
+ Object.defineProperty(exports, "updateTranslationFileMessages", { enumerable: true, get: function () { return i18nUtils_1.updateTranslationFileMessages; } });
35
+ Object.defineProperty(exports, "getPluginI18nPath", { enumerable: true, get: function () { return i18nUtils_1.getPluginI18nPath; } });
36
+ var jsUtils_1 = require("./jsUtils");
37
+ Object.defineProperty(exports, "removeSuffix", { enumerable: true, get: function () { return jsUtils_1.removeSuffix; } });
38
+ Object.defineProperty(exports, "removePrefix", { enumerable: true, get: function () { return jsUtils_1.removePrefix; } });
39
+ Object.defineProperty(exports, "getElementsAround", { enumerable: true, get: function () { return jsUtils_1.getElementsAround; } });
40
+ Object.defineProperty(exports, "mapAsyncSequential", { enumerable: true, get: function () { return jsUtils_1.mapAsyncSequential; } });
41
+ Object.defineProperty(exports, "findAsyncSequential", { enumerable: true, get: function () { return jsUtils_1.findAsyncSequential; } });
42
+ Object.defineProperty(exports, "reportMessage", { enumerable: true, get: function () { return jsUtils_1.reportMessage; } });
38
43
  var urlUtils_1 = require("./urlUtils");
39
44
  Object.defineProperty(exports, "normalizeUrl", { enumerable: true, get: function () { return urlUtils_1.normalizeUrl; } });
40
45
  Object.defineProperty(exports, "getEditUrl", { enumerable: true, get: function () { return urlUtils_1.getEditUrl; } });
46
+ Object.defineProperty(exports, "fileToPath", { enumerable: true, get: function () { return urlUtils_1.fileToPath; } });
47
+ Object.defineProperty(exports, "encodePath", { enumerable: true, get: function () { return urlUtils_1.encodePath; } });
48
+ Object.defineProperty(exports, "isValidPathname", { enumerable: true, get: function () { return urlUtils_1.isValidPathname; } });
49
+ Object.defineProperty(exports, "resolvePathname", { enumerable: true, get: function () { return urlUtils_1.resolvePathname; } });
50
+ Object.defineProperty(exports, "addLeadingSlash", { enumerable: true, get: function () { return urlUtils_1.addLeadingSlash; } });
51
+ Object.defineProperty(exports, "addTrailingSlash", { enumerable: true, get: function () { return urlUtils_1.addTrailingSlash; } });
52
+ Object.defineProperty(exports, "removeTrailingSlash", { enumerable: true, get: function () { return urlUtils_1.removeTrailingSlash; } });
41
53
  var tags_1 = require("./tags");
42
54
  Object.defineProperty(exports, "normalizeFrontMatterTag", { enumerable: true, get: function () { return tags_1.normalizeFrontMatterTag; } });
43
55
  Object.defineProperty(exports, "normalizeFrontMatterTags", { enumerable: true, get: function () { return tags_1.normalizeFrontMatterTags; } });
@@ -59,10 +71,11 @@ Object.defineProperty(exports, "posixPath", { enumerable: true, get: function ()
59
71
  Object.defineProperty(exports, "toMessageRelativeFilePath", { enumerable: true, get: function () { return pathUtils_1.toMessageRelativeFilePath; } });
60
72
  Object.defineProperty(exports, "aliasedSitePath", { enumerable: true, get: function () { return pathUtils_1.aliasedSitePath; } });
61
73
  Object.defineProperty(exports, "escapePath", { enumerable: true, get: function () { return pathUtils_1.escapePath; } });
62
- var hashUtils_2 = require("./hashUtils");
63
- Object.defineProperty(exports, "md5Hash", { enumerable: true, get: function () { return hashUtils_2.md5Hash; } });
64
- Object.defineProperty(exports, "simpleHash", { enumerable: true, get: function () { return hashUtils_2.simpleHash; } });
65
- Object.defineProperty(exports, "docuHash", { enumerable: true, get: function () { return hashUtils_2.docuHash; } });
74
+ Object.defineProperty(exports, "addTrailingPathSeparator", { enumerable: true, get: function () { return pathUtils_1.addTrailingPathSeparator; } });
75
+ var hashUtils_1 = require("./hashUtils");
76
+ Object.defineProperty(exports, "md5Hash", { enumerable: true, get: function () { return hashUtils_1.md5Hash; } });
77
+ Object.defineProperty(exports, "simpleHash", { enumerable: true, get: function () { return hashUtils_1.simpleHash; } });
78
+ Object.defineProperty(exports, "docuHash", { enumerable: true, get: function () { return hashUtils_1.docuHash; } });
66
79
  var globUtils_1 = require("./globUtils");
67
80
  Object.defineProperty(exports, "Globby", { enumerable: true, get: function () { return globUtils_1.Globby; } });
68
81
  Object.defineProperty(exports, "GlobExcludeDefault", { enumerable: true, get: function () { return globUtils_1.GlobExcludeDefault; } });
@@ -76,223 +89,4 @@ Object.defineProperty(exports, "getDataFileData", { enumerable: true, get: funct
76
89
  Object.defineProperty(exports, "getContentPathList", { enumerable: true, get: function () { return dataFileUtils_1.getContentPathList; } });
77
90
  Object.defineProperty(exports, "findFolderContainingFile", { enumerable: true, get: function () { return dataFileUtils_1.findFolderContainingFile; } });
78
91
  Object.defineProperty(exports, "getFolderContainingFile", { enumerable: true, get: function () { return dataFileUtils_1.getFolderContainingFile; } });
79
- const fileHash = new Map();
80
- async function generate(generatedFilesDir, file, content, skipCache = process.env.NODE_ENV === 'production') {
81
- const filepath = path_1.default.join(generatedFilesDir, file);
82
- if (skipCache) {
83
- await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath));
84
- await fs_extra_1.default.writeFile(filepath, content);
85
- return;
86
- }
87
- let lastHash = fileHash.get(filepath);
88
- // If file already exists but its not in runtime cache yet,
89
- // we try to calculate the content hash and then compare
90
- // This is to avoid unnecessary overwriting and we can reuse old file.
91
- if (!lastHash && (await fs_extra_1.default.pathExists(filepath))) {
92
- const lastContent = await fs_extra_1.default.readFile(filepath, 'utf8');
93
- lastHash = (0, crypto_1.createHash)('md5').update(lastContent).digest('hex');
94
- fileHash.set(filepath, lastHash);
95
- }
96
- const currentHash = (0, crypto_1.createHash)('md5').update(content).digest('hex');
97
- if (lastHash !== currentHash) {
98
- await fs_extra_1.default.ensureDir(path_1.default.dirname(filepath));
99
- await fs_extra_1.default.writeFile(filepath, content);
100
- fileHash.set(filepath, currentHash);
101
- }
102
- }
103
- exports.generate = generate;
104
- const indexRE = /(?<dirname>^|.*\/)index\.(?:mdx?|jsx?|tsx?)$/i;
105
- const extRE = /\.(?:mdx?|jsx?|tsx?)$/;
106
- /**
107
- * Convert filepath to url path.
108
- * Example: 'index.md' -> '/', 'foo/bar.js' -> '/foo/bar',
109
- */
110
- function fileToPath(file) {
111
- if (indexRE.test(file)) {
112
- return file.replace(indexRE, '/$1');
113
- }
114
- return `/${file.replace(extRE, '').replace(/\\/g, '/')}`;
115
- }
116
- exports.fileToPath = fileToPath;
117
- function encodePath(userPath) {
118
- return userPath
119
- .split('/')
120
- .map((item) => encodeURIComponent(item))
121
- .join('/');
122
- }
123
- exports.encodePath = encodePath;
124
- const chunkNameCache = new Map();
125
- /**
126
- * Generate unique chunk name given a module path.
127
- */
128
- function genChunkName(modulePath, prefix, preferredName, shortId = process.env.NODE_ENV === 'production') {
129
- let chunkName = chunkNameCache.get(modulePath);
130
- if (!chunkName) {
131
- if (shortId) {
132
- chunkName = (0, hashUtils_1.simpleHash)(modulePath, 8);
133
- }
134
- else {
135
- let str = modulePath;
136
- if (preferredName) {
137
- const shortHash = (0, hashUtils_1.simpleHash)(modulePath, 3);
138
- str = `${preferredName}${shortHash}`;
139
- }
140
- const name = str === '/' ? 'index' : (0, hashUtils_1.docuHash)(str);
141
- chunkName = prefix ? `${prefix}---${name}` : name;
142
- }
143
- chunkNameCache.set(modulePath, chunkName);
144
- }
145
- return chunkName;
146
- }
147
- exports.genChunkName = genChunkName;
148
- function isValidPathname(str) {
149
- if (!str.startsWith('/')) {
150
- return false;
151
- }
152
- try {
153
- // weird, but is there a better way?
154
- const parsedPathname = new url_1.URL(str, 'https://domain.com').pathname;
155
- return parsedPathname === str || parsedPathname === encodeURI(str);
156
- }
157
- catch {
158
- return false;
159
- }
160
- }
161
- exports.isValidPathname = isValidPathname;
162
- // resolve pathname and fail fast if resolution fails
163
- function resolvePathname(to, from) {
164
- return (0, resolve_pathname_1.default)(to, from);
165
- }
166
- exports.resolvePathname = resolvePathname;
167
- function addLeadingSlash(str) {
168
- return str.startsWith('/') ? str : `/${str}`;
169
- }
170
- exports.addLeadingSlash = addLeadingSlash;
171
- function addTrailingPathSeparator(str) {
172
- return str.endsWith(path_1.default.sep)
173
- ? str
174
- : // If this is Windows, we need to change the forward slash to backward
175
- `${str.replace(/\/$/, '')}${path_1.default.sep}`;
176
- }
177
- exports.addTrailingPathSeparator = addTrailingPathSeparator;
178
- // TODO deduplicate: also present in @docusaurus/utils-common
179
- function addTrailingSlash(str) {
180
- return str.endsWith('/') ? str : `${str}/`;
181
- }
182
- exports.addTrailingSlash = addTrailingSlash;
183
- function removeTrailingSlash(str) {
184
- return removeSuffix(str, '/');
185
- }
186
- exports.removeTrailingSlash = removeTrailingSlash;
187
- function removeSuffix(str, suffix) {
188
- if (suffix === '') {
189
- return str; // always returns "" otherwise!
190
- }
191
- return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;
192
- }
193
- exports.removeSuffix = removeSuffix;
194
- function removePrefix(str, prefix) {
195
- return str.startsWith(prefix) ? str.slice(prefix.length) : str;
196
- }
197
- exports.removePrefix = removePrefix;
198
- function getElementsAround(array, aroundIndex) {
199
- const min = 0;
200
- const max = array.length - 1;
201
- if (aroundIndex < min || aroundIndex > max) {
202
- throw new Error(`Valid "aroundIndex" for array (of size ${array.length}) are between ${min} and ${max}, but you provided ${aroundIndex}.`);
203
- }
204
- const previous = aroundIndex === min ? undefined : array[aroundIndex - 1];
205
- const next = aroundIndex === max ? undefined : array[aroundIndex + 1];
206
- return { previous, next };
207
- }
208
- exports.getElementsAround = getElementsAround;
209
- function getPluginI18nPath({ siteDir, locale, pluginName, pluginId = constants_1.DEFAULT_PLUGIN_ID, subPaths = [], }) {
210
- return path_1.default.join(siteDir, 'i18n',
211
- // namespace first by locale: convenient to work in a single folder for a
212
- // translator
213
- locale,
214
- // Make it convenient to use for single-instance
215
- // ie: return "docs", not "docs-default" nor "docs/default"
216
- `${pluginName}${pluginId === constants_1.DEFAULT_PLUGIN_ID ? '' : `-${pluginId}`}`, ...subPaths);
217
- }
218
- exports.getPluginI18nPath = getPluginI18nPath;
219
- /**
220
- * @param permalink The URL that the HTML file corresponds to, without base URL
221
- * @param outDir Full path to the output directory
222
- * @param trailingSlash The site config option. If provided, only one path will
223
- * be read.
224
- * @returns This returns a buffer, which you have to decode string yourself if
225
- * needed. (Not always necessary since the output isn't for human consumption
226
- * anyways, and most HTML manipulation libs accept buffers)
227
- */
228
- async function readOutputHTMLFile(permalink, outDir, trailingSlash) {
229
- const withTrailingSlashPath = path_1.default.join(outDir, permalink, 'index.html');
230
- const withoutTrailingSlashPath = path_1.default.join(outDir, `${permalink.replace(/\/$/, '')}.html`);
231
- if (trailingSlash) {
232
- return fs_extra_1.default.readFile(withTrailingSlashPath);
233
- }
234
- else if (trailingSlash === false) {
235
- return fs_extra_1.default.readFile(withoutTrailingSlashPath);
236
- }
237
- const HTMLPath = await findAsyncSequential([withTrailingSlashPath, withoutTrailingSlashPath], fs_extra_1.default.pathExists);
238
- if (!HTMLPath) {
239
- throw new Error(`Expected output HTML file to be found at ${withTrailingSlashPath}`);
240
- }
241
- return fs_extra_1.default.readFile(HTMLPath);
242
- }
243
- exports.readOutputHTMLFile = readOutputHTMLFile;
244
- async function mapAsyncSequential(array, action) {
245
- const results = [];
246
- for (const t of array) {
247
- const result = await action(t);
248
- results.push(result);
249
- }
250
- return results;
251
- }
252
- exports.mapAsyncSequential = mapAsyncSequential;
253
- async function findAsyncSequential(array, predicate) {
254
- for (const t of array) {
255
- if (await predicate(t)) {
256
- return t;
257
- }
258
- }
259
- return undefined;
260
- }
261
- exports.findAsyncSequential = findAsyncSequential;
262
- function reportMessage(message, reportingSeverity) {
263
- switch (reportingSeverity) {
264
- case 'ignore':
265
- break;
266
- case 'log':
267
- logger_1.default.info(message);
268
- break;
269
- case 'warn':
270
- logger_1.default.warn(message);
271
- break;
272
- case 'error':
273
- logger_1.default.error(message);
274
- break;
275
- case 'throw':
276
- throw new Error(message);
277
- default:
278
- throw new Error(`Unexpected "reportingSeverity" value: ${reportingSeverity}.`);
279
- }
280
- }
281
- exports.reportMessage = reportMessage;
282
- function mergeTranslations(contents) {
283
- return contents.reduce((acc, content) => ({ ...acc, ...content }), {});
284
- }
285
- exports.mergeTranslations = mergeTranslations;
286
- // Useful to update all the messages of a translation file
287
- // Used in tests to simulate translations
288
- function updateTranslationFileMessages(translationFile, updateMessage) {
289
- return {
290
- ...translationFile,
291
- content: lodash_1.default.mapValues(translationFile.content, (translation) => ({
292
- ...translation,
293
- message: updateMessage(translation.message),
294
- })),
295
- };
296
- }
297
- exports.updateTranslationFileMessages = updateTranslationFileMessages;
298
92
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,6EAAwC;AACxC,6DAAwB;AACxB,mCAAkC;AAClC,iEAAuB;AACvB,qEAA0B;AAC1B,6BAAwB;AAOxB,qFAAqD;AAErD,2CAAiD;AACjD,2CAA8C;AAE9C,yCAcqB;AAbnB,+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,4GAAA,eAAe,OAAA;AACf,0HAAA,6BAA6B,OAAA;AAC7B,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,8GAAA,iBAAiB,OAAA;AACjB,qHAAA,wBAAwB,OAAA;AAE1B,uCAA+D;AAAvD,6GAAA,iBAAiB,OAAA;AAAE,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