@rsbuild/core 2.1.7 → 2.1.9

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 (160) hide show
  1. package/compiled/cors/index.d.ts +1 -1
  2. package/compiled/css-loader/index.js +2 -2
  3. package/compiled/html-rspack-plugin/index.d.ts +1 -1
  4. package/compiled/html-rspack-plugin/index.js +14 -14
  5. package/compiled/postcss/index.js +1 -1
  6. package/compiled/postcss/lib/node.d.ts +2 -2
  7. package/compiled/postcss/package.json +1 -1
  8. package/compiled/postcss-loader/index.js +6 -6
  9. package/dist/{711.js → 626.js} +106 -84
  10. package/dist/build.d.ts +4 -0
  11. package/dist/chokidar.js +1 -1046
  12. package/{dist-types → dist}/cli/commands.d.ts +2 -2
  13. package/{dist-types → dist}/cli/init.d.ts +2 -2
  14. package/dist/client/hmr.js +1 -1
  15. package/dist/client/overlay.js +1 -1
  16. package/{dist-types → dist}/configChain.d.ts +2 -2
  17. package/dist/connect-next.js +1 -876
  18. package/dist/cors.js +1 -1
  19. package/{dist-types → dist}/createCompiler.d.ts +2 -2
  20. package/{dist-types → dist}/createContext.d.ts +3 -3
  21. package/{dist-types → dist}/createRsbuild.d.ts +1 -1
  22. package/{dist-types → dist}/defaultConfig.d.ts +1 -1
  23. package/{dist-types → dist}/helpers/compiler.d.ts +1 -1
  24. package/{dist-types → dist}/helpers/css.d.ts +1 -1
  25. package/{dist-types → dist}/helpers/format.d.ts +1 -1
  26. package/{dist-types → dist}/helpers/fs.d.ts +2 -2
  27. package/{dist-types → dist}/helpers/index.d.ts +4 -4
  28. package/{dist-types → dist}/helpers/overlayConfig.d.ts +1 -1
  29. package/{dist-types → dist}/helpers/path.d.ts +1 -1
  30. package/{dist-types → dist}/helpers/restartManager.d.ts +2 -2
  31. package/{dist-types → dist}/helpers/stats.d.ts +2 -2
  32. package/{dist-types → dist}/helpers/url.d.ts +2 -2
  33. package/{dist-types → dist}/helpers/vendors.d.ts +1 -1
  34. package/{dist-types → dist}/hooks.d.ts +1 -1
  35. package/dist/http-proxy-middleware.js +5 -3010
  36. package/{dist-types → dist}/index.d.ts +14 -14
  37. package/dist/index.js +1 -1
  38. package/{dist-types → dist}/initConfigs.d.ts +1 -1
  39. package/{dist-types → dist}/initPlugins.d.ts +2 -2
  40. package/{dist-types → dist}/inspectConfig.d.ts +2 -2
  41. package/dist/launch-editor-middleware.js +1 -544
  42. package/{dist-types → dist}/loadConfig.d.ts +6 -6
  43. package/{dist-types → dist}/loader/cssUrlLoader.d.ts +1 -1
  44. package/{dist-types → dist}/loader/ignoreCssLoader.d.ts +1 -1
  45. package/{dist-types → dist}/loader/transformLoader.d.ts +1 -1
  46. package/{dist-types → dist}/loader/transformRawLoader.d.ts +1 -1
  47. package/{dist-types → dist}/logger.d.ts +1 -1
  48. package/dist/manifest-plugin.js +1 -692
  49. package/dist/memfs.js +1 -5695
  50. package/{dist-types → dist}/mergeConfig.d.ts +1 -1
  51. package/dist/open.js +2 -439
  52. package/{dist-types → dist}/pluginHelper.d.ts +1 -1
  53. package/{dist-types → dist}/pluginManager.d.ts +2 -2
  54. package/{dist-types → dist}/plugins/appIcon.d.ts +1 -1
  55. package/{dist-types → dist}/plugins/asset.d.ts +1 -1
  56. package/{dist-types → dist}/plugins/basic.d.ts +1 -1
  57. package/dist/plugins/cache.d.ts +2 -0
  58. package/{dist-types → dist}/plugins/cleanOutput.d.ts +1 -1
  59. package/{dist-types → dist}/plugins/css.d.ts +1 -1
  60. package/{dist-types → dist}/plugins/define.d.ts +1 -1
  61. package/dist/plugins/entry.d.ts +2 -0
  62. package/{dist-types → dist}/plugins/externals.d.ts +2 -2
  63. package/{dist-types → dist}/plugins/fileSize.d.ts +1 -1
  64. package/{dist-types → dist}/plugins/html.d.ts +1 -1
  65. package/{dist-types → dist}/plugins/inlineChunk.d.ts +1 -1
  66. package/{dist-types → dist}/plugins/lazyCompilation.d.ts +1 -1
  67. package/{dist-types → dist}/plugins/manifest.d.ts +1 -1
  68. package/{dist-types → dist}/plugins/minimize.d.ts +2 -2
  69. package/{dist-types → dist}/plugins/moduleFederation.d.ts +1 -1
  70. package/{dist-types → dist}/plugins/nodeAddons.d.ts +1 -1
  71. package/dist/plugins/nonce.d.ts +2 -0
  72. package/{dist-types → dist}/plugins/output.d.ts +1 -1
  73. package/{dist-types → dist}/plugins/progress.d.ts +1 -1
  74. package/{dist-types → dist}/plugins/resolve.d.ts +1 -1
  75. package/{dist-types → dist}/plugins/resourceHints.d.ts +1 -1
  76. package/{dist-types → dist}/plugins/rsdoctor.d.ts +1 -1
  77. package/{dist-types → dist}/plugins/rspackProfile.d.ts +1 -1
  78. package/{dist-types → dist}/plugins/server.d.ts +1 -1
  79. package/{dist-types → dist}/plugins/sourceMap.d.ts +1 -1
  80. package/{dist-types → dist}/plugins/splitChunks.d.ts +1 -1
  81. package/dist/plugins/sri.d.ts +2 -0
  82. package/{dist-types → dist}/plugins/swc.d.ts +1 -1
  83. package/{dist-types → dist}/plugins/target.d.ts +1 -1
  84. package/dist/plugins/wasm.d.ts +2 -0
  85. package/{dist-types → dist}/plugins/worker.d.ts +1 -1
  86. package/dist/range-parser.js +1 -1
  87. package/dist/restart.d.ts +15 -0
  88. package/{dist-types → dist}/rspack-plugins/RsbuildHtmlPlugin.d.ts +1 -1
  89. package/{dist-types → dist}/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +1 -1
  90. package/{dist-types → dist}/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +1 -1
  91. package/{dist-types → dist}/rspack-plugins/resource-hints/extractChunks.d.ts +1 -1
  92. package/{dist-types → dist}/rspackConfig.d.ts +1 -1
  93. package/{dist-types → dist}/server/assets-middleware/getFileFromUrl.d.ts +1 -1
  94. package/{dist-types → dist}/server/assets-middleware/index.d.ts +2 -2
  95. package/{dist-types → dist}/server/assets-middleware/middleware.d.ts +1 -1
  96. package/{dist-types → dist}/server/assets-middleware/setupOutputFileSystem.d.ts +1 -1
  97. package/{dist-types → dist}/server/assets-middleware/setupWriteToDisk.d.ts +2 -2
  98. package/{dist-types → dist}/server/browserLogs.d.ts +1 -1
  99. package/{dist-types → dist}/server/buildManager.d.ts +3 -3
  100. package/{dist-types → dist}/server/cliShortcuts.d.ts +2 -2
  101. package/{dist-types → dist}/server/devMiddlewares.d.ts +4 -4
  102. package/{dist-types → dist}/server/devServer.d.ts +4 -4
  103. package/{dist-types → dist}/server/environment.d.ts +1 -1
  104. package/{dist-types → dist}/server/gzipMiddleware.d.ts +1 -1
  105. package/{dist-types → dist}/server/helper.d.ts +4 -4
  106. package/{dist-types → dist}/server/historyApiFallback.d.ts +2 -2
  107. package/{dist-types → dist}/server/httpServer.d.ts +1 -1
  108. package/{dist-types → dist}/server/middlewares.d.ts +2 -2
  109. package/{dist-types → dist}/server/open.d.ts +2 -2
  110. package/{dist-types → dist}/server/previewServer.d.ts +2 -2
  111. package/{dist-types → dist}/server/proxy.d.ts +3 -3
  112. package/{dist-types → dist}/server/runner/basic.d.ts +1 -1
  113. package/{dist-types → dist}/server/runner/cjs.d.ts +2 -2
  114. package/{dist-types → dist}/server/runner/esm.d.ts +2 -2
  115. package/{dist-types → dist}/server/runner/index.d.ts +1 -1
  116. package/{dist-types → dist}/server/serverSetup.d.ts +1 -1
  117. package/{dist-types → dist}/server/socketServer.d.ts +1 -1
  118. package/{dist-types → dist}/server/watchFiles.d.ts +4 -3
  119. package/dist/sirv.js +1 -1
  120. package/dist/tinyglobby.js +1 -1670
  121. package/{dist-types → dist}/types/config.d.ts +24 -15
  122. package/{dist-types → dist}/types/context.d.ts +9 -9
  123. package/{dist-types → dist}/types/hooks.d.ts +31 -15
  124. package/dist/types/index.d.ts +8 -0
  125. package/{dist-types → dist}/types/plugin.d.ts +7 -7
  126. package/{dist-types → dist}/types/rsbuild.d.ts +15 -14
  127. package/{dist-types → dist}/types/rspack.d.ts +2 -2
  128. package/{dist-types → dist}/types/thirdParty.d.ts +5 -5
  129. package/dist/ws.js +2 -1524
  130. package/package.json +9 -10
  131. package/dist-types/build.d.ts +0 -4
  132. package/dist-types/package.json +0 -1
  133. package/dist-types/plugins/cache.d.ts +0 -2
  134. package/dist-types/plugins/entry.d.ts +0 -2
  135. package/dist-types/plugins/nonce.d.ts +0 -2
  136. package/dist-types/plugins/sri.d.ts +0 -2
  137. package/dist-types/plugins/wasm.d.ts +0 -2
  138. package/dist-types/restart.d.ts +0 -14
  139. package/dist-types/types/index.d.ts +0 -8
  140. /package/dist/{711.js.LICENSE.txt → 626.js.LICENSE.txt} +0 -0
  141. /package/{dist-types → dist}/cli/index.d.ts +0 -0
  142. /package/dist/client/{307.js → 307~0.js} +0 -0
  143. /package/{dist-types → dist}/constants.d.ts +0 -0
  144. /package/{dist-types → dist}/helpers/exitHook.d.ts +0 -0
  145. /package/{dist-types → dist}/helpers/packageJson.d.ts +0 -0
  146. /package/{dist-types → dist}/helpers/version.d.ts +0 -0
  147. /package/{dist-types → dist}/loadEnv.d.ts +0 -0
  148. /package/{dist-types → dist}/loader/workerLoader.d.ts +0 -0
  149. /package/dist/{1~rslib-runtime.js → rslib-runtime.js} +0 -0
  150. /package/{dist-types → dist}/rspack-plugins/resource-hints/getResourceType.d.ts +0 -0
  151. /package/{dist-types → dist}/server/ansiHTML.d.ts +0 -0
  152. /package/{dist-types → dist}/server/assets-middleware/parseTokenList.d.ts +0 -0
  153. /package/{dist-types → dist}/server/compileState.d.ts +0 -0
  154. /package/{dist-types → dist}/server/gracefulShutdown.d.ts +0 -0
  155. /package/{dist-types → dist}/server/hmrFallback.d.ts +0 -0
  156. /package/{dist-types → dist}/server/overlay.d.ts +0 -0
  157. /package/{dist-types → dist}/server/publicPathnames.d.ts +0 -0
  158. /package/{dist-types → dist}/server/runner/asModule.d.ts +0 -0
  159. /package/{dist-types → dist}/server/runner/type.d.ts +0 -0
  160. /package/{dist-types → dist}/types/utils.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import type { RsbuildConfig } from './types';
