feat(core): support TypeScript + ESM configuration (#9317)

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Chongyi Zheng 2023-10-13 20:46:03 -04:00 committed by GitHub
parent 336a44f3ea
commit 45f1a669b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 2054 additions and 914 deletions

View file

@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
const path = require('path');
const fs = require('fs-extra');
const pluginContentBlog = require('@docusaurus/plugin-content-blog');
const {aliasedSitePath, docuHash, normalizeUrl} = require('@docusaurus/utils');
import path from 'path';
import fs from 'fs-extra';
import pluginContentBlog from '@docusaurus/plugin-content-blog';
import {aliasedSitePath, docuHash, normalizeUrl} from '@docusaurus/utils';
/**
* Multiple versions may be published on the same day, causing the order to be
@ -90,7 +90,7 @@ ${content.replace(/####/g, '##')}`,
* @param {import('@docusaurus/types').LoadContext} context
* @returns {import('@docusaurus/types').Plugin}
*/
async function ChangelogPlugin(context, options) {
export default async function ChangelogPlugin(context, options) {
const generateDir = path.join(context.siteDir, 'changelog/source');
const blogPlugin = await pluginContentBlog.default(context, {
...options,
@ -157,6 +157,4 @@ async function ChangelogPlugin(context, options) {
};
}
ChangelogPlugin.validateOptions = pluginContentBlog.validateOptions;
module.exports = ChangelogPlugin;
export const {validateOptions} = pluginContentBlog;

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import utils from '@docusaurus/utils';
import {normalizeUrl} from '@docusaurus/utils';
/**
* @param {import('@docusaurus/types').LoadContext} context
@ -15,10 +15,7 @@ export default function FeatureRequestsPlugin(context) {
return {
name: 'feature-requests-plugin',
async contentLoaded({actions}) {
const basePath = utils.normalizeUrl([
context.baseUrl,
'/feature-requests',
]);
const basePath = normalizeUrl([context.baseUrl, '/feature-requests']);
const paths = await actions.createData(
'paths.json',
JSON.stringify(basePath),