Skip to content

Commit 5a13d73

Browse files
committedOct 18, 2023
Change to use exports
1 parent 780fa02 commit 5a13d73

20 files changed

+36
-43
lines changed
 

‎packages/esbuild/lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('@mdx-js/mdx/lib/core.js').ProcessorOptions} ProcessorOptions
2+
* @typedef {import('@mdx-js/mdx').ProcessorOptions} ProcessorOptions
33
* @typedef {import('esbuild').Message} Message
44
* @typedef {import('esbuild').OnLoadArgs} OnLoadArgs
55
* @typedef {import('esbuild').OnLoadResult} OnLoadResult
@@ -46,8 +46,8 @@ import assert from 'node:assert'
4646
import fs from 'node:fs/promises'
4747
import path from 'node:path'
4848
import process from 'node:process'
49-
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
50-
import {extnamesToRegex} from '@mdx-js/mdx/lib/util/extnames-to-regex.js'
49+
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
50+
import {extnamesToRegex} from '@mdx-js/mdx/internal-extnames-to-regex'
5151
import {fetch} from 'undici'
5252
import {VFile} from 'vfile'
5353

‎packages/esbuild/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
],
3131
"type": "module",
3232
"sideEffects": false,
33-
"main": "index.js",
34-
"types": "index.d.ts",
33+
"exports": "./index.js",
3534
"files": [
3635
"lib/",
3736
"index.d.ts",

‎packages/loader/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import {Buffer} from 'node:buffer'
2525
import {createHash} from 'node:crypto'
2626
import path from 'node:path'
27-
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
27+
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
2828
import {SourceMapGenerator} from 'source-map'
2929

3030
// Note: the cache is heavily inspired by:

‎packages/loader/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
],
3636
"type": "module",
3737
"sideEffects": false,
38-
"main": "index.cjs",
39-
"types": "index.d.ts",
38+
"exports": "./index.cjs",
4039
"files": [
4140
"lib/",
4241
"index.cjs",
File renamed without changes.
File renamed without changes.

‎packages/mdx/lib/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import {recmaStringify} from './plugin/recma-stringify.js'
5151
import {rehypeRecma} from './plugin/rehype-recma.js'
5252
import {rehypeRemoveRaw} from './plugin/rehype-remove-raw.js'
5353
import {remarkMarkAndUnravel} from './plugin/remark-mark-and-unravel.js'
54-
import {development as defaultDevelopment} from './condition.js'
5554
import {nodeTypes} from './node-types.js'
55+
import {development as defaultDevelopment} from '#condition'
5656

5757
const removedOptions = [
5858
'compilers',

‎packages/mdx/package.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@
3131
],
3232
"type": "module",
3333
"sideEffects": false,
34-
"main": "index.js",
35-
"types": "index.d.ts",
36-
"browser": {
37-
"./lib/condition.js": "./lib/condition.browser.js"
34+
"exports": {
35+
".": "./index.js",
36+
"./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
37+
"./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js",
38+
"./internal-resolve-evaluate-options": "./lib/util/resolve-evaluate-options.js"
3839
},
39-
"react-native": {
40-
"./lib/condition.js": "./lib/condition.browser.js"
40+
"imports": {
41+
"#condition": {
42+
"node": "./lib/condition.node.js",
43+
"default": "./lib/condition.default.js"
44+
}
4145
},
4246
"files": [
4347
"lib/",

‎packages/node-loader/lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @typedef {import('@mdx-js/mdx/lib/compile.js').CompileOptions} Options
2+
* @typedef {import('@mdx-js/mdx').CompileOptions} Options
33
*/
44

55
import fs from 'node:fs/promises'
6-
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
7-
import {extnamesToRegex} from '@mdx-js/mdx/lib/util/extnames-to-regex.js'
6+
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
7+
import {extnamesToRegex} from '@mdx-js/mdx/internal-extnames-to-regex'
88
import {VFile} from 'vfile'
99

1010
/**

‎packages/node-loader/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
],
3030
"type": "module",
3131
"sideEffects": false,
32-
"main": "index.js",
33-
"types": "index.d.ts",
32+
"exports": "./index.js",
3433
"files": [
3534
"lib/",
3635
"index.d.ts",

‎packages/preact/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
],
3434
"type": "module",
3535
"sideEffects": false,
36-
"main": "index.js",
37-
"types": "index.d.ts",
36+
"exports": "./index.js",
3837
"files": [
3938
"lib/",
4039
"index.d.ts",

‎packages/preact/test/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @jsxRuntime automatic @jsxImportSource preact */
22

33
/**
4-
* @typedef {import('@mdx-js/mdx/lib/util/resolve-evaluate-options.js').RuntimeProduction} RuntimeProduction
4+
* @typedef {import('@mdx-js/mdx/internal-resolve-evaluate-options').RuntimeProduction} RuntimeProduction
55
*/
66

77
import assert from 'node:assert/strict'

‎packages/react/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
],
3333
"type": "module",
3434
"sideEffects": false,
35-
"main": "index.js",
36-
"types": "index.d.ts",
35+
"exports": "./index.js",
3736
"files": [
3837
"lib/",
3938
"index.d.ts",

‎packages/react/test/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('@mdx-js/mdx/lib/util/resolve-evaluate-options.js').RuntimeProduction} RuntimeProduction
2+
* @typedef {import('@mdx-js/mdx/internal-resolve-evaluate-options').RuntimeProduction} RuntimeProduction
33
*/
44

55
import assert from 'node:assert/strict'

‎packages/register/lib/index.cjs

+6-8
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,24 @@
1919
// @ts-expect-error: type imports from CJS do work.
2020
/** @typedef {import('@mdx-js/mdx').EvaluateOptions} EvaluateOptions */
2121
// @ts-expect-error: type imports from CJS do work.
22-
/** @typedef {import('@mdx-js/mdx/lib/run.js')} RunMod */
22+
/** @typedef {import('@mdx-js/mdx')} MdxMod */
2323
// @ts-expect-error: type imports from CJS do work.
24-
/** @typedef {import('@mdx-js/mdx/lib/util/create-format-aware-processors.js')} CreateProcessorMod */
24+
/** @typedef {import('@mdx-js/mdx/internal-create-format-aware-processors')} CreateProcessorMod */
2525
// @ts-expect-error: type imports from CJS do work.
26-
/** @typedef {import('@mdx-js/mdx/lib/util/resolve-evaluate-options.js')} ResolveEvaluateMod */
26+
/** @typedef {import('@mdx-js/mdx/internal-resolve-evaluate-options')} ResolveEvaluateMod */
2727

2828
'use strict'
2929

3030
const fs = require('node:fs')
3131
const deasync = require('deasync')
3232

3333
const {createFormatAwareProcessors} = /** @type {CreateProcessorMod} */ (
34-
deasync(load)('@mdx-js/mdx/lib/util/create-format-aware-processors.js')
34+
deasync(load)('@mdx-js/mdx/internal-create-format-aware-processors')
3535
)
3636
const {resolveEvaluateOptions} = /** @type {ResolveEvaluateMod} */ (
37-
deasync(load)('@mdx-js/mdx/lib/util/resolve-evaluate-options.js')
38-
)
39-
const {runSync} = /** @type {RunMod} */ (
40-
deasync(load)('@mdx-js/mdx/lib/run.js')
37+
deasync(load)('@mdx-js/mdx/internal-resolve-evaluate-options')
4138
)
39+
const {runSync} = /** @type {MdxMod} */ (deasync(load)('@mdx-js/mdx'))
4240

4341
module.exports = register
4442

‎packages/register/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
],
3030
"type": "module",
3131
"sideEffects": true,
32-
"main": "index.cjs",
33-
"types": "index.d.ts",
32+
"exports": "./index.cjs",
3433
"files": [
3534
"lib/",
3635
"index.d.ts",

‎packages/remark-mdx/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
],
3434
"type": "module",
3535
"sideEffects": false,
36-
"main": "index.js",
37-
"types": "index.d.ts",
36+
"exports": "./index.js",
3837
"files": [
3938
"lib/",
4039
"index.d.ts",

‎packages/rollup/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Configuration.
2020
*/
2121

22-
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
22+
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
2323
import {createFilter} from '@rollup/pluginutils'
2424
import {SourceMapGenerator} from 'source-map'
2525
import {VFile} from 'vfile'

‎packages/rollup/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
],
3131
"type": "module",
3232
"sideEffects": false,
33-
"main": "index.js",
34-
"types": "index.d.ts",
33+
"exports": "./index.js",
3534
"files": [
3635
"lib/",
3736
"index.d.ts",

‎packages/vue/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
],
2929
"type": "module",
3030
"sideEffects": false,
31-
"main": "index.js",
32-
"types": "index.d.ts",
31+
"exports": "./index.js",
3332
"files": [
3433
"lib/",
3534
"index.d.ts",

0 commit comments

Comments
 (0)
Please sign in to comment.