Skip to content

Commit

Permalink
Get rid of CJS rollup plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 13, 2020
1 parent cd1eaea commit 6a8af43
Show file tree
Hide file tree
Showing 4 changed files with 869 additions and 85 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"preversion": "yarn build && yarn test",
"version": "git add index.html dist/",
"postversion": "git push",
"postinstall": "patch-package",
"test": "node --unhandled-rejections=strict scripts/test.js dist/"
},
"author": "Antoine du HAMEL",
Expand All @@ -27,7 +28,6 @@
"@babel/core": "^7.7.4",
"@babel/preset-modules": "^0.1.1",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-json": "^4.0.0",
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-typescript": "^4.0.0",
Expand All @@ -36,6 +36,7 @@
"cssnano-preset-advanced": "^4.0.7",
"fibers": "^5.0.0",
"jsdom": "^16.0.0",
"patch-package": "^6.2.2",
"pdf-parse": "^1.1.1",
"postcss": "^7.0.23",
"puppeteer": "^3.0.4",
Expand Down
55 changes: 55 additions & 0 deletions patches/prop-types+15.7.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/node_modules/prop-types/factoryWithThrowingShims.js b/node_modules/prop-types/factoryWithThrowingShims.js
index e5b2f9c..bd572a3 100644
--- a/node_modules/prop-types/factoryWithThrowingShims.js
+++ b/node_modules/prop-types/factoryWithThrowingShims.js
@@ -4,16 +4,13 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-
-'use strict';
-
-var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
+import ReactPropTypesSecret from'./lib/ReactPropTypesSecret.js';

function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;

-module.exports = function() {
+export default function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
diff --git a/node_modules/prop-types/index.js b/node_modules/prop-types/index.js
index e9ef51d..023c589 100644
--- a/node_modules/prop-types/index.js
+++ b/node_modules/prop-types/index.js
@@ -5,15 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

-if (process.env.NODE_ENV !== 'production') {
- var ReactIs = require('react-is');
+import factory from './factoryWithThrowingShims.js';

- // By explicitly using `prop-types` you are opting into new development behavior.
- // http://fb.me/prop-types-in-prod
- var throwOnDirectAccess = true;
- module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);
-} else {
- // By explicitly using `prop-types` you are opting into new production behavior.
- // http://fb.me/prop-types-in-prod
- module.exports = require('./factoryWithThrowingShims')();
-}
+export default factory();
diff --git a/node_modules/prop-types/lib/ReactPropTypesSecret.js b/node_modules/prop-types/lib/ReactPropTypesSecret.js
index f54525e..b127604 100644
--- a/node_modules/prop-types/lib/ReactPropTypesSecret.js
+++ b/node_modules/prop-types/lib/ReactPropTypesSecret.js
@@ -9,4 +9,4 @@

var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

-module.exports = ReactPropTypesSecret;
+export default ReactPropTypesSecret;
3 changes: 1 addition & 2 deletions scripts/dev-build-js.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import path from "path";

import resolve from "@rollup/plugin-node-resolve";
import commonJs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import typescript from "@rollup/plugin-typescript";
import { rollup } from "rollup";
import sass from "./rollup-plugin-sass.mjs";
import { INPUT_DIR } from "./dev-config.mjs";

const plugins = [typescript(), resolve(), commonJs(), json(), sass()];
const plugins = [typescript(), resolve(), json(), sass()];

let cache;

Expand Down
Loading

0 comments on commit 6a8af43

Please sign in to comment.