Skip to content

Commit b8adf8d

Browse files
authored
v1 release (#11)
* Prep for v1 release * v1.0.0-alpha.2 * Add test for using inline as a value on an object * Version bump * Add indented object example spec, update readme with breaking changes, added dedent library to format template strings * Publish 1.0.0-alpha.4 * v1.0.0
1 parent bc777be commit b8adf8d

File tree

17 files changed

+3111
-1864
lines changed

17 files changed

+3111
-1864
lines changed

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"proseWrap": "always",
3+
"trailingComma": "all",
4+
"tabWidth": 2,
5+
"semi": false,
6+
"singleQuote": true
7+
}

__fixtures__/basic-example/code.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { inline } from 'inline-mdx.macro'
1+
/** @jsx mdx */
2+
import {mdx} from '@mdx-js/react'
3+
import { inline } from '../../inline-mdx.macro'
24

35
const SomeMDXComponent = inline`
46
Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,67 @@
1-
const SomeMDXComponent = ({
2-
components,
3-
...props
4-
}) => <MDXTag name="wrapper" components={components}><MDXTag name="h2" components={components}>{`This is some MDX source`}</MDXTag>
5-
<SomeComponent />
6-
<MDXTag name="p" components={components}><MDXTag name="del" components={components} parentName="p">{`strikethrough`}</MDXTag></MDXTag></MDXTag>;
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react';
3+
4+
const SomeMDXComponent = function () {
5+
function _objectWithoutProperties(source, excluded) {
6+
if (source == null) return {};
7+
8+
var target = _objectWithoutPropertiesLoose(source, excluded);
9+
10+
var key, i;
11+
12+
if (Object.getOwnPropertySymbols) {
13+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
14+
15+
for (i = 0; i < sourceSymbolKeys.length; i++) {
16+
key = sourceSymbolKeys[i];
17+
if (excluded.indexOf(key) >= 0) continue;
18+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
19+
target[key] = source[key];
20+
}
21+
}
22+
23+
return target;
24+
}
25+
26+
function _objectWithoutPropertiesLoose(source, excluded) {
27+
if (source == null) return {};
28+
var target = {};
29+
var sourceKeys = Object.keys(source);
30+
var key, i;
31+
32+
for (i = 0; i < sourceKeys.length; i++) {
33+
key = sourceKeys[i];
34+
if (excluded.indexOf(key) >= 0) continue;
35+
target[key] = source[key];
36+
}
37+
38+
return target;
39+
}
40+
/* @jsx mdx */
41+
42+
43+
const makeShortcode = name => function MDXDefaultShortcode(props) {
44+
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
45+
return <div {...props} />;
46+
};
47+
48+
const SomeComponent = makeShortcode("SomeComponent");
49+
const layoutProps = {};
50+
const MDXLayout = "wrapper";
51+
52+
function MDXContent(_ref) {
53+
let {
54+
components
55+
} = _ref,
56+
props = _objectWithoutProperties(_ref, ["components"]);
57+
58+
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
59+
<h2>{`This is some MDX source`}</h2>
60+
<SomeComponent mdxType="SomeComponent" />
61+
<p><del parentName="p">{`strikethrough`}</del></p>
62+
</MDXLayout>;
63+
}
64+
65+
MDXContent.isMDXComponent = true;
66+
return MDXContent;
67+
}();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react'
3+
import { inline } from '../../inline-mdx.macro'
4+
5+
const key = 'property'
6+
7+
const object = {
8+
[key]: inline`
9+
## This is some MDX source
10+
11+
<SomeComponent />
12+
13+
~~strikethrough~~
14+
`,
15+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react';
3+
const key = 'property';
4+
const object = {
5+
[key]: function () {
6+
function _objectWithoutProperties(source, excluded) {
7+
if (source == null) return {};
8+
9+
var target = _objectWithoutPropertiesLoose(source, excluded);
10+
11+
var key, i;
12+
13+
if (Object.getOwnPropertySymbols) {
14+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
15+
16+
for (i = 0; i < sourceSymbolKeys.length; i++) {
17+
key = sourceSymbolKeys[i];
18+
if (excluded.indexOf(key) >= 0) continue;
19+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20+
target[key] = source[key];
21+
}
22+
}
23+
24+
return target;
25+
}
26+
27+
function _objectWithoutPropertiesLoose(source, excluded) {
28+
if (source == null) return {};
29+
var target = {};
30+
var sourceKeys = Object.keys(source);
31+
var key, i;
32+
33+
for (i = 0; i < sourceKeys.length; i++) {
34+
key = sourceKeys[i];
35+
if (excluded.indexOf(key) >= 0) continue;
36+
target[key] = source[key];
37+
}
38+
39+
return target;
40+
}
41+
/* @jsx mdx */
42+
43+
44+
const makeShortcode = name => function MDXDefaultShortcode(props) {
45+
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
46+
return <div {...props} />;
47+
};
48+
49+
const SomeComponent = makeShortcode("SomeComponent");
50+
const layoutProps = {};
51+
const MDXLayout = "wrapper";
52+
53+
function MDXContent(_ref) {
54+
let {
55+
components
56+
} = _ref,
57+
props = _objectWithoutProperties(_ref, ["components"]);
58+
59+
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
60+
<h2>{`This is some MDX source`}</h2>
61+
<SomeComponent mdxType="SomeComponent" />
62+
<p><del parentName="p">{`strikethrough`}</del></p>
63+
</MDXLayout>;
64+
}
65+
66+
MDXContent.isMDXComponent = true;
67+
return MDXContent;
68+
}()
69+
};

__fixtures__/imports-example/code.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { inline, imports } from 'inline-mdx.macro'
2-
imports()
1+
/** @jsx mdx */
2+
import {mdx} from '@mdx-js/react'
3+
import { inline } from '../../inline-mdx.macro'
34

45
const SomeMDXComponent = inline`
56
Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,71 @@
1-
import { MDXTag } from '@mdx-js/tag';
21
import Foo from './foo';
32
import Another from './another';
43

