@modern-js/utils 2.58.4-alpha.2 → 2.60.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cli/index.js +2 -0
- package/dist/cjs/{universal/route.server.js → cli/route.js} +5 -26
- package/dist/esm/cli/index.js +1 -0
- package/dist/esm/cli/is/type.js +3 -2
- package/dist/esm/{universal/route.server.js → cli/route.js} +1 -21
- package/dist/esm/universal/formatWebpack.js +2 -1
- package/dist/esm-node/cli/index.js +1 -0
- package/dist/esm-node/{universal/route.server.js → cli/route.js} +1 -21
- package/dist/types/cli/index.d.ts +1 -0
- package/dist/types/{universal/route.server.d.ts → cli/route.d.ts} +0 -1
- package/package.json +6 -14
- package/dist/cjs/universal/route.js +0 -1
- package/dist/compiled/ajv/codegen.js +0 -1
- package/dist/compiled/ajv/index.js +0 -9
- package/dist/compiled/ajv/license +0 -22
- package/dist/compiled/ajv/package.json +0 -1
- package/dist/compiled/ajv/types/ajv.d.ts +0 -16
- package/dist/compiled/ajv/types/compile/codegen/code.d.ts +0 -40
- package/dist/compiled/ajv/types/compile/codegen/index.d.ts +0 -79
- package/dist/compiled/ajv/types/compile/codegen/scope.d.ts +0 -79
- package/dist/compiled/ajv/types/compile/errors.d.ts +0 -13
- package/dist/compiled/ajv/types/compile/index.d.ts +0 -80
- package/dist/compiled/ajv/types/compile/ref_error.d.ts +0 -6
- package/dist/compiled/ajv/types/compile/resolve.d.ts +0 -12
- package/dist/compiled/ajv/types/compile/rules.d.ts +0 -28
- package/dist/compiled/ajv/types/compile/util.d.ts +0 -40
- package/dist/compiled/ajv/types/compile/validate/index.d.ts +0 -42
- package/dist/compiled/ajv/types/compile/validate/subschema.d.ts +0 -47
- package/dist/compiled/ajv/types/core.d.ts +0 -173
- package/dist/compiled/ajv/types/runtime/validation_error.d.ts +0 -7
- package/dist/compiled/ajv/types/types/index.d.ts +0 -183
- package/dist/compiled/ajv/types/types/json-schema.d.ts +0 -124
- package/dist/compiled/ajv/types/types/jtd-schema.d.ts +0 -169
- package/dist/compiled/ajv/types/vocabularies/errors.d.ts +0 -1
- package/dist/compiled/ajv/uri-js.d.ts +0 -59
- package/dist/compiled/ajv-keywords/index.d.ts +0 -1
- package/dist/compiled/ajv-keywords/index.js +0 -1
- package/dist/compiled/ajv-keywords/license +0 -21
- package/dist/compiled/ajv-keywords/package.json +0 -1
- package/dist/compiled/better-ajv-errors/index.d.ts +0 -1
- package/dist/compiled/better-ajv-errors/index.js +0 -1
- package/dist/compiled/better-ajv-errors/license +0 -13
- package/dist/compiled/better-ajv-errors/package.json +0 -1
- package/dist/compiled/recursive-readdir/index.d.ts +0 -21
- package/dist/compiled/recursive-readdir/index.js +0 -1
- package/dist/compiled/recursive-readdir/license +0 -21
- package/dist/compiled/recursive-readdir/package.json +0 -1
- package/dist/compiled/schema-utils3/index.d.ts +0 -1
- package/dist/compiled/schema-utils3/index.js +0 -3
- package/dist/compiled/schema-utils3/license +0 -20
- package/dist/compiled/schema-utils3/package.json +0 -1
- package/dist/compiled/webpack-dev-middleware/index.js +0 -7
- package/dist/compiled/webpack-dev-middleware/license +0 -20
- package/dist/compiled/webpack-dev-middleware/package.json +0 -1
- package/dist/compiled/webpack-dev-middleware/types/index.d.ts +0 -262
- package/dist/esm/universal/route.js +0 -0
- package/dist/esm-node/universal/route.js +0 -0
- package/dist/types/universal/route.d.ts +0 -0
package/dist/cjs/cli/index.js
CHANGED
@@ -36,6 +36,7 @@ __reExport(cli_exports, require("./runtimeExports"), module.exports);
|
|
36
36
|
__reExport(cli_exports, require("./watch"), module.exports);
|
37
37
|
__reExport(cli_exports, require("./config"), module.exports);
|
38
38
|
__reExport(cli_exports, require("./action"), module.exports);
|
39
|
+
__reExport(cli_exports, require("./route"), module.exports);
|
39
40
|
__reExport(cli_exports, require("./version"), module.exports);
|
40
41
|
// Annotate the CommonJS export names for ESM import in node:
|
41
42
|
0 && (module.exports = {
|
@@ -60,5 +61,6 @@ __reExport(cli_exports, require("./version"), module.exports);
|
|
60
61
|
...require("./watch"),
|
61
62
|
...require("./config"),
|
62
63
|
...require("./action"),
|
64
|
+
...require("./route"),
|
63
65
|
...require("./version")
|
64
66
|
});
|
@@ -16,13 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
return to;
|
17
17
|
};
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var
|
20
|
-
__export(
|
19
|
+
var route_exports = {};
|
20
|
+
__export(route_exports, {
|
21
21
|
filterRoutesForServer: () => filterRoutesForServer,
|
22
|
-
filterRoutesLoader: () => filterRoutesLoader
|
23
|
-
markRoutes: () => markRoutes
|
22
|
+
filterRoutesLoader: () => filterRoutesLoader
|
24
23
|
});
|
25
|
-
module.exports = __toCommonJS(
|
24
|
+
module.exports = __toCommonJS(route_exports);
|
26
25
|
var import_compiled = require("../compiled");
|
27
26
|
const { cloneDeep } = import_compiled.lodash;
|
28
27
|
function filterRoutesForServer(routes) {
|
@@ -59,28 +58,8 @@ function filterRoutesLoader(routes) {
|
|
59
58
|
}).filter((route) => route !== null);
|
60
59
|
return newRoutes;
|
61
60
|
}
|
62
|
-
function markRoutes(routes, routeIds) {
|
63
|
-
return routes.map((route) => {
|
64
|
-
if (route.type !== "nested") {
|
65
|
-
return route;
|
66
|
-
}
|
67
|
-
if (route.children && route.children.length > 0) {
|
68
|
-
route.children = markRoutes(route.children, routeIds);
|
69
|
-
}
|
70
|
-
if (route.children && route.children.length > 0) {
|
71
|
-
route.inValidSSRRoute = route.children.every((child) => {
|
72
|
-
var _child_inValidSSRRoute;
|
73
|
-
return (_child_inValidSSRRoute = child.inValidSSRRoute) !== null && _child_inValidSSRRoute !== void 0 ? _child_inValidSSRRoute : false;
|
74
|
-
});
|
75
|
-
} else if (route.id) {
|
76
|
-
route.inValidSSRRoute = !routeIds.includes(route.id);
|
77
|
-
}
|
78
|
-
return route;
|
79
|
-
});
|
80
|
-
}
|
81
61
|
// Annotate the CommonJS export names for ESM import in node:
|
82
62
|
0 && (module.exports = {
|
83
63
|
filterRoutesForServer,
|
84
|
-
filterRoutesLoader
|
85
|
-
markRoutes
|
64
|
+
filterRoutesLoader
|
86
65
|
});
|
package/dist/esm/cli/index.js
CHANGED
package/dist/esm/cli/is/type.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
1
2
|
function isString(str) {
|
2
3
|
return typeof str === "string";
|
3
4
|
}
|
@@ -11,13 +12,13 @@ function isFunction(func) {
|
|
11
12
|
return typeof func === "function";
|
12
13
|
}
|
13
14
|
function isObject(obj) {
|
14
|
-
return obj !== null && typeof obj === "object";
|
15
|
+
return obj !== null && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object";
|
15
16
|
}
|
16
17
|
function isPlainObject(obj) {
|
17
18
|
return isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]";
|
18
19
|
}
|
19
20
|
function isPromise(obj) {
|
20
|
-
return Boolean(obj) && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function";
|
21
|
+
return Boolean(obj) && ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object" || typeof obj === "function") && typeof obj.then === "function";
|
21
22
|
}
|
22
23
|
function isRegExp(obj) {
|
23
24
|
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
@@ -38,27 +38,7 @@ function filterRoutesLoader(routes) {
|
|
38
38
|
});
|
39
39
|
return newRoutes;
|
40
40
|
}
|
41
|
-
function markRoutes(routes, routeIds) {
|
42
|
-
return routes.map(function(route) {
|
43
|
-
if (route.type !== "nested") {
|
44
|
-
return route;
|
45
|
-
}
|
46
|
-
if (route.children && route.children.length > 0) {
|
47
|
-
route.children = markRoutes(route.children, routeIds);
|
48
|
-
}
|
49
|
-
if (route.children && route.children.length > 0) {
|
50
|
-
route.inValidSSRRoute = route.children.every(function(child) {
|
51
|
-
var _child_inValidSSRRoute;
|
52
|
-
return (_child_inValidSSRRoute = child.inValidSSRRoute) !== null && _child_inValidSSRRoute !== void 0 ? _child_inValidSSRRoute : false;
|
53
|
-
});
|
54
|
-
} else if (route.id) {
|
55
|
-
route.inValidSSRRoute = !routeIds.includes(route.id);
|
56
|
-
}
|
57
|
-
return route;
|
58
|
-
});
|
59
|
-
}
|
60
41
|
export {
|
61
42
|
filterRoutesForServer,
|
62
|
-
filterRoutesLoader
|
63
|
-
markRoutes
|
43
|
+
filterRoutesLoader
|
64
44
|
};
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
2
|
+
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
2
3
|
var friendlySyntaxErrorLabel = "SyntaxError:";
|
3
4
|
function isLikelyASyntaxError(message) {
|
4
5
|
return message.includes(friendlySyntaxErrorLabel);
|
@@ -6,7 +7,7 @@ function isLikelyASyntaxError(message) {
|
|
6
7
|
function formatMessage(stats) {
|
7
8
|
var lines = [];
|
8
9
|
var message;
|
9
|
-
if (typeof stats === "object") {
|
10
|
+
if ((typeof stats === "undefined" ? "undefined" : _type_of(stats)) === "object") {
|
10
11
|
var fileName = stats.moduleName ? "File: ".concat(stats.moduleName, "\n") : "";
|
11
12
|
var mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
|
12
13
|
var details = stats.details ? "\nDetails: ".concat(stats.details, "\n") : "";
|
@@ -34,27 +34,7 @@ function filterRoutesLoader(routes) {
|
|
34
34
|
}).filter((route) => route !== null);
|
35
35
|
return newRoutes;
|
36
36
|
}
|
37
|
-
function markRoutes(routes, routeIds) {
|
38
|
-
return routes.map((route) => {
|
39
|
-
if (route.type !== "nested") {
|
40
|
-
return route;
|
41
|
-
}
|
42
|
-
if (route.children && route.children.length > 0) {
|
43
|
-
route.children = markRoutes(route.children, routeIds);
|
44
|
-
}
|
45
|
-
if (route.children && route.children.length > 0) {
|
46
|
-
route.inValidSSRRoute = route.children.every((child) => {
|
47
|
-
var _child_inValidSSRRoute;
|
48
|
-
return (_child_inValidSSRRoute = child.inValidSSRRoute) !== null && _child_inValidSSRRoute !== void 0 ? _child_inValidSSRRoute : false;
|
49
|
-
});
|
50
|
-
} else if (route.id) {
|
51
|
-
route.inValidSSRRoute = !routeIds.includes(route.id);
|
52
|
-
}
|
53
|
-
return route;
|
54
|
-
});
|
55
|
-
}
|
56
37
|
export {
|
57
38
|
filterRoutesForServer,
|
58
|
-
filterRoutesLoader
|
59
|
-
markRoutes
|
39
|
+
filterRoutesLoader
|
60
40
|
};
|
@@ -1,4 +1,3 @@
|
|
1
1
|
import type { NestedRouteForCli, PageRoute } from '@modern-js/types';
|
2
2
|
export declare function filterRoutesForServer(routes: (NestedRouteForCli | PageRoute)[]): (NestedRouteForCli | PageRoute)[];
|
3
3
|
export declare function filterRoutesLoader(routes: (NestedRouteForCli | PageRoute)[]): (NestedRouteForCli | PageRoute)[];
|
4
|
-
export declare function markRoutes(routes: (NestedRouteForCli | PageRoute)[], routeIds: string[]): (NestedRouteForCli | PageRoute)[];
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.60.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -54,11 +54,6 @@
|
|
54
54
|
"import": "./dist/esm/universal/pluginDagSort.js",
|
55
55
|
"default": "./dist/cjs/universal/pluginDagSort.js"
|
56
56
|
},
|
57
|
-
"./universal/route": {
|
58
|
-
"types": "./dist/types/universal/route.server.d.ts",
|
59
|
-
"import": "./dist/esm/universal/route.js",
|
60
|
-
"default": "./dist/cjs/universal/route.server.js"
|
61
|
-
},
|
62
57
|
"./commander": "./dist/compiled/commander/index.js",
|
63
58
|
"./ora": "./dist/compiled/ora/index.js",
|
64
59
|
"./glob": "./dist/compiled/glob/index.js",
|
@@ -102,9 +97,6 @@
|
|
102
97
|
"universal/plugin-dag-sort": [
|
103
98
|
"./dist/types/universal/pluginDagSort.d.ts"
|
104
99
|
],
|
105
|
-
"universal/route": [
|
106
|
-
"./dist/types/universal/route.server.d.ts"
|
107
|
-
],
|
108
100
|
"execa": [
|
109
101
|
"./dist/compiled/execa/index.d.ts"
|
110
102
|
],
|
@@ -159,7 +151,7 @@
|
|
159
151
|
}
|
160
152
|
},
|
161
153
|
"dependencies": {
|
162
|
-
"@swc/helpers": "0.5.
|
154
|
+
"@swc/helpers": "0.5.13",
|
163
155
|
"caniuse-lite": "^1.0.30001520",
|
164
156
|
"lodash": "^4.17.21",
|
165
157
|
"rslog": "^1.1.0"
|
@@ -169,10 +161,10 @@
|
|
169
161
|
"@types/node": "^14",
|
170
162
|
"jest": "^29",
|
171
163
|
"typescript": "^5",
|
172
|
-
"webpack": "^5.
|
173
|
-
"@modern-js/types": "2.
|
174
|
-
"@scripts/
|
175
|
-
"@scripts/
|
164
|
+
"webpack": "^5.94.0",
|
165
|
+
"@modern-js/types": "2.60.0",
|
166
|
+
"@scripts/build": "2.60.0",
|
167
|
+
"@scripts/jest-config": "2.60.0"
|
176
168
|
},
|
177
169
|
"sideEffects": false,
|
178
170
|
"scripts": {
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require('./').codegen;
|