@modern-js/app-tools 2.63.0 → 2.63.1

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 (61) hide show
  1. package/dist/cjs/commands/dev.js +1 -1
  2. package/dist/cjs/commands/serve.js +1 -1
  3. package/dist/cjs/new/compat/hooks.js +11 -4
  4. package/dist/cjs/new/compat/utils.js +10 -1
  5. package/dist/cjs/new/context.js +0 -1
  6. package/dist/cjs/plugins/analyze/getBundleEntry.js +2 -2
  7. package/dist/cjs/plugins/analyze/getFileSystemEntry.js +9 -9
  8. package/dist/cjs/plugins/analyze/getHtmlTemplate.js +51 -25
  9. package/dist/cjs/plugins/analyze/index.js +128 -130
  10. package/dist/cjs/plugins/deploy/index.js +12 -14
  11. package/dist/cjs/plugins/initialize/index.js +1 -1
  12. package/dist/cjs/utils/printInstructions.js +12 -3
  13. package/dist/cjs/utils/restart.js +2 -1
  14. package/dist/esm/commands/dev.js +2 -2
  15. package/dist/esm/commands/serve.js +2 -2
  16. package/dist/esm/new/compat/hooks.js +27 -17
  17. package/dist/esm/new/compat/utils.js +10 -1
  18. package/dist/esm/new/context.js +0 -1
  19. package/dist/esm/plugins/analyze/getBundleEntry.js +3 -3
  20. package/dist/esm/plugins/analyze/getFileSystemEntry.js +12 -12
  21. package/dist/esm/plugins/analyze/getHtmlTemplate.js +101 -28
  22. package/dist/esm/plugins/analyze/index.js +328 -331
  23. package/dist/esm/plugins/deploy/index.js +84 -88
  24. package/dist/esm/plugins/initialize/index.js +1 -1
  25. package/dist/esm/utils/printInstructions.js +29 -2
  26. package/dist/esm/utils/restart.js +2 -1
  27. package/dist/esm-node/commands/dev.js +2 -2
  28. package/dist/esm-node/commands/serve.js +2 -2
  29. package/dist/esm-node/new/compat/hooks.js +11 -4
  30. package/dist/esm-node/new/compat/utils.js +10 -1
  31. package/dist/esm-node/new/context.js +0 -1
  32. package/dist/esm-node/plugins/analyze/getBundleEntry.js +2 -2
  33. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +9 -9
  34. package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +49 -24
  35. package/dist/esm-node/plugins/analyze/index.js +128 -130
  36. package/dist/esm-node/plugins/deploy/index.js +12 -14
  37. package/dist/esm-node/plugins/initialize/index.js +1 -1
  38. package/dist/esm-node/utils/printInstructions.js +10 -2
  39. package/dist/esm-node/utils/restart.js +2 -1
  40. package/dist/types/builder/generator/adapterCopy.d.ts +2 -1
  41. package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +3 -2
  42. package/dist/types/builder/generator/createCopyPattern.d.ts +4 -3
  43. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +2 -2
  44. package/dist/types/builder/index.d.ts +1 -1
  45. package/dist/types/builder/shared/createCopyInfo.d.ts +3 -2
  46. package/dist/types/builder/shared/types.d.ts +3 -2
  47. package/dist/types/config/initialize/index.d.ts +3 -2
  48. package/dist/types/config/initialize/inits.d.ts +4 -3
  49. package/dist/types/new/context.d.ts +0 -1
  50. package/dist/types/plugins/analyze/getBundleEntry.d.ts +3 -3
  51. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +3 -3
  52. package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +26 -5
  53. package/dist/types/plugins/analyze/getServerRoutes.d.ts +2 -2
  54. package/dist/types/plugins/analyze/index.d.ts +2 -3
  55. package/dist/types/plugins/deploy/index.d.ts +2 -3
  56. package/dist/types/plugins/deploy/platforms/platform.d.ts +3 -3
  57. package/dist/types/plugins/deploy/utils.d.ts +2 -2
  58. package/dist/types/types/new.d.ts +38 -21
  59. package/dist/types/utils/printInstructions.d.ts +3 -1
  60. package/dist/types/utils/routes.d.ts +2 -1
  61. package/package.json +20 -20
