Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
Closes GH-1938.
Closes GH-1963.
Closes GH-1977.
  • Loading branch information
wooorm committed Mar 16, 2022
1 parent 656a4ae commit 46fae4f
Show file tree
Hide file tree
Showing 15 changed files with 2,756 additions and 2,469 deletions.
2 changes: 1 addition & 1 deletion docs/_component/foot-site.server.js
Expand Up @@ -23,7 +23,7 @@ export const FootSite = () => (
</small>
<br />
<small>
Site on <a href={new URL('./docs/', config.ghTree).href}>GitHub</a>
Site on <a href={new URL('docs/', config.ghTree).href}>GitHub</a>
</small>
<br />
<small>
Expand Down
8 changes: 4 additions & 4 deletions docs/_config.js
Expand Up @@ -3,12 +3,12 @@ const git = new URL('../', import.meta.url)
const gh = new URL('https://github.com/mdx-js/mdx/')

export const config = {
input: new URL('./docs/', git),
output: new URL('./public/', git),
input: new URL('docs/', git),
output: new URL('public/', git),
git,
gh,
ghBlob: new URL('./blob/main/', gh),
ghTree: new URL('./tree/main/', gh),
ghBlob: new URL('blob/main/', gh),
ghTree: new URL('tree/main/', gh),
site,
twitter: new URL('https://twitter.com/mdx_js'),
oc: new URL('https://opencollective.com/unified'),
Expand Down
5,035 changes: 2,663 additions & 2,372 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -69,7 +69,7 @@
"react-error-boundary": "^3.0.0",
"react-fetch": "0.0.0-experimental-7ec4c5597",
"react-server-dom-webpack": "0.0.0-experimental-7ec4c5597",
"react-tabs": "^3.0.0",
"react-tabs": "^4.0.0",
"react-use-clipboard": "^1.0.0",
"rehype-autolink-headings": "^6.0.0",
"rehype-document": "^6.0.0",
Expand Down Expand Up @@ -113,7 +113,7 @@
"xast-util-feed": "^1.0.0",
"xast-util-sitemap": "^1.0.0",
"xast-util-to-xml": "^3.0.0",
"xo": "^0.47.0"
"xo": "^0.48.0"
},
"scripts": {
"postinstall": "patch-package",
Expand Down
130 changes: 63 additions & 67 deletions packages/esbuild/test/index.test.js
Expand Up @@ -14,21 +14,21 @@ import {test} from 'uvu'
import * as assert from 'uvu/assert'
import esbuild from 'esbuild'
import React from 'react'
import {renderToStaticMarkup} from 'react-dom/server.js'
import {renderToStaticMarkup} from 'react-dom/server'
import esbuildMdx from '../index.js'

test('@mdx-js/esbuild', async () => {
// MDX.
await fs.writeFile(
new URL('./esbuild.mdx', import.meta.url),
new URL('esbuild.mdx', import.meta.url),
'export const Message = () => <>World!</>\n\n# Hello, <Message />'
)

await esbuild.build({
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
entryPoints: [fileURLToPath(new URL('./esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(new URL('./esbuild.js', import.meta.url)),
entryPoints: [fileURLToPath(new URL('esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(new URL('esbuild.js', import.meta.url)),
format: 'esm',
plugins: [esbuildMdx()]
})
Expand All @@ -44,30 +44,30 @@ test('@mdx-js/esbuild', async () => {
'should compile'
)

await fs.unlink(new URL('./esbuild.mdx', import.meta.url))
await fs.unlink(new URL('./esbuild.js', import.meta.url))
await fs.unlink(new URL('esbuild.mdx', import.meta.url))
await fs.unlink(new URL('esbuild.js', import.meta.url))

// Resolve directory.
await fs.writeFile(
new URL('./esbuild-resolve.mdx', import.meta.url),
new URL('esbuild-resolve.mdx', import.meta.url),
'import Content from "./folder/file.mdx"\n\n<Content/>'
)
await fs.mkdir(new URL('./folder', import.meta.url))
await fs.mkdir(new URL('folder', import.meta.url))
await fs.writeFile(
new URL('./folder/file.mdx', import.meta.url),
new URL('folder/file.mdx', import.meta.url),
'import {data} from "./file.js"\n\n{data}'
)
await fs.writeFile(
new URL('./folder/file.js', import.meta.url),
new URL('folder/file.js', import.meta.url),
'export const data = 0.1'
)
await esbuild.build({
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
entryPoints: [
fileURLToPath(new URL('./esbuild-resolve.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-resolve.mdx', import.meta.url))
],
outfile: fileURLToPath(new URL('./esbuild-resolve.js', import.meta.url)),
outfile: fileURLToPath(new URL('esbuild-resolve.js', import.meta.url)),
format: 'esm',
plugins: [esbuildMdx()]
})
Expand All @@ -82,18 +82,18 @@ test('@mdx-js/esbuild', async () => {
'should compile'
)

await fs.unlink(new URL('./esbuild-resolve.mdx', import.meta.url))
await fs.unlink(new URL('./esbuild-resolve.js', import.meta.url))
await fs.rmdir(new URL('./folder/', import.meta.url), {recursive: true})
await fs.unlink(new URL('esbuild-resolve.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-resolve.js', import.meta.url))
await fs.rmdir(new URL('folder/', import.meta.url), {recursive: true})

// Markdown.
await fs.writeFile(new URL('./esbuild.md', import.meta.url), '\ta')
await fs.writeFile(new URL('esbuild.md', import.meta.url), '\ta')

await esbuild.build({
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
entryPoints: [fileURLToPath(new URL('./esbuild.md', import.meta.url))],
outfile: fileURLToPath(new URL('./esbuild-md.js', import.meta.url)),
entryPoints: [fileURLToPath(new URL('esbuild.md', import.meta.url))],
outfile: fileURLToPath(new URL('esbuild-md.js', import.meta.url)),
format: 'esm',
plugins: [esbuildMdx()]
})
Expand All @@ -108,17 +108,17 @@ test('@mdx-js/esbuild', async () => {
'should compile `.md`'
)

await fs.unlink(new URL('./esbuild.md', import.meta.url))
await fs.unlink(new URL('./esbuild-md.js', import.meta.url))
await fs.unlink(new URL('esbuild.md', import.meta.url))
await fs.unlink(new URL('esbuild-md.js', import.meta.url))

// `.md` as MDX extension.
await fs.writeFile(new URL('./esbuild.md', import.meta.url), '\ta')
await fs.writeFile(new URL('esbuild.md', import.meta.url), '\ta')

await esbuild.build({
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
entryPoints: [fileURLToPath(new URL('./esbuild.md', import.meta.url))],
outfile: fileURLToPath(new URL('./esbuild-md-as-mdx.js', import.meta.url)),
entryPoints: [fileURLToPath(new URL('esbuild.md', import.meta.url))],
outfile: fileURLToPath(new URL('esbuild-md-as-mdx.js', import.meta.url)),
format: 'esm',
plugins: [esbuildMdx({mdExtensions: [], mdxExtensions: ['.md']})]
})
Expand All @@ -133,20 +133,18 @@ test('@mdx-js/esbuild', async () => {
'should compile `.md` as MDX w/ configuration'
)

await fs.unlink(new URL('./esbuild.md', import.meta.url))
await fs.unlink(new URL('./esbuild-md-as-mdx.js', import.meta.url))
await fs.unlink(new URL('esbuild.md', import.meta.url))
await fs.unlink(new URL('esbuild-md-as-mdx.js', import.meta.url))

// File not in `extnames`:
await fs.writeFile(new URL('./esbuild.md', import.meta.url), 'a')
await fs.writeFile(new URL('./esbuild.mdx', import.meta.url), 'a')
await fs.writeFile(new URL('esbuild.md', import.meta.url), 'a')
await fs.writeFile(new URL('esbuild.mdx', import.meta.url), 'a')

console.log('\nnote: the following error is expected!\n')
try {
await esbuild.build({
entryPoints: [fileURLToPath(new URL('./esbuild.md', import.meta.url))],
outfile: fileURLToPath(
new URL('./esbuild-md-as-mdx.js', import.meta.url)
),
entryPoints: [fileURLToPath(new URL('esbuild.md', import.meta.url))],
outfile: fileURLToPath(new URL('esbuild-md-as-mdx.js', import.meta.url)),
plugins: [esbuildMdx({format: 'mdx'})]
})
assert.unreachable()
Expand All @@ -161,10 +159,8 @@ test('@mdx-js/esbuild', async () => {
console.log('\nnote: the following error is expected!\n')
try {
await esbuild.build({
entryPoints: [fileURLToPath(new URL('./esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(
new URL('./esbuild-md-as-mdx.js', import.meta.url)
),
entryPoints: [fileURLToPath(new URL('esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(new URL('esbuild-md-as-mdx.js', import.meta.url)),
plugins: [esbuildMdx({format: 'md'})]
})
assert.unreachable()
Expand All @@ -176,22 +172,22 @@ test('@mdx-js/esbuild', async () => {
)
}

await fs.unlink(new URL('./esbuild.md', import.meta.url))
await fs.unlink(new URL('./esbuild.mdx', import.meta.url))
await fs.unlink(new URL('esbuild.md', import.meta.url))
await fs.unlink(new URL('esbuild.mdx', import.meta.url))

console.log('\nnote: the following errors and warnings are expected!\n')

await fs.writeFile(
new URL('./esbuild-broken.mdx', import.meta.url),
new URL('esbuild-broken.mdx', import.meta.url),
'asd <https://example.com>?'
)

try {
await esbuild.build({
entryPoints: [
fileURLToPath(new URL('./esbuild-broken.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-broken.mdx', import.meta.url))
],
outfile: fileURLToPath(new URL('./esbuild.js', import.meta.url)),
outfile: fileURLToPath(new URL('esbuild.js', import.meta.url)),
plugins: [esbuildMdx()]
})
assert.unreachable('esbuild should throw')
Expand Down Expand Up @@ -219,19 +215,19 @@ test('@mdx-js/esbuild', async () => {
)
}

await fs.unlink(new URL('./esbuild-broken.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-broken.mdx', import.meta.url))

await fs.writeFile(
new URL('./esbuild-warnings.mdx', import.meta.url),
new URL('esbuild-warnings.mdx', import.meta.url),
'export const Message = () => <>World!</>\n\n# Hello, <Message />'
)

try {
await esbuild.build({
entryPoints: [
fileURLToPath(new URL('./esbuild-warnings.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-warnings.mdx', import.meta.url))
],
outfile: fileURLToPath(new URL('./esbuild-warnings.js', import.meta.url)),
outfile: fileURLToPath(new URL('esbuild-warnings.js', import.meta.url)),
format: 'esm',
plugins: [
esbuildMdx({
Expand Down Expand Up @@ -386,20 +382,20 @@ test('@mdx-js/esbuild', async () => {
)
}

await fs.unlink(new URL('./esbuild-warnings.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-warnings.mdx', import.meta.url))

await fs.writeFile(
new URL('./esbuild-plugin-crash.mdx', import.meta.url),
new URL('esbuild-plugin-crash.mdx', import.meta.url),
'# hi'
)

try {
await esbuild.build({
entryPoints: [
fileURLToPath(new URL('./esbuild-plugin-crash.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-plugin-crash.mdx', import.meta.url))
],
outfile: fileURLToPath(
new URL('./esbuild-plugin-crash.js', import.meta.url)
new URL('esbuild-plugin-crash.js', import.meta.url)
),
format: 'esm',
plugins: [
Expand Down Expand Up @@ -449,25 +445,25 @@ test('@mdx-js/esbuild', async () => {
)
}

await fs.unlink(new URL('./esbuild-plugin-crash.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-plugin-crash.mdx', import.meta.url))

console.log('\nnote: the preceding errors and warnings are expected!\n')

/** @type {(contents: string) => import('esbuild').Plugin} */
const inlinePlugin = (contents) => ({
name: 'inline plugin',
setup: (build) => {
setup(build) {
build.onResolve({filter: /esbuild\.mdx/}, () => ({
path: fileURLToPath(new URL('./esbuild.mdx', import.meta.url)),
path: fileURLToPath(new URL('esbuild.mdx', import.meta.url)),
pluginData: {contents}
}))
}
})

await esbuild.build({
entryPoints: [fileURLToPath(new URL('./esbuild.mdx', import.meta.url))],
entryPoints: [fileURLToPath(new URL('esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(
new URL('./esbuild-compile-from-memory.js', import.meta.url)
new URL('esbuild-compile-from-memory.js', import.meta.url)
),
plugins: [inlinePlugin(`# Test`), esbuildMdx()],
define: {'process.env.NODE_ENV': '"development"'},
Expand All @@ -485,12 +481,12 @@ test('@mdx-js/esbuild', async () => {
'should compile from `pluginData.content`'
)

await fs.unlink(new URL('./esbuild-compile-from-memory.js', import.meta.url))
await fs.unlink(new URL('esbuild-compile-from-memory.js', import.meta.url))

await esbuild.build({
entryPoints: [fileURLToPath(new URL('./esbuild.mdx', import.meta.url))],
entryPoints: [fileURLToPath(new URL('esbuild.mdx', import.meta.url))],
outfile: fileURLToPath(
new URL('./esbuild-compile-from-memory-empty.js', import.meta.url)
new URL('esbuild-compile-from-memory-empty.js', import.meta.url)
),
plugins: [inlinePlugin(``), esbuildMdx()],
define: {'process.env.NODE_ENV': '"development"'},
Expand All @@ -509,21 +505,21 @@ test('@mdx-js/esbuild', async () => {
)

await fs.unlink(
new URL('./esbuild-compile-from-memory-empty.js', import.meta.url)
new URL('esbuild-compile-from-memory-empty.js', import.meta.url)
)

// Remote markdown.
await fs.writeFile(
new URL('./esbuild-with-remote-md.mdx', import.meta.url),
new URL('esbuild-with-remote-md.mdx', import.meta.url),
'import Content from "https://raw.githubusercontent.com/mdx-js/mdx/main/packages/esbuild/test/files/md-file.md"\n\n<Content />'
)

await esbuild.build({
entryPoints: [
fileURLToPath(new URL('./esbuild-with-remote-md.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-with-remote-md.mdx', import.meta.url))
],
outfile: fileURLToPath(
new URL('./esbuild-with-remote-md.js', import.meta.url)
new URL('esbuild-with-remote-md.js', import.meta.url)
),
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
Expand All @@ -541,21 +537,21 @@ test('@mdx-js/esbuild', async () => {
'should compile remote markdown files w/ `allowDangerousRemoteMdx`'
)

await fs.unlink(new URL('./esbuild-with-remote-md.mdx', import.meta.url))
await fs.unlink(new URL('./esbuild-with-remote-md.js', import.meta.url))
await fs.unlink(new URL('esbuild-with-remote-md.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-with-remote-md.js', import.meta.url))

// Remote MDX importing more markdown.
await fs.writeFile(
new URL('./esbuild-with-remote-mdx.mdx', import.meta.url),
new URL('esbuild-with-remote-mdx.mdx', import.meta.url),
'import Content from "https://raw.githubusercontent.com/mdx-js/mdx/main/packages/esbuild/test/files/mdx-file-importing-markdown.mdx"\n\n<Content />'
)

await esbuild.build({
entryPoints: [
fileURLToPath(new URL('./esbuild-with-remote-mdx.mdx', import.meta.url))
fileURLToPath(new URL('esbuild-with-remote-mdx.mdx', import.meta.url))
],
outfile: fileURLToPath(
new URL('./esbuild-with-remote-mdx.js', import.meta.url)
new URL('esbuild-with-remote-mdx.js', import.meta.url)
),
bundle: true,
define: {'process.env.NODE_ENV': '"development"'},
Expand All @@ -573,8 +569,8 @@ test('@mdx-js/esbuild', async () => {
'should compile remote MD, MDX, and JS files w/ `allowDangerousRemoteMdx`'
)

await fs.unlink(new URL('./esbuild-with-remote-mdx.mdx', import.meta.url))
await fs.unlink(new URL('./esbuild-with-remote-mdx.js', import.meta.url))
await fs.unlink(new URL('esbuild-with-remote-mdx.mdx', import.meta.url))
await fs.unlink(new URL('esbuild-with-remote-mdx.js', import.meta.url))
})

test.run()

1 comment on commit 46fae4f

@vercel
Copy link

@vercel vercel bot commented on 46fae4f Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.