Skip to content

Commit

Permalink
Change to use exports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 18, 2023
1 parent 780fa02 commit 5a13d73
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 43 deletions.
6 changes: 3 additions & 3 deletions packages/esbuild/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('@mdx-js/mdx/lib/core.js').ProcessorOptions} ProcessorOptions
* @typedef {import('@mdx-js/mdx').ProcessorOptions} ProcessorOptions
* @typedef {import('esbuild').Message} Message
* @typedef {import('esbuild').OnLoadArgs} OnLoadArgs
* @typedef {import('esbuild').OnLoadResult} OnLoadResult
Expand Down Expand Up @@ -46,8 +46,8 @@ import assert from 'node:assert'
import fs from 'node:fs/promises'
import path from 'node:path'
import process from 'node:process'
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
import {extnamesToRegex} from '@mdx-js/mdx/lib/util/extnames-to-regex.js'
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
import {extnamesToRegex} from '@mdx-js/mdx/internal-extnames-to-regex'
import {fetch} from 'undici'
import {VFile} from 'vfile'

Expand Down
3 changes: 1 addition & 2 deletions packages/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import {Buffer} from 'node:buffer'
import {createHash} from 'node:crypto'
import path from 'node:path'
import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
import {SourceMapGenerator} from 'source-map'

// Note: the cache is heavily inspired by:
Expand Down
3 changes: 1 addition & 2 deletions packages/loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.cjs",
"types": "index.d.ts",
"exports": "./index.cjs",
"files": [
"lib/",
"index.cjs",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/mdx/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ import {recmaStringify} from './plugin/recma-stringify.js'
import {rehypeRecma} from './plugin/rehype-recma.js'
import {rehypeRemoveRaw} from './plugin/rehype-remove-raw.js'
import {remarkMarkAndUnravel} from './plugin/remark-mark-and-unravel.js'
import {development as defaultDevelopment} from './condition.js'
import {nodeTypes} from './node-types.js'
import {development as defaultDevelopment} from '#condition'

const removedOptions = [
'compilers',
Expand Down
16 changes: 10 additions & 6 deletions packages/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"browser": {
"./lib/condition.js": "./lib/condition.browser.js"
"exports": {
".": "./index.js",
"./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
"./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js",
"./internal-resolve-evaluate-options": "./lib/util/resolve-evaluate-options.js"
},
"react-native": {
"./lib/condition.js": "./lib/condition.browser.js"
"imports": {
"#condition": {
"node": "./lib/condition.node.js",
"default": "./lib/condition.default.js"
}
},
"files": [
"lib/",
Expand Down
6 changes: 3 additions & 3 deletions packages/node-loader/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @typedef {import('@mdx-js/mdx/lib/compile.js').CompileOptions} Options
* @typedef {import('@mdx-js/mdx').CompileOptions} Options
*/

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

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/node-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @jsxRuntime automatic @jsxImportSource preact */

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

import assert from 'node:assert/strict'
Expand Down
3 changes: 1 addition & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('@mdx-js/mdx/lib/util/resolve-evaluate-options.js').RuntimeProduction} RuntimeProduction
* @typedef {import('@mdx-js/mdx/internal-resolve-evaluate-options').RuntimeProduction} RuntimeProduction
*/

import assert from 'node:assert/strict'
Expand Down
14 changes: 6 additions & 8 deletions packages/register/lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,24 @@
// @ts-expect-error: type imports from CJS do work.
/** @typedef {import('@mdx-js/mdx').EvaluateOptions} EvaluateOptions */
// @ts-expect-error: type imports from CJS do work.
/** @typedef {import('@mdx-js/mdx/lib/run.js')} RunMod */
/** @typedef {import('@mdx-js/mdx')} MdxMod */
// @ts-expect-error: type imports from CJS do work.
/** @typedef {import('@mdx-js/mdx/lib/util/create-format-aware-processors.js')} CreateProcessorMod */
/** @typedef {import('@mdx-js/mdx/internal-create-format-aware-processors')} CreateProcessorMod */
// @ts-expect-error: type imports from CJS do work.
/** @typedef {import('@mdx-js/mdx/lib/util/resolve-evaluate-options.js')} ResolveEvaluateMod */
/** @typedef {import('@mdx-js/mdx/internal-resolve-evaluate-options')} ResolveEvaluateMod */

'use strict'

const fs = require('node:fs')
const deasync = require('deasync')

const {createFormatAwareProcessors} = /** @type {CreateProcessorMod} */ (
deasync(load)('@mdx-js/mdx/lib/util/create-format-aware-processors.js')
deasync(load)('@mdx-js/mdx/internal-create-format-aware-processors')
)
const {resolveEvaluateOptions} = /** @type {ResolveEvaluateMod} */ (
deasync(load)('@mdx-js/mdx/lib/util/resolve-evaluate-options.js')
)
const {runSync} = /** @type {RunMod} */ (
deasync(load)('@mdx-js/mdx/lib/run.js')
deasync(load)('@mdx-js/mdx/internal-resolve-evaluate-options')
)
const {runSync} = /** @type {MdxMod} */ (deasync(load)('@mdx-js/mdx'))

module.exports = register

Expand Down
3 changes: 1 addition & 2 deletions packages/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
],
"type": "module",
"sideEffects": true,
"main": "index.cjs",
"types": "index.d.ts",
"exports": "./index.cjs",
"files": [
"lib/",
"index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/remark-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Configuration.
*/

import {createFormatAwareProcessors} from '@mdx-js/mdx/lib/util/create-format-aware-processors.js'
import {createFormatAwareProcessors} from '@mdx-js/mdx/internal-create-format-aware-processors'
import {createFilter} from '@rollup/pluginutils'
import {SourceMapGenerator} from 'source-map'
import {VFile} from 'vfile'
Expand Down
3 changes: 1 addition & 2 deletions packages/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
],
"type": "module",
"sideEffects": false,
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
Expand Down

0 comments on commit 5a13d73

Please sign in to comment.