Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: switch to xdm * things work now * Update src/index.ts Co-authored-by: Titus <tituswormer@gmail.com> Co-authored-by: Titus <tituswormer@gmail.com> BREAKING CHANGE: We've switched from @mdx-js/js to xdm which is more capable, faster, and requires no runtime! We've also moved to an `xdmOptions` function to customize all the options for compilation rather than simply accepting a `remarkPlugins` option. Check the docs for the latest way to configure things. This is hopefully the last breaking change and we'll enter a pretty stable state from here on out.
- Loading branch information
1 parent
01149e9
commit c49e165
Showing
10 changed files
with
132 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
const configs = require('kcd-scripts/config') | ||
|
||
const esModules = [ | ||
'xdm', | ||
'unist-util-position-from-estree', | ||
'estree-walker', | ||
'periscopic', | ||
'remark-mdx-frontmatter', | ||
'js-yaml', | ||
].join('|') | ||
|
||
module.exports = Object.assign(configs.jest, { | ||
testEnvironment: './tests/jest.environment.js', | ||
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+/`], | ||
transform: { | ||
'^.+\\.(js|ts|jsx|tsx|cjs|mjs)$': './tests/transform.js', | ||
}, | ||
resolver: 'jest-module-field-resolver', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// because jest + TS + native es modules don't like each other, we have to keep | ||
// native es modules disabled and compile esm to cjs for the packages that are esm | ||
// total bummer... | ||
const path = require('path') | ||
const {transformSync} = require('esbuild') | ||
|
||
const extnameToLoader = { | ||
mjs: 'js', | ||
cjs: 'js', | ||
} | ||
|
||
module.exports = { | ||
process(src, filename) { | ||
const ext = path.extname(filename).slice(1) | ||
const result = transformSync(src, { | ||
loader: extnameToLoader[ext] || ext, | ||
sourcemap: true, | ||
format: 'cjs', | ||
}) | ||
return result | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.