@modern-js/core 1.21.3 → 2.0.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,51 @@
1
1
  # @modern-js/core
2
2
 
3
- ## 1.21.3
3
+ ## 2.0.0-beta.0
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9: chore: v2
8
+
9
+ ### Minor Changes
10
+
11
+ - c9e800d39: feat: support React18 streaming SSR
12
+ feat: 支持 React18 流式 SSR
13
+ - edd1cfb1a: feat: modernjs Access builder compiler
14
+ feat: modernjs 接入 builder 构建
15
+ - d5a31df78: refactor: remove unbundle configs and types
16
+
17
+ refactor: 移除 unbundle 相关的配置项和类型定义
4
18
 
5
19
  ### Patch Changes
6
20
 
7
- - @modern-js/node-bundle-require@1.21.3
8
- - @modern-js/plugin@1.21.3
9
- - @modern-js/utils@1.21.3
21
+ - 85edee8: feat(app-tools): support tools.htmlPlugin config
22
+
23
+ feat(app-tools): 支持 tools.htmlPlugin 配置项
24
+
25
+ - b8bbe036c: feat: change type logic
26
+ feat: 修改类型相关的逻辑
27
+ - 8b8e1bb57: feat: support nested routes
28
+ feat: 支持嵌套路由
29
+ - 3bbea92b2: feat: support Hook、Middleware new API
30
+ feat: 支持 Hook、Middleware 的新 API
31
+ - 14b712d: fix: use consistent alias type and default value across packages
32
+
33
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
34
+
35
+ - Updated dependencies [a2509bf]
36
+ - Updated dependencies [edd1cfb1a]
37
+ - Updated dependencies [cc971eabf]
38
+ - Updated dependencies [5b9049f]
39
+ - Updated dependencies [b8bbe036c]
40
+ - Updated dependencies [d5a31df78]
41
+ - Updated dependencies [dda38c9]
42
+ - Updated dependencies [3bbea92b2]
43
+ - Updated dependencies [abf3421]
44
+ - Updated dependencies [543be95]
45
+ - Updated dependencies [14b712d]
46
+ - @modern-js/node-bundle-require@2.0.0-beta.0
47
+ - @modern-js/utils@2.0.0-beta.0
48
+ - @modern-js/plugin@2.0.0-beta.0
10
49
 
11
50
  ## 1.21.2
12
51
 
@@ -1,5 +1,6 @@
1
+ import type { IAppContext } from '@modern-js/types';
1
2
  import { OutputConfig, ServerConfig, SourceConfig } from '.';
