@docusaurus/core 0.0.0-4258 → 0.0.0-4263

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.
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getMinimizer = exports.getHttpsConfig = exports.getFileLoaderUtils = exports.compile = exports.applyConfigurePostCss = exports.applyConfigureWebpack = exports.getCustomizableJSLoader = exports.getBabelOptions = exports.getCustomBabelConfigFilePath = exports.getStyleLoaders = void 0;
9
+ exports.getMinimizer = exports.getHttpsConfig = exports.compile = exports.applyConfigurePostCss = exports.applyConfigureWebpack = exports.getCustomizableJSLoader = exports.getBabelOptions = exports.getCustomBabelConfigFilePath = exports.getStyleLoaders = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const mini_css_extract_plugin_1 = (0, tslib_1.__importDefault)(require("mini-css-extract-plugin"));
12
12
  const webpack_merge_1 = require("webpack-merge");
@@ -17,7 +17,7 @@ const css_minimizer_webpack_plugin_1 = (0, tslib_1.__importDefault)(require("css
17
17
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
18
18
  const crypto_1 = (0, tslib_1.__importDefault)(require("crypto"));
19
19
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
20
- const constants_1 = require("../constants");
20
+ const utils_1 = require("@docusaurus/utils");
21
21
  const lodash_1 = require("lodash");
22
22
  // Utility method to get style loaders
23
23
  function getStyleLoaders(isServer, cssOptions = {}) {
@@ -76,7 +76,7 @@ function getStyleLoaders(isServer, cssOptions = {}) {
76
76
  }
77
77
  exports.getStyleLoaders = getStyleLoaders;
78
78
  function getCustomBabelConfigFilePath(siteDir) {
79
- const customBabelConfigurationPath = path_1.default.join(siteDir, constants_1.BABEL_CONFIG_FILE_NAME);
79
+ const customBabelConfigurationPath = path_1.default.join(siteDir, utils_1.BABEL_CONFIG_FILE_NAME);
80
80
  return fs_extra_1.default.existsSync(customBabelConfigurationPath)
81
81
  ? customBabelConfigurationPath
82
82
  : undefined;
@@ -221,102 +221,6 @@ function compile(config) {
221
221
  });
222
222
  }
223
223
  exports.compile = compile;
224
- // Inspired by https://github.com/gatsbyjs/gatsby/blob/8e6e021014da310b9cc7d02e58c9b3efe938c665/packages/gatsby/src/utils/webpack-utils.ts#L447
225
- function getFileLoaderUtils() {
226
- // files/images < urlLoaderLimit will be inlined as base64 strings directly in the html
227
- const urlLoaderLimit = constants_1.WEBPACK_URL_LOADER_LIMIT;
228
- // defines the path/pattern of the assets handled by webpack
229
- const fileLoaderFileName = (folder) => `${constants_1.OUTPUT_STATIC_ASSETS_DIR_NAME}/${folder}/[name]-[hash].[ext]`;
230
- const loaders = {
231
- file: (options) => ({
232
- loader: require.resolve(`file-loader`),
233
- options: {
234
- name: fileLoaderFileName(options.folder),
235
- },
236
- }),
237
- url: (options) => ({
238
- loader: require.resolve(`url-loader`),
239
- options: {
240
- limit: urlLoaderLimit,
241
- name: fileLoaderFileName(options.folder),
242
- fallback: require.resolve(`file-loader`),
243
- },
244
- }),
245
- // TODO find a better solution to avoid conflicts with the ideal-image plugin
246
- // TODO this may require a little breaking change for ideal-image users?
247
- // Maybe with the ideal image plugin, all md images should be "ideal"?
248
- // This is used to force url-loader+file-loader on markdown images
249
- // https://webpack.js.org/concepts/loaders/#inline
250
- inlineMarkdownImageFileLoader: `!url-loader?limit=${urlLoaderLimit}&name=${fileLoaderFileName('images')}&fallback=file-loader!`,
251
- inlineMarkdownLinkFileLoader: `!file-loader?name=${fileLoaderFileName('files')}!`,
252
- };
253
- const rules = {
254
- /**
255
- * Loads image assets, inlines images via a data URI if they are below
256
- * the size threshold
257
- */
258
- images: () => ({
259
- use: [loaders.url({ folder: 'images' })],
260
- test: /\.(ico|jpg|jpeg|png|gif|webp)(\?.*)?$/,
261
- }),
262
- fonts: () => ({
263
- use: [loaders.url({ folder: 'fonts' })],
264
- test: /\.(woff|woff2|eot|ttf|otf)$/,
265
- }),
266
- /**
267
- * Loads audio and video and inlines them via a data URI if they are below
268
- * the size threshold
269
- */
270
- media: () => ({
271
- use: [loaders.url({ folder: 'medias' })],
272
- test: /\.(mp4|webm|ogv|wav|mp3|m4a|aac|oga|flac)$/,
273
- }),
274
- svg: () => ({
275
- test: /\.svg?$/,
276
- oneOf: [
277
- {
278
- use: [
279
- {
280
- loader: '@svgr/webpack',
281
- options: {
282
- prettier: false,
283
- svgo: true,
284
- svgoConfig: {
285
- plugins: [
286
- {
287
- name: 'preset-default',
288
- params: {
289
- overrides: {
290
- removeViewBox: false,
291
- },
292
- },
293
- },
294
- ],
295
- },
296
- titleProp: true,
297
- ref: ![path_1.default],
298
- },
299
- },
300
- ],
301
- // We don't want to use SVGR loader for non-React source code
302
- // ie we don't want to use SVGR for CSS files...
303
- issuer: {
304
- and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
305
- },
306
- },
307
- {
308
- use: [loaders.url({ folder: 'images' })],
309
- },
310
- ],
311
- }),
312
- otherAssets: () => ({
313
- use: [loaders.file({ folder: 'files' })],
314
- test: /\.(pdf|doc|docx|xls|xlsx|zip|rar)$/,
315
- }),
316
- };
317
- return { loaders, rules };
318
- }
319
- exports.getFileLoaderUtils = getFileLoaderUtils;
320
224
  // Ensure the certificate and key provided are valid and if not
321
225
  // throw an easy to debug error
322
226
  function validateKeyAndCerts({ cert, key, keyFile, crtFile, }) {
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-4258",
4
+ "version": "0.0.0-4263",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,11 +41,12 @@
41
41
  "@babel/runtime": "^7.16.3",
42
42
  "@babel/runtime-corejs3": "^7.16.3",
43
43
  "@babel/traverse": "^7.16.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4258",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4263",
45
+ "@docusaurus/mdx-loader": "0.0.0-4263",
45
46
  "@docusaurus/react-loadable": "5.5.2",
46
- "@docusaurus/utils": "0.0.0-4258",
47
- "@docusaurus/utils-common": "0.0.0-4258",
48
- "@docusaurus/utils-validation": "0.0.0-4258",
47
+ "@docusaurus/utils": "0.0.0-4263",
48
+ "@docusaurus/utils-common": "0.0.0-4263",
49
+ "@docusaurus/utils-validation": "0.0.0-4263",
49
50
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
50
51
  "@svgr/webpack": "^6.0.0",
51
52
  "autoprefixer": "^10.3.5",
@@ -107,8 +108,8 @@
107
108
  "webpackbar": "^5.0.0-3"
108
109
  },
109
110
  "devDependencies": {
110
- "@docusaurus/module-type-aliases": "0.0.0-4258",
111
- "@docusaurus/types": "0.0.0-4258",
111
+ "@docusaurus/module-type-aliases": "0.0.0-4263",
112
+ "@docusaurus/types": "0.0.0-4263",
112
113
  "@types/copy-webpack-plugin": "^8.0.1",
113
114
  "@types/css-minimizer-webpack-plugin": "^3.0.2",
114
115
  "@types/detect-port": "^1.3.0",
@@ -127,5 +128,5 @@
127
128
  "engines": {
128
129
  "node": ">=14"
129
130
  },
130
- "gitHead": "8da10a91f6ab5e25e3d23ce2719bc4b512ee754d"
131
+ "gitHead": "c04a978ae6fdf49ddbeb2259c3f79c5d820eb243"
131
132
  }
@@ -1,19 +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
- export declare const NODE_MAJOR_VERSION: number;
8
- export declare const NODE_MINOR_VERSION: number;
9
- export declare const DEFAULT_BUILD_DIR_NAME = "build";
10
- export declare const DEFAULT_CONFIG_FILE_NAME = "docusaurus.config.js";
11
- export declare const BABEL_CONFIG_FILE_NAME: string;
12
- export declare const GENERATED_FILES_DIR_NAME: string;
13
- export declare const SRC_DIR_NAME = "src";
14
- export declare const STATIC_DIR_NAME = "static";
15
- export declare const OUTPUT_STATIC_ASSETS_DIR_NAME = "assets";
16
- export declare const THEME_PATH: string;
17
- export declare const DEFAULT_PORT = 3000;
18
- export declare const DEFAULT_PLUGIN_ID = "default";
19
- export declare const WEBPACK_URL_LOADER_LIMIT: string | number;
package/lib/constants.js DELETED
@@ -1,26 +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
- var _a;
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.WEBPACK_URL_LOADER_LIMIT = exports.DEFAULT_PLUGIN_ID = exports.DEFAULT_PORT = exports.THEME_PATH = exports.OUTPUT_STATIC_ASSETS_DIR_NAME = exports.STATIC_DIR_NAME = exports.SRC_DIR_NAME = exports.GENERATED_FILES_DIR_NAME = exports.BABEL_CONFIG_FILE_NAME = exports.DEFAULT_CONFIG_FILE_NAME = exports.DEFAULT_BUILD_DIR_NAME = exports.NODE_MINOR_VERSION = exports.NODE_MAJOR_VERSION = void 0;
11
- exports.NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
12
- exports.NODE_MINOR_VERSION = parseInt(process.versions.node.split('.')[1], 10);
13
- // Can be overridden with cli option --out-dir
14
- exports.DEFAULT_BUILD_DIR_NAME = 'build';
15
- // Can be overridden with cli option --config
16
- exports.DEFAULT_CONFIG_FILE_NAME = 'docusaurus.config.js';
17
- exports.BABEL_CONFIG_FILE_NAME = process.env.DOCUSAURUS_BABEL_CONFIG_FILE_NAME || 'babel.config.js';
18
- exports.GENERATED_FILES_DIR_NAME = process.env.DOCUSAURUS_GENERATED_FILES_DIR_NAME || '.docusaurus';
19
- exports.SRC_DIR_NAME = 'src';
20
- exports.STATIC_DIR_NAME = 'static';
21
- exports.OUTPUT_STATIC_ASSETS_DIR_NAME = 'assets'; // files handled by webpack, hashed (can be cached aggressively)
22
- exports.THEME_PATH = `${exports.SRC_DIR_NAME}/theme`;
23
- exports.DEFAULT_PORT = 3000;
24
- exports.DEFAULT_PLUGIN_ID = 'default';
25
- // Temporary fix for https://github.com/facebook/docusaurus/issues/5493
26
- exports.WEBPACK_URL_LOADER_LIMIT = (_a = process.env.WEBPACK_URL_LOADER_LIMIT) !== null && _a !== void 0 ? _a : 10000;