@4399ywkf/core 5.3.1 → 5.4.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/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { G as GeneratorContext, e as PluginHooks, Y as YwkfConfig, f as PluginConfig } from './schema-Ade9gA3U.js';
2
- export { A as AnalyticsPluginOptions, h as BiomePluginOptions, j as BrowserCheckPluginOptions, k as BrowserMinVersions, y as BuildHooks, C as CodeInjection, D as DevServerConfig, E as EnvConfig, m as GarfishPluginOptions, F as GeneratedFile, J as GeneratorHooks, H as HtmlConfig, I as I18nPluginOptions, M as MicroFrontendConfig, q as MockPluginOptions, b as OutputConfig, P as PerformanceConfig, K as PluginContext, s as ReactQueryPluginOptions, R as RouterConfig, L as RouterHooks, N as RuntimeHooks, S as StyleConfig, u as TailwindPluginOptions, v as ThemePluginOptions, T as ToolsConfig, Q as YwkfPlugin, Z as ZustandPluginOptions, g as analyticsPlugin, i as biomePlugin, l as browserCheckPlugin, d as defaultConfig, a as defineConfig, n as garfishPlugin, o as getDefaultBiomeConfig, p as i18nPlugin, r as mockPlugin, t as reactQueryPlugin, w as tailwindPlugin, x as themePlugin, z as zustandPlugin } from './schema-Ade9gA3U.js';
1
+ import { G as GeneratorContext, e as PluginHooks, Y as YwkfConfig, f as PluginConfig } from './schema-BblOKuYl.js';
2
+ export { A as AnalyticsPluginOptions, i as BiomePluginOptions, k as BrowserCheckPluginOptions, l as BrowserMinVersions, y as BuildHooks, C as CodeInjection, D as DevServerConfig, E as EnvConfig, n as GarfishPluginOptions, F as GeneratedFile, J as GeneratorHooks, H as HtmlConfig, I as I18nPluginOptions, M as MicroFrontendConfig, r as MockPluginOptions, b as OutputConfig, P as PerformanceConfig, K as PluginContext, t as ReactQueryPluginOptions, R as RouterConfig, L as RouterHooks, N as RuntimeHooks, S as StyleConfig, v as TailwindPluginOptions, x as ThemePluginOptions, T as ToolsConfig, Q as YwkfPlugin, Z as ZustandPluginOptions, g as analyticsPlugin, h as biomePlugin, j as browserCheckPlugin, d as defaultConfig, a as defineConfig, m as garfishPlugin, o as getDefaultBiomeConfig, p as i18nPlugin, q as mockPlugin, s as reactQueryPlugin, u as tailwindPlugin, w as themePlugin, z as zustandPlugin } from './schema-BblOKuYl.js';
3
3
  import { Compiler } from '@rspack/core';
4
4
  export { PluginManager, createPlugin, definePlugin } from './plugin/index.js';
5
5
  export { ConventionalRouteGenerator, ConventionalRoutePlugin, ConventionalRoutePluginOptions, GeneratorOptions, RouteConfig, generateConventionalRoutes } from './router/index.js';
6
6
  export { createBaseConfig, createDevConfig, createProdConfig, createRspackConfig } from './rspack/index.js';
7
7
  export { AppContext, AppContextProvider, CHUNK_RECOVERY_ACTIVE_SYMBOL, CHUNK_RECOVERY_CACHE_BUST_PARAM, CHUNK_RECOVERY_STORAGE_KEY, ChunkRecoveryClaim, ChunkRecoveryPolicy, ChunkRecoveryPolicyContext, ChunkRecoveryStorage, ClaimChunkRecoveryAttemptOptions, DEFAULT_CHUNK_RECOVERY_COOLDOWN_MS, ErrorBoundary, GlobalChunkRecoveryHandlersOptions, HandleChunkRecoveryOptions, RootProvider, RouteErrorBoundary, RouteErrorBoundaryProps, bootstrap, claimChunkRecoveryAttempt, clearChunkRecoveryCacheBustParam, createMicroApp, createProvider, getMicroAppPublicPath, handleChunkLoadError, installGlobalChunkRecoveryHandlers, isChunkLoadError, isMicroAppEnv, isMicroAppRuntime, resolveChunkRecoveryPolicy, unmount, useApp, useAppName, useBasename, useEnv, useIsDev } from './runtime/index.js';
