weapp-vite 7.4.0 → 7.5.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.
Files changed (92) hide show
  1. package/README.md +51 -1
  2. package/bin/bootstrap.js +14 -1
  3. package/dist/adapters-CcHrsYaj.mjs +1 -0
  4. package/dist/analyze-ZJUvEdaY.mjs +248 -0
  5. package/dist/auto-import-components/resolvers.mjs +1 -2
  6. package/dist/auto-import-presets/wevu-router.mjs +1 -2
  7. package/dist/auto-import-presets/wevu.mjs +1 -2
  8. package/dist/auto-routes.mjs +2 -1
  9. package/dist/budget-BD7VqLCl.d.mts +178 -0
  10. package/dist/chunkStrategy-DRA5WpB-.mjs +1436 -0
  11. package/dist/cli-acceptance.d.mts +1 -0
  12. package/dist/cli-acceptance.mjs +21 -0
  13. package/dist/cli.mjs +1420 -1554
  14. package/dist/compatibility.mjs +1 -2
  15. package/dist/{config-Dbvj5yK7.d.mts → config-V0L-IAJf.d.mts} +87 -30
  16. package/dist/config.d.mts +2 -2
  17. package/dist/config.mjs +1 -1
  18. package/dist/{constants-WOsG3Eqd.mjs → constants-DEZdcsMn.mjs} +1 -1
  19. package/dist/{createContext-UOEgeYnA.mjs → createCompilerContextInstance-DJH_P_nZ.mjs} +31278 -32148
  20. package/dist/createContext-BqYzHhY9.mjs +12 -0
  21. package/dist/dashboard/analyze.d.mts +48 -0
  22. package/dist/dashboard/analyze.mjs +1 -0
  23. package/dist/dashboard/vite.d.mts +1 -1
  24. package/dist/dashboard-DvqF3Key.mjs +1842 -0
  25. package/dist/dashboard.d.mts +3 -2
  26. package/dist/dashboard.mjs +1 -2
  27. package/dist/dashboardViteBridge-Dy3nAD4m.mjs +299 -0
  28. package/dist/dev-fR5GiJRO.mjs +63 -0
  29. package/dist/devProvider-BGBkw28J.mjs +1050 -0
  30. package/dist/docs/README.md +51 -1
  31. package/dist/docs/ai-workflows.md +4 -0
  32. package/dist/docs/doctor.md +38 -0
  33. package/dist/docs/getting-started.md +3 -1
  34. package/dist/docs/index.md +3 -1
  35. package/dist/docs/mcp.md +94 -1
  36. package/dist/docs/testing.md +29 -2
  37. package/dist/docs/troubleshooting.md +8 -0
  38. package/dist/docs/uni-app-component-libraries.md +8 -7
  39. package/dist/docs/upload.md +40 -3
  40. package/dist/docs/vite-plugin.md +171 -0
  41. package/dist/docs/vue-sfc.md +19 -0
  42. package/dist/docs/weapp-config.md +54 -0
  43. package/dist/docs/wevu-authoring.md +10 -0
  44. package/dist/doctor-worker.d.mts +1 -0
  45. package/dist/doctor-worker.mjs +59 -0
  46. package/dist/doctor.d.mts +144 -0
  47. package/dist/doctor.mjs +848 -0
  48. package/dist/eslint.mjs +1 -2
  49. package/dist/file-DRb4eWqw.mjs +1 -0
  50. package/dist/{file-giE9UMZa.mjs → file-sC3jD7Fh.mjs} +15 -9
  51. package/dist/files-BqxFIPRp.mjs +45 -0
  52. package/dist/getInstance-DiGSzBNI.mjs +28 -0
  53. package/dist/getInstance-SiE6WZRh.mjs +1 -0
  54. package/dist/index-C9HjUX5c.d.mts +741 -0
  55. package/dist/index.d.mts +10 -8
  56. package/dist/index.mjs +3 -2
  57. package/dist/json.d.mts +1 -1
  58. package/dist/json.mjs +1 -2
  59. package/dist/lifecycle-BROTlwSL.mjs +320 -0
  60. package/dist/loadConfig-C3BQhz7F.mjs +59 -0
  61. package/dist/loadConfig-VGtBF4qm.mjs +1 -0
  62. package/dist/logger-DGn5iEVN.mjs +1 -0
  63. package/dist/{mcp-BG6TliEg.mjs → mcp-Cj8Maqo6.mjs} +16 -7
  64. package/dist/mcp-D3Yh24Cj.mjs +529 -0
  65. package/dist/mcp.d.mts +6 -3
  66. package/dist/mcp.mjs +1 -2
  67. package/dist/package-7swhyLmf.mjs +91 -0
  68. package/dist/path-doV773b7.mjs +103 -0
  69. package/dist/{platform-DTWs5QRi.mjs → platform-CnkySBKz.mjs} +1 -1
  70. package/dist/processCleanup-B6KA30Zc.mjs +77 -0
  71. package/dist/protocol-vg8HGJ4n.mjs +138 -0
  72. package/dist/{resolvers-icNxkpcy.mjs → resolvers-Dod-euqX.mjs} +4 -1
  73. package/dist/resolvers.mjs +1 -2
  74. package/dist/runtime.mjs +1 -2
  75. package/dist/session-PskhD-nZ.mjs +390 -0
  76. package/dist/test.d.mts +1 -0
  77. package/dist/test.mjs +201 -44
  78. package/dist/types.d.mts +2 -2
  79. package/dist/{upload-D0RcEWrq.mjs → upload-D4msblBf.mjs} +174 -15
  80. package/dist/upload-worker.mjs +136 -3
  81. package/dist/utils-CJSCgEj6.mjs +1094 -0
  82. package/dist/vite.d.mts +9 -0
  83. package/dist/vite.mjs +270 -0
  84. package/dist/volar.d.mts +2 -2
  85. package/dist/web-apis.mjs +1 -2
  86. package/package.json +67 -41
  87. package/dist/adapters-BwnMMIZR.mjs +0 -2
  88. package/dist/dashboard-BzaVesmQ.mjs +0 -558
  89. package/dist/file-D19nbDoN.mjs +0 -2
  90. package/dist/getInstance-CYF1vl5l.mjs +0 -2
  91. package/dist/index-DbqVupg0.d.mts +0 -246
  92. package/dist/logger-mt4mSTqV.mjs +0 -2
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { f as Resolver } from "./index-CaXAtb9e.mjs";
2
2
  import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-C7fCmf92.mjs";
