@docusaurus/mdx-loader 4.0.0-canary-6892 → 4.0.0-canary-6893

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,13 +6,9 @@
6
6
  */
7
7
  import type { Options } from './options';
8
8
  import type { RuleSetRule, RuleSetUseItem } from 'webpack';
9
- type CreateOptions = {
10
- useCrossCompilerCache?: boolean;
11
- };
12
- export declare function createMDXLoaderItem(options: Options & CreateOptions): RuleSetUseItem;
9
+ export declare function createMDXLoaderItem(options: Options): RuleSetUseItem;
13
10
  export declare function createMDXLoaderRule({ include, options, }: {
14
11
  include: RuleSetRule['include'];
15
- options: Options & CreateOptions;
12
+ options: Options;
16
13
  }): RuleSetRule;
17
- export {};
18
14
  //# sourceMappingURL=createMDXLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMDXLoader.d.ts","sourceRoot":"","sources":["../src/createMDXLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAEzD,KAAK,aAAa,GAAG;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AA8BF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,GAAG,aAAa,GAC/B,cAAc,CAKhB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,GAAG,aAAa,CAAC;CAClC,GAAG,WAAW,CAOd"}
1
+ {"version":3,"file":"createMDXLoader.d.ts","sourceRoot":"","sources":["../src/createMDXLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAmCzD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAKpE;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,WAAW,CAOd"}
@@ -9,6 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.createMDXLoaderItem = createMDXLoaderItem;
10
10
  exports.createMDXLoaderRule = createMDXLoaderRule;
11
11
  const processor_1 = require("./processor");
12
+ // Escape hatch to disable the MDX cross-compiler cache, just in case
13
+ // TODO Docusaurus v5: remove this escape hatch env variable
14
+ const DisableCrossCompilerCache = process.env.DOCUSAURUS_NO_MDX_CROSS_COMPILER_CACHE === 'true';
12
15
  function normalizeOptions(optionsInput) {
13
16
  // Skip eager processor creation in tests
14
17
  if (process.env.NODE_ENV === 'test' || process.env.VITEST) {
@@ -24,7 +27,7 @@ function normalizeOptions(optionsInput) {
24
27
  // We don't want to cache in dev mode (docusaurus start)
25
28
  // We only have multiple compilers in production mode (docusaurus build)
26
29
  // TODO wrong but good enough for now (example: "docusaurus build --dev")
27
- if (options.useCrossCompilerCache && process.env.NODE_ENV === 'production') {
30
+ if (!DisableCrossCompilerCache && process.env.NODE_ENV === 'production') {
28
31
  options = {
29
32
  ...options,
30
33
  crossCompilerCache: new Map(),
@@ -1 +1 @@
1
- {"version":3,"file":"createMDXLoader.js","sourceRoot":"","sources":["../src/createMDXLoader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,2CAA6C;AAQ7C,SAAS,gBAAgB,CAAC,YAAqC;IAC7D,yCAAyC;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC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,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAC1D,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,GAAG,YAAY,CAAC;IAE3B,6EAA6E;IAC7E,2EAA2E;IAC3E,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,OAAO,GAAG,EAAC,GAAG,OAAO,EAAE,UAAU,EAAE,IAAA,4BAAgB,EAAC,EAAC,OAAO,EAAC,CAAC,EAAC,CAAC;IAClE,CAAC;IAED,sEAAsE;IACtE,wDAAwD;IACxD,wEAAwE;IACxE,yEAAyE;IACzE,IAAI,CAAC,yBAAyB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QACxE,OAAO,GAAG;YACR,GAAG,OAAO;YACV,kBAAkB,EAAE,IAAI,GAAG,EAAE;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6BAAoC,OAAgB;IAClD,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;QAClC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,6BAAoC,EAClC,OAAO,EACP,OAAO,GAIR;IACC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,OAAO;QACP,IAAI,EAAE,EAAC,IAAI,EAAE,EAAC,GAAG,EAAE,MAAM,EAAC,EAAC;QAC3B,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;KACpC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/mdx-loader",
3
- "version": "4.0.0-canary-6892",
3
+ "version": "4.0.0-canary-6893",
4
4
  "description": "Docusaurus Loader for MDX",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,10 +18,10 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/fs": "4.0.0-canary-6892",
22
- "@docusaurus/logger": "4.0.0-canary-6892",
23
- "@docusaurus/utils": "4.0.0-canary-6892",
24
- "@docusaurus/utils-validation": "4.0.0-canary-6892",
21
+ "@docusaurus/fs": "4.0.0-canary-6893",
22
+ "@docusaurus/logger": "4.0.0-canary-6893",
23
+ "@docusaurus/utils": "4.0.0-canary-6893",
24
+ "@docusaurus/utils-validation": "4.0.0-canary-6893",
25
25
  "@mdx-js/mdx": "^3.1.1",
26
26
  "@slorber/remark-comment": "^1.0.0",
27
27
  "astring": "^1.9.0",
@@ -43,7 +43,7 @@
43
43
  "webpack": "^5.111.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@docusaurus/types": "4.0.0-canary-6892",
46
+ "@docusaurus/types": "4.0.0-canary-6893",
47
47
  "@types/escape-html": "^1.0.4",
48
48
  "@types/estree": "^1.0.9",
49
49
  "@types/mdast": "^4.0.4",
@@ -64,5 +64,5 @@
64
64
  "engines": {
65
65
  "node": ">=24.21"
66
66
  },
67
- "gitHead": "a28eee9700a9a7eab87344e7144546bfd0b57961"
67
+ "gitHead": "4034eb0170f49b59b9d4e5f34425045beb0074e5"
68
68
  }
@@ -9,11 +9,12 @@ import {createProcessors} from './processor';
9
9
  import type {Options} from './options';
10
10
  import type {RuleSetRule, RuleSetUseItem} from 'webpack';
11
11
 
12
- type CreateOptions = {
13
- useCrossCompilerCache?: boolean;
14
- };
12
+ // Escape hatch to disable the MDX cross-compiler cache, just in case
13
+ // TODO Docusaurus v5: remove this escape hatch env variable
14
+ const DisableCrossCompilerCache =
15
+ process.env.DOCUSAURUS_NO_MDX_CROSS_COMPILER_CACHE === 'true';
15
16
 
16
- function normalizeOptions(optionsInput: Options & CreateOptions): Options {
17
+ function normalizeOptions(optionsInput: Options): Options {
17
18
  // Skip eager processor creation in tests
18
19
  if (process.env.NODE_ENV === 'test' || process.env.VITEST) {
19
20
  return optionsInput;
@@ -31,7 +32,7 @@ function normalizeOptions(optionsInput: Options & CreateOptions): Options {
31
32
  // We don't want to cache in dev mode (docusaurus start)
32
33
  // We only have multiple compilers in production mode (docusaurus build)
33
34
  // TODO wrong but good enough for now (example: "docusaurus build --dev")
34
- if (options.useCrossCompilerCache && process.env.NODE_ENV === 'production') {
35
+ if (!DisableCrossCompilerCache && process.env.NODE_ENV === 'production') {
35
36
  options = {
36
37
  ...options,
37
38
  crossCompilerCache: new Map(),
@@ -41,9 +42,7 @@ function normalizeOptions(optionsInput: Options & CreateOptions): Options {
41
42
  return options;
42
43
  }
43
44
 
44
- export function createMDXLoaderItem(
45
- options: Options & CreateOptions,
46
- ): RuleSetUseItem {
45
+ export function createMDXLoaderItem(options: Options): RuleSetUseItem {
47
46
  return {
48
47
  loader: require.resolve('./index'),
49
48
  options: normalizeOptions(options),
@@ -55,7 +54,7 @@ export function createMDXLoaderRule({
55
54
  options,
56
55
  }: {
57
56
  include: RuleSetRule['include'];
58
- options: Options & CreateOptions;
57
+ options: Options;
59
58
  }): RuleSetRule {
60
59
  return {
61
60
  test: /\.mdx?$/i,