@docusaurus/core 2.0.0-beta.16 → 2.0.0-beta.19
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/bin/beforeCli.mjs +14 -12
- package/bin/docusaurus.mjs +41 -93
- package/lib/babel/preset.js +2 -2
- package/lib/client/.eslintrc.js +2 -3
- package/lib/client/App.d.ts +1 -1
- package/lib/client/App.js +15 -7
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → BaseUrlIssueBanner/index.d.ts} +10 -5
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +14 -9
- package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
- package/lib/client/ClientLifecyclesDispatcher.d.ts +16 -0
- package/lib/client/ClientLifecyclesDispatcher.js +34 -0
- package/lib/client/LinksCollector.d.ts +1 -1
- package/lib/client/LinksCollector.js +4 -5
- package/lib/client/PendingNavigation.d.ts +8 -17
- package/lib/client/PendingNavigation.js +39 -70
- package/lib/{server/loadSetup.d.ts → client/SiteMetadataDefaults.d.ts} +2 -2
- package/lib/client/SiteMetadataDefaults.js +19 -0
- package/lib/client/{exports/browserContext.d.ts → browserContext.d.ts} +0 -0
- package/lib/client/{exports/browserContext.js → browserContext.js} +0 -0
- package/lib/client/clientEntry.js +3 -4
- package/lib/client/docusaurus.d.ts +5 -5
- package/lib/client/docusaurus.js +26 -33
- package/lib/client/{exports/docusaurusContext.d.ts → docusaurusContext.d.ts} +0 -0
- package/lib/client/{exports/docusaurusContext.js → docusaurusContext.js} +0 -0
- package/lib/client/exports/BrowserOnly.d.ts +3 -4
- package/lib/client/exports/BrowserOnly.js +2 -2
- package/lib/client/exports/ComponentCreator.js +65 -40
- package/lib/client/exports/ErrorBoundary.d.ts +2 -2
- package/lib/client/exports/ErrorBoundary.js +4 -5
- package/lib/client/exports/Interpolate.d.ts +1 -1
- package/lib/client/exports/Interpolate.js +18 -41
- package/lib/client/exports/Link.d.ts +3 -15
- package/lib/client/exports/Link.js +24 -30
- package/lib/client/exports/Translate.d.ts +2 -2
- package/lib/client/exports/Translate.js +3 -3
- package/lib/client/exports/useBaseUrl.js +8 -9
- package/lib/client/exports/useDocusaurusContext.js +1 -1
- package/lib/client/exports/useGlobalData.d.ts +4 -3
- package/lib/client/exports/useGlobalData.js +5 -5
- package/lib/client/exports/useIsBrowser.js +1 -1
- package/lib/{server/client-modules/index.d.ts → client/exports/useRouteContext.d.ts} +2 -2
- package/lib/client/exports/useRouteContext.js +15 -0
- package/lib/client/flat.d.ts +12 -2
- package/lib/client/flat.js +12 -5
- package/lib/client/normalizeLocation.js +13 -8
- package/lib/client/prefetch.js +10 -28
- package/lib/client/preload.d.ts +1 -3
- package/lib/client/preload.js +5 -11
- package/lib/client/routeContext.d.ts +13 -0
- package/lib/client/routeContext.js +31 -0
- package/lib/client/serverEntry.js +19 -18
- package/lib/client/theme-fallback/Error/index.js +7 -1
- package/lib/client/theme-fallback/Layout/index.d.ts +1 -1
- package/lib/client/theme-fallback/Layout/index.js +2 -17
- package/lib/client/theme-fallback/Loading/index.js +2 -0
- package/lib/client/theme-fallback/NotFound/index.js +13 -5
- package/lib/client/theme-fallback/Root/index.d.ts +4 -4
- package/lib/client/theme-fallback/Root/index.js +2 -1
- package/lib/{server/html-tags/htmlTags.d.ts → client/theme-fallback/SiteMetadata/index.d.ts} +2 -1
- package/lib/client/theme-fallback/SiteMetadata/index.js +10 -0
- package/lib/commands/build.d.ts +6 -2
- package/lib/commands/build.js +48 -30
- package/lib/commands/clear.d.ts +1 -1
- package/lib/commands/clear.js +6 -5
- package/lib/commands/deploy.d.ts +5 -5
- package/lib/commands/deploy.js +21 -45
- package/lib/commands/external.d.ts +1 -1
- package/lib/commands/external.js +6 -11
- package/lib/commands/serve.d.ts +7 -2
- package/lib/commands/serve.js +18 -19
- package/lib/commands/start.d.ts +8 -2
- package/lib/commands/start.js +33 -30
- package/lib/commands/swizzle/actions.d.ts +2 -2
- package/lib/commands/swizzle/actions.js +10 -10
- package/lib/commands/swizzle/common.d.ts +3 -3
- package/lib/commands/swizzle/common.js +8 -9
- package/lib/commands/swizzle/components.js +48 -13
- package/lib/commands/swizzle/config.js +21 -15
- package/lib/commands/swizzle/context.js +6 -12
- package/lib/commands/swizzle/index.d.ts +2 -2
- package/lib/commands/swizzle/index.js +5 -4
- package/lib/commands/swizzle/prompts.js +2 -2
- package/lib/commands/swizzle/tables.js +10 -13
- package/lib/commands/swizzle/themes.js +9 -8
- package/lib/commands/writeHeadingIds.d.ts +2 -9
- package/lib/commands/writeHeadingIds.js +11 -69
- package/lib/commands/writeTranslations.d.ts +3 -4
- package/lib/commands/writeTranslations.js +10 -14
- package/lib/index.d.ts +9 -10
- package/lib/index.js +18 -19
- package/lib/server/brokenLinks.d.ts +3 -16
- package/lib/server/brokenLinks.js +37 -31
- package/lib/server/clientModules.d.ts +12 -0
- package/lib/server/clientModules.js +20 -0
- package/lib/server/config.d.ts +5 -2
- package/lib/server/config.js +14 -9
- package/lib/server/configValidation.d.ts +1 -1
- package/lib/server/configValidation.js +39 -13
- package/lib/server/getHostPort.d.ts +14 -0
- package/lib/{choosePort.js → server/getHostPort.js} +24 -41
- package/lib/server/htmlTags.d.ts +12 -0
- package/lib/server/htmlTags.js +62 -0
- package/lib/server/i18n.d.ts +2 -11
- package/lib/server/i18n.js +7 -28
- package/lib/server/index.d.ts +28 -13
- package/lib/server/index.js +62 -229
- package/lib/server/plugins/configs.d.ts +51 -0
- package/lib/server/plugins/configs.js +101 -0
- package/lib/server/plugins/index.d.ts +9 -8
- package/lib/server/plugins/index.js +65 -132
- package/lib/server/plugins/init.d.ts +6 -15
- package/lib/server/plugins/init.js +25 -83
- package/lib/server/{moduleShorthand.d.ts → plugins/moduleShorthand.d.ts} +0 -0
- package/lib/server/{moduleShorthand.js → plugins/moduleShorthand.js} +0 -0
- package/lib/server/plugins/pluginIds.d.ts +4 -0
- package/lib/server/plugins/pluginIds.js +6 -4
- package/lib/server/plugins/presets.d.ts +12 -0
- package/lib/server/{presets/index.js → plugins/presets.js} +21 -20
- package/lib/server/plugins/{applyRouteTrailingSlash.d.ts → routeConfig.d.ts} +3 -1
- package/lib/server/plugins/routeConfig.js +54 -0
- package/lib/server/plugins/synthetic.d.ts +20 -0
- package/lib/server/plugins/synthetic.js +112 -0
- package/lib/server/routes.d.ts +39 -7
- package/lib/server/routes.js +169 -102
- package/lib/server/siteMetadata.d.ts +12 -0
- package/lib/server/siteMetadata.js +81 -0
- package/lib/server/translations/translations.d.ts +5 -14
- package/lib/server/translations/translations.js +23 -39
- package/lib/server/translations/translationsExtractor.d.ts +2 -2
- package/lib/server/translations/translationsExtractor.js +16 -19
- package/lib/server/utils.js +1 -1
- package/lib/webpack/aliases/index.d.ts +34 -0
- package/lib/webpack/aliases/index.js +106 -0
- package/lib/webpack/base.d.ts +0 -1
- package/lib/webpack/base.js +12 -30
- package/lib/webpack/client.js +7 -8
- package/lib/webpack/plugins/ChunkAssetPlugin.js +7 -7
- package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +2 -2
- package/lib/webpack/plugins/CleanWebpackPlugin.js +2 -2
- package/lib/webpack/plugins/LogPlugin.js +2 -2
- package/lib/webpack/plugins/WaitPlugin.d.ts +2 -2
- package/lib/webpack/plugins/WaitPlugin.js +3 -3
- package/lib/webpack/server.d.ts +2 -2
- package/lib/webpack/server.js +10 -8
- package/lib/webpack/utils.d.ts +9 -3
- package/lib/webpack/utils.js +20 -25
- package/package.json +38 -41
- package/lib/choosePort.d.ts +0 -11
- package/lib/client/client-lifecycles-dispatcher.d.ts +0 -9
- package/lib/client/client-lifecycles-dispatcher.js +0 -23
- package/lib/client/nprogress.css +0 -36
- package/lib/commands/commandUtils.d.ts +0 -9
- package/lib/commands/commandUtils.js +0 -21
- package/lib/server/client-modules/index.js +0 -12
- package/lib/server/duplicateRoutes.d.ts +0 -10
- package/lib/server/duplicateRoutes.js +0 -42
- package/lib/server/html-tags/htmlTags.js +0 -38
- package/lib/server/html-tags/index.d.ts +0 -9
- package/lib/server/html-tags/index.js +0 -43
- package/lib/server/loadSetup.js +0 -25
- package/lib/server/plugins/applyRouteTrailingSlash.js +0 -19
- package/lib/server/presets/index.d.ts +0 -11
- package/lib/server/themes/alias.d.ts +0 -9
- package/lib/server/themes/alias.js +0 -48
- package/lib/server/themes/index.d.ts +0 -12
- package/lib/server/themes/index.js +0 -47
- package/lib/server/versions/__fixtures__/dummy-plugin.d.ts +0 -0
- package/lib/server/versions/__fixtures__/dummy-plugin.js +0 -0
- package/lib/server/versions/__fixtures__/package.json +0 -3
- package/lib/server/versions/index.d.ts +0 -9
- package/lib/server/versions/index.js +0 -51
package/lib/commands/start.js
CHANGED
|
@@ -6,71 +6,71 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.start = void 0;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const chokidar_1 =
|
|
13
|
-
const html_webpack_plugin_1 =
|
|
14
|
-
const path_1 =
|
|
15
|
-
const lodash_1 =
|
|
16
|
-
const openBrowser_1 =
|
|
12
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
13
|
+
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
14
|
+
const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
|
|
15
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
16
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
17
|
+
const openBrowser_1 = tslib_1.__importDefault(require("react-dev-utils/openBrowser"));
|
|
17
18
|
const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
|
|
18
|
-
const evalSourceMapMiddleware_1 =
|
|
19
|
-
const webpack_1 =
|
|
20
|
-
const webpack_dev_server_1 =
|
|
21
|
-
const webpack_merge_1 =
|
|
19
|
+
const evalSourceMapMiddleware_1 = tslib_1.__importDefault(require("react-dev-utils/evalSourceMapMiddleware"));
|
|
20
|
+
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
21
|
+
const webpack_dev_server_1 = tslib_1.__importDefault(require("webpack-dev-server"));
|
|
22
|
+
const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
22
23
|
const server_1 = require("../server");
|
|
23
|
-
const client_1 =
|
|
24
|
+
const client_1 = tslib_1.__importDefault(require("../webpack/client"));
|
|
24
25
|
const utils_2 = require("../webpack/utils");
|
|
25
|
-
const
|
|
26
|
+
const getHostPort_1 = require("../server/getHostPort");
|
|
26
27
|
const translations_1 = require("../server/translations/translations");
|
|
27
28
|
async function start(siteDir, cliOptions) {
|
|
28
29
|
process.env.NODE_ENV = 'development';
|
|
29
30
|
process.env.BABEL_ENV = 'development';
|
|
30
31
|
logger_1.default.info('Starting the development server...');
|
|
31
32
|
function loadSite() {
|
|
32
|
-
return (0, server_1.load)(
|
|
33
|
-
|
|
33
|
+
return (0, server_1.load)({
|
|
34
|
+
siteDir,
|
|
35
|
+
config: cliOptions.config,
|
|
34
36
|
locale: cliOptions.locale,
|
|
35
|
-
localizePath: undefined, //
|
|
37
|
+
localizePath: undefined, // Should this be configurable?
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
// Process all related files as a prop.
|
|
39
41
|
const props = await loadSite();
|
|
40
42
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
41
|
-
const host = (0,
|
|
42
|
-
const port = await (0, commandUtils_1.getCLIOptionPort)(cliOptions.port, host);
|
|
43
|
+
const { host, port } = await (0, getHostPort_1.getHostPort)(cliOptions);
|
|
43
44
|
if (port === null) {
|
|
44
45
|
process.exit();
|
|
45
46
|
}
|
|
46
47
|
const { baseUrl, headTags, preBodyTags, postBodyTags } = props;
|
|
47
48
|
const urls = (0, WebpackDevServerUtils_1.prepareUrls)(protocol, host, port);
|
|
48
49
|
const openUrl = (0, utils_1.normalizeUrl)([urls.localUrlForBrowser, baseUrl]);
|
|
49
|
-
logger_1.default.success `Docusaurus website is running at
|
|
50
|
+
logger_1.default.success `Docusaurus website is running at url=${openUrl}.`;
|
|
50
51
|
// Reload files processing.
|
|
51
52
|
const reload = lodash_1.default.debounce(() => {
|
|
52
53
|
loadSite()
|
|
53
54
|
.then(({ baseUrl: newBaseUrl }) => {
|
|
54
55
|
const newOpenUrl = (0, utils_1.normalizeUrl)([urls.localUrlForBrowser, newBaseUrl]);
|
|
55
56
|
if (newOpenUrl !== openUrl) {
|
|
56
|
-
logger_1.default.success `Docusaurus website is running at
|
|
57
|
+
logger_1.default.success `Docusaurus website is running at url=${newOpenUrl}.`;
|
|
57
58
|
}
|
|
58
59
|
})
|
|
59
60
|
.catch((err) => {
|
|
60
61
|
logger_1.default.error(err.stack);
|
|
61
62
|
});
|
|
62
63
|
}, 500);
|
|
63
|
-
const { siteConfig, plugins
|
|
64
|
+
const { siteConfig, plugins } = props;
|
|
64
65
|
const normalizeToSiteDir = (filepath) => {
|
|
65
66
|
if (filepath && path_1.default.isAbsolute(filepath)) {
|
|
66
67
|
return (0, utils_1.posixPath)(path_1.default.relative(siteDir, filepath));
|
|
67
68
|
}
|
|
68
69
|
return (0, utils_1.posixPath)(filepath);
|
|
69
70
|
};
|
|
70
|
-
const pluginPaths =
|
|
71
|
-
.
|
|
72
|
-
.
|
|
73
|
-
.filter(Boolean))
|
|
71
|
+
const pluginPaths = plugins
|
|
72
|
+
.flatMap((plugin) => plugin.getPathsToWatch?.() ?? [])
|
|
73
|
+
.filter(Boolean)
|
|
74
74
|
.map(normalizeToSiteDir);
|
|
75
75
|
const pathsToWatch = [
|
|
76
76
|
...pluginPaths,
|
|
@@ -94,6 +94,10 @@ async function start(siteDir, cliOptions) {
|
|
|
94
94
|
});
|
|
95
95
|
['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) => fsWatcher.on(event, reload));
|
|
96
96
|
let config = (0, webpack_merge_1.default)(await (0, client_1.default)(props), {
|
|
97
|
+
watchOptions: {
|
|
98
|
+
ignored: /node_modules\/(?!@docusaurus)/,
|
|
99
|
+
poll: cliOptions.poll,
|
|
100
|
+
},
|
|
97
101
|
infrastructureLogging: {
|
|
98
102
|
// Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105
|
|
99
103
|
level: 'warn',
|
|
@@ -101,7 +105,7 @@ async function start(siteDir, cliOptions) {
|
|
|
101
105
|
plugins: [
|
|
102
106
|
// Generates an `index.html` file with the <script> injected.
|
|
103
107
|
new html_webpack_plugin_1.default({
|
|
104
|
-
template: path_1.default.
|
|
108
|
+
template: path_1.default.join(__dirname, '../webpack/templates/index.html.template.ejs'),
|
|
105
109
|
// So we can define the position where the scripts are injected.
|
|
106
110
|
inject: false,
|
|
107
111
|
filename: 'index.html',
|
|
@@ -114,14 +118,13 @@ async function start(siteDir, cliOptions) {
|
|
|
114
118
|
});
|
|
115
119
|
// Plugin Lifecycle - configureWebpack and configurePostCss.
|
|
116
120
|
plugins.forEach((plugin) => {
|
|
117
|
-
var _a;
|
|
118
121
|
const { configureWebpack, configurePostCss } = plugin;
|
|
119
122
|
if (configurePostCss) {
|
|
120
|
-
config = (0, utils_2.applyConfigurePostCss)(configurePostCss, config);
|
|
123
|
+
config = (0, utils_2.applyConfigurePostCss)(configurePostCss.bind(plugin), config);
|
|
121
124
|
}
|
|
122
125
|
if (configureWebpack) {
|
|
123
|
-
config = (0, utils_2.applyConfigureWebpack)(configureWebpack.bind(plugin), // The plugin lifecycle may reference `this`.
|
|
124
|
-
config, false,
|
|
126
|
+
config = (0, utils_2.applyConfigureWebpack)(configureWebpack.bind(plugin), // The plugin lifecycle may reference `this`.
|
|
127
|
+
config, false, props.siteConfig.webpack?.jsLoader, plugin.content);
|
|
125
128
|
}
|
|
126
129
|
});
|
|
127
130
|
const compiler = (0, webpack_1.default)(config);
|
|
@@ -200,4 +203,4 @@ async function start(siteDir, cliOptions) {
|
|
|
200
203
|
});
|
|
201
204
|
});
|
|
202
205
|
}
|
|
203
|
-
exports.
|
|
206
|
+
exports.start = start;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { SwizzleAction, SwizzleComponentConfig } from '@docusaurus/types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { SwizzleCLIOptions } from './common';
|
|
9
9
|
export declare const SwizzleActions: SwizzleAction[];
|
|
10
|
-
export declare function getAction(componentConfig: SwizzleComponentConfig, options: Pick<
|
|
10
|
+
export declare function getAction(componentConfig: SwizzleComponentConfig, options: Pick<SwizzleCLIOptions, 'wrap' | 'eject'>): Promise<SwizzleAction>;
|
|
11
11
|
export declare type ActionParams = {
|
|
12
12
|
siteDir: string;
|
|
13
13
|
themePath: string;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.wrap = exports.eject = exports.getAction = exports.SwizzleActions = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const fs_extra_1 =
|
|
13
|
-
const path_1 =
|
|
14
|
-
const lodash_1 =
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
15
15
|
const utils_1 = require("@docusaurus/utils");
|
|
16
16
|
const prompts_1 = require("./prompts");
|
|
17
17
|
exports.SwizzleActions = ['wrap', 'eject'];
|
|
@@ -32,7 +32,7 @@ async function eject({ siteDir, themePath, componentName, }) {
|
|
|
32
32
|
const fromPath = path_1.default.join(themePath, componentName);
|
|
33
33
|
const isDirectory = await isDir(fromPath);
|
|
34
34
|
const globPattern = isDirectory
|
|
35
|
-
? //
|
|
35
|
+
? // Do we really want to copy all components?
|
|
36
36
|
path_1.default.join(fromPath, '*')
|
|
37
37
|
: `${fromPath}.*`;
|
|
38
38
|
const globPatternPosix = (0, utils_1.posixPath)(globPattern);
|
|
@@ -51,10 +51,11 @@ async function eject({ siteDir, themePath, componentName, }) {
|
|
|
51
51
|
const fileName = path_1.default.basename(sourceFile);
|
|
52
52
|
const targetFile = path_1.default.join(toPath, fileName);
|
|
53
53
|
try {
|
|
54
|
-
await fs_extra_1.default.
|
|
54
|
+
const fileContents = await fs_extra_1.default.readFile(sourceFile, 'utf-8');
|
|
55
|
+
await fs_extra_1.default.outputFile(targetFile, fileContents.trimStart().replace(/^\/\*.+?\*\/\s*/ms, ''));
|
|
55
56
|
}
|
|
56
57
|
catch (err) {
|
|
57
|
-
throw new Error(logger_1.default.interpolate `Could not copy file from
|
|
58
|
+
throw new Error(logger_1.default.interpolate `Could not copy file from path=${sourceFile} to path=${targetFile}`);
|
|
58
59
|
}
|
|
59
60
|
return targetFile;
|
|
60
61
|
}));
|
|
@@ -74,7 +75,7 @@ async function wrap({ siteDir, themePath, componentName: themeComponentName, typ
|
|
|
74
75
|
import type ${componentName}Type from '@theme/${themeComponentName}';
|
|
75
76
|
import ${componentName} from '@theme-${importType}/${themeComponentName}';
|
|
76
77
|
|
|
77
|
-
type Props = ComponentProps<typeof ${componentName}Type
|
|
78
|
+
type Props = ComponentProps<typeof ${componentName}Type>;
|
|
78
79
|
|
|
79
80
|
export default function ${wrapperComponentName}(props: Props): JSX.Element {
|
|
80
81
|
return (
|
|
@@ -95,8 +96,7 @@ export default function ${wrapperComponentName}(props) {
|
|
|
95
96
|
);
|
|
96
97
|
}
|
|
97
98
|
`;
|
|
98
|
-
await fs_extra_1.default.
|
|
99
|
-
await fs_extra_1.default.writeFile(toPath, content);
|
|
99
|
+
await fs_extra_1.default.outputFile(toPath, content);
|
|
100
100
|
return { createdFiles: [toPath] };
|
|
101
101
|
}
|
|
102
102
|
exports.wrap = wrap;
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
+
import type { NormalizedPluginConfig } from '../../server/plugins/configs';
|
|
7
8
|
import type { InitializedPlugin, SwizzleAction, SwizzleActionStatus } from '@docusaurus/types';
|
|
8
|
-
import type { NormalizedPluginConfig } from '../../server/plugins/init';
|
|
9
9
|
export declare const SwizzleActions: SwizzleAction[];
|
|
10
10
|
export declare const SwizzleActionsStatuses: SwizzleActionStatus[];
|
|
11
11
|
export declare const PartiallySafeHint: string;
|
|
@@ -21,13 +21,13 @@ export declare type SwizzlePlugin = {
|
|
|
21
21
|
export declare type SwizzleContext = {
|
|
22
22
|
plugins: SwizzlePlugin[];
|
|
23
23
|
};
|
|
24
|
-
export declare type
|
|
24
|
+
export declare type SwizzleCLIOptions = {
|
|
25
25
|
typescript: boolean;
|
|
26
26
|
danger: boolean;
|
|
27
27
|
list: boolean;
|
|
28
28
|
wrap: boolean;
|
|
29
29
|
eject: boolean;
|
|
30
30
|
};
|
|
31
|
-
export declare function normalizeOptions(options: Partial<
|
|
31
|
+
export declare function normalizeOptions(options: Partial<SwizzleCLIOptions>): SwizzleCLIOptions;
|
|
32
32
|
export declare function findStringIgnoringCase(str: string, values: string[]): string | undefined;
|
|
33
33
|
export declare function findClosestValue(str: string, values: string[], maxLevenshtein?: number): string | undefined;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.findClosestValue = exports.findStringIgnoringCase = exports.normalizeOptions = exports.actionStatusSuffix = exports.actionStatusColor = exports.actionStatusLabel = exports.PartiallySafeHint = exports.SwizzleActionsStatuses = exports.SwizzleActions = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const leven_1 =
|
|
12
|
-
const lodash_1 =
|
|
13
|
-
const logger_1 =
|
|
11
|
+
const leven_1 = tslib_1.__importDefault(require("leven"));
|
|
12
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
14
14
|
exports.SwizzleActions = ['wrap', 'eject'];
|
|
15
15
|
exports.SwizzleActionsStatuses = [
|
|
16
16
|
'safe',
|
|
@@ -37,13 +37,12 @@ function actionStatusSuffix(status, options = {}) {
|
|
|
37
37
|
}
|
|
38
38
|
exports.actionStatusSuffix = actionStatusSuffix;
|
|
39
39
|
function normalizeOptions(options) {
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
41
40
|
return {
|
|
42
|
-
typescript:
|
|
43
|
-
danger:
|
|
44
|
-
list:
|
|
45
|
-
wrap:
|
|
46
|
-
eject:
|
|
41
|
+
typescript: options.typescript ?? false,
|
|
42
|
+
danger: options.danger ?? false,
|
|
43
|
+
list: options.list ?? false,
|
|
44
|
+
wrap: options.wrap ?? false,
|
|
45
|
+
eject: options.eject ?? false,
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -8,16 +8,35 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getComponentName = exports.getThemeComponents = exports.listComponentNames = exports.readComponentNames = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const fs_extra_1 =
|
|
13
|
-
const path_1 =
|
|
14
|
-
const lodash_1 =
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
15
15
|
const utils_1 = require("@docusaurus/utils");
|
|
16
16
|
const prompts_1 = require("./prompts");
|
|
17
17
|
const common_1 = require("./common");
|
|
18
18
|
const tables_1 = require("./tables");
|
|
19
19
|
const actions_1 = require("./actions");
|
|
20
20
|
const formatComponentName = (componentName) => componentName.replace(/[/\\]index\.[jt]sx?/, '').replace(/\.[jt]sx?/, '');
|
|
21
|
+
function sortComponentNames(componentNames) {
|
|
22
|
+
return componentNames.sort(); // Algo may change?
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Expand a list of components to include and return parent folders.
|
|
26
|
+
* If a folder is not directly a component (no Folder/index.tsx file),
|
|
27
|
+
* we still want to be able to swizzle --eject that folder.
|
|
28
|
+
* See https://github.com/facebook/docusaurus/pull/7175#issuecomment-1103757218
|
|
29
|
+
*
|
|
30
|
+
* @param componentNames the original list of component names
|
|
31
|
+
*/
|
|
32
|
+
function getMissingIntermediateComponentFolderNames(componentNames) {
|
|
33
|
+
function getAllIntermediatePaths(componentName) {
|
|
34
|
+
const paths = componentName.split('/');
|
|
35
|
+
return lodash_1.default.range(1, paths.length + 1).map((i) => paths.slice(0, i).join('/'));
|
|
36
|
+
}
|
|
37
|
+
const expandedComponentNames = lodash_1.default.uniq(componentNames.flatMap((componentName) => getAllIntermediatePaths(componentName)));
|
|
38
|
+
return lodash_1.default.difference(expandedComponentNames, componentNames);
|
|
39
|
+
}
|
|
21
40
|
const skipReadDirNames = ['__test__', '__tests__', '__mocks__', '__fixtures__'];
|
|
22
41
|
async function readComponentNames(themePath) {
|
|
23
42
|
if (!(await fs_extra_1.default.pathExists(themePath))) {
|
|
@@ -48,8 +67,8 @@ async function readComponentNames(themePath) {
|
|
|
48
67
|
}))).flat();
|
|
49
68
|
}
|
|
50
69
|
const componentFiles = await walk(themePath);
|
|
51
|
-
const
|
|
52
|
-
return
|
|
70
|
+
const componentNames = componentFiles.map((f) => f.componentName);
|
|
71
|
+
return sortComponentNames(componentNames);
|
|
53
72
|
}
|
|
54
73
|
exports.readComponentNames = readComponentNames;
|
|
55
74
|
function listComponentNames(themeComponents) {
|
|
@@ -72,21 +91,37 @@ async function getThemeComponents({ themeName, themePath, swizzleConfig, }) {
|
|
|
72
91
|
},
|
|
73
92
|
description: FallbackSwizzleComponentDescription,
|
|
74
93
|
};
|
|
75
|
-
const
|
|
94
|
+
const FallbackIntermediateFolderSwizzleComponentConfig = {
|
|
95
|
+
actions: {
|
|
96
|
+
// It doesn't make sense to wrap an intermediate folder
|
|
97
|
+
// because it has not any index component
|
|
98
|
+
wrap: 'forbidden',
|
|
99
|
+
eject: FallbackSwizzleActionStatus,
|
|
100
|
+
},
|
|
101
|
+
description: FallbackSwizzleComponentDescription,
|
|
102
|
+
};
|
|
103
|
+
const allInitialComponents = await readComponentNames(themePath);
|
|
104
|
+
const missingIntermediateComponentFolderNames = getMissingIntermediateComponentFolderNames(allInitialComponents);
|
|
105
|
+
const allComponents = sortComponentNames(allInitialComponents.concat(missingIntermediateComponentFolderNames));
|
|
76
106
|
function getConfig(component) {
|
|
77
|
-
var _a;
|
|
78
107
|
if (!allComponents.includes(component)) {
|
|
79
108
|
throw new Error(`Can't get component config: component doesn't exist: ${component}`);
|
|
80
109
|
}
|
|
81
|
-
|
|
110
|
+
const config = swizzleConfig.components[component];
|
|
111
|
+
if (config) {
|
|
112
|
+
return config;
|
|
113
|
+
}
|
|
114
|
+
const isIntermediateFolder = missingIntermediateComponentFolderNames.includes(component);
|
|
115
|
+
if (isIntermediateFolder) {
|
|
116
|
+
return FallbackIntermediateFolderSwizzleComponentConfig;
|
|
117
|
+
}
|
|
118
|
+
return (swizzleConfig.components[component] ?? FallbackSwizzleComponentConfig);
|
|
82
119
|
}
|
|
83
120
|
function getDescription(component) {
|
|
84
|
-
|
|
85
|
-
return ((_a = getConfig(component).description) !== null && _a !== void 0 ? _a : FallbackSwizzleComponentDescription);
|
|
121
|
+
return (getConfig(component).description ?? FallbackSwizzleComponentDescription);
|
|
86
122
|
}
|
|
87
123
|
function getActionStatus(component, action) {
|
|
88
|
-
|
|
89
|
-
return (_a = getConfig(component).actions[action]) !== null && _a !== void 0 ? _a : FallbackSwizzleActionStatus;
|
|
124
|
+
return getConfig(component).actions[action] ?? FallbackSwizzleActionStatus;
|
|
90
125
|
}
|
|
91
126
|
function isSafeAction(component, action) {
|
|
92
127
|
return getActionStatus(component, action) === 'safe';
|
|
@@ -11,15 +11,18 @@ const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
|
11
11
|
const common_1 = require("./common");
|
|
12
12
|
const themes_1 = require("./themes");
|
|
13
13
|
function getModuleSwizzleConfig(swizzlePlugin) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const getSwizzleConfig = swizzlePlugin.plugin.plugin?.getSwizzleConfig ??
|
|
15
|
+
swizzlePlugin.plugin.pluginModule?.module.getSwizzleConfig ??
|
|
16
|
+
swizzlePlugin.plugin.pluginModule?.module?.getSwizzleConfig;
|
|
16
17
|
if (getSwizzleConfig) {
|
|
17
18
|
return getSwizzleConfig();
|
|
18
19
|
}
|
|
19
20
|
// TODO deprecate getSwizzleComponentList later
|
|
20
|
-
const getSwizzleComponentList =
|
|
21
|
+
const getSwizzleComponentList = swizzlePlugin.plugin.plugin?.getSwizzleComponentList ??
|
|
22
|
+
swizzlePlugin.plugin.pluginModule?.module.getSwizzleComponentList ??
|
|
23
|
+
swizzlePlugin.plugin.pluginModule?.module?.getSwizzleComponentList;
|
|
21
24
|
if (getSwizzleComponentList) {
|
|
22
|
-
const safeComponents =
|
|
25
|
+
const safeComponents = getSwizzleComponentList() ?? [];
|
|
23
26
|
const safeComponentConfig = {
|
|
24
27
|
actions: {
|
|
25
28
|
eject: 'safe',
|
|
@@ -33,20 +36,23 @@ function getModuleSwizzleConfig(swizzlePlugin) {
|
|
|
33
36
|
}
|
|
34
37
|
return undefined;
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const result =
|
|
39
|
+
const SwizzleConfigSchema = utils_validation_1.Joi.object({
|
|
40
|
+
components: utils_validation_1.Joi.object()
|
|
41
|
+
.pattern(utils_validation_1.Joi.string(), utils_validation_1.Joi.object({
|
|
42
|
+
actions: utils_validation_1.Joi.object().pattern(utils_validation_1.Joi.string().valid(...common_1.SwizzleActions), utils_validation_1.Joi.string().valid(...common_1.SwizzleActionsStatuses)),
|
|
43
|
+
description: utils_validation_1.Joi.string(),
|
|
44
|
+
}))
|
|
45
|
+
.required(),
|
|
46
|
+
});
|
|
47
|
+
function validateSwizzleConfig(unsafeSwizzleConfig) {
|
|
48
|
+
const result = SwizzleConfigSchema.validate(unsafeSwizzleConfig);
|
|
46
49
|
if (result.error) {
|
|
47
50
|
throw new Error(`Swizzle config does not match expected schema: ${result.error.message}`);
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
return result.value;
|
|
53
|
+
}
|
|
54
|
+
function normalizeSwizzleConfig(unsafeSwizzleConfig) {
|
|
55
|
+
const swizzleConfig = validateSwizzleConfig(unsafeSwizzleConfig);
|
|
50
56
|
// Ensure all components always declare all actions
|
|
51
57
|
Object.values(swizzleConfig.components).forEach((componentConfig) => {
|
|
52
58
|
common_1.SwizzleActions.forEach((action) => {
|
|
@@ -7,22 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.initSwizzleContext = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const module_1 = require("module");
|
|
12
10
|
const server_1 = require("../../server");
|
|
13
|
-
const init_1 =
|
|
11
|
+
const init_1 = require("../../server/plugins/init");
|
|
12
|
+
const configs_1 = require("../../server/plugins/configs");
|
|
14
13
|
async function initSwizzleContext(siteDir) {
|
|
15
|
-
const context = await (0, server_1.loadContext)(siteDir);
|
|
16
|
-
const
|
|
17
|
-
const pluginConfigs = await (0,
|
|
18
|
-
const plugins = await (0, init_1.default)({
|
|
19
|
-
pluginConfigs,
|
|
20
|
-
context,
|
|
21
|
-
});
|
|
22
|
-
const pluginsNormalized = await (0, init_1.normalizePluginConfigs)(pluginConfigs, pluginRequire);
|
|
14
|
+
const context = await (0, server_1.loadContext)({ siteDir });
|
|
15
|
+
const plugins = await (0, init_1.initPlugins)(context);
|
|
16
|
+
const pluginConfigs = await (0, configs_1.loadPluginConfigs)(context);
|
|
23
17
|
return {
|
|
24
18
|
plugins: plugins.map((plugin, pluginIndex) => ({
|
|
25
|
-
plugin:
|
|
19
|
+
plugin: pluginConfigs[pluginIndex],
|
|
26
20
|
instance: plugin,
|
|
27
21
|
})),
|
|
28
22
|
};
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
import type {
|
|
8
|
-
export
|
|
7
|
+
import type { SwizzleCLIOptions } from './common';
|
|
8
|
+
export declare function swizzle(siteDir: string, themeNameParam: string | undefined, componentNameParam: string | undefined, optionsParam: Partial<SwizzleCLIOptions>): Promise<void>;
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.swizzle = void 0;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
|
-
const logger_1 =
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
11
12
|
const themes_1 = require("./themes");
|
|
12
13
|
const components_1 = require("./components");
|
|
13
14
|
const tables_1 = require("./tables");
|
|
@@ -90,7 +91,7 @@ async function swizzle(siteDir, themeNameParam, componentNameParam, optionsParam
|
|
|
90
91
|
typescript,
|
|
91
92
|
});
|
|
92
93
|
logger_1.default.success `
|
|
93
|
-
Created wrapper of name=${componentName} from name=${themeName} in path=${result.createdFiles}
|
|
94
|
+
Created wrapper of name=${componentName} from name=${themeName} in path=${result.createdFiles}
|
|
94
95
|
`;
|
|
95
96
|
return result;
|
|
96
97
|
}
|
|
@@ -101,7 +102,7 @@ Created wrapper of name=${componentName} from name=${themeName} in path=${result
|
|
|
101
102
|
componentName,
|
|
102
103
|
});
|
|
103
104
|
logger_1.default.success `
|
|
104
|
-
Ejected name=${componentName} from name=${themeName} to path=${result.createdFiles}
|
|
105
|
+
Ejected name=${componentName} from name=${themeName} to path=${result.createdFiles}
|
|
105
106
|
`;
|
|
106
107
|
return result;
|
|
107
108
|
}
|
|
@@ -112,4 +113,4 @@ Ejected name=${componentName} from name=${themeName} to path=${result.createdFil
|
|
|
112
113
|
await executeAction();
|
|
113
114
|
return process.exit(0);
|
|
114
115
|
}
|
|
115
|
-
exports.
|
|
116
|
+
exports.swizzle = swizzle;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.askSwizzleAction = exports.askSwizzleDangerousComponent = exports.askComponentName = exports.askThemeName = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const prompts_1 =
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
const prompts_1 = tslib_1.__importDefault(require("prompts"));
|
|
13
13
|
const common_1 = require("./common");
|
|
14
14
|
const ExitTitle = logger_1.default.yellow('[Exit]');
|
|
15
15
|
async function askThemeName(themeNames) {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.themeComponentsTable = exports.helpTables = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const cli_table3_1 =
|
|
13
|
-
const lodash_1 =
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
|
|
13
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
14
14
|
const actions_1 = require("./actions");
|
|
15
15
|
const common_1 = require("./common");
|
|
16
16
|
function tableStatusLabel(status) {
|
|
@@ -31,8 +31,7 @@ This component is safe to swizzle and was designed for this purpose.
|
|
|
31
31
|
The swizzled component is retro-compatible with minor version upgrades.
|
|
32
32
|
`,
|
|
33
33
|
],
|
|
34
|
-
}
|
|
35
|
-
table.push({
|
|
34
|
+
}, {
|
|
36
35
|
[tableStatusLabel('unsafe')]: [
|
|
37
36
|
logger_1.default.code('--danger'),
|
|
38
37
|
`
|
|
@@ -44,12 +43,11 @@ ${logger_1.default.green('Tip')}: your customization can't be done in a ${tableS
|
|
|
44
43
|
Report it here: https://github.com/facebook/docusaurus/discussions/5468
|
|
45
44
|
`,
|
|
46
45
|
],
|
|
47
|
-
}
|
|
48
|
-
table.push({
|
|
46
|
+
}, {
|
|
49
47
|
[tableStatusLabel('forbidden')]: [
|
|
50
48
|
'',
|
|
51
49
|
`
|
|
52
|
-
This component
|
|
50
|
+
This component is not meant to be swizzled.
|
|
53
51
|
`,
|
|
54
52
|
],
|
|
55
53
|
});
|
|
@@ -66,18 +64,17 @@ function actionsTable() {
|
|
|
66
64
|
Creates a wrapper around the original theme component.
|
|
67
65
|
Allows rendering other components before/after the original theme component.
|
|
68
66
|
|
|
69
|
-
${logger_1.default.green('Tip')}: prefer ${logger_1.default.code('--wrap')} whenever possible to
|
|
67
|
+
${logger_1.default.green('Tip')}: prefer ${logger_1.default.code('--wrap')} whenever possible to reduce the amount of code to maintain.
|
|
70
68
|
`,
|
|
71
69
|
],
|
|
72
|
-
}
|
|
73
|
-
table.push({
|
|
70
|
+
}, {
|
|
74
71
|
[logger_1.default.bold('Eject')]: [
|
|
75
72
|
logger_1.default.code('--eject'),
|
|
76
73
|
`
|
|
77
74
|
Ejects the full source code of the original theme component.
|
|
78
|
-
Allows overriding the original component entirely with your own UI and logic.
|
|
75
|
+
Allows overriding of the original component entirely with your own UI and logic.
|
|
79
76
|
|
|
80
|
-
${logger_1.default.green('Tip')}: ${logger_1.default.code('--eject')} can be useful
|
|
77
|
+
${logger_1.default.green('Tip')}: ${logger_1.default.code('--eject')} can be useful for completely redesigning a component.
|
|
81
78
|
`,
|
|
82
79
|
],
|
|
83
80
|
});
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getThemePath = exports.getThemeName = exports.getThemeNames = exports.getPluginByThemeName = exports.pluginToThemeName = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const logger_1 =
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
13
|
+
const leven_1 = tslib_1.__importDefault(require("leven"));
|
|
14
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
14
15
|
const prompts_1 = require("./prompts");
|
|
15
16
|
const common_1 = require("./common");
|
|
16
17
|
function pluginToThemeName(plugin) {
|
|
17
|
-
var _a;
|
|
18
18
|
if (plugin.instance.getThemePath) {
|
|
19
|
-
return (
|
|
19
|
+
return (plugin.instance.version.name ?? plugin.instance.name);
|
|
20
20
|
}
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
@@ -86,11 +86,12 @@ async function getThemeName({ themeNameParam, themeNames, list, }) {
|
|
|
86
86
|
}
|
|
87
87
|
exports.getThemeName = getThemeName;
|
|
88
88
|
function getThemePath({ plugins, themeName, typescript, }) {
|
|
89
|
-
var _a, _b, _c, _d;
|
|
90
89
|
const pluginInstance = getPluginByThemeName(plugins, themeName);
|
|
91
90
|
const themePath = typescript
|
|
92
|
-
?
|
|
93
|
-
|
|
91
|
+
? pluginInstance.instance.getTypeScriptThemePath &&
|
|
92
|
+
path_1.default.resolve(pluginInstance.instance.path, pluginInstance.instance.getTypeScriptThemePath())
|
|
93
|
+
: pluginInstance.instance.getThemePath &&
|
|
94
|
+
path_1.default.resolve(pluginInstance.instance.path, pluginInstance.instance.getThemePath());
|
|
94
95
|
if (!themePath) {
|
|
95
96
|
logger_1.default.warn(typescript
|
|
96
97
|
? logger_1.default.interpolate `name=${themeName} does not provide TypeScript theme code via ${'getTypeScriptThemePath()'}.`
|
|
@@ -4,12 +4,5 @@
|
|
|
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
|
-
import { type
|
|
8
|
-
declare
|
|
9
|
-
maintainCase?: boolean;
|
|
10
|
-
overwrite?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare function transformMarkdownHeadingLine(line: string, slugger: Slugger, options?: Options): string;
|
|
13
|
-
export declare function transformMarkdownContent(content: string, options?: Options): string;
|
|
14
|
-
export default function writeHeadingIds(siteDir: string, files?: string[], options?: Options): Promise<void>;
|
|
15
|
-
export {};
|
|
7
|
+
import { type WriteHeadingIDOptions } from '@docusaurus/utils';
|
|
8
|
+
export declare function writeHeadingIds(siteDir: string, files: string[], options: WriteHeadingIDOptions): Promise<void>;
|