@modern-js/app-tools 2.62.0 → 2.62.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/bin/modern.js +2 -2
  2. package/dist/cjs/index.js +4 -142
  3. package/dist/cjs/new/compat/hooks.js +160 -0
  4. package/dist/cjs/new/compat/index.js +52 -0
  5. package/dist/cjs/new/compat/utils.js +95 -0
  6. package/dist/cjs/new/constants.js +37 -0
  7. package/dist/cjs/new/context.js +63 -0
  8. package/dist/cjs/new/getConfigFile.js +41 -0
  9. package/dist/cjs/new/index.js +76 -0
  10. package/dist/cjs/new/loadPlugins.js +57 -0
  11. package/dist/cjs/new/run.js +66 -0
  12. package/dist/cjs/new/types/index.js +16 -0
  13. package/dist/cjs/new/utils/index.js +34 -0
  14. package/dist/cjs/old.js +179 -0
  15. package/dist/esm/index.js +2 -248
  16. package/dist/esm/new/compat/hooks.js +418 -0
  17. package/dist/esm/new/compat/index.js +30 -0
  18. package/dist/esm/new/compat/utils.js +69 -0
  19. package/dist/esm/new/constants.js +10 -0
  20. package/dist/esm/new/context.js +30 -0
  21. package/dist/esm/new/getConfigFile.js +11 -0
  22. package/dist/esm/new/index.js +52 -0
  23. package/dist/esm/new/loadPlugins.js +94 -0
  24. package/dist/esm/new/run.js +79 -0
  25. package/dist/esm/new/types/index.js +0 -0
  26. package/dist/esm/new/utils/index.js +33 -0
  27. package/dist/esm/old.js +258 -0
  28. package/dist/esm-node/index.js +2 -130
  29. package/dist/esm-node/new/compat/hooks.js +135 -0
  30. package/dist/esm-node/new/compat/index.js +28 -0
  31. package/dist/esm-node/new/compat/utils.js +69 -0
  32. package/dist/esm-node/new/constants.js +10 -0
  33. package/dist/esm-node/new/context.js +29 -0
  34. package/dist/esm-node/new/getConfigFile.js +7 -0
  35. package/dist/esm-node/new/index.js +49 -0
  36. package/dist/esm-node/new/loadPlugins.js +33 -0
  37. package/dist/esm-node/new/run.js +42 -0
  38. package/dist/esm-node/new/types/index.js +0 -0
  39. package/dist/esm-node/new/utils/index.js +10 -0
  40. package/dist/esm-node/old.js +140 -0
  41. package/dist/types/index.d.ts +2 -6
  42. package/dist/types/new/compat/hooks.d.ts +8 -0
  43. package/dist/types/new/compat/index.d.ts +4 -0
  44. package/dist/types/new/compat/utils.d.ts +6 -0
  45. package/dist/types/new/constants.d.ts +4 -0
  46. package/dist/types/new/context.d.ts +32 -0
  47. package/dist/types/new/getConfigFile.d.ts +1 -0
  48. package/dist/types/new/index.d.ts +15 -0
  49. package/dist/types/new/loadPlugins.d.ts +9 -0
  50. package/dist/types/new/run.d.ts +13 -0
  51. package/dist/types/new/types/index.d.ts +89 -0
  52. package/dist/types/new/utils/index.d.ts +1 -0
  53. package/dist/types/old.d.ts +20 -0
  54. package/package.json +14 -6
