Skip to content

Commit

Permalink
Revert "feat: update xdk version to 3.3.4"
Browse files Browse the repository at this point in the history
This reverts commit bf2f847.
  • Loading branch information
TomokiMiyauci committed Feb 6, 2022
1 parent 874e92e commit b2914e5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 58 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,15 @@ Passes the `@mdx-js/mdx#compile` options as is. For details, see

## Note

This plugin depends on [xdm@3.3.4](https://www.npmjs.com/package/xdm/v/3.3.4).
This plugin depends on [xdm@1.12.2](https://www.npmjs.com/package/xdm/v/1.12.2).

However, the dependency of `remark-parse@10.v` will cause an error to be used
with the Deno runtime, so `remark-parse@9.0.0` is used.
After `xdm@1.6.0`, it cannot be used as it is with the Deno runtime from
Registry such as esm.sh and skypack.

Note that this is not the same as `xdm` with Node.js.
Therefore, we are intentionally adjusting the dependencies.

xdm already has a `3.x.x` version, It is not possible to follow the version any
further by simply adjusting the version of the dependencies.

## License

Expand Down
2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export type {
Plugin,
ResolveResult,
} from "https://deno.land/x/aleph@v0.3.0-beta.19/types.d.ts";
export { compile } from "https://esm.sh/xdm@3.3.4?deps=remark-parse@9.0.0&pin=v65";
export { compile } from "https://esm.sh/xdm@1.12.2?deps=unist-util-stringify-position@3.0.0,unist-util-visit@3.0.0";
export { default as util } from "https://deno.land/x/aleph@v0.3.0-beta.19/shared/util.ts";
4 changes: 2 additions & 2 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function mdxLoader(
const { framework } = aleph.config;
const source = new TextDecoder().decode(content);

const { value } = await compile(source, options);
const { contents } = await compile(source, options);

if (framework !== "react") {
throw new Error(
Expand All @@ -100,7 +100,7 @@ export async function mdxLoader(

return {
code: [
value.toString(),
contents.toString(),
...props,
].filter(Boolean).join("\n"),
};
Expand Down
93 changes: 42 additions & 51 deletions mod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,21 @@ test("mdxLoader", async () => {
).resolves.toEqual({
code: `/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
function MDXContent(props = {}) {
let {wrapper: MDXLayout} = props.components || ({});
function MDXContent(props) {
const _components = Object.assign({
h1: "h1",
p: "p"
}, props.components), {wrapper: MDXLayout} = _components;
const _content = _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, {})
})) : _createMdxContent();
function _createMdxContent() {
let _components = Object.assign({
h1: "h1",
p: "p"
}, props.components);
return _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
}
children: _content
})) : _content;
}
export default MDXContent;
`,
Expand All @@ -81,24 +78,21 @@ export default MDXContent;
).resolves.toEqual({
code: `/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
function MDXContent(props = {}) {
let {wrapper: MDXLayout} = props.components || ({});
function MDXContent(props) {
const _components = Object.assign({
h1: "h1",
p: "p"
}, props.components), {wrapper: MDXLayout} = _components;
const _content = _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, {})
})) : _createMdxContent();
function _createMdxContent() {
let _components = Object.assign({
h1: "h1",
p: "p"
}, props.components);
return _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
}
children: _content
})) : _content;
}
export default MDXContent;
Expand All @@ -123,24 +117,21 @@ MDXContent.nav = [{"path":"/"}];`,
).resolves.toEqual({
code: `/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
function MDXContent(props = {}) {
let {wrapper: MDXLayout} = props.components || ({});
function MDXContent(props) {
const _components = Object.assign({
h1: "h1",
p: "p"
}, props.components), {wrapper: MDXLayout} = _components;
const _content = _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, {})
})) : _createMdxContent();
function _createMdxContent() {
let _components = Object.assign({
h1: "h1",
p: "p"
}, props.components);
return _jsxs(_Fragment, {
children: [_jsx(_components.h1, {
children: "aleph-plugin-mdx"
}), "\\n", _jsx(_components.p, {
children: "Aleph plugin for mdx v2"
})]
});
}
children: _content
})) : _content;
}
export default MDXContent;
`,
Expand Down

0 comments on commit b2914e5

Please sign in to comment.