@modern-js/utils 2.59.0 → 2.60.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/commands.js +18 -0
- package/dist/cjs/cli/index.js +3 -3
- 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/commands.js +17 -0
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/is/type.js +3 -2
- package/dist/esm/cli/route.js +21 -1
- package/dist/esm/universal/formatWebpack.js +2 -1
- package/dist/esm-node/cli/commands.js +17 -0
- package/dist/esm-node/cli/index.js +1 -1
- package/dist/esm-node/cli/route.js +21 -1
- package/dist/types/cli/commands.d.ts +4 -0
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/cli/route.d.ts +1 -0
- package/package.json +5 -5
@@ -1,3 +1,4 @@
|
|
1
|
+
import { logger } from "./logger";
|
1
2
|
const getFullArgv = () => {
|
2
3
|
var _process_env_MODERN_ARGV;
|
3
4
|
return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
|
@@ -14,7 +15,23 @@ const isDevCommand = () => {
|
|
14
15
|
const command = getCommand();
|
15
16
|
return command === "dev" || command === "start";
|
16
17
|
};
|
18
|
+
const deprecatedCommands = (program) => {
|
19
|
+
var _program_commandsMap, _program_commandsMap1;
|
20
|
+
const lintCommand = (_program_commandsMap = program.commandsMap) === null || _program_commandsMap === void 0 ? void 0 : _program_commandsMap.get("lint");
|
21
|
+
if (!lintCommand) {
|
22
|
+
program.command("lint [...files]").allowUnknownOption().description("Deprecated").action(() => {
|
23
|
+
logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
|
24
|
+
});
|
25
|
+
}
|
26
|
+
const preCommitCommand = (_program_commandsMap1 = program.commandsMap) === null || _program_commandsMap1 === void 0 ? void 0 : _program_commandsMap1.get("pre-commit");
|
27
|
+
if (!preCommitCommand) {
|
28
|
+
program.command("pre-commit").description("Deprecated").action(() => {
|
29
|
+
logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
|
30
|
+
});
|
31
|
+
}
|
32
|
+
};
|
17
33
|
export {
|
34
|
+
deprecatedCommands,
|
18
35
|
getArgv,
|
19
36
|
getCommand,
|
20
37
|
getFullArgv,
|
@@ -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,4 +1,8 @@
|
|
1
|
+
import type { Command } from '../../compiled/commander';
|
1
2
|
export declare const getFullArgv: () => string[];
|
2
3
|
export declare const getArgv: () => string[];
|
3
4
|
export declare const getCommand: () => string;
|
4
5
|
export declare const isDevCommand: () => boolean;
|
6
|
+
export declare const deprecatedCommands: (program: Command & {
|
7
|
+
commandsMap?: Map<string, Command>;
|
8
|
+
}) => void;
|
@@ -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.
|
18
|
+
"version": "2.60.1-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -151,7 +151,7 @@
|
|
151
151
|
}
|
152
152
|
},
|
153
153
|
"dependencies": {
|
154
|
-
"@swc/helpers": "0.5.
|
154
|
+
"@swc/helpers": "0.5.13",
|
155
155
|
"caniuse-lite": "^1.0.30001520",
|
156
156
|
"lodash": "^4.17.21",
|
157
157
|
"rslog": "^1.1.0"
|
@@ -162,9 +162,9 @@
|
|
162
162
|
"jest": "^29",
|
163
163
|
"typescript": "^5",
|
164
164
|
"webpack": "^5.94.0",
|
165
|
-
"@
|
166
|
-
"@
|
167
|
-
"@scripts/jest-config": "2.
|
165
|
+
"@scripts/build": "2.60.0",
|
166
|
+
"@modern-js/types": "2.60.0",
|
167
|
+
"@scripts/jest-config": "2.60.0"
|
168
168
|
},
|
169
169
|
"sideEffects": false,
|
170
170
|
"scripts": {
|