@ohos-ports/rsbuild-core 1.1.14-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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/bin/rsbuild.js +20 -0
  4. package/compiled/chokidar/index.d.ts +345 -0
  5. package/compiled/chokidar/index.js +1778 -0
  6. package/compiled/chokidar/license +21 -0
  7. package/compiled/chokidar/package.json +1 -0
  8. package/compiled/connect/index.d.ts +90 -0
  9. package/compiled/connect/index.js +1240 -0
  10. package/compiled/connect/license +25 -0
  11. package/compiled/connect/package.json +1 -0
  12. package/compiled/connect-history-api-fallback/index.d.ts +1 -0
  13. package/compiled/connect-history-api-fallback/index.js +149 -0
  14. package/compiled/connect-history-api-fallback/license +21 -0
  15. package/compiled/connect-history-api-fallback/package.json +1 -0
  16. package/compiled/cors/index.d.ts +1 -0
  17. package/compiled/cors/index.js +371 -0
  18. package/compiled/cors/license +22 -0
  19. package/compiled/cors/package.json +1 -0
  20. package/compiled/css-loader/api.js +85 -0
  21. package/compiled/css-loader/getUrl.js +26 -0
  22. package/compiled/css-loader/index.d.ts +1 -0
  23. package/compiled/css-loader/index.js +8008 -0
  24. package/compiled/css-loader/license +20 -0
  25. package/compiled/css-loader/noSourceMaps.js +5 -0
  26. package/compiled/css-loader/package.json +1 -0
  27. package/compiled/css-loader/sourceMaps.js +16 -0
  28. package/compiled/html-rspack-plugin/default_index.ejs +9 -0
  29. package/compiled/html-rspack-plugin/index.d.ts +289 -0
  30. package/compiled/html-rspack-plugin/index.js +1583 -0
  31. package/compiled/html-rspack-plugin/license +20 -0
  32. package/compiled/html-rspack-plugin/loader.js +162 -0
  33. package/compiled/html-rspack-plugin/package.json +1 -0
  34. package/compiled/http-proxy-middleware/index.d.ts +318 -0
  35. package/compiled/http-proxy-middleware/index.js +5280 -0
  36. package/compiled/http-proxy-middleware/license +22 -0
  37. package/compiled/http-proxy-middleware/package.json +1 -0
  38. package/compiled/jiti/index.d.ts +1 -0
  39. package/compiled/jiti/index.js +416 -0
  40. package/compiled/jiti/license +21 -0
  41. package/compiled/jiti/package.json +1 -0
  42. package/compiled/launch-editor-middleware/index.d.ts +1 -0
  43. package/compiled/launch-editor-middleware/index.js +694 -0
  44. package/compiled/launch-editor-middleware/license +21 -0
  45. package/compiled/launch-editor-middleware/package.json +1 -0
  46. package/compiled/mrmime/index.d.ts +4 -0
  47. package/compiled/mrmime/index.js +452 -0
  48. package/compiled/mrmime/package.json +1 -0
  49. package/compiled/on-finished/index.d.ts +13 -0
  50. package/compiled/on-finished/index.js +197 -0
  51. package/compiled/on-finished/license +23 -0
  52. package/compiled/on-finished/package.json +1 -0
  53. package/compiled/open/index.d.ts +153 -0
  54. package/compiled/open/index.js +409 -0
  55. package/compiled/open/package.json +1 -0
  56. package/compiled/open/xdg-open +1066 -0
  57. package/compiled/picocolors/index.d.ts +55 -0
  58. package/compiled/picocolors/index.js +108 -0
  59. package/compiled/picocolors/license +15 -0
  60. package/compiled/picocolors/package.json +1 -0
  61. package/compiled/postcss/index.d.ts +1 -0
  62. package/compiled/postcss/index.js +5997 -0
  63. package/compiled/postcss/license +20 -0
  64. package/compiled/postcss/package.json +1 -0
  65. package/compiled/postcss-load-config/index.d.ts +1 -0
  66. package/compiled/postcss-load-config/index.js +739 -0
  67. package/compiled/postcss-load-config/license +20 -0
  68. package/compiled/postcss-load-config/package.json +1 -0
  69. package/compiled/postcss-loader/index.d.ts +1 -0
  70. package/compiled/postcss-loader/index.js +741 -0
  71. package/compiled/postcss-loader/license +20 -0
  72. package/compiled/postcss-loader/package.json +1 -0
  73. package/compiled/rsbuild-dev-middleware/index.d.ts +1 -0
  74. package/compiled/rsbuild-dev-middleware/index.js +6158 -0
  75. package/compiled/rsbuild-dev-middleware/license +20 -0
  76. package/compiled/rsbuild-dev-middleware/package.json +1 -0
  77. package/compiled/rslog/index.d.ts +66 -0
  78. package/compiled/rslog/index.js +334 -0
  79. package/compiled/rslog/license +21 -0
  80. package/compiled/rslog/package.json +1 -0
  81. package/compiled/rspack-chain/index.d.ts +611 -0
  82. package/compiled/rspack-chain/index.js +1740 -0
  83. package/compiled/rspack-chain/license +373 -0
  84. package/compiled/rspack-chain/package.json +1 -0
  85. package/compiled/rspack-manifest-plugin/index.d.ts +44 -0
  86. package/compiled/rspack-manifest-plugin/index.js +394 -0
  87. package/compiled/rspack-manifest-plugin/license +21 -0
  88. package/compiled/rspack-manifest-plugin/package.json +1 -0
  89. package/compiled/sirv/index.d.ts +1 -0
  90. package/compiled/sirv/index.js +709 -0
  91. package/compiled/sirv/package.json +1 -0
  92. package/compiled/style-loader/index.d.ts +1 -0
  93. package/compiled/style-loader/index.js +427 -0
  94. package/compiled/style-loader/license +20 -0
  95. package/compiled/style-loader/package.json +1 -0
  96. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  97. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  98. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  99. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  100. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  101. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  102. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  103. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  104. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  105. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  106. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  107. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  108. package/compiled/tinyglobby/index.d.ts +25 -0
  109. package/compiled/tinyglobby/index.js +2749 -0
  110. package/compiled/tinyglobby/index1.js +17 -0
  111. package/compiled/tinyglobby/license +21 -0
  112. package/compiled/tinyglobby/package.json +1 -0
  113. package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
  114. package/compiled/webpack-bundle-analyzer/index.js +13480 -0
  115. package/compiled/webpack-bundle-analyzer/license +20 -0
  116. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  117. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  118. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  119. package/compiled/webpack-merge/index.d.ts +31 -0
  120. package/compiled/webpack-merge/index.js +1200 -0
  121. package/compiled/webpack-merge/license +20 -0
  122. package/compiled/webpack-merge/package.json +1 -0
  123. package/compiled/ws/index.d.ts +401 -0
  124. package/compiled/ws/index.js +3153 -0
  125. package/compiled/ws/license +20 -0
  126. package/compiled/ws/package.json +1 -0
  127. package/dist/client/hmr.js +143 -0
  128. package/dist/client/overlay.js +210 -0
  129. package/dist/ignoreCssLoader.mjs +4 -0
  130. package/dist/index.cjs +7251 -0
  131. package/dist/index.js +7118 -0
  132. package/dist/transformLoader.mjs +22 -0
  133. package/dist/transformRawLoader.mjs +22 -0
  134. package/dist-types/cli/commands.d.ts +23 -0
  135. package/dist-types/cli/index.d.ts +1 -0
  136. package/dist-types/cli/init.d.ts +7 -0
  137. package/dist-types/cli/prepare.d.ts +1 -0
  138. package/dist-types/client/hmr.d.ts +1 -0
  139. package/dist-types/client/overlay.d.ts +1 -0
  140. package/dist-types/config.d.ts +90 -0
  141. package/dist-types/configChain.d.ts +139 -0
  142. package/dist-types/constants.d.ts +37 -0
  143. package/dist-types/createContext.d.ts +11 -0
  144. package/dist-types/createRsbuild.d.ts +2 -0
  145. package/dist-types/helpers/format.d.ts +5 -0
  146. package/dist-types/helpers/fs.d.ts +13 -0
  147. package/dist-types/helpers/index.d.ts +47 -0
  148. package/dist-types/helpers/path.d.ts +11 -0
  149. package/dist-types/helpers/stats.d.ts +9 -0
  150. package/dist-types/hooks.d.ts +48 -0
  151. package/dist-types/index.d.ts +26 -0
  152. package/dist-types/initPlugins.d.ts +6 -0
  153. package/dist-types/internal.d.ts +6 -0
  154. package/dist-types/loadEnv.d.ts +50 -0
  155. package/dist-types/loader/ignoreCssLoader.d.ts +2 -0
  156. package/dist-types/loader/transformLoader.d.ts +7 -0
  157. package/dist-types/loader/transformRawLoader.d.ts +3 -0
  158. package/dist-types/logger.d.ts +4 -0
  159. package/dist-types/mergeConfig.d.ts +2 -0
  160. package/dist-types/package.json +1 -0
  161. package/dist-types/pluginHelper.d.ts +12 -0
  162. package/dist-types/pluginManager.d.ts +9 -0
  163. package/dist-types/plugins/appIcon.d.ts +2 -0
  164. package/dist-types/plugins/asset.d.ts +3 -0
  165. package/dist-types/plugins/basic.d.ts +5 -0
  166. package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
  167. package/dist-types/plugins/cache.d.ts +2 -0
  168. package/dist-types/plugins/cleanOutput.d.ts +3 -0
  169. package/dist-types/plugins/css.d.ts +3 -0
  170. package/dist-types/plugins/define.d.ts +2 -0
  171. package/dist-types/plugins/entry.d.ts +2 -0
  172. package/dist-types/plugins/externals.d.ts +2 -0
  173. package/dist-types/plugins/fileSize.d.ts +4 -0
  174. package/dist-types/plugins/html.d.ts +9 -0
  175. package/dist-types/plugins/inlineChunk.d.ts +2 -0
  176. package/dist-types/plugins/lazyCompilation.d.ts +2 -0
  177. package/dist-types/plugins/manifest.d.ts +2 -0
  178. package/dist-types/plugins/minimize.d.ts +10 -0
  179. package/dist-types/plugins/moduleFederation.d.ts +2 -0
  180. package/dist-types/plugins/moment.d.ts +2 -0
  181. package/dist-types/plugins/nodeAddons.d.ts +2 -0
  182. package/dist-types/plugins/nonce.d.ts +2 -0
  183. package/dist-types/plugins/output.d.ts +2 -0
  184. package/dist-types/plugins/performance.d.ts +5 -0
  185. package/dist-types/plugins/progress.d.ts +2 -0
  186. package/dist-types/plugins/resolve.d.ts +2 -0
  187. package/dist-types/plugins/resourceHints.d.ts +2 -0
  188. package/dist-types/plugins/rsdoctor.d.ts +2 -0
  189. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  190. package/dist-types/plugins/server.d.ts +2 -0
  191. package/dist-types/plugins/splitChunks.d.ts +4 -0
  192. package/dist-types/plugins/sri.d.ts +2 -0
  193. package/dist-types/plugins/swc.d.ts +7 -0
  194. package/dist-types/plugins/target.d.ts +2 -0
  195. package/dist-types/plugins/wasm.d.ts +2 -0
  196. package/dist-types/provider/build.d.ts +3 -0
  197. package/dist-types/provider/createCompiler.d.ts +27 -0
  198. package/dist-types/provider/helpers.d.ts +12 -0
  199. package/dist-types/provider/initConfigs.d.ts +10 -0
  200. package/dist-types/provider/inspectConfig.d.ts +6 -0
  201. package/dist-types/provider/provider.d.ts +2 -0
  202. package/dist-types/provider/rspackConfig.d.ts +8 -0
  203. package/dist-types/rspack/RsbuildHtmlPlugin.d.ts +37 -0
  204. package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +29 -0
  205. package/dist-types/rspack/preload/helpers/determineAsValue.d.ts +22 -0
  206. package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +29 -0
  207. package/dist-types/rspack/preload/helpers/extractChunks.d.ts +28 -0
  208. package/dist-types/rspack/preload/helpers/index.d.ts +4 -0
  209. package/dist-types/rspack/preload/helpers/type.d.ts +13 -0
  210. package/dist-types/server/ansiHTML.d.ts +12 -0
  211. package/dist-types/server/cliShortcuts.d.ts +10 -0
  212. package/dist-types/server/compilerDevMiddleware.d.ts +31 -0
  213. package/dist-types/server/devMiddleware.d.ts +27 -0
  214. package/dist-types/server/devServer.d.ts +60 -0
  215. package/dist-types/server/environment.d.ts +8 -0
  216. package/dist-types/server/getDevMiddlewares.d.ts +25 -0
  217. package/dist-types/server/gzipMiddleware.d.ts +4 -0
  218. package/dist-types/server/helper.d.ts +71 -0
  219. package/dist-types/server/httpServer.d.ts +8 -0
  220. package/dist-types/server/middlewares.d.ts +34 -0
  221. package/dist-types/server/open.d.ts +10 -0
  222. package/dist-types/server/prodServer.d.ts +25 -0
  223. package/dist-types/server/proxy.d.ts +6 -0
  224. package/dist-types/server/restart.d.ts +14 -0
  225. package/dist-types/server/runner/asModule.d.ts +2 -0
  226. package/dist-types/server/runner/basic.d.ts +25 -0
  227. package/dist-types/server/runner/cjs.d.ts +10 -0
  228. package/dist-types/server/runner/esm.d.ts +6 -0
  229. package/dist-types/server/runner/index.d.ts +8 -0
  230. package/dist-types/server/runner/type.d.ts +36 -0
  231. package/dist-types/server/socketServer.d.ts +26 -0
  232. package/dist-types/server/watchFiles.d.ts +14 -0
  233. package/dist-types/types/config.d.ts +1309 -0
  234. package/dist-types/types/context.d.ts +52 -0
  235. package/dist-types/types/hooks.d.ts +146 -0
  236. package/dist-types/types/index.d.ts +8 -0
  237. package/dist-types/types/plugin.d.ts +329 -0
  238. package/dist-types/types/rsbuild.d.ts +156 -0
  239. package/dist-types/types/rspack.d.ts +16 -0
  240. package/dist-types/types/thirdParty.d.ts +176 -0
  241. package/dist-types/types/utils.d.ts +12 -0
  242. package/package.json +61 -0
  243. package/static/openChrome.applescript +95 -0
  244. package/types.d.ts +221 -0