3
- import { $ as WeappCompilerHmrRequest, $n as NpmMainPackageConfig, $t as WeappSubPackageConfig, A as PluginOption, An as DeprecatedInlineDynamicImports, Ar as WeappWebConfig, At as ScanWxmlOptions, B as ViteDevServer, Bn as GenerateTemplateFileSource, Bt as WeappInjectRequestGlobalsTarget, Cn as Alias, Cr as WeappLibInternalDtsOptions, Ct as WeappViteConfig, D as InlineConfig, Dn as ChunksConfig, Dr as WeappManagedServerTsconfigConfig, Dt as EnhanceWxmlOptions, E as ConfigEnv, En as BuildNpmPackageMeta, Er as WeappManagedNodeTsconfigConfig, Et as EnhanceOptions, F as RolldownOutput, Fn as GenerateOptions, Ft as WeappAutoRoutesIncludePattern, G as Entry, Gn as JsonConfig, Gt as WeappNpmConfig, H as AppEntry, Hn as GenerateTemplateScope, Ht as WeappInjectWebRuntimeGlobalsConfig, I as RolldownPlugin, In as GenerateTemplate, It as WeappBuildScopeConfig, J as ComponentsMap, Jn as JsonMergeStage, Jt as WeappReactCompilerConfig, K as EntryJsonFragment, Kn as JsonMergeContext, Kt as WeappPreloadNetwork, L as RolldownPluginOption, Ln as GenerateTemplateContext, Lt as WeappBuildScopeObjectConfig, M as ResolvedConfig, Mn as GenerateExtensionsOptions, Mr as WeappViteHostMeta, Mt as WeappAppPreludeMode, N as RolldownBuild, Nn as GenerateFileType, Nt as WeappAutoRoutesConfig, O as MethodDefinitions, On as CopyGlobs, Or as WeappManagedSharedTsconfigConfig, Ot as HandleWxmlOptions, P as RolldownOptions, Pn as GenerateFilenamesOptions, Pt as WeappAutoRoutesInclude, Q as WeappCompilerHmrPreparation, Qn as NpmDependencyPattern, Qt as WeappRouteRules, R as RolldownWatchOptions, Rn as GenerateTemplateEntry, Rt as WeappHmrConfig, Sn as MultiPlatformProjectConfigs, Sr as WeappLibFileName, St as WeappUploadConfig, T as ComputedDefinitions, Tn as AlipayNpmMode, Tr as WeappManagedAppTsconfigConfig, Tt as AutoImportComponentsOption, U as BaseEntry, Un as GenerateTemplatesConfig, Ut as WeappInjectWebRuntimeGlobalsTarget, V as BindingErrorLike, Vn as GenerateTemplateInlineSource, Vr as WeappViteRuntime, Vt as WeappInjectWeapiConfig, W as ComponentEntry, Wn as JsFormat, Wt as WeappMcpConfig, X as WxmlDep, Xn as MpPlatform, Xt as WeappRequestRuntimeConfig, Y as ScanComponentItem, Yn as JsonMergeStrategy, Yt as WeappReactConfig, Z as WeappCompilerHmrAsset, Zn as NpmBuildOptions, Zt as WeappRouteRule, _n as WxmlTransformContext, _r as SubPackageStyleScope, _t as WeappAnalyzeHistoryConfig, an as WeappWorkerConfig, ar as SharedChunkDynamicImports, at as WeappCompilerPluginFactory, b as ChangeEvent, bn as WxmlTransformVisitor, br as WeappLibDtsOptions, bt as WeappForwardConsoleLogLevel, cn as WxmlValidate, cr as SharedChunkStrategy, ct as WeappCompilerResourceKind, dn as WxmlValidationVisitor, dr as StyleEntry, dt as WeappCompilerTransformResult, en as WeappUniAppConfig, er as NpmPackageFilesConfig, et as WeappCompilerOutputRequest, fn as WxmlAttribute, fr as StyleScope, ft as ProjectConfig, gn as WxmlTransform, gr as SubPackageStyleEntry, gt as WeappAnalyzeConfig, hn as WxmlSourceLocation, hr as SubPackageStyleConfigObject, ht as WeappAnalyzeBudgetConfig, in as WeappWevuConfig, ir as ResolvedAlias, it as WeappCompilerPluginController, j as Ref, jn as GenerateDirsOptions, jt as WeappAppPreludeConfig, k as Plugin, kn as CopyOptions, kr as WeappManagedTypeScriptConfig, kt as MultiPlatformConfig, ln as WxmlValidationContext, lr as StyleConfigEntry, lt as WeappCompilerSourceClaim, mn as WxmlElementInfo, mr as SubPackageStyleConfigEntry, mt as UserConfig, nn as WeappVueTemplateConfig, nr as NpmStrategy, nt as WeappCompilerPluginCapabilities, on as WxmlRemoveAttrRule, or as SharedChunkMode, ot as WeappCompilerPluginOption, pn as WxmlAttributeValue, pr as SubPackage, pt as SubPackageMetaValue, q as PageEntry, qn as JsonMergeFunction, qt as WeappPreloadRule, rn as WeappWebRuntimeConfig, rr as NpmSubPackageConfig, rt as WeappCompilerPluginContext, sn as WxmlRemoveOptions, sr as SharedChunkOverride, st as WeappCompilerPluginPhase, tn as WeappVueConfig, tr as NpmPluginPackageConfig, tt as WeappCompilerPlugin, un as WxmlValidationDiagnostic, ur as StyleConfigObject, ut as WeappCompilerSourceRequest, vn as WxmlTransformNode, vr as WeappLibComponentJson, vt as WeappDebugConfig, wn as AliasOptions, wr as WeappLibVueTscOptions, wt as AutoImportComponents, x as WeappVitePluginApi, xn as MultiPlatformProjectConfig, xr as WeappLibEntryContext, xt as WeappTailwindcssOptions, yn as WxmlTransformResult, yr as WeappLibConfig, yt as WeappForwardConsoleConfig, z as RolldownWatcher, zn as GenerateTemplateFactory, zt as WeappInjectRequestGlobalsConfig } from "./config-Dbvj5yK7.mjs";
3
+ import { $ as WeappCompilerHmrRequest, $n as NpmMainPackageConfig, $t as WeappSubPackageConfig, A as PluginOption, An as DeprecatedInlineDynamicImports, Ar as WeappWebConfig, At as ScanWxmlOptions, B as ViteDevServer, Bn as GenerateTemplateFileSource, Bt as WeappInjectRequestGlobalsTarget, Cn as Alias, Cr as WeappLibInternalDtsOptions, Ct as WeappViteConfig, D as InlineConfig, Dn as ChunksConfig, Dr as WeappManagedServerTsconfigConfig, Dt as EnhanceWxmlOptions, E as ConfigEnv, En as BuildNpmPackageMeta, Er as WeappManagedNodeTsconfigConfig, Et as EnhanceOptions, F as RolldownOutput, Fn as GenerateOptions, Ft as WeappAutoRoutesIncludePattern, G as Entry, Gn as JsonConfig, Gt as WeappNpmConfig, H as AppEntry, Hn as GenerateTemplateScope, Ht as WeappInjectWebRuntimeGlobalsConfig, I as RolldownPlugin, In as GenerateTemplate, It as WeappBuildScopeConfig, J as ComponentsMap, Jn as JsonMergeStage, Jt as WeappReactCompilerConfig, K as EntryJsonFragment, Kn as JsonMergeContext, Kt as WeappPreloadNetwork, L as RolldownPluginOption, Ln as GenerateTemplateContext, Lt as WeappBuildScopeObjectConfig, M as ResolvedConfig, Mn as GenerateExtensionsOptions, Mr as WeappViteHostMeta, Mt as WeappAppPreludeMode, N as RolldownBuild, Nn as GenerateFileType, Nt as WeappAutoRoutesConfig, O as MethodDefinitions, On as CopyGlobs, Or as WeappManagedSharedTsconfigConfig, Ot as HandleWxmlOptions, P as RolldownOptions, Pn as GenerateFilenamesOptions, Pt as WeappAutoRoutesInclude, Q as WeappCompilerHmrPreparation, Qn as NpmDependencyPattern, Qt as WeappRouteRules, R as RolldownWatchOptions, Rn as GenerateTemplateEntry, Rt as WeappHmrConfig, Sn as MultiPlatformProjectConfigs, Sr as WeappLibFileName, St as WeappUploadConfig, T as ComputedDefinitions, Tn as AlipayNpmMode, Tr as WeappManagedAppTsconfigConfig, Tt as AutoImportComponentsOption, U as BaseEntry, Un as GenerateTemplatesConfig, Ut as WeappInjectWebRuntimeGlobalsTarget, V as BindingErrorLike, Vn as GenerateTemplateInlineSource, Vr as WeappViteRuntime, Vt as WeappInjectWeapiConfig, W as ComponentEntry, Wn as JsFormat, Wt as WeappMcpConfig, X as WxmlDep, Xn as MpPlatform, Xt as WeappRequestRuntimeConfig, Y as ScanComponentItem, Yn as JsonMergeStrategy, Yt as WeappReactConfig, Z as WeappCompilerHmrAsset, Zn as NpmBuildOptions, Zt as WeappRouteRule, _n as WxmlTransformContext, _r as SubPackageStyleScope, _t as WeappAnalyzeHistoryConfig, an as WeappWorkerConfig, ar as SharedChunkDynamicImports, at as WeappCompilerPluginFactory, b as ChangeEvent, bn as WxmlTransformVisitor, br as WeappLibDtsOptions, bt as WeappForwardConsoleLogLevel, cn as WxmlValidate, cr as SharedChunkStrategy, ct as WeappCompilerResourceKind, dn as WxmlValidationVisitor, dr as StyleEntry, dt as WeappCompilerTransformResult, en as WeappUniAppConfig, er as NpmPackageFilesConfig, et as WeappCompilerOutputRequest, fn as WxmlAttribute, fr as StyleScope, ft as ProjectConfig, gn as WxmlTransform, gr as SubPackageStyleEntry, gt as WeappAnalyzeConfig, hn as WxmlSourceLocation, hr as SubPackageStyleConfigObject, ht as WeappAnalyzeBudgetConfig, in as WeappWevuConfig, ir as ResolvedAlias, it as WeappCompilerPluginController, j as Ref, jn as GenerateDirsOptions, jt as WeappAppPreludeConfig, k as Plugin, kn as CopyOptions, kr as WeappManagedTypeScriptConfig, kt as MultiPlatformConfig, ln as WxmlValidationContext, lr as StyleConfigEntry, lt as WeappCompilerSourceClaim, mn as WxmlElementInfo, mr as SubPackageStyleConfigEntry, mt as UserConfig, nn as WeappVueTemplateConfig, nr as NpmStrategy, nt as WeappCompilerPluginCapabilities, on as WxmlRemoveAttrRule, or as SharedChunkMode, ot as WeappCompilerPluginOption, pn as WxmlAttributeValue, pr as SubPackage, pt as SubPackageMetaValue, q as PageEntry, qn as JsonMergeFunction, qt as WeappPreloadRule, rn as WeappWebRuntimeConfig, rr as NpmSubPackageConfig, rt as WeappCompilerPluginContext, sn as WxmlRemoveOptions, sr as SharedChunkOverride, st as WeappCompilerPluginPhase, tn as WeappVueConfig, tr as NpmPluginPackageConfig, tt as WeappCompilerPlugin, un as WxmlValidationDiagnostic, ur as StyleConfigObject, ut as WeappCompilerSourceRequest, vn as WxmlTransformNode, vr as WeappLibComponentJson, vt as WeappDebugConfig, wn as AliasOptions, wr as WeappLibVueTscOptions, wt as AutoImportComponents, x as WeappVitePluginApi, xn as MultiPlatformProjectConfig, xr as WeappLibEntryContext, xt as WeappTailwindcssOptions, yn as WxmlTransformResult, yr as WeappLibConfig, yt as WeappForwardConsoleConfig, z as RolldownWatcher, zn as GenerateTemplateFactory, zt as WeappInjectRequestGlobalsConfig } from "./config-V0L-IAJf.mjs";
4
4
  import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
