mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-25 12:38:57 +02:00
misc: convert all internal scripts to ESM (#6286)
* misc: convert all internal scripts to ESM * fixes * fix * fixes * fix! * complete eslint * more move * fix! * This looks better? * Final ones
This commit is contained in:
parent
bcc05e243f
commit
4fad1ce0cd
66 changed files with 412 additions and 374 deletions
|
@ -5,17 +5,20 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const {normalizeUrl} = require('@docusaurus/utils');
|
||||
import utils from '@docusaurus/utils';
|
||||
|
||||
/**
|
||||
* @param {import('@docusaurus/types').LoadContext} context
|
||||
* @returns {import('@docusaurus/types').Plugin}
|
||||
*/
|
||||
function FeatureRequestsPlugin(context) {
|
||||
export default function FeatureRequestsPlugin(context) {
|
||||
return {
|
||||
name: 'feature-requests-plugin',
|
||||
async contentLoaded({actions}) {
|
||||
const basePath = normalizeUrl([context.baseUrl, '/feature-requests']);
|
||||
const basePath = utils.normalizeUrl([
|
||||
context.baseUrl,
|
||||
'/feature-requests',
|
||||
]);
|
||||
await actions.createData('paths.json', JSON.stringify(basePath));
|
||||
actions.addRoute({
|
||||
path: basePath,
|
||||
|
@ -28,5 +31,3 @@ function FeatureRequestsPlugin(context) {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = FeatureRequestsPlugin;
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const visit = require('unist-util-visit');
|
||||
import visit from 'unist-util-visit';
|
||||
|
||||
/**
|
||||
* Turns a "```js config-tabs" code block into a "plugin options" and a "preset options" tab
|
||||
*/
|
||||
const plugin = () => {
|
||||
export default function plugin() {
|
||||
const transformer = (root) => {
|
||||
let tabsImported = false;
|
||||
let codeBlockImported = false;
|
||||
|
@ -165,6 +165,4 @@ const plugin = () => {
|
|||
}
|
||||
};
|
||||
return transformer;
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
||||
}
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const darkTheme = require('prism-react-renderer/themes/vsDark');
|
||||
import darkTheme from 'prism-react-renderer/themes/vsDark/index.cjs.js';
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
plain: {
|
||||
color: '#D4D4D4',
|
||||
backgroundColor: '#1E1E1E',
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const lightTheme = require('prism-react-renderer/themes/github');
|
||||
import lightTheme from 'prism-react-renderer/themes/github/index.cjs.js';
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
...lightTheme,
|
||||
styles: [
|
||||
...lightTheme.styles,
|
Loading…
Add table
Add a link
Reference in a new issue