@ohos-ports/rsbuild-core 2.2.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/rsbuild.js +20 -0
  4. package/compiled/@rstackjs/load-config/index.d.ts +87 -0
  5. package/compiled/@rstackjs/load-config/license +21 -0
  6. package/compiled/@rstackjs/load-config/package.json +1 -0
  7. package/compiled/chokidar/index.d.ts +385 -0
  8. package/compiled/chokidar/license +21 -0
  9. package/compiled/chokidar/package.json +1 -0
  10. package/compiled/connect-next/index.d.ts +57 -0
  11. package/compiled/connect-next/license +26 -0
  12. package/compiled/connect-next/package.json +1 -0
  13. package/compiled/cors/index.d.ts +56 -0
  14. package/compiled/cors/license +22 -0
  15. package/compiled/cors/package.json +1 -0
  16. package/compiled/css-loader/api.js +85 -0
  17. package/compiled/css-loader/getUrl.js +26 -0
  18. package/compiled/css-loader/index.d.ts +1 -0
  19. package/compiled/css-loader/index.js +2 -0
  20. package/compiled/css-loader/license +20 -0
  21. package/compiled/css-loader/noSourceMaps.js +5 -0
  22. package/compiled/css-loader/package.json +1 -0
  23. package/compiled/css-loader/sourceMaps.js +16 -0
  24. package/compiled/html-rspack-plugin/default_index.ejs +9 -0
  25. package/compiled/html-rspack-plugin/htmlLoader.js +157 -0
  26. package/compiled/html-rspack-plugin/index.d.ts +395 -0
  27. package/compiled/html-rspack-plugin/index.js +2400 -0
  28. package/compiled/html-rspack-plugin/license +20 -0
  29. package/compiled/html-rspack-plugin/package.json +1 -0
  30. package/compiled/http-proxy-middleware/index.d.ts +455 -0
  31. package/compiled/http-proxy-middleware/license +22 -0
  32. package/compiled/http-proxy-middleware/package.json +1 -0
  33. package/compiled/jiti/LICENSE +21 -0
  34. package/compiled/jiti/README.md +258 -0
  35. package/compiled/jiti/dist/babel.cjs +47446 -0
  36. package/compiled/jiti/dist/jiti.cjs +5990 -0
  37. package/compiled/jiti/lib/jiti-cli.mjs +19 -0
  38. package/compiled/jiti/lib/jiti-hooks.mjs +89 -0
  39. package/compiled/jiti/lib/jiti-native.mjs +76 -0
  40. package/compiled/jiti/lib/jiti-register.d.mts +1 -0
  41. package/compiled/jiti/lib/jiti-register.mjs +2 -0
  42. package/compiled/jiti/lib/jiti-static.mjs +19 -0
  43. package/compiled/jiti/lib/jiti.cjs +24 -0
  44. package/compiled/jiti/lib/jiti.d.cts +8 -0
  45. package/compiled/jiti/lib/jiti.d.mts +8 -0
  46. package/compiled/jiti/lib/jiti.mjs +23 -0
  47. package/compiled/jiti/lib/types.d.ts +420 -0
  48. package/compiled/jiti/package.json +146 -0
  49. package/compiled/postcss/index.js +1 -0
  50. package/compiled/postcss/lib/at-rule.d.ts +139 -0
  51. package/compiled/postcss/lib/comment.d.ts +67 -0
  52. package/compiled/postcss/lib/container.d.ts +474 -0
  53. package/compiled/postcss/lib/css-syntax-error.d.ts +247 -0
  54. package/compiled/postcss/lib/declaration.d.ts +150 -0
  55. package/compiled/postcss/lib/document.d.ts +68 -0
  56. package/compiled/postcss/lib/fromJSON.d.ts +9 -0
  57. package/compiled/postcss/lib/input.d.ts +226 -0
  58. package/compiled/postcss/lib/lazy-result.d.ts +189 -0
  59. package/compiled/postcss/lib/list.d.ts +60 -0
  60. package/compiled/postcss/lib/no-work-result.d.ts +45 -0
  61. package/compiled/postcss/lib/node.d.ts +555 -0
  62. package/compiled/postcss/lib/parse.d.ts +9 -0
  63. package/compiled/postcss/lib/postcss.d.ts +464 -0
  64. package/compiled/postcss/lib/previous-map.d.ts +80 -0
  65. package/compiled/postcss/lib/processor.d.ts +114 -0
  66. package/compiled/postcss/lib/result.d.ts +204 -0
  67. package/compiled/postcss/lib/root.d.ts +86 -0
  68. package/compiled/postcss/lib/rule.d.ts +126 -0
  69. package/compiled/postcss/lib/source-map-js.d.ts +4 -0
  70. package/compiled/postcss/lib/stringifier.d.ts +45 -0
  71. package/compiled/postcss/lib/stringify.d.ts +9 -0
  72. package/compiled/postcss/lib/warning.d.ts +146 -0
  73. package/compiled/postcss/license +20 -0
  74. package/compiled/postcss/package.json +1 -0
  75. package/compiled/postcss-loader/index.d.ts +1 -0
  76. package/compiled/postcss-loader/index.js +721 -0
  77. package/compiled/postcss-loader/license +20 -0
  78. package/compiled/postcss-loader/package.json +1 -0
  79. package/compiled/rslog/index.d.ts +98 -0
  80. package/compiled/rslog/license +21 -0
  81. package/compiled/rslog/package.json +1 -0
  82. package/compiled/rspack-chain/license +22 -0
  83. package/compiled/rspack-chain/package.json +1 -0
  84. package/compiled/rspack-chain/types/index.d.ts +515 -0
  85. package/compiled/rspack-manifest-plugin/index.d.ts +52 -0
  86. package/compiled/rspack-manifest-plugin/license +21 -0
  87. package/compiled/rspack-manifest-plugin/package.json +1 -0
  88. package/compiled/style-loader/index.d.ts +1 -0
  89. package/compiled/style-loader/index.js +370 -0
  90. package/compiled/style-loader/license +20 -0
  91. package/compiled/style-loader/package.json +1 -0
  92. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  93. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  94. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  95. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  96. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  97. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  98. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  99. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  100. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  101. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  102. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  103. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  104. package/compiled/ws/index.d.ts +445 -0
  105. package/compiled/ws/license +21 -0
  106. package/compiled/ws/package.json +1 -0
  107. package/dist/build.d.ts +4 -0
  108. package/dist/c.js +10 -0
  109. package/dist/chokidar.js +2 -0
  110. package/dist/chokidar.js.LICENSE.txt +1 -0
  111. package/dist/cli/commands.d.ts +31 -0
  112. package/dist/cli/index.d.ts +7 -0
  113. package/dist/cli/init.d.ts +7 -0
  114. package/dist/client/f~0.js +22 -0
  115. package/dist/client/hmr.js +267 -0
  116. package/dist/client/overlay.js +214 -0
  117. package/dist/configChain.d.ts +84 -0
  118. package/dist/connect-next.js +2 -0
  119. package/dist/connect-next.js.LICENSE.txt +57 -0
  120. package/dist/constants.d.ts +67 -0
  121. package/dist/cors.js +188 -0
  122. package/dist/cors.js.LICENSE.txt +11 -0
  123. package/dist/createCompiler.d.ts +6 -0
  124. package/dist/createContext.d.ts +12 -0
  125. package/dist/createRsbuild.d.ts +4 -0
  126. package/dist/cssUrlLoader.mjs +34 -0
  127. package/dist/defaultConfig.d.ts +23 -0
  128. package/dist/freshImport.js +90 -0
  129. package/dist/helpers/cachedImport.d.ts +2 -0
  130. package/dist/helpers/compiler.d.ts +5 -0
  131. package/dist/helpers/css.d.ts +3 -0
  132. package/dist/helpers/exitHook.d.ts +3 -0
  133. package/dist/helpers/format.d.ts +4 -0
  134. package/dist/helpers/fs.d.ts +16 -0
  135. package/dist/helpers/html.d.ts +2 -0
  136. package/dist/helpers/index.d.ts +29 -0
  137. package/dist/helpers/overlayConfig.d.ts +4 -0
  138. package/dist/helpers/packageJson.d.ts +9 -0
  139. package/dist/helpers/path.d.ts +22 -0
  140. package/dist/helpers/restartManager.d.ts +15 -0
  141. package/dist/helpers/stats.d.ts +17 -0
  142. package/dist/helpers/url.d.ts +11 -0
  143. package/dist/helpers/vendors.d.ts +12 -0
  144. package/dist/helpers/version.d.ts +7 -0
  145. package/dist/hooks.d.ts +41 -0
  146. package/dist/http-proxy-middleware.js +14 -0
  147. package/dist/http-proxy-middleware.js.LICENSE.txt +34 -0
  148. package/dist/ignoreCssLoader.mjs +9 -0
  149. package/dist/index.d.ts +28 -0
  150. package/dist/index.js +1 -0
  151. package/dist/initConfigs.d.ts +18 -0
  152. package/dist/initPlugins.d.ts +7 -0
  153. package/dist/inspectConfig.d.ts +7 -0
  154. package/dist/launch-editor-middleware.js +1 -0
  155. package/dist/loadConfig.d.ts +31 -0
  156. package/dist/loadEnv.d.ts +54 -0
  157. package/dist/loader/cssUrlLoader.d.ts +9 -0
  158. package/dist/loader/ignoreCssLoader.d.ts +10 -0
  159. package/dist/loader/transformLoader.d.ts +8 -0
  160. package/dist/loader/transformRawLoader.d.ts +4 -0
  161. package/dist/loader/workerLoader.d.ts +6 -0
  162. package/dist/logger.d.ts +24 -0
  163. package/dist/m.js +10348 -0
  164. package/dist/m.js.LICENSE.txt +26 -0
  165. package/dist/manifest-plugin.js +1 -0
  166. package/dist/memfs.js +1 -0
  167. package/dist/mergeConfig.d.ts +7 -0
  168. package/dist/open.js +2 -0
  169. package/dist/pluginHelper.d.ts +4 -0
  170. package/dist/pluginManager.d.ts +19 -0
  171. package/dist/plugins/appIcon.d.ts +2 -0
  172. package/dist/plugins/asset.d.ts +3 -0
  173. package/dist/plugins/basic.d.ts +4 -0
  174. package/dist/plugins/cache.d.ts +2 -0
  175. package/dist/plugins/cleanOutput.d.ts +2 -0
  176. package/dist/plugins/css.d.ts +8 -0
  177. package/dist/plugins/define.d.ts +2 -0
  178. package/dist/plugins/entry.d.ts +2 -0
  179. package/dist/plugins/externals.d.ts +9 -0
  180. package/dist/plugins/fileSize.d.ts +7 -0
  181. package/dist/plugins/html.d.ts +9 -0
  182. package/dist/plugins/inlineChunk.d.ts +6 -0
  183. package/dist/plugins/lazyCompilation.d.ts +2 -0
  184. package/dist/plugins/manifest.d.ts +2 -0
  185. package/dist/plugins/minimize.d.ts +10 -0
  186. package/dist/plugins/moduleFederation.d.ts +2 -0
  187. package/dist/plugins/nodeAddons.d.ts +2 -0
  188. package/dist/plugins/nonce.d.ts +2 -0
  189. package/dist/plugins/output.d.ts +2 -0
  190. package/dist/plugins/progress.d.ts +2 -0
  191. package/dist/plugins/resolve.d.ts +2 -0
  192. package/dist/plugins/resourceHints.d.ts +2 -0
  193. package/dist/plugins/rsdoctor.d.ts +2 -0
  194. package/dist/plugins/rspackProfile.d.ts +4 -0
  195. package/dist/plugins/server.d.ts +3 -0
  196. package/dist/plugins/sourceMap.d.ts +2 -0
  197. package/dist/plugins/splitChunks.d.ts +4 -0
  198. package/dist/plugins/sri.d.ts +2 -0
  199. package/dist/plugins/swc.d.ts +4 -0
  200. package/dist/plugins/target.d.ts +2 -0
  201. package/dist/plugins/wasm.d.ts +2 -0
  202. package/dist/plugins/worker.d.ts +2 -0
  203. package/dist/r.js +7 -0
  204. package/dist/range-parser.js +55 -0
  205. package/dist/range-parser.js.LICENSE.txt +6 -0
  206. package/dist/remapping.js +201 -0
  207. package/dist/restart.d.ts +15 -0
  208. package/dist/rslib-runtime.js +49 -0
  209. package/dist/rspack-plugins/RsbuildHtmlPlugin.d.ts +37 -0
  210. package/dist/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +36 -0
  211. package/dist/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +27 -0
  212. package/dist/rspack-plugins/resource-hints/extractChunks.d.ts +22 -0
  213. package/dist/rspack-plugins/resource-hints/getResourceType.d.ts +21 -0
  214. package/dist/rspackConfig.d.ts +8 -0
  215. package/dist/server/ansiHTML.d.ts +3 -0
  216. package/dist/server/assets-middleware/getFileFromUrl.d.ts +11 -0
  217. package/dist/server/assets-middleware/index.d.ts +35 -0
  218. package/dist/server/assets-middleware/memoryFileSystem.d.ts +2 -0
  219. package/dist/server/assets-middleware/middleware.d.ts +7 -0
  220. package/dist/server/assets-middleware/parseTokenList.d.ts +1 -0
  221. package/dist/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
  222. package/dist/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
  223. package/dist/server/browserLogs.d.ts +8 -0
  224. package/dist/server/buildManager.d.ts +32 -0
  225. package/dist/server/cliShortcuts.d.ts +19 -0
  226. package/dist/server/compileState.d.ts +5 -0
  227. package/dist/server/devMiddlewares.d.ts +18 -0
  228. package/dist/server/devServer.d.ts +47 -0
  229. package/dist/server/environment.d.ts +8 -0
  230. package/dist/server/gracefulShutdown.d.ts +8 -0
  231. package/dist/server/gzipMiddleware.d.ts +2 -0
  232. package/dist/server/helper.d.ts +118 -0
  233. package/dist/server/historyApiFallback.d.ts +10 -0
  234. package/dist/server/hmrFallback.d.ts +1 -0
  235. package/dist/server/httpServer.d.ts +7 -0
  236. package/dist/server/middlewares.d.ts +31 -0
  237. package/dist/server/open.d.ts +12 -0
  238. package/dist/server/overlay.d.ts +3 -0
  239. package/dist/server/previewServer.d.ts +4 -0
  240. package/dist/server/proxy.d.ts +7 -0
  241. package/dist/server/publicPathnames.d.ts +2 -0
  242. package/dist/server/runner/asModule.d.ts +2 -0
  243. package/dist/server/runner/basic.d.ts +25 -0
  244. package/dist/server/runner/cjs.d.ts +10 -0
  245. package/dist/server/runner/esm.d.ts +6 -0
  246. package/dist/server/runner/index.d.ts +6 -0
  247. package/dist/server/runner/type.d.ts +42 -0
  248. package/dist/server/serverSetup.d.ts +2 -0
  249. package/dist/server/socketServer.d.ts +113 -0
  250. package/dist/server/watchFiles.d.ts +15 -0
  251. package/dist/sirv.js +122 -0
  252. package/dist/tinyglobby.js +1 -0
  253. package/dist/trace-mapping.js +548 -0
  254. package/dist/transformLoader.mjs +36 -0
  255. package/dist/transformRawLoader.mjs +4 -0
  256. package/dist/types/config.d.ts +1796 -0
  257. package/dist/types/context.d.ts +89 -0
  258. package/dist/types/hooks.d.ts +261 -0
  259. package/dist/types/index.d.ts +8 -0
  260. package/dist/types/plugin.d.ts +479 -0
  261. package/dist/types/rsbuild.d.ts +241 -0
  262. package/dist/types/rspack.d.ts +10 -0
  263. package/dist/types/thirdParty.d.ts +161 -0
  264. package/dist/types/utils.d.ts +16 -0
  265. package/dist/workerLoader.mjs +94 -0
  266. package/dist/ws.js +2 -0
  267. package/package.json +107 -0
  268. package/static/openChrome.applescript +95 -0
  269. package/types.d.ts +422 -0
