@modern-js/app-tools 2.62.2-alpha.0 → 2.63.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.
Files changed (144) hide show
  1. package/bin/modern.js +1 -1
  2. package/dist/cjs/commands/build.js +19 -13
  3. package/dist/cjs/commands/deploy.js +5 -5
  4. package/dist/cjs/commands/dev.js +11 -11
  5. package/dist/cjs/commands/index.js +6 -6
  6. package/dist/cjs/commands/inspect.js +1 -1
  7. package/dist/cjs/commands/serve.js +4 -4
  8. package/dist/cjs/{new/compat → compat}/hooks.js +20 -8
  9. package/dist/cjs/{new/compat → compat}/index.js +10 -2
  10. package/dist/cjs/{new/compat → compat}/utils.js +10 -1
  11. package/dist/cjs/index.js +156 -7
  12. package/dist/cjs/plugins/analyze/getBundleEntry.js +2 -2
  13. package/dist/cjs/plugins/analyze/getFileSystemEntry.js +9 -9
  14. package/dist/cjs/plugins/analyze/getHtmlTemplate.js +51 -25
  15. package/dist/cjs/plugins/analyze/index.js +128 -130
  16. package/dist/cjs/plugins/deploy/index.js +12 -14
  17. package/dist/cjs/plugins/initialize/index.js +44 -50
  18. package/dist/cjs/plugins/serverBuild.js +30 -32
  19. package/dist/cjs/{new/run.js → run/index.js} +6 -6
  20. package/dist/cjs/{new/types/index.js → types/new.js} +2 -2
  21. package/dist/cjs/{new → utils}/getConfigFile.js +1 -1
  22. package/dist/cjs/{new/context.js → utils/initAppContext.js} +5 -5
  23. package/dist/cjs/{new/utils/index.js → utils/isAutoLoadPlugins.js} +6 -6
  24. package/dist/cjs/utils/loadPlugins.js +35 -4
  25. package/dist/cjs/utils/printInstructions.js +2 -2
  26. package/dist/cjs/utils/restart.js +4 -3
  27. package/dist/esm/commands/build.js +18 -12
  28. package/dist/esm/commands/deploy.js +6 -6
  29. package/dist/esm/commands/dev.js +10 -10
  30. package/dist/esm/commands/index.js +8 -8
  31. package/dist/esm/commands/inspect.js +1 -1
  32. package/dist/esm/commands/serve.js +5 -5
  33. package/dist/esm/{new/compat → compat}/hooks.js +65 -41
  34. package/dist/esm/{new/compat → compat}/index.js +13 -2
  35. package/dist/{esm-node/new → esm}/compat/utils.js +10 -1
  36. package/dist/esm/index.js +248 -5
  37. package/dist/esm/plugins/analyze/getBundleEntry.js +3 -3
  38. package/dist/esm/plugins/analyze/getFileSystemEntry.js +12 -12
  39. package/dist/esm/plugins/analyze/getHtmlTemplate.js +101 -28
  40. package/dist/esm/plugins/analyze/index.js +328 -331
  41. package/dist/esm/plugins/deploy/index.js +84 -88
  42. package/dist/esm/plugins/initialize/index.js +61 -64
  43. package/dist/esm/plugins/serverBuild.js +52 -56
  44. package/dist/esm/{new/run.js → run/index.js} +6 -6
  45. package/dist/esm/{new → utils}/getConfigFile.js +1 -1
  46. package/dist/esm/{new/context.js → utils/initAppContext.js} +3 -3
  47. package/dist/esm/{new/utils/index.js → utils/isAutoLoadPlugins.js} +6 -6
  48. package/dist/esm/utils/loadPlugins.js +95 -7
  49. package/dist/esm/utils/printInstructions.js +3 -3
  50. package/dist/esm/utils/restart.js +5 -4
  51. package/dist/esm-node/commands/build.js +19 -13
  52. package/dist/esm-node/commands/deploy.js +5 -5
  53. package/dist/esm-node/commands/dev.js +11 -11
  54. package/dist/esm-node/commands/index.js +6 -6
  55. package/dist/esm-node/commands/inspect.js +1 -1
  56. package/dist/esm-node/commands/serve.js +4 -4
  57. package/dist/esm-node/{new/compat → compat}/hooks.js +20 -8
  58. package/dist/esm-node/{new/compat → compat}/index.js +10 -2
  59. package/dist/{esm/new → esm-node}/compat/utils.js +10 -1
  60. package/dist/esm-node/index.js +143 -5
  61. package/dist/esm-node/plugins/analyze/getBundleEntry.js +2 -2
  62. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +9 -9
  63. package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +49 -24
  64. package/dist/esm-node/plugins/analyze/index.js +128 -130
  65. package/dist/esm-node/plugins/deploy/index.js +12 -14
  66. package/dist/esm-node/plugins/initialize/index.js +44 -50
  67. package/dist/esm-node/plugins/serverBuild.js +30 -32
  68. package/dist/esm-node/{new/run.js → run/index.js} +6 -6
  69. package/dist/esm-node/{new → utils}/getConfigFile.js +1 -1
  70. package/dist/esm-node/{new/context.js → utils/initAppContext.js} +3 -3
  71. package/dist/esm-node/{new/utils/index.js → utils/isAutoLoadPlugins.js} +2 -2
  72. package/dist/esm-node/utils/loadPlugins.js +34 -4
  73. package/dist/esm-node/utils/printInstructions.js +2 -2
  74. package/dist/esm-node/utils/restart.js +4 -3
  75. package/dist/types/builder/generator/adapterCopy.d.ts +2 -1
  76. package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +3 -2
  77. package/dist/types/builder/generator/createCopyPattern.d.ts +4 -3
  78. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +2 -2
  79. package/dist/types/builder/index.d.ts +1 -1
  80. package/dist/types/builder/shared/createCopyInfo.d.ts +3 -2
  81. package/dist/types/builder/shared/types.d.ts +3 -2
  82. package/dist/types/commands/build.d.ts +2 -2
  83. package/dist/types/commands/deploy.d.ts +2 -2
  84. package/dist/types/commands/dev.d.ts +2 -2
  85. package/dist/types/commands/index.d.ts +6 -6
  86. package/dist/types/commands/inspect.d.ts +2 -2
  87. package/dist/types/commands/serve.d.ts +2 -2
  88. package/dist/types/compat/hooks.d.ts +7 -0
  89. package/dist/types/compat/index.d.ts +2 -0
  90. package/dist/types/config/default.d.ts +4 -3
  91. package/dist/types/config/initialize/index.d.ts +3 -2
  92. package/dist/types/config/initialize/inits.d.ts +4 -3
  93. package/dist/types/index.d.ts +8 -5
  94. package/dist/types/plugins/analyze/getBundleEntry.d.ts +3 -3
  95. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +3 -3
  96. package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +26 -5
  97. package/dist/types/plugins/analyze/getServerRoutes.d.ts +2 -2
  98. package/dist/types/plugins/analyze/index.d.ts +2 -3
  99. package/dist/types/plugins/deploy/index.d.ts +2 -3
  100. package/dist/types/plugins/deploy/platforms/platform.d.ts +3 -3
  101. package/dist/types/plugins/deploy/utils.d.ts +2 -2
  102. package/dist/types/plugins/initialize/index.d.ts +2 -2
  103. package/dist/types/plugins/serverBuild.d.ts +2 -2
  104. package/dist/types/types/index.d.ts +7 -3
  105. package/dist/types/types/new.d.ts +157 -0
  106. package/dist/types/utils/env.d.ts +2 -2
  107. package/dist/types/utils/generateWatchFiles.d.ts +2 -2
  108. package/dist/types/{new/context.d.ts → utils/initAppContext.d.ts} +0 -1
  109. package/dist/types/utils/isAutoLoadPlugins.d.ts +1 -0
  110. package/dist/types/utils/loadPlugins.d.ts +13 -3
  111. package/dist/types/utils/printInstructions.d.ts +3 -3
  112. package/dist/types/utils/restart.d.ts +2 -3
  113. package/dist/types/utils/routes.d.ts +2 -1
  114. package/lib/types.d.ts +82 -61
  115. package/package.json +24 -24
  116. package/dist/cjs/hooks.js +0 -60
  117. package/dist/cjs/new/index.js +0 -79
  118. package/dist/cjs/new/loadPlugins.js +0 -57
  119. package/dist/cjs/old.js +0 -179
  120. package/dist/esm/hooks.js +0 -36
  121. package/dist/esm/new/index.js +0 -55
  122. package/dist/esm/new/loadPlugins.js +0 -94
  123. package/dist/esm/old.js +0 -258
  124. package/dist/esm-node/hooks.js +0 -36
  125. package/dist/esm-node/new/index.js +0 -52
  126. package/dist/esm-node/new/loadPlugins.js +0 -33
  127. package/dist/esm-node/old.js +0 -140
  128. package/dist/types/hooks.d.ts +0 -2
  129. package/dist/types/new/compat/hooks.d.ts +0 -8
  130. package/dist/types/new/compat/index.d.ts +0 -4
  131. package/dist/types/new/index.d.ts +0 -9
  132. package/dist/types/new/loadPlugins.d.ts +0 -9
  133. package/dist/types/new/types/index.d.ts +0 -90
  134. package/dist/types/new/utils/index.d.ts +0 -1
  135. package/dist/types/old.d.ts +0 -13
  136. /package/dist/cjs/{new/constants.js → constants.js} +0 -0
  137. /package/dist/esm/{new/constants.js → constants.js} +0 -0
  138. /package/dist/esm/{new/types/index.js → types/new.js} +0 -0
  139. /package/dist/esm-node/{new/constants.js → constants.js} +0 -0
  140. /package/dist/esm-node/{new/types/index.js → types/new.js} +0 -0
  141. /package/dist/types/{new/compat → compat}/utils.d.ts +0 -0
  142. /package/dist/types/{new/constants.d.ts → constants.d.ts} +0 -0
  143. /package/dist/types/{new/run.d.ts → run/index.d.ts} +0 -0
  144. /package/dist/types/{new → utils}/getConfigFile.d.ts +0 -0
