@docusaurus/plugin-content-docs 0.0.0-5846 → 0.0.0-5847
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/docs.js +1 -20
- package/package.json +9 -9
- package/src/docs.ts +0 -24
- package/src/plugin-content-docs.d.ts +0 -2
package/lib/docs.js
CHANGED
|
@@ -11,7 +11,6 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
13
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
14
|
-
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
15
14
|
const utils_1 = require("@docusaurus/utils");
|
|
16
15
|
const lastUpdate_1 = require("./lastUpdate");
|
|
17
16
|
const slug_1 = tslib_1.__importDefault(require("./slug"));
|
|
@@ -66,7 +65,7 @@ async function readVersionDocs(versionMetadata, options) {
|
|
|
66
65
|
exports.readVersionDocs = readVersionDocs;
|
|
67
66
|
async function doProcessDocMetadata({ docFile, versionMetadata, context, options, env, }) {
|
|
68
67
|
const { source, content, contentPath, filePath } = docFile;
|
|
69
|
-
const { siteDir,
|
|
68
|
+
const { siteDir, siteConfig: { markdown: { parseFrontMatter }, }, } = context;
|
|
70
69
|
const { frontMatter: unsafeFrontMatter, contentTitle, excerpt, } = await (0, utils_1.parseMarkdownFile)({
|
|
71
70
|
filePath,
|
|
72
71
|
fileContent: content,
|
|
@@ -141,21 +140,6 @@ async function doProcessDocMetadata({ docFile, versionMetadata, context, options
|
|
|
141
140
|
}
|
|
142
141
|
const draft = (0, utils_1.isDraft)({ env, frontMatter });
|
|
143
142
|
const unlisted = (0, utils_1.isUnlisted)({ env, frontMatter });
|
|
144
|
-
const formatDate = (locale, date, calendar) => {
|
|
145
|
-
try {
|
|
146
|
-
return new Intl.DateTimeFormat(locale, {
|
|
147
|
-
day: 'numeric',
|
|
148
|
-
month: 'short',
|
|
149
|
-
year: 'numeric',
|
|
150
|
-
timeZone: 'UTC',
|
|
151
|
-
calendar,
|
|
152
|
-
}).format(date);
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
logger_1.default.error `Can't format docs lastUpdatedAt date "${String(date)}"`;
|
|
156
|
-
throw err;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
143
|
// Assign all of object properties during instantiation (if possible) for
|
|
160
144
|
// NodeJS optimization.
|
|
161
145
|
// Adding properties to object after instantiation will cause hidden
|
|
@@ -175,9 +159,6 @@ async function doProcessDocMetadata({ docFile, versionMetadata, context, options
|
|
|
175
159
|
version: versionMetadata.versionName,
|
|
176
160
|
lastUpdatedBy: lastUpdate.lastUpdatedBy,
|
|
177
161
|
lastUpdatedAt: lastUpdate.lastUpdatedAt,
|
|
178
|
-
formattedLastUpdatedAt: lastUpdate.lastUpdatedAt
|
|
179
|
-
? formatDate(i18n.currentLocale, new Date(lastUpdate.lastUpdatedAt * 1000), i18n.localeConfigs[i18n.currentLocale].calendar)
|
|
180
|
-
: undefined,
|
|
181
162
|
sidebarPosition,
|
|
182
163
|
frontMatter,
|
|
183
164
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5847",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "0.0.0-
|
|
39
|
-
"@docusaurus/logger": "0.0.0-
|
|
40
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
41
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
42
|
-
"@docusaurus/types": "0.0.0-
|
|
43
|
-
"@docusaurus/utils": "0.0.0-
|
|
44
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
38
|
+
"@docusaurus/core": "0.0.0-5847",
|
|
39
|
+
"@docusaurus/logger": "0.0.0-5847",
|
|
40
|
+
"@docusaurus/mdx-loader": "0.0.0-5847",
|
|
41
|
+
"@docusaurus/module-type-aliases": "0.0.0-5847",
|
|
42
|
+
"@docusaurus/types": "0.0.0-5847",
|
|
43
|
+
"@docusaurus/utils": "0.0.0-5847",
|
|
44
|
+
"@docusaurus/utils-validation": "0.0.0-5847",
|
|
45
45
|
"@types/react-router-config": "^5.0.7",
|
|
46
46
|
"combine-promises": "^1.1.0",
|
|
47
47
|
"fs-extra": "^11.1.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=18.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "a819e55b3b147c8ca2c1483813cc9c0ce2b75500"
|
|
69
69
|
}
|
package/src/docs.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import fs from 'fs-extra';
|
|
10
10
|
import _ from 'lodash';
|
|
11
|
-
import logger from '@docusaurus/logger';
|
|
12
11
|
import {
|
|
13
12
|
aliasedSitePath,
|
|
14
13
|
getEditUrl,
|
|
@@ -142,7 +141,6 @@ async function doProcessDocMetadata({
|
|
|
142
141
|
const {source, content, contentPath, filePath} = docFile;
|
|
143
142
|
const {
|
|
144
143
|
siteDir,
|
|
145
|
-
i18n,
|
|
146
144
|
siteConfig: {
|
|
147
145
|
markdown: {parseFrontMatter},
|
|
148
146
|
},
|
|
@@ -257,21 +255,6 @@ async function doProcessDocMetadata({
|
|
|
257
255
|
const draft = isDraft({env, frontMatter});
|
|
258
256
|
const unlisted = isUnlisted({env, frontMatter});
|
|
259
257
|
|
|
260
|
-
const formatDate = (locale: string, date: Date, calendar: string): string => {
|
|
261
|
-
try {
|
|
262
|
-
return new Intl.DateTimeFormat(locale, {
|
|
263
|
-
day: 'numeric',
|
|
264
|
-
month: 'short',
|
|
265
|
-
year: 'numeric',
|
|
266
|
-
timeZone: 'UTC',
|
|
267
|
-
calendar,
|
|
268
|
-
}).format(date);
|
|
269
|
-
} catch (err) {
|
|
270
|
-
logger.error`Can't format docs lastUpdatedAt date "${String(date)}"`;
|
|
271
|
-
throw err;
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
|
|
275
258
|
// Assign all of object properties during instantiation (if possible) for
|
|
276
259
|
// NodeJS optimization.
|
|
277
260
|
// Adding properties to object after instantiation will cause hidden
|
|
@@ -291,13 +274,6 @@ async function doProcessDocMetadata({
|
|
|
291
274
|
version: versionMetadata.versionName,
|
|
292
275
|
lastUpdatedBy: lastUpdate.lastUpdatedBy,
|
|
293
276
|
lastUpdatedAt: lastUpdate.lastUpdatedAt,
|
|
294
|
-
formattedLastUpdatedAt: lastUpdate.lastUpdatedAt
|
|
295
|
-
? formatDate(
|
|
296
|
-
i18n.currentLocale,
|
|
297
|
-
new Date(lastUpdate.lastUpdatedAt * 1000),
|
|
298
|
-
i18n.localeConfigs[i18n.currentLocale]!.calendar,
|
|
299
|
-
)
|
|
300
|
-
: undefined,
|
|
301
277
|
sidebarPosition,
|
|
302
278
|
frontMatter,
|
|
303
279
|
};
|
|
@@ -407,8 +407,6 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
407
407
|
export type LastUpdateData = {
|
|
408
408
|
/** A timestamp in **seconds**, directly acquired from `git log`. */
|
|
409
409
|
lastUpdatedAt?: number;
|
|
410
|
-
/** `lastUpdatedAt` formatted as a date according to the current locale. */
|
|
411
|
-
formattedLastUpdatedAt?: string;
|
|
412
410
|
/** The author's name directly acquired from `git log`. */
|
|
413
411
|
lastUpdatedBy?: string;
|
|
414
412
|
};
|