@@ -0,0 +1,548 @@
1
+ import { definePropertyGetters, makeNamespaceObject } from "./rslib-runtime.js";
2
+ var trace_mapping_namespaceObject = {};
3
+ makeNamespaceObject(trace_mapping_namespaceObject), definePropertyGetters(trace_mapping_namespaceObject, {
4
+ AnyMap: ()=>FlattenMap,
5
+ FlattenMap: ()=>FlattenMap,
6
+ GREATEST_LOWER_BOUND: ()=>GREATEST_LOWER_BOUND,
7
+ LEAST_UPPER_BOUND: ()=>LEAST_UPPER_BOUND,
8
+ TraceMap: ()=>TraceMap,
9
+ allGeneratedPositionsFor: ()=>allGeneratedPositionsFor,
10
+ decodedMap: ()=>decodedMap,
11
+ decodedMappings: ()=>decodedMappings,
12
+ eachMapping: ()=>eachMapping,
13
+ encodedMap: ()=>encodedMap,
14
+ encodedMappings: ()=>encodedMappings,
15
+ generatedPositionFor: ()=>generatedPositionFor,
16
+ isIgnored: ()=>isIgnored,
17
+ originalPositionFor: ()=>originalPositionFor,
18
+ presortedDecodedMap: ()=>presortedDecodedMap,
19
+ sourceContentFor: ()=>sourceContentFor,
20
+ traceSegment: ()=>traceSegment
21
+ });
22
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
23
+ for(let i = 0; i < chars.length; i++){
24
+ let c = chars.charCodeAt(i);
25
+ intToChar[i] = c, charToInt[c] = i;
26
+ }
27
+ function decodeInteger(reader, relative) {
28
+ let value = 0, shift = 0, integer = 0;
29
+ do value |= (31 & (integer = charToInt[reader.next()])) << shift, shift += 5;
30
+ while (32 & integer);
31
+ let shouldNegate = 1 & value;
32
+ return value >>>= 1, shouldNegate && (value = -2147483648 | -value), relative + value;
33
+ }
34
+ function encodeInteger(builder, num, relative) {
35
+ let delta = num - relative;
36
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
37
+ do {
38
+ let clamped = 31 & delta;
39
+ (delta >>>= 5) > 0 && (clamped |= 32), builder.write(intToChar[clamped]);
40
+ }while (delta > 0);
41
+ return num;
42
+ }
43
+ function hasMoreVlq(reader, max) {
44
+ return !(reader.pos >= max) && 44 !== reader.peek();
45
+ }
46
+ var td = "u" > typeof TextDecoder ? new TextDecoder() : "u" > typeof Buffer ? {
47
+ decode: (buf)=>Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString()
48
+ } : {
49
+ decode (buf) {
50
+ let out = "";
51
+ for(let i = 0; i < buf.length; i++)out += String.fromCharCode(buf[i]);
52
+ return out;
53
+ }
54
+ }, StringWriter = class {
55
+ constructor(){
56
+ this.pos = 0, this.out = "", this.buffer = new Uint8Array(16384);
57
+ }
58
+ write(v) {
59
+ let { buffer } = this;
60
+ buffer[this.pos++] = v, 16384 === this.pos && (this.out += td.decode(buffer), this.pos = 0);
61
+ }
62
+ flush() {
63
+ let { buffer, out, pos } = this;
64
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
65
+ }
66
+ }, StringReader = class {
67
+ constructor(buffer){
68
+ this.pos = 0, this.buffer = buffer;
69
+ }
70
+ next() {
71
+ return this.buffer.charCodeAt(this.pos++);
72
+ }
73
+ peek() {
74
+ return this.buffer.charCodeAt(this.pos);
75
+ }
76
+ indexOf(char) {
77
+ let { buffer, pos } = this, idx = buffer.indexOf(char, pos);
78
+ return -1 === idx ? buffer.length : idx;
79
+ }
80
+ };
81
+ function decode(mappings) {
82
+ let { length } = mappings, reader = new StringReader(mappings), decoded = [], genColumn = 0, sourcesIndex = 0, sourceLine = 0, sourceColumn = 0, namesIndex = 0;
83
+ do {
84
+ let semi = reader.indexOf(";"), line = [], sorted = !0, lastCol = 0;
85
+ for(genColumn = 0; reader.pos < semi;){
86
+ let seg;
87
+ (genColumn = decodeInteger(reader, genColumn)) < lastCol && (sorted = !1), lastCol = genColumn, hasMoreVlq(reader, semi) ? (sourcesIndex = decodeInteger(reader, sourcesIndex), sourceLine = decodeInteger(reader, sourceLine), sourceColumn = decodeInteger(reader, sourceColumn), seg = hasMoreVlq(reader, semi) ? [
88
+ genColumn,
89
+ sourcesIndex,
90
+ sourceLine,
91
+ sourceColumn,
92
+ namesIndex = decodeInteger(reader, namesIndex)
93
+ ] : [
94
+ genColumn,
95
+ sourcesIndex,
96
+ sourceLine,
97
+ sourceColumn
98
+ ]) : seg = [
99
+ genColumn
100
+ ], line.push(seg), reader.pos++;
101
+ }
102
+ sorted || sort(line), decoded.push(line), reader.pos = semi + 1;
103
+ }while (reader.pos <= length);
104
+ return decoded;
105
+ }
106
+ function sort(line) {
107
+ line.sort(sortComparator);
108
+ }
109
+ function sortComparator(a, b) {
110
+ return a[0] - b[0];
111
+ }
112
+ function encode(decoded) {
113
+ let writer = new StringWriter(), sourcesIndex = 0, sourceLine = 0, sourceColumn = 0, namesIndex = 0;
114
+ for(let i = 0; i < decoded.length; i++){
115
+ let line = decoded[i];
116
+ if (i > 0 && writer.write(59), 0 === line.length) continue;
117
+ let genColumn = 0;
118
+ for(let j = 0; j < line.length; j++){
119
+ let segment = line[j];
120
+ j > 0 && writer.write(44), genColumn = encodeInteger(writer, segment[0], genColumn), 1 !== segment.length && (sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex), sourceLine = encodeInteger(writer, segment[2], sourceLine), sourceColumn = encodeInteger(writer, segment[3], sourceColumn), 4 !== segment.length && (namesIndex = encodeInteger(writer, segment[4], namesIndex)));
121
+ }
122
+ }
123
+ return writer.flush();
124
+ }
125
+ let schemeRegex = /^[\w+.-]+:\/\//, urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/, fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
126
+ function isAbsoluteUrl(input) {
127
+ return schemeRegex.test(input);
128
+ }
129
+ function isSchemeRelativeUrl(input) {
130
+ return input.startsWith('//');
131
+ }
132
+ function isAbsolutePath(input) {
133
+ return input.startsWith('/');
134
+ }
135
+ function isFileUrl(input) {
136
+ return input.startsWith('file:');
137
+ }
138
+ function isRelative(input) {
139
+ return /^[.?#]/.test(input);
140
+ }
141
+ function parseAbsoluteUrl(input) {
142
+ let match = urlRegex.exec(input);
143
+ return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
144
+ }
145
+ function parseFileUrl(input) {
146
+ let match = fileRegex.exec(input), path = match[2];
147
+ return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
148
+ }
149
+ function makeUrl(scheme, user, host, port, path, query, hash) {
150
+ return {
151
+ scheme,
152
+ user,
153
+ host,
154
+ port,
155
+ path,
156
+ query,
157
+ hash,
158
+ type: 7
159
+ };
160
+ }
161
+ function parseUrl(input) {
162
+ if (isSchemeRelativeUrl(input)) {
163
+ let url = parseAbsoluteUrl('http:' + input);
164
+ return url.scheme = '', url.type = 6, url;
165
+ }
166
+ if (isAbsolutePath(input)) {
167
+ let url = parseAbsoluteUrl('http://foo.com' + input);
168
+ return url.scheme = '', url.host = '', url.type = 5, url;
169
+ }
170
+ if (isFileUrl(input)) return parseFileUrl(input);
171
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
172
+ let url = parseAbsoluteUrl('http://foo.com/' + input);
173
+ return url.scheme = '', url.host = '', url.type = input ? input.startsWith('?') ? 3 : input.startsWith('#') ? 2 : 4 : 1, url;
174
+ }
175
+ function stripPathFilename(path) {
176
+ if (path.endsWith('/..')) return path;
177
+ let index = path.lastIndexOf('/');
178
+ return path.slice(0, index + 1);
179
+ }
180
+ function mergePaths(url, base) {
181
+ normalizePath(base, base.type), '/' === url.path ? url.path = base.path : url.path = stripPathFilename(base.path) + url.path;
182
+ }
183
+ function normalizePath(url, type) {
184
+ let rel = type <= 4, pieces = url.path.split('/'), pointer = 1, positive = 0, addTrailingSlash = !1;
185
+ for(let i = 1; i < pieces.length; i++){
186
+ let piece = pieces[i];
187
+ if (!piece) {
188
+ addTrailingSlash = !0;
189
+ continue;
190
+ }
191
+ if (addTrailingSlash = !1, '.' !== piece) {
192
+ if ('..' === piece) {
193
+ positive ? (addTrailingSlash = !0, positive--, pointer--) : rel && (pieces[pointer++] = piece);
194
+ continue;
195
+ }
196
+ pieces[pointer++] = piece, positive++;
197
+ }
198
+ }
199
+ let path = '';
200
+ for(let i = 1; i < pointer; i++)path += '/' + pieces[i];
201
+ path && (!addTrailingSlash || path.endsWith('/..')) || (path += '/'), url.path = path;
202
+ }
203
+ function resolve_uri_resolve(input, base) {
204
+ if (!input && !base) return '';
205
+ let url = parseUrl(input), inputType = url.type;
206
+ if (base && 7 !== inputType) {
207
+ let baseUrl = parseUrl(base), baseType = baseUrl.type;
208
+ switch(inputType){
209
+ case 1:
210
+ url.hash = baseUrl.hash;
211
+ case 2:
212
+ url.query = baseUrl.query;
213
+ case 3:
214
+ case 4:
215
+ mergePaths(url, baseUrl);
216
+ case 5:
217
+ url.user = baseUrl.user, url.host = baseUrl.host, url.port = baseUrl.port;
218
+ case 6:
219
+ url.scheme = baseUrl.scheme;
220
+ }
221
+ baseType > inputType && (inputType = baseType);
222
+ }
223
+ normalizePath(url, inputType);
224
+ let queryHash = url.query + url.hash;
225
+ switch(inputType){
226
+ case 2:
227
+ case 3:
228
+ return queryHash;
229
+ case 4:
230
+ {
231
+ let path = url.path.slice(1);
232
+ if (!path) return queryHash || '.';
233
+ if (isRelative(base || input) && !isRelative(path)) return './' + path + queryHash;
234
+ return path + queryHash;
235
+ }
236
+ case 5:
237
+ return url.path + queryHash;
238
+ default:
239
+ return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
240
+ }
241
+ }
242
+ function stripFilename(path) {
243
+ if (!path) return "";
244
+ let index = path.lastIndexOf("/");
245
+ return path.slice(0, index + 1);
246
+ }
247
+ function resolver(mapUrl, sourceRoot) {
248
+ let from = stripFilename(mapUrl), prefix = sourceRoot ? sourceRoot + "/" : "";
249
+ return (source)=>resolve_uri_resolve(prefix + (source || ""), from);
250
+ }
251
+ function maybeSort(mappings, owned) {
252
+ let unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
253
+ if (unsortedIndex === mappings.length) return mappings;
254
+ owned || (mappings = mappings.slice());
255
+ for(let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1))mappings[i] = sortSegments(mappings[i], owned);
256
+ return mappings;
257
+ }
258
+ function nextUnsortedSegmentLine(mappings, start) {
259
+ for(let i = start; i < mappings.length; i++)if (!isSorted(mappings[i])) return i;
260
+ return mappings.length;
261
+ }
262
+ function isSorted(line) {
263
+ for(let j = 1; j < line.length; j++)if (line[j][0] < line[j - 1][0]) return !1;
264
+ return !0;
265
+ }
266
+ function sortSegments(line, owned) {
267
+ return owned || (line = line.slice()), line.sort(trace_mapping_sortComparator);
268
+ }
269
+ function trace_mapping_sortComparator(a, b) {
270
+ return a[0] - b[0];
271
+ }
272
+ function buildBySources(decoded, memos) {
273
+ let sources = memos.map(()=>[]);
274
+ for(let i = 0; i < decoded.length; i++){
275
+ let line = decoded[i];
276
+ for(let j = 0; j < line.length; j++){
277
+ let seg = line[j];
278
+ if (1 === seg.length) continue;
279
+ let sourceIndex2 = seg[1], sourceLine = seg[2], sourceColumn = seg[3], source = sources[sourceIndex2];
280
+ (source[sourceLine] || (source[sourceLine] = [])).push([
281
+ sourceColumn,
282
+ i,
283
+ seg[0]
284
+ ]);
285
+ }
286
+ }
287
+ for(let i = 0; i < sources.length; i++){
288
+ let source = sources[i];
289
+ for(let j = 0; j < source.length; j++){
290
+ let line = source[j];
291
+ line && line.sort(trace_mapping_sortComparator);
292
+ }
293
+ }
294
+ return sources;
295
+ }
296
+ var found = !1;
297
+ function binarySearch(haystack, needle, low, high) {
298
+ for(; low <= high;){
299
+ let mid = low + (high - low >> 1), cmp = haystack[mid][0] - needle;
300
+ if (0 === cmp) return found = !0, mid;
301
+ cmp < 0 ? low = mid + 1 : high = mid - 1;
302
+ }
303
+ return found = !1, low - 1;
304
+ }
305
+ function upperBound(haystack, needle, index) {
306
+ for(let i = index + 1; i < haystack.length && haystack[i][0] === needle; index = i++);
307
+ return index;
308
+ }
309
+ function lowerBound(haystack, needle, index) {
310
+ for(let i = index - 1; i >= 0 && haystack[i][0] === needle; index = i--);
311
+ return index;
312
+ }
313
+ function memoizedState() {
314
+ return {
315
+ lastKey: -1,
316
+ lastNeedle: -1,
317
+ lastIndex: -1
318
+ };
319
+ }
320
+ function memoizedBinarySearch(haystack, needle, state, key) {
321
+ let { lastKey, lastNeedle, lastIndex } = state, low = 0, high = haystack.length - 1;
322
+ if (key === lastKey) {
323
+ if (needle === lastNeedle) return found = -1 !== lastIndex && haystack[lastIndex][0] === needle, lastIndex;
324
+ needle >= lastNeedle ? low = -1 === lastIndex ? 0 : lastIndex : high = lastIndex;
325
+ }
326
+ return state.lastKey = key, state.lastNeedle = needle, state.lastIndex = binarySearch(haystack, needle, low, high);
327
+ }
328
+ function parse(map) {
329
+ return "string" == typeof map ? JSON.parse(map) : map;
330
+ }
331
+ var FlattenMap = function(map, mapUrl) {
332
+ let parsed = parse(map);
333
+ if (!("sections" in parsed)) return new TraceMap(parsed, mapUrl);
334
+ let mappings = [], sources = [], sourcesContent = [], names = [], ignoreList = [];
335
+ return recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, ignoreList, 0, 0, 1 / 0, 1 / 0), presortedDecodedMap({
336
+ version: 3,
337
+ file: parsed.file,
338
+ names,
339
+ sources,
340
+ sourcesContent,
341
+ mappings,
342
+ ignoreList
343
+ });
344
+ };
345
+ function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
346
+ let { sections } = input;
347
+ for(let i = 0; i < sections.length; i++){
348
+ let { map, offset } = sections[i], sl = stopLine, sc = stopColumn;
349
+ if (i + 1 < sections.length) {
350
+ let nextOffset = sections[i + 1].offset;
351
+ (sl = Math.min(stopLine, lineOffset + nextOffset.line)) === stopLine ? sc = Math.min(stopColumn, columnOffset + nextOffset.column) : sl < stopLine && (sc = columnOffset + nextOffset.column);
352
+ }
353
+ addSection(map, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset + offset.line, columnOffset + offset.column, sl, sc);
354
+ }
355
+ }
356
+ function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
357
+ let parsed = parse(input);
358
+ if ("sections" in parsed) return recurse(...arguments);
359
+ let map = new TraceMap(parsed, mapUrl), sourcesOffset = sources.length, namesOffset = names.length, decoded = decodedMappings(map), { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;
360
+ if (append(sources, resolvedSources), append(names, map.names), contents) append(sourcesContent, contents);
361
+ else for(let i = 0; i < resolvedSources.length; i++)sourcesContent.push(null);
362
+ if (ignores) for(let i = 0; i < ignores.length; i++)ignoreList.push(ignores[i] + sourcesOffset);
363
+ for(let i = 0; i < decoded.length; i++){
364
+ let lineI = lineOffset + i;
365
+ if (lineI > stopLine) return;
366
+ let out = getLine(mappings, lineI), cOffset = 0 === i ? columnOffset : 0, line = decoded[i];
367
+ for(let j = 0; j < line.length; j++){
368
+ let seg = line[j], column = cOffset + seg[0];
369
+ if (lineI === stopLine && column >= stopColumn) return;
370
+ if (1 === seg.length) {
371
+ out.push([
372
+ column
373
+ ]);
374
+ continue;
375
+ }
376
+ let sourcesIndex = sourcesOffset + seg[1], sourceLine = seg[2], sourceColumn = seg[3];
377
+ out.push(4 === seg.length ? [
378
+ column,
379
+ sourcesIndex,
380
+ sourceLine,
381
+ sourceColumn
382
+ ] : [
383
+ column,
384
+ sourcesIndex,
385
+ sourceLine,
386
+ sourceColumn,
387
+ namesOffset + seg[4]
388
+ ]);
389
+ }
390
+ }
391
+ }
392
+ function append(arr, other) {
393
+ for(let i = 0; i < other.length; i++)arr.push(other[i]);
394
+ }
395
+ function getLine(arr, index) {
396
+ for(let i = arr.length; i <= index; i++)arr[i] = [];
397
+ return arr[index];
398
+ }
399
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1, TraceMap = class {
400
+ constructor(map, mapUrl){
401
+ let isString = "string" == typeof map;
402
+ if (!isString && map._decodedMemo) return map;
403
+ let parsed = parse(map), { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
404
+ this.version = version, this.file = file, this.names = names || [], this.sourceRoot = sourceRoot, this.sources = sources, this.sourcesContent = sourcesContent, this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
405
+ let resolve = resolver(mapUrl, sourceRoot);
406
+ this.resolvedSources = sources.map(resolve);
407
+ let { mappings } = parsed;
408
+ if ("string" == typeof mappings) this._encoded = mappings, this._decoded = void 0;
409
+ else if (Array.isArray(mappings)) this._encoded = void 0, this._decoded = maybeSort(mappings, isString);
410
+ else if (parsed.sections) throw Error("TraceMap passed sectioned source map, please use FlattenMap export instead");
411
+ else throw Error(`invalid source map: ${JSON.stringify(parsed)}`);
412
+ this._decodedMemo = memoizedState(), this._bySources = void 0, this._bySourceMemos = void 0;
413
+ }
414
+ };
415
+ function encodedMappings(map) {
416
+ var _b;
417
+ return null != (_b = map._encoded) ? _b : map._encoded = encode(map._decoded);
418
+ }
419
+ function decodedMappings(map) {
420
+ return map._decoded || (map._decoded = decode(map._encoded));
421
+ }
422
+ function traceSegment(map, line, column) {
423
+ let decoded = decodedMappings(map);
424
+ if (line >= decoded.length) return null;
425
+ let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
426
+ return -1 === index ? null : segments[index];
427
+ }
428
+ function originalPositionFor(map, needle) {
429
+ let { line, column, bias } = needle;
430
+ if (--line < 0) throw Error(LINE_GTR_ZERO);
431
+ if (column < 0) throw Error(COL_GTR_EQ_ZERO);
432
+ let decoded = decodedMappings(map);
433
+ if (line >= decoded.length) return OMapping(null, null, null, null);
434
+ let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
435
+ if (-1 === index) return OMapping(null, null, null, null);
436
+ let segment = segments[index];
437
+ if (1 === segment.length) return OMapping(null, null, null, null);
438
+ let { names, resolvedSources } = map;
439
+ return OMapping(resolvedSources[segment[1]], segment[2] + 1, segment[3], 5 === segment.length ? names[segment[4]] : null);
440
+ }
441
+ function generatedPositionFor(map, needle) {
442
+ let { source, line, column, bias } = needle;
443
+ return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, !1);
444
+ }
445
+ function allGeneratedPositionsFor(map, needle) {
446
+ let { source, line, column, bias } = needle;
447
+ return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, !0);
448
+ }
449
+ function eachMapping(map, cb) {
450
+ let decoded = decodedMappings(map), { names, resolvedSources } = map;
451
+ for(let i = 0; i < decoded.length; i++){
452
+ let line = decoded[i];
453
+ for(let j = 0; j < line.length; j++){
454
+ let seg = line[j], generatedLine = i + 1, generatedColumn = seg[0], source = null, originalLine = null, originalColumn = null, name = null;
455
+ 1 !== seg.length && (source = resolvedSources[seg[1]], originalLine = seg[2] + 1, originalColumn = seg[3]), 5 === seg.length && (name = names[seg[4]]), cb({
456
+ generatedLine,
457
+ generatedColumn,
458
+ source,
459
+ originalLine,
460
+ originalColumn,
461
+ name
462
+ });
463
+ }
464
+ }
465
+ }
466
+ function sourceIndex(map, source) {
467
+ let { sources, resolvedSources } = map, index = sources.indexOf(source);
468
+ return -1 === index && (index = resolvedSources.indexOf(source)), index;
469
+ }
470
+ function sourceContentFor(map, source) {
471
+ let { sourcesContent } = map;
472
+ if (null == sourcesContent) return null;
473
+ let index = sourceIndex(map, source);
474
+ return -1 === index ? null : sourcesContent[index];
475
+ }
476
+ function isIgnored(map, source) {
477
+ let { ignoreList } = map;
478
+ if (null == ignoreList) return !1;
479
+ let index = sourceIndex(map, source);
480
+ return -1 !== index && ignoreList.includes(index);
481
+ }
482
+ function presortedDecodedMap(map, mapUrl) {
483
+ let tracer = new TraceMap(clone(map, []), mapUrl);
484
+ return tracer._decoded = map.mappings, tracer;
485
+ }
486
+ function decodedMap(map) {
487
+ return clone(map, decodedMappings(map));
488
+ }
489
+ function encodedMap(map) {
490
+ return clone(map, encodedMappings(map));
491
+ }
492
+ function clone(map, mappings) {
493
+ return {
494
+ version: map.version,
495
+ file: map.file,
496
+ names: map.names,
497
+ sourceRoot: map.sourceRoot,
498
+ sources: map.sources,
499
+ sourcesContent: map.sourcesContent,
500
+ mappings,
501
+ ignoreList: map.ignoreList || map.x_google_ignoreList
502
+ };
503
+ }
504
+ function OMapping(source, line, column, name) {
505
+ return {
506
+ source,
507
+ line,
508
+ column,
509
+ name
510
+ };
511
+ }
512
+ function GMapping(line, column) {
513
+ return {
514
+ line,
515
+ column
516
+ };
517
+ }
518
+ function traceSegmentInternal(segments, memo, line, column, bias) {
519
+ let index = memoizedBinarySearch(segments, column, memo, line);
520
+ return (found ? index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index) : bias === LEAST_UPPER_BOUND && index++, -1 === index || index === segments.length) ? -1 : index;
521
+ }
522
+ function sliceGeneratedPositions(segments, memo, line, column, bias) {
523
+ let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
524
+ if (!found && bias === LEAST_UPPER_BOUND && min++, -1 === min || min === segments.length) return [];
525
+ let matchedColumn = found ? column : segments[min][0];
526
+ found || (min = lowerBound(segments, matchedColumn, min));
527
+ let max = upperBound(segments, matchedColumn, min), result = [];
528
+ for(; min <= max; min++){
529
+ let segment = segments[min];
530
+ result.push(GMapping(segment[1] + 1, segment[2]));
531
+ }
532
+ return result;
533
+ }
534
+ function generatedPosition(map, source, line, column, bias, all) {
535
+ if (--line < 0) throw Error(LINE_GTR_ZERO);
536
+ if (column < 0) throw Error(COL_GTR_EQ_ZERO);
537
+ let { sources, resolvedSources } = map, sourceIndex2 = sources.indexOf(source);
538
+ if (-1 === sourceIndex2 && (sourceIndex2 = resolvedSources.indexOf(source)), -1 === sourceIndex2) return all ? [] : GMapping(null, null);
539
+ let bySourceMemos = map._bySourceMemos || (map._bySourceMemos = sources.map(memoizedState)), segments = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), bySourceMemos)))[sourceIndex2][line];
540
+ if (null == segments) return all ? [] : GMapping(null, null);
541
+ let memo = bySourceMemos[sourceIndex2];
542
+ if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
543
+ let index = traceSegmentInternal(segments, memo, line, column, bias);
544
+ if (-1 === index) return GMapping(null, null);
545
+ let segment = segments[index];
546
+ return GMapping(segment[1] + 1, segment[2]);
547
+ }
548
+ export { TraceMap, decodedMappings, encode, traceSegment, trace_mapping_namespaceObject };
@@ -0,0 +1,36 @@
1
+ import { cachedImport } from "./r.js";
2
+ let getRemapping = cachedImport(()=>import("./remapping.js").then((m)=>m.remapping_namespaceObject)), mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
3
+ let { default: remapping } = await getRemapping();
4
+ return remapping([
5
+ generatedSourceMap,
6
+ originalSourceMap
7
+ ], ()=>null);
8
+ }, transformLoader = async function transform(source, map) {
9
+ let callback = this.async(), { id: transformId, getEnvironment } = this.getOptions();
10
+ if (!transformId) return void callback(null, source, map);
11
+ let transform = this._compiler?.__rsbuildTransformer?.[transformId];
12
+ if (!transform) return void callback(null, source, map);
13
+ try {
14
+ let result = await transform({
15
+ code: source,
16
+ context: this.context,
17
+ resource: this.resource,
18
+ resourcePath: this.resourcePath,
19
+ resourceQuery: this.resourceQuery,
20
+ environment: getEnvironment(),
21
+ addDependency: this.addDependency.bind(this),
22
+ addMissingDependency: this.addMissingDependency.bind(this),
23
+ addContextDependency: this.addContextDependency.bind(this),
24
+ emitFile: this.emitFile.bind(this),
25
+ importModule: this.importModule.bind(this),
26
+ resolve: this.resolve.bind(this)
27
+ });
28
+ if (null == result) return void callback(null, source, map);
29
+ if ('string' == typeof result || Buffer.isBuffer(result)) return void callback(null, result, map);
30
+ let mergedMap = map && result.map ? await mergeSourceMap(map, result.map) : result.map ?? map;
31
+ callback(null, result.code, mergedMap);
32
+ } catch (error) {
33
+ callback(error instanceof Error ? error : Error(String(error)));
34
+ }
35
+ };
36
+ export default transformLoader;
@@ -0,0 +1,4 @@
1
+ import loader_transformLoader from "./transformLoader.mjs";
2
+ let raw = !0;
3
+ export default loader_transformLoader;
4
+ export { raw };