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

Embed React and ReactDOM instead of packages from unpkg [skip test] #13002

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/_frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"@floating-ui/react-dom-interactions": "^0.6.3",
"classnames": "^2.3.1",
"downshift": "^6.1.7",
"preact": "^10.7.0"
"preact": "^10.7.0",
"react": "17",
"react-dom": "17"
}
}
3 changes: 1 addition & 2 deletions docs/_frontend/src/models/FilterForm/FilterForm.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createElement as e } from 'react';
import Select from '../Select';
import './FilterForm.css';
import { products, productDisplayName } from '../ModelItem/utils';

const { createElement: e } = React;

const removeAloneEditions = (editions) => {
const groups = {};
editions.forEach((edition) => {
Expand Down
3 changes: 1 addition & 2 deletions docs/_frontend/src/models/Form/Form.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { createElement as e } from 'react';
import SearchForm from '../SearchForm';
import FilterForm from '../FilterForm';

const { createElement: e } = React;

const Form = ({ onSubmit, isLoading, params, meta }) => {
return [
e(SearchForm, {
Expand Down
4 changes: 3 additions & 1 deletion docs/_frontend/src/models/ModelItemList/ModelItemList.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';
import { createPortal } from 'react-dom';
import Pagination from '../Pagination';
import Sidebar from '../Sidebar';
import './ModelItemList.css';
Expand All @@ -24,7 +26,7 @@ const ModelItemList = ({
onSupportedToggle(flag);
};

return ReactDOM.createPortal(
return createPortal(
<div key="items" className="grid--container model-items">
<div className="model-items__sidebar-wrapper">
<div className="model-items__sidebar">
Expand Down
2 changes: 1 addition & 1 deletion docs/_frontend/src/models/ModelItemTag/ModelItemTag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { createElement: e } = React;
import { createElement as e } from 'react';

const ModelItemTag = ({ icon, name, value }) => {
return e('div', { className: 'model-item__tag' }, [
Expand Down
2 changes: 1 addition & 1 deletion docs/_frontend/src/models/Pagination/Pagination.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { createElement: e } = React;
import { createElement as e } from 'react';
import './Pagination.css';

const Pagination = ({ page, totalPages, onChange }) => {
Expand Down
3 changes: 1 addition & 2 deletions docs/_frontend/src/models/SearchForm/SearchForm.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { createElement as e, useState, useEffect } from 'react';
import Spinner from '../Spinner';
import './SearchForm.css';

const { createElement: e, useState, useEffect } = React;

const SearchForm = ({ onSubmit, isLoading, params }) => {
const [value, setValue] = useState('');
useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions docs/_frontend/src/models/Select/Select.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createElement as e, Children } from 'react';
import './Select.css';

const { createElement: e, Children } = React;

const Select = ({
name,
value,
Expand Down
1 change: 1 addition & 0 deletions docs/_frontend/src/models/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import Combobox from '../Combobox';
import Radio from '../Radio/Radio';
import RadioGroup from '../RadioGroup';
Expand Down
2 changes: 1 addition & 1 deletion docs/_frontend/src/models/Spinner/Spinner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { createElement: e } = React;
import { createElement as e } from 'react';

const Spinner = () => e('i', { className: 'fas fa-circle-notch fa-spin' });

Expand Down
5 changes: 3 additions & 2 deletions docs/_frontend/src/models/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { createElement: e } = React;
import React from 'react';
import { render } from 'react-dom';

import App from './App';

ReactDOM.render(e(App), document.getElementById('app'));
render(<App />, document.getElementById('app'));
4 changes: 0 additions & 4 deletions docs/_frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ module.exports = (env, argv) => {
},
],
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
},
devServer: {
port: 9000,
hot: true,
Expand Down
27 changes: 26 additions & 1 deletion docs/_frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3140,7 +3140,7 @@ lodash@^4.17.14:
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

loose-envify@^1.4.0:
loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -4102,6 +4102,15 @@ raw-body@2.4.0:
iconv-lite "0.4.24"
unpipe "1.0.0"

react-dom@17:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"

react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
Expand All @@ -4112,6 +4121,14 @@ react-is@^17.0.2:
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react@17:
Copy link

Choose a reason for hiding this comment

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

Medium Vulnerability:

npm : -/react : 17.0.2

0 Critical, 0 High, 1 Medium, 0 Low vulnerabilities have been found across 1 dependencies.
View the Lift console for details about these vulnerabilities.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

readable-stream@^2.0.1:
version "2.3.7"
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz"
Expand Down Expand Up @@ -4309,6 +4326,14 @@ safe-buffer@~5.2.0:
resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@^2.6.5:
version "2.7.1"
resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz"
Expand Down
4 changes: 1 addition & 3 deletions docs/_layouts/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ <h1>NLP Models Hub</h1>
</div>
</div>

<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script type="text/javascript" src="/static/models.js?t=1639577062227"></script>
<script type="text/javascript" src="/static/models.js?t=1666962246795"></script>

{%- include pageview.html -%}