Skip to content

Commit

Permalink
v1 release (#11)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hamlim authored Sep 21, 2019
1 parent bc777be commit b8adf8d
Show file tree
Hide file tree
Showing 17 changed files with 3,111 additions and 1,864 deletions.
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"proseWrap": "always",
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
4 changes: 3 additions & 1 deletion __fixtures__/basic-example/code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { inline } from 'inline-mdx.macro'
/** @jsx mdx */
import {mdx} from '@mdx-js/react'
import { inline } from '../../inline-mdx.macro'

const SomeMDXComponent = inline`
Expand Down
73 changes: 67 additions & 6 deletions __fixtures__/basic-example/output.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
const SomeMDXComponent = ({
components,
...props
}) => <MDXTag name="wrapper" components={components}><MDXTag name="h2" components={components}>{`This is some MDX source`}</MDXTag>
<SomeComponent />
<MDXTag name="p" components={components}><MDXTag name="del" components={components} parentName="p">{`strikethrough`}</MDXTag></MDXTag></MDXTag>;
/** @jsx mdx */
import { mdx } from '@mdx-js/react';

const SomeMDXComponent = function () {
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

var target = _objectWithoutPropertiesLoose(source, excluded);

var key, i;

if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return target;
}
/* @jsx mdx */


const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
return <div {...props} />;
};

const SomeComponent = makeShortcode("SomeComponent");
const layoutProps = {};
const MDXLayout = "wrapper";

function MDXContent(_ref) {
let {
components
} = _ref,
props = _objectWithoutProperties(_ref, ["components"]);

return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<h2>{`This is some MDX source`}</h2>
<SomeComponent mdxType="SomeComponent" />
<p><del parentName="p">{`strikethrough`}</del></p>
</MDXLayout>;
}

MDXContent.isMDXComponent = true;
return MDXContent;
}();
15 changes: 15 additions & 0 deletions __fixtures__/dynamic-object-key-example/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @jsx mdx */
import { mdx } from '@mdx-js/react'
import { inline } from '../../inline-mdx.macro'

const key = 'property'

const object = {
[key]: inline`
## This is some MDX source
<SomeComponent />
~~strikethrough~~
`,
}
69 changes: 69 additions & 0 deletions __fixtures__/dynamic-object-key-example/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/** @jsx mdx */
import { mdx } from '@mdx-js/react';
const key = 'property';
const object = {
[key]: function () {
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

var target = _objectWithoutPropertiesLoose(source, excluded);

var key, i;

if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return target;
}
/* @jsx mdx */


const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
return <div {...props} />;
};

const SomeComponent = makeShortcode("SomeComponent");
const layoutProps = {};
const MDXLayout = "wrapper";

function MDXContent(_ref) {
let {
components
} = _ref,
props = _objectWithoutProperties(_ref, ["components"]);

return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<h2>{`This is some MDX source`}</h2>
<SomeComponent mdxType="SomeComponent" />
<p><del parentName="p">{`strikethrough`}</del></p>
</MDXLayout>;
}

MDXContent.isMDXComponent = true;
return MDXContent;
}()
};
5 changes: 3 additions & 2 deletions __fixtures__/imports-example/code.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { inline, imports } from 'inline-mdx.macro'
imports()
/** @jsx mdx */
import {mdx} from '@mdx-js/react'
import { inline } from '../../inline-mdx.macro'

const SomeMDXComponent = inline`
Expand Down
75 changes: 68 additions & 7 deletions __fixtures__/imports-example/output.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,71 @@
import { MDXTag } from '@mdx-js/tag';
import Foo from './foo';
import Another from './another';

const SomeMDXComponent = ({
components,
...props
}) => <MDXTag name="wrapper" components={components}><MDXTag name="h2" components={components}>{`This is some MDX source`}</MDXTag>
<SomeComponent />
<MDXTag name="p" components={components}><MDXTag name="del" components={components} parentName="p">{`strikethrough`}</MDXTag></MDXTag></MDXTag>;
/** @jsx mdx */
import { mdx } from '@mdx-js/react';

const SomeMDXComponent = function () {
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

var target = _objectWithoutPropertiesLoose(source, excluded);

var key, i;

if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return target;
}
/* @jsx mdx */


const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
return <div {...props} />;
};

const SomeComponent = makeShortcode("SomeComponent");
const layoutProps = {};
const MDXLayout = "wrapper";

function MDXContent(_ref) {
let {
components
} = _ref,
props = _objectWithoutProperties(_ref, ["components"]);

return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<h2>{`This is some MDX source`}</h2>
<SomeComponent mdxType="SomeComponent" />

<p><del parentName="p">{`strikethrough`}</del></p>
</MDXLayout>;
}

MDXContent.isMDXComponent = true;
return MDXContent;
}();
13 changes: 13 additions & 0 deletions __fixtures__/object-key-example/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @jsx mdx */
import { mdx } from '@mdx-js/react'
import { inline } from '../../inline-mdx.macro'

const object = {
property: inline`
## This is some MDX source
<SomeComponent />
~~strikethrough~~
`,
}
68 changes: 68 additions & 0 deletions __fixtures__/object-key-example/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/** @jsx mdx */
import { mdx } from '@mdx-js/react';
const object = {
property: function () {
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

var target = _objectWithoutPropertiesLoose(source, excluded);

var key, i;

if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return target;
}
/* @jsx mdx */


const makeShortcode = name => function MDXDefaultShortcode(props) {
console.warn("Component " + name + " was not imported, exported, or provided by MDXProvider as global scope");
return <div {...props} />;
};

const SomeComponent = makeShortcode("SomeComponent");
const layoutProps = {};
const MDXLayout = "wrapper";

function MDXContent(_ref) {
let {
components
} = _ref,
props = _objectWithoutProperties(_ref, ["components"]);

return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
<h2>{`This is some MDX source`}</h2>
<SomeComponent mdxType="SomeComponent" />
<p><del parentName="p">{`strikethrough`}</del></p>
</MDXLayout>;
}

MDXContent.isMDXComponent = true;
return MDXContent;
}()
};
20 changes: 20 additions & 0 deletions __fixtures__/object-key-indented-example/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @jsx mdx */
import { mdx } from '@mdx-js/react'
import { inline } from '../../inline-mdx.macro'

const object = {
property: {
nested: {
foo: inline`
## This is some MDX source
<SomeComponent />
import Foo from './foo';
import Another from './another';
~~strikethrough~~
`,
},
},
}
Loading

0 comments on commit b8adf8d

Please sign in to comment.