@@ -0,0 +1,76 @@
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
+ const context = api.getAppContext();
63
+ api.updateAppContext((0, import_context.initAppContext)({
64
+ appDirectory: context.appDirectory,
65
+ options: {},
66
+ serverConfigFile: import_constants.DEFAULT_SERVER_CONFIG_FILE,
67
+ runtimeConfigFile: import_constants.DEFAULT_RUNTIME_CONFIG_FILE
68
+ }));
69
+ }
70
+ });
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ appTools,
74
+ initAppContext,
75
+ ...require("../defineConfig")
76
+ });
@@ -0,0 +1,57 @@
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, forceAutoLoadPlugins) => {
43
+ const plugins = [
44
+ ...forceAutoLoadPlugins || 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
+ });
@@ -0,0 +1,66 @@
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 run_exports = {};
20
+ __export(run_exports, {
21
+ run: () => run
22
+ });
23
+ module.exports = __toCommonJS(run_exports);
24
+ var import_cli = require("@modern-js/plugin-v2/cli");
25
+ var import_run = require("@modern-js/plugin-v2/run");
26
+ var import_utils = require("@modern-js/utils");
27
+ var import_hooks = require("./compat/hooks");
28
+ var import_constants = require("./constants");
29
+ var import_getConfigFile = require("./getConfigFile");
30
+ var import_loadPlugins = require("./loadPlugins");
31
+ var import_utils2 = require("./utils");
32
+ async function run({ cwd, version, internalPlugins, forceAutoLoadPlugins, packageJsonConfig, configFile }) {
33
+ const command = process.argv[2];
34
+ const cliParams = (0, import_utils.minimist)(process.argv.slice(2));
35
+ const SUPPORT_CONFIG_PARAM_COMMANDS = [
36
+ "dev",
37
+ "build",
38
+ "deploy",
39
+ "start",
40
+ "serve",
41
+ "inspect",
42
+ "upgrade"
43
+ ];
44
+ let customConfigFile;
45
+ if (SUPPORT_CONFIG_PARAM_COMMANDS.includes(command)) {
46
+ customConfigFile = cliParams.config || cliParams.c;
47
+ }
48
+ if (command === "new") {
49
+ customConfigFile = cliParams["config-file"];
50
+ }
51
+ const appDirectory = await (0, import_cli.initAppDir)(cwd);
52
+ const autoLoadPlugins = await (0, import_utils2.getIsAutoLoadPlugins)(appDirectory, customConfigFile || (0, import_getConfigFile.getConfigFile)(configFile));
53
+ const plugins = await (0, import_loadPlugins.loadInternalPlugins)(appDirectory, internalPlugins === null || internalPlugins === void 0 ? void 0 : internalPlugins.cli, internalPlugins === null || internalPlugins === void 0 ? void 0 : internalPlugins.autoLoad, autoLoadPlugins, forceAutoLoadPlugins);
54
+ await (0, import_run.run)({
55
+ cwd,
56
+ initialLog: `Modern.js Framework v${version}`,
57
+ configFile: customConfigFile || (0, import_getConfigFile.getConfigFile)(configFile),
58
+ packageJsonConfig: packageJsonConfig || import_constants.PACKAGE_JSON_CONFIG_NAME,
59
+ internalPlugins: plugins,
60
+ handleSetupResult: import_hooks.handleSetupResult
61
+ });
62
+ }
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ run
66
+ });
@@ -0,0 +1,16 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,34 @@
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 utils_exports = {};
20
+ __export(utils_exports, {
21
+ getIsAutoLoadPlugins: () => getIsAutoLoadPlugins
22
+ });
23
+ module.exports = __toCommonJS(utils_exports);
24
+ var import_cli = require("@modern-js/plugin-v2/cli");
25
+ async function getIsAutoLoadPlugins(appDirectory, configFile = "modern.config.ts", packageJsonConfig = "ModernConfig") {
26
+ var _loaded_config;
27
+ const loaded = await (0, import_cli.createLoadedConfig)(appDirectory, configFile, packageJsonConfig);
28
+ const autoLoadPlugins = (_loaded_config = loaded.config) === null || _loaded_config === void 0 ? void 0 : _loaded_config.autoLoadPlugins;
29
+ return autoLoadPlugins || false;
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ getIsAutoLoadPlugins
34
+ });
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var old_exports = {};
31
+ __export(old_exports, {
32
+ appTools: () => appTools,
33
+ default: () => old_default,
34
+ dev: () => import_dev.dev,
35
+ mergeConfig: () => import_core.mergeConfig
36
+ });
37
+ module.exports = __toCommonJS(old_exports);
38
+ var import_path = __toESM(require("path"));
39
+ var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
40
+ var import_uni_builder = require("@modern-js/uni-builder");
41
+ var import_utils = require("@modern-js/utils");
42
+ var import_hooks = require("./hooks");
43
+ var import_locale = require("./locale");
44
+ var import_analyze = __toESM(require("./plugins/analyze"));
45
+ var import_deploy = __toESM(require("./plugins/deploy"));
46
+ var import_initialize = __toESM(require("./plugins/initialize"));
47
+ var import_serverBuild = __toESM(require("./plugins/serverBuild"));
48
+ var import_commands = require("./commands");
49
+ var import_generateWatchFiles = require("./utils/generateWatchFiles");
50
+ var import_restart = require("./utils/restart");
51
+ var import_dev = require("./commands/dev");
52
+ var import_core = require("@modern-js/core");
53
+ __reExport(old_exports, require("./defineConfig"), module.exports);
54
+ __reExport(old_exports, require("./types"), module.exports);
55
+ const appTools = (options = {
56
+ // default webpack to be compatible with original projects
57
+ bundler: "webpack"
58
+ }) => ({
59
+ name: "@modern-js/app-tools-old",
60
+ post: [
61
+ "@modern-js/plugin-initialize",
62
+ "@modern-js/plugin-analyze",
63
+ "@modern-js/plugin-ssr",
64
+ "@modern-js/plugin-document",
65
+ "@modern-js/plugin-state",
66
+ "@modern-js/plugin-router",
67
+ "@modern-js/plugin-router-v5",
68
+ "@modern-js/plugin-polyfill"
69
+ ],
70
+ registerHook: import_hooks.hooks,
71
+ usePlugins: [
72
+ (0, import_initialize.default)({
73
+ bundler: (options === null || options === void 0 ? void 0 : options.bundler) && [
74
+ "rspack",
75
+ "experimental-rspack"
76
+ ].includes(options.bundler) ? "rspack" : "webpack"
77
+ }),
78
+ (0, import_analyze.default)({
79
+ bundler: (options === null || options === void 0 ? void 0 : options.bundler) && [
80
+ "rspack",
81
+ "experimental-rspack"
82
+ ].includes(options.bundler) ? "rspack" : "webpack"
83
+ }),
84
+ (0, import_serverBuild.default)(),
85
+ (0, import_deploy.default)()
86
+ ],
87
+ setup: (api) => {
88
+ const appContext = api.useAppContext();
89
+ api.setAppContext({
90
+ ...appContext,
91
+ toolsType: "app-tools"
92
+ });
93
+ const locale = (0, import_language_detector.getLocaleLanguage)();
94
+ import_locale.i18n.changeLanguage({
95
+ locale
96
+ });
97
+ return {
98
+ async beforeConfig() {
99
+ var _userConfig_output;
100
+ const userConfig = api.useConfigContext();
101
+ const appContext2 = api.useAppContext();
102
+ if ((_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir) {
103
+ api.setAppContext({
104
+ ...appContext2,
105
+ internalDirectory: import_path.default.resolve(appContext2.appDirectory, userConfig.output.tempDir)
106
+ });
107
+ }
108
+ },
109
+ async commands({ program }) {
110
+ await (0, import_commands.devCommand)(program, api);
111
+ await (0, import_commands.buildCommand)(program, api);
112
+ (0, import_commands.serverCommand)(program, api);
113
+ (0, import_commands.deployCommand)(program, api);
114
+ (0, import_commands.newCommand)(program, locale);
115
+ (0, import_commands.inspectCommand)(program, api);
116
+ (0, import_commands.upgradeCommand)(program);
117
+ (0, import_utils.deprecatedCommands)(program);
118
+ },
119
+ async prepare() {
120
+ const command = (0, import_utils.getCommand)();
121
+ if (command === "deploy") {
122
+ const isSkipBuild = [
123
+ "-s",
124
+ "--skip-build"
125
+ ].some((tag) => {
126
+ return (0, import_utils.getArgv)().includes(tag);
127
+ });
128
+ if (isSkipBuild) {
129
+ return;
130
+ }
131
+ }
132
+ if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
133
+ const resolvedConfig = api.useResolvedConfigContext();
134
+ if (resolvedConfig.output.cleanDistPath) {
135
+ const appContext2 = api.useAppContext();
136
+ await (0, import_utils.emptyDir)(appContext2.distDirectory);
137
+ }
138
+ }
139
+ },
140
+ async watchFiles() {
141
+ const appContext2 = api.useAppContext();
142
+ const config = api.useResolvedConfigContext();
143
+ const files = await (0, import_generateWatchFiles.generateWatchFiles)(appContext2, config.source.configDir);
144
+ const watchFiles = (0, import_uni_builder.castArray)(config.dev.watchFiles);
145
+ watchFiles.forEach(({ type, paths }) => {
146
+ if (type === "reload-server") {
147
+ files.push(...Array.isArray(paths) ? paths : [
148
+ paths
149
+ ]);
150
+ }
151
+ });
152
+ return files;
153
+ },
154
+ // 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
155
+ async fileChange(e) {
156
+ const { filename, eventType, isPrivate } = e;
157
+ if (!isPrivate && (eventType === "change" || eventType === "unlink")) {
158
+ const { closeServer } = await import("./utils/createServer.js");
159
+ await closeServer();
160
+ await (0, import_restart.restart)(api.useHookRunners(), filename);
161
+ }
162
+ },
163
+ async beforeRestart() {
164
+ (0, import_utils.cleanRequireCache)([
165
+ require.resolve("./plugins/analyze")
166
+ ]);
167
+ }
168
+ };
169
+ }
170
+ });
171
+ var old_default = appTools;
172
+ // Annotate the CommonJS export names for ESM import in node:
173
+ 0 && (module.exports = {
174
+ appTools,
175
+ dev,
176
+ mergeConfig,
177
+ ...require("./defineConfig"),
178
+ ...require("./types")
179
+ });