Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users are receiving errors of outdated mdx versions, this fixes those errors. #257

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ information on the current packages:
| [gatsby-plugin-mdx-embed](https://www.npmjs.com/package/gatsby-plugin-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/gatsby-plugin-mdx-embed/badge.svg)](https://snyk.io/test/npm/gatsby-plugin-mdx-embed) |
| [storybook-addon-mdx-embed](https://www.npmjs.com/package/storybook-addon-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/storybook-addon-mdx-embed/badge.svg)](https://snyk.io/test/npm/storybook-addon-mdx-embed) |

<br />

## 🕺 Core Team

Expand Down
4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
},
"postpublish": "npm run deploy"
},
"packages": [
"packages/*"
]
"packages": ["packages/*"]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
},
"name": "mdx-embed",
"devDependencies": {
"cypress": "^5.1.0",
"lerna": "^3.22.1",
"start-server-and-test": "^1.11.3"
"cypress": "^13.5.1",
"lerna": "^7.4.2",
"start-server-and-test": "^2.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-mdx-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
"devDependencies": {
"husky": "^4.2.5"
}
}
}
16 changes: 8 additions & 8 deletions packages/mdx-embed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdx-embed",
"version": "1.1.2",
"name": "mdx-embed2",
"version": "2.0.1",
"description": "Embed 3rd party media content in MDX - no import required",
"main": "dist/index.js",
"types": "./dist/types/index.d.ts",
Expand All @@ -25,14 +25,14 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/PaulieScanlon/mdx-embed.git"
"url": "git+https://github.com/lacymorrow/mdx-embed.git"
},
"author": "Paul Scanlon",
"license": "MIT",
"bugs": {
"url": "https://github.com/PaulieScanlon/mdx-embed/issues"
"url": "https://github.com/lacymorrow/mdx-embed/issues"
},
"homepage": "https://github.com/PaulieScanlon/mdx-embed#readme",
"homepage": "https://github.com/lacymorrow/mdx-embed#readme",
"keywords": [
"mdx",
"mdx-embed"
Expand All @@ -56,7 +56,7 @@
"@types/jest": "^27.4.0",
"@types/mdx-js__react": "^1.5.2",
"@types/node": "^17.0.15",
"@types/react": "18.0.22",
"@types/react": "^18.3.3",
"@types/react-dom": "18.0.7",
"@types/testing-library__dom": "^7.5.0",
"@types/testing-library__jest-dom": "^5.14.5",
Expand All @@ -77,8 +77,8 @@
"typescript": "^3.9.7"
},
"peerDependencies": {
"@mdx-js/mdx": "^1.6.16",
"@mdx-js/react": "^1.6.16",
"@mdx-js/mdx": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"react": "^16.x || ^17.x || ^18.x",
"react-dom": "^16.x || ^17.x || ^18.x"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { AirtableBase } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { AirtableForm } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Buzzsprout } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/cinnamon/cinnamon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Cinnamon } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/codepen/codepen.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { CodePen } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { CodeSandbox } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { EggheadLesson } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/figma/figma.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Figma } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/flickr/flickr.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Flickr } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { GeneralObserver } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FunctionComponent, useRef, useEffect, useState, RefObject } from 'react';
import React, { FunctionComponent, RefObject, useEffect, useRef, useState } from 'react';

interface IGeneralObserverProps {
/** React Children */
Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/gist/gist.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { waitFor, render, screen, act } from '@testing-library/react';
import { render, screen, waitFor } from '@testing-library/react';
import React, { act } from 'react';

import { Gist } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Instagram } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/instagram/utils.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, act } from '@testing-library/react';
import { render } from '@testing-library/react';
import React, { act } from 'react';

import { Instagram } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { LinkedInBadge } from '.';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/pinterest/pin.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Pin } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { PinterestBoard } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { PinterestFollowButton } from './';

Expand Down
6 changes: 3 additions & 3 deletions packages/mdx-embed/src/components/pinterest/utils.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { render, act } from '@testing-library/react';
import { render } from '@testing-library/react';
import React, { act } from 'react';

import { Pin } from '.';
import { pinterestClassNames, handlePinterestBuild } from './utils';
import { handlePinterestBuild, pinterestClassNames } from './utils';

describe('utils', () => {
beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/replit/replit.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Replit } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/snack/snack.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Snack } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { SoundCloud } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/spotify/spotify.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Spotify } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/strava/strava.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Strava } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/tiktok/tiktok.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TikTok } from './';

Expand Down
5 changes: 2 additions & 3 deletions packages/mdx-embed/src/components/twitch/twitch.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';

import { render, screen } from '@testing-library/react';
import React, { act } from 'react';
import { Twitch } from './';

const PARENT_PROP = 'http://localhost:6006/';
Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/twitter/tweet.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Tweet } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TwitterFollowButton } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TwitterHashtagButton } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TwitterList } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TwitterMentionButton } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { TwitterTimeline } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/twitter/utils.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, act } from '@testing-library/react';
import { render } from '@testing-library/react';
import React, { act } from 'react';

import { Tweet } from './';

Expand Down
4 changes: 2 additions & 2 deletions packages/mdx-embed/src/components/vimeo/vimeo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Vimeo } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, act } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { act } from 'react';

import { Whimsical } from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, waitFor, screen, act } from '@testing-library/react';
import { render, screen, waitFor } from '@testing-library/react';
import fetchMock from 'jest-fetch-mock';
import React, { act } from 'react';

import { Wikipedia } from './';

Expand Down
6 changes: 5 additions & 1 deletion packages/mdx-embed/src/components/wikipedia/wikipedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ export const Wikipedia: FunctionComponent<IWikipediaProps> = ({ wikipediaLink, h
.then((response) => response.text())
.then((response) => {
if (response) {
const body = response
.replace(/<a rel="mw:WikiLink"/g, '<a target="_blank" rel="mw:WikiLink"')
.replace(/<a href="\/wiki\/"/g, '<a href="https://en.wikipedia.org/wiki/')
.replace(/\/w\/load.php/g, 'https://en.wikipedia.org/w/');
setWikiResponse({
isLoading: false,
hasError: false,
body: response.replace(/<a rel="mw:WikiLink"/g, '<a target="_blank" rel="mw:WikiLink"'),
body,
});
}

Expand Down
Loading