5
- export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, DeprecatedInlineDynamicImports, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, MultiPlatformProjectConfig, MultiPlatformProjectConfigs, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPackageFilesConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, StyleConfigEntry, StyleConfigObject, StyleEntry, StyleScope, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, type WeappCompilerHmrAsset, type WeappCompilerHmrPreparation, type WeappCompilerHmrRequest, WeappCompilerOutputRequest, WeappCompilerPlugin, WeappCompilerPluginCapabilities, WeappCompilerPluginContext, WeappCompilerPluginController, WeappCompilerPluginFactory, WeappCompilerPluginOption, WeappCompilerPluginPhase, WeappCompilerResourceKind, WeappCompilerSourceClaim, WeappCompilerSourceRequest, WeappCompilerTransformResult, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, type WeappI18nConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappPreloadNetwork, WeappPreloadRule, WeappReactCompilerConfig, WeappReactConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappTailwindcssOptions, WeappUniAppConfig, WeappUploadConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlAttribute, WxmlAttributeValue, WxmlDep, WxmlElementInfo, WxmlRemoveAttrRule, WxmlRemoveOptions, WxmlSourceLocation, WxmlTransform, WxmlTransformContext, WxmlTransformNode, WxmlTransformResult, WxmlTransformVisitor, WxmlValidate, WxmlValidationContext, WxmlValidationDiagnostic, WxmlValidationVisitor };
5
+ export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, DeprecatedInlineDynamicImports, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, type JsonConfig, type JsonMergeContext, type JsonMergeFunction, type JsonMergeStage, type JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, MultiPlatformProjectConfig, MultiPlatformProjectConfigs, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPackageFilesConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, StyleConfigEntry, StyleConfigObject, StyleEntry, StyleScope, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, type WeappCompilerHmrAsset, type WeappCompilerHmrPreparation, type WeappCompilerHmrRequest, WeappCompilerOutputRequest, WeappCompilerPlugin, WeappCompilerPluginCapabilities, WeappCompilerPluginContext, WeappCompilerPluginController, WeappCompilerPluginFactory, WeappCompilerPluginOption, WeappCompilerPluginPhase, WeappCompilerResourceKind, WeappCompilerSourceClaim, WeappCompilerSourceRequest, WeappCompilerTransformResult, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, type WeappI18nConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappPreloadNetwork, WeappPreloadRule, WeappReactCompilerConfig, WeappReactConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappTailwindcssOptions, WeappUniAppConfig, WeappUploadConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlAttribute, WxmlAttributeValue, WxmlDep, WxmlElementInfo, WxmlRemoveAttrRule, WxmlRemoveOptions, WxmlSourceLocation, WxmlTransform, WxmlTransformContext, WxmlTransformNode, WxmlTransformResult, WxmlTransformVisitor, WxmlValidate, WxmlValidationContext, WxmlValidationDiagnostic, WxmlValidationVisitor };
@@ -1,12 +1,121 @@
1
- import { m as resolveMiniPlatform } from "./platform-DTWs5QRi.mjs";
2
- import { r as logger_default } from "./logger-mt4mSTqV.mjs";
1
+ import { m as resolveMiniPlatform } from "./platform-CnkySBKz.mjs";
2
+ import { r as logger_default } from "./logger-DGn5iEVN.mjs";
3
3
  import { createRequire } from "node:module";
4
+ import process from "node:process";
4
5
  import { pathToFileURL } from "node:url";
5
6
  import path from "node:path";
6
- import process from "node:process";
7
7
  import { mkdir, readFile, stat } from "node:fs/promises";
8
8
  import { getPackageInfo } from "local-pkg";
9
- import { execFile } from "node:child_process";
9
+ import { execFile, execFileSync } from "node:child_process";
10
+ //#region src/cli/upload/processTree.ts
11
+ function childPids(pid, lifetime) {
12
+ if (process.platform === "win32") {
13
+ const since = lifetime ? `[DateTimeOffset]::FromUnixTimeMilliseconds(${lifetime.start}).UtcDateTime` : `(Get-CimInstance Win32_Process -Filter 'ProcessId = ${pid}').CreationDate.ToUniversalTime()`;
14
+ const until = lifetime ? `[DateTimeOffset]::FromUnixTimeMilliseconds(${lifetime.end}).UtcDateTime` : "[DateTime]::UtcNow";
15
+ return execFileSync("powershell.exe", [
16
+ "-NoProfile",
17
+ "-NonInteractive",
18
+ "-Command",
19
+ `$ErrorActionPreference = 'Stop'; $since = ${since}; $until = ${until}; Get-CimInstance Win32_Process -Filter 'ParentProcessId = ${pid}' | Where-Object { \$_.CreationDate.ToUniversalTime() -ge \$since -and \$_.CreationDate.ToUniversalTime() -le \$until } | Select-Object -ExpandProperty ProcessId`
20
+ ], {
21
+ encoding: "utf8",
22
+ windowsHide: true,
23
+ timeout: 3e4,
24
+ stdio: [
25
+ "ignore",
26
+ "pipe",
27
+ "ignore"
28
+ ]
29
+ }).split(/\s+/).map(Number).filter((value) => Number.isSafeInteger(value) && value > 0);
30
+ }
31
+ const output = execFileSync("ps", [
32
+ "-A",
33
+ "-o",
34
+ "pid=,ppid="
35
+ ], {
36
+ encoding: "utf8",
37
+ timeout: 5e3,
38
+ stdio: [
39
+ "ignore",
40
+ "pipe",
41
+ "ignore"
42
+ ]
43
+ });
44
+ const children = /* @__PURE__ */ new Map();
45
+ for (const line of output.trim().split(/\r?\n/)) {
46
+ const [child, parent] = line.trim().split(/\s+/).map(Number);
47
+ if (child && parent) {
48
+ const siblings = children.get(parent) ?? [];
49
+ siblings.push(child);
50
+ children.set(parent, siblings);
51
+ }
52
+ }
53
+ const descendants = [];
54
+ const visit = (parent) => {
55
+ for (const child of children.get(parent) ?? []) {
56
+ visit(child);
57
+ descendants.push(child);
58
+ }
59
+ };
60
+ visit(pid);
61
+ return descendants;
62
+ }
63
+ function killPid(pid) {
64
+ try {
65
+ process.kill(pid, "SIGKILL");
66
+ } catch (error) {
67
+ if (error.code !== "ESRCH") throw error;
68
+ }
69
+ }
70
+ /** POSIX 使用独立进程组;已退出的根进程不再授权向其正 PID 发信号。 */
71
+ function terminateUploadProcess(pid, options) {
72
+ if (process.platform === "win32") {
73
+ if (options?.exited) {
74
+ if (!options.lifetime) throw new Error("缺少已退出进程的生命周期,无法确认子进程归属。");
75
+ for (const child of childPids(pid, options.lifetime)) terminateUploadProcess(child);
76
+ return;
77
+ }
78
+ try {
79
+ execFileSync("taskkill", [
80
+ "/PID",
81
+ String(pid),
82
+ "/T",
83
+ "/F"
84
+ ], {
85
+ windowsHide: true,
86
+ timeout: 5e3,
87
+ stdio: "ignore"
88
+ });
89
+ } catch (error) {
90
+ try {
91
+ process.kill(pid, 0);
92
+ } catch (probeError) {
93
+ if (probeError.code === "ESRCH") {
94
+ if (!options?.lifetime) throw new Error("根进程已消失,无法确认子进程归属。");
95
+ for (const child of childPids(pid, options.lifetime)) terminateUploadProcess(child);
96
+ return;
97
+ }
98
+ }
99
+ throw error;
100
+ }
101
+ return;
102
+ }
103
+ if (options?.processGroup) {
104
+ try {
105
+ process.kill(-pid, "SIGKILL");
106
+ } catch (error) {
107
+ if (error.code !== "ESRCH") throw error;
108
+ if (!options.exited) killPid(pid);
109
+ }
110
+ return;
111
+ }
112
+ if (!options?.exited) killPid(pid);
113
+ }
114
+ /** 只终止当前 worker 所属的本地子进程,不推断远端任务状态。 */
115
+ function terminateUploadDescendants(pid) {
116
+ for (const child of childPids(pid)) terminateUploadProcess(child);
117
+ }
118
+ //#endregion
10
119
  //#region src/cli/upload/tools.ts
11
120
  function requireUploadEnv(context, name) {
12
121
  const value = context.env[name]?.trim();
@@ -56,7 +165,14 @@ async function runUploadCli(context, packageName, binName, args, secrets, captur
56
165
  resolve(stdout);
57
166
  });
58
167
  function cancel() {
59
- child.kill("SIGKILL");
168
+ if (child.pid) try {
169
+ if (process.platform !== "win32") terminateUploadDescendants(child.pid);
170
+ terminateUploadProcess(child.pid);
171
+ } catch {
172
+ child.kill("SIGKILL");
173
+ process.stderr.write("无法确认上传 CLI 子进程已全部终止。\n");
174
+ process.exitCode = 1;
175
+ }
60
176
  }
61
177
  process.once("exit", cancel);
62
178
  child.once("close", () => process.off("exit", cancel));
@@ -97,7 +213,7 @@ async function prepareAlipayUpload(context, action = "upload") {
97
213
  if (!alipay || typeof alipay !== "object" || !("authentication" in alipay) || !alipay.authentication) throw new Error("支付宝身份密钥文件缺少 alipay.authentication。请从开放平台重新获取身份密钥。");
98
214
  return {
99
215
  secrets,
100
- async run() {
216
+ async run(onProgress) {
101
217
  const sdk = await loadUploadPackage("minidev", context.cwd);
102
218
  if (action === "preview") {
103
219
  const result = await sdk.minidev.preview({
@@ -118,7 +234,20 @@ async function prepareAlipayUpload(context, action = "upload") {
118
234
  version: context.version,
119
235
  versionDescription: context.desc,
120
236
  experience: false
121
- });
237
+ }, onProgress ? {
238
+ onLog: (message) => onProgress({
239
+ type: "log",
240
+ message: redactUploadSecrets(message, secrets)
241
+ }),
242
+ onTaskCreated: (taskId) => onProgress({
243
+ type: "task-created",
244
+ message: redactUploadSecrets(taskId, secrets)
245
+ }),
246
+ onVersionCreated: (version) => onProgress({
247
+ type: "version-created",
248
+ message: redactUploadSecrets(version, secrets)
249
+ })
250
+ } : void 0);
122
251
  }
123
252
  };
124
253
  }
@@ -264,7 +393,13 @@ async function prepareSwanUpload(context, action = "upload") {
264
393
  if (typeof previewUrl !== "string" || !previewUrl.trim()) throw new Error("百度预览未返回有效的预览链接。");
265
394
  return { previewUrl: previewUrl.trim() };
266
395
  }
267
- return runUploadCli(context, "swan-toolkit", "swan", [
396
+ const output = await runUploadCli({
397
+ ...context,
398
+ env: {
399
+ ...context.env,
400
+ IS_NODE_JS: "true"
401
+ }
402
+ }, "swan-toolkit", "swan", [
268
403
  "upload",
269
404
  "--project-path",
270
405
  context.projectPath,
@@ -277,7 +412,14 @@ async function prepareSwanUpload(context, action = "upload") {
277
412
  "--desc",
278
413
  context.desc,
279
414
  "--json"
280
- ], secrets);
415
+ ], secrets, true);
416
+ try {
417
+ const marker = /^NODE_JS_ENV_RESULT:/m.exec(output);
418
+ if (!marker) throw new Error("缺少官方 JSON 结果标记。");
419
+ return JSON.parse(output.slice(marker.index + marker[0].length));
420
+ } catch {
421
+ throw new Error("百度上传未返回有效的 JSON 结果。");
422
+ }
281
423
  }
282
424
  };
283
425
  }
@@ -301,9 +443,10 @@ async function prepareWechatUpload(context, action = "upload") {
301
443
  throw new Error("无法读取 WEAPP_CI_PRIVATE_KEY_PATH 指定的私钥文件;相对路径以项目根目录为基准。");
302
444
  }
303
445
  if (!privateKey.trim()) throw new Error("WEAPP_CI_PRIVATE_KEY_PATH 指定的私钥文件不能为空。");
446
+ const secrets = [privateKey, privateKey.trim()];
304
447
  return {
305
- secrets: [privateKey, privateKey.trim()],
306
- async run() {
448
+ secrets,
449
+ async run(onProgress) {
307
450
  const ci = await loadUploadPackage("miniprogram-ci", context.cwd);
308
451
  const project = new ci.Project({
309
452
  appid,
@@ -333,7 +476,13 @@ async function prepareWechatUpload(context, action = "upload") {
333
476
  version: context.version,
334
477
  desc: context.desc,
335
478
  robot,
336
- setting: { useProjectConfig: true }
479
+ setting: { useProjectConfig: true },
480
+ onProgressUpdate: onProgress ? (task) => {
481
+ onProgress({
482
+ type: "progress",
483
+ message: redactUploadSecrets(typeof task === "string" ? task : `${task.status}: ${task.message}`, secrets)
484
+ });
485
+ } : void 0
337
486
  });
338
487
  }
339
488
  };
@@ -348,7 +497,7 @@ async function prepareXhsUpload(context, action = "upload") {
348
497
  if (JSON.parse(await readFile(path.join(context.projectPath, "project.config.json"), "utf8"))?.appid !== appid) throw new Error("小红书 project.config.json 的 appid 必须与 XHS_APP_ID 或项目配置的 AppID 一致,禁止向其他小程序上传。");
349
498
  return {
350
499
  secrets: [token],
351
- async run() {
500
+ async run(onProgress) {
352
501
  const { CI } = await loadUploadPackage("xhs-mp-cli/dist/ci.js", context.cwd);
353
502
  const sdk = new CI();
354
503
  sdk.core.login = async () => {
@@ -370,7 +519,17 @@ async function prepareXhsUpload(context, action = "upload") {
370
519
  project: { projectPath: context.projectPath },
371
520
  version: context.version,
372
521
  desc: context.desc,
373
- verbose: false
522
+ verbose: false,
523
+ progressCallback: onProgress ? (progress) => {
524
+ if (progress === -1) onProgress({
525
+ type: "log",
526
+ message: "小红书 SDK 报告上传失败。"
527
+ });
528
+ else if (Number.isFinite(progress) && progress >= 0 && progress <= 100) onProgress({
529
+ type: "progress",
530
+ percent: progress
531
+ });
532
+ } : void 0
374
533
  });
375
534
  }
376
535
  };
@@ -400,4 +559,4 @@ function prepareUpload(platform, context, action = "upload") {
400
559
  return providers[platform](context, action);
401
560
  }
402
561
  //#endregion
403
- export { resolveUploadPlatforms as n, redactUploadSecrets as r, prepareUpload as t };
562
+ export { terminateUploadProcess as a, terminateUploadDescendants as i, resolveUploadPlatforms as n, redactUploadSecrets as r, prepareUpload as t };
@@ -1,20 +1,153 @@
1
- import { t as prepareUpload } from "./upload-D0RcEWrq.mjs";
1
+ import { i as terminateUploadDescendants, r as redactUploadSecrets, t as prepareUpload } from "./upload-D4msblBf.mjs";
2
2
  import process from "node:process";
3
+ //#region src/cli/upload/uploadResult.ts
4
+ function record(value) {
5
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
6
+ }
7
+ function text(value, secrets) {
8
+ if (typeof value !== "string" || !value.trim() || value.includes("\0")) return;
9
+ return redactUploadSecrets(value.trim(), secrets);
10
+ }
11
+ function bytes(value) {
12
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
13
+ }
14
+ function link(value, secrets, scheme = false) {
15
+ if (typeof value !== "string" || !value.trim() || /[\s\p{Cc}]/u.test(value.trim())) return;
16
+ try {
17
+ const url = new URL(value);
18
+ if (!(scheme ? [
19
+ "http:",
20
+ "https:",
21
+ "baiduboxapp:",
22
+ "swan:"
23
+ ] : ["http:", "https:"]).includes(url.protocol) || url.username || url.password) return;
24
+ return text(value, secrets);
25
+ } catch {
26
+ return;
27
+ }
28
+ }
29
+ function base64(value, secrets) {
30
+ if (typeof value !== "string") return;
31
+ const source = value.trim();
32
+ const content = source.replace(/^data:image\/(?:png|jpe?g|gif|webp);base64,/i, "");
33
+ if (!content || !/^(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(content)) return;
34
+ return text(source, secrets);
35
+ }
36
+ /** 按官方上传结果选择字段;可选信息无效时丢弃,不把已完成上传改判失败。 */
37
+ function normalizeUploadResult(platform, value, secrets) {
38
+ const input = record(value);
39
+ const result = {};
40
+ if (!input) return result;
41
+ if (platform === "weapp") {
42
+ if (Array.isArray(input.subPackageInfo)) result.subPackages = input.subPackageInfo.flatMap((value) => {
43
+ const item = record(value);
44
+ const name = text(item?.name, secrets);
45
+ const size = bytes(item?.size);
46
+ return name !== void 0 && size !== void 0 ? [{
47
+ name,
48
+ size
49
+ }] : [];
50
+ });
51
+ if (Array.isArray(input.pluginInfo)) result.plugins = input.pluginInfo.flatMap((value) => {
52
+ const item = record(value);
53
+ const appid = text(item?.pluginProviderAppid, secrets);
54
+ const version = text(item?.version, secrets);
55
+ const size = bytes(item?.size);
56
+ return appid !== void 0 && version !== void 0 && size !== void 0 ? [{
57
+ appid,
58
+ version,
59
+ size
60
+ }] : [];
61
+ });
62
+ } else if (platform === "alipay") {
63
+ const sdkVersion = text(input.version, secrets);
64
+ const qrCodeUrl = link(input.experienceQrCodeUrl, secrets);
65
+ if (sdkVersion !== void 0) result.sdkVersion = sdkVersion;
66
+ if (qrCodeUrl !== void 0) result.qrCodeUrl = qrCodeUrl;
67
+ } else if (platform === "tt") {
68
+ const previewUrl = link(input.shortUrl, secrets);
69
+ const qrCodeFile = text(input.qrcodeFilePath, secrets);
70
+ if (previewUrl !== void 0) result.previewUrl = previewUrl;
71
+ if (qrCodeFile !== void 0) result.qrCodeFile = qrCodeFile;
72
+ } else if (platform === "jd") {
73
+ const qrCodeUrl = link(input.imgUrl, secrets);
74
+ const qrCodeBase64 = base64(input.base64Data, secrets);
75
+ if (qrCodeUrl !== void 0) result.qrCodeUrl = qrCodeUrl;
76
+ if (qrCodeBase64 !== void 0) result.qrCodeBase64 = qrCodeBase64;
77
+ } else if (platform === "swan") {
78
+ const previewUrl = link(input.schemeUrlOpti, secrets, true) ?? link(input.schemeUrl, secrets, true);
79
+ const fileSize = bytes(input.fileSize);
80
+ if (previewUrl !== void 0) result.previewUrl = previewUrl;
81
+ if (fileSize !== void 0) result.fileSize = fileSize;
82
+ if (Array.isArray(input.warningList)) result.warnings = input.warningList.flatMap((value) => {
83
+ const warning = text(value, secrets);
84
+ return warning === void 0 ? [] : [warning];
85
+ });
86
+ }
87
+ return result;
88
+ }
89
+ //#endregion
3
90
  //#region src/cli/upload/worker.ts
4
91
  process.once("disconnect", () => process.exit(1));
5
92
  process.once("SIGINT", () => process.exit(1));
6
93
  process.once("SIGTERM", () => process.exit(1));
94
+ process.once("exit", () => {
95
+ try {
96
+ terminateUploadDescendants(process.pid);
97
+ } catch {
98
+ process.stderr.write("无法确认本地 SDK 子进程已全部终止。\n");
99
+ process.exitCode = 1;
100
+ }
101
+ });
7
102
  try {
8
103
  let input = "";
9
104
  for await (const chunk of process.stdin) input += String(chunk);
10
105
  const { platform, context, action } = JSON.parse(input);
11
106
  if (action !== "upload" && action !== "preview") throw new Error("不支持的上传或预览操作。");
12
- const result = await (await prepareUpload(platform, context, action)).run();
107
+ const upload = await prepareUpload(platform, context, action);
108
+ await new Promise((resolve, reject) => {
109
+ const onMessage = (message) => {
110
+ if (message && typeof message === "object" && "type" in message && message.type === "run" && "action" in message && message.action === action) {
111
+ process.off("message", onMessage);
112
+ resolve();
113
+ }
114
+ };
115
+ if (!process.send) {
116
+ reject(/* @__PURE__ */ new Error("上传 worker 缺少父进程 IPC 通道。"));
117
+ return;
118
+ }
119
+ process.on("message", onMessage);
120
+ process.send({
121
+ type: "started",
122
+ action
123
+ }, (error) => {
124
+ if (error) {
125
+ process.off("message", onMessage);
126
+ reject(error);
127
+ }
128
+ });
129
+ });
130
+ const onProgress = (event) => {
131
+ const safeEvent = {
132
+ type: event.type,
133
+ ...typeof event.message === "string" ? { message: redactUploadSecrets(event.message, upload.secrets) } : {},
134
+ ...typeof event.percent === "number" && Number.isFinite(event.percent) ? { percent: event.percent } : {}
135
+ };
136
+ process.send?.({
137
+ type: "progress",
138
+ action,
139
+ event: safeEvent
140
+ }, (error) => {
141
+ if (error) process.exit(1);
142
+ });
143
+ };
144
+ const rawResult = await upload.run(onProgress);
145
+ const result = action === "upload" ? normalizeUploadResult(platform, rawResult, upload.secrets) : rawResult;
13
146
  const finish = () => process.stderr.write("", () => process.stdout.write("", () => process.exit(0)));
14
147
  if (process.send) process.send({
15
148
  type: "completed",
16
149
  action,
17
- result: action === "preview" ? result : void 0
150
+ result
18
151
  }, (error) => {
19
152
  if (error) process.exit(1);
20
153
  finish();