8
- export { A as AntdConfig, a as AppConfig, b as AppContextValue, C as ChunkRecoveryConfig, c as ChunkRecoveryEvent, d as ChunkRecoveryOutcome, e as ChunkRecoverySource, L as LifecycleHooks, M as MicroAppConfig, P as ProviderConfig } from './types-ZJhd87ue.js';
8
+ export { A as AntdConfig, a as AppConfig, b as AppContextValue, C as ChunkRecoveryConfig, c as ChunkRecoveryEvent, d as ChunkRecoveryOutcome, e as ChunkRecoverySource, L as LifecycleHooks, M as MicroAppConfig, P as ProviderConfig } from './types-DZ7Nz9bQ.js';
9
9
  import 'react/jsx-runtime';
10
10
  import 'react';
11
11
  import 'react-router';
@@ -46,7 +46,7 @@ declare class YwkfGenerator {
46
46
  private context;
47
47
  private pluginHooks;
48
48
  private lastGeneratedContent;
49
- constructor(context: Omit<GeneratorContext, "outputDir"> & {
49
+ constructor(context: Omit<GeneratorContext, 'outputDir'> & {
50
50
  outputDir?: string;
51
51
  }, pluginHooks?: PluginHooks[]);
52
52
  /**
@@ -96,14 +96,14 @@ declare class YwkfGenerator {
96
96
  }
97
97
 
98
98
  interface YwkfGeneratorPluginOptions {
99
- /** 项目根目录 */
100
- cwd: string;
101
99
  /** 解析后的配置 */
102
100
  config: Required<YwkfConfig>;
103
- /** 输出目录(.ywkf) */
104
- outputDir: string;
101
+ /** 项目根目录 */
102
+ cwd: string;
105
103
  /** 是否开发模式 */
106
104
  isDev: boolean;
105
+ /** 输出目录(.ywkf) */
106
+ outputDir: string;
107
107
  /** 用户配置的插件列表(PluginConfig 格式) */
108
108
  pluginConfigs?: PluginConfig[];
109
109
  }
package/dist/index.js CHANGED
@@ -152,9 +152,7 @@ var browserCheckPlugin = createPlugin((options = {}) => ({
152
152
  }
153
153
  }
154
154
  const minVersions = explicitVersions ? { ...baseVersions, ...explicitVersions } : baseVersions;
155
- logger.info(
156
- `\u6D4F\u89C8\u5668\u517C\u5BB9\u6027\u68C0\u67E5\u5DF2\u542F\u7528 (\u7279\u6027\u68C0\u6D4B: ${features.join(", ")})`
157
- );
155
+ logger.info(`\u6D4F\u89C8\u5668\u517C\u5BB9\u6027\u68C0\u67E5\u5DF2\u542F\u7528 (\u7279\u6027\u68C0\u6D4B: ${features.join(", ")})`);
158
156
  logger.info(
159
157
  `\u6700\u4F4E\u7248\u672C\u8981\u6C42: Chrome ${minVersions.chrome ?? "\u2014"}, Edge ${minVersions.edge ?? "\u2014"}, Firefox ${minVersions.firefox ?? "\u2014"}, Safari ${minVersions.safari ?? "\u2014"}${fromBrowserslist !== false ? " (\u4ECE browserslist \u8BFB\u53D6)" : ""}`
160
158
  );
@@ -194,7 +192,7 @@ var browserCheckPlugin = createPlugin((options = {}) => ({
194
192
  const insertIndex = lastImportIndex >= 0 ? lastImportIndex + 1 : 0;
195
193
  lines.splice(insertIndex, 0, checkBlock);
196
194
  let result = lines.join("\n");
197
- result = result.replace(
195
+ result = result.replaceAll(
198
196
  /(\s*)(await\s+)?runApp\(\);?/g,
199
197
  (_, indent, awaitKw) => `${indent}if (__ywkfBrowserOk) { ${awaitKw || ""}runApp(); }`
200
198
  );
@@ -218,37 +216,39 @@ function buildFeatureChecks(features) {
218
216
  return lines;
219
217
  }
220
218
  function buildVersionChecks(minVersions) {
221
- const entries = Object.entries(minVersions).filter(
222
- ([, v]) => v != null
223
- );
219
+ const entries = Object.entries(minVersions).filter(([, v]) => v != null);
224
220
  if (entries.length === 0) return [];
225
221
  const lines = ["// UA \u7248\u672C\u68C0\u6D4B", "const ua = navigator.userAgent;"];
226
222
  for (const [browser, minVer] of entries) {
227
223
  switch (browser) {
228
- case "chrome":
224
+ case "chrome": {
229
225
  lines.push(
230
226
  `const chromeMatch = /Chrome\\/(\\d+)/.exec(ua);`,
231
227
  `if (chromeMatch && !/Edg\\//.test(ua) && Number(chromeMatch[1]) < ${minVer}) return false;`
232
228
  );
233
229
  break;
234
- case "edge":
230
+ }
231
+ case "edge": {
235
232
  lines.push(
236
233
  `const edgeMatch = /Edg\\/(\\d+)/.exec(ua);`,
237
234
  `if (edgeMatch && Number(edgeMatch[1]) < ${minVer}) return false;`
238
235
  );
239
236
  break;
240
- case "firefox":
237
+ }
238
+ case "firefox": {
241
239
  lines.push(
242
240
  `const firefoxMatch = /Firefox\\/(\\d+)/.exec(ua);`,
243
241
  `if (firefoxMatch && Number(firefoxMatch[1]) < ${minVer}) return false;`
244
242
  );
245
243
  break;
246
- case "safari":
244
+ }
245
+ case "safari": {
247
246
  lines.push(
248
247
  `const safariMatch = /Version\\/(\\d+\\.?\\d*)/.exec(ua);`,
249
248
  `if (safariMatch && /Safari/.test(ua) && !/Chrome/.test(ua) && Number(safariMatch[1]) < ${minVer}) return false;`
250
249
  );
251
250
  break;
251
+ }
252
252
  }
253
253
  }
254
254
  return lines;
@@ -341,9 +341,9 @@ function readBrowserslistFile(filePath) {
341
341
  function extractMinVersions(queries) {
342
342
  const result = {};
343
343
  const expanded = queries.flatMap((q) => q.split(",").map((s) => s.trim()));
344
- const versionPattern = /^(\w+)\s*(?:(>=?)\s*)?(\d+(?:\.\d+)?)\s*$/i;
344
+ const versionPattern = /^([a-z_]+)\s*(?:(>=?)\s*)?(\d+(?:\.\d+)?)\s*$/i;
345
345
  for (const query of expanded) {
346
- if (/^(not|dead|last|defaults|>?\s*\d+%|unreleased|current)/i.test(query)) {
346
+ if (/^(?:not|dead|last|defaults|>?\s*\d+%|unreleased|current)/i.test(query)) {
347
347
  continue;
348
348
  }
349
349
  const match = versionPattern.exec(query);
@@ -384,7 +384,7 @@ var garfishPlugin = createPlugin((options = {}) => ({
384
384
  rspackConfig.devServer = {
385
385
  ...rspackConfig.devServer,
386
386
  headers: {
387
- ...rspackConfig.devServer?.headers || {},
387
+ ...rspackConfig.devServer?.headers,
388
388
  "Access-Control-Allow-Origin": "*",
389
389
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
390
390
  "Access-Control-Allow-Headers": "*"
@@ -712,7 +712,7 @@ function getLocaleLabel(locale) {
712
712
  "ru-RU": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
713
713
  "it-IT": "Italiano",
714
714
  "vi-VN": "Ti\u1EBFng Vi\u1EC7t",
715
- ar: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
715
+ "ar": "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
716
716
  };
717
717
  return map[locale] || locale;
718
718
  }
@@ -863,7 +863,7 @@ function scanMockFiles(dir) {
863
863
  for (const entry of entries) {
864
864
  const fullPath = join4(dir, entry);
865
865
  const stat = statSync(fullPath);
866
- if (stat.isFile() && /\.(ts|js|mjs)$/.test(entry)) {
866
+ if (stat.isFile() && /\.(?:ts|js|mjs)$/.test(entry)) {
867
867
  files.push(fullPath);
868
868
  } else if (stat.isDirectory()) {
869
869
  files.push(...scanMockFiles(fullPath));
@@ -1340,12 +1340,13 @@ function generateThemeProvider(opts) {
1340
1340
  scopePopupContainer
1341
1341
  } = opts;
1342
1342
  const isAutoLocale = locale === "auto";
1343
- const sections = [];
1344
- sections.push(`// \u6B64\u6587\u4EF6\u7531 @4399ywkf/plugin-theme v3 \u81EA\u52A8\u751F\u6210\uFF0C\u8BF7\u52FF\u624B\u52A8\u4FEE\u6539`);
1345
- sections.push(buildImports({ globalReset, cssVar, scopePopupContainer, locale }));
1346
- sections.push(TYPES_CODE);
1347
- sections.push(buildStoreCode({ defaultAppearance, primaryColor, neutralColor, locale }));
1348
- sections.push(HOOKS_CODE);
1343
+ const sections = [
1344
+ `// \u6B64\u6587\u4EF6\u7531 @4399ywkf/plugin-theme v3 \u81EA\u52A8\u751F\u6210\uFF0C\u8BF7\u52FF\u624B\u52A8\u4FEE\u6539`,
1345
+ buildImports({ globalReset, cssVar, scopePopupContainer, locale }),
1346
+ TYPES_CODE,
1347
+ buildStoreCode({ defaultAppearance, primaryColor, neutralColor, locale }),
1348
+ HOOKS_CODE
1349
+ ];
1349
1350
  if (globalReset) sections.push(GLOBAL_RESET_CODE);
1350
1351
  if (cssVar) sections.push(buildCssVarSyncCode());
1351
1352
  if (darkMode) sections.push(APPEARANCE_SYNC_CODE);
@@ -2040,18 +2041,58 @@ export type { StateCreator, StoreApi } from "zustand";
2040
2041
 
2041
2042
  // src/config/normalize.ts
2042
2043
  var BUILTIN_PLUGINS = [
2043
- { key: "reactQuery", factory: reactQueryPlugin, pluginName: "@4399ywkf/plugin-react-query" },
2044
- { key: "zustand", factory: zustandPlugin, pluginName: "@4399ywkf/plugin-zustand" },
2045
- { key: "tailwind", factory: tailwindPlugin, pluginName: "@4399ywkf/plugin-tailwind" }
2044
+ {
2045
+ key: "reactQuery",
2046
+ factory: reactQueryPlugin,
2047
+ pluginName: "@4399ywkf/plugin-react-query"
2048
+ },
2049
+ {
2050
+ key: "zustand",
2051
+ factory: zustandPlugin,
2052
+ pluginName: "@4399ywkf/plugin-zustand"
2053
+ },
2054
+ {
2055
+ key: "tailwind",
2056
+ factory: tailwindPlugin,
2057
+ pluginName: "@4399ywkf/plugin-tailwind"
2058
+ }
2046
2059
  ];
2047
2060
  var OPTIONAL_PLUGINS = [
2048
- { key: "biome", factory: biomePlugin, pluginName: "@4399ywkf/plugin-biome" },
2049
- { key: "analytics", factory: analyticsPlugin, pluginName: "@4399ywkf/plugin-analytics" },
2050
- { key: "mock", factory: mockPlugin, pluginName: "@4399ywkf/plugin-mock" },
2051
- { key: "theme", factory: themePlugin, pluginName: "@4399ywkf/plugin-theme" },
2052
- { key: "i18n", factory: i18nPlugin, pluginName: "@4399ywkf/plugin-i18n" },
2053
- { key: "garfish", factory: garfishPlugin, pluginName: "@4399ywkf/plugin-garfish" },
2054
- { key: "browserCheck", factory: browserCheckPlugin, pluginName: "@4399ywkf/plugin-browser-check" }
2061
+ {
2062
+ key: "biome",
2063
+ factory: biomePlugin,
2064
+ pluginName: "@4399ywkf/plugin-biome"
2065
+ },
2066
+ {
2067
+ key: "analytics",
2068
+ factory: analyticsPlugin,
2069
+ pluginName: "@4399ywkf/plugin-analytics"
2070
+ },
2071
+ {
2072
+ key: "mock",
2073
+ factory: mockPlugin,
2074
+ pluginName: "@4399ywkf/plugin-mock"
2075
+ },
2076
+ {
2077
+ key: "theme",
2078
+ factory: themePlugin,
2079
+ pluginName: "@4399ywkf/plugin-theme"
2080
+ },
2081
+ {
2082
+ key: "i18n",
2083
+ factory: i18nPlugin,
2084
+ pluginName: "@4399ywkf/plugin-i18n"
2085
+ },
2086
+ {
2087
+ key: "garfish",
2088
+ factory: garfishPlugin,
2089
+ pluginName: "@4399ywkf/plugin-garfish"
2090
+ },
2091
+ {
2092
+ key: "browserCheck",
2093
+ factory: browserCheckPlugin,
2094
+ pluginName: "@4399ywkf/plugin-browser-check"
2095
+ }
2055
2096
  ];
2056
2097
  var ALL_SHORTHAND_KEYS = /* @__PURE__ */ new Set([
2057
2098
  ...BUILTIN_PLUGINS.map((p) => p.key),
@@ -2184,7 +2225,12 @@ var defaultConfig = {
2184
2225
  };
2185
2226
 
2186
2227
  // src/config/loader.ts
2187
- var CONFIG_FILES = ["ywkf.config.ts", "ywkf.config.mts", "ywkf.config.js", "ywkf.config.mjs"];
2228
+ var CONFIG_FILES = [
2229
+ "ywkf.config.ts",
2230
+ "ywkf.config.mts",
2231
+ "ywkf.config.js",
2232
+ "ywkf.config.mjs"
2233
+ ];
2188
2234
  function findConfigFile(cwd) {
2189
2235
  for (const file of CONFIG_FILES) {
2190
2236
  const configPath = resolve2(cwd, file);
@@ -2509,7 +2555,7 @@ function winPath(path) {
2509
2555
  if (isExtendedLengthPath) {
2510
2556
  return path;
2511
2557
  }
2512
- return path.replace(/\\/g, "/");
2558
+ return path.replaceAll("\\", "/");
2513
2559
  }
2514
2560
  var EXCLUDED_DIRS = /* @__PURE__ */ new Set([
2515
2561
  "components",
@@ -2645,16 +2691,16 @@ var ConventionalRouteGenerator = class {
2645
2691
  */
2646
2692
  resolveRoutePath(dirName, parentPath) {
2647
2693
  let segment;
2648
- if (dirName.match(/^\[\.\.\.(.+)\]$/)) {
2694
+ if (/^\[\.\.\..+\]$/.test(dirName)) {
2649
2695
  segment = "*";
2650
- } else if (dirName.match(/^\[(.+)\$\]$/)) {
2696
+ } else if (/^\[.+\$\]$/.test(dirName)) {
2651
2697
  const param = dirName.slice(1, -2);
2652
2698
  segment = `:${param}?`;
2653
- } else if (dirName.match(/^\[(.+)\]$/)) {
2699
+ } else if (/^\[.+\]$/.test(dirName)) {
2654
2700
  const param = dirName.slice(1, -1);
2655
2701
  segment = `:${param}`;
2656
2702
  } else if (dirName.includes(".")) {
2657
- segment = dirName.replace(/\./g, "/");
2703
+ segment = dirName.replaceAll(".", "/");
2658
2704
  } else {
2659
2705
  segment = dirName;
2660
2706
  }
@@ -2665,7 +2711,7 @@ var ConventionalRouteGenerator = class {
2665
2711
  */
2666
2712
  generateRouteName(path) {
2667
2713
  const name = path.split("/").filter(Boolean).map((s) => s.replace(/^:/, "Param").replace(/\?$/, "Optional").replace(/^\*$/, "CatchAll")).map((s) => {
2668
- const cleaned = s.replace(/[^a-zA-Z0-9]/g, "");
2714
+ const cleaned = s.replaceAll(/[^a-z0-9]/gi, "");
2669
2715
  if (!cleaned) return "";
2670
2716
  return cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
2671
2717
  }).join("");
@@ -2785,9 +2831,7 @@ export default routes;
2785
2831
  );
2786
2832
  }
2787
2833
  if (route.errorFile) {
2788
- errorImports.push(
2789
- `import ${name}Error from "@/pages/${toImportPath(route.errorFile)}";`
2790
- );
2834
+ errorImports.push(`import ${name}Error from "@/pages/${toImportPath(route.errorFile)}";`);
2791
2835
  }
2792
2836
  if (route.loadingFile) {
2793
2837
  loadingImports.push(
@@ -3301,7 +3345,7 @@ var YwkfGenerator = class {
3301
3345
  * 标准化内容(去掉时间戳等动态部分)
3302
3346
  */
3303
3347
  normalizeContent(content) {
3304
- return content.replace(/\/\/ Generated at: .+/g, "").replace(/\/\*\* Generated at: .+ \*\//g, "");
3348
+ return content.replaceAll(/\/\/ Generated at: .+/g, "").replaceAll(/\/\*\* Generated at: .+ \*\//g, "");
3305
3349
  }
3306
3350
  };
3307
3351
 
@@ -3521,7 +3565,16 @@ function resolveYwkfBuildId(appName) {
3521
3565
  function createBaseConfig(config, cwd, options = {}) {
3522
3566
  const isDev = options.isDev ?? process.env.NODE_ENV !== "production";
3523
3567
  const { resolveApp } = createPathResolver(cwd);
3524
- const { appName, appCName, output, html, alias: userAlias, microFrontend, router, reactCompiler } = config;
3568
+ const {
3569
+ appName,
3570
+ appCName,
3571
+ output,
3572
+ html,
3573
+ alias: userAlias,
3574
+ microFrontend,
3575
+ router,
3576
+ reactCompiler
3577
+ } = config;
3525
3578
  const buildId = resolveYwkfBuildId(appName);
3526
3579
  const { env: clientEnv, dropped: droppedEnvKeys } = buildClientEnv({ cwd, env: config.env });
3527
3580
  if (droppedEnvKeys.length > 0) {
@@ -3554,7 +3607,7 @@ function createBaseConfig(config, cwd, options = {}) {
3554
3607
  ...alias,
3555
3608
  "process/browser.js": require2.resolve("process/browser.js"),
3556
3609
  "process/browser": require2.resolve("process/browser.js"),
3557
- react: resolveApp("node_modules/react"),
3610
+ "react": resolveApp("node_modules/react"),
3558
3611
  "react-dom": resolveApp("node_modules/react-dom"),
3559
3612
  "react-router": resolveApp("node_modules/react-router")
3560
3613
  },
@@ -4406,9 +4459,10 @@ function registerShortcuts(getPrinter, opts) {
4406
4459
  const cmd = buffer.trim().toLowerCase();
4407
4460
  buffer = "";
4408
4461
  switch (cmd) {
4409
- case "h":
4462
+ case "h": {
4410
4463
  getPrinter().printShortcuts();
4411
4464
  break;
4465
+ }
4412
4466
  case "o": {
4413
4467
  const url = `http://${displayHost(opts.getHost())}:${opts.getPort()}/`;
4414
4468
  import("child_process").then((cp) => {
@@ -4418,12 +4472,14 @@ function registerShortcuts(getPrinter, opts) {
4418
4472
  console.log(` ${chalk.green("\u279C")} Opening ${chalk.cyan(url)}...`);
4419
4473
  break;
4420
4474
  }
4421
- case "c":
4475
+ case "c": {
4422
4476
  console.clear();
4423
4477
  break;
4424
- case "q":
4478
+ }
4479
+ case "q": {
4425
4480
  opts.onQuit();
4426
4481
  break;
4482
+ }
4427
4483
  }
4428
4484
  };
4429
4485
  process.stdin.on("data", handler);
@@ -4574,20 +4630,16 @@ async function findPortHolder(port) {
4574
4630
  const pid2 = parseWindowsNetstatPid(stdout2, port);
4575
4631
  return pid2 === null ? null : { pid: pid2 };
4576
4632
  }
4577
- const { stdout } = await execFileAsync(
4578
- "lsof",
4579
- ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"],
4580
- { timeout: 1500 }
4581
- );
4633
+ const { stdout } = await execFileAsync("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"], {
4634
+ timeout: 1500
4635
+ });
4582
4636
  const pid = Number.parseInt(stdout.trim().split(/\s+/)[0], 10);
4583
4637
  if (!Number.isInteger(pid)) return null;
4584
4638
  let name;
4585
4639
  try {
4586
- const { stdout: comm } = await execFileAsync(
4587
- "ps",
4588
- ["-p", String(pid), "-o", "comm="],
4589
- { timeout: 1500 }
4590
- );
4640
+ const { stdout: comm } = await execFileAsync("ps", ["-p", String(pid), "-o", "comm="], {
4641
+ timeout: 1500
4642
+ });
4591
4643
  name = comm.trim().split("/").pop() || void 0;
4592
4644
  } catch {
4593
4645
  }
@@ -4734,7 +4786,7 @@ async function startDevServer(cwd, config) {
4734
4786
  printer.updateProgress(0, "rebuilding");
4735
4787
  });
4736
4788
  const devServerOptions = {
4737
- ...rspackConfig.devServer || {},
4789
+ ...rspackConfig.devServer,
4738
4790
  host,
4739
4791
  port,
4740
4792
  setupExitSignals: false
@@ -4895,7 +4947,7 @@ var ConventionalRoutePlugin = class {
4895
4947
  * 标准化内容(去掉时间戳等动态部分)
4896
4948
  */
4897
4949
  normalizeContent(content) {
4898
- return content.replace(/\/\/ Generated at: .+/g, "");
4950
+ return content.replaceAll(/\/\/ Generated at: .+/g, "");
4899
4951
  }
4900
4952
  /**
4901
4953
  * 监听页面目录变化
@@ -4932,12 +4984,8 @@ var ConventionalRoutePlugin = class {
4932
4984
  var DEFAULT_CHUNK_RECOVERY_COOLDOWN_MS = 3e4;
4933
4985
  var CHUNK_RECOVERY_STORAGE_KEY = "@4399ywkf/core:chunk-recovery-attempt";
4934
4986
  var CHUNK_RECOVERY_CACHE_BUST_PARAM = "__ywkf_chunk_retry";
4935
- var CHUNK_RECOVERY_ACTIVE_SYMBOL = /* @__PURE__ */ Symbol.for(
4936
- "@4399ywkf/core/chunk-recovery-active"
4937
- );
4938
- var CHUNK_RECOVERY_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for(
4939
- "@4399ywkf/core/chunk-recovery-registry"
4940
- );
4987
+ var CHUNK_RECOVERY_ACTIVE_SYMBOL = /* @__PURE__ */ Symbol.for("@4399ywkf/core/chunk-recovery-active");
4988
+ var CHUNK_RECOVERY_REGISTRY_SYMBOL = /* @__PURE__ */ Symbol.for("@4399ywkf/core/chunk-recovery-registry");
4941
4989
  var CHUNK_LOAD_ERROR_PATTERNS = [
4942
4990
  /\bChunkLoadError\b/i,
4943
4991
  /\bLoading (?:CSS )?chunk\s+\S+\s+failed\b/i,
@@ -5544,7 +5592,6 @@ function DefaultErrorFallback({
5544
5592
  !isChunkError && onReset && /* @__PURE__ */ jsx2(
5545
5593
  "button",
5546
5594
  {
5547
- onClick: onReset,
5548
5595
  style: {
5549
5596
  padding: "8px 16px",
5550
5597
  backgroundColor: "#1890ff",
@@ -5553,13 +5600,13 @@ function DefaultErrorFallback({
5553
5600
  borderRadius: 4,
5554
5601
  cursor: "pointer"
5555
5602
  },
5603
+ onClick: onReset,
5556
5604
  children: "\u91CD\u8BD5"
5557
5605
  }
5558
5606
  ),
5559
5607
  canReloadPage && /* @__PURE__ */ jsx2(
5560
5608
  "button",
5561
5609
  {
5562
- onClick: () => window.location.reload(),
5563
5610
  style: {
5564
5611
  padding: "8px 16px",
5565
5612
  backgroundColor: "#fff",
@@ -5568,6 +5615,7 @@ function DefaultErrorFallback({
5568
5615
  borderRadius: 4,
5569
5616
  cursor: "pointer"
5570
5617
  },
5618
+ onClick: () => window.location.reload(),
5571
5619
  children: "\u5237\u65B0\u9875\u9762"
5572
5620
  }
5573
5621
  )
@@ -5695,7 +5743,7 @@ async function resolveAppConfig(config) {
5695
5743
  const createRouter = routesModule.createRouter || routesModule.default?.createRouter;
5696
5744
  if (typeof createRouter === "function") {
5697
5745
  const router = createRouter(config.basename);
5698
- console.log("[ywkf] \u5DF2\u81EA\u52A8\u6CE8\u5165\u7EA6\u5B9A\u5F0F\u8DEF\u7531");
5746
+ console.info("[ywkf] \u5DF2\u81EA\u52A8\u6CE8\u5165\u7EA6\u5B9A\u5F0F\u8DEF\u7531");
5699
5747
  return { ...config, router };
5700
5748
  } else {
5701
5749
  console.warn("[ywkf] @ywkf/routes \u672A\u5BFC\u51FA createRouter \u51FD\u6570");
@@ -5763,13 +5811,13 @@ function createMicroApp(getConfig) {
5763
5811
  * 微前端 bootstrap 生命周期
5764
5812
  */
5765
5813
  async bootstrap() {
5766
- console.log("[MicroApp] bootstrap");
5814
+ console.info("[MicroApp] bootstrap");
5767
5815
  },
5768
5816
  /**
5769
5817
  * 微前端 mount 生命周期
5770
5818
  */
5771
5819
  async mount(props) {
5772
- console.log("[MicroApp] mount", props);
5820
+ console.info("[MicroApp] mount", props);
5773
5821
  const config = getConfig(props);
5774
5822
  const resolvedConfig = await resolveAppConfig(config);
5775
5823
  const container = props?.masterProps?.container;
@@ -5790,7 +5838,7 @@ function createMicroApp(getConfig) {
5790
5838
  });
5791
5839
  try {
5792
5840
  microRoot = createRoot(rootElement);
5793
- microRoot.render(/* @__PURE__ */ jsx4(RootProvider, { config: resolvedConfig, isMicroApp: true }));
5841
+ microRoot.render(/* @__PURE__ */ jsx4(RootProvider, { isMicroApp: true, config: resolvedConfig }));
5794
5842
  disposeMicroChunkRecoveryHandlers = nextDisposeMicroChunkRecoveryHandlers;
5795
5843
  } catch (error) {
5796
5844
  nextDisposeMicroChunkRecoveryHandlers();
@@ -5807,7 +5855,7 @@ function createMicroApp(getConfig) {
5807
5855
  * 微前端 unmount 生命周期
5808
5856
  */
5809
5857
  async unmount(props) {
5810
- console.log("[MicroApp] unmount", props);
5858
+ console.info("[MicroApp] unmount", props);
5811
5859
  const config = getConfig(props);
5812
5860
  if (config.lifecycle?.onUnmount) {
5813
5861
  config.lifecycle.onUnmount();
@@ -5823,7 +5871,7 @@ function createMicroApp(getConfig) {
5823
5871
  * 微前端 update 生命周期(可选)
5824
5872
  */
5825
5873
  async update(props) {
5826
- console.log("[MicroApp] update", props);
5874
+ console.info("[MicroApp] update", props);
5827
5875
  }
5828
5876
  };
5829
5877
  }