@@ -1,6 +1,7 @@
1
1
  import type { DevToolData, RegisterBuildPlatformResult } from '@modern-js/core';
2
- import type { AppContext, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin-v2';
3
- import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
2
+ import type { AppContext, AsyncHook, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin-v2';
3
+ import type { Hooks } from '@modern-js/plugin-v2/cli';
4
+ import type { Entrypoint, HtmlPartials, HtmlTemplates, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
4
5
  import type { AppTools } from '.';
5
6
  import type { getHookRunners } from '../new/compat/hooks';
6
7
  import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config';
@@ -52,10 +53,7 @@ export type RegisterBuildPlatformFn = (params: {
52
53
  type: string;
53
54
  config: any;
54
55
  }) => Promise<RegisterBuildPlatformResult> | RegisterBuildPlatformResult;
55
- export type AddRuntimeExportsFn = (params: {
56
- entrypoint: Entrypoint;
57
- exports: string[];
58
- }) => Promise<void> | void;
56
+ export type AddRuntimeExportsFn = () => Promise<void> | void;
59
57
  export interface AppToolsExtendAPI<B extends Bundler = 'webpack'> {
60
58
  onBeforeConfig: PluginHookTap<BeforeConfigFn>;
61
59
  onAfterPrepare: PluginHookTap<AfterPrepareFn>;
@@ -102,33 +100,33 @@ export interface AppToolsExtendAPI<B extends Bundler = 'webpack'> {
102
100
  useHookRunners: () => ReturnType<typeof getHookRunners>;
103
101
  }
104
102
  export interface AppToolsExtendHooks extends Record<string, PluginHook<(...args: any[]) => any>> {
105
- onBeforeConfig: PluginHook<BeforeConfigFn>;
106
- onAfterPrepare: PluginHook<AfterPrepareFn>;
107
- deploy: PluginHook<DeplpoyFn>;
108
- _internalRuntimePlugins: PluginHook<InternalRuntimePluginsFn>;
109
- _internalServerPlugins: PluginHook<InternalServerPluginsFn>;
110
- checkEntryPoint: PluginHook<CheckEntryPointFn>;
111
- modifyEntrypoints: PluginHook<ModifyEntrypointsFn>;
112
- modifyFileSystemRoutes: PluginHook<ModifyFileSystemRoutesFn>;
113
- modifyServerRoutes: PluginHook<ModifyServerRoutesFn>;
114
- generateEntryCode: PluginHook<GenerateEntryCodeFn>;
115
- onBeforeGenerateRoutes: PluginHook<BeforeGenerateRoutesFn>;
103
+ onBeforeConfig: AsyncHook<BeforeConfigFn>;
104
+ onAfterPrepare: AsyncHook<AfterPrepareFn>;
105
+ deploy: AsyncHook<DeplpoyFn>;
106
+ _internalRuntimePlugins: AsyncHook<InternalRuntimePluginsFn>;
107
+ _internalServerPlugins: AsyncHook<InternalServerPluginsFn>;
108
+ checkEntryPoint: AsyncHook<CheckEntryPointFn>;
109
+ modifyEntrypoints: AsyncHook<ModifyEntrypointsFn>;
110
+ modifyFileSystemRoutes: AsyncHook<ModifyFileSystemRoutesFn>;
111
+ modifyServerRoutes: AsyncHook<ModifyServerRoutesFn>;
112
+ generateEntryCode: AsyncHook<GenerateEntryCodeFn>;
113
+ onBeforeGenerateRoutes: AsyncHook<BeforeGenerateRoutesFn>;
116
114
  /**
117
115
  * @deprecated
118
116
  */
119
- onBeforePrintInstructions: PluginHook<BeforePrintInstructionsFn>;
117
+ onBeforePrintInstructions: AsyncHook<BeforePrintInstructionsFn>;
120
118
  /**
121
119
  * @deprecated
122
120
  */
123
- registerDev: PluginHook<RegisterDevFn>;
121
+ registerDev: AsyncHook<RegisterDevFn>;
124
122
  /**
125
123
  * @deprecated
126
124
  */
127
- registerBuildPlatform: PluginHook<RegisterBuildPlatformFn>;
125
+ registerBuildPlatform: AsyncHook<RegisterBuildPlatformFn>;
128
126
  /**
129
127
  * @deprecated
130
128
  */
131
- addRuntimeExports: PluginHook<AddRuntimeExportsFn>;
129
+ addRuntimeExports: AsyncHook<AddRuntimeExportsFn>;
132
130
  }
133
131
  export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
134
132
  metaName: string;
@@ -140,6 +138,25 @@ export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
140
138
  lambdaDirectory: string;
141
139
  serverPlugins: ServerPlugin[];
142
140
  moduleType: 'module' | 'commonjs';
141
+ /** Information for entry points */
142
+ entrypoints: Entrypoint[];
143
+ /** Selected entry points */
144
+ checkedEntries: string[];
145
+ /** Information for server routes */
146
+ serverRoutes: ServerRoute[];
147
+ /** Whether to use api only mode */
148
+ apiOnly: boolean;
143
149
  _internalContext: InternalContext<AppTools<B>>;
150
+ /**
151
+ * Information for HTML templates by entry
152
+ * @private
153
+ */
154
+ partialsByEntrypoint?: Record<string, HtmlPartials>;
155
+ /**
156
+ * Information for HTML templates
157
+ * @private
158
+ */
159
+ htmlTemplates: HtmlTemplates;
144
160
  };
145
161
  export type AppToolsContext<B extends Bundler = 'webpack'> = AppContext<AppTools<B>> & AppToolsExtendContext<B>;
162
+ export type AppToolsHooks<B extends Bundler = 'webpack'> = Hooks<AppToolsUserConfig<B>, AppToolsNormalizedConfig> & AppToolsExtendHooks;
@@ -1,3 +1,5 @@
1
1
  import type { CliHooksRunner, IAppContext } from '@modern-js/core';
2
2
  import type { AppNormalizedConfig, AppTools } from '../types';
3
- export declare const printInstructions: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Promise<void>;
3
+ import type { AppToolsContext, AppToolsHooks } from '../types/new';
4
+ export declare const printInstructions: (hooks: AppToolsHooks<'shared'>, appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>) => Promise<void>;
5
+ export declare const printInstructionsCompat: (hookRunners: CliHooksRunner<AppTools<'shared'>>, appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => 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/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.63.0",
18
+ "version": "2.63.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -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.5",
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.63.0",
100
- "@modern-js/node-bundle-require": "2.63.0",
101
- "@modern-js/core": "2.63.0",
102
- "@modern-js/plugin": "2.63.0",
103
- "@modern-js/plugin-i18n": "2.63.0",
104
- "@modern-js/plugin-data-loader": "2.63.0",
105
- "@modern-js/rsbuild-plugin-esbuild": "2.63.0",
106
- "@modern-js/prod-server": "2.63.0",
107
- "@modern-js/server": "2.63.0",
108
- "@modern-js/server-core": "2.63.0",
109
- "@modern-js/server-utils": "2.63.0",
110
- "@modern-js/types": "2.63.0",
111
- "@modern-js/uni-builder": "2.63.0",
112
- "@modern-js/utils": "2.63.0"
99
+ "@modern-js/node-bundle-require": "2.63.1",
100
+ "@modern-js/core": "2.63.1",
101
+ "@modern-js/plugin": "2.63.1",
102
+ "@modern-js/plugin-data-loader": "2.63.1",
103
+ "@modern-js/prod-server": "2.63.1",
104
+ "@modern-js/plugin-v2": "2.63.1",
105
+ "@modern-js/plugin-i18n": "2.63.1",
106
+ "@modern-js/rsbuild-plugin-esbuild": "2.63.1",
107
+ "@modern-js/server": "2.63.1",
108
+ "@modern-js/server-core": "2.63.1",
109
+ "@modern-js/types": "2.63.1",
110
+ "@modern-js/uni-builder": "2.63.1",
111
+ "@modern-js/server-utils": "2.63.1",
112
+ "@modern-js/utils": "2.63.1"
113
113
  },
114
114
  "devDependencies": {
115
- "@rsbuild/plugin-webpack-swc": "~1.0.8",
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.63.0",
125
- "@scripts/jest-config": "2.63.0"
124
+ "@scripts/jest-config": "2.63.1",
125
+ "@scripts/build": "2.63.1"
126
126
  },
127
127
  "peerDependencies": {
128
128
  "ts-node": "^10.7.0",