5-
const SomeMDXComponent = ({
6-
components,
7-
...props
8-
}) => <MDXTag name="wrapper" components={components}><MDXTag name="h2" components={components}>{`This is some MDX source`}</MDXTag>
9-
<SomeComponent />
10-
<MDXTag name="p" components={components}><MDXTag name="del" components={components} parentName="p">{`strikethrough`}</MDXTag></MDXTag></MDXTag>;
4+
/** @jsx mdx */
5+
import { mdx } from '@mdx-js/react';
6+
7+
const SomeMDXComponent = function () {
8+
function _objectWithoutProperties(source, excluded) {
9+
if (source == null) return {};
10+
11+
var target = _objectWithoutPropertiesLoose(source, excluded);
12+
13+
var key, i;
14+
15+
if (Object.getOwnPropertySymbols) {
16+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
17+
18+
for (i = 0; i < sourceSymbolKeys.length; i++) {
19+
key = sourceSymbolKeys[i];
20+
if (excluded.indexOf(key) >= 0) continue;
21+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
22+
target[key] = source[key];
23+
}
24+
}
25+
26+
return target;
27+
}
28+
29+
function _objectWithoutPropertiesLoose(source, excluded) {
30+
if (source == null) return {};
31+
var target = {};
32+
var sourceKeys = Object.keys(source);
33+
var key, i;
34+
35+
for (i = 0; i < sourceKeys.length; i++) {
36+
key = sourceKeys[i];
37+
if (excluded.indexOf(key) >= 0) continue;
38+
target[key] = source[key];
39+
}
40+
41+
return target;
42+
}
43+
/* @jsx mdx */
44+
45+
46+
const makeShortcode = name => function MDXDefaultShortcode(props) {
47+
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
48+
return <div {...props} />;
49+
};
50+
51+
const SomeComponent = makeShortcode("SomeComponent");
52+
const layoutProps = {};
53+
const MDXLayout = "wrapper";
54+
55+
function MDXContent(_ref) {
56+
let {
57+
components
58+
} = _ref,
59+
props = _objectWithoutProperties(_ref, ["components"]);
60+
61+
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
62+
<h2>{`This is some MDX source`}</h2>
63+
<SomeComponent mdxType="SomeComponent" />
64+
65+
<p><del parentName="p">{`strikethrough`}</del></p>
66+
</MDXLayout>;
67+
}
68+
69+
MDXContent.isMDXComponent = true;
70+
return MDXContent;
71+
}();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react'
3+
import { inline } from '../../inline-mdx.macro'
4+
5+
const object = {
6+
property: inline`
7+
## This is some MDX source
8+
9+
<SomeComponent />
10+
11+
~~strikethrough~~
12+
`,
13+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react';
3+
const object = {
4+
property: function () {
5+
function _objectWithoutProperties(source, excluded) {
6+
if (source == null) return {};
7+
8+
var target = _objectWithoutPropertiesLoose(source, excluded);
9+
10+
var key, i;
11+
12+
if (Object.getOwnPropertySymbols) {
13+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
14+
15+
for (i = 0; i < sourceSymbolKeys.length; i++) {
16+
key = sourceSymbolKeys[i];
17+
if (excluded.indexOf(key) >= 0) continue;
18+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
19+
target[key] = source[key];
20+
}
21+
}
22+
23+
return target;
24+
}
25+
26+
function _objectWithoutPropertiesLoose(source, excluded) {
27+
if (source == null) return {};
28+
var target = {};
29+
var sourceKeys = Object.keys(source);
30+
var key, i;
31+
32+
for (i = 0; i < sourceKeys.length; i++) {
33+
key = sourceKeys[i];
34+
if (excluded.indexOf(key) >= 0) continue;
35+
target[key] = source[key];
36+
}
37+
38+
return target;
39+
}
40+
/* @jsx mdx */
41+
42+
43+
const makeShortcode = name => function MDXDefaultShortcode(props) {
44+
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
45+
return <div {...props} />;
46+
};
47+
48+
const SomeComponent = makeShortcode("SomeComponent");
49+
const layoutProps = {};
50+
const MDXLayout = "wrapper";
51+
52+
function MDXContent(_ref) {
53+
let {
54+
components
55+
} = _ref,
56+
props = _objectWithoutProperties(_ref, ["components"]);
57+
58+
return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
59+
<h2>{`This is some MDX source`}</h2>
60+
<SomeComponent mdxType="SomeComponent" />
61+
<p><del parentName="p">{`strikethrough`}</del></p>
62+
</MDXLayout>;
63+
}
64+
65+
MDXContent.isMDXComponent = true;
66+
return MDXContent;
67+
}()
68+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @jsx mdx */
2+
import { mdx } from '@mdx-js/react'
3+
import { inline } from '../../inline-mdx.macro'
4+
5+
const object = {
6+
property: {
7+
nested: {
8+
foo: inline`
9+
## This is some MDX source
10+
11+
<SomeComponent />
12+
13+
import Foo from './foo';
14+
import Another from './another';
15+
16+
~~strikethrough~~
17+
`,
18+
},
19+
},
20+
}

0 commit comments

Comments
 (0)