@modern-js/utils 2.35.0 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/dist/cjs/cli/alias.js +48 -49
  2. package/dist/cjs/cli/applyOptionsChain.js +30 -13
  3. package/dist/cjs/cli/babel.js +36 -26
  4. package/dist/cjs/cli/commands.js +29 -21
  5. package/dist/cjs/cli/common.js +29 -20
  6. package/dist/cjs/cli/config.js +24 -7
  7. package/dist/cjs/cli/constants/chainId.js +27 -10
  8. package/dist/cjs/cli/constants/index.js +86 -104
  9. package/dist/cjs/cli/ensure.js +37 -18
  10. package/dist/cjs/cli/fs.js +29 -19
  11. package/dist/cjs/cli/get/config.js +26 -9
  12. package/dist/cjs/cli/get/data.js +67 -54
  13. package/dist/cjs/cli/get/index.js +46 -25
  14. package/dist/cjs/cli/index.js +58 -23
  15. package/dist/cjs/cli/is/config.js +45 -41
  16. package/dist/cjs/cli/is/env.js +32 -29
  17. package/dist/cjs/cli/is/index.js +26 -8
  18. package/dist/cjs/cli/is/project.js +67 -53
  19. package/dist/cjs/cli/is/type.js +39 -36
  20. package/dist/cjs/cli/logger.js +25 -125
  21. package/dist/cjs/cli/monorepo.js +58 -58
  22. package/dist/cjs/cli/package.js +34 -26
  23. package/dist/cjs/cli/path.js +64 -54
  24. package/dist/cjs/cli/port.js +39 -13
  25. package/dist/cjs/cli/prettyInstructions.js +50 -34
  26. package/dist/cjs/cli/require.js +36 -31
  27. package/dist/cjs/cli/runtimeExports.js +42 -16
  28. package/dist/cjs/cli/watch.js +41 -22
  29. package/dist/cjs/compiled.js +127 -138
  30. package/dist/cjs/import.js +25 -15
  31. package/dist/cjs/index.js +24 -6
  32. package/dist/cjs/universal/constants.js +29 -21
  33. package/dist/cjs/universal/formatWebpack.js +28 -18
  34. package/dist/cjs/universal/pluginDagSort.js +25 -8
  35. package/dist/esm/cli/alias.js +13 -25
  36. package/dist/esm/cli/applyOptionsChain.js +4 -1
  37. package/dist/esm/cli/babel.js +6 -2
  38. package/dist/esm/cli/commands.js +10 -4
  39. package/dist/esm/cli/common.js +8 -3
  40. package/dist/esm/cli/config.js +4 -1
  41. package/dist/esm/cli/constants/chainId.js +7 -4
  42. package/dist/esm/cli/constants/index.js +64 -31
  43. package/dist/esm/cli/ensure.js +6 -2
  44. package/dist/esm/cli/fs.js +6 -2
  45. package/dist/esm/cli/get/config.js +4 -1
  46. package/dist/esm/cli/get/data.js +18 -8
  47. package/dist/esm/cli/get/index.js +6 -2
  48. package/dist/esm/cli/is/config.js +23 -17
  49. package/dist/esm/cli/is/env.js +12 -8
  50. package/dist/esm/cli/is/index.js +0 -1
  51. package/dist/esm/cli/is/project.js +17 -8
  52. package/dist/esm/cli/is/type.js +20 -9
  53. package/dist/esm/cli/logger.js +4 -123
  54. package/dist/esm/cli/monorepo.js +14 -16
  55. package/dist/esm/cli/package.js +10 -4
  56. package/dist/esm/cli/path.js +24 -11
  57. package/dist/esm/cli/port.js +6 -3
  58. package/dist/esm/cli/prettyInstructions.js +8 -5
  59. package/dist/esm/cli/require.js +15 -8
  60. package/dist/esm/cli/runtimeExports.js +6 -3
  61. package/dist/esm/cli/watch.js +10 -6
  62. package/dist/esm/compiled.js +65 -31
  63. package/dist/esm/import.js +6 -3
  64. package/dist/esm/universal/constants.js +10 -4
  65. package/dist/esm/universal/formatWebpack.js +8 -5
  66. package/dist/esm/universal/pluginDagSort.js +5 -2
  67. package/dist/esm-node/cli/alias.js +11 -22
  68. package/dist/esm-node/cli/applyOptionsChain.js +4 -1
  69. package/dist/esm-node/cli/babel.js +6 -2
  70. package/dist/esm-node/cli/commands.js +10 -4
  71. package/dist/esm-node/cli/common.js +8 -3
  72. package/dist/esm-node/cli/config.js +4 -1
  73. package/dist/esm-node/cli/constants/chainId.js +7 -4
  74. package/dist/esm-node/cli/constants/index.js +64 -31
  75. package/dist/esm-node/cli/ensure.js +6 -2
  76. package/dist/esm-node/cli/fs.js +6 -2
  77. package/dist/esm-node/cli/get/config.js +4 -1
  78. package/dist/esm-node/cli/get/data.js +18 -8
  79. package/dist/esm-node/cli/get/index.js +6 -2
  80. package/dist/esm-node/cli/is/config.js +23 -17
  81. package/dist/esm-node/cli/is/env.js +12 -6
  82. package/dist/esm-node/cli/is/index.js +0 -1
  83. package/dist/esm-node/cli/is/project.js +16 -7
  84. package/dist/esm-node/cli/is/type.js +20 -9
  85. package/dist/esm-node/cli/logger.js +4 -108
  86. package/dist/esm-node/cli/monorepo.js +14 -18
  87. package/dist/esm-node/cli/package.js +10 -4
  88. package/dist/esm-node/cli/path.js +24 -11
  89. package/dist/esm-node/cli/port.js +5 -2
  90. package/dist/esm-node/cli/prettyInstructions.js +8 -7
  91. package/dist/esm-node/cli/require.js +15 -8
  92. package/dist/esm-node/cli/runtimeExports.js +4 -1
  93. package/dist/esm-node/cli/watch.js +6 -2
  94. package/dist/esm-node/compiled.js +65 -31
  95. package/dist/esm-node/import.js +5 -2
  96. package/dist/esm-node/universal/constants.js +10 -4
  97. package/dist/esm-node/universal/formatWebpack.js +8 -5
  98. package/dist/esm-node/universal/pluginDagSort.js +5 -2
  99. package/dist/types/cli/alias.d.ts +0 -5
  100. package/dist/types/cli/constants/chainId.d.ts +2 -2
  101. package/dist/types/cli/is/env.d.ts +1 -2
  102. package/dist/types/cli/is/index.d.ts +0 -1
  103. package/dist/types/cli/logger.d.ts +1 -64
  104. package/dist/types/cli/monorepo.d.ts +0 -1
  105. package/package.json +6 -84
  106. package/dist/cjs/cli/is/platform.js +0 -21
  107. package/dist/cjs/runtime/nestedRoutes.js +0 -149
  108. package/dist/cjs/runtime/remixRouter.js +0 -6
  109. package/dist/cjs/runtime/router.js +0 -6
  110. package/dist/cjs/runtime-browser/index.js +0 -6
  111. package/dist/cjs/runtime-browser/parsed.js +0 -28
  112. package/dist/cjs/runtime-node/index.js +0 -28
  113. package/dist/cjs/runtime-node/loaderContext/createLoaderCtx.js +0 -34
  114. package/dist/cjs/runtime-node/loaderContext/createRequestCtx.js +0 -38
  115. package/dist/cjs/runtime-node/loaderContext/index.js +0 -22
  116. package/dist/cjs/runtime-node/nestedRoutes.js +0 -28
  117. package/dist/cjs/runtime-node/router.js +0 -6
  118. package/dist/cjs/runtime-node/serialize.js +0 -17
  119. package/dist/cjs/runtime-node/storage.js +0 -48
  120. package/dist/cjs/universal/time.js +0 -38
  121. package/dist/compiled/gradient-string/index.d.ts +0 -1
  122. package/dist/compiled/gradient-string/index.js +0 -1
  123. package/dist/compiled/gradient-string/license +0 -21
  124. package/dist/compiled/gradient-string/package.json +0 -1
  125. package/dist/compiled/webpack-dev-middleware/index.js +0 -7
  126. package/dist/compiled/webpack-dev-middleware/license +0 -20
  127. package/dist/compiled/webpack-dev-middleware/package.json +0 -1
  128. package/dist/compiled/webpack-dev-middleware/types/index.d.ts +0 -262
  129. package/dist/esm/cli/is/platform.js +0 -6
  130. package/dist/esm/runtime/nestedRoutes.js +0 -163
  131. package/dist/esm/runtime/remixRouter.js +0 -1
  132. package/dist/esm/runtime/router.js +0 -1
  133. package/dist/esm/runtime-browser/index.js +0 -1
  134. package/dist/esm/runtime-browser/parsed.js +0 -18
  135. package/dist/esm/runtime-node/index.js +0 -6
  136. package/dist/esm/runtime-node/loaderContext/createLoaderCtx.js +0 -20
  137. package/dist/esm/runtime-node/loaderContext/createRequestCtx.js +0 -24
  138. package/dist/esm/runtime-node/loaderContext/index.js +0 -3
  139. package/dist/esm/runtime-node/nestedRoutes.js +0 -20
  140. package/dist/esm/runtime-node/router.js +0 -1
  141. package/dist/esm/runtime-node/serialize.js +0 -6
  142. package/dist/esm/runtime-node/storage.js +0 -36
  143. package/dist/esm/universal/time.js +0 -29
  144. package/dist/esm-node/cli/is/platform.js +0 -2
  145. package/dist/esm-node/runtime/nestedRoutes.js +0 -129
  146. package/dist/esm-node/runtime/remixRouter.js +0 -1
  147. package/dist/esm-node/runtime/router.js +0 -1
  148. package/dist/esm-node/runtime-browser/index.js +0 -1
  149. package/dist/esm-node/runtime-browser/parsed.js +0 -18
  150. package/dist/esm-node/runtime-node/index.js +0 -6
  151. package/dist/esm-node/runtime-node/loaderContext/createLoaderCtx.js +0 -15
  152. package/dist/esm-node/runtime-node/loaderContext/createRequestCtx.js +0 -19
  153. package/dist/esm-node/runtime-node/loaderContext/index.js +0 -3
  154. package/dist/esm-node/runtime-node/nestedRoutes.js +0 -18
  155. package/dist/esm-node/runtime-node/router.js +0 -1
  156. package/dist/esm-node/runtime-node/serialize.js +0 -6
  157. package/dist/esm-node/runtime-node/storage.js +0 -38
  158. package/dist/esm-node/universal/time.js +0 -28
  159. package/dist/types/cli/is/platform.d.ts +0 -2
  160. package/dist/types/runtime/nestedRoutes.d.ts +0 -13
  161. package/dist/types/runtime/remixRouter.d.ts +0 -1
  162. package/dist/types/runtime/router.d.ts +0 -1
  163. package/dist/types/runtime-browser/index.d.ts +0 -1
  164. package/dist/types/runtime-browser/parsed.d.ts +0 -1
  165. package/dist/types/runtime-node/index.d.ts +0 -10
  166. package/dist/types/runtime-node/loaderContext/createLoaderCtx.d.ts +0 -7
  167. package/dist/types/runtime-node/loaderContext/createRequestCtx.d.ts +0 -7
  168. package/dist/types/runtime-node/loaderContext/index.d.ts +0 -4
  169. package/dist/types/runtime-node/nestedRoutes.d.ts +0 -3
  170. package/dist/types/runtime-node/router.d.ts +0 -1
  171. package/dist/types/runtime-node/serialize.d.ts +0 -1
  172. package/dist/types/runtime-node/storage.d.ts +0 -5
  173. package/dist/types/universal/time.d.ts +0 -1
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { NestedRoute, Reporter } from '@modern-js/types';
3
- export declare const transformNestedRoutes: (routes: NestedRoute[], reporter: Reporter) => import("react-router-dom").RouteObject[];
4
- type DeferredDataComponentType = (props?: {
5
- nonce?: string;
6
- }) => JSX.Element | null;
7
- export declare const renderNestedRoute: (nestedRoute: NestedRoute, options?: {
8
- parent?: NestedRoute;
9
- DeferredDataComponent?: DeferredDataComponentType;
10
- props?: Record<string, any>;
11
- reporter?: Reporter;
12
- }) => JSX.Element;
13
- export {};
@@ -1 +0,0 @@
1
- export * from '@remix-run/router';
@@ -1 +0,0 @@
1
- export * from 'react-router-dom';
@@ -1 +0,0 @@
1
- export * from './parsed';
@@ -1 +0,0 @@
1
- export declare const parsedJSONFromElement: (id: string) => any;
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * ssr helpers
4
- */
5
- import type { IncomingHttpHeaders } from 'http';
6
- declare const run: <O>(context: IncomingHttpHeaders, cb: () => O | Promise<O>) => Promise<O>, useHeaders: () => IncomingHttpHeaders;
7
- export { run, useHeaders };
8
- export { serializeJson } from './serialize';
9
- export * from './nestedRoutes';
10
- export * from './loaderContext';
@@ -1,7 +0,0 @@
1
- export declare class LoaderContext<T = unknown> {
2
- symbol: symbol;
3
- private defaultValue?;
4
- constructor(defaultValue?: T);
5
- getDefaultValue(): T;
6
- }
7
- export declare function createLoaderContext<T = unknown>(defaultValue?: T): LoaderContext<T>;
@@ -1,7 +0,0 @@
1
- import { LoaderContext } from './createLoaderCtx';
2
- export declare class RequestContext {
3
- private store;
4
- get<T>(loaderCtx: LoaderContext<T>): T;
5
- set<T = unknown>(loaderCtx: LoaderContext, value: T): void;
6
- }
7
- export declare function createRequestContext(): RequestContext;
@@ -1,4 +0,0 @@
1
- import type { Reporter } from '@modern-js/types';
2
- export { createRequestContext, type RequestContext } from './createRequestCtx';
3
- export type { LoaderContext } from './createLoaderCtx';
4
- export declare const reporterCtx: import("./createLoaderCtx").LoaderContext<Reporter>;
@@ -1,3 +0,0 @@
1
- import type { ModernServerContext, ServerRoute } from '@modern-js/types';
2
- export type ServerContext = Pick<ModernServerContext, 'logger' | 'req' | 'reporter' | 'res' | 'params' | 'headers' | 'method' | 'url' | 'host' | 'protocol' | 'origin' | 'href' | 'path' | 'query'>;
3
- export declare const matchEntry: (pathname: string, entries: ServerRoute[]) => ServerRoute | undefined;
@@ -1 +0,0 @@
1
- export * from 'react-router-dom/server';
@@ -1 +0,0 @@
1
- export declare const serializeJson: (data: any) => string;
@@ -1,5 +0,0 @@
1
- declare const createStorage: <T>() => {
2
- run: <O>(context: T, cb: () => O | Promise<O>) => Promise<O>;
3
- useContext: () => T;
4
- };
5
- export { createStorage };
@@ -1 +0,0 @@
1
- export declare const time: () => () => number;