@docusaurus/core 0.0.0-6081 → 0.0.0-6083

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.
@@ -11,16 +11,15 @@ exports.applyConfigureWebpack = applyConfigureWebpack;
11
11
  exports.applyConfigurePostCss = applyConfigurePostCss;
12
12
  exports.executePluginsConfigureWebpack = executePluginsConfigureWebpack;
13
13
  const webpack_merge_1 = require("webpack-merge");
14
- const utils_1 = require("./utils");
15
- const currentBundler_1 = require("./currentBundler");
14
+ const bundler_1 = require("@docusaurus/bundler");
16
15
  /**
17
16
  * Creates convenient utils to inject into the configureWebpack() lifecycle
18
17
  * @param config the Docusaurus config
19
18
  */
20
19
  async function createConfigureWebpackUtils({ siteConfig, }) {
21
- const currentBundler = await (0, currentBundler_1.getCurrentBundler)({ siteConfig });
22
- const getStyleLoaders = await (0, utils_1.createStyleLoadersFactory)({ currentBundler });
23
- const getJSLoader = await (0, utils_1.createJsLoaderFactory)({ siteConfig });
20
+ const currentBundler = await (0, bundler_1.getCurrentBundler)({ siteConfig });
21
+ const getStyleLoaders = await (0, bundler_1.createStyleLoadersFactory)({ currentBundler });
22
+ const getJSLoader = await (0, bundler_1.createJsLoaderFactory)({ siteConfig });
24
23
  return {
25
24
  currentBundler,
26
25
  getStyleLoaders,
@@ -7,8 +7,8 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const tslib_1 = require("tslib");
10
+ const bundler_1 = require("@docusaurus/bundler");
10
11
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
11
- const utils_1 = require("../utils");
12
12
  // When building, include the plugin to force terminate building if errors
13
13
  // happened in the client bundle.
14
14
  class ForceTerminatePlugin {
@@ -16,7 +16,7 @@ class ForceTerminatePlugin {
16
16
  compiler.hooks.done.tap('client:done', (stats) => {
17
17
  if (stats.hasErrors()) {
18
18
  const errorsWarnings = stats.toJson('errors-warnings');
19
- logger_1.default.error(`Client bundle compiled with errors therefore further build is impossible.\n${(0, utils_1.formatStatsErrorMessage)(errorsWarnings)}`);
19
+ logger_1.default.error(`Client bundle compiled with errors therefore further build is impossible.\n${(0, bundler_1.formatStatsErrorMessage)(errorsWarnings)}`);
20
20
  process.exit(1);
21
21
  }
22
22
  });
@@ -4,9 +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 { CurrentBundler, Props } from '@docusaurus/types';
7
+ import type { Props } from '@docusaurus/types';
8
8
  import type { WebpackPluginInstance } from 'webpack';
9
- export declare function createStaticDirectoriesCopyPlugin({ props, currentBundler, }: {
9
+ export declare function createStaticDirectoriesCopyPlugin({ props, }: {
10
10
  props: Props;
11
- currentBundler: CurrentBundler;
12
11
  }): Promise<WebpackPluginInstance | undefined>;
@@ -10,10 +10,10 @@ exports.createStaticDirectoriesCopyPlugin = createStaticDirectoriesCopyPlugin;
10
10
  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
- const currentBundler_1 = require("../currentBundler");
14
- async function createStaticDirectoriesCopyPlugin({ props, currentBundler, }) {
15
- const CopyPlugin = await (0, currentBundler_1.getCopyPlugin)({
16
- currentBundler,
13
+ const bundler_1 = require("@docusaurus/bundler");
14
+ async function createStaticDirectoriesCopyPlugin({ props, }) {
15
+ const CopyPlugin = await (0, bundler_1.getCopyPlugin)({
16
+ currentBundler: props.currentBundler,
17
17
  });
18
18
  const { outDir, siteDir, siteConfig: { staticDirectories: staticDirectoriesOption }, } = props;
19
19
  // The staticDirectories option can contain empty directories, or non-existent
@@ -11,7 +11,7 @@ const tslib_1 = require("tslib");
11
11
  const path_1 = tslib_1.__importDefault(require("path"));
12
12
  const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
13
13
  const utils_1 = require("@docusaurus/utils");
14
- const webpackbar_1 = tslib_1.__importDefault(require("webpackbar"));
14
+ const bundler_1 = require("@docusaurus/bundler");
15
15
  const base_1 = require("./base");
16
16
  async function createServerConfig({ props, configureWebpackUtils, }) {
17
17
  const baseConfig = await (0, base_1.createBaseConfig)({
@@ -21,6 +21,9 @@ async function createServerConfig({ props, configureWebpackUtils, }) {
21
21
  faster: props.siteConfig.future.experimental_faster,
22
22
  configureWebpackUtils,
23
23
  });
24
+ const ProgressBarPlugin = await (0, bundler_1.getProgressBarPlugin)({
25
+ currentBundler: props.currentBundler,
26
+ });
24
27
  const outputFilename = 'server.bundle.js';
25
28
  const outputDir = path_1.default.join(props.outDir, '__server');
26
29
  const serverBundlePath = path_1.default.join(outputDir, outputFilename);
@@ -35,8 +38,7 @@ async function createServerConfig({ props, configureWebpackUtils, }) {
35
38
  libraryTarget: 'commonjs2',
36
39
  },
37
40
  plugins: [
38
- // Show compilation progress bar.
39
- new webpackbar_1.default({
41
+ new ProgressBarPlugin({
40
42
  name: 'Server',
41
43
  color: 'yellow',
42
44
  }),
@@ -4,5 +4,7 @@
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 { Globby } from '@docusaurus/utils';
8
- export declare function safeGlobby(patterns: string[], options?: Globby.GlobbyOptions): Promise<string[]>;
7
+ export default function getHttpsConfig(): Promise<boolean | {
8
+ cert: Buffer;
9
+ key: Buffer;
10
+ }>;
@@ -0,0 +1,60 @@
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.default = getHttpsConfig;
10
+ const tslib_1 = require("tslib");
11
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
+ const path_1 = tslib_1.__importDefault(require("path"));
13
+ const crypto_1 = tslib_1.__importDefault(require("crypto"));
14
+ const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
15
+ // Ensure the certificate and key provided are valid and if not
16
+ // throw an easy to debug error
17
+ function validateKeyAndCerts({ cert, key, keyFile, crtFile, }) {
18
+ let encrypted;
19
+ try {
20
+ // publicEncrypt will throw an error with an invalid cert
21
+ encrypted = crypto_1.default.publicEncrypt(cert, Buffer.from('test'));
22
+ }
23
+ catch (err) {
24
+ logger_1.default.error `The certificate path=${crtFile} is invalid.`;
25
+ throw err;
26
+ }
27
+ try {
28
+ // privateDecrypt will throw an error with an invalid key
29
+ crypto_1.default.privateDecrypt(key, encrypted);
30
+ }
31
+ catch (err) {
32
+ logger_1.default.error `The certificate key path=${keyFile} is invalid.`;
33
+ throw err;
34
+ }
35
+ }
36
+ // Read file and throw an error if it doesn't exist
37
+ async function readEnvFile(file, type) {
38
+ if (!(await fs_extra_1.default.pathExists(file))) {
39
+ throw new Error(`You specified ${type} in your env, but the file "${file}" can't be found.`);
40
+ }
41
+ return fs_extra_1.default.readFile(file);
42
+ }
43
+ // Get the https config
44
+ // Return cert files if provided in env, otherwise just true or false
45
+ async function getHttpsConfig() {
46
+ const appDirectory = await fs_extra_1.default.realpath(process.cwd());
47
+ const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
48
+ const isHttps = HTTPS === 'true';
49
+ if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
50
+ const crtFile = path_1.default.resolve(appDirectory, SSL_CRT_FILE);
51
+ const keyFile = path_1.default.resolve(appDirectory, SSL_KEY_FILE);
52
+ const config = {
53
+ cert: await readEnvFile(crtFile, 'SSL_CRT_FILE'),
54
+ key: await readEnvFile(keyFile, 'SSL_KEY_FILE'),
55
+ };
56
+ validateKeyAndCerts({ ...config, keyFile, crtFile });
57
+ return config;
58
+ }
59
+ return isHttps;
60
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-6081",
4
+ "version": "0.0.0-6083",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,54 +33,32 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@babel/core": "^7.23.3",
37
- "@babel/generator": "^7.23.3",
38
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
39
- "@babel/plugin-transform-runtime": "^7.22.9",
40
- "@babel/preset-env": "^7.22.9",
41
- "@babel/preset-react": "^7.22.5",
42
- "@babel/preset-typescript": "^7.22.5",
43
- "@babel/runtime": "^7.22.6",
44
- "@babel/runtime-corejs3": "^7.22.6",
45
- "@babel/traverse": "^7.22.8",
46
- "@docusaurus/cssnano-preset": "0.0.0-6081",
47
- "@docusaurus/logger": "0.0.0-6081",
48
- "@docusaurus/mdx-loader": "0.0.0-6081",
49
- "@docusaurus/utils": "0.0.0-6081",
50
- "@docusaurus/utils-common": "0.0.0-6081",
51
- "@docusaurus/utils-validation": "0.0.0-6081",
52
- "autoprefixer": "^10.4.14",
53
- "babel-loader": "^9.1.3",
54
- "babel-plugin-dynamic-import-node": "^2.3.3",
36
+ "@docusaurus/babel": "0.0.0-6083",
37
+ "@docusaurus/bundler": "0.0.0-6083",
38
+ "@docusaurus/logger": "0.0.0-6083",
39
+ "@docusaurus/mdx-loader": "0.0.0-6083",
40
+ "@docusaurus/utils": "0.0.0-6083",
41
+ "@docusaurus/utils-common": "0.0.0-6083",
42
+ "@docusaurus/utils-validation": "0.0.0-6083",
55
43
  "boxen": "^6.2.1",
56
44
  "chalk": "^4.1.2",
57
45
  "chokidar": "^3.5.3",
58
- "clean-css": "^5.3.2",
59
46
  "cli-table3": "^0.6.3",
60
47
  "combine-promises": "^1.1.0",
61
48
  "commander": "^5.1.0",
62
- "copy-webpack-plugin": "^11.0.0",
63
49
  "core-js": "^3.31.1",
64
- "css-loader": "^6.8.1",
65
- "css-minimizer-webpack-plugin": "^5.0.1",
66
- "cssnano": "^6.1.2",
67
50
  "del": "^6.1.1",
68
51
  "detect-port": "^1.5.1",
69
52
  "escape-html": "^1.0.3",
70
53
  "eta": "^2.2.0",
71
54
  "eval": "^0.1.8",
72
- "file-loader": "^6.2.0",
73
55
  "fs-extra": "^11.1.1",
74
56
  "html-minifier-terser": "^7.2.0",
75
57
  "html-tags": "^3.3.1",
76
58
  "html-webpack-plugin": "^5.5.3",
77
59
  "leven": "^3.1.0",
78
60
  "lodash": "^4.17.21",
79
- "mini-css-extract-plugin": "^2.7.6",
80
- "null-loader": "^4.0.1",
81
61
  "p-map": "^4.0.0",
82
- "postcss": "^8.4.26",
83
- "postcss-loader": "^7.3.3",
84
62
  "prompts": "^2.4.2",
85
63
  "react-dev-utils": "^12.0.1",
86
64
  "react-helmet-async": "^1.3.0",
@@ -93,19 +71,16 @@
93
71
  "semver": "^7.5.4",
94
72
  "serve-handler": "npm:@docusaurus/serve-handler@6.2.0",
95
73
  "shelljs": "^0.8.5",
96
- "terser-webpack-plugin": "^5.3.10",
97
74
  "tslib": "^2.6.0",
98
75
  "update-notifier": "^6.0.2",
99
- "url-loader": "^4.1.1",
100
76
  "webpack": "^5.88.1",
101
77
  "webpack-bundle-analyzer": "^4.9.0",
102
78
  "webpack-dev-server": "^4.15.1",
103
- "webpack-merge": "^5.9.0",
104
- "webpackbar": "^5.0.2"
79
+ "webpack-merge": "^5.9.0"
105
80
  },
106
81
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-6081",
108
- "@docusaurus/types": "0.0.0-6081",
82
+ "@docusaurus/module-type-aliases": "0.0.0-6083",
83
+ "@docusaurus/types": "0.0.0-6083",
109
84
  "@total-typescript/shoehorn": "^0.1.2",
110
85
  "@types/detect-port": "^1.3.3",
111
86
  "@types/react-dom": "^18.2.7",
@@ -132,5 +107,5 @@
132
107
  "engines": {
133
108
  "node": ">=18.0"
134
109
  },
135
- "gitHead": "610c0dfb7990452f8e0eeb0c8bea792d0d0c0a0c"
110
+ "gitHead": "474967f4f49da90a1fca9f9034b0c054c5e29c7f"
136
111
  }
package/lib/faster.d.ts DELETED
@@ -1,10 +0,0 @@
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 { ConfigureWebpackUtils } from '@docusaurus/types';
8
- import type { MinimizerOptions, CustomOptions } from 'terser-webpack-plugin';
9
- export declare function importSwcJsLoaderFactory(): Promise<ConfigureWebpackUtils['getJSLoader']>;
10
- export declare function importSwcJsMinifierOptions(): Promise<MinimizerOptions<CustomOptions>>;
package/lib/faster.js DELETED
@@ -1,29 +0,0 @@
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.importSwcJsLoaderFactory = importSwcJsLoaderFactory;
10
- exports.importSwcJsMinifierOptions = importSwcJsMinifierOptions;
11
- async function importFaster() {
12
- return import('@docusaurus/faster');
13
- }
14
- async function ensureFaster() {
15
- try {
16
- return await importFaster();
17
- }
18
- catch (error) {
19
- throw new Error('Your Docusaurus site need to add the @docusaurus/faster package as a dependency.', { cause: error });
20
- }
21
- }
22
- async function importSwcJsLoaderFactory() {
23
- const faster = await ensureFaster();
24
- return faster.getSwcJsLoaderFactory;
25
- }
26
- async function importSwcJsMinifierOptions() {
27
- const faster = await ensureFaster();
28
- return faster.getSwcJsMinifierOptions();
29
- }
@@ -1,20 +0,0 @@
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.safeGlobby = safeGlobby;
10
- const tslib_1 = require("tslib");
11
- const path_1 = tslib_1.__importDefault(require("path"));
12
- const utils_1 = require("@docusaurus/utils");
13
- // Globby that fix Windows path patterns
14
- // See https://github.com/facebook/docusaurus/pull/4222#issuecomment-795517329
15
- async function safeGlobby(patterns, options) {
16
- // Required for Windows support, as paths using \ should not be used by globby
17
- // (also using the windows hard drive prefix like c: is not a good idea)
18
- const globPaths = patterns.map((dirPath) => (0, utils_1.posixPath)(path_1.default.relative(process.cwd(), dirPath)));
19
- return (0, utils_1.Globby)(globPaths, options);
20
- }
@@ -1,24 +0,0 @@
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 MiniCssExtractPlugin from 'mini-css-extract-plugin';
8
- import CopyWebpackPlugin from 'copy-webpack-plugin';
9
- import type { CurrentBundler, DocusaurusConfig } from '@docusaurus/types';
10
- type SiteConfigSlice = {
11
- future: {
12
- experimental_faster: Pick<DocusaurusConfig['future']['experimental_faster'], 'rspackBundler'>;
13
- };
14
- };
15
- export declare function getCurrentBundler({ siteConfig, }: {
16
- siteConfig: SiteConfigSlice;
17
- }): Promise<CurrentBundler>;
18
- export declare function getCSSExtractPlugin({ currentBundler, }: {
19
- currentBundler: CurrentBundler;
20
- }): Promise<typeof MiniCssExtractPlugin>;
21
- export declare function getCopyPlugin({ currentBundler, }: {
22
- currentBundler: CurrentBundler;
23
- }): Promise<typeof CopyWebpackPlugin>;
24
- export {};
@@ -1,42 +0,0 @@
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.getCurrentBundler = getCurrentBundler;
10
- exports.getCSSExtractPlugin = getCSSExtractPlugin;
11
- exports.getCopyPlugin = getCopyPlugin;
12
- const tslib_1 = require("tslib");
13
- const webpack_1 = tslib_1.__importDefault(require("webpack"));
14
- const mini_css_extract_plugin_1 = tslib_1.__importDefault(require("mini-css-extract-plugin"));
15
- const copy_webpack_plugin_1 = tslib_1.__importDefault(require("copy-webpack-plugin"));
16
- const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
17
- function isRspack(siteConfig) {
18
- return siteConfig.future.experimental_faster.rspackBundler;
19
- }
20
- async function getCurrentBundler({ siteConfig, }) {
21
- if (isRspack(siteConfig)) {
22
- // TODO add support for Rspack
23
- logger_1.default.error('Rspack bundler is not supported yet, will use Webpack instead');
24
- }
25
- return {
26
- name: 'webpack',
27
- instance: webpack_1.default,
28
- };
29
- }
30
- async function getCSSExtractPlugin({ currentBundler, }) {
31
- if (currentBundler.name === 'rspack') {
32
- throw new Error('Rspack bundler is not supported yet');
33
- }
34
- return mini_css_extract_plugin_1.default;
35
- }
36
- async function getCopyPlugin({ currentBundler, }) {
37
- if (currentBundler.name === 'rspack') {
38
- throw new Error('Rspack bundler is not supported yet');
39
- }
40
- // https://github.com/webpack-contrib/copy-webpack-plugin
41
- return copy_webpack_plugin_1.default;
42
- }
@@ -1,12 +0,0 @@
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 { WebpackPluginInstance } from 'webpack';
8
- import type { FasterConfig } from '@docusaurus/types';
9
- export type MinimizersConfig = {
10
- faster: Pick<FasterConfig, 'swcJsMinimizer'>;
11
- };
12
- export declare function getMinimizers(params: MinimizersConfig): Promise<WebpackPluginInstance[]>;
@@ -1,106 +0,0 @@
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.getMinimizers = getMinimizers;
10
- const tslib_1 = require("tslib");
11
- const terser_webpack_plugin_1 = tslib_1.__importDefault(require("terser-webpack-plugin"));
12
- const css_minimizer_webpack_plugin_1 = tslib_1.__importDefault(require("css-minimizer-webpack-plugin"));
13
- const faster_1 = require("../faster");
14
- // See https://github.com/webpack-contrib/terser-webpack-plugin#parallel
15
- function getTerserParallel() {
16
- let terserParallel = true;
17
- if (process.env.TERSER_PARALLEL === 'false') {
18
- terserParallel = false;
19
- }
20
- else if (process.env.TERSER_PARALLEL &&
21
- parseInt(process.env.TERSER_PARALLEL, 10) > 0) {
22
- terserParallel = parseInt(process.env.TERSER_PARALLEL, 10);
23
- }
24
- return terserParallel;
25
- }
26
- async function getJsMinimizer({ faster }) {
27
- if (faster.swcJsMinimizer) {
28
- const terserOptions = await (0, faster_1.importSwcJsMinifierOptions)();
29
- return new terser_webpack_plugin_1.default({
30
- parallel: getTerserParallel(),
31
- minify: terser_webpack_plugin_1.default.swcMinify,
32
- terserOptions,
33
- });
34
- }
35
- return new terser_webpack_plugin_1.default({
36
- parallel: getTerserParallel(),
37
- terserOptions: {
38
- parse: {
39
- // We want uglify-js to parse ecma 8 code. However, we don't want it
40
- // to apply any minification steps that turns valid ecma 5 code
41
- // into invalid ecma 5 code. This is why the 'compress' and 'output'
42
- // sections only apply transformations that are ecma 5 safe
43
- // https://github.com/facebook/create-react-app/pull/4234
44
- ecma: 2020,
45
- },
46
- compress: {
47
- ecma: 5,
48
- },
49
- mangle: {
50
- safari10: true,
51
- },
52
- output: {
53
- ecma: 5,
54
- comments: false,
55
- // Turned on because emoji and regex is not minified properly using
56
- // default. See https://github.com/facebook/create-react-app/issues/2488
57
- ascii_only: true,
58
- },
59
- },
60
- });
61
- }
62
- function getAdvancedCssMinifier() {
63
- // Using the array syntax to add 2 minimizers
64
- // see https://github.com/webpack-contrib/css-minimizer-webpack-plugin#array
65
- return new css_minimizer_webpack_plugin_1.default({
66
- minimizerOptions: [
67
- // CssNano options
68
- {
69
- preset: require.resolve('@docusaurus/cssnano-preset'),
70
- },
71
- // CleanCss options
72
- {
73
- inline: false,
74
- level: {
75
- 1: {
76
- all: false,
77
- removeWhitespace: true,
78
- },
79
- 2: {
80
- all: true,
81
- restructureRules: true,
82
- removeUnusedAtRules: false,
83
- },
84
- },
85
- },
86
- ],
87
- minify: [
88
- css_minimizer_webpack_plugin_1.default.cssnanoMinify,
89
- css_minimizer_webpack_plugin_1.default.cleanCssMinify,
90
- ],
91
- });
92
- }
93
- function getCssMinimizer() {
94
- // This is an historical env variable to opt-out of the advanced minifier
95
- // Sometimes there's a bug in it and people are happy to disable it
96
- const useSimpleCssMinifier = process.env.USE_SIMPLE_CSS_MINIFIER === 'true';
97
- if (useSimpleCssMinifier) {
98
- return new css_minimizer_webpack_plugin_1.default();
99
- }
100
- else {
101
- return getAdvancedCssMinifier();
102
- }
103
- }
104
- async function getMinimizers(params) {
105
- return Promise.all([getJsMinimizer(params), getCssMinimizer()]);
106
- }
@@ -1,38 +0,0 @@
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 webpack, { type Configuration } from 'webpack';
8
- import type { ConfigureWebpackUtils, CurrentBundler, DocusaurusConfig } from '@docusaurus/types';
9
- import type { TransformOptions } from '@babel/core';
10
- export declare function formatStatsErrorMessage(statsJson: ReturnType<webpack.Stats['toJson']> | undefined): string | undefined;
11
- export declare function printStatsWarnings(statsJson: ReturnType<webpack.Stats['toJson']> | undefined): void;
12
- export declare function createStyleLoadersFactory({ currentBundler, }: {
13
- currentBundler: CurrentBundler;
14
- }): Promise<ConfigureWebpackUtils['getStyleLoaders']>;
15
- export declare function getCustomBabelConfigFilePath(siteDir: string): Promise<string | undefined>;
16
- export declare function getBabelOptions({ isServer, babelOptions, }?: {
17
- isServer?: boolean;
18
- babelOptions?: TransformOptions | string;
19
- }): TransformOptions;
20
- export declare function createJsLoaderFactory({ siteConfig, }: {
21
- siteConfig: {
22
- webpack?: DocusaurusConfig['webpack'];
23
- future?: {
24
- experimental_faster: DocusaurusConfig['future']['experimental_faster'];
25
- };
26
- };
27
- }): Promise<ConfigureWebpackUtils['getJSLoader']>;
28
- declare global {
29
- interface Error {
30
- /** @see https://webpack.js.org/api/node/#error-handling */
31
- details: unknown;
32
- }
33
- }
34
- export declare function compile(config: Configuration[]): Promise<webpack.MultiStats>;
35
- export declare function getHttpsConfig(): Promise<boolean | {
36
- cert: Buffer;
37
- key: Buffer;
38
- }>;