Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Themezv committed Mar 23, 2024
1 parent aa5282a commit e4b676b
Show file tree
Hide file tree
Showing 30 changed files with 135 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(({ foo }) => import(/* webpackChunkName: "Pages" */ `./${foo}`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(props => import(/* webpackChunkName: "pages/[request]" */ `./pages/${props.path}`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(props => import(/* webpackChunkName: "Pages" */ `./${props.foo}`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(props => import(`./dir/${props.foo}/test`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(({ foo }) => import(`./dir/${foo}/test`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(props => import(`./${props.foo}`))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable.lib(() => import('moment'))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(() => timeout(import('./ModA'), 2000))
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import loadable from '@loadable/component';
loadable(() => import('../foo/bar'))
Loading

0 comments on commit e4b676b

Please sign in to comment.