This commit is contained in:
26
node_modules/@react-dnd/invariant/.github/workflows/nodejs.yml
generated
vendored
Normal file
26
node_modules/@react-dnd/invariant/.github/workflows/nodejs.yml
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x, 10.x, 12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
yarn install
|
||||
yarn build
|
||||
yarn test
|
||||
env:
|
||||
CI: true
|
||||
69
node_modules/@react-dnd/invariant/CHANGELOG.md
generated
vendored
Normal file
69
node_modules/@react-dnd/invariant/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
2.2.4 / 2018-03-13
|
||||
==================
|
||||
|
||||
* Use flow strict mode (i.e. `@flow strict`).
|
||||
|
||||
2.2.3 / 2018-02-19
|
||||
==================
|
||||
|
||||
* Change license from BSD+Patents to MIT.
|
||||
|
||||
2.2.2 / 2016-11-15
|
||||
==================
|
||||
|
||||
* Add LICENSE file.
|
||||
* Misc housekeeping.
|
||||
|
||||
2.2.1 / 2016-03-09
|
||||
==================
|
||||
|
||||
* Use `NODE_ENV` variable instead of `__DEV__` to cache `process.env.NODE_ENV`.
|
||||
|
||||
2.2.0 / 2015-11-17
|
||||
==================
|
||||
|
||||
* Use `error.name` instead of `Invariant Violation`.
|
||||
|
||||
2.1.3 / 2015-11-17
|
||||
==================
|
||||
|
||||
* Remove `@provideModule` pragma.
|
||||
|
||||
2.1.2 / 2015-10-27
|
||||
==================
|
||||
|
||||
* Fix license.
|
||||
|
||||
2.1.1 / 2015-09-20
|
||||
==================
|
||||
|
||||
* Use correct SPDX license.
|
||||
* Test "browser.js" using browserify.
|
||||
* Switch from "envify" to "loose-envify".
|
||||
|
||||
2.1.0 / 2015-06-03
|
||||
==================
|
||||
|
||||
* Add "envify" as a dependency.
|
||||
* Fixed license field in "package.json".
|
||||
|
||||
2.0.0 / 2015-02-21
|
||||
==================
|
||||
|
||||
* Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production.
|
||||
|
||||
1.0.2 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Added tests, npmignore and gitignore.
|
||||
* Clarifications in README.
|
||||
|
||||
1.0.1 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Actually include 'invariant.js'.
|
||||
|
||||
1.0.0 / 2014-09-24
|
||||
==================
|
||||
|
||||
* Initial release.
|
||||
21
node_modules/@react-dnd/invariant/LICENSE
generated
vendored
Normal file
21
node_modules/@react-dnd/invariant/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-present, Facebook, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
39
node_modules/@react-dnd/invariant/README.md
generated
vendored
Normal file
39
node_modules/@react-dnd/invariant/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# invariant
|
||||
|
||||
[](https://actions-badge.atrox.dev/react-dnd/invariant/goto)
|
||||
|
||||
A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)).
|
||||
|
||||
A way to provide descriptive errors in development but generic errors in production.
|
||||
|
||||
## Note: This has been forked by react-dnd for ESM and TypeScript support
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm install invariant
|
||||
```
|
||||
|
||||
## `invariant(condition, message)`
|
||||
|
||||
```js
|
||||
var invariant = require('invariant');
|
||||
|
||||
invariant(someTruthyVal, 'This will not throw');
|
||||
// No errors
|
||||
|
||||
invariant(someFalseyVal, 'This will throw an error with this message');
|
||||
// Error: Invariant Violation: This will throw an error with this message
|
||||
```
|
||||
|
||||
**Note:** When `process.env.NODE_ENV` is not `production`, the message is required. If omitted, `invariant` will throw regardless of the truthiness of the condition. When `process.env.NODE_ENV` is `production`, the message is optional – so they can be minified away.
|
||||
|
||||
### Browser
|
||||
|
||||
When used with [browserify](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/envify) transform will inline the value of `process.env.NODE_ENV`.
|
||||
|
||||
### Node
|
||||
|
||||
The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `process.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812)
|
||||
11
node_modules/@react-dnd/invariant/dist/index.d.ts
generated
vendored
Normal file
11
node_modules/@react-dnd/invariant/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
export declare function invariant(condition: any, format: string, ...args: any[]): void;
|
||||
8
node_modules/@react-dnd/invariant/dist/index.js
generated
vendored
Normal file
8
node_modules/@react-dnd/invariant/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./invariant.cjs.production.min.js')
|
||||
} else {
|
||||
module.exports = require('./invariant.cjs.development.js')
|
||||
}
|
||||
44
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js
generated
vendored
Normal file
44
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
function invariant(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
{
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.invariant = invariant;
|
||||
//# sourceMappingURL=invariant.cjs.development.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.development.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":";;AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;EAChB;QACrCD,MAAM,KAAKE,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACJ,SAAL,EAAgB;QACVK,KAAJ;;QACIJ,MAAM,KAAKE,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNH,MAAM,CAACM,OAAP,CAAe,KAAf,EAAsB;eACbL,IAAI,CAACI,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}
|
||||
2
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js
generated
vendored
Normal file
2
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";exports.invariant=function(r,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(!r){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var t=0;(a=new Error(e.replace(/%s/g,(function(){return i[t++]})))).name="Invariant Violation"}throw a.framesToPop=1,a}};
|
||||
//# sourceMappingURL=invariant.cjs.production.min.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.cjs.production.min.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["condition","format","args","error","undefined","Error","argIndex","replace","name","framesToPop"],"mappings":"wCAW0BA,EAAgBC,8BAAmBC,mCAAAA,wBAOtDF,EAAW,KACVG,UACWC,IAAXH,EACFE,EAAQ,IAAIE,MACV,qIAGG,KACDC,EAAW,GACfH,EAAQ,IAAIE,MACVJ,EAAOM,QAAQ,OAAO,kBACbL,EAAKI,UAGVE,KAAO,4BAGdL,EAAcM,YAAc,EACvBN"}
|
||||
42
node_modules/@react-dnd/invariant/dist/invariant.esm.js
generated
vendored
Normal file
42
node_modules/@react-dnd/invariant/dist/invariant.esm.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
function invariant(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export { invariant };
|
||||
//# sourceMappingURL=invariant.esm.js.map
|
||||
1
node_modules/@react-dnd/invariant/dist/invariant.esm.js.map
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/invariant.esm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"invariant.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nexport function invariant(condition: any, format: string, ...args: any[]) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n let argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() {\n return args[argIndex++];\n })\n );\n error.name = 'Invariant Violation';\n }\n\n (error as any).framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n"],"names":["invariant","condition","format","args","process","env","NODE_ENV","undefined","Error","error","argIndex","replace","name","framesToPop"],"mappings":"AAAA;;;;;;;;;;AAWA,SAAgBA,UAAUC,WAAgBC;oCAAmBC;IAAAA;;;MACvDC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;QACrCJ,MAAM,KAAKK,SAAf,EAA0B;YAClB,IAAIC,KAAJ,CAAU,8CAAV,CAAN;;;;MAIA,CAACP,SAAL,EAAgB;QACVQ,KAAJ;;QACIP,MAAM,KAAKK,SAAf,EAA0B;MACxBE,KAAK,GAAG,IAAID,KAAJ,CACN,uEACE,6DAFI,CAAR;KADF,MAKO;UACDE,QAAQ,GAAG,CAAf;MACAD,KAAK,GAAG,IAAID,KAAJ,CACNN,MAAM,CAACS,OAAP,CAAe,KAAf,EAAsB;eACbR,IAAI,CAACO,QAAQ,EAAT,CAAX;OADF,CADM,CAAR;MAKAD,KAAK,CAACG,IAAN,GAAa,qBAAb;;;IAGDH,KAAa,CAACI,WAAd,GAA4B,CAA5B,CAjBa;;UAkBRJ,KAAN;;;;;;"}
|
||||
1
node_modules/@react-dnd/invariant/dist/test/development.spec.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/test/development.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
node_modules/@react-dnd/invariant/dist/test/production.spec.d.ts
generated
vendored
Normal file
1
node_modules/@react-dnd/invariant/dist/test/production.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
41
node_modules/@react-dnd/invariant/package.json
generated
vendored
Normal file
41
node_modules/@react-dnd/invariant/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@react-dnd/invariant",
|
||||
"version": "2.0.0",
|
||||
"private": false,
|
||||
"description": "invariantx",
|
||||
"keywords": [
|
||||
"test",
|
||||
"invariant"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": "Andres Suarez <zertosh@gmail.com>",
|
||||
"repository": "https://github.com/react-dnd/invariant",
|
||||
"scripts": {
|
||||
"start": "tsdx watch",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"lint": "tsdx lint"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "tsdx lint"
|
||||
}
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.23",
|
||||
"husky": "^3.1.0",
|
||||
"tsdx": "^0.11.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "^3.7.2"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/invariant.esm.js",
|
||||
"typings": "dist/index.d.ts"
|
||||
}
|
||||
39
node_modules/@react-dnd/invariant/src/index.ts
generated
vendored
Normal file
39
node_modules/@react-dnd/invariant/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
export function invariant(condition: any, format: string, ...args: any[]) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
let error;
|
||||
if (format === undefined) {
|
||||
error = new Error(
|
||||
'Minified exception occurred; use the non-minified dev environment ' +
|
||||
'for the full error message and additional helpful warnings.'
|
||||
);
|
||||
} else {
|
||||
let argIndex = 0;
|
||||
error = new Error(
|
||||
format.replace(/%s/g, function() {
|
||||
return args[argIndex++];
|
||||
})
|
||||
);
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
(error as any).framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
35
node_modules/@react-dnd/invariant/test/development.spec.ts
generated
vendored
Normal file
35
node_modules/@react-dnd/invariant/test/development.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import invariant from '../src';
|
||||
|
||||
describe('development mode', () => {
|
||||
const OLD_ENV = process.env;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules(); // this is important - it clears the cache
|
||||
process.env = { ...OLD_ENV };
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = OLD_ENV;
|
||||
});
|
||||
|
||||
it('works', () => {
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
expect(function() {
|
||||
invariant(true, 'invariant message');
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
invariant(false, 'invariant message');
|
||||
}).toThrow(/invariant message/);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(true);
|
||||
}).toThrow(/requires an error/i);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(false);
|
||||
}).toThrow(/requires an error/i);
|
||||
});
|
||||
});
|
||||
35
node_modules/@react-dnd/invariant/test/production.spec.ts
generated
vendored
Normal file
35
node_modules/@react-dnd/invariant/test/production.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import invariant from '../src';
|
||||
|
||||
describe('production mode', () => {
|
||||
const OLD_ENV = process.env;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules(); // this is important - it clears the cache
|
||||
process.env = { ...OLD_ENV };
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env = OLD_ENV;
|
||||
});
|
||||
|
||||
it('works', () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
expect(function() {
|
||||
invariant(true, 'invariant message');
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
invariant(false, 'invariant message');
|
||||
}).toThrow(/invariant message/);
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(true);
|
||||
}).not.toThrow();
|
||||
|
||||
expect(function() {
|
||||
(invariant as any)(false);
|
||||
}).toThrow(/minified exception occurred/i);
|
||||
});
|
||||
});
|
||||
30
node_modules/@react-dnd/invariant/tsconfig.json
generated
vendored
Normal file
30
node_modules/@react-dnd/invariant/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"include": ["src", "types", "test"],
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "esnext"],
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user