From e4b676b1be7bcc5d2c8fa38738ff8d1659f72648 Mon Sep 17 00:00:00 2001 From: Artem Zverev Date: Sat, 23 Mar 2024 20:41:44 +0100 Subject: [PATCH] fix tests --- .../should work with destructuration/input.js | 1 + .../should work with destructuration/output.js | 15 ++++++++------- .../with webpackChunkName/should keep it/input.js | 1 + .../should keep it/output.js | 15 ++++++++------- .../should replace it/input.js | 1 + .../should replace it/output.js | 15 ++++++++------- .../should support complex request/input.js | 1 + .../should support complex request/output.js | 15 ++++++++------- .../should support destructuring/input.js | 1 + .../should support destructuring/output.js | 15 ++++++++------- .../should support simple request/input.js | 1 + .../should support simple request/output.js | 15 ++++++++------- .../should be transpiled too/input.js | 1 + .../should be transpiled too/output.js | 15 ++++++++------- .../in a complex promise/should work/input.js | 1 + .../in a complex promise/should work/output.js | 15 ++++++++------- .../input.js | 1 + .../output.js | 15 ++++++++------- .../should work with mul in name/input.js | 1 + .../should work with mul in name/output.js | 15 ++++++++------- .../should work with plus concatenation/input.js | 1 + .../should work with plus concatenation/output.js | 15 ++++++++------- .../should work with template literal/input.js | 1 + .../should work with template literal/output.js | 15 ++++++++------- .../should add it/input.js | 1 + .../should add it/output.js | 15 ++++++++------- .../input.js | 1 + .../output.js | 15 ++++++++------- .../should use it/input.js | 1 + .../should use it/output.js | 15 ++++++++------- 30 files changed, 135 insertions(+), 105 deletions(-) diff --git a/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/input.js b/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/input.js index bd7c3b470..43e76bddc 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(({ foo }) => import(/* webpackChunkName: "Pages" */ `./${foo}`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/output.js b/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/output.js index ccc18964a..37c00e0cb 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName ({ foo }) { + chunkName({ foo }) { return `${foo}`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ({ foo })=>import(/*webpackChunkName: "[request]"*/ `./${foo}`), - requireAsync (props) { + importAsync: ({ foo }) => import(/*webpackChunkName: "[request]"*/ `./${foo}`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve ({ foo }) { + resolve({ foo }) { if (require.resolveWeak) { return require.resolveWeak(`./${foo}`); } diff --git a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/input.js b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/input.js index fb942b47c..1e037c182 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(props => import(/* webpackChunkName: "pages/[request]" */ `./pages/${props.path}`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/output.js b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/output.js index 88c405e44..26c21231c 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName (props) { + chunkName(props) { return "pages/" + props.path.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: (props)=>import(/*webpackChunkName: "pages/[request]"*/ `./pages/${props.path}`), - requireAsync (props) { + importAsync: (props) => import(/*webpackChunkName: "pages/[request]"*/ `./pages/${props.path}`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve (props) { + resolve(props) { if (require.resolveWeak) { return require.resolveWeak(`./pages/${props.path}`); } diff --git a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/input.js b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/input.js index 4c1a80b5f..1cd027260 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(props => import(/* webpackChunkName: "Pages" */ `./${props.foo}`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/output.js b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/output.js index 8c8713376..11a62011e 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName (props) { + chunkName(props) { return `${props.foo}`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: (props)=>import(/*webpackChunkName: "[request]"*/ `./${props.foo}`), - requireAsync (props) { + importAsync: (props) => import(/*webpackChunkName: "[request]"*/ `./${props.foo}`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve (props) { + resolve(props) { if (require.resolveWeak) { return require.resolveWeak(`./${props.foo}`); } diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/input.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/input.js index f5cf40583..ab21d048e 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(props => import(`./dir/${props.foo}/test`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/output.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/output.js index bbc95bbe1..89d9c3239 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName (props) { + chunkName(props) { return `dir-${props.foo}-test`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: (props)=>import(/*webpackChunkName: "dir-[request]"*/ `./dir/${props.foo}/test`), - requireAsync (props) { + importAsync: (props) => import(/*webpackChunkName: "dir-[request]"*/ `./dir/${props.foo}/test`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve (props) { + resolve(props) { if (require.resolveWeak) { return require.resolveWeak(`./dir/${props.foo}/test`); } diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/input.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/input.js index 956fbfa5e..1b0185920 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(({ foo }) => import(`./dir/${foo}/test`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/output.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/output.js index eba8f031e..aa0fc8d61 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName ({ foo }) { + chunkName({ foo }) { return `dir-${foo}-test`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ({ foo })=>import(/*webpackChunkName: "dir-[request]"*/ `./dir/${foo}/test`), - requireAsync (props) { + importAsync: ({ foo }) => import(/*webpackChunkName: "dir-[request]"*/ `./dir/${foo}/test`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve ({ foo }) { + resolve({ foo }) { if (require.resolveWeak) { return require.resolveWeak(`./dir/${foo}/test`); } diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/input.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/input.js index b08cc51a2..b131624ab 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/input.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(props => import(`./${props.foo}`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/output.js b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/output.js index 8c8713376..11a62011e 100644 --- a/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/output.js +++ b/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName (props) { + chunkName(props) { return `${props.foo}`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: (props)=>import(/*webpackChunkName: "[request]"*/ `./${props.foo}`), - requireAsync (props) { + importAsync: (props) => import(/*webpackChunkName: "[request]"*/ `./${props.foo}`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve (props) { + resolve(props) { if (require.resolveWeak) { return require.resolveWeak(`./${props.foo}`); } diff --git a/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/input.js b/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/input.js index c0a34798a..07b10bf26 100644 --- a/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/input.js +++ b/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable.lib(() => import('moment')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/output.js b/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/output.js index 5d95fcbe4..90eb1e47a 100644 --- a/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/output.js +++ b/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable.lib({ resolved: {}, - chunkName () { + chunkName() { return "moment"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable.lib({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "moment"*/ 'moment'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "moment"*/ 'moment'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('moment'); } diff --git a/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/input.js b/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/input.js index bf764ed35..335741639 100644 --- a/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/input.js +++ b/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => timeout(import('./ModA'), 2000)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/output.js b/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/output.js index 6985ad145..0ae11bf40 100644 --- a/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/output.js +++ b/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return "ModA"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>timeout(import(/*webpackChunkName: "ModA"*/ './ModA'), 2000), - requireAsync (props) { + importAsync: () => timeout(import(/*webpackChunkName: "ModA"*/ './ModA'), 2000), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('./ModA'); } diff --git a/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/input.js b/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/input.js index 1820f1de1..e3625c4d8 100644 --- a/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/input.js +++ b/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import('../foo/bar')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/output.js b/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/output.js index 6c5c90aa5..8530e78a8 100644 --- a/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/output.js +++ b/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return "foo-bar"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "foo-bar"*/ '../foo/bar'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "foo-bar"*/ '../foo/bar'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('../foo/bar'); } diff --git a/packages/loadable-components/tests/fixture/simple import/should work with mul in name/input.js b/packages/loadable-components/tests/fixture/simple import/should work with mul in name/input.js index 01ead9027..10975150a 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with mul in name/input.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with mul in name/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import(`./foo*`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/should work with mul in name/output.js b/packages/loadable-components/tests/fixture/simple import/should work with mul in name/output.js index a046e67e4..eb732a0a4 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with mul in name/output.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with mul in name/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return `foo`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "foo"*/ `./foo*`), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "foo"*/ `./foo*`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak(`./foo*`); } diff --git a/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/input.js b/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/input.js index f0f766c82..c48d088cc 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/input.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import('./Mod' + 'A')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/output.js b/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/output.js index b42e052c8..b923576c5 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/output.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return ""; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: ""*/ './Mod' + 'A'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: ""*/ './Mod' + 'A'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('./Mod' + 'A'); } diff --git a/packages/loadable-components/tests/fixture/simple import/should work with template literal/input.js b/packages/loadable-components/tests/fixture/simple import/should work with template literal/input.js index 38f27c79a..9845c7992 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with template literal/input.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with template literal/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import(`./ModA`)) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/should work with template literal/output.js b/packages/loadable-components/tests/fixture/simple import/should work with template literal/output.js index bca81ae28..1554cb453 100644 --- a/packages/loadable-components/tests/fixture/simple import/should work with template literal/output.js +++ b/packages/loadable-components/tests/fixture/simple import/should work with template literal/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return `ModA`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, "-"); }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "ModA"*/ `./ModA`), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "ModA"*/ `./ModA`), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak(`./ModA`); } diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/input.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/input.js index 18f1d67e3..ffc1d2660 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/input.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import('./ModA')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/output.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/output.js index 675f94977..b23df66ca 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/output.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return "ModA"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "ModA"*/ './ModA'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "ModA"*/ './ModA'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('./ModA'); } diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/input.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/input.js index dfcc94d64..a70fc80fd 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/input.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import(/* webpackPrefetch: true, webpackChunkName: "ChunkA" */ './ModA')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/output.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/output.js index bc2d71a3f..ef969cd0b 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/output.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return "ChunkA"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "ChunkA", webpackPrefetch: "true"*/ './ModA'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "ChunkA", webpackPrefetch: "true"*/ './ModA'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('./ModA'); } diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/input.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/input.js index 55c3343d9..fbc80c9ea 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/input.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/input.js @@ -1 +1,2 @@ +import loadable from '@loadable/component'; loadable(() => import(/* webpackChunkName: "ChunkA" */ './ModA')) \ No newline at end of file diff --git a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/output.js b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/output.js index e0ece3fe7..2aa7bd63a 100644 --- a/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/output.js +++ b/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/output.js @@ -1,9 +1,10 @@ +import loadable from '@loadable/component'; loadable({ resolved: {}, - chunkName () { + chunkName() { return "ChunkA"; }, - isReady (props) { + isReady(props) { const key = this.resolve(props); if (this.resolved[key] !== true) { return false; @@ -13,23 +14,23 @@ loadable({ } return false; }, - importAsync: ()=>import(/*webpackChunkName: "ChunkA"*/ './ModA'), - requireAsync (props) { + importAsync: () => import(/*webpackChunkName: "ChunkA"*/ './ModA'), + requireAsync(props) { const key = this.resolve(props); this.resolved[key] = false; - return this.importAsync(props).then((resolved)=>{ + return this.importAsync(props).then((resolved) => { this.resolved[key] = true; return resolved; }); }, - requireSync (props) { + requireSync(props) { const id = this.resolve(props); if (typeof __webpack_require__ !== 'undefined') { return __webpack_require__(id); } return eval('module.require')(id); }, - resolve () { + resolve() { if (require.resolveWeak) { return require.resolveWeak('./ModA'); }