@@ -0,0 +1,409 @@
1
+ (() => {
2
+ var __webpack_modules__ = {
3
+ 104: (module) => {
4
+ "use strict";
5
+ module.exports = (object, propertyName, fn) => {
6
+ const define = (value) =>
7
+ Object.defineProperty(object, propertyName, {
8
+ value,
9
+ enumerable: true,
10
+ writable: true,
11
+ });
12
+ Object.defineProperty(object, propertyName, {
13
+ configurable: true,
14
+ enumerable: true,
15
+ get() {
16
+ const result = fn();
17
+ define(result);
18
+ return result;
19
+ },
20
+ set(value) {
21
+ define(value);
22
+ },
23
+ });
24
+ return object;
25
+ };
26
+ },
27
+ 669: (module, __unused_webpack_exports, __nccwpck_require__) => {
28
+ "use strict";
29
+ const fs = __nccwpck_require__(147);
30
+ let isDocker;
31
+ function hasDockerEnv() {
32
+ try {
33
+ fs.statSync("/.dockerenv");
34
+ return true;
35
+ } catch (_) {
36
+ return false;
37
+ }
38
+ }
39
+ function hasDockerCGroup() {
40
+ try {
41
+ return fs
42
+ .readFileSync("/proc/self/cgroup", "utf8")
43
+ .includes("docker");
44
+ } catch (_) {
45
+ return false;
46
+ }
47
+ }
48
+ module.exports = () => {
49
+ if (isDocker === undefined) {
50
+ isDocker = hasDockerEnv() || hasDockerCGroup();
51
+ }
52
+ return isDocker;
53
+ };
54
+ },
55
+ 729: (module, __unused_webpack_exports, __nccwpck_require__) => {
56
+ "use strict";
57
+ const os = __nccwpck_require__(37);
58
+ const fs = __nccwpck_require__(147);
59
+ const isDocker = __nccwpck_require__(669);
60
+ const isWsl = () => {
61
+ if (process.platform !== "linux") {
62
+ return false;
63
+ }
64
+ if (os.release().toLowerCase().includes("microsoft")) {
65
+ if (isDocker()) {
66
+ return false;
67
+ }
68
+ return true;
69
+ }
70
+ try {
71
+ return fs
72
+ .readFileSync("/proc/version", "utf8")
73
+ .toLowerCase()
74
+ .includes("microsoft")
75
+ ? !isDocker()
76
+ : false;
77
+ } catch (_) {
78
+ return false;
79
+ }
80
+ };
81
+ if (process.env.__IS_WSL_TEST__) {
82
+ module.exports = isWsl;
83
+ } else {
84
+ module.exports = isWsl();
85
+ }
86
+ },
87
+ 913: (module, __unused_webpack_exports, __nccwpck_require__) => {
88
+ const path = __nccwpck_require__(17);
89
+ const childProcess = __nccwpck_require__(81);
90
+ const { promises: fs, constants: fsConstants } = __nccwpck_require__(147);
91
+ const isWsl = __nccwpck_require__(729);
92
+ const isDocker = __nccwpck_require__(669);
93
+ const defineLazyProperty = __nccwpck_require__(104);
94
+ const localXdgOpenPath = __nccwpck_require__.ab + "xdg-open";
95
+ const { platform, arch } = process;
96
+ const hasContainerEnv = () => {
97
+ try {
98
+ fs.statSync("/run/.containerenv");
99
+ return true;
100
+ } catch {
101
+ return false;
102
+ }
103
+ };
104
+ let cachedResult;
105
+ function isInsideContainer() {
106
+ if (cachedResult === undefined) {
107
+ cachedResult = hasContainerEnv() || isDocker();
108
+ }
109
+ return cachedResult;
110
+ }
111
+ const getWslDrivesMountPoint = (() => {
112
+ const defaultMountPoint = "/mnt/";
113
+ let mountPoint;
114
+ return async function () {
115
+ if (mountPoint) {
116
+ return mountPoint;
117
+ }
118
+ const configFilePath = "/etc/wsl.conf";
119
+ let isConfigFileExists = false;
120
+ try {
121
+ await fs.access(configFilePath, fsConstants.F_OK);
122
+ isConfigFileExists = true;
123
+ } catch {}
124
+ if (!isConfigFileExists) {
125
+ return defaultMountPoint;
126
+ }
127
+ const configContent = await fs.readFile(configFilePath, {
128
+ encoding: "utf8",
129
+ });
130
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(
131
+ configContent,
132
+ );
133
+ if (!configMountPoint) {
134
+ return defaultMountPoint;
135
+ }
136
+ mountPoint = configMountPoint.groups.mountPoint.trim();
137
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
138
+ return mountPoint;
139
+ };
140
+ })();
141
+ const pTryEach = async (array, mapper) => {
142
+ let latestError;
143
+ for (const item of array) {
144
+ try {
145
+ return await mapper(item);
146
+ } catch (error) {
147
+ latestError = error;
148
+ }
149
+ }
150
+ throw latestError;
151
+ };
152
+ const baseOpen = async (options) => {
153
+ options = {
154
+ wait: false,
155
+ background: false,
156
+ newInstance: false,
157
+ allowNonzeroExitCode: false,
158
+ ...options,
159
+ };
160
+ if (Array.isArray(options.app)) {
161
+ return pTryEach(options.app, (singleApp) =>
162
+ baseOpen({ ...options, app: singleApp }),
163
+ );
164
+ }
165
+ let { name: app, arguments: appArguments = [] } = options.app || {};
166
+ appArguments = [...appArguments];
167
+ if (Array.isArray(app)) {
168
+ return pTryEach(app, (appName) =>
169
+ baseOpen({
170
+ ...options,
171
+ app: { name: appName, arguments: appArguments },
172
+ }),
173
+ );
174
+ }
175
+ let command;
176
+ const cliArguments = [];
177
+ const childProcessOptions = {};
178
+ if (platform === "darwin") {
179
+ command = "open";
180
+ if (options.wait) {
181
+ cliArguments.push("--wait-apps");
182
+ }
183
+ if (options.background) {
184
+ cliArguments.push("--background");
185
+ }
186
+ if (options.newInstance) {
187
+ cliArguments.push("--new");
188
+ }
189
+ if (app) {
190
+ cliArguments.push("-a", app);
191
+ }
192
+ } else if (
193
+ platform === "win32" ||
194
+ (isWsl && !isInsideContainer() && !app)
195
+ ) {
196
+ const mountPoint = await getWslDrivesMountPoint();
197
+ command = isWsl
198
+ ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`
199
+ : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
200
+ cliArguments.push(
201
+ "-NoProfile",
202
+ "-NonInteractive",
203
+ "–ExecutionPolicy",
204
+ "Bypass",
205
+ "-EncodedCommand",
206
+ );
207
+ if (!isWsl) {
208
+ childProcessOptions.windowsVerbatimArguments = true;
209
+ }
210
+ const encodedArguments = ["Start"];
211
+ if (options.wait) {
212
+ encodedArguments.push("-Wait");
213
+ }
214
+ if (app) {
215
+ encodedArguments.push(`"\`"${app}\`""`, "-ArgumentList");
216
+ if (options.target) {
217
+ appArguments.unshift(options.target);
218
+ }
219
+ } else if (options.target) {
220
+ encodedArguments.push(`"${options.target}"`);
221
+ }
222
+ if (appArguments.length > 0) {
223
+ appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
224
+ encodedArguments.push(appArguments.join(","));
225
+ }
226
+ options.target = Buffer.from(
227
+ encodedArguments.join(" "),
228
+ "utf16le",
229
+ ).toString("base64");
230
+ } else {
231
+ if (app) {
232
+ command = app;
233
+ } else {
234
+ const isBundled = !__dirname || __dirname === "/";
235
+ let exeLocalXdgOpen = false;
236
+ try {
237
+ await fs.access(
238
+ __nccwpck_require__.ab + "xdg-open",
239
+ fsConstants.X_OK,
240
+ );
241
+ exeLocalXdgOpen = true;
242
+ } catch {}
243
+ const useSystemXdgOpen =
244
+ process.versions.electron ||
245
+ platform === "android" ||
246
+ isBundled ||
247
+ !exeLocalXdgOpen;
248
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
249
+ }
250
+ if (appArguments.length > 0) {
251
+ cliArguments.push(...appArguments);
252
+ }
253
+ if (!options.wait) {
254
+ childProcessOptions.stdio = "ignore";
255
+ childProcessOptions.detached = true;
256
+ }
257
+ }
258
+ if (options.target) {
259
+ cliArguments.push(options.target);
260
+ }
261
+ if (platform === "darwin" && appArguments.length > 0) {
262
+ cliArguments.push("--args", ...appArguments);
263
+ }
264
+ const subprocess = childProcess.spawn(
265
+ command,
266
+ cliArguments,
267
+ childProcessOptions,
268
+ );
269
+ if (options.wait) {
270
+ return new Promise((resolve, reject) => {
271
+ subprocess.once("error", reject);
272
+ subprocess.once("close", (exitCode) => {
273
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
274
+ reject(new Error(`Exited with code ${exitCode}`));
275
+ return;
276
+ }
277
+ resolve(subprocess);
278
+ });
279
+ });
280
+ }
281
+ subprocess.unref();
282
+ return subprocess;
283
+ };
284
+ const open = (target, options) => {
285
+ if (typeof target !== "string") {
286
+ throw new TypeError("Expected a `target`");
287
+ }
288
+ return baseOpen({ ...options, target });
289
+ };
290
+ const openApp = (name, options) => {
291
+ if (typeof name !== "string") {
292
+ throw new TypeError("Expected a `name`");
293
+ }
294
+ const { arguments: appArguments = [] } = options || {};
295
+ if (
296
+ appArguments !== undefined &&
297
+ appArguments !== null &&
298
+ !Array.isArray(appArguments)
299
+ ) {
300
+ throw new TypeError("Expected `appArguments` as Array type");
301
+ }
302
+ return baseOpen({ ...options, app: { name, arguments: appArguments } });
303
+ };
304
+ function detectArchBinary(binary) {
305
+ if (typeof binary === "string" || Array.isArray(binary)) {
306
+ return binary;
307
+ }
308
+ const { [arch]: archBinary } = binary;
309
+ if (!archBinary) {
310
+ throw new Error(`${arch} is not supported`);
311
+ }
312
+ return archBinary;
313
+ }
314
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
315
+ if (wsl && isWsl) {
316
+ return detectArchBinary(wsl);
317
+ }
318
+ if (!platformBinary) {
319
+ throw new Error(`${platform} is not supported`);
320
+ }
321
+ return detectArchBinary(platformBinary);
322
+ }
323
+ const apps = {};
324
+ defineLazyProperty(apps, "chrome", () =>
325
+ detectPlatformBinary(
326
+ {
327
+ darwin: "google chrome",
328
+ win32: "chrome",
329
+ linux: ["google-chrome", "google-chrome-stable", "chromium"],
330
+ },
331
+ {
332
+ wsl: {
333
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
334
+ x64: [
335
+ "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe",
336
+ "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
337
+ ],
338
+ },
339
+ },
340
+ ),
341
+ );
342
+ defineLazyProperty(apps, "firefox", () =>
343
+ detectPlatformBinary(
344
+ {
345
+ darwin: "firefox",
346
+ win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
347
+ linux: "firefox",
348
+ },
349
+ { wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" },
350
+ ),
351
+ );
352
+ defineLazyProperty(apps, "edge", () =>
353
+ detectPlatformBinary(
354
+ {
355
+ darwin: "microsoft edge",
356
+ win32: "msedge",
357
+ linux: ["microsoft-edge", "microsoft-edge-dev"],
358
+ },
359
+ {
360
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
361
+ },
362
+ ),
363
+ );
364
+ open.apps = apps;
365
+ open.openApp = openApp;
366
+ module.exports = open;
367
+ },
368
+ 81: (module) => {
369
+ "use strict";
370
+ module.exports = require("child_process");
371
+ },
372
+ 147: (module) => {
373
+ "use strict";
374
+ module.exports = require("fs");
375
+ },
376
+ 37: (module) => {
377
+ "use strict";
378
+ module.exports = require("os");
379
+ },
380
+ 17: (module) => {
381
+ "use strict";
382
+ module.exports = require("path");
383
+ },
384
+ };
385
+ var __webpack_module_cache__ = {};
386
+ function __nccwpck_require__(moduleId) {
387
+ var cachedModule = __webpack_module_cache__[moduleId];
388
+ if (cachedModule !== undefined) {
389
+ return cachedModule.exports;
390
+ }
391
+ var module = (__webpack_module_cache__[moduleId] = { exports: {} });
392
+ var threw = true;
393
+ try {
394
+ __webpack_modules__[moduleId](
395
+ module,
396
+ module.exports,
397
+ __nccwpck_require__,
398
+ );
399
+ threw = false;
400
+ } finally {
401
+ if (threw) delete __webpack_module_cache__[moduleId];
402
+ }
403
+ return module.exports;
404
+ }
405
+ if (typeof __nccwpck_require__ !== "undefined")
406
+ __nccwpck_require__.ab = __dirname + "/";
407
+ var __webpack_exports__ = __nccwpck_require__(913);
408
+ module.exports = __webpack_exports__;
409
+ })();
@@ -0,0 +1 @@
1
+ {"name":"open","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"version":"8.4.2","funding":"https://github.com/sponsors/sindresorhus","license":"MIT","types":"index.d.ts","type":"commonjs"}