Skip to content

Commit f30d6c4

Browse files
authored
add hints why things crashed, improve middleware composition
1 parent e46b4e3 commit f30d6c4

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lastui/rocker",
3-
"version": "0.19.38",
3+
"version": "0.19.39",
44
"license": "Apache-2.0",
55
"author": "[email protected]",
66
"homepage": "https://github.com/lastui/rocker#readme",

platform/src/kernel/middleware/__tests__/loader.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe("loader middleware", () => {
8383
const actual = createLoaderMiddleware()()(next)(action);
8484
expect(actual).toEqual(action);
8585

86-
expect(spy).toHaveBeenLastCalledWith("dynamic middleware errored", new Error("ouch"));
86+
expect(spy).toHaveBeenLastCalledWith("loader middleware errored", new Error("ouch"));
8787
});
8888

8989
describe("SET_AVAILABLE_MODULES", () => {

platform/src/kernel/middleware/dynamic.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getStore } from "../registry/store";
66
const createDynamicMiddlewares = () => {
77
let keys = [];
88
let values = [];
9+
let composition = compose();
910

1011
const injectMiddleware = async (name, middleware) => {
1112
const index = keys.indexOf(name);
@@ -19,6 +20,7 @@ const createDynamicMiddlewares = () => {
1920
keys.push(name);
2021
values.push(instance(getStore()));
2122
}
23+
composition = compose.apply(null, values);
2224
return true;
2325
};
2426

@@ -29,14 +31,16 @@ const createDynamicMiddlewares = () => {
2931
}
3032
keys = keys.filter((_, idx) => idx !== index);
3133
values = values.filter((_, idx) => idx !== index);
34+
composition = compose.apply(null, values);
3235
return true;
3336
};
3437

3538
return {
3639
underlying: (_store) => (next) => (action) => {
3740
try {
38-
return compose.apply(null, values)(next)(action);
41+
return composition(next)(action);
3942
} catch (error) {
43+
// TODO try to do "module {name} dynamic middleware errored"
4044
warning("dynamic middleware errored", error);
4145
return next(action);
4246
}

platform/src/kernel/middleware/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const createLoaderMiddleware = () => {
112112
}
113113
}
114114
} catch (error) {
115-
warning("dynamic middleware errored", error);
115+
warning("loader middleware errored", error);
116116
return next(action);
117117
}
118118
};

webpack/internal/build.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ module.exports = {
5858
sourceMap: false,
5959
toplevel: false,
6060
parse: {
61-
ecma: 2021,
61+
ecma: 2023,
6262
html5_comments: false,
6363
},
6464
compress: {
65-
ecma: 2021,
65+
ecma: 2023,
6666
warnings: false,
6767
comparisons: false,
6868
inline: 2,
@@ -73,7 +73,7 @@ module.exports = {
7373
drop_debugger: true,
7474
},
7575
output: {
76-
ecma: 5,
76+
ecma: 2023,
7777
comments: false,
7878
ascii_only: true,
7979
indent_level: 0,

0 commit comments

Comments
 (0)