1
+ import type { RsbuildConfig } from './types/index.js';
2
2
  /**
3
3
  * Deeply merges multiple Rsbuild configuration objects.
4
4
  *
package/dist/open.js CHANGED
@@ -1,439 +1,2 @@
1
- let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
2
- import node_process from "node:process";
3
- import node_path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import node_child_process, { execFile as external_node_child_process_execFile } from "node:child_process";
6
- import promises, { constants } from "node:fs/promises";
7
- import { promisify } from "node:util";
8
- import node_os from "node:os";
9
- import node_fs from "node:fs";
10
- import { Buffer } from "node:buffer";
11
- function hasDockerEnv() {
12
- try {
13
- return node_fs.statSync('/.dockerenv'), !0;
14
- } catch {
15
- return !1;
16
- }
17
- }
18
- function hasDockerCGroup() {
19
- try {
20
- return node_fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
21
- } catch {
22
- return !1;
23
- }
24
- }
25
- function isDocker() {
26
- return void 0 === isDockerCached && (isDockerCached = hasDockerEnv() || hasDockerCGroup()), isDockerCached;
27
- }
28
- function isInsideContainer() {
29
- return void 0 === cachedResult && (cachedResult = (()=>{
30
- try {
31
- return node_fs.statSync('/run/.containerenv'), !0;
32
- } catch {
33
- return !1;
34
- }
35
- })() || isDocker()), cachedResult;
36
- }
37
- let isWsl = ()=>{
38
- if ('linux' !== node_process.platform) return !1;
39
- if (node_os.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
40
- try {
41
- if (node_fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
42
- } catch {}
43
- return !!(node_fs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop') || node_fs.existsSync('/run/WSL')) && !isInsideContainer();
44
- }, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), execFile = promisify(node_child_process.execFile), powerShellPath = ()=>`${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
45
- let { powerShellPath: psPath, ...execFileOptions } = options, encodedCommand = executePowerShell.encodeCommand(command);
46
- return execFile(psPath ?? powerShellPath(), [
47
- ...executePowerShell.argumentsPrefix,
48
- encodedCommand
49
- ], {
50
- encoding: 'utf8',
51
- ...execFileOptions
52
- });
53
- };
54
- function parseMountPointFromConfig(content) {
55
- for (let line of content.split('\n')){
56
- if (/^\s*#/.test(line)) continue;
57
- let match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
58
- if (match) return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, '');
59
- }
60
- }
61
- executePowerShell.argumentsPrefix = [
62
- '-NoProfile',
63
- '-NonInteractive',
64
- '-ExecutionPolicy',
65
- 'Bypass',
66
- '-EncodedCommand'
67
- ], executePowerShell.encodeCommand = (command)=>Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
68
- let wsl_utils_execFile = promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
69
- if (mountPoint) return mountPoint;
70
- let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
71
- try {
72
- await promises.access(configFilePath, constants.F_OK), isConfigFileExists = !0;
73
- } catch {}
74
- if (!isConfigFileExists) return defaultMountPoint;
75
- let parsedMountPoint = parseMountPointFromConfig(await promises.readFile(configFilePath, {
76
- encoding: 'utf8'
77
- }));
78
- return void 0 === parsedMountPoint ? defaultMountPoint : mountPoint = (mountPoint = parsedMountPoint).endsWith('/') ? mountPoint : `${mountPoint}/`;
79
- }), powerShellPathFromWsl = async ()=>{
80
- let mountPoint = await wslDrivesMountPoint();
81
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
82
- }, wsl_utils_powerShellPath = is_wsl ? powerShellPathFromWsl : powerShellPath, wsl_utils_canAccessPowerShell = async ()=>canAccessPowerShellPromise ??= (async ()=>{
83
- try {
84
- let psPath = await wsl_utils_powerShellPath();
85
- return await promises.access(psPath, constants.X_OK), !0;
86
- } catch {
87
- return !1;
88
- }
89
- })(), wslDefaultBrowser = async ()=>{
90
- let psPath = await wsl_utils_powerShellPath(), command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { stdout } = await executePowerShell(command, {
91
- powerShellPath: psPath
92
- });
93
- return stdout.trim();
94
- }, convertWslPathToWindows = async (path)=>{
95
- if (/^[a-z]+:\/\//i.test(path)) return path;
96
- try {
97
- let { stdout } = await wsl_utils_execFile('wslpath', [
98
- '-aw',
99
- path
100
- ], {
101
- encoding: 'utf8'
102
- });
103
- return stdout.trim();
104
- } catch {
105
- return path;
106
- }
107
- };
108
- function defineLazyProperty(object, propertyName, valueGetter) {
109
- let define = (value)=>Object.defineProperty(object, propertyName, {
110
- value,
111
- enumerable: !0,
112
- writable: !0
113
- });
114
- return Object.defineProperty(object, propertyName, {
115
- configurable: !0,
116
- enumerable: !0,
117
- get () {
118
- let result = valueGetter();
119
- return define(result), result;
120
- },
121
- set (value) {
122
- define(value);
123
- }
124
- }), object;
125
- }
126
- let execFileAsync = promisify(external_node_child_process_execFile);
127
- async function defaultBrowserId() {
128
- if ('darwin' !== node_process.platform) throw Error('macOS only');
129
- let { stdout } = await execFileAsync('defaults', [
130
- 'read',
131
- 'com.apple.LaunchServices/com.apple.launchservices.secure',
132
- 'LSHandlers'
133
- ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout), browserId = match?.groups.id ?? 'com.apple.Safari';
134
- return 'com.apple.safari' === browserId ? 'com.apple.Safari' : browserId;
135
- }
136
- let run_applescript_execFileAsync = promisify(external_node_child_process_execFile);
137
- async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
138
- if ('darwin' !== node_process.platform) throw Error('macOS only');
139
- let execOptions = {};
140
- signal && (execOptions.signal = signal);
141
- let { stdout } = await run_applescript_execFileAsync("osascript", [
142
- '-e',
143
- script,
144
- humanReadableOutput ? [] : [
145
- '-ss'
146
- ]
147
- ], execOptions);
148
- return stdout.trim();
149
- }
150
- async function bundleName(bundleId) {
151
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
152
- }
153
- let windows_execFileAsync = promisify(external_node_child_process_execFile), windowsBrowserProgIds = {
154
- MSEdgeHTM: {
155
- name: 'Edge',
156
- id: 'com.microsoft.edge'
157
- },
158
- MSEdgeBHTML: {
159
- name: 'Edge Beta',
160
- id: 'com.microsoft.edge.beta'
161
- },
162
- MSEdgeDHTML: {
163
- name: 'Edge Dev',
164
- id: 'com.microsoft.edge.dev'
165
- },
166
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
167
- name: 'Edge',
168
- id: 'com.microsoft.edge.old'
169
- },
170
- ChromeHTML: {
171
- name: 'Chrome',
172
- id: 'com.google.chrome'
173
- },
174
- ChromeBHTML: {
175
- name: 'Chrome Beta',
176
- id: 'com.google.chrome.beta'
177
- },
178
- ChromeDHTML: {
179
- name: 'Chrome Dev',
180
- id: 'com.google.chrome.dev'
181
- },
182
- ChromiumHTM: {
183
- name: 'Chromium',
184
- id: 'org.chromium.Chromium'
185
- },
186
- BraveHTML: {
187
- name: 'Brave',
188
- id: 'com.brave.Browser'
189
- },
190
- BraveBHTML: {
191
- name: 'Brave Beta',
192
- id: 'com.brave.Browser.beta'
193
- },
194
- BraveDHTML: {
195
- name: 'Brave Dev',
196
- id: 'com.brave.Browser.dev'
197
- },
198
- BraveSSHTM: {
199
- name: 'Brave Nightly',
200
- id: 'com.brave.Browser.nightly'
201
- },
202
- FirefoxURL: {
203
- name: 'Firefox',
204
- id: 'org.mozilla.firefox'
205
- },
206
- OperaStable: {
207
- name: 'Opera',
208
- id: 'com.operasoftware.Opera'
209
- },
210
- VivaldiHTM: {
211
- name: 'Vivaldi',
212
- id: 'com.vivaldi.Vivaldi'
213
- },
214
- 'IE.HTTP': {
215
- name: 'Internet Explorer',
216
- id: 'com.microsoft.ie'
217
- }
218
- }, _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
219
- class UnknownBrowserError extends Error {
220
- }
221
- async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
222
- let { stdout } = await _execFileAsync('reg', [
223
- 'QUERY',
224
- ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
225
- '/v',
226
- 'ProgId'
227
- ]), match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
228
- if (!match) throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
229
- let { id } = match.groups, dotIndex = id.lastIndexOf('.'), hyphenIndex = id.lastIndexOf('-'), baseIdByDot = -1 === dotIndex ? void 0 : id.slice(0, dotIndex), baseIdByHyphen = -1 === hyphenIndex ? void 0 : id.slice(0, hyphenIndex);
230
- return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {
231
- name: id,
232
- id
233
- };
234
- }
235
- let default_browser_execFileAsync = promisify(external_node_child_process_execFile);
236
- async function default_browser_defaultBrowser() {
237
- if ('darwin' === node_process.platform) {
238
- let id = await defaultBrowserId();
239
- return {
240
- name: await bundleName(id),
241
- id
242
- };
243
- }
244
- if ('linux' === node_process.platform) {
245
- let { stdout } = await default_browser_execFileAsync('xdg-mime', [
246
- 'query',
247
- 'default',
248
- 'x-scheme-handler/http'
249
- ]), id = stdout.trim();
250
- return {
251
- name: id.replace(/.desktop$/, '').replace('-', ' ').toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x)=>x.toUpperCase()),
252
- id
253
- };
254
- }
255
- if ('win32' === node_process.platform) return defaultBrowser();
256
- throw Error('Only macOS, Linux, and Windows are supported');
257
- }
258
- let isInSsh = !!(node_process.env.SSH_CONNECTION || node_process.env.SSH_CLIENT || node_process.env.SSH_TTY), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? node_path.dirname(fileURLToPath(import.meta.url)) : '', localXdgOpenPath = node_path.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = node_process, tryEachApp = async (apps, opener)=>{
259
- if (0 === apps.length) return;
260
- let errors = [];
261
- for (let app of apps)try {
262
- return await opener(app);
263
- } catch (error) {
264
- errors.push(error);
265
- }
266
- throw AggregateError(errors, 'Failed to open in all supported apps');
267
- }, baseOpen = async (options)=>{
268
- let command, isFallbackAttempt = !0 === (options = {
269
- wait: !1,
270
- background: !1,
271
- newInstance: !1,
272
- allowNonzeroExitCode: !1,
273
- ...options
274
- })[fallbackAttemptSymbol];
275
- if (delete options[fallbackAttemptSymbol], Array.isArray(options.app)) return tryEachApp(options.app, (singleApp)=>baseOpen({
276
- ...options,
277
- app: singleApp,
278
- [fallbackAttemptSymbol]: !0
279
- }));
280
- let { name: app, arguments: appArguments = [] } = options.app ?? {};
281
- if (appArguments = [
282
- ...appArguments
283
- ], Array.isArray(app)) return tryEachApp(app, (appName)=>baseOpen({
284
- ...options,
285
- app: {
286
- name: appName,
287
- arguments: appArguments
288
- },
289
- [fallbackAttemptSymbol]: !0
290
- }));
291
- if ('browser' === app || 'browserPrivate' === app) {
292
- let browser, ids = {
293
- 'com.google.chrome': 'chrome',
294
- 'google-chrome.desktop': 'chrome',
295
- 'com.brave.browser': 'brave',
296
- 'org.mozilla.firefox': 'firefox',
297
- 'firefox.desktop': 'firefox',
298
- 'com.microsoft.msedge': 'edge',
299
- 'com.microsoft.edge': 'edge',
300
- 'com.microsoft.edgemac': 'edge',
301
- 'microsoft-edge.desktop': 'edge',
302
- 'com.apple.safari': 'safari'
303
- };
304
- if (is_wsl) {
305
- let progId = await wslDefaultBrowser();
306
- browser = _windowsBrowserProgIdMap.get(progId) ?? {};
307
- } else browser = await default_browser_defaultBrowser();
308
- if (browser.id in ids) {
309
- let browserName = ids[browser.id.toLowerCase()];
310
- if ('browserPrivate' === app) {
311
- if ('safari' === browserName) throw Error('Safari doesn\'t support opening in private mode via command line');
312
- appArguments.push({
313
- chrome: '--incognito',
314
- brave: '--incognito',
315
- firefox: '--private-window',
316
- edge: '--inPrivate'
317
- }[browserName]);
318
- }
319
- return baseOpen({
320
- ...options,
321
- app: {
322
- name: open_apps[browserName],
323
- arguments: appArguments
324
- }
325
- });
326
- }
327
- throw Error(`${browser.name} is not supported as a default browser`);
328
- }
329
- let cliArguments = [], childProcessOptions = {}, shouldUseWindowsInWsl = !1;
330
- if (!is_wsl || isInsideContainer() || isInSsh || app || (shouldUseWindowsInWsl = await wsl_utils_canAccessPowerShell()), 'darwin' === platform) command = 'open', options.wait && cliArguments.push('--wait-apps'), options.background && cliArguments.push('--background'), options.newInstance && cliArguments.push('--new'), app && cliArguments.push('-a', app);
331
- else if ('win32' === platform || shouldUseWindowsInWsl) {
332
- command = await wsl_utils_powerShellPath(), cliArguments.push(...executePowerShell.argumentsPrefix), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0), is_wsl && options.target && (options.target = await convertWslPathToWindows(options.target));
333
- let encodedArguments = [
334
- '$ProgressPreference = \'SilentlyContinue\';',
335
- 'Start'
336
- ];
337
- options.wait && encodedArguments.push('-Wait'), app ? (encodedArguments.push(executePowerShell.escapeArgument(app)), options.target && appArguments.push(options.target)) : options.target && encodedArguments.push(executePowerShell.escapeArgument(options.target)), appArguments.length > 0 && encodedArguments.push('-ArgumentList', (appArguments = appArguments.map((argument)=>executePowerShell.escapeArgument(argument))).join(',')), options.target = executePowerShell.encodeCommand(encodedArguments.join(' ')), options.wait || (childProcessOptions.stdio = 'ignore');
338
- } else {
339
- if (app) command = app;
340
- else {
341
- let exeLocalXdgOpen = !1;
342
- try {
343
- await promises.access(localXdgOpenPath, constants.X_OK), exeLocalXdgOpen = !0;
344
- } catch {}
345
- command = node_process.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
346
- }
347
- appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
348
- }
349
- 'darwin' === platform && appArguments.length > 0 && cliArguments.push('--args', ...appArguments), options.target && cliArguments.push(options.target);
350
- let subprocess = node_child_process.spawn(command, cliArguments, childProcessOptions);
351
- return options.wait ? new Promise((resolve, reject)=>{
352
- subprocess.once('error', reject), subprocess.once('close', (exitCode)=>{
353
- options.allowNonzeroExitCode || 0 === exitCode ? resolve(subprocess) : reject(Error(`Exited with code ${exitCode}`));
354
- });
355
- }) : isFallbackAttempt ? new Promise((resolve, reject)=>{
356
- subprocess.once('error', reject), subprocess.once('spawn', ()=>{
357
- subprocess.once('close', (exitCode)=>{
358
- (subprocess.off('error', reject), 0 !== exitCode) ? reject(Error(`Exited with code ${exitCode}`)) : (subprocess.unref(), resolve(subprocess));
359
- });
360
- });
361
- }) : (subprocess.unref(), new Promise((resolve, reject)=>{
362
- subprocess.once('error', reject), subprocess.once('spawn', ()=>{
363
- subprocess.off('error', reject), resolve(subprocess);
364
- });
365
- }));
366
- };
367
- function detectArchBinary(binary) {
368
- if ('string' == typeof binary || Array.isArray(binary)) return binary;
369
- let { [arch]: archBinary } = binary;
370
- if (!archBinary) throw Error(`${arch} is not supported`);
371
- return archBinary;
372
- }
373
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
374
- if (wsl && is_wsl) return detectArchBinary(wsl);
375
- if (!platformBinary) throw Error(`${platform} is not supported`);
376
- return detectArchBinary(platformBinary);
377
- }
378
- let open_apps = {
379
- browser: 'browser',
380
- browserPrivate: 'browserPrivate'
381
- };
382
- defineLazyProperty(open_apps, 'chrome', ()=>detectPlatformBinary({
383
- darwin: 'google chrome',
384
- win32: 'chrome',
385
- linux: [
386
- 'google-chrome',
387
- 'google-chrome-stable',
388
- 'chromium',
389
- 'chromium-browser'
390
- ]
391
- }, {
392
- wsl: {
393
- ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
394
- x64: [
395
- '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe',
396
- '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
397
- ]
398
- }
399
- })), defineLazyProperty(open_apps, 'brave', ()=>detectPlatformBinary({
400
- darwin: 'brave browser',
401
- win32: 'brave',
402
- linux: [
403
- 'brave-browser',
404
- 'brave'
405
- ]
406
- }, {
407
- wsl: {
408
- ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
409
- x64: [
410
- '/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe',
411
- '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
412
- ]
413
- }
414
- })), defineLazyProperty(open_apps, 'firefox', ()=>detectPlatformBinary({
415
- darwin: 'firefox',
416
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
417
- linux: 'firefox'
418
- }, {
419
- wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
420
- })), defineLazyProperty(open_apps, 'edge', ()=>detectPlatformBinary({
421
- darwin: 'microsoft edge',
422
- win32: 'msedge',
423
- linux: [
424
- 'microsoft-edge',
425
- 'microsoft-edge-dev'
426
- ]
427
- }, {
428
- wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
429
- })), defineLazyProperty(open_apps, 'safari', ()=>detectPlatformBinary({
430
- darwin: 'Safari'
431
- }));
432
- export default ((target, options)=>{
433
- if ('string' != typeof target) throw TypeError('Expected a `target`');
434
- return baseOpen({
435
- ...options,
436
- target
437
- });
438
- });
439
- export { open_apps as apps };
1
+ let e,r,o,t,a;import i from"node:process";import n from"node:path";import{fileURLToPath as s}from"node:url";import c,{execFile as l}from"node:child_process";import m,{constants as p}from"node:fs/promises";import{promisify as d}from"node:util";import f from"node:os";import u from"node:fs";import{Buffer as g}from"node:buffer";function w(){return void 0===r&&(r=(()=>{try{return u.statSync("/run/.containerenv"),!0}catch{return!1}})()||(void 0===e&&(e=function(){try{return u.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return u.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),e)),r}let h=()=>{if("linux"!==i.platform)return!1;if(f.release().toLowerCase().includes("microsoft"))return!w();try{if(u.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!w()}catch{}return!!(u.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||u.existsSync("/run/WSL"))&&!w()},v=i.env.__IS_WSL_TEST__?h:h(),x=d(c.execFile),S=()=>`${i.env.SYSTEMROOT||i.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,y=async(e,r={})=>{let{powerShellPath:o,...t}=r,a=y.encodeCommand(e);return x(o??S(),[...y.argumentsPrefix,a],{encoding:"utf8",...t})};y.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],y.encodeCommand=e=>g.from(e,"utf16le").toString("base64"),y.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;let b=d(c.execFile),E=(a="/mnt/",async function(){if(t)return t;let e="/etc/wsl.conf",r=!1;try{await m.access(e,p.F_OK),r=!0}catch{}if(!r)return a;let o=function(e){for(let r of e.split("\n")){if(/^\s*#/.test(r))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(r);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}(await m.readFile(e,{encoding:"utf8"}));return void 0===o?a:t=(t=o).endsWith("/")?t:`${t}/`}),P=async()=>{let e=await E();return`${e}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},C=v?P:S,A=async()=>o??=(async()=>{try{let e=await C();return await m.access(e,p.X_OK),!0}catch{return!1}})(),B=async()=>{let e=await C(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:o}=await y(r,{powerShellPath:e});return o.trim()},L=async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:r}=await b("wslpath",["-aw",e],{encoding:"utf8"});return r.trim()}catch{return e}};function T(e,r,o){let t=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let e=o();return t(e),e},set(e){t(e)}}),e}let F=d(l);async function M(){if("darwin"!==i.platform)throw Error("macOS only");let{stdout:e}=await F("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e),o=r?.groups.id??"com.apple.Safari";return"com.apple.safari"===o?"com.apple.Safari":o}let H=d(l);async function O(e,{humanReadableOutput:r=!0,signal:o}={}){if("darwin"!==i.platform)throw Error("macOS only");let t={};o&&(t.signal=o);let{stdout:a}=await H("osascript",["-e",e,r?[]:["-ss"]],t);return a.trim()}async function _(e){return O(`tell application "Finder" to set app_path to application file id "${e}" as string
2
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}let I=d(l),$={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},W=new Map(Object.entries($));class N extends Error{}async function k(e=I){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),o=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!o)throw new N(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:t}=o.groups,a=t.lastIndexOf("."),i=t.lastIndexOf("-"),n=-1===a?void 0:t.slice(0,a),s=-1===i?void 0:t.slice(0,i);return $[t]??$[n]??$[s]??{name:t,id:t}}let U=d(l);async function R(){if("darwin"===i.platform){let e=await M();return{name:await _(e),id:e}}if("linux"===i.platform){let{stdout:e}=await U("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:r.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:r}}if("win32"===i.platform)return k();throw Error("Only macOS, Linux, and Windows are supported")}let z=!!(i.env.SSH_CONNECTION||i.env.SSH_CLIENT||i.env.SSH_TTY),j=Symbol("fallbackAttempt"),D=import.meta.url?n.dirname(s(import.meta.url)):"",G=n.join(D,"xdg-open"),{platform:K,arch:V}=i,Y=async(e,r)=>{if(0===e.length)return;let o=[];for(let t of e)try{return await r(t)}catch(e){o.push(e)}throw AggregateError(o,"Failed to open in all supported apps")},q=async e=>{let r,o=!0===(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e})[j];if(delete e[j],Array.isArray(e.app))return Y(e.app,r=>q({...e,app:r,[j]:!0}));let{name:t,arguments:a=[]}=e.app??{};if(a=[...a],Array.isArray(t))return Y(t,r=>q({...e,app:{name:r,arguments:a},[j]:!0}));if("browser"===t||"browserPrivate"===t){let r,o={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"};if(v){let e=await B();r=W.get(e)??{}}else r=await R();if(r.id in o){let i=o[r.id.toLowerCase()];if("browserPrivate"===t){if("safari"===i)throw Error("Safari doesn't support opening in private mode via command line");a.push({chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"}[i])}return q({...e,app:{name:Q[i],arguments:a}})}throw Error(`${r.name} is not supported as a default browser`)}let n=[],s={},l=!1;if(!v||w()||z||t||(l=await A()),"darwin"===K)r="open",e.wait&&n.push("--wait-apps"),e.background&&n.push("--background"),e.newInstance&&n.push("--new"),t&&n.push("-a",t);else if("win32"===K||l){r=await C(),n.push(...y.argumentsPrefix),v||(s.windowsVerbatimArguments=!0),v&&e.target&&(e.target=await L(e.target));let o=["$ProgressPreference = 'SilentlyContinue';","Start"];e.wait&&o.push("-Wait"),t?(o.push(y.escapeArgument(t)),e.target&&a.push(e.target)):e.target&&o.push(y.escapeArgument(e.target)),a.length>0&&o.push("-ArgumentList",(a=a.map(e=>y.escapeArgument(e))).join(",")),e.target=y.encodeCommand(o.join(" ")),e.wait||(s.stdio="ignore")}else{if(t)r=t;else{let e=!1;try{await m.access(G,p.X_OK),e=!0}catch{}r=i.versions.electron??("android"===K||!D||"/"===D||!e)?"xdg-open":G}a.length>0&&n.push(...a),e.wait||(s.stdio="ignore",s.detached=!0)}"darwin"===K&&a.length>0&&n.push("--args",...a),e.target&&n.push(e.target);let d=c.spawn(r,n,s);return e.wait?new Promise((r,o)=>{d.once("error",o),d.once("close",t=>{e.allowNonzeroExitCode||0===t?r(d):o(Error(`Exited with code ${t}`))})}):o?new Promise((e,r)=>{d.once("error",r),d.once("spawn",()=>{d.once("close",o=>{(d.off("error",r),0!==o)?r(Error(`Exited with code ${o}`)):(d.unref(),e(d))})})}):(d.unref(),new Promise((e,r)=>{d.once("error",r),d.once("spawn",()=>{d.off("error",r),e(d)})}))};function X(e){if("string"==typeof e||Array.isArray(e))return e;let{[V]:r}=e;if(!r)throw Error(`${V} is not supported`);return r}function J({[K]:e},{wsl:r}={}){if(r&&v)return X(r);if(!e)throw Error(`${K} is not supported`);return X(e)}let Q={browser:"browser",browserPrivate:"browserPrivate"};T(Q,"chrome",()=>J({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),T(Q,"brave",()=>J({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),T(Q,"firefox",()=>J({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),T(Q,"edge",()=>J({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),T(Q,"safari",()=>J({darwin:"Safari"}));export default((e,r)=>{if("string"!=typeof e)throw TypeError("Expected a `target`");return q({...r,target:e})});export{Q as apps};
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This file is used to get the global instance for html-plugin.
3
- */ import type { HtmlRspackPlugin, NormalizedEnvironmentConfig } from './types';
3
+ */ import type { HtmlRspackPlugin, NormalizedEnvironmentConfig } from './types/index.js';
4
4
  export declare function getHTMLPlugin(config?: NormalizedEnvironmentConfig): typeof HtmlRspackPlugin;
@@ -1,5 +1,5 @@
1
- import type { Logger } from './logger';
2
- import type { InternalContext, PluginManager, PluginMeta } from './types';
1
+ import type { Logger } from './logger.js';
2
+ import type { InternalContext, PluginManager, PluginMeta } from './types/index.js';
3
3
  /**
4
4
  * Determines whether the plugin is registered in the specified environment.
5
5
  * If the pluginEnvironment is undefined, it means it can match any environment.
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginAppIcon: () => RsbuildPlugin;
@@ -1,3 +1,3 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare function getRegExpForExts(exts: string[]): RegExp;
3
3
  export declare const pluginAsset: () => RsbuildPlugin;
@@ -1,4 +1,4 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  /**
3
3
  * Set some basic Rspack configs
4
4
  */ export declare const pluginBasic: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
+ export declare const pluginCache: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginCleanOutput: () => RsbuildPlugin;
@@ -1,4 +1,4 @@
1
- import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
1
+ import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types/index.js';
2
2
  export declare function getLightningCSSLoaderOptions(config: NormalizedEnvironmentConfig, targets: string[], minify: boolean): Promise<Rspack.LightningcssLoaderOptions>;
3
3
  // If the target is not `web` and the modules option of css-loader is enabled,
4
4
  // we must enable exportOnlyLocals to only exports the modules identifier mappings.
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginDefine: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
+ export declare const pluginEntry: () => RsbuildPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { Externals } from '@rspack/core';
2
- import { type PackageJson } from '../helpers/packageJson';
3
- import type { AutoExternal, RsbuildPlugin } from '../types';
2
+ import { type PackageJson } from '../helpers/packageJson.js';
3
+ import type { AutoExternal, RsbuildPlugin } from '../types/index.js';
4
4
  export declare const composeAutoExternalRules: (options: {
5
5
  autoExternal?: AutoExternal;
6
6
  pkgJson?: PackageJson;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * modified from https://github.com/facebook/create-react-app
3
3
  * license at https://github.com/facebook/create-react-app/blob/master/LICENSE
4
- */ import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types';
4
+ */ import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types/index.js';
5
5
  /** Normalize file path by removing hash for comparison across builds */ export declare function normalizeFilePath(filePath: string): string;
6
6
  /** Exclude source map, license, and type declaration files by default */ export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
7
7
  export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
@@ -1,4 +1,4 @@
1
- import type { InternalContext, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
1
+ import type { InternalContext, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types/index.js';
2
2
  export declare function getTemplate(entryName: string, config: NormalizedEnvironmentConfig, rootPath: string): Promise<{
3
3
  templatePath: string;
4
4
  templateContent?: string;
@@ -1,4 +1,4 @@
1
- import type { InlineChunkTest, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
1
+ import type { InlineChunkTest, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types/index.js';
2
2
  export declare function getInlineTests(config: NormalizedEnvironmentConfig): {
3
3
  scriptTests: InlineChunkTest[];
4
4
  styleTests: InlineChunkTest[];
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginLazyCompilation: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginManifest: () => RsbuildPlugin;
@@ -1,10 +1,10 @@
1
1
  import type { LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
2
- import type { NormalizedEnvironmentConfig, OneOrMany, RsbuildPlugin } from '../types';
2
+ import type { NormalizedEnvironmentConfig, OneOrMany, RsbuildPlugin } from '../types/index.js';
3
3
  export declare function getSwcMinimizerOptions(config: NormalizedEnvironmentConfig, jsOptions?: SwcJsMinimizerRspackPluginOptions): SwcJsMinimizerRspackPluginOptions;
4
4
  export declare function parseMinifyOptions(config: NormalizedEnvironmentConfig): {
5
5
  minifyJs: boolean;
6
6
  minifyCss: boolean;
7
7
  jsOptions?: OneOrMany<SwcJsMinimizerRspackPluginOptions>;
8
- cssOptions?: LightningCssMinimizerRspackPluginOptions;
8
+ cssOptions?: OneOrMany<LightningCssMinimizerRspackPluginOptions>;
9
9
  };
10
10
  export declare const pluginMinimize: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare function pluginModuleFederation(): RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginNodeAddons: () => RsbuildPlugin;
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
+ export declare const pluginNonce: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginOutput: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginProgress: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginResolve: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginResourceHints: () => RsbuildPlugin;
@@ -1,2 +1,2 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  export declare const pluginRsdoctor: () => RsbuildPlugin;
@@ -1,4 +1,4 @@
1
- import type { RsbuildPlugin } from '../types';
1
+ import type { RsbuildPlugin } from '../types/index.js';
2
2
  // Referenced from Rspack CLI
3
3
  // https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-cli/src/utils/profile.ts
4
4
  export declare const pluginRspackProfile: () => RsbuildPlugin;