@modern-js/utils 2.19.1 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/cli/alias.js +3 -7
  3. package/dist/cjs/cli/constants/chainId.js +2 -0
  4. package/dist/cjs/cli/constants/index.js +2 -14
  5. package/dist/cjs/cli/ensure.js +2 -6
  6. package/dist/cjs/cli/get/data.js +3 -7
  7. package/dist/cjs/cli/get/index.js +5 -21
  8. package/dist/cjs/cli/index.js +24 -37
  9. package/dist/cjs/cli/is/index.js +6 -18
  10. package/dist/cjs/cli/is/project.js +2 -6
  11. package/dist/cjs/cli/logger.js +7 -23
  12. package/dist/cjs/cli/monorepo.js +3 -7
  13. package/dist/cjs/cli/path.js +4 -8
  14. package/dist/cjs/cli/pathSerializer.js +3 -7
  15. package/dist/cjs/cli/port.js +2 -6
  16. package/dist/cjs/cli/prettyInstructions.js +2 -6
  17. package/dist/cjs/cli/routes.js +2 -6
  18. package/dist/cjs/cli/runtimeExports.js +2 -6
  19. package/dist/cjs/cli/watch.js +2 -6
  20. package/dist/cjs/compiled.js +28 -71
  21. package/dist/cjs/index.js +4 -16
  22. package/dist/cjs/runtime/nestedRoutes.js +2 -41
  23. package/dist/cjs/runtime/remixRouter.js +2 -14
  24. package/dist/cjs/runtime/router.js +2 -15
  25. package/dist/cjs/runtime-browser/index.js +2 -14
  26. package/dist/cjs/runtime-node/router.js +6 -0
  27. package/dist/cjs/runtime-node/serialize.js +2 -6
  28. package/dist/cjs/runtime-node/storage.js +2 -41
  29. package/dist/compiled/better-ajv-errors/index.js +1 -1
  30. package/dist/compiled/webpack-dev-middleware/index.js +2 -2
  31. package/dist/esm/cli/constants/chainId.js +2 -0
  32. package/dist/esm/cli/index.js +0 -1
  33. package/dist/esm/cli/logger.js +1 -13
  34. package/dist/esm/runtime/router.js +1 -2
  35. package/dist/esm/runtime-node/router.js +1 -0
  36. package/dist/types/cli/constants/chainId.d.ts +2 -73
  37. package/dist/types/cli/constants/index.d.ts +0 -21
  38. package/dist/types/cli/index.d.ts +0 -1
  39. package/dist/types/cli/is/config.d.ts +0 -2
  40. package/dist/types/cli/is/project.d.ts +0 -2
  41. package/dist/types/cli/is/type.d.ts +0 -1
  42. package/dist/types/cli/logger.d.ts +0 -2
  43. package/dist/types/cli/path.d.ts +0 -2
  44. package/dist/types/cli/require.d.ts +0 -1
  45. package/dist/types/compiled.d.ts +0 -1
  46. package/dist/types/runtime/router.d.ts +1 -2
  47. package/dist/types/runtime-node/index.d.ts +0 -1
  48. package/dist/types/runtime-node/router.d.ts +1 -0
  49. package/dist/types/universal/constants.d.ts +0 -1
  50. package/package.json +38 -12
  51. package/dist/cjs/cli/generateMetaTags.js +0 -42
  52. package/dist/esm/cli/generateMetaTags.js +0 -34
  53. package/dist/types/cli/generateMetaTags.d.ts +0 -16
@@ -4,56 +4,39 @@ export declare const CHAIN_ID: {
4
4
  /** Rule for .mjs */
5
5
  readonly MJS: "mjs";
6
6
  /** Rule for predefined loaders */
7
-
8
7
  readonly LOADERS: "loaders";
9
8
  /** Rule for fonts */
10
-
11
9
  readonly FONT: "font";
12
10
  /** Rule for images */
13
-
14
11
  readonly IMAGE: "image";
15
12
  /** Rule for media */
16
-
17
13
  readonly MEDIA: "media";
18
14
  /** Rule for js */
19
-
20
15
  readonly JS: "js";
21
16
  /** Rule for data uri encoded javascript */
22
-
23
17
  readonly JS_DATA_URI: "js-data-uri";
24
18
  /** Rule for ts */
25
-
26
19
  readonly TS: "ts";
27
20
  /** Rule for css */
28
-
29
21
  readonly CSS: "css";
30
22
  /** Rule for less */
31
-
32
23
  readonly LESS: "less";
33
24
  /** Rule for sass */
34
-
35
25
  readonly SASS: "sass";
36
26
  /** Rule for stylus */
37
-
38
27
  readonly STYLUS: "stylus";
39
28
  /** Rule for svg */
40
-
41
29
  readonly SVG: "svg";
42
30
  /** Rule for pug */
43
-
44
31
  readonly PUG: "pug";
45
32
  /** Rule for toml */
46
-
47
33
  readonly TOML: "toml";
48
34
  /** Rule for yaml */
49
-
50
35
  readonly YAML: "yaml";
51
36
  /** Rule for bff */
52
-
53
37
  readonly JS_BFF_API: "js-bff-api";
54
38
  };
55
39
  /** Predefined rule groups */