2
- export declare const defaults: {
3
+ export declare const getDefaultConfig: (appContext?: IAppContext) => {
3
4
  source: SourceConfig;
4
5
  output: OutputConfig;
5
6
  server: ServerConfig;
@@ -1,99 +1,110 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaults = void 0;
4
- const sourceDefaults = {
5
- entries: undefined,
6
- enableAsyncEntry: false,
7
- disableDefaultEntries: false,
8
- entriesDir: './src',
9
- configDir: './config',
10
- apiDir: './api',
11
- envVars: [],
12
- globalVars: undefined,
13
- alias: undefined,
14
- moduleScopes: undefined,
15
- include: [],
16
- };
17
- const outputDefaults = {
18
- assetPrefix: '/',
19
- htmlPath: 'html',
20
- jsPath: 'static/js',
21
- cssPath: 'static/css',
22
- mediaPath: 'static/media',
23
- path: 'dist',
24
- title: '',
25
- titleByEntries: undefined,
26
- meta: {
27
- charset: { charset: 'utf-8' },
28
- viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
29
- 'http-equiv': { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
30
- renderer: 'webkit',
31
- layoutmode: 'standard',
32
- imagemode: 'force',
33
- 'wap-font-scale': 'no',
34
- 'format-detection': 'telephone=no',
35
- },
36
- metaByEntries: undefined,
37
- inject: 'head',
38
- injectByEntries: undefined,
39
- mountId: 'root',
40
- favicon: '',
41
- faviconByEntries: undefined,
42
- copy: undefined,
43
- scriptExt: undefined,
44
- disableHtmlFolder: false,
45
- disableCssModuleExtension: false,
46
- disableCssExtract: false,
47
- enableCssModuleTSDeclaration: false,
48
- disableMinimize: false,
49
- enableInlineStyles: false,
50
- enableInlineScripts: false,
51
- disableSourceMap: false,
52
- disableInlineRuntimeChunk: false,
53
- disableAssetsCache: false,
54
- enableLatestDecorators: false,
55
- polyfill: 'entry',
56
- dataUriLimit: 10000,
57
- templateParameters: {},
58
- templateParametersByEntries: undefined,
59
- cssModuleLocalIdentName: '[name]__[local]--[hash:base64:5]',
60
- enableModernMode: false,
61
- federation: undefined,
62
- disableNodePolyfill: false,
63
- enableTsLoader: false,
64
- };
65
- const serverDefaults = {
66
- routes: undefined,
67
- publicRoutes: undefined,
68
- ssr: undefined,
69
- ssrByEntries: undefined,
70
- baseUrl: '/',
71
- port: 8080,
72
- };
73
- const devDefaults = { assetPrefix: false, https: false };
74
- const deployDefaults = {
75
- domain: '',
76
- domainByEntries: undefined,
77
- };
78
- const toolsDefaults = {
79
- webpack: undefined,
80
- babel: undefined,
81
- postcss: undefined,
82
- autoprefixer: undefined,
83
- lodash: undefined,
84
- devServer: undefined,
85
- tsLoader: undefined,
86
- terser: undefined,
87
- minifyCss: undefined,
88
- };
89
- exports.defaults = {
90
- source: sourceDefaults,
91
- output: outputDefaults,
92
- server: serverDefaults,
93
- dev: devDefaults,
94
- deploy: deployDefaults,
95
- tools: toolsDefaults,
96
- plugins: [],
97
- runtime: {},
98
- runtimeByEntries: {},
3
+ exports.getDefaultConfig = void 0;
4
+ const getDefaultConfig = (appContext) => {
5
+ const defaultAlias = appContext
6
+ ? {
7
+ [appContext.internalDirAlias]: appContext.internalDirectory,
8
+ [appContext.internalSrcAlias]: appContext.srcDirectory,
9
+ '@': appContext.srcDirectory,
10
+ '@shared': appContext.sharedDirectory,
11
+ }
12
+ : {};
13
+ const sourceDefaults = {
14
+ entries: undefined,
15
+ enableAsyncEntry: false,
16
+ disableDefaultEntries: false,
17
+ entriesDir: './src',
18
+ configDir: './config',
19
+ apiDir: './api',
20
+ envVars: [],
21
+ globalVars: undefined,
22
+ alias: defaultAlias,
23
+ moduleScopes: undefined,
24
+ include: [],
25
+ };
26
+ const outputDefaults = {
27
+ assetPrefix: '/',
28
+ htmlPath: 'html',
29
+ jsPath: 'static/js',
30
+ cssPath: 'static/css',
31
+ mediaPath: 'static/media',
32
+ path: 'dist',
33
+ title: '',
34
+ titleByEntries: undefined,
35
+ meta: {
36
+ charset: { charset: 'utf-8' },
37
+ viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
38
+ 'http-equiv': { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' },
39
+ renderer: 'webkit',
40
+ layoutmode: 'standard',
41
+ imagemode: 'force',
42
+ 'wap-font-scale': 'no',
43
+ 'format-detection': 'telephone=no',
44
+ },
45
+ metaByEntries: undefined,
46
+ inject: 'head',
47
+ injectByEntries: undefined,
48
+ mountId: 'root',
49
+ favicon: '',
50
+ faviconByEntries: undefined,
51
+ copy: undefined,
52
+ scriptExt: undefined,
53
+ disableHtmlFolder: false,
54
+ disableCssModuleExtension: false,
55
+ disableCssExtract: false,
56
+ enableCssModuleTSDeclaration: false,
57
+ disableMinimize: false,
58
+ enableInlineStyles: false,
59
+ enableInlineScripts: false,
60
+ disableSourceMap: false,
61
+ disableInlineRuntimeChunk: false,
62
+ disableAssetsCache: false,
63
+ enableLatestDecorators: false,
64
+ polyfill: 'entry',
65
+ dataUriLimit: 10000,
66
+ templateParameters: {},
67
+ templateParametersByEntries: undefined,
68
+ cssModuleLocalIdentName: undefined,
69
+ enableModernMode: false,
70
+ federation: undefined,
71
+ disableNodePolyfill: false,
72
+ enableTsLoader: false,
73
+ };
74
+ const serverDefaults = {
75
+ routes: undefined,
76
+ publicRoutes: undefined,
77
+ ssr: undefined,
78
+ ssrByEntries: undefined,
79
+ baseUrl: '/',
80
+ port: 8080,
81
+ };
82
+ const devDefaults = { assetPrefix: false, https: false };
83
+ const deployDefaults = {
84
+ domain: '',
85
+ domainByEntries: undefined,
86
+ };
87
+ const toolsDefaults = {
88
+ webpack: undefined,
89
+ babel: undefined,
90
+ postcss: undefined,
91
+ autoprefixer: undefined,
92
+ lodash: undefined,
93
+ devServer: undefined,
94
+ tsLoader: undefined,
95
+ terser: undefined,
96
+ minifyCss: undefined,
97
+ };
98
+ return {
99
+ source: sourceDefaults,
100
+ output: outputDefaults,
101
+ server: serverDefaults,
102
+ dev: devDefaults,
103
+ deploy: deployDefaults,
104
+ tools: toolsDefaults,
105
+ plugins: [],
106
+ runtime: {},
107
+ runtimeByEntries: {},
108
+ };
99
109
  };
110
+ exports.getDefaultConfig = getDefaultConfig;
@@ -1,9 +1,9 @@
1
1
  import type { ErrorObject } from '@modern-js/utils/ajv';
2
- import { defaults } from './defaults';
2
+ import { getDefaultConfig } from './defaults';
3
3
  import { NormalizedConfig } from './mergeConfig';
4
4
  import { PluginValidateSchema } from './schema';
5
5
  import type { UserConfig, ConfigParam, LoadedConfig } from './types';
6
- export { defaults as defaultsConfig };
6
+ export { getDefaultConfig };
7
7
  export * from './mergeConfig';
8
8
  export * from './types';
9
9
  export * from './schema';
@@ -26,13 +26,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.resolveConfig = exports.loadUserConfig = exports.assignPkgConfig = exports.defineConfig = exports.addServerConfigToDeps = exports.defaultsConfig = void 0;
29
+ exports.resolveConfig = exports.loadUserConfig = exports.assignPkgConfig = exports.defineConfig = exports.addServerConfigToDeps = exports.getDefaultConfig = void 0;
30
30
  const utils_1 = require("@modern-js/utils");
31
31
  const lodash_1 = require("@modern-js/utils/lodash");
32
+ const context_1 = require("../context");
32
33
  const load_configs_1 = require("../load-configs");
33
34
  const repeatKeyWarning_1 = require("../utils/repeatKeyWarning");
34
35
  const defaults_1 = require("./defaults");
35
- Object.defineProperty(exports, "defaultsConfig", { enumerable: true, get: function () { return defaults_1.defaults; } });
36
+ Object.defineProperty(exports, "getDefaultConfig", { enumerable: true, get: function () { return defaults_1.getDefaultConfig; } });
36
37
  const mergeConfig_1 = require("./mergeConfig");
37
38
  const schema_1 = require("./schema");
38
39
  const debug = (0, utils_1.createDebugger)('resolve-config');
@@ -129,7 +130,11 @@ const resolveConfig = async (loaded, configs, schemas, restartWithExistingPort,
129
130
  throw new Error(`Validate configuration error.`);
130
131
  }
131
132
  }
132
- const resolved = (0, mergeConfig_1.mergeConfig)([defaults_1.defaults, ...configs, userConfig]);
133
+ const resolved = (0, mergeConfig_1.mergeConfig)([
134
+ (0, defaults_1.getDefaultConfig)(context_1.AppContext.use().value),
135
+ ...configs,
136
+ userConfig,
137
+ ]);
133
138
  resolved._raw = loaded.config;
134
139
  if ((0, utils_1.isDev)() && argv[0] === 'dev') {
135
140
  if (restartWithExistingPort > 0) {
@@ -1,6 +1,6 @@
1
1
  import { UserConfig, SourceConfig, ToolsConfig } from '.';
2
2
  export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'moduleScopes'> {
3
- alias: SourceConfig['alias'] | Array<SourceConfig['alias']>;
3
+ alias: SourceConfig['alias'] | Array<NonNullable<SourceConfig['alias']>>;
4
4
  moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
5
5
  }
6
6
  export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'webpackChain' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
@@ -15,6 +15,7 @@ export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'we
15
15
  terser: ToolsConfig['terser'] | Array<NonNullable<ToolsConfig['terser']>>;
16
16
  minifyCss: ToolsConfig['minifyCss'] | Array<NonNullable<ToolsConfig['minifyCss']>>;
17
17
  esbuild: ToolsConfig['esbuild'] | Array<NonNullable<ToolsConfig['esbuild']>>;
18
+ htmlPlugin: ToolsConfig['htmlPlugin'] | Array<NonNullable<ToolsConfig['htmlPlugin']>>;
18
19
  }
19
20
  export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
20
21
  source: NormalizedSourceConfig;
@@ -400,6 +400,9 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
400
400
  enableMicroFrontendDebug: {
401
401
  type: string;
402
402
  };
403
+ disableFrameworkExt: {
404
+ type: string;
405
+ };
403
406
  watchOptions: {
404
407
  type: string;
405
408
  };
@@ -477,6 +480,18 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
477
480
  styledComponents: {
478
481
  typeof: string[];
479
482
  };
483
+ htmlPlugin: {
484
+ typeof: string[];
485
+ };
486
+ esbuild: {
487
+ type: string;
488
+ };
489
+ sass: {
490
+ typeof: string[];
491
+ };
492
+ less: {
493
+ typeof: string[];
494
+ };
480
495
  };
481
496
  };
482
497
  };
@@ -181,6 +181,9 @@ export declare const server: {
181
181
  enableMicroFrontendDebug: {
182
182
  type: string;
183
183
  };
184
+ disableFrameworkExt: {
185
+ type: string;
186
+ };
184
187
  watchOptions: {
185
188
  type: string;
186
189
  };
@@ -104,6 +104,7 @@ exports.server = {
104
104
  metrics: { type: ['object', 'boolean'] },
105
105
  proxy: { type: 'object' },
106
106
  enableMicroFrontendDebug: { type: 'boolean' },
107
+ disableFrameworkExt: { type: 'boolean' },
107
108
  watchOptions: { type: 'object' },
108
109
  compiler: { type: 'string' },
109
110
  },
@@ -35,5 +35,17 @@ export declare const tools: {
35
35
  styledComponents: {
36
36
  typeof: string[];
37
37
  };
38
+ htmlPlugin: {
39
+ typeof: string[];
40
+ };
41
+ esbuild: {
42
+ type: string;
43
+ };
44
+ sass: {
45
+ typeof: string[];
46
+ };
47
+ less: {
48
+ typeof: string[];
49
+ };
38
50
  };
39
51
  };
@@ -16,5 +16,9 @@ exports.tools = {
16
16
  terser: { typeof: ['object', 'function'] },
17
17
  minifyCss: { typeof: ['object', 'function'] },
18
18
  styledComponents: { typeof: ['object', 'function'] },
19
+ htmlPlugin: { typeof: ['object', 'function'] },
20
+ esbuild: { type: 'object' },
21
+ sass: { typeof: ['object', 'function'] },
22
+ less: { typeof: ['object', 'function'] },
19
23
  },
20
24
  };
@@ -1,5 +1,5 @@
1
1
  import type { DevServerHttpsOptions, DevServerOptions } from '@modern-js/types';
2
- import type { MetaOptions, ChainIdentifier, WatchOptions } from '@modern-js/utils';
2
+ import type { AliasOption, MetaOptions, ChainIdentifier, WatchOptions } from '@modern-js/utils';
3
3
  import type { BabelConfig } from '@modern-js/babel-preset-app';
4
4
  import type webpack from 'webpack';
5
5
  import type { RuleSetRule, Configuration as WebpackConfiguration, WebpackPluginInstance } from 'webpack';
@@ -8,11 +8,11 @@ import type autoprefixer from 'autoprefixer';
8
8
  import type { BasePluginOptions, TerserOptions as RawTerserOptions } from 'terser-webpack-plugin';
9
9
  import type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
10
10
  import { TransformOptions } from '@babel/core';
11
- import type { PluginConfig } from '../../loadPlugins';
11
+ import type { Options as HTMLPluginOptions } from 'html-webpack-plugin';
12
+ import type { PluginConfig, NewPluginConfig } from '../../loadPlugins';
12
13
  import type { TestConfig, JestConfig } from './test';
13
14
  import type { SassConfig, SassLoaderOptions } from './sass';
14
15
  import type { LessConfig, LessLoaderOptions } from './less';
15
- import type { UnbundleConfig } from './unbundle';
16
16
  import type { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions } from './ssg';
17
17
  import type { ElectronConfig } from './electron';
18
18
  import type { PostCSSLoaderOptions } from './postcss';
@@ -21,7 +21,7 @@ declare type AutoprefixerOptions = autoprefixer.Options;
21
21
  declare type TerserOptions = BasePluginOptions & {
22
22
  terserOptions?: Partial<RawTerserOptions>;
23
23
  };
24
- export type { TestConfig, JestConfig, BabelConfig, UnbundleConfig, SassConfig, SassLoaderOptions, LessConfig, LessLoaderOptions, SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions, TransformOptions, AutoprefixerOptions, TerserOptions, };
24
+ export type { TestConfig, JestConfig, BabelConfig, SassConfig, SassLoaderOptions, LessConfig, LessLoaderOptions, SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions, TransformOptions, AutoprefixerOptions, TerserOptions, PluginConfig, NewPluginConfig, };
25
25
  export interface SourceConfig {
26
26
  entries?: Record<string, string | {
27
27
  entry: string;
@@ -36,7 +36,7 @@ export interface SourceConfig {
36
36
  apiDir?: string;
37
37
  envVars?: Array<string>;
38
38
  globalVars?: Record<string, string>;
39
- alias?: Record<string, string> | ((aliases: Record<string, string>) => Record<string, unknown>);
39
+ alias?: AliasOption;
40
40
  moduleScopes?: Array<string | RegExp> | ((scopes: Array<string | RegExp>) => void) | ((scopes: Array<string | RegExp>) => Array<string | RegExp>);
41
41
  include?: Array<string | RegExp>;
42
42
  /**
@@ -87,13 +87,6 @@ export interface OutputConfig {
87
87
  federation?: boolean;
88
88
  disableNodePolyfill?: boolean;
89
89
  enableTsLoader?: boolean;
90
- /**
91
- * Disables lazy import support for styles, currently supports antd and arco-design.
92
- * The configuration of `output.disableAutoImportStyle` is provided by `unbundle` plugin.
93
- * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
94
- * @requires `unbundle` plugin
95
- */
96
- disableAutoImportStyle?: boolean;
97
90
  /**
98
91
  * The configuration of `output.ssg` is provided by `ssg` plugin.
99
92
  * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
@@ -110,8 +103,14 @@ export interface ServerConfig {
110
103
  publicRoutes?: {
111
104
  [filepath: string]: string;
112
105
  };
113
- ssr?: boolean | Record<string, unknown>;
114
- ssrByEntries?: Record<string, boolean | Record<string, unknown>>;
106
+ ssr?: boolean | {
107
+ mode?: 'string' | 'stream';
108
+ [property: string]: unknown;
109
+ };
110
+ ssrByEntries?: Record<string, boolean | {
111
+ mode?: 'string' | 'stream';
112
+ [property: string]: unknown;
113
+ }>;
115
114
  baseUrl?: string | Array<string>;
116
115
  port?: number;
117
116
  logger?: boolean | Record<string, any>;
@@ -119,6 +118,7 @@ export interface ServerConfig {
119
118
  enableMicroFrontendDebug?: boolean;
120
119
  watchOptions?: WatchOptions;
121
120
  compiler?: 'babel' | 'typescript';
121
+ disableFrameworkExt?: boolean;
122
122
  }
123
123
  export declare type DevProxyOptions = string | Record<string, string>;
124
124
  export interface DevConfig {
@@ -130,12 +130,6 @@ export interface DevConfig {
130
130
  * @requires `proxy` plugin
131
131
  */
132
132
  proxy?: DevProxyOptions;
133
- /**
134
- * The configuration of `dev.unbundle` is provided by `unbundle` plugin.
135
- * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
136
- * @requires `unbundle` plugin
137
- */
138
- unbundle?: UnbundleConfig;
139
133
  }
140
134
  export interface MicroFrontend {
141
135
  enableHtmlEntry?: boolean;
@@ -154,22 +148,22 @@ export declare type PostCSSConfigUtils = {
154
148
  export declare type PostCSSConfig = PostCSSLoaderOptions | ((options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void);
155
149
  export declare type WebpackConfigUtils = {
156
150
  env: string;
151
+ /** @deprecated Use target instead */
157
152
  name: string;
153
+ target: string;
158
154
  webpack: typeof webpack;
159
155
  HtmlWebpackPlugin: typeof import('html-webpack-plugin');
160
156
  addRules: (rules: RuleSetRule | RuleSetRule[]) => void;
161
157
  prependPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
162
158
  appendPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
163
159
  removePlugin: (pluginName: string) => void;
164
- /**
165
- * @deprecated please use `tools.webpackChain` instead.
166
- */
167
- chain: WebpackChain;
168
160
  };
169
161
  export declare type WebpackConfig = WebpackConfiguration | ((config: WebpackConfiguration, utils: WebpackConfigUtils) => WebpackConfiguration | void);
170
162
  export declare type WebpackChainConfigUtils = {
171
163
  env: string;
164
+ /** @deprecated Use target instead */
172
165
  name: string;
166
+ target: string;
173
167
  webpack: typeof webpack;
174
168
  CHAIN_ID: ChainIdentifier;
175
169
  HtmlWebpackPlugin: typeof import('html-webpack-plugin');
@@ -182,6 +176,10 @@ export declare type TsLoaderConfigUtils = {
182
176
  export declare type TsLoaderConfig = TsLoaderOptions | ((config: TsLoaderOptions, utils: TsLoaderConfigUtils) => TsLoaderOptions | void);
183
177
  export declare type AutoprefixerConfig = AutoprefixerOptions | ((config: AutoprefixerOptions) => AutoprefixerOptions | void);
184
178
  export declare type TerserConfig = TerserOptions | ((config: TerserOptions) => TerserOptions | void);
179
+ export declare type HtmlPluginConfig = HTMLPluginOptions | ((options: HTMLPluginOptions, entryInfo: {
180
+ entryName: string;
181
+ entryValue: webpack.Configuration['entry'];
182
+ }) => HTMLPluginOptions | void);
185
183
  export interface ToolsConfig {
186
184
  webpack?: WebpackConfig;
187
185
  webpackChain?: WebpackChainConfig;
@@ -195,6 +193,7 @@ export interface ToolsConfig {
195
193
  terser?: TerserConfig;
196
194
  minifyCss?: ConfigFunction;
197
195
  esbuild?: Record<string, unknown>;
196
+ htmlPlugin?: HtmlPluginConfig;
198
197
  /**
199
198
  * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.
200
199
  * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
@@ -207,17 +206,7 @@ export interface ToolsConfig {
207
206
  * @requires `testing` plugin
208
207
  */
209
208
  jest?: TestConfig['jest'];
210
- /**
211
- * The configuration of `tools.sass` is provided by `sass` plugin.
212
- * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
213
- * @requires `sass` plugin
214
- */
215
209
  sass?: SassConfig;
216
- /**
217
- * The configuration of `tools.less` is provided by `less` plugin.
218
- * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
219
- * @requires `less` plugin
220
- */
221
210
  less?: LessConfig;
222
211
  }
223
212
  export interface RuntimeConfig {
package/dist/context.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { IAppContext } from '@modern-js/types';
1
+ import type { IAppContext, InternalPlugins } from '@modern-js/types';
2
2
  import { UserConfig } from './config';
3
3
  import { NormalizedConfig } from './config/mergeConfig';
4
- import type { LoadedPlugin } from './loadPlugins';
4
+ import { CliPlugin } from './manager';
5
5
  export type { IAppContext };
6
6
  export declare const AppContext: import("@modern-js/plugin").Context<IAppContext>;
7
7
  export declare const ConfigContext: import("@modern-js/plugin").Context<UserConfig>;
@@ -23,9 +23,9 @@ export declare const useConfigContext: () => UserConfig;
23
23
  * Get normalized content of user config.
24
24
  */
25
25
  export declare const useResolvedConfigContext: () => NormalizedConfig;
26
- export declare const initAppContext: ({ appDirectory, plugins, configFile, options, serverConfigFile, }: {
26
+ export declare const initAppContext: ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, }: {
27
27
  appDirectory: string;
28
- plugins: LoadedPlugin[];
28
+ plugins: CliPlugin[];
29
29
  configFile: string | false;
30
30
  options?: {
31
31
  metaName?: string | undefined;
@@ -34,4 +34,5 @@ export declare const initAppContext: ({ appDirectory, plugins, configFile, optio
34
34
  sharedDir?: string | undefined;
35
35
  } | undefined;
36
36
  serverConfigFile: string;
37
+ serverInternalPlugins: InternalPlugins;
37
38
  }) => IAppContext;
package/dist/context.js CHANGED
@@ -31,13 +31,14 @@ exports.useConfigContext = useConfigContext;
31
31
  */
32
32
  const useResolvedConfigContext = () => exports.ResolvedConfigContext.use().value;
33
33
  exports.useResolvedConfigContext = useResolvedConfigContext;
34
- const initAppContext = ({ appDirectory, plugins, configFile, options, serverConfigFile, }) => {
34
+ const initAppContext = ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, }) => {
35
35
  const { metaName = 'modern-js', srcDir = 'src', distDir = '', sharedDir = 'shared', } = options || {};
36
36
  return {
37
37
  metaName,
38
38
  appDirectory,
39
39
  configFile,
40
40
  serverConfigFile,
41
+ serverInternalPlugins,
41
42
  ip: utils_1.address.ip(),
42
43
  port: 0,
43
44
  packageName: require(path_1.default.resolve(appDirectory, './package.json')).name,
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { INTERNAL_PLUGINS } from '@modern-js/utils';
2
1
  import type { ErrorObject } from '@modern-js/utils/ajv';
2
+ import { InternalPlugins } from '@modern-js/types';
3
3
  import { TransformPlugin } from './loadPlugins';
4
4
  import { IAppContext, initAppContext } from './context';
5
5
  export * from './config';
6
6
  export type { Hooks, ImportSpecifier, ImportStatement, RuntimePlugin, } from './types';
7
7
  export * from '@modern-js/plugin';
8
- export { manager, mountHook, usePlugins, createPlugin, registerHook, } from './manager';
8
+ export { manager, mountHook, createPlugin, registerHook } from './manager';
9
9
  export type { CliHooks, CliPlugin, CliHookCallbacks } from './manager';
10
10
  export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, } from './pluginAPI';
11
11
  export type { PluginAPI } from './pluginAPI';
@@ -16,7 +16,10 @@ export interface CoreOptions {
16
16
  configFile?: string;
17
17
  serverConfigFile?: string;
18
18
  packageJsonConfig?: string;
19
- plugins?: typeof INTERNAL_PLUGINS;
19
+ internalPlugins?: {
20
+ cli?: InternalPlugins;
21
+ server?: InternalPlugins;
22
+ };
20
23
  transformPlugin?: TransformPlugin;
21
24
  onSchemaError?: (error: ErrorObject) => void;
22
25
  options?: {
@@ -31,11 +34,9 @@ export declare const mergeOptions: (options?: CoreOptions) => {
31
34
  configFile?: string | undefined;
32
35
  serverConfigFile: string;
33
36
  packageJsonConfig?: string | undefined;
34
- plugins?: {
35
- [name: string]: {
36
- cli?: string | undefined;
37
- server?: string | undefined;
38
- };
37
+ internalPlugins?: {
38
+ cli?: InternalPlugins | undefined;
39
+ server?: InternalPlugins | undefined;
39
40
  } | undefined;
40
41
  transformPlugin?: TransformPlugin | undefined;
41
42
  onSchemaError?: ((error: ErrorObject) => void) | undefined;
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.initAppContext = exports.initAppDir = exports.cli = exports.mergeOptions = exports.useResolvedConfigContext = exports.useConfigContext = exports.useAppContext = exports.ResolvedConfigContext = exports.ConfigContext = exports.AppContext = exports.registerHook = exports.createPlugin = exports.usePlugins = exports.mountHook = exports.manager = void 0;
20
+ exports.initAppContext = exports.initAppDir = exports.cli = exports.mergeOptions = exports.useResolvedConfigContext = exports.useConfigContext = exports.useAppContext = exports.ResolvedConfigContext = exports.ConfigContext = exports.AppContext = exports.registerHook = exports.createPlugin = exports.mountHook = exports.manager = void 0;
21
21
  const path_1 = __importDefault(require("path"));
22
22
  const utils_1 = require("@modern-js/utils");
23
23
  const commander_1 = require("./utils/commander");
@@ -34,7 +34,6 @@ __exportStar(require("@modern-js/plugin"), exports);
34
34
  var manager_2 = require("./manager");
35
35
  Object.defineProperty(exports, "manager", { enumerable: true, get: function () { return manager_2.manager; } });
36
36
  Object.defineProperty(exports, "mountHook", { enumerable: true, get: function () { return manager_2.mountHook; } });
37
- Object.defineProperty(exports, "usePlugins", { enumerable: true, get: function () { return manager_2.usePlugins; } });
38
37
  Object.defineProperty(exports, "createPlugin", { enumerable: true, get: function () { return manager_2.createPlugin; } });
39
38
  Object.defineProperty(exports, "registerHook", { enumerable: true, get: function () { return manager_2.registerHook; } });
40
39
  // TODO: remove export after refactor all plugins
@@ -76,7 +75,7 @@ const createCli = () => {
76
75
  let restartWithExistingPort = 0;
77
76
  let restartOptions;
78
77
  const init = async (argv = [], options) => {
79
- var _a, _b;
78
+ var _a, _b, _c, _d;
80
79
  manager_1.manager.clear();
81
80
  const mergedOptions = (0, exports.mergeOptions)(options);
82
81
  restartOptions = mergedOptions;
@@ -87,16 +86,17 @@ const createCli = () => {
87
86
  (0, loadEnv_1.loadEnv)(appDirectory, process.env[`${metaName.toUpperCase()}_ENV`]);
88
87
  const loaded = await (0, config_1.loadUserConfig)(appDirectory, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.configFile, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.packageJsonConfig);
89
88
  const plugins = (0, loadPlugins_1.loadPlugins)(appDirectory, loaded.config, {
90
- internalPlugins: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.plugins,
89
+ internalPlugins: (_c = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _c === void 0 ? void 0 : _c.cli,
91
90
  transformPlugin: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.transformPlugin,
92
91
  });
93
- plugins.forEach(plugin => plugin.cli && manager_1.manager.usePlugin(plugin.cli));
92
+ plugins.forEach(plugin => plugin && manager_1.manager.usePlugin(plugin));
94
93
  const appContext = (0, context_1.initAppContext)({
95
94
  appDirectory,
96
95
  plugins,
97
96
  configFile: loaded.filePath,
98
97
  options: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.options,
99
98
  serverConfigFile: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.serverConfigFile,
99
+ serverInternalPlugins: ((_d = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _d === void 0 ? void 0 : _d.server) || utils_1.INTERNAL_SERVER_PLUGINS,
100
100
  });
101
101
  // 将 server.config 加入到 loaded.dependencies,以便对文件监听做热更新
102
102
  (0, config_1.addServerConfigToDeps)(loaded.dependencies, appDirectory, mergedOptions.serverConfigFile);
@@ -1,31 +1,16 @@
1
- import { INTERNAL_PLUGINS } from '@modern-js/utils';
1
+ import { InternalPlugins } from '@modern-js/types';
2
2
  import type { UserConfig } from './config';
3
3
  import { CliPlugin } from './manager';
4
4
  declare type PluginItem = string | [string, any];
5
- export declare type LoadedPlugin = {
6
- cli?: CliPlugin;
7
- server?: string;
8
- serverPkg?: string;
9
- };
10
5
  export declare type TransformPlugin = (plugin: PluginConfig, resolvedConfig: UserConfig, pluginOptions?: any) => PluginConfig;
11
6
  /**
12
7
  * @deprecated
13
8
  * Using NewPluginConfig instead.
14
9
  */
15
- declare type OldPluginConfig = Array<PluginItem | {
16
- cli?: PluginItem;
17
- server?: PluginItem;
18
- }>;
19
- declare type NewPluginConfig = CliPlugin[] | {
20
- cli?: CliPlugin[];
21
- /** Custom server plugin is not supported yet. */
22
- server?: never;
23
- };
10
+ declare type OldPluginConfig = Array<PluginItem>;
11
+ export declare type NewPluginConfig<T = {}> = CliPlugin<T>[];
24
12
  export declare type PluginConfig = OldPluginConfig | NewPluginConfig;
25
- export declare function getAppPlugins(appDirectory: string, oldPluginConfig: OldPluginConfig, internalPlugins?: typeof INTERNAL_PLUGINS): (PluginItem | {
26
- cli?: PluginItem | undefined;
27
- server?: PluginItem | undefined;
28
- })[];
13
+ export declare const isOldPluginConfig: (config?: PluginConfig) => config is OldPluginConfig;
29
14
  /**
30
15
  * Load internal plugins which in @modern-js scope and user's custom plugins.
31
16
  * @param appDirectory - Application root directory.
@@ -35,7 +20,7 @@ export declare function getAppPlugins(appDirectory: string, oldPluginConfig: Old
35
20
  * @returns Plugin Objects has been required.
36
21
  */
37
22
  export declare const loadPlugins: (appDirectory: string, userConfig: UserConfig, options?: {
38
- internalPlugins?: typeof INTERNAL_PLUGINS;
23
+ internalPlugins?: InternalPlugins;
39
24
  transformPlugin?: TransformPlugin;
40
- }) => LoadedPlugin[];
25
+ }) => CliPlugin<{}>[];
41
26
  export {};
@@ -1,26 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadPlugins = exports.getAppPlugins = void 0;
3
+ exports.loadPlugins = exports.isOldPluginConfig = void 0;
4
4
  const utils_1 = require("@modern-js/utils");
5
5
  const manager_1 = require("./manager");
6
6
  const debug = (0, utils_1.createDebugger)('load-plugins');
7
- function getAppPlugins(appDirectory, oldPluginConfig, internalPlugins) {
8
- const allPlugins = internalPlugins || utils_1.INTERNAL_PLUGINS;
9
- const appPlugins = [
10
- ...Object.keys(allPlugins)
11
- .filter(name => {
12
- const config = allPlugins[name];
13
- if (config.forced === true) {
14
- return true;
15
- }
16
- return (0, utils_1.isDepExists)(appDirectory, name);
17
- })
18
- .map(name => allPlugins[name]),
19
- ...oldPluginConfig,
20
- ];
21
- return appPlugins;
22
- }
23
- exports.getAppPlugins = getAppPlugins;
24
7
  const resolveCliPlugin = (p, userConfig, appDirectory, transformPlugin) => {
25
8
  const pkg = typeof p === 'string' ? p : p[0];
26
9
  const pluginOptions = typeof p === 'string' ? undefined : p[1];
@@ -37,11 +20,9 @@ const resolveCliPlugin = (p, userConfig, appDirectory, transformPlugin) => {
37
20
  };
38
21
  const isOldPluginConfig = (config) => Array.isArray(config) &&
39
22
  config.some(item => {
40
- if (typeof item === 'string' || Array.isArray(item)) {
41
- return true;
42
- }
43
- return 'cli' in item || 'server' in item;
23
+ return typeof item === 'string' || Array.isArray(item);
44
24
  });
25
+ exports.isOldPluginConfig = isOldPluginConfig;
45
26
  /**
46
27
  * Load internal plugins which in @modern-js scope and user's custom plugins.
47
28
  * @param appDirectory - Application root directory.
@@ -52,35 +33,19 @@ const isOldPluginConfig = (config) => Array.isArray(config) &&
52
33
  */
53
34
  const loadPlugins = (appDirectory, userConfig, options = {}) => {
54
35
  const pluginConfig = userConfig.plugins;
55
- const plugins = getAppPlugins(appDirectory, isOldPluginConfig(pluginConfig) ? pluginConfig : [], options.internalPlugins);
36
+ const plugins = [
37
+ ...(0, utils_1.getInternalPlugins)(appDirectory, options.internalPlugins),
38
+ ...((0, exports.isOldPluginConfig)(pluginConfig) ? pluginConfig : []),
39
+ ];
56
40
  const loadedPlugins = plugins.map(plugin => {
57
- const _plugin = typeof plugin === 'string' || Array.isArray(plugin)
58
- ? { cli: plugin }
59
- : plugin;
60
- const { cli, server } = _plugin;
61
- const loadedPlugin = {};
62
- if (cli) {
63
- loadedPlugin.cli = resolveCliPlugin(cli, userConfig, appDirectory, options.transformPlugin);
64
- }
41
+ const loadedPlugin = resolveCliPlugin(plugin, userConfig, appDirectory, options.transformPlugin);
65
42
  // server plugins don't support to accept params
66
- if (server && typeof server === 'string') {
67
- loadedPlugin.server = server;
68
- loadedPlugin.serverPkg = server;
69
- }
70
- debug(`resolve plugin %s: %s`, plugin, {
71
- cli: loadedPlugin.cli,
72
- server: loadedPlugin.server,
73
- });
43
+ debug(`resolve plugin %s: %s`, plugin, loadedPlugin);
74
44
  return loadedPlugin;
75
45
  });
76
- if (!isOldPluginConfig(pluginConfig)) {
77
- const cliPlugins = Array.isArray(pluginConfig)
78
- ? pluginConfig
79
- : pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.cli;
80
- if (cliPlugins === null || cliPlugins === void 0 ? void 0 : cliPlugins.length) {
81
- loadedPlugins.push(...cliPlugins.map(item => ({
82
- cli: (0, manager_1.createPlugin)(item.setup, item),
83
- })));
46
+ if (!(0, exports.isOldPluginConfig)(pluginConfig)) {
47
+ if (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.length) {
48
+ loadedPlugins.push(...pluginConfig.map(item => (0, manager_1.createPlugin)(item.setup, item)));
84
49
  }
85
50
  }
86
51
  return loadedPlugins;
package/dist/manager.d.ts CHANGED
@@ -51,7 +51,7 @@ export declare const manager: import("@modern-js/plugin").AsyncManager<CliHooks,
51
51
  useResolvedConfigContext: () => NormalizedConfig;
52
52
  }>;
53
53
  /** Plugin options of a cli plugin. */
54
- export declare type CliPlugin = PluginOptions<CliHooks, AsyncSetup<CliHooks, typeof pluginAPI>>;
54
+ export declare type CliPlugin<ExtendHooks = {}> = PluginOptions<CliHooks, AsyncSetup<CliHooks & ExtendHooks, typeof pluginAPI>, ExtendHooks>;
55
55
  export declare const createPlugin: (setup?: AsyncSetup<CliHooks, {
56
56
  setAppContext: (value: import("@modern-js/types/cli").IAppContext) => void;
57
57
  useAppContext: () => import("@modern-js/types/cli").IAppContext;
@@ -62,11 +62,10 @@ export declare const createPlugin: (setup?: AsyncSetup<CliHooks, {
62
62
  useAppContext: () => import("@modern-js/types/cli").IAppContext;
63
63
  useConfigContext: () => UserConfig;
64
64
  useResolvedConfigContext: () => NormalizedConfig;
65
- }>> | undefined) => import("@modern-js/plugin").AsyncPlugin<CliHooks, {
65
+ }>, Record<string, unknown>> | undefined) => import("@modern-js/plugin").AsyncPlugin<CliHooks, {
66
66
  setAppContext: (value: import("@modern-js/types/cli").IAppContext) => void;
67
67
  useAppContext: () => import("@modern-js/types/cli").IAppContext;
68
68
  useConfigContext: () => UserConfig;
69
69
  useResolvedConfigContext: () => NormalizedConfig;
70
70
  }>, registerHook: (newHooks: Partial<CliHooks>) => void, mountHook: () => ToRunners<CliHooks>;
71
- export declare const usePlugins: (plugins: string[]) => void;
72
71
  export {};
package/dist/manager.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePlugins = exports.mountHook = exports.registerHook = exports.createPlugin = exports.manager = void 0;
3
+ exports.mountHook = exports.registerHook = exports.createPlugin = exports.manager = void 0;
4
4
  const plugin_1 = require("@modern-js/plugin");
5
- const utils_1 = require("@modern-js/utils");
6
5
  const pluginAPI_1 = require("./pluginAPI");
7
6
  const baseHooks = {
8
7
  config: (0, plugin_1.createParallelWorkflow)(),
@@ -17,8 +16,3 @@ const baseHooks = {
17
16
  };
18
17
  exports.manager = (0, plugin_1.createAsyncManager)(baseHooks, pluginAPI_1.pluginAPI);
19
18
  exports.createPlugin = exports.manager.createPlugin, exports.registerHook = exports.manager.registerHook, exports.mountHook = exports.manager.useRunner;
20
- const usePlugins = (plugins) => plugins.forEach(pluginPath => {
21
- const module = (0, utils_1.compatRequire)(require.resolve(pluginPath));
22
- exports.manager.usePlugin(module);
23
- });
24
- exports.usePlugins = usePlugins;
@@ -9,5 +9,5 @@ export declare const pluginAPI: {
9
9
  };
10
10
  export type { IAppContext } from '@modern-js/types';
11
11
  /** all apis for cli plugin */
12
- export declare type PluginAPI = typeof pluginAPI & CommonAPI<CliHooks>;
12
+ export declare type PluginAPI<ExtendHooks = Record<string, any>> = typeof pluginAPI & CommonAPI<CliHooks & ExtendHooks>;
13
13
  export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, };
@@ -1,6 +1,5 @@
1
1
  import { AsyncWaterfall, AsyncWorkflow } from '@modern-js/plugin';
2
- import { Entrypoint, HtmlPartials, Route, ServerRoute } from '@modern-js/types';
3
- import { Compiler, Configuration, MultiCompiler } from 'webpack';
2
+ import { Entrypoint, HtmlPartials, NestedRoute, PageRoute, RouteLegacy, ServerRoute } from '@modern-js/types';
4
3
  export interface ImportSpecifier {
5
4
  local?: string;
6
5
  imported?: string;
@@ -16,27 +15,10 @@ export interface RuntimePlugin {
16
15
  args?: string;
17
16
  }
18
17
  export interface Hooks {
19
- beforeDev: AsyncWorkflow<void, unknown>;
20
- afterDev: AsyncWorkflow<void, unknown>;
21
- beforeCreateCompiler: AsyncWorkflow<{
22
- webpackConfigs: Configuration[];
23
- }, unknown>;
24
- afterCreateCompiler: AsyncWorkflow<{
25
- compiler: Compiler | MultiCompiler | undefined;
26
- }, unknown>;
27
- beforePrintInstructions: AsyncWaterfall<{
28
- instructions: string;
29
- }>;
30
- beforeBuild: AsyncWorkflow<{
31
- webpackConfigs: Configuration[];
32
- }, unknown>;
33
- afterBuild: AsyncWorkflow<void, unknown>;
34
18
  afterMonorepoDeploy: AsyncWorkflow<{
35
19
  operator: any;
36
20
  deployProjectNames: string[];
37
21
  }, void>;
38
- beforeDeploy: AsyncWorkflow<Record<string, any>, unknown>;
39
- afterDeploy: AsyncWorkflow<Record<string, any>, unknown>;
40
22
  modifyEntryExport: AsyncWaterfall<{
41
23
  entrypoint: Entrypoint;
42
24
  exportStatement: string;
@@ -59,7 +41,7 @@ export interface Hooks {
59
41
  }>;
60
42
  modifyFileSystemRoutes: AsyncWaterfall<{
61
43
  entrypoint: Entrypoint;
62
- routes: Route[];
44
+ routes: RouteLegacy[] | (NestedRoute | PageRoute)[];
63
45
  }>;
64
46
  modifyServerRoutes: AsyncWaterfall<{
65
47
  routes: ServerRoute[];
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "modern",
11
11
  "modern.js"
12
12
  ],
13
- "version": "1.21.3",
13
+ "version": "2.0.0-beta.0",
14
14
  "jsnext:source": "./src/index.ts",
15
15
  "types": "./dist/index.d.ts",
16
16
  "main": "./dist/index.js",
@@ -33,21 +33,21 @@
33
33
  "typesVersions": {
34
34
  "*": {
35
35
  "config": [
36
- "./dist/config/index.d.ts"
36
+ "./dist/config/types/index.d.ts"
37
37
  ]
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@modern-js/node-bundle-require": "1.21.3",
42
- "@modern-js/plugin": "1.21.3",
43
- "@modern-js/utils": "1.21.3"
41
+ "@modern-js/node-bundle-require": "2.0.0-beta.0",
42
+ "@modern-js/plugin": "2.0.0-beta.0",
43
+ "@modern-js/utils": "2.0.0-beta.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jest/types": "^27.0.6",
47
- "@modern-js/babel-preset-app": "1.21.3",
48
- "@modern-js/types": "1.21.3",
49
- "@scripts/build": "1.21.3",
50
- "@scripts/jest-config": "1.21.3",
47
+ "@modern-js/babel-preset-app": "2.0.0-beta.0",
48
+ "@modern-js/types": "2.0.0-beta.0",
49
+ "@scripts/build": "2.0.0-beta.0",
50
+ "@scripts/jest-config": "2.0.0-beta.0",
51
51
  "@types/babel__code-frame": "^7.0.3",
52
52
  "@types/babel__core": "^7.1.16",
53
53
  "@types/jest": "^27",
@@ -69,33 +69,10 @@
69
69
  "registry": "https://registry.npmjs.org/",
70
70
  "access": "public"
71
71
  },
72
- "wireit": {
73
- "build": {
74
- "command": "tsc",
75
- "files": [
76
- "src/**/*",
77
- "tsconfig.json",
78
- "package.json"
79
- ],
80
- "output": [
81
- "dist/**/*"
82
- ]
83
- },
84
- "test": {
85
- "command": "jest",
86
- "files": [
87
- "src/**/*",
88
- "tsconfig.json",
89
- "package.json",
90
- "tests/**/*"
91
- ],
92
- "output": []
93
- }
94
- },
95
72
  "scripts": {
96
73
  "new": "modern new",
97
- "build": "wireit",
74
+ "build": "tsc",
98
75
  "dev": "tsc --watch",
99
- "test": "wireit"
76
+ "test": "jest"
100
77
  }
101
78
  }
@@ -1,25 +0,0 @@
1
- export declare type UnbundleConfig = {
2
- /**
3
- * Some package A may require another package B that is intended for Node.js
4
- * use only. In such a case, if package B cannot be converted to ESM, it will
5
- * cause package A to fail during unbundle development, even though package B
6
- * is not really required. Package B can thus be safely ignored via this option
7
- * to ensure transpilation of package A to ESM
8
- */
9
- ignore?: string | string[];
10
- /**
11
- * ignores cached esm modules and recompiles dependencies not available
12
- * from PDN host on dev start.
13
- * default: false
14
- */
15
- ignoreModuleCache?: boolean;
16
- /**
17
- * clears cache of downloaded esm modules (from PDN) on dev start.
18
- * default: false
19
- */
20
- clearPdnCache?: boolean;
21
- /**
22
- * modifies host to attempt to download esm modules from
23
- */
24
- pdnHost?: string;
25
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });