@ohos-ports/rsbuild-core 1.7.2-beta.1

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 (279) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/rsbuild.js +20 -0
  4. package/compiled/@jridgewell/remapping/index.d.ts +1 -0
  5. package/compiled/@jridgewell/remapping/index.js +1222 -0
  6. package/compiled/@jridgewell/remapping/license +19 -0
  7. package/compiled/@jridgewell/remapping/package.json +1 -0
  8. package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
  9. package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
  10. package/compiled/@jridgewell/trace-mapping/license +19 -0
  11. package/compiled/@jridgewell/trace-mapping/package.json +1 -0
  12. package/compiled/chokidar/index.d.ts +384 -0
  13. package/compiled/chokidar/index.js +1793 -0
  14. package/compiled/chokidar/license +21 -0
  15. package/compiled/chokidar/package.json +1 -0
  16. package/compiled/connect/index.d.ts +90 -0
  17. package/compiled/connect/index.js +1240 -0
  18. package/compiled/connect/license +25 -0
  19. package/compiled/connect/package.json +1 -0
  20. package/compiled/cors/index.d.ts +56 -0
  21. package/compiled/cors/index.js +371 -0
  22. package/compiled/cors/license +22 -0
  23. package/compiled/cors/package.json +1 -0
  24. package/compiled/css-loader/api.js +85 -0
  25. package/compiled/css-loader/getUrl.js +26 -0
  26. package/compiled/css-loader/index.d.ts +1 -0
  27. package/compiled/css-loader/index.js +2 -0
  28. package/compiled/css-loader/license +20 -0
  29. package/compiled/css-loader/noSourceMaps.js +5 -0
  30. package/compiled/css-loader/package.json +1 -0
  31. package/compiled/css-loader/sourceMaps.js +16 -0
  32. package/compiled/html-rspack-plugin/default_index.ejs +9 -0
  33. package/compiled/html-rspack-plugin/index.d.ts +290 -0
  34. package/compiled/html-rspack-plugin/index.js +1602 -0
  35. package/compiled/html-rspack-plugin/license +20 -0
  36. package/compiled/html-rspack-plugin/loader.js +166 -0
  37. package/compiled/html-rspack-plugin/package.json +1 -0
  38. package/compiled/http-proxy-middleware/index.d.ts +319 -0
  39. package/compiled/http-proxy-middleware/index.js +5284 -0
  40. package/compiled/http-proxy-middleware/license +22 -0
  41. package/compiled/http-proxy-middleware/package.json +1 -0
  42. package/compiled/launch-editor-middleware/index.d.ts +1 -0
  43. package/compiled/launch-editor-middleware/index.js +719 -0
  44. package/compiled/launch-editor-middleware/license +21 -0
  45. package/compiled/launch-editor-middleware/package.json +1 -0
  46. package/compiled/memfs/index.d.ts +1462 -0
  47. package/compiled/memfs/index.js +1 -0
  48. package/compiled/memfs/license +201 -0
  49. package/compiled/memfs/package.json +1 -0
  50. package/compiled/mrmime/index.d.ts +4 -0
  51. package/compiled/mrmime/index.js +456 -0
  52. package/compiled/mrmime/package.json +1 -0
  53. package/compiled/picocolors/index.d.ts +55 -0
  54. package/compiled/picocolors/index.js +108 -0
  55. package/compiled/picocolors/license +15 -0
  56. package/compiled/picocolors/package.json +1 -0
  57. package/compiled/postcss/index.js +1 -0
  58. package/compiled/postcss/lib/at-rule.d.ts +140 -0
  59. package/compiled/postcss/lib/comment.d.ts +68 -0
  60. package/compiled/postcss/lib/container.d.ts +483 -0
  61. package/compiled/postcss/lib/css-syntax-error.d.ts +248 -0
  62. package/compiled/postcss/lib/declaration.d.ts +151 -0
  63. package/compiled/postcss/lib/document.d.ts +69 -0
  64. package/compiled/postcss/lib/fromJSON.d.ts +9 -0
  65. package/compiled/postcss/lib/input.d.ts +227 -0
  66. package/compiled/postcss/lib/lazy-result.d.ts +190 -0
  67. package/compiled/postcss/lib/list.d.ts +60 -0
  68. package/compiled/postcss/lib/no-work-result.d.ts +46 -0
  69. package/compiled/postcss/lib/node.d.ts +556 -0
  70. package/compiled/postcss/lib/parse.d.ts +9 -0
  71. package/compiled/postcss/lib/postcss.d.ts +458 -0
  72. package/compiled/postcss/lib/previous-map.d.ts +81 -0
  73. package/compiled/postcss/lib/processor.d.ts +115 -0
  74. package/compiled/postcss/lib/result.d.ts +205 -0
  75. package/compiled/postcss/lib/root.d.ts +87 -0
  76. package/compiled/postcss/lib/rule.d.ts +126 -0
  77. package/compiled/postcss/lib/source-map-js.d.ts +4 -0
  78. package/compiled/postcss/lib/stringifier.d.ts +46 -0
  79. package/compiled/postcss/lib/stringify.d.ts +9 -0
  80. package/compiled/postcss/lib/warning.d.ts +147 -0
  81. package/compiled/postcss/license +20 -0
  82. package/compiled/postcss/package.json +1 -0
  83. package/compiled/postcss-loader/index.d.ts +1 -0
  84. package/compiled/postcss-loader/index.js +720 -0
  85. package/compiled/postcss-loader/license +20 -0
  86. package/compiled/postcss-loader/package.json +1 -0
  87. package/compiled/rslog/index.d.ts +67 -0
  88. package/compiled/rslog/license +21 -0
  89. package/compiled/rslog/package.json +1 -0
  90. package/compiled/rspack-chain/license +22 -0
  91. package/compiled/rspack-chain/package.json +1 -0
  92. package/compiled/rspack-chain/types/index.d.ts +545 -0
  93. package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
  94. package/compiled/rspack-manifest-plugin/index.js +409 -0
  95. package/compiled/rspack-manifest-plugin/license +21 -0
  96. package/compiled/rspack-manifest-plugin/package.json +1 -0
  97. package/compiled/sirv/index.d.ts +1 -0
  98. package/compiled/sirv/index.js +274 -0
  99. package/compiled/sirv/package.json +1 -0
  100. package/compiled/style-loader/index.d.ts +1 -0
  101. package/compiled/style-loader/index.js +427 -0
  102. package/compiled/style-loader/license +20 -0
  103. package/compiled/style-loader/package.json +1 -0
  104. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  105. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  106. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  107. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  108. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  109. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  110. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  111. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  112. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  113. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  114. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  115. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  116. package/compiled/tinyglobby/index.d.ts +46 -0
  117. package/compiled/tinyglobby/index.js +2664 -0
  118. package/compiled/tinyglobby/license +21 -0
  119. package/compiled/tinyglobby/package.json +1 -0
  120. package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
  121. package/compiled/webpack-bundle-analyzer/index.js +23 -0
  122. package/compiled/webpack-bundle-analyzer/license +20 -0
  123. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  124. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  125. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  126. package/compiled/webpack-merge/index.d.ts +31 -0
  127. package/compiled/webpack-merge/index.js +1200 -0
  128. package/compiled/webpack-merge/license +20 -0
  129. package/compiled/webpack-merge/package.json +1 -0
  130. package/compiled/ws/index.d.ts +437 -0
  131. package/compiled/ws/index.js +3161 -0
  132. package/compiled/ws/license +20 -0
  133. package/compiled/ws/package.json +1 -0
  134. package/dist/0~open.js +427 -0
  135. package/dist/0~range-parser.js +49 -0
  136. package/dist/0~range-parser.js.LICENSE.txt +6 -0
  137. package/dist/131.js +9305 -0
  138. package/dist/131.js.LICENSE.txt +26 -0
  139. package/dist/136.mjs +42 -0
  140. package/dist/2~open.cjs +436 -0
  141. package/dist/2~range-parser.cjs +52 -0
  142. package/dist/2~range-parser.cjs.LICENSE.txt +6 -0
  143. package/dist/client/59.js +22 -0
  144. package/dist/client/hmr.js +206 -0
  145. package/dist/client/overlay.js +203 -0
  146. package/dist/ignoreCssLoader.mjs +3 -0
  147. package/dist/index.cjs +9456 -0
  148. package/dist/index.cjs.LICENSE.txt +26 -0
  149. package/dist/index.js +1 -0
  150. package/dist/rslib-runtime.js +44 -0
  151. package/dist/transformLoader.mjs +1 -0
  152. package/dist/transformRawLoader.mjs +4 -0
  153. package/dist-types/cli/commands.d.ts +28 -0
  154. package/dist-types/cli/index.d.ts +1 -0
  155. package/dist-types/cli/init.d.ts +7 -0
  156. package/dist-types/client/hmr.d.ts +3 -0
  157. package/dist-types/client/log.d.ts +13 -0
  158. package/dist-types/client/overlay.d.ts +1 -0
  159. package/dist-types/configChain.d.ts +154 -0
  160. package/dist-types/constants.d.ts +52 -0
  161. package/dist-types/createContext.d.ts +11 -0
  162. package/dist-types/createRsbuild.d.ts +5 -0
  163. package/dist-types/defaultConfig.d.ts +25 -0
  164. package/dist-types/helpers/compiler.d.ts +5 -0
  165. package/dist-types/helpers/exitHook.d.ts +3 -0
  166. package/dist-types/helpers/format.d.ts +2 -0
  167. package/dist-types/helpers/fs.d.ts +17 -0
  168. package/dist-types/helpers/index.d.ts +29 -0
  169. package/dist-types/helpers/path.d.ts +26 -0
  170. package/dist-types/helpers/stats.d.ts +18 -0
  171. package/dist-types/helpers/url.d.ts +11 -0
  172. package/dist-types/helpers/vendors.d.ts +29 -0
  173. package/dist-types/helpers/version.d.ts +7 -0
  174. package/dist-types/hooks.d.ts +44 -0
  175. package/dist-types/index.d.ts +22 -0
  176. package/dist-types/initPlugins.d.ts +6 -0
  177. package/dist-types/inspectConfig.d.ts +35 -0
  178. package/dist-types/loadConfig.d.ts +60 -0
  179. package/dist-types/loadEnv.d.ts +63 -0
  180. package/dist-types/loader/ignoreCssLoader.d.ts +3 -0
  181. package/dist-types/loader/transformLoader.d.ts +8 -0
  182. package/dist-types/loader/transformRawLoader.d.ts +3 -0
  183. package/dist-types/logger.d.ts +19 -0
  184. package/dist-types/mergeConfig.d.ts +2 -0
  185. package/dist-types/package.json +1 -0
  186. package/dist-types/pluginHelper.d.ts +12 -0
  187. package/dist-types/pluginManager.d.ts +21 -0
  188. package/dist-types/plugins/appIcon.d.ts +2 -0
  189. package/dist-types/plugins/asset.d.ts +3 -0
  190. package/dist-types/plugins/basic.d.ts +5 -0
  191. package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
  192. package/dist-types/plugins/cache.d.ts +2 -0
  193. package/dist-types/plugins/cleanOutput.d.ts +2 -0
  194. package/dist-types/plugins/css.d.ts +4 -0
  195. package/dist-types/plugins/define.d.ts +2 -0
  196. package/dist-types/plugins/entry.d.ts +2 -0
  197. package/dist-types/plugins/esm.d.ts +2 -0
  198. package/dist-types/plugins/externals.d.ts +2 -0
  199. package/dist-types/plugins/fileSize.d.ts +6 -0
  200. package/dist-types/plugins/html.d.ts +9 -0
  201. package/dist-types/plugins/inlineChunk.d.ts +6 -0
  202. package/dist-types/plugins/lazyCompilation.d.ts +2 -0
  203. package/dist-types/plugins/manifest.d.ts +2 -0
  204. package/dist-types/plugins/minimize.d.ts +10 -0
  205. package/dist-types/plugins/moduleFederation.d.ts +2 -0
  206. package/dist-types/plugins/moment.d.ts +2 -0
  207. package/dist-types/plugins/nodeAddons.d.ts +2 -0
  208. package/dist-types/plugins/nonce.d.ts +2 -0
  209. package/dist-types/plugins/output.d.ts +2 -0
  210. package/dist-types/plugins/performance.d.ts +5 -0
  211. package/dist-types/plugins/progress.d.ts +2 -0
  212. package/dist-types/plugins/resolve.d.ts +2 -0
  213. package/dist-types/plugins/resourceHints.d.ts +2 -0
  214. package/dist-types/plugins/rsdoctor.d.ts +2 -0
  215. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  216. package/dist-types/plugins/server.d.ts +2 -0
  217. package/dist-types/plugins/sourceMap.d.ts +2 -0
  218. package/dist-types/plugins/splitChunks.d.ts +4 -0
  219. package/dist-types/plugins/sri.d.ts +2 -0
  220. package/dist-types/plugins/swc.d.ts +5 -0
  221. package/dist-types/plugins/target.d.ts +2 -0
  222. package/dist-types/plugins/wasm.d.ts +2 -0
  223. package/dist-types/provider/build.d.ts +4 -0
  224. package/dist-types/provider/createCompiler.d.ts +6 -0
  225. package/dist-types/provider/helpers.d.ts +12 -0
  226. package/dist-types/provider/initConfigs.d.ts +19 -0
  227. package/dist-types/provider/provider.d.ts +2 -0
  228. package/dist-types/provider/rspackConfig.d.ts +8 -0
  229. package/dist-types/restart.d.ts +18 -0
  230. package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +38 -0
  231. package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +32 -0
  232. package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +28 -0
  233. package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +23 -0
  234. package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +22 -0
  235. package/dist-types/rspack.d.ts +2 -0
  236. package/dist-types/server/ansiHTML.d.ts +4 -0
  237. package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +12 -0
  238. package/dist-types/server/assets-middleware/index.d.ts +37 -0
  239. package/dist-types/server/assets-middleware/middleware.d.ts +2 -0
  240. package/dist-types/server/assets-middleware/parseTokenList.d.ts +1 -0
  241. package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
  242. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
  243. package/dist-types/server/browserLogs.d.ts +9 -0
  244. package/dist-types/server/buildManager.d.ts +33 -0
  245. package/dist-types/server/cliShortcuts.d.ts +10 -0
  246. package/dist-types/server/devMiddlewares.d.ts +21 -0
  247. package/dist-types/server/devServer.d.ts +79 -0
  248. package/dist-types/server/environment.d.ts +8 -0
  249. package/dist-types/server/gracefulShutdown.d.ts +10 -0
  250. package/dist-types/server/gzipMiddleware.d.ts +2 -0
  251. package/dist-types/server/helper.d.ts +91 -0
  252. package/dist-types/server/historyApiFallback.d.ts +2 -0
  253. package/dist-types/server/hmrFallback.d.ts +1 -0
  254. package/dist-types/server/httpServer.d.ts +7 -0
  255. package/dist-types/server/middlewares.d.ts +33 -0
  256. package/dist-types/server/open.d.ts +10 -0
  257. package/dist-types/server/overlay.d.ts +3 -0
  258. package/dist-types/server/prodServer.d.ts +24 -0
  259. package/dist-types/server/proxy.d.ts +6 -0
  260. package/dist-types/server/runner/asModule.d.ts +2 -0
  261. package/dist-types/server/runner/basic.d.ts +29 -0
  262. package/dist-types/server/runner/cjs.d.ts +10 -0
  263. package/dist-types/server/runner/esm.d.ts +6 -0
  264. package/dist-types/server/runner/index.d.ts +4 -0
  265. package/dist-types/server/runner/type.d.ts +42 -0
  266. package/dist-types/server/socketServer.d.ts +81 -0
  267. package/dist-types/server/watchFiles.d.ts +14 -0
  268. package/dist-types/types/config.d.ts +1882 -0
  269. package/dist-types/types/context.d.ts +110 -0
  270. package/dist-types/types/hooks.d.ts +275 -0
  271. package/dist-types/types/index.d.ts +8 -0
  272. package/dist-types/types/plugin.d.ts +585 -0
  273. package/dist-types/types/rsbuild.d.ts +286 -0
  274. package/dist-types/types/rspack.d.ts +16 -0
  275. package/dist-types/types/thirdParty.d.ts +186 -0
  276. package/dist-types/types/utils.d.ts +19 -0
  277. package/package.json +114 -0
  278. package/static/openChrome.applescript +95 -0
  279. package/types.d.ts +349 -0
@@ -0,0 +1,6 @@
1
+ import type { InternalContext, NormalizedEnvironmentConfig, PluginManager, RsbuildPluginAPI } from './types';
2
+ export declare function getHTMLPathByEntry(entryName: string, config: NormalizedEnvironmentConfig): string;
3
+ export declare function initPluginAPI({ context, pluginManager, }: {
4
+ context: InternalContext;
5
+ pluginManager: PluginManager;
6
+ }): (environment?: string) => RsbuildPluginAPI;
@@ -0,0 +1,35 @@
1
+ import type { InitConfigsOptions } from './provider/initConfigs';
2
+ import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, Rspack, WebpackConfig } from './types';
3
+ export declare const getRsbuildInspectConfig: ({ normalizedConfig, inspectOptions, pluginManager, }: {
4
+ normalizedConfig: NormalizedConfig;
5
+ inspectOptions: InspectConfigOptions;
6
+ pluginManager: PluginManager;
7
+ }) => {
8
+ rawRsbuildConfig: string;
9
+ rsbuildConfig: InspectConfigResult["origin"]["rsbuildConfig"];
10
+ rawEnvironmentConfigs: {
11
+ name: string;
12
+ content: string;
13
+ }[];
14
+ environmentConfigs: InspectConfigResult["origin"]["environmentConfigs"];
15
+ };
16
+ type RawConfig = {
17
+ name: string;
18
+ content: string;
19
+ };
20
+ export declare function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, rawExtraConfigs, configType, }: {
21
+ configType: string;
22
+ rawExtraConfigs?: RawConfig[];
23
+ rawEnvironmentConfigs: RawConfig[];
24
+ rawBundlerConfigs: RawConfig[];
25
+ inspectOptions: InspectConfigOptions & {
26
+ outputPath: string;
27
+ };
28
+ }): Promise<void>;
29
+ export declare function stringifyConfig(config: unknown, verbose?: boolean): string;
30
+ export declare function inspectConfig<B extends 'rspack' | 'webpack' = 'rspack'>({ context, pluginManager, bundlerConfigs, inspectOptions, bundler, }: InitConfigsOptions & {
31
+ inspectOptions?: InspectConfigOptions;
32
+ bundlerConfigs: B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[];
33
+ bundler?: 'rspack' | 'webpack';
34
+ }): Promise<InspectConfigResult<B>>;
35
+ export {};
@@ -0,0 +1,60 @@
1
+ import type { RsbuildConfig } from './types';
2
+ export type ConfigParams = {
3
+ env: string;
4
+ command: string;
5
+ envMode?: string;
6
+ meta?: Record<string, unknown>;
7
+ };
8
+ export type RsbuildConfigAsyncFn = (env: ConfigParams) => Promise<RsbuildConfig>;
9
+ export type RsbuildConfigSyncFn = (env: ConfigParams) => RsbuildConfig;
10
+ export type RsbuildConfigExport = RsbuildConfig | RsbuildConfigSyncFn | RsbuildConfigAsyncFn;
11
+ export type LoadConfigOptions = {
12
+ /**
13
+ * The root path to resolve the config file.
14
+ * @default process.cwd()
15
+ */
16
+ cwd?: string;
17
+ /**
18
+ * The path to the config file, can be a relative or absolute path.
19
+ * If `path` is not provided, the function will search for the config file in the `cwd`.
20
+ */
21
+ path?: string;
22
+ /**
23
+ * A custom meta object to be passed into the config function of `defineConfig`.
24
+ */
25
+ meta?: Record<string, unknown>;
26
+ /**
27
+ * The `envMode` passed into the config function of `defineConfig`.
28
+ * @default process.env.NODE_ENV
29
+ */
30
+ envMode?: string;
31
+ /**
32
+ * Specify the config loader, can be `auto`, `jiti` or `native`.
33
+ * - 'auto': Use native Node.js loader first, fallback to jiti if failed
34
+ * - 'jiti': Use `jiti` as loader, which supports TypeScript and ESM out of the box
35
+ * - 'native': Use native Node.js loader, requires TypeScript support in Node.js >= 22.6
36
+ * @default 'jiti'
37
+ */
38
+ loader?: ConfigLoader;
39
+ };
40
+ export type LoadConfigResult = {
41
+ /**
42
+ * The loaded configuration object.
43
+ */
44
+ content: RsbuildConfig;
45
+ /**
46
+ * The path to the loaded configuration file.
47
+ * Return `null` if the configuration file is not found.
48
+ */
49
+ filePath: string | null;
50
+ };
51
+ /**
52
+ * This function helps you to autocomplete configuration types.
53
+ * It accepts a Rsbuild config object, or a function that returns a config.
54
+ */
55
+ export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
56
+ export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
57
+ export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
58
+ export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
59
+ export type ConfigLoader = 'auto' | 'jiti' | 'native';
60
+ export declare function loadConfig({ cwd, path, envMode, meta, loader, }?: LoadConfigOptions): Promise<LoadConfigResult>;
@@ -0,0 +1,63 @@
1
+ export type LoadEnvOptions = {
2
+ /**
3
+ * The root path to load the env file
4
+ * @default process.cwd()
5
+ */
6
+ cwd?: string;
7
+ /**
8
+ * Used to specify the name of the .env.[mode] file
9
+ * @default process.env.NODE_ENV
10
+ */
11
+ mode?: string;
12
+ /**
13
+ * The prefix of public variables
14
+ * @default ['PUBLIC_']
15
+ */
16
+ prefixes?: string[];
17
+ /**
18
+ * Specify a target object to store environment variables.
19
+ * If not provided, variables will be written to `process.env`.
20
+ * @default process.env
21
+ */
22
+ processEnv?: Record<string, string>;
23
+ };
24
+ export type LoadEnvResult = {
25
+ /**
26
+ * All environment variables in the .env file
27
+ */
28
+ parsed: Record<string, string>;
29
+ /**
30
+ * The absolute paths to all env files
31
+ */
32
+ filePaths: string[];
33
+ /**
34
+ * Environment variables that start with prefixes.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * {
39
+ * PUBLIC_FOO: 'bar',
40
+ * }
41
+ * ```
42
+ **/
43
+ rawPublicVars: Record<string, string | undefined>;
44
+ /**
45
+ * Formatted environment variables that start with prefixes.
46
+ * The keys contain the prefixes `process.env.*` and `import.meta.env.*`.
47
+ * The values are processed by `JSON.stringify`.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * {
52
+ * 'process.env.PUBLIC_FOO': '"bar"',
53
+ * 'import.meta.env.PUBLIC_FOO': '"bar"',
54
+ * }
55
+ * ```
56
+ **/
57
+ publicVars: Record<string, string>;
58
+ /**
59
+ * Clear the environment variables mounted on `process.env`
60
+ */
61
+ cleanup: () => void;
62
+ };
63
+ export declare function loadEnv({ cwd, mode, prefixes, processEnv, }?: LoadEnvOptions): LoadEnvResult;
@@ -0,0 +1,3 @@
1
+ import type { LoaderDefinition } from '@rspack/core';
2
+ declare const ignoreCssLoader: LoaderDefinition;
3
+ export default ignoreCssLoader;
@@ -0,0 +1,8 @@
1
+ import type { LoaderDefinition } from '@rspack/core';
2
+ import type { EnvironmentContext } from '../types';
3
+ export type TransformLoaderOptions = {
4
+ id: string;
5
+ getEnvironment: () => EnvironmentContext;
6
+ };
7
+ declare const transformLoader: LoaderDefinition<TransformLoaderOptions>;
8
+ export default transformLoader;
@@ -0,0 +1,3 @@
1
+ import transform from './transformLoader';
2
+ export default transform;
3
+ export declare const raw = true;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Logging message case convention:
3
+ *
4
+ * Info, ready, success and debug messages:
5
+ * - Start with lowercase
6
+ * - Example: "info build started..."
7
+ *
8
+ * Errors and warnings:
9
+ * - Start with uppercase
10
+ * - Example: "error Failed to build"
11
+ *
12
+ * This convention helps distinguish between normal operations
13
+ * and important alerts that require attention.
14
+ */
15
+ import { type Logger, logger } from '../compiled/rslog';
16
+ export declare const isDebug: () => boolean;
17
+ export declare const isVerbose: () => boolean;
18
+ export { logger };
19
+ export type { Logger };
@@ -0,0 +1,2 @@
1
+ import type { RsbuildConfig } from './types';
2
+ export declare const mergeRsbuildConfig: <T = RsbuildConfig>(...originalConfigs: (T | undefined)[]) => T;
@@ -0,0 +1 @@
1
+ {"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is used to get/set the global instance for html-plugin and css-extract plugin.
3
+ */
4
+ import { rspack } from './rspack';
5
+ import type { HtmlRspackPlugin, NormalizedEnvironmentConfig } from './types';
6
+ /**
7
+ * This method is used to override the Rsbuild default html-plugin (html-rspack-plugin).
8
+ */
9
+ export declare const setHTMLPlugin: (plugin: typeof HtmlRspackPlugin) => void;
10
+ export declare const getHTMLPlugin: (config?: NormalizedEnvironmentConfig) => typeof HtmlRspackPlugin;
11
+ export declare const setCssExtractPlugin: (plugin: unknown) => void;
12
+ export declare const getCssExtractPlugin: () => typeof rspack.CssExtractRspackPlugin;
@@ -0,0 +1,21 @@
1
+ import type { InternalContext, PluginManager, PluginMeta } from './types';
2
+ /**
3
+ * Determines whether the plugin is registered in the specified environment.
4
+ * If the pluginEnvironment is undefined, it means it can match any environment.
5
+ */
6
+ export declare const isEnvironmentMatch: (pluginEnvironment?: string, specifiedEnvironment?: string) => boolean;
7
+ export declare function createPluginManager(): PluginManager;
8
+ /**
9
+ * Sorts plugins by their `enforce` property.
10
+ */
11
+ export declare const sortPluginsByEnforce: (plugins: PluginMeta[]) => PluginMeta[];
12
+ /**
13
+ * Performs topological sorting on plugins based on their dependencies.
14
+ * Uses the `pre` and `post` properties of plugins to determine the correct
15
+ * execution order.
16
+ */
17
+ export declare const sortPluginsByDependencies: (plugins: PluginMeta[]) => PluginMeta[];
18
+ export declare function initPlugins({ context, pluginManager, }: {
19
+ context: InternalContext;
20
+ pluginManager: PluginManager;
21
+ }): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginAppIcon: () => RsbuildPlugin;
@@ -0,0 +1,3 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare function getRegExpForExts(exts: string[]): RegExp;
3
+ export declare const pluginAsset: () => RsbuildPlugin;
@@ -0,0 +1,5 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ /**
3
+ * Set some basic Rspack configs
4
+ */
5
+ export declare const pluginBasic: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare function pluginBundleAnalyzer(): RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginCache: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginCleanOutput: () => RsbuildPlugin;
@@ -0,0 +1,4 @@
1
+ import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
2
+ export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[], minify: boolean) => Rspack.LightningcssLoaderOptions;
3
+ export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
4
+ export declare const pluginCss: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginDefine: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginEntry: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginEsm: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare function pluginExternals(): RsbuildPlugin;
@@ -0,0 +1,6 @@
1
+ import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types';
2
+ /** Normalize file path by removing hash for comparison across builds */
3
+ export declare function normalizeFilePath(filePath: string): string;
4
+ /** Exclude source map and license files by default */
5
+ export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
6
+ export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
@@ -0,0 +1,9 @@
1
+ import type { InternalContext, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
2
+ export declare function getTemplate(entryName: string, config: NormalizedEnvironmentConfig, rootPath: string): Promise<{
3
+ templatePath: string;
4
+ templateContent?: string;
5
+ } | {
6
+ templatePath: undefined;
7
+ templateContent: string;
8
+ }>;
9
+ export declare const pluginHtml: (context: InternalContext) => RsbuildPlugin;
@@ -0,0 +1,6 @@
1
+ import type { InlineChunkTest, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
2
+ export declare const getInlineTests: (config: NormalizedEnvironmentConfig) => {
3
+ scriptTests: InlineChunkTest[];
4
+ styleTests: InlineChunkTest[];
5
+ };
6
+ export declare const pluginInlineChunk: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginLazyCompilation: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginManifest: () => RsbuildPlugin;
@@ -0,0 +1,10 @@
1
+ import type { LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
2
+ import type { NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
3
+ export declare const getSwcMinimizerOptions: (config: NormalizedEnvironmentConfig, jsOptions?: SwcJsMinimizerRspackPluginOptions) => SwcJsMinimizerRspackPluginOptions;
4
+ export declare const parseMinifyOptions: (config: NormalizedEnvironmentConfig) => {
5
+ minifyJs: boolean;
6
+ minifyCss: boolean;
7
+ jsOptions?: SwcJsMinimizerRspackPluginOptions;
8
+ cssOptions?: LightningCssMinimizerRspackPluginOptions;
9
+ };
10
+ export declare const pluginMinimize: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare function pluginModuleFederation(): RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginMoment: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginNodeAddons: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginNonce: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginOutput: () => RsbuildPlugin;
@@ -0,0 +1,5 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ /**
3
+ * Apply some configs of Rsbuild performance
4
+ */
5
+ export declare const pluginPerformance: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginProgress: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginResolve: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginResourceHints: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginRsdoctor: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginRspackProfile: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginServer: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginSourceMap: () => RsbuildPlugin;
@@ -0,0 +1,4 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const MODULE_PATH_REGEX: RegExp;
3
+ export declare function getPackageNameFromModulePath(modulePath: string): string | undefined;
4
+ export declare const pluginSplitChunks: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginSri: () => RsbuildPlugin;
@@ -0,0 +1,5 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ /**
3
+ * Provide some SWC configs of Rspack
4
+ */
5
+ export declare const pluginSwc: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginTarget: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginWasm: () => RsbuildPlugin;
@@ -0,0 +1,4 @@
1
+ import type { Build, BuildOptions } from '../types';
2
+ import type { InitConfigsOptions } from './initConfigs';
3
+ export declare const RSPACK_BUILD_ERROR = "Rspack build failed.";
4
+ export declare const build: (initOptions: InitConfigsOptions, { watch, compiler: customCompiler }?: BuildOptions) => Promise<ReturnType<Build>>;
@@ -0,0 +1,6 @@
1
+ import type { Rspack } from '../types';
2
+ import { type InitConfigsOptions } from './initConfigs';
3
+ export declare function createCompiler(options: InitConfigsOptions): Promise<{
4
+ compiler: Rspack.Compiler | Rspack.MultiCompiler;
5
+ rspackConfigs: Rspack.Configuration[];
6
+ }>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Helpers for `@rsbuild/webpack`.
3
+ */
4
+ export { modifyBundlerChain } from '../configChain';
5
+ export { prettyTime } from '../helpers';
6
+ export { formatStats, getRsbuildStats } from '../helpers/stats';
7
+ export { registerBuildHook, registerDevHook } from '../hooks';
8
+ export { inspectConfig } from '../inspectConfig';
9
+ export { getHTMLPlugin, setCssExtractPlugin, setHTMLPlugin, } from '../pluginHelper';
10
+ export { createDevServer } from '../server/devServer';
11
+ export { initRsbuildConfig } from './initConfigs';
12
+ export { getChainUtils, getConfigUtils } from './rspackConfig';
@@ -0,0 +1,19 @@
1
+ import type { InternalContext, NormalizedConfig, PluginManager, ResolvedCreateRsbuildOptions, Rspack } from '../types';
2
+ export type InitConfigsOptions = {
3
+ context: InternalContext;
4
+ pluginManager: PluginManager;
5
+ rsbuildOptions: ResolvedCreateRsbuildOptions;
6
+ };
7
+ /**
8
+ * Initialize the Rsbuild config
9
+ * 1. Initialize the Rsbuild plugins
10
+ * 2. Run all the `modifyRsbuildConfig` hooks
11
+ * 3. Normalize the Rsbuild config, merge with the default config
12
+ * 4. Initialize the configs for each environment
13
+ * 5. Run all the `modifyEnvironmentConfig` hooks
14
+ * 6. Validate the final Rsbuild config
15
+ */
16
+ export declare function initRsbuildConfig({ context, pluginManager, }: Pick<InitConfigsOptions, 'context' | 'pluginManager'>): Promise<NormalizedConfig>;
17
+ export declare function initConfigs({ context, pluginManager, rsbuildOptions, }: InitConfigsOptions): Promise<{
18
+ rspackConfigs: Rspack.Configuration[];
19
+ }>;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildProvider } from '../types';
2
+ export declare const rspackProvider: RsbuildProvider;
@@ -0,0 +1,8 @@
1
+ import type { EnvironmentContext, InternalContext, ModifyChainUtils, ModifyRspackConfigUtils, RsbuildTarget, Rspack } from '../types';
2
+ export declare function getConfigUtils(getCurrentConfig: () => Rspack.Configuration, chainUtils: ModifyChainUtils): ModifyRspackConfigUtils;
3
+ export declare function getChainUtils(target: RsbuildTarget, environment: EnvironmentContext, environments: Record<string, EnvironmentContext>): ModifyChainUtils;
4
+ export declare function generateRspackConfig({ target, context, environmentName, }: {
5
+ target: RsbuildTarget;
6
+ context: InternalContext;
7
+ environmentName: string;
8
+ }): Promise<Rspack.Configuration>;
@@ -0,0 +1,18 @@
1
+ import type { ChokidarOptions } from '../compiled/chokidar/index.js';
2
+ import type { RsbuildInstance } from './types';
3
+ type Cleaner = () => unknown;
4
+ /**
5
+ * Add a cleaner to handle side effects
6
+ */
7
+ export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
8
+ export declare const restartDevServer: ({ filePath, clear, }?: {
9
+ filePath?: string;
10
+ clear?: boolean;
11
+ }) => Promise<boolean>;
12
+ export declare function watchFilesForRestart({ files, rsbuild, isBuildWatch, watchOptions, }: {
13
+ files: string[];
14
+ rsbuild: RsbuildInstance;
15
+ isBuildWatch: boolean;
16
+ watchOptions?: ChokidarOptions;
17
+ }): Promise<void>;
18
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { Compiler } from '@rspack/core';
2
+ import type { EnvironmentContext, HtmlRspackPlugin, HtmlTag, HtmlTagDescriptor, InternalContext } from '../types';
3
+ type HtmlTagObject = HtmlRspackPlugin.HtmlTagObject;
4
+ export type TagConfig = {
5
+ tags?: HtmlTagDescriptor[];
6
+ hash?: HtmlTag['hash'];
7
+ append?: HtmlTag['append'];
8
+ publicPath?: HtmlTag['publicPath'];
9
+ };
10
+ /**
11
+ * A unique identifier for providing extra data to RsbuildHtmlPlugin
12
+ */
13
+ export declare const entryNameSymbol: unique symbol;
14
+ export type HtmlExtraData = {
15
+ entryName: string;
16
+ context: InternalContext;
17
+ environment: EnvironmentContext;
18
+ favicon?: string;
19
+ faviconDistPath: string;
20
+ tagConfig?: TagConfig;
21
+ templateContent?: string;
22
+ };
23
+ export type AlterAssetTagGroupsData = {
24
+ headTags: HtmlTagObject[];
25
+ bodyTags: HtmlTagObject[];
26
+ outputName: string;
27
+ publicPath: string;
28
+ plugin: HtmlRspackPlugin;
29
+ };
30
+ export declare const hasTitle: (html?: string) => boolean;
31
+ export declare class RsbuildHtmlPlugin {
32
+ readonly name: string;
33
+ readonly getExtraData: (entryName: string) => HtmlExtraData | undefined;
34
+ readonly getHTMLPlugin: () => typeof HtmlRspackPlugin;
35
+ constructor(getExtraData: (entryName: string) => HtmlExtraData | undefined, getHTMLPlugin: () => typeof HtmlRspackPlugin);
36
+ apply(compiler: Compiler): void;
37
+ }
38
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This method is modified based on source found in
3
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/index.js
4
+ *
5
+ * Copyright 2018 Google Inc.
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
19
+ import type { HtmlRspackPlugin, ResourceHintsOptions } from '../../types';
20
+ type LinkType = 'preload' | 'prefetch';
21
+ export declare class HtmlResourceHintsPlugin implements RspackPluginInstance {
22
+ readonly options: ResourceHintsOptions;
23
+ name: string;
24
+ resourceHints: HtmlRspackPlugin.HtmlTagObject[];
25
+ type: LinkType;
26
+ HTMLCount: number;
27
+ isDev: boolean;
28
+ getHTMLPlugin: () => typeof HtmlRspackPlugin;
29
+ constructor(options: ResourceHintsOptions, type: LinkType, HTMLCount: number, isDev: boolean, getHTMLPlugin: () => typeof HtmlRspackPlugin);
30
+ apply(compiler: Compiler): void;
31
+ }
32
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This method is modified based on source found in
3
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/does-chunk-belong-to-html.js
4
+ *
5
+ * Copyright 2018 Google Inc.
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import type { Chunk, Compilation } from '@rspack/core';
19
+ import type { HtmlRspackPlugin, ResourceHintsOptions } from '../../types';
20
+ interface DoesChunkBelongToHtmlOptions {
21
+ chunk: Chunk;
22
+ compilation?: Compilation;
23
+ htmlPluginData: HtmlRspackPlugin.BeforeAssetTagGenerationData;
24
+ pluginOptions?: ResourceHintsOptions;
25
+ }
26
+ export declare function recursiveChunkEntryNames(chunk: Chunk): string[];
27
+ export declare function doesChunkBelongToHtml({ chunk, htmlPluginData, }: DoesChunkBelongToHtmlOptions): boolean;
28
+ export {};