@modern-js/app-tools 2.62.2-alpha.0 → 2.63.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var src_exports = {};
21
21
  __export(src_exports, {
22
- appTools: () => import_new2.appTools,
22
+ appTools: () => import_new.appTools,
23
23
  default: () => src_default,
24
24
  defineConfig: () => import_defineConfig.defineConfig,
25
25
  defineLegacyConfig: () => import_defineConfig.defineLegacyConfig,
@@ -30,9 +30,9 @@ __export(src_exports, {
30
30
  module.exports = __toCommonJS(src_exports);
31
31
  var import_new = require("./new/index");
32
32
  var import_new2 = require("./new/index");
33
- var import_dev = require("./commands/dev");
34
- var import_core = require("@modern-js/core");
35
33
  var import_defineConfig = require("./defineConfig");
34
+ var import_core = require("@modern-js/core");
35
+ var import_dev = require("./commands/dev");
36
36
  __reExport(src_exports, require("./types"), module.exports);
37
37
  var src_default = import_new.appTools;
38
38
  // Annotate the CommonJS export names for ESM import in node:
@@ -65,6 +65,11 @@ function getHookRunners(context) {
65
65
  beforePrintInstructions: async (params) => {
66
66
  return hooks.onBeforePrintInstructions.call(params);
67
67
  },
68
+ // garfish plugin hooks
69
+ appendEntryCode: async (params) => {
70
+ const result = await (hooks === null || hooks === void 0 ? void 0 : hooks.appendEntryCode.call(params));
71
+ return result;
72
+ },
68
73
  /**
69
74
  * common hooks
70
75
  */
@@ -21,6 +21,7 @@ __export(compat_exports, {
21
21
  compatPlugin: () => compatPlugin
22
22
  });
23
23
  module.exports = __toCommonJS(compat_exports);
24
+ var import_plugin_v2 = require("@modern-js/plugin-v2");
24
25
  var import_hooks = require("./hooks");
25
26
  const compatPlugin = () => ({
26
27
  name: "@modern-js/app-tools-compat",
@@ -30,7 +31,8 @@ const compatPlugin = () => ({
30
31
  };
31
32
  return {
32
33
  useAppContext: () => {
33
- return getAppContext();
34
+ const { _internalContext, ...appContext } = getAppContext();
35
+ return appContext;
34
36
  },
35
37
  setAppContext: (context) => {
36
38
  return updateAppContext(context);
@@ -46,6 +48,9 @@ const compatPlugin = () => ({
46
48
  }
47
49
  };
48
50
  },
51
+ registryHooks: {
52
+ appendEntryCode: (0, import_plugin_v2.createCollectAsyncHook)()
53
+ },
49
54
  setup: (_api) => {
50
55
  }
51
56
  });
@@ -35,13 +35,14 @@ var import_path = __toESM(require("path"));
35
35
  var import_utils = require("@modern-js/utils");
36
36
  const initAppContext = ({ appDirectory, runtimeConfigFile, options, serverConfigFile, tempDir }) => {
37
37
  const { metaName = "modern-js", apiDir = "api", distDir = "", sharedDir = "shared" } = options || {};
38
+ const pkgPath = import_path.default.resolve(appDirectory, "./package.json");
38
39
  return {
39
40
  metaName,
40
41
  runtimeConfigFile,
41
42
  serverConfigFile,
42
43
  ip: import_utils.address.ip(),
43
44
  port: 0,
44
- moduleType: require(import_path.default.resolve(appDirectory, "./package.json")).type || "commonjs",
45
+ moduleType: import_utils.fs.existsSync(pkgPath) ? require(pkgPath).type || "commonjs" : "commonjs",
45
46
  apiDirectory: import_path.default.resolve(appDirectory, apiDir),
46
47
  lambdaDirectory: import_path.default.resolve(appDirectory, apiDir, "lambda"),
47
48
  sharedDirectory: import_path.default.resolve(appDirectory, sharedDir),
@@ -34,60 +34,54 @@ var initialize_default = ({ bundler }) => ({
34
34
  "@modern-js/plugin-polyfill"
35
35
  ],
36
36
  setup(api) {
37
- const config = () => {
38
- const appContext = api.useAppContext();
39
- const userConfig = api.useConfigContext();
40
- api.setAppContext({
41
- ...appContext,
37
+ api.config(() => {
38
+ const appContext = api.getAppContext();
39
+ const userConfig = api.getConfig();
40
+ api.updateAppContext({
42
41
  bundlerType: bundler
43
42
  });
44
43
  return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext);
45
- };
46
- return {
47
- config,
48
- async resolvedConfig({ resolved }) {
49
- var _resolved_output_distPath;
50
- let appContext = api.useAppContext();
51
- const userConfig = api.useConfigContext();
52
- const port = await getServerPort(resolved);
53
- appContext = {
54
- ...appContext,
55
- port,
56
- distDirectory: (0, import_utils.ensureAbsolutePath)(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
57
- };
58
- api.setAppContext(appContext);
59
- const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_config.transformNormalizedConfig)(resolved) : resolved;
60
- resolved._raw = userConfig;
61
- resolved.server = {
62
- ...normalizedConfig.server || {},
63
- port
64
- };
65
- var _normalizedConfig_autoLoadPlugins;
66
- resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
67
- stabilizeConfig(resolved, normalizedConfig, [
68
- "source",
69
- "bff",
70
- "dev",
71
- "html",
72
- "output",
73
- "tools",
74
- "testing",
75
- "plugins",
76
- "builderPlugins",
77
- "runtime",
78
- "runtimeByEntries",
79
- "deploy",
80
- "performance"
81
- ]);
82
- if (bundler === "webpack") {
83
- resolved.security = normalizedConfig.security || {};
84
- resolved.experiments = normalizedConfig.experiments;
85
- }
86
- return {
87
- resolved
88
- };
44
+ });
45
+ api.modifyResolvedConfig(async (resolved) => {
46
+ var _resolved_output_distPath;
47
+ let appContext = api.getAppContext();
48
+ const userConfig = api.getConfig();
49
+ const port = await getServerPort(resolved);
50
+ appContext = {
51
+ ...appContext,
52
+ port,
53
+ distDirectory: (0, import_utils.ensureAbsolutePath)(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
54
+ };
55
+ api.updateAppContext(appContext);
56
+ const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_config.transformNormalizedConfig)(resolved) : resolved;
57
+ resolved._raw = userConfig;
58
+ resolved.server = {
59
+ ...normalizedConfig.server || {},
60
+ port
61
+ };
62
+ var _normalizedConfig_autoLoadPlugins;
63
+ resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
64
+ stabilizeConfig(resolved, normalizedConfig, [
65
+ "source",
66
+ "bff",
67
+ "dev",
68
+ "html",
69
+ "output",
70
+ "tools",
71
+ "testing",
72
+ "plugins",
73
+ "builderPlugins",
74
+ "runtime",
75
+ "runtimeByEntries",
76
+ "deploy",
77
+ "performance"
78
+ ]);
79
+ if (bundler === "webpack") {
80
+ resolved.security = normalizedConfig.security || {};
81
+ resolved.experiments = normalizedConfig.experiments;
89
82
  }
90
- };
83
+ return resolved;
84
+ });
91
85
  }
92
86
  });
93
87
  function stabilizeConfig(resolve, config, keys) {
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
15
+ var new_exports = {};
16
+ module.exports = __toCommonJS(new_exports);
package/dist/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { appTools } from "./new/index";
2
- import { appTools as appTools2, initAppContext } from "./new/index";
3
- import { dev } from "./commands/dev";
4
- import { mergeConfig } from "@modern-js/core";
2
+ import { initAppContext } from "./new/index";
5
3
  import { defineConfig, defineLegacyConfig } from "./defineConfig";
4
+ import { mergeConfig } from "@modern-js/core";
5
+ import { dev } from "./commands/dev";
6
6
  export * from "./types";
7
7
  var src_default = appTools;
8
8
  export {
9
- appTools2 as appTools,
9
+ appTools,
10
10
  src_default as default,
11
11
  defineConfig,
12
12
  defineLegacyConfig,
@@ -148,6 +148,30 @@ function getHookRunners(context) {
148
148
  return _ref.apply(this, arguments);
149
149
  };
150
150
  }(),
151
+ // garfish plugin hooks
152
+ appendEntryCode: function() {
153
+ var _ref = _async_to_generator(function(params) {
154
+ var result;
155
+ return _ts_generator(this, function(_state) {
156
+ switch (_state.label) {
157
+ case 0:
158
+ return [
159
+ 4,
160
+ hooks === null || hooks === void 0 ? void 0 : hooks.appendEntryCode.call(params)
161
+ ];
162
+ case 1:
163
+ result = _state.sent();
164
+ return [
165
+ 2,
166
+ result
167
+ ];
168
+ }
169
+ });
170
+ });
171
+ return function(params) {
172
+ return _ref.apply(this, arguments);
173
+ };
174
+ }(),
151
175
  /**
152
176
  * common hooks
153
177
  */
@@ -1,3 +1,5 @@
1
+ import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
2
+ import { createCollectAsyncHook } from "@modern-js/plugin-v2";
1
3
  import { getHookRunners } from "./hooks";
2
4
  var compatPlugin = function() {
3
5
  return {
@@ -8,7 +10,10 @@ var compatPlugin = function() {
8
10
  };
9
11
  return {
10
12
  useAppContext: function() {
11
- return getAppContext();
13
+ var _getAppContext = getAppContext(), _internalContext = _getAppContext._internalContext, appContext = _object_without_properties(_getAppContext, [
14
+ "_internalContext"
15
+ ]);
16
+ return appContext;
12
17
  },
13
18
  setAppContext: function(context) {
14
19
  return updateAppContext(context);
@@ -24,6 +29,9 @@ var compatPlugin = function() {
24
29
  }
25
30
  };
26
31
  },
32
+ registryHooks: {
33
+ appendEntryCode: createCollectAsyncHook()
34
+ },
27
35
  setup: function(_api) {
28
36
  }
29
37
  };
@@ -1,15 +1,16 @@
1
1
  import path from "path";
2
- import { address } from "@modern-js/utils";
2
+ import { fs, address } from "@modern-js/utils";
3
3
  var initAppContext = function(param) {
4
4
  var appDirectory = param.appDirectory, runtimeConfigFile = param.runtimeConfigFile, options = param.options, serverConfigFile = param.serverConfigFile, tempDir = param.tempDir;
5
5
  var _ref = options || {}, _ref_metaName = _ref.metaName, metaName = _ref_metaName === void 0 ? "modern-js" : _ref_metaName, _ref_apiDir = _ref.apiDir, apiDir = _ref_apiDir === void 0 ? "api" : _ref_apiDir, _ref_distDir = _ref.distDir, distDir = _ref_distDir === void 0 ? "" : _ref_distDir, _ref_sharedDir = _ref.sharedDir, sharedDir = _ref_sharedDir === void 0 ? "shared" : _ref_sharedDir;
6
+ var pkgPath = path.resolve(appDirectory, "./package.json");
6
7
  return {
7
8
  metaName,
8
9
  runtimeConfigFile,
9
10
  serverConfigFile,
10
11
  ip: address.ip(),
11
12
  port: 0,
12
- moduleType: require(path.resolve(appDirectory, "./package.json")).type || "commonjs",
13
+ moduleType: fs.existsSync(pkgPath) ? require(pkgPath).type || "commonjs" : "commonjs",
13
14
  apiDirectory: path.resolve(appDirectory, apiDir),
14
15
  lambdaDirectory: path.resolve(appDirectory, apiDir, "lambda"),
15
16
  sharedDirectory: path.resolve(appDirectory, sharedDir),
@@ -17,72 +17,69 @@ function initialize_default(param) {
17
17
  "@modern-js/plugin-polyfill"
18
18
  ],
19
19
  setup: function setup(api) {
20
- var config = function() {
21
- var appContext = api.useAppContext();
22
- var userConfig = api.useConfigContext();
23
- api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
20
+ api.config(function() {
21
+ var appContext = api.getAppContext();
22
+ var userConfig = api.getConfig();
23
+ api.updateAppContext({
24
24
  bundlerType: bundler
25
- }));
25
+ });
26
26
  return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
27
- };
28
- return {
29
- config,
30
- resolvedConfig: function resolvedConfig(param2) {
31
- var resolved = param2.resolved;
32
- return _async_to_generator(function() {
33
- var _resolved_output_distPath, appContext, userConfig, port, normalizedConfig, _normalizedConfig_autoLoadPlugins;
34
- return _ts_generator(this, function(_state) {
35
- switch (_state.label) {
36
- case 0:
37
- appContext = api.useAppContext();
38
- userConfig = api.useConfigContext();
39
- return [
40
- 4,
41
- getServerPort(resolved)
42
- ];
43
- case 1:
44
- port = _state.sent();
45
- appContext = _object_spread_props(_object_spread({}, appContext), {
46
- port,
47
- distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
48
- });
49
- api.setAppContext(appContext);
50
- normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
51
- resolved._raw = userConfig;
52
- resolved.server = _object_spread_props(_object_spread({}, normalizedConfig.server || {}), {
53
- port
54
- });
55
- resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
56
- stabilizeConfig(resolved, normalizedConfig, [
57
- "source",
58
- "bff",
59
- "dev",
60
- "html",
61
- "output",
62
- "tools",
63
- "testing",
64
- "plugins",
65
- "builderPlugins",
66
- "runtime",
67
- "runtimeByEntries",
68
- "deploy",
69
- "performance"
70
- ]);
71
- if (bundler === "webpack") {
72
- resolved.security = normalizedConfig.security || {};
73
- resolved.experiments = normalizedConfig.experiments;
74
- }
75
- return [
76
- 2,
77
- {
78
- resolved
79
- }
80
- ];
81
- }
82
- });
83
- })();
84
- }
85
- };
27
+ });
28
+ api.modifyResolvedConfig(function() {
29
+ var _ref = _async_to_generator(function(resolved) {
30
+ var _resolved_output_distPath, appContext, userConfig, port, normalizedConfig, _normalizedConfig_autoLoadPlugins;
31
+ return _ts_generator(this, function(_state) {
32
+ switch (_state.label) {
33
+ case 0:
34
+ appContext = api.getAppContext();
35
+ userConfig = api.getConfig();
36
+ return [
37
+ 4,
38
+ getServerPort(resolved)
39
+ ];
40
+ case 1:
41
+ port = _state.sent();
42
+ appContext = _object_spread_props(_object_spread({}, appContext), {
43
+ port,
44
+ distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
45
+ });
46
+ api.updateAppContext(appContext);
47
+ normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
48
+ resolved._raw = userConfig;
49
+ resolved.server = _object_spread_props(_object_spread({}, normalizedConfig.server || {}), {
50
+ port
51
+ });
52
+ resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
53
+ stabilizeConfig(resolved, normalizedConfig, [
54
+ "source",
55
+ "bff",
56
+ "dev",
57
+ "html",
58
+ "output",
59
+ "tools",
60
+ "testing",
61
+ "plugins",
62
+ "builderPlugins",
63
+ "runtime",
64
+ "runtimeByEntries",
65
+ "deploy",
66
+ "performance"
67
+ ]);
68
+ if (bundler === "webpack") {
69
+ resolved.security = normalizedConfig.security || {};
70
+ resolved.experiments = normalizedConfig.experiments;
71
+ }
72
+ return [
73
+ 2,
74
+ resolved
75
+ ];
76
+ }
77
+ });
78
+ });
79
+ return function(resolved) {
80
+ return _ref.apply(this, arguments);
81
+ };
82
+ }());
86
83
  }
87
84
  };
88
85
  }
@@ -1,12 +1,12 @@
1
1
  import { appTools } from "./new/index";
2
- import { appTools as appTools2, initAppContext } from "./new/index";
3
- import { dev } from "./commands/dev";
4
- import { mergeConfig } from "@modern-js/core";
2
+ import { initAppContext } from "./new/index";
5
3
  import { defineConfig, defineLegacyConfig } from "./defineConfig";
4
+ import { mergeConfig } from "@modern-js/core";
5
+ import { dev } from "./commands/dev";
6
6
  export * from "./types";
7
7
  var src_default = appTools;
8
8
  export {
9
- appTools2 as appTools,
9
+ appTools,
10
10
  src_default as default,
11
11
  defineConfig,
12
12
  defineLegacyConfig,
@@ -41,6 +41,11 @@ function getHookRunners(context) {
41
41
  beforePrintInstructions: async (params) => {
42
42
  return hooks.onBeforePrintInstructions.call(params);
43
43
  },
44
+ // garfish plugin hooks
45
+ appendEntryCode: async (params) => {
46
+ const result = await (hooks === null || hooks === void 0 ? void 0 : hooks.appendEntryCode.call(params));
47
+ return result;
48
+ },
44
49
  /**
45
50
  * common hooks
46
51
  */
@@ -1,3 +1,4 @@
1
+ import { createCollectAsyncHook } from "@modern-js/plugin-v2";
1
2
  import { getHookRunners } from "./hooks";
2
3
  const compatPlugin = () => ({
3
4
  name: "@modern-js/app-tools-compat",
@@ -7,7 +8,8 @@ const compatPlugin = () => ({
7
8
  };
8
9
  return {
9
10
  useAppContext: () => {
10
- return getAppContext();
11
+ const { _internalContext, ...appContext } = getAppContext();
12
+ return appContext;
11
13
  },
12
14
  setAppContext: (context) => {
13
15
  return updateAppContext(context);
@@ -23,6 +25,9 @@ const compatPlugin = () => ({
23
25
  }
24
26
  };
25
27
  },
28
+ registryHooks: {
29
+ appendEntryCode: createCollectAsyncHook()
30
+ },
26
31
  setup: (_api) => {
27
32
  }
28
33
  });
@@ -1,14 +1,15 @@
1
1
  import path from "path";
2
- import { address } from "@modern-js/utils";
2
+ import { fs, address } from "@modern-js/utils";
3
3
  const initAppContext = ({ appDirectory, runtimeConfigFile, options, serverConfigFile, tempDir }) => {
4
4
  const { metaName = "modern-js", apiDir = "api", distDir = "", sharedDir = "shared" } = options || {};
5
+ const pkgPath = path.resolve(appDirectory, "./package.json");
5
6
  return {
6
7
  metaName,
7
8
  runtimeConfigFile,
8
9
  serverConfigFile,
9
10
  ip: address.ip(),
10
11
  port: 0,
11
- moduleType: require(path.resolve(appDirectory, "./package.json")).type || "commonjs",
12
+ moduleType: fs.existsSync(pkgPath) ? require(pkgPath).type || "commonjs" : "commonjs",
12
13
  apiDirectory: path.resolve(appDirectory, apiDir),
13
14
  lambdaDirectory: path.resolve(appDirectory, apiDir, "lambda"),
14
15
  sharedDirectory: path.resolve(appDirectory, sharedDir),
@@ -11,60 +11,54 @@ var initialize_default = ({ bundler }) => ({
11
11
  "@modern-js/plugin-polyfill"
12
12
  ],
13
13
  setup(api) {
14
- const config = () => {
15
- const appContext = api.useAppContext();
16
- const userConfig = api.useConfigContext();
17
- api.setAppContext({
18
- ...appContext,
14
+ api.config(() => {
15
+ const appContext = api.getAppContext();
16
+ const userConfig = api.getConfig();
17
+ api.updateAppContext({
19
18
  bundlerType: bundler
20
19
  });
21
20
  return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
22
- };
23
- return {
24
- config,
25
- async resolvedConfig({ resolved }) {
26
- var _resolved_output_distPath;
27
- let appContext = api.useAppContext();
28
- const userConfig = api.useConfigContext();
29
- const port = await getServerPort(resolved);
30
- appContext = {
31
- ...appContext,
32
- port,
33
- distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
34
- };
35
- api.setAppContext(appContext);
36
- const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
37
- resolved._raw = userConfig;
38
- resolved.server = {
39
- ...normalizedConfig.server || {},
40
- port
41
- };
42
- var _normalizedConfig_autoLoadPlugins;
43
- resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
44
- stabilizeConfig(resolved, normalizedConfig, [
45
- "source",
46
- "bff",
47
- "dev",
48
- "html",
49
- "output",
50
- "tools",
51
- "testing",
52
- "plugins",
53
- "builderPlugins",
54
- "runtime",
55
- "runtimeByEntries",
56
- "deploy",
57
- "performance"
58
- ]);
59
- if (bundler === "webpack") {
60
- resolved.security = normalizedConfig.security || {};
61
- resolved.experiments = normalizedConfig.experiments;
62
- }
63
- return {
64
- resolved
65
- };
21
+ });
22
+ api.modifyResolvedConfig(async (resolved) => {
23
+ var _resolved_output_distPath;
24
+ let appContext = api.getAppContext();
25
+ const userConfig = api.getConfig();
26
+ const port = await getServerPort(resolved);
27
+ appContext = {
28
+ ...appContext,
29
+ port,
30
+ distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
31
+ };
32
+ api.updateAppContext(appContext);
33
+ const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
34
+ resolved._raw = userConfig;
35
+ resolved.server = {
36
+ ...normalizedConfig.server || {},
37
+ port
38
+ };
39
+ var _normalizedConfig_autoLoadPlugins;
40
+ resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
41
+ stabilizeConfig(resolved, normalizedConfig, [
42
+ "source",
43
+ "bff",
44
+ "dev",
45
+ "html",
46
+ "output",
47
+ "tools",
48
+ "testing",
49
+ "plugins",
50
+ "builderPlugins",
51
+ "runtime",
52
+ "runtimeByEntries",
53
+ "deploy",
54
+ "performance"
55
+ ]);
56
+ if (bundler === "webpack") {
57
+ resolved.security = normalizedConfig.security || {};
58
+ resolved.experiments = normalizedConfig.experiments;
66
59
  }
67
- };
60
+ return resolved;
61
+ });
68
62
  }
69
63
  });
70
64
  function stabilizeConfig(resolve, config, keys) {
@@ -1,3 +1,4 @@
1
- import type { AppLegacyUserConfig, AppUserConfig, IAppContext } from '../types';
2
- export declare function createDefaultConfig(appContext: IAppContext): AppUserConfig<'webpack'> | AppUserConfig<'rspack'>;
3
- export declare function createLegacyDefaultConfig(appContext: IAppContext): AppLegacyUserConfig;
1
+ import type { AppLegacyUserConfig, AppUserConfig } from '../types';
2
+ import type { AppToolsContext } from '../types/new';
3
+ export declare function createDefaultConfig(appContext: AppToolsContext<'shared'>): AppUserConfig<'webpack'> | AppUserConfig<'rspack'>;
4
+ export declare function createLegacyDefaultConfig(appContext: AppToolsContext<'shared'>): AppLegacyUserConfig;
@@ -1,9 +1,10 @@
1
1
  import { appTools } from './new/index';
2
- export { appTools, initAppContext, type AppToolsPlugin } from './new/index';
2
+ export { appTools };
3
+ export { initAppContext } from './new/index';
4
+ export { defineConfig, defineLegacyConfig } from './defineConfig';
5
+ export { mergeConfig } from '@modern-js/core';
6
+ export type { RuntimeUserConfig } from './types/config';
3
7
  export { dev } from './commands/dev';
4
8
  export type { DevOptions } from './utils/types';
5
- export { mergeConfig } from '@modern-js/core';
6
- export { defineConfig, defineLegacyConfig } from './defineConfig';
7
9
  export * from './types';
8
- export type { RuntimeUserConfig } from './types/config';
9
10
  export default appTools;