56
-
57
40
  readonly ONE_OF: {
58
41
  readonly SVG: "svg";
59
42
  readonly SVG_URL: "svg-url";
@@ -61,183 +44,129 @@ export declare const CHAIN_ID: {
61
44
  readonly SVG_INLINE: "svg-inline";
62
45
  };
63
46
  /** Predefined loaders */
64
-
65
47
  readonly USE: {
66
48
  /** ts-loader */
67
49
  readonly TS: "ts";
68
50
  /** css-loader */
69
-
70
51
  readonly CSS: "css";
71
52
  /** sass-loader */
72
-
73
53
  readonly SASS: "sass";
74
54
  /** less-loader */
75
-
76
55
  readonly LESS: "less";
77
56
  /** stylus-loader */
78
-
79
57
  readonly STYLUS: "stylus";
80
58
  /** url-loader */
81
-
82
59
  readonly URL: "url";
83
60
  /** pug-loader */
84
-
85
61
  readonly PUG: "pug";
86
62
  /** file-loader */
87
-
88
63
  readonly FILE: "file";
89
64
  /** @svgr/webpack */
90
-
91
65
  readonly SVGR: "svgr";
92
66
  /** yaml-loader */
93
-
94
67
  readonly YAML: "yaml";
95
68
  /** toml-loader */
96
-
97
69
  readonly TOML: "toml";
98
70
  /** html-loader */
99
-
100
71
  readonly HTML: "html";
101
72
  /** babel-loader */
102
-
103
73
  readonly BABEL: "babel";
104
74
  /** esbuild-loader */
105
-
106
75
  readonly ESBUILD: "esbuild";
107
76
  /** swc-loader */
108
-
109
77
  readonly SWC: "swc";
110
78
  /** style-loader */
111
-
112
79
  readonly STYLE: "style-loader";
113
80
  /** postcss-loader */
114
-
115
81
  readonly POSTCSS: "postcss";
116
82
  /** markdown-loader */
117
-
118
83
  readonly MARKDOWN: "markdown";
119
84
  /** ignore-css-loader */
120
-
121
85
  readonly IGNORE_CSS: "ignore-css";
122
86
  /** css-modules-typescript-loader */
123
-
124
87
  readonly CSS_MODULES_TS: "css-modules-typescript";
125
88
  /** mini-css-extract-plugin.loader */
126
-
127
89
  readonly MINI_CSS_EXTRACT: "mini-css-extract";
128
90
  /** builder-plugin-image-compress.loader */
129
-
130
91
  readonly IMAGE_COMPRESS: "image-compress";
131
92
  /** builder-plugin-image-compress svgo-loader */
132
-
133
93
  readonly SVGO: "svgo";
134
94
  /** builder-plugin-imagex */
135
-
136
95
  readonly IMAGEX: "imagex";
137
96
  };
138
97
  /** Predefined plugins */
139
-
140
98
  readonly PLUGIN: {
141
99
  /** HotModuleReplacementPlugin */
142
100
  readonly HMR: "hmr";
143
101
  /** CopyWebpackPlugin */
144
-
145
102
  readonly COPY: "copy";
146
103
  /** HtmlWebpackPlugin */
147
-
148
104
  readonly HTML: "html";
149
105
  /** DefinePlugin */
150
-
151
106
  readonly DEFINE: "define";
152
107
  /** IgnorePlugin */
153
-
154
108
  readonly IGNORE: "ignore";
155
109
  /** BannerPlugin */
156
-
157
110
  readonly BANNER: "banner";
158
111
  /** Webpackbar */
159
-
160
112
  readonly PROGRESS: "progress";
161
113
  /** Inspector */
162
-
163
114
  readonly INSPECTOR: "inspector";
164
115
  /** AppIconPlugin */
165
-
166
116
  readonly APP_ICON: "app-icon";
167
117
  /** FaviconUrlPlugin */
168
-
169
118
  readonly FAVICON_URL: "favicon-url";
170
119
  /** LoadableWebpackPlugin */
171
-
172
120
  readonly LOADABLE: "loadable";
173
121
  /** WebpackManifestPlugin */
174
-
175
122
  readonly MANIFEST: "webpack-manifest";
176
123
  /** ForkTsCheckerWebpackPlugin */
177
-
178
124
  readonly TS_CHECKER: "ts-checker";
179
125
  /** InlineChunkHtmlPlugin */
180
-
181
126
  readonly INLINE_HTML: "inline-html";
182
127
  /** WebpackBundleAnalyzer */
183
-
184
128
  readonly BUNDLE_ANALYZER: "bundle-analyze";
185
129
  /** BottomTemplatePlugin */
186
-
187
130
  readonly BOTTOM_TEMPLATE: "bottom-template";
188
131
  /** HtmlCrossOriginPlugin */
189
-
190
132
  readonly HTML_CROSS_ORIGIN: "html-cross-origin";
133
+ /** HtmlNoncePlugin */
134
+ readonly HTML_NONCE: "html-nonce";
191
135
  /** MiniCssExtractPlugin */
192
-
193
136
  readonly MINI_CSS_EXTRACT: "mini-css-extract";
194
137
  /** ReactFastRefreshPlugin */
195
-
196
138
  readonly REACT_FAST_REFRESH: "react-fast-refresh";
197
139
  /** ProvidePlugin for node polyfill */
198
-
199
140
  readonly NODE_POLYFILL_PROVIDE: "node-polyfill-provide";
200
141
  /** WebpackSRIPlugin */
201
-
202
142
  readonly SUBRESOURCE_INTEGRITY: "subresource-integrity";
203
143
  /** WebpackAssetsRetryPlugin */
204
-
205
144
  readonly ASSETS_RETRY: "ASSETS_RETRY";
206
145
  /** AutoSetRootFontSizePlugin */
207
-
208
146
  readonly AUTO_SET_ROOT_SIZE: "auto-set-root-size";
209
147
  /** HtmlAsyncChunkPlugin */
210
-
211
148
  readonly HTML_ASYNC_CHUNK: "html-async-chunk";
212
149
  /** SWC_POLYFILL_CHECKER */
213
-
214
150
  readonly SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin";
215
151
  /** HtmlTagsPlugin */
216
-
217
152
  readonly HTML_TAGS: "html-tags";
218
153
  };
219
154
  /** Predefined minimizers */
220
-
221
155
  readonly MINIMIZER: {
222
156
  /** TerserWebpackPlugin */
223
157
  readonly JS: "js";
224
158
  /** CssMinimizerWebpackPlugin */
225
-
226
159
  readonly CSS: "css";
227
160
  /** ESBuildPlugin */
228
-
229
161
  readonly ESBUILD: "js-css";
230
162
  /** SWCPlugin */
231
-
232
163
  readonly SWC: "swc";
233
164
  };
234
165
  /** Predefined resolve plugins */
235
-
236
166
  readonly RESOLVE_PLUGIN: {
237
167
  /** ModuleScopePlugin */
238
168
  readonly MODULE_SCOPE: "module-scope";
239
169
  /** TsConfigPathsPlugin */
240
-
241
170
  readonly TS_CONFIG_PATHS: "ts-config-paths";
242
171
  };
243
172
  };
@@ -2,101 +2,82 @@ import { InternalPlugins } from '@modern-js/types';
2
2
  /**
3
3
  * route specification file
4
4
  */
5
-
6
5
  export declare const ROUTE_SPEC_FILE = "route.json";
7
6
  /**
8
7
  * main entry name
9
8
  */
10
-
11
9
  export declare const MAIN_ENTRY_NAME = "main";
12
10
  /**
13
11
  * server side bundles directory, which relative to dist.
14
12
  */
15
-
16
13
  export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
17
14
  /**
18
15
  * server side bundles directory, which relative to dist.
19
16
  */
20
-
21
17
  export declare const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
22
18
  /**
23
19
  * entry name pattern used for ajv pattern properties.
24
20
  */
25
-
26
21
  export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
27
22
  /**
28
23
  * SSR server render function name
29
24
  */
30
-
31
25
  export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
32
26
  /**
33
27
  * loadbale manifest json file
34
28
  */
35
-
36
29
  export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
37
30
  /**
38
31
  * internal specified folder
39
32
  */
40
-
41
33
  export declare const API_DIR = "api";
42
34
  export declare const SERVER_DIR = "server";
43
35
  export declare const SHARED_DIR = "shared";
44
36
  /**
45
37
  * Modern.config.ts cached dir
46
38
  */
47
-
48
39
  export declare const CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
49
40
  export declare const CONFIG_FILE_EXTENSIONS: string[];
50
41
  /**
51
42
  * Serialized config path
52
43
  */
53
-
54
44
  export declare const OUTPUT_CONFIG_FILE = "modern.config.json";
55
45
  /**
56
46
  * Default server config basename
57
47
  */
58
-
59
48
  export declare const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
60
49
  /**
61
50
  * Routes manifest filename
62
51
  */
63
-
64
52
  export declare const ROUTE_MANIFEST_FILE = "routes-manifest.json";
65
53
  /**
66
54
  * directory name for loader routes
67
55
  */
68
-
69
56
  export declare const LOADER_ROUTES_DIR = "loader-routes";
70
57
  /**
71
58
  * default host for dev
72
59
  */
73
-
74
60
  export declare const DEFAULT_DEV_HOST = "0.0.0.0";
75
61
  /**
76
62
  * Internal app-tools plugins that work as soon as they are installed.
77
63
  */
78
-
79
64
  export declare const INTERNAL_APP_TOOLS_PLUGINS: InternalPlugins;
80
65
  export declare const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: InternalPlugins;
81
66
  /**
82
67
  * Internal module-tools plugins that work as soon as they are installed.
83
68
  */
84
-
85
69
  export declare const INTERNAL_MODULE_TOOLS_PLUGINS: InternalPlugins;
86
70
  /**
87
71
  * Internal monorepo-tools plugins that work as soon as they are installed.
88
72
  */
89
-
90
73
  export declare const INTERNAL_MONOREPO_TOOLS_PLUGINS: InternalPlugins;
91
74
  /**
92
75
  * Internal doc-tools plugins that work as soon as they are installed.
93
76
  */
94
-
95
77
  export declare const INTERNAL_DOC_TOOLS_PLUGINS: InternalPlugins;
96
78
  /**
97
79
  * Internal plugins that work as soon as they are installed.
98
80
  */
99
-
100
81
  export declare const INTERNAL_CLI_PLUGINS: InternalPlugins;
101
82
  export declare const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
102
83
  export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
@@ -107,7 +88,6 @@ export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
107
88
  /**
108
89
  * The schema registered in the plugin.
109
90
  */
110
-
111
91
  export declare const PLUGIN_SCHEMAS: {
112
92
  '@modern-js/runtime': ({
113
93
  target: string;
@@ -233,7 +213,6 @@ export declare const PLUGIN_SCHEMAS: {
233
213
  * - `@modern-js/builder-rspack-provider`
234
214
  * - `@modern-js/babel-preset-base`
235
215
  */
236
-
237
216
  export declare const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: {
238
217
  allowNamespaces: boolean;
239
218
  allExtensions: boolean;
@@ -8,7 +8,6 @@ export * from './commands';
8
8
  export * from './common';
9
9
  export * from './ensure';
10
10
  export * from './fs';
11
- export * from './generateMetaTags';
12
11
  export * from './logger';
13
12
  export * from './monorepo';
14
13
  export * from './package';
@@ -7,7 +7,6 @@ interface EntryPoint {
7
7
  * @param config - User config.
8
8
  * @returns Whether to use server side render.
9
9
  */
10
-
11
10
  export declare const isSSR: (config: any) => boolean;
12
11
  export declare const isUseSSRBundle: (config: any) => boolean;
13
12
  /**
@@ -16,7 +15,6 @@ export declare const isUseSSRBundle: (config: any) => boolean;
16
15
  * @param config - User config.
17
16
  * @returns Whether to use worker deploy.
18
17
  */
19
-
20
18
  export declare const isServiceWorker: (config: any) => boolean;
21
19
  export declare const isRouterV5: (config: {
22
20
  runtime?: {
@@ -9,7 +9,6 @@ export declare const isDepExists: (appDirectory: string, name: string) => boolea
9
9
  /**
10
10
  * Try to resolve npm package, return true if package is installed.
11
11
  */
12
-
13
12
  export declare const isPackageInstalled: (name: string, resolvePaths: string | string[]) => boolean;
14
13
  export declare const isApiOnly: (appDirectory: string, entryDir?: string) => Promise<boolean>;
15
14
  export declare const isWebOnly: () => Promise<boolean>;
@@ -21,5 +20,4 @@ export declare const isReact18: (cwd: string) => boolean;
21
20
  * @param root - App directory.
22
21
  * @returns Whether to use typescript.
23
22
  */
24
-
25
23
  export declare const isTypescript: (root: string) => boolean;
@@ -12,5 +12,4 @@ export declare function isRegExp(obj: any): obj is RegExp;
12
12
  * @param o - Any object.
13
13
  * @returns Whether it is empty object.
14
14
  */
15
-
16
15
  export declare const isEmpty: (o: Record<string, unknown>) => boolean;
@@ -46,7 +46,6 @@ declare const LOG_TYPES: {
46
46
  level: string;
47
47
  };
48
48
  };
49
-
50
49
  declare class Logger {
51
50
  private readonly level;
52
51
  private readonly config;
@@ -57,7 +56,6 @@ declare class Logger {
57
56
  private _log;
58
57
  private getLongestLabel;
59
58
  }
60
-
61
59
  type LoggerInterface = { [key in keyof typeof LOG_TYPES]: LoggerFunction };
62
60
  declare const logger: Logger & LoggerInterface;
63
61
  export { Logger };
@@ -8,10 +8,8 @@ export declare const getTemplatePath: (prefix?: string) => string;
8
8
  * Compile path string to RegExp.
9
9
  * @note Only support posix path.
10
10
  */
11
-
12
11
  export declare function compilePathMatcherRegExp(match: string | RegExp): RegExp;
13
12
  /** @internal @see {@link upwardPaths} */
14
-
15
13
  export declare const _joinPathParts: (_part: unknown, i: number, parts: _.List<string>) => string;
16
14
  export declare function upwardPaths(start: string): string[];
17
15
  export declare function getRealTemporaryDirectory(): string | null;
@@ -17,5 +17,4 @@ export declare function deleteRequireCache(path: string): void;
17
17
  * @param resolvePath - Path to resolve dependencies.
18
18
  * @returns Resolved file path.
19
19
  */
20
-
21
20
  export declare const tryResolve: (name: string, resolvePath: string) => string;
@@ -37,7 +37,6 @@ export type { default as WebpackChain } from '../compiled/webpack-chain';
37
37
  * Lazy import some expensive modules that will slow down startup speed.
38
38
  * Notice that `csmith-tools build` can not bundle lazy imported modules.
39
39
  */
40
-
41
40
  export declare const mime: typeof import('../compiled/mime-types');
42
41
  export declare const chokidar: typeof import('../compiled/chokidar');
43
42
  export declare const inquirer: typeof import('../compiled/inquirer');
@@ -1,2 +1 @@
1
- export * from './nestedRoutes';
2
- export * from './remixRouter';
1
+ export * from 'react-router-dom';
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
-
3
2
  /**
4
3
  * ssr helpers
5
4
  */
@@ -0,0 +1 @@
1
+ export * from 'react-router-dom/server';
@@ -5,5 +5,4 @@ export declare const ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
5
5
  /**
6
6
  * hmr socket connect path
7
7
  */
8
-
9
8
  export declare const HMR_SOCK_PATH = "/webpack-hmr";
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.19.1",
18
+ "version": "2.21.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -38,6 +38,14 @@
38
38
  "types": "./dist/types/runtime/router.d.ts",
39
39
  "default": "./dist/esm/runtime/router.js"
40
40
  },
41
+ "./runtime/remix-router": {
42
+ "types": "./dist/types/runtime/remixRouter.d.ts",
43
+ "default": "./dist/esm/runtime/remixRouter.js"
44
+ },
45
+ "./runtime/nested-routes": {
46
+ "types": "./dist/types/runtime/nestedRoutes.d.ts",
47
+ "default": "./dist/esm/runtime/nestedRoutes.js"
48
+ },
41
49
  "./runtime-browser": {
42
50
  "jsnext:source": "./src/runtime-browser/index.d.ts",
43
51
  "default": "./dist/esm/runtime-browser/index.js"
@@ -46,6 +54,10 @@
46
54
  "types": "./dist/types/runtime-node/index.d.ts",
47
55
  "default": "./dist/esm/runtime-node/index.js"
48
56
  },
57
+ "./runtime-node/router": {
58
+ "types": "./dist/types/runtime-node/router.d.ts",
59
+ "default": "./dist/esm/runtime-node/router.js"
60
+ },
49
61
  "./universal/constants": {
50
62
  "types": "./dist/types/universal/constants.d.ts",
51
63
  "import": "./dist/esm/universal/constants.js",
@@ -62,6 +74,8 @@
62
74
  "default": "./dist/cjs/universal/pluginDagSort.js"
63
75
  },
64
76
  "./ajv": "./dist/compiled/ajv/index.js",
77
+ "./commander": "./compiled/commander/index.js",
78
+ "./ora": "./compiled/ora/index.js",
65
79
  "./glob": "./dist/compiled/glob/index.js",
66
80
  "./chalk": "./dist/compiled/chalk/index.js",
67
81
  "./execa": "./dist/compiled/execa/index.js",
@@ -96,12 +110,21 @@
96
110
  "runtime/router": [
97
111
  "./dist/types/runtime/router.d.ts"
98
112
  ],
113
+ "runtime/remix-router": [
114
+ "./dist/types/runtime/remixRouter.d.ts"
115
+ ],
116
+ "runtime/nested-routes": [
117
+ "./dist/types/runtime/nestedRoutes.d.ts"
118
+ ],
99
119
  "runtime-browser": [
100
120
  "./dist/types/runtime-browser/index.d.ts"
101
121
  ],
102
122
  "runtime-node": [
103
123
  "./dist/types/runtime-node/index.d.ts"
104
124
  ],
125
+ "runtime-node/router": [
126
+ "./dist/types/runtime-node/router.d.ts"
127
+ ],
105
128
  "universal/constants": [
106
129
  "./dist/types/universal/constants.d.ts"
107
130
  ],
@@ -170,6 +193,12 @@
170
193
  ],
171
194
  "webpack-dev-middleware": [
172
195
  "./dist/compiled/webpack-dev-middleware/types/index.d.ts"
196
+ ],
197
+ "commander": [
198
+ "./dist/compiled/commander/typings/index.d.ts"
199
+ ],
200
+ "ora": [
201
+ "./dist/compiled/ora/index.d.ts"
173
202
  ]
174
203
  }
175
204
  },
@@ -177,12 +206,13 @@
177
206
  "caniuse-lite": "^1.0.30001451",
178
207
  "lodash": "^4.17.21",
179
208
  "serialize-javascript": "^6.0.0",
180
- "@remix-run/router": "^1.3.2"
209
+ "react-router-dom": "6.11.2",
210
+ "@remix-run/router": "1.6.2",
211
+ "@swc/helpers": "0.5.1"
181
212
  },
182
213
  "peerDependencies": {
183
214
  "react": ">=17.0.0",
184
- "react-dom": ">=17.0.0",
185
- "react-router-dom": "^6.8.1"
215
+ "react-dom": ">=17.0.0"
186
216
  },
187
217
  "peerDependenciesMeta": {
188
218
  "react": {
@@ -190,24 +220,20 @@
190
220
  },
191
221
  "react-dom": {
192
222
  "optional": true
193
- },
194
- "react-router-dom": {
195
- "optional": true
196
223
  }
197
224
  },
198
225
  "devDependencies": {
199
226
  "react": ">=17.0.0",
200
227
  "react-dom": ">=17.0.0",
201
- "react-router-dom": "^6.8.1",
202
228
  "@types/jest": "^29",
203
229
  "@types/node": "^14",
204
230
  "jest": "^29",
205
- "typescript": "^4",
231
+ "typescript": "^5",
206
232
  "webpack": "^5.82.1",
207
233
  "@types/serialize-javascript": "^5.0.1",
208
- "@modern-js/types": "2.19.1",
209
- "@scripts/build": "2.19.1",
210
- "@scripts/jest-config": "2.19.1"
234
+ "@modern-js/types": "2.21.0",
235
+ "@scripts/jest-config": "2.21.0",
236
+ "@scripts/build": "2.21.0"
211
237
  },
212
238
  "sideEffects": false,
213
239
  "scripts": {
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "generateMetaTags", {
6
- enumerable: true,
7
- get: () => generateMetaTags
8
- });
9
- const tagObjectToString = (tagDefinition) => {
10
- const attributes = Object.keys(tagDefinition.attributes || {}).filter((attributeName) => tagDefinition.attributes[attributeName] !== false).map((attributeName) => {
11
- if (tagDefinition.attributes[attributeName] === true) {
12
- return attributeName;
13
- }
14
- return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
15
- });
16
- return `<${[
17
- tagDefinition.tagName
18
- ].concat(attributes).join(" ")}>${tagDefinition.innerHTML || ""}${tagDefinition.voidTag ? "" : `</${tagDefinition.tagName}>`}`;
19
- };
20
- const generateMetaTags = (metaOptions) => {
21
- if (!metaOptions) {
22
- return "";
23
- }
24
- const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
25
- const metaTagContent = metaOptions[metaName];
26
- return typeof metaTagContent === "string" ? {
27
- name: metaName,
28
- content: metaTagContent
29
- } : metaTagContent;
30
- }).filter((attribute) => attribute !== false);
31
- return metaTagAttributeObjects.map((metaTagAttributes) => {
32
- if (metaTagAttributes === false) {
33
- throw new Error("Invalid meta tag");
34
- }
35
- return {
36
- tagName: "meta",
37
- voidTag: true,
38
- attributes: metaTagAttributes
39
- };
40
- }).reduce((memo, tagObject) => `${memo}
41
- ${tagObjectToString(tagObject)}`, "");
42
- };
@@ -1,34 +0,0 @@
1
- const tagObjectToString = (tagDefinition) => {
2
- const attributes = Object.keys(tagDefinition.attributes || {}).filter((attributeName) => tagDefinition.attributes[attributeName] !== false).map((attributeName) => {
3
- if (tagDefinition.attributes[attributeName] === true) {
4
- return attributeName;
5
- }
6
- return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
7
- });
8
- return `<${[
9
- tagDefinition.tagName
10
- ].concat(attributes).join(" ")}>${tagDefinition.innerHTML || ""}${tagDefinition.voidTag ? "" : `</${tagDefinition.tagName}>`}`;
11
- };
12
- export const generateMetaTags = (metaOptions) => {
13
- if (!metaOptions) {
14
- return "";
15
- }
16
- const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
17
- const metaTagContent = metaOptions[metaName];
18
- return typeof metaTagContent === "string" ? {
19
- name: metaName,
20
- content: metaTagContent
21
- } : metaTagContent;
22
- }).filter((attribute) => attribute !== false);
23
- return metaTagAttributeObjects.map((metaTagAttributes) => {
24
- if (metaTagAttributes === false) {
25
- throw new Error("Invalid meta tag");
26
- }
27
- return {
28
- tagName: "meta",
29
- voidTag: true,
30
- attributes: metaTagAttributes
31
- };
32
- }).reduce((memo, tagObject) => `${memo}
33
- ${tagObjectToString(tagObject)}`, "");
34
- };