@modern-js/utils 2.59.0 → 2.60.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/dist/cjs/cli/commands.js +18 -0
  2. package/dist/cjs/cli/index.js +3 -3
  3. package/dist/cjs/cli/route.js +23 -2
  4. package/dist/compiled/ajv/codegen.js +1 -0
  5. package/dist/compiled/ajv/index.js +9 -0
  6. package/dist/compiled/ajv/license +22 -0
  7. package/dist/compiled/ajv/package.json +1 -0
  8. package/dist/compiled/ajv/types/ajv.d.ts +16 -0
  9. package/dist/compiled/ajv/types/compile/codegen/code.d.ts +40 -0
  10. package/dist/compiled/ajv/types/compile/codegen/index.d.ts +79 -0
  11. package/dist/compiled/ajv/types/compile/codegen/scope.d.ts +79 -0
  12. package/dist/compiled/ajv/types/compile/errors.d.ts +13 -0
  13. package/dist/compiled/ajv/types/compile/index.d.ts +80 -0
  14. package/dist/compiled/ajv/types/compile/ref_error.d.ts +6 -0
  15. package/dist/compiled/ajv/types/compile/resolve.d.ts +12 -0
  16. package/dist/compiled/ajv/types/compile/rules.d.ts +28 -0
  17. package/dist/compiled/ajv/types/compile/util.d.ts +40 -0
  18. package/dist/compiled/ajv/types/compile/validate/index.d.ts +42 -0
  19. package/dist/compiled/ajv/types/compile/validate/subschema.d.ts +47 -0
  20. package/dist/compiled/ajv/types/core.d.ts +173 -0
  21. package/dist/compiled/ajv/types/runtime/validation_error.d.ts +7 -0
  22. package/dist/compiled/ajv/types/types/index.d.ts +183 -0
  23. package/dist/compiled/ajv/types/types/json-schema.d.ts +124 -0
  24. package/dist/compiled/ajv/types/types/jtd-schema.d.ts +169 -0
  25. package/dist/compiled/ajv/types/vocabularies/errors.d.ts +1 -0
  26. package/dist/compiled/ajv/uri-js.d.ts +59 -0
  27. package/dist/compiled/ajv-keywords/index.d.ts +1 -0
  28. package/dist/compiled/ajv-keywords/index.js +1 -0
  29. package/dist/compiled/ajv-keywords/license +21 -0
  30. package/dist/compiled/ajv-keywords/package.json +1 -0
  31. package/dist/compiled/better-ajv-errors/index.d.ts +1 -0
  32. package/dist/compiled/better-ajv-errors/index.js +1 -0
  33. package/dist/compiled/better-ajv-errors/license +13 -0
  34. package/dist/compiled/better-ajv-errors/package.json +1 -0
  35. package/dist/compiled/recursive-readdir/index.d.ts +21 -0
  36. package/dist/compiled/recursive-readdir/index.js +1 -0
  37. package/dist/compiled/recursive-readdir/license +21 -0
  38. package/dist/compiled/recursive-readdir/package.json +1 -0
  39. package/dist/compiled/schema-utils3/index.d.ts +1 -0
  40. package/dist/compiled/schema-utils3/index.js +3 -0
  41. package/dist/compiled/schema-utils3/license +20 -0
  42. package/dist/compiled/schema-utils3/package.json +1 -0
  43. package/dist/compiled/webpack-dev-middleware/index.js +7 -0
  44. package/dist/compiled/webpack-dev-middleware/license +20 -0
  45. package/dist/compiled/webpack-dev-middleware/package.json +1 -0
  46. package/dist/compiled/webpack-dev-middleware/types/index.d.ts +262 -0
  47. package/dist/esm/cli/commands.js +17 -0
  48. package/dist/esm/cli/index.js +1 -1
  49. package/dist/esm/cli/is/type.js +3 -2
  50. package/dist/esm/cli/route.js +21 -1
  51. package/dist/esm/universal/formatWebpack.js +2 -1
  52. package/dist/esm-node/cli/commands.js +17 -0
  53. package/dist/esm-node/cli/index.js +1 -1
  54. package/dist/esm-node/cli/route.js +21 -1
  55. package/dist/types/cli/commands.d.ts +4 -0
  56. package/dist/types/cli/index.d.ts +1 -1
  57. package/dist/types/cli/route.d.ts +1 -0
  58. 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,
@@ -19,5 +19,5 @@ export * from "./runtimeExports";
19
19
  export * from "./watch";
20
20
  export * from "./config";
21
21
  export * from "./action";
22
- export * from "./route";
23
22
  export * from "./version";
23
+ export * from "./route";
@@ -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;
@@ -19,5 +19,5 @@ export * from './runtimeExports';
19
19
  export * from './watch';
20
20
  export * from './config';
21
21
  export * from './action';
22
- export * from './route';
23
22
  export * from './version';
23
+ export * from './route';
@@ -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.59.0",
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.3",
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
- "@modern-js/types": "2.59.0",
166
- "@scripts/build": "2.59.0",
167
- "@scripts/jest-config": "2.59.0"
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": {