@@ -0,0 +1 @@
1
+ export declare function isAutoLoadPlugins(appDirectory: string, configFile?: string, packageJsonConfig?: string): Promise<boolean>;
@@ -1,5 +1,15 @@
1
+ import type { CLIPluginAPI } from '@modern-js/plugin-v2';
2
+ import type { Plugin } from '@modern-js/plugin-v2';
1
3
  import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
2
4
  import type { ServerPlugin } from '@modern-js/types';
3
- import type { AppTools, PluginAPI } from '../types';
4
- export declare function getServerPlugins(api: PluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
5
- export declare function loadServerPlugins(api: PluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
5
+ import type { InternalPlugins } from '@modern-js/types';
6
+ import type { AppTools } from '../types';
7
+ export declare function getServerPlugins(api: CLIPluginAPI<AppTools<'shared'>>, metaName?: string): Promise<ServerPlugin[]>;
8
+ export declare function loadServerPlugins(api: CLIPluginAPI<AppTools<'shared'>>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
9
+ /**
10
+ * Load internal plugins which in @modern-js scope and user's custom plugins.
11
+ * @param appDirectory - Application root directory.
12
+ * @param internalPlugins - Internal plugins.
13
+ * @returns Plugin Objects has been required.
14
+ */
15
+ export declare const loadInternalPlugins: (appDirectory: string, internalPlugins?: InternalPlugins, autoLoad?: InternalPlugins, autoLoadPlugins?: boolean) => Promise<Plugin[]>;
@@ -1,3 +1,3 @@
1
- import type { CliHooksRunner, IAppContext } from '@modern-js/core';
2
- import type { AppNormalizedConfig, AppTools } from '../types';
3
- export declare const printInstructions: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<void>;
1
+ import type { AppNormalizedConfig } from '../types';
2
+ import type { AppToolsContext, AppToolsHooks } from '../types/new';
3
+ export declare const printInstructions: (hooks: AppToolsHooks<'shared'>, appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>) => Promise<void>;
@@ -1,3 +1,2 @@
1
- import type { ToRunners } from '@modern-js/core';
2
- import type { AppToolsHooks } from '../types/hooks';
3
- export declare function restart(hooksRunner: ToRunners<AppToolsHooks>, filename: string): Promise<void>;
1
+ import type { AppToolsHooks } from '../types/new';
2
+ export declare function restart(hooks: AppToolsHooks<'shared'>, filename: string): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import type { IAppContext } from '@modern-js/core';
2
- export declare const generateRoutes: (appContext: IAppContext) => Promise<void>;
2
+ import type { AppToolsContext } from '../types/new';
3
+ export declare const generateRoutes: (appContext: AppToolsContext<'shared'> | IAppContext) => Promise<void>;
3
4
  export declare const getPathWithoutExt: (filename: string) => string;
4
5
  export declare const isMainEntry: (entryName: string, mainEntryName?: string) => boolean;
package/lib/types.d.ts CHANGED
@@ -11,6 +11,10 @@ declare namespace NodeJS {
11
11
  }
12
12
  }
13
13
 
14
+ // reference @rsbuild/core/types, but there are some differences, such as svg
15
+ /**
16
+ * Image assets
17
+ */
14
18
  declare module '*.bmp' {
15
19
  const src: string;
16
20
  export default src;
@@ -36,143 +40,152 @@ declare module '*.png' {
36
40
  export default src;
37
41
  }
38
42
 
39
- declare module '*.avif' {
43
+ declare module '*.pjpeg' {
40
44
  const src: string;
41
45
  export default src;
42
46
  }
43
-
44
- declare module '*.ico' {
47
+ declare module '*.pjp' {
45
48
  const src: string;
46
49
  export default src;
47
50
  }
48
-
49
- declare module '*.webp' {
51
+ declare module '*.apng' {
50
52
  const src: string;
51
53
  export default src;
52
54
  }
53
-
54
- declare module '*.svg' {
55
- import * as React from 'react';
56
-
57
- export const ReactComponent: React.FunctionComponent<
58
- React.SVGProps<SVGSVGElement>
59
- >;
60
-
61
- /**
62
- * The default export type depends on the svgDefaultExport config,
63
- * it can be a string or a ReactComponent
64
- * */
65
- const content: any;
66
- export default content;
55
+ declare module '*.tif' {
56
+ const src: string;
57
+ export default src;
67
58
  }
68
-
69
- declare module '*.svg?react' {
70
- const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
71
- export default ReactComponent;
59
+ declare module '*.tiff' {
60
+ const src: string;
61
+ export default src;
72
62
  }
73
-
74
- declare module '*.bmp?inline' {
63
+ declare module '*.jfif' {
75
64
  const src: string;
76
65
  export default src;
77
66
  }
78
67
 
79
- declare module '*.gif?inline' {
68
+ declare module '*.avif' {
80
69
  const src: string;
81
70
  export default src;
82
71
  }
83
72
 
84
- declare module '*.jpg?inline' {
73
+ declare module '*.ico' {
85
74
  const src: string;
86
75
  export default src;
87
76
  }
88
77
 
89
- declare module '*.jpeg?inline' {
78
+ declare module '*.webp' {
90
79
  const src: string;
91
80
  export default src;
92
81
  }
93
82
 
94
- declare module '*.png?inline' {
83
+ /**
84
+ * Font assets
85
+ */
86
+ declare module '*.woff' {
95
87
  const src: string;
96
88
  export default src;
97
89
  }
98
-
99
- declare module '*.avif?inline' {
90
+ declare module '*.woff2' {
100
91
  const src: string;
101
92
  export default src;
102
93
  }
103
-
104
- declare module '*.ico?inline' {
94
+ declare module '*.eot' {
105
95
  const src: string;
106
96
  export default src;
107
97
  }
108
-
109
- declare module '*.webp?inline' {
98
+ declare module '*.ttf' {
110
99
  const src: string;
111
100
  export default src;
112
101
  }
113
-
114
- declare module '*.svg?inline' {
115
- import * as React from 'react';
116
-
117
- export const ReactComponent: React.FunctionComponent<
118
- React.SVGProps<SVGSVGElement>
119
- >;
120
-
102
+ declare module '*.otf' {
121
103
  const src: string;
122
104
  export default src;
123
105
  }
124
-
125
- declare module '*.bmp?url' {
106
+ declare module '*.ttc' {
126
107
  const src: string;
127
108
  export default src;
128
109
  }
129
110
 
130
- declare module '*.gif?url' {
111
+ /**
112
+ * Media assets
113
+ */
114
+ declare module '*.mp4' {
131
115
  const src: string;
132
116
  export default src;
133
117
  }
134
-
135
- declare module '*.jpg?url' {
118
+ declare module '*.webm' {
136
119
  const src: string;
137
120
  export default src;
138
121
  }
139
-
140
- declare module '*.jpeg?url' {
122
+ declare module '*.ogg' {
141
123
  const src: string;
142
124
  export default src;
143
125
  }
144
-
145
- declare module '*.png?url' {
126
+ declare module '*.mp3' {
146
127
  const src: string;
147
128
  export default src;
148
129
  }
149
-
150
- declare module '*.avif?url' {
130
+ declare module '*.wav' {
151
131
  const src: string;
152
132
  export default src;
153
133
  }
154
-
155
- declare module '*.ico?url' {
134
+ declare module '*.flac' {
156
135
  const src: string;
157
136
  export default src;
158
137
  }
159
-
160
- declare module '*.webp?url' {
138
+ declare module '*.aac' {
139
+ const src: string;
140
+ export default src;
141
+ }
142
+ declare module '*.mov' {
143
+ const src: string;
144
+ export default src;
145
+ }
146
+ declare module '*.m4a' {
147
+ const src: string;
148
+ export default src;
149
+ }
150
+ declare module '*.opus' {
161
151
  const src: string;
162
152
  export default src;
163
153
  }
164
154
 
165
- declare module '*.svg?url' {
155
+ declare module '*.svg' {
166
156
  import * as React from 'react';
167
157
 
168
158
  export const ReactComponent: React.FunctionComponent<
169
159
  React.SVGProps<SVGSVGElement>
170
160
  >;
171
161
 
162
+ /**
163
+ * The default export type depends on the svgDefaultExport config,
164
+ * it can be a string or a ReactComponent
165
+ * */
166
+ const content: any;
167
+ export default content;
168
+ }
169
+
170
+ declare module '*.svg?react' {
171
+ const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
172
+ export default ReactComponent;
173
+ }
174
+
175
+ /**
176
+ * Queries
177
+ */
178
+ declare module '*?inline' {
179
+ const content: string;
180
+ export default content;
181
+ }
182
+
183
+ declare module '*?url' {
172
184
  const src: string;
173
185
  export default src;
174
186
  }
175
187
 
188
+
176
189
  declare module '*.css' {
177
190
  const classes: { readonly [key: string]: string };
178
191
  export default classes;
@@ -193,6 +206,9 @@ declare module '*.sass' {
193
206
  export default classes;
194
207
  }
195
208
 
209
+ /**
210
+ * CSS Modules
211
+ */
196
212
  declare module '*.module.css' {
197
213
  const classes: { readonly [key: string]: string };
198
214
  export default classes;
@@ -224,12 +240,17 @@ declare module '*.hbs' {
224
240
  }
225
241
 
226
242
  declare module '*.yaml' {
227
- const src: string;
243
+ const src: Record<string, any>;
228
244
  export default src;
229
245
  }
230
246
 
247
+ declare module '*.yml' {
248
+ const content: Record<string, any>;
249
+ export default content;
250
+ }
251
+
231
252
  declare module '*.toml' {
232
- const src: string;
253
+ const src: Record<string, any>;
233
254
  export default src;
234
255
  }
235
256
 
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.62.2-alpha.0",
18
+ "version": "2.63.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",
@@ -35,9 +35,9 @@
35
35
  "default": "./dist/cjs/index.js"
36
36
  },
37
37
  "./cli/run": {
38
- "types": "./dist/types/new/run.d.ts",
39
- "jsnext:source": "./src/new/run.ts",
40
- "default": "./dist/cjs/new/run.js"
38
+ "types": "./dist/types/run/index.d.ts",
39
+ "jsnext:source": "./src/run/index.ts",
40
+ "default": "./dist/cjs/run/index.js"
41
41
  },
42
42
  "./types": {
43
43
  "types": "./lib/types.d.ts",
@@ -64,7 +64,7 @@
64
64
  "./dist/types/index.d.ts"
65
65
  ],
66
66
  "cli/run": [
67
- "./dist/types/new/run.d.ts"
67
+ "./dist/types/run/index.d.ts"
68
68
  ],
69
69
  "types": [
70
70
  "./lib/types.d.ts"
@@ -85,8 +85,8 @@
85
85
  "@babel/parser": "^7.22.15",
86
86
  "@babel/traverse": "^7.23.2",
87
87
  "@babel/types": "^7.26.0",
88
- "@rsbuild/core": "~1.1.0",
89
- "@rsbuild/plugin-node-polyfill": "~1.2.0",
88
+ "@rsbuild/core": "1.1.8",
89
+ "@rsbuild/plugin-node-polyfill": "1.2.0",
90
90
  "@swc/helpers": "0.5.13",
91
91
  "@vercel/nft": "^0.26.4",
92
92
  "es-module-lexer": "^1.1.0",
@@ -96,23 +96,23 @@
96
96
  "mlly": "^1.6.1",
97
97
  "pkg-types": "^1.1.0",
98
98
  "std-env": "^3.7.0",
99
- "@modern-js/plugin-v2": "2.60.6",
100
- "@modern-js/core": "2.62.1",
101
- "@modern-js/plugin": "2.62.1",
102
- "@modern-js/plugin-i18n": "2.62.1",
103
- "@modern-js/plugin-data-loader": "2.62.1",
104
- "@modern-js/prod-server": "2.62.1",
105
- "@modern-js/rsbuild-plugin-esbuild": "2.62.1",
106
- "@modern-js/node-bundle-require": "2.62.1",
107
- "@modern-js/server": "2.62.1",
108
- "@modern-js/uni-builder": "2.62.1",
109
- "@modern-js/server-utils": "2.62.1",
110
- "@modern-js/server-core": "2.62.1",
111
- "@modern-js/utils": "2.62.1",
112
- "@modern-js/types": "2.62.1"
99
+ "@modern-js/core": "2.63.0",
100
+ "@modern-js/node-bundle-require": "2.63.0",
101
+ "@modern-js/plugin": "2.63.0",
102
+ "@modern-js/plugin-i18n": "2.63.0",
103
+ "@modern-js/plugin-v2": "2.63.0",
104
+ "@modern-js/prod-server": "2.63.0",
105
+ "@modern-js/rsbuild-plugin-esbuild": "2.63.0",
106
+ "@modern-js/server": "2.63.0",
107
+ "@modern-js/server-core": "2.63.0",
108
+ "@modern-js/server-utils": "2.63.0",
109
+ "@modern-js/types": "2.63.0",
110
+ "@modern-js/uni-builder": "2.63.0",
111
+ "@modern-js/utils": "2.63.0",
112
+ "@modern-js/plugin-data-loader": "2.63.0"
113
113
  },
114
114
  "devDependencies": {
115
- "@rsbuild/plugin-webpack-swc": "~1.0.3",
115
+ "@rsbuild/plugin-webpack-swc": "1.0.9",
116
116
  "@types/babel__traverse": "7.20.6",
117
117
  "@types/jest": "^29",
118
118
  "@types/node": "^16",
@@ -121,8 +121,8 @@
121
121
  "tsconfig-paths": "^4.2.0",
122
122
  "typescript": "^5",
123
123
  "webpack": "^5.96.1",
124
- "@scripts/build": "2.62.1",
125
- "@scripts/jest-config": "2.62.1"
124
+ "@scripts/build": "2.63.0",
125
+ "@scripts/jest-config": "2.63.0"
126
126
  },
127
127
  "peerDependencies": {
128
128
  "ts-node": "^10.7.0",
package/dist/cjs/hooks.js DELETED
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var hooks_exports = {};
20
- __export(hooks_exports, {
21
- hooks: () => hooks
22
- });
23
- module.exports = __toCommonJS(hooks_exports);
24
- var import_plugin = require("@modern-js/plugin");
25
- const hooks = {
26
- _internalRuntimePlugins: (0, import_plugin.createAsyncWaterfall)(),
27
- modifyFileSystemRoutes: (0, import_plugin.createAsyncWaterfall)(),
28
- modifyServerRoutes: (0, import_plugin.createAsyncWaterfall)(),
29
- /** add entry point info to entrypoints array */
30
- modifyEntrypoints: (0, import_plugin.createAsyncWaterfall)(),
31
- /** add entry type */
32
- checkEntryPoint: (0, import_plugin.createAsyncWaterfall)(),
33
- generateEntryCode: (0, import_plugin.createAsyncWorkflow)(),
34
- htmlPartials: (0, import_plugin.createAsyncWaterfall)(),
35
- beforeGenerateRoutes: (0, import_plugin.createAsyncWaterfall)(),
36
- _internalServerPlugins: (0, import_plugin.createAsyncWaterfall)(),
37
- beforeDev: (0, import_plugin.createAsyncWorkflow)(),
38
- afterDev: (0, import_plugin.createAsyncWorkflow)(),
39
- beforeCreateCompiler: (0, import_plugin.createAsyncWorkflow)(),
40
- afterCreateCompiler: (0, import_plugin.createAsyncWorkflow)(),
41
- beforePrintInstructions: (0, import_plugin.createAsyncWaterfall)(),
42
- beforeBuild: (0, import_plugin.createAsyncWorkflow)(),
43
- afterBuild: (0, import_plugin.createAsyncWorkflow)(),
44
- beforeDeploy: (0, import_plugin.createAsyncWorkflow)(),
45
- deploy: (0, import_plugin.createAsyncWorkflow)(),
46
- afterDeploy: (0, import_plugin.createAsyncWorkflow)(),
47
- beforeRestart: (0, import_plugin.createAsyncWorkflow)(),
48
- /**
49
- * @deprecated
50
- */
51
- registerDev: (0, import_plugin.createParallelWorkflow)(),
52
- /**
53
- * @deprecated
54
- */
55
- registerBuildPlatform: (0, import_plugin.createParallelWorkflow)()
56
- };
57
- // Annotate the CommonJS export names for ESM import in node:
58
- 0 && (module.exports = {
59
- hooks
60
- });
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var new_exports = {};
21
- __export(new_exports, {
22
- appTools: () => appTools,
23
- initAppContext: () => import_context.initAppContext
24
- });
25
- module.exports = __toCommonJS(new_exports);
26
- var import_plugin_v2 = require("@modern-js/plugin-v2");
27
- var import_old = require("../old");
28
- var import_compat = require("./compat");
29
- var import_constants = require("./constants");
30
- var import_context = require("./context");
31
- __reExport(new_exports, require("../defineConfig"), module.exports);
32
- const appTools = (options = {
33
- // default webpack to be compatible with original projects
34
- bundler: "webpack"
35
- }) => ({
36
- name: "@modern-js/app-tools",
37
- usePlugins: [
38
- (0, import_compat.compatPlugin)(),
39
- (0, import_old.appTools)(options)
40
- ],
41
- post: [
42
- "@modern-js/app-tools-old"
43
- ],
44
- registryHooks: {
45
- onBeforeConfig: (0, import_plugin_v2.createAsyncHook)(),
46
- onAfterPrepare: (0, import_plugin_v2.createAsyncHook)(),
47
- deploy: (0, import_plugin_v2.createAsyncHook)(),
48
- _internalRuntimePlugins: (0, import_plugin_v2.createAsyncHook)(),
49
- _internalServerPlugins: (0, import_plugin_v2.createAsyncHook)(),
50
- checkEntryPoint: (0, import_plugin_v2.createAsyncHook)(),
51
- modifyEntrypoints: (0, import_plugin_v2.createAsyncHook)(),
52
- modifyFileSystemRoutes: (0, import_plugin_v2.createAsyncHook)(),
53
- modifyServerRoutes: (0, import_plugin_v2.createAsyncHook)(),
54
- generateEntryCode: (0, import_plugin_v2.createAsyncHook)(),
55
- onBeforeGenerateRoutes: (0, import_plugin_v2.createAsyncHook)(),
56
- onBeforePrintInstructions: (0, import_plugin_v2.createAsyncHook)(),
57
- registerDev: (0, import_plugin_v2.createAsyncHook)(),
58
- registerBuildPlatform: (0, import_plugin_v2.createAsyncHook)(),
59
- addRuntimeExports: (0, import_plugin_v2.createAsyncHook)()
60
- },
61
- setup: (api) => {
62
- var _userConfig_output;
63
- const context = api.getAppContext();
64
- const userConfig = api.getConfig();
65
- api.updateAppContext((0, import_context.initAppContext)({
66
- appDirectory: context.appDirectory,
67
- options: {},
68
- serverConfigFile: import_constants.DEFAULT_SERVER_CONFIG_FILE,
69
- runtimeConfigFile: import_constants.DEFAULT_RUNTIME_CONFIG_FILE,
70
- tempDir: (_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir
71
- }));
72
- }
73
- });
74
- // Annotate the CommonJS export names for ESM import in node:
75
- 0 && (module.exports = {
76
- appTools,
77
- initAppContext,
78
- ...require("../defineConfig")
79
- });
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var loadPlugins_exports = {};
20
- __export(loadPlugins_exports, {
21
- loadInternalPlugins: () => loadInternalPlugins
22
- });
23
- module.exports = __toCommonJS(loadPlugins_exports);
24
- var import_utils = require("@modern-js/utils");
25
- const debug = (0, import_utils.createDebugger)("load-plugins");
26
- const resolveCliPlugin = async (p, appDirectory) => {
27
- const pkg = typeof p === "string" ? p : p[0];
28
- const pluginOptions = typeof p === "string" ? void 0 : p[1];
29
- const path = (0, import_utils.tryResolve)(pkg, appDirectory);
30
- let module2;
31
- try {
32
- module2 = await (0, import_utils.compatibleRequire)(path);
33
- } catch (e) {
34
- ({ default: module2 } = await (0, import_utils.dynamicImport)(path));
35
- }
36
- if (typeof module2 === "function") {
37
- const result = module2(pluginOptions);
38
- return result;
39
- }
40
- return module2;
41
- };
42
- const loadInternalPlugins = async (appDirectory, internalPlugins, autoLoad, autoLoadPlugins) => {
43
- const plugins = [
44
- ...autoLoadPlugins ? (0, import_utils.getInternalPlugins)(appDirectory, internalPlugins) : [],
45
- ...autoLoad ? (0, import_utils.getInternalPlugins)(appDirectory, autoLoad) : []
46
- ];
47
- const loadedPlugins = await Promise.all(plugins.map((plugin) => {
48
- const loadedPlugin = resolveCliPlugin(plugin, appDirectory);
49
- debug(`resolve plugin %s: %s`, plugin, loadedPlugin);
50
- return loadedPlugin;
51
- }));
52
- return loadedPlugins;
53
- };
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- loadInternalPlugins
57
- });