@modern-js/utils 2.58.2 → 2.58.3-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cli/alias.js +1 -1
- package/dist/cjs/cli/is/project.js +1 -1
- package/dist/cjs/cli/path.js +2 -2
- package/dist/cjs/cli/prettyInstructions.js +2 -2
- package/dist/cjs/cli/require.js +1 -1
- package/dist/cjs/cli/route.js +23 -2
- package/dist/compiled/ajv/codegen.js +1 -0
- package/dist/compiled/ajv/index.js +9 -0
- package/dist/compiled/ajv/license +22 -0
- package/dist/compiled/ajv/package.json +1 -0
- package/dist/compiled/ajv/types/ajv.d.ts +16 -0
- package/dist/compiled/ajv/types/compile/codegen/code.d.ts +40 -0
- package/dist/compiled/ajv/types/compile/codegen/index.d.ts +79 -0
- package/dist/compiled/ajv/types/compile/codegen/scope.d.ts +79 -0
- package/dist/compiled/ajv/types/compile/errors.d.ts +13 -0
- package/dist/compiled/ajv/types/compile/index.d.ts +80 -0
- package/dist/compiled/ajv/types/compile/ref_error.d.ts +6 -0
- package/dist/compiled/ajv/types/compile/resolve.d.ts +12 -0
- package/dist/compiled/ajv/types/compile/rules.d.ts +28 -0
- package/dist/compiled/ajv/types/compile/util.d.ts +40 -0
- package/dist/compiled/ajv/types/compile/validate/index.d.ts +42 -0
- package/dist/compiled/ajv/types/compile/validate/subschema.d.ts +47 -0
- package/dist/compiled/ajv/types/core.d.ts +173 -0
- package/dist/compiled/ajv/types/runtime/validation_error.d.ts +7 -0
- package/dist/compiled/ajv/types/types/index.d.ts +183 -0
- package/dist/compiled/ajv/types/types/json-schema.d.ts +124 -0
- package/dist/compiled/ajv/types/types/jtd-schema.d.ts +169 -0
- package/dist/compiled/ajv/types/vocabularies/errors.d.ts +1 -0
- package/dist/compiled/ajv/uri-js.d.ts +59 -0
- package/dist/compiled/ajv-keywords/index.d.ts +1 -0
- package/dist/compiled/ajv-keywords/index.js +1 -0
- package/dist/compiled/ajv-keywords/license +21 -0
- package/dist/compiled/ajv-keywords/package.json +1 -0
- package/dist/compiled/better-ajv-errors/index.d.ts +1 -0
- package/dist/compiled/better-ajv-errors/index.js +1 -0
- package/dist/compiled/better-ajv-errors/license +13 -0
- package/dist/compiled/better-ajv-errors/package.json +1 -0
- package/dist/compiled/recursive-readdir/index.d.ts +21 -0
- package/dist/compiled/recursive-readdir/index.js +1 -0
- package/dist/compiled/recursive-readdir/license +21 -0
- package/dist/compiled/recursive-readdir/package.json +1 -0
- package/dist/compiled/schema-utils3/index.d.ts +1 -0
- package/dist/compiled/schema-utils3/index.js +3 -0
- package/dist/compiled/schema-utils3/license +20 -0
- package/dist/compiled/schema-utils3/package.json +1 -0
- package/dist/compiled/webpack-dev-middleware/index.js +7 -0
- package/dist/compiled/webpack-dev-middleware/license +20 -0
- package/dist/compiled/webpack-dev-middleware/package.json +1 -0
- package/dist/compiled/webpack-dev-middleware/types/index.d.ts +262 -0
- package/dist/esm/cli/alias.js +1 -1
- package/dist/esm/cli/get/data.js +1 -1
- package/dist/esm/cli/is/project.js +1 -1
- package/dist/esm/cli/path.js +2 -2
- package/dist/esm/cli/prettyInstructions.js +2 -2
- package/dist/esm/cli/require.js +1 -1
- package/dist/esm/cli/route.js +21 -1
- package/dist/esm-node/cli/alias.js +1 -1
- package/dist/esm-node/cli/get/data.js +1 -1
- package/dist/esm-node/cli/is/project.js +1 -1
- package/dist/esm-node/cli/path.js +2 -2
- package/dist/esm-node/cli/prettyInstructions.js +2 -2
- package/dist/esm-node/cli/require.js +1 -1
- package/dist/esm-node/cli/route.js +21 -1
- package/dist/types/cli/route.d.ts +1 -0
- package/package.json +3 -3
@@ -1,6 +1,6 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import os from "os";
|
3
1
|
import fs from "fs";
|
2
|
+
import os from "os";
|
3
|
+
import path from "path";
|
4
4
|
import { nanoid, upath } from "../compiled";
|
5
5
|
const isPathString = (test) => path.posix.basename(test) !== test || path.win32.basename(test) !== test;
|
6
6
|
const isRelativePath = (test) => /^\.\.?($|[\\/])/.test(test);
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import os from "os";
|
2
1
|
import { isIPv6 } from "net";
|
2
|
+
import os from "os";
|
3
3
|
import { chalk } from "../compiled";
|
4
|
-
import { isDev, isSingleEntry } from "./is";
|
5
4
|
import { DEFAULT_DEV_HOST } from "./constants";
|
5
|
+
import { isDev, isSingleEntry } from "./is";
|
6
6
|
const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
|
7
7
|
const getIpv4Interfaces = () => {
|
8
8
|
const interfaces = os.networkInterfaces();
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { isAbsolute } from "node:path";
|
2
|
-
import { findExists } from "./fs";
|
3
2
|
import { pathToFileURL } from "node:url";
|
3
|
+
import { findExists } from "./fs";
|
4
4
|
async function compatibleRequire(path, interop = true) {
|
5
5
|
if (path.endsWith(".json")) {
|
6
6
|
return require(path);
|
@@ -34,7 +34,27 @@ 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
|
+
}
|
37
56
|
export {
|
38
57
|
filterRoutesForServer,
|
39
|
-
filterRoutesLoader
|
58
|
+
filterRoutesLoader,
|
59
|
+
markRoutes
|
40
60
|
};
|
@@ -1,3 +1,4 @@
|
|
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.58.
|
18
|
+
"version": "2.58.3-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -163,8 +163,8 @@
|
|
163
163
|
"typescript": "^5",
|
164
164
|
"webpack": "^5.93.0",
|
165
165
|
"@scripts/build": "2.58.2",
|
166
|
-
"@
|
167
|
-
"@
|
166
|
+
"@modern-js/types": "2.58.2",
|
167
|
+
"@scripts/jest-config": "2.58.2"
|
168
168
|
},
|
169
169
|
"sideEffects": false,
|
170
170
|
"scripts": {
|