@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,741 @@
1
+ (() => {
2
+ "use strict";
3
+ var __webpack_modules__ = {
4
+ 184: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(526)["default"];
6
+ },
7
+ 526: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
+ var __webpack_unused_export__;
9
+ __webpack_unused_export__ = { value: true };
10
+ exports["default"] = loader;
11
+ var _path = _interopRequireDefault(__nccwpck_require__(17));
12
+ var _package = _interopRequireDefault(__nccwpck_require__(337));
13
+ var _options = _interopRequireDefault(__nccwpck_require__(612));
14
+ var _utils = __nccwpck_require__(922);
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule ? obj : { default: obj };
17
+ }
18
+ let hasExplicitDependencyOnPostCSS = false;
19
+ async function loader(content, sourceMap, meta) {
20
+ const options = this.getOptions(_options.default);
21
+ const callback = this.async();
22
+ const configOption =
23
+ typeof options.postcssOptions === "undefined" ||
24
+ typeof options.postcssOptions.config === "undefined"
25
+ ? true
26
+ : options.postcssOptions.config;
27
+ let implementation;
28
+ try {
29
+ implementation = (0, _utils.getPostcssImplementation)(
30
+ this,
31
+ options.implementation,
32
+ );
33
+ } catch (error) {
34
+ callback(error);
35
+ return;
36
+ }
37
+ if (!implementation) {
38
+ callback(
39
+ new Error(
40
+ `The Postcss implementation "${options.implementation}" not found`,
41
+ ),
42
+ );
43
+ return;
44
+ }
45
+ let loadedConfig;
46
+ if (configOption) {
47
+ try {
48
+ loadedConfig = await (0, _utils.loadConfig)(
49
+ this,
50
+ configOption,
51
+ options.postcssOptions,
52
+ );
53
+ } catch (error) {
54
+ callback(error);
55
+ return;
56
+ }
57
+ }
58
+ const { plugins, processOptions } = await (0, _utils.getPostcssOptions)(
59
+ this,
60
+ loadedConfig,
61
+ options.postcssOptions,
62
+ );
63
+ const useSourceMap =
64
+ typeof options.sourceMap !== "undefined"
65
+ ? options.sourceMap
66
+ : this.sourceMap;
67
+ if (useSourceMap) {
68
+ processOptions.map = {
69
+ inline: false,
70
+ annotation: false,
71
+ ...processOptions.map,
72
+ };
73
+ }
74
+ if (sourceMap && processOptions.map) {
75
+ processOptions.map.prev = (0, _utils.normalizeSourceMap)(
76
+ sourceMap,
77
+ this.context,
78
+ );
79
+ }
80
+ let root;
81
+ if (
82
+ meta &&
83
+ meta.ast &&
84
+ meta.ast.type === "postcss" &&
85
+ { satisfies: () => true }.satisfies(
86
+ meta.ast.version,
87
+ `^${_package.default.version}`,
88
+ )
89
+ ) {
90
+ ({ root } = meta.ast);
91
+ }
92
+ if (!root && options.execute) {
93
+ content = (0, _utils.exec)(content, this);
94
+ }
95
+ let result;
96
+ let processor;
97
+ try {
98
+ processor = implementation(plugins);
99
+ result = await processor.process(root || content, processOptions);
100
+ } catch (error) {
101
+ if (
102
+ !hasExplicitDependencyOnPostCSS &&
103
+ processor &&
104
+ processor.version &&
105
+ processor.version.startsWith("7.")
106
+ ) {
107
+ const packageJSONDir = (0, _utils.findPackageJSONDir)(
108
+ process.cwd(),
109
+ this.fs.statSync,
110
+ );
111
+ if (packageJSONDir) {
112
+ let bufferOfPackageJSON;
113
+ try {
114
+ bufferOfPackageJSON = this.fs.readFileSync(
115
+ _path.default.resolve(packageJSONDir, "package.json"),
116
+ "utf8",
117
+ );
118
+ } catch (_error) {}
119
+ if (bufferOfPackageJSON) {
120
+ let pkg;
121
+ try {
122
+ pkg = JSON.parse(bufferOfPackageJSON);
123
+ } catch (_error) {}
124
+ if (pkg) {
125
+ const { dependencies = {}, devDependencies = {} } = pkg;
126
+ if (!dependencies.postcss && !devDependencies.postcss) {
127
+ this.emitWarning(
128
+ new Error(
129
+ "Add postcss as project dependency. postcss is not a peer dependency for postcss-loader. " +
130
+ "Use `npm install postcss` or `yarn add postcss`",
131
+ ),
132
+ );
133
+ } else {
134
+ hasExplicitDependencyOnPostCSS = true;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ (0, _utils.reportError)(this, callback, error);
141
+ return;
142
+ }
143
+ for (const warning of result.warnings()) {
144
+ this.emitWarning((0, _utils.warningFactory)(warning));
145
+ }
146
+ for (const message of result.messages) {
147
+ switch (message.type) {
148
+ case "dependency":
149
+ this.addDependency(message.file);
150
+ break;
151
+ case "build-dependency":
152
+ this.addBuildDependency(message.file);
153
+ break;
154
+ case "missing-dependency":
155
+ this.addMissingDependency(message.file);
156
+ break;
157
+ case "context-dependency":
158
+ this.addContextDependency(message.file);
159
+ break;
160
+ case "dir-dependency":
161
+ this.addContextDependency(message.dir);
162
+ break;
163
+ case "asset":
164
+ if (message.content && message.file) {
165
+ this.emitFile(
166
+ message.file,
167
+ message.content,
168
+ message.sourceMap,
169
+ message.info,
170
+ );
171
+ }
172
+ }
173
+ }
174
+ let map = result.map ? result.map.toJSON() : undefined;
175
+ if (map && useSourceMap) {
176
+ map = (0, _utils.normalizeSourceMapAfterPostcss)(map, this.context);
177
+ }
178
+ let ast;
179
+ try {
180
+ ast = {
181
+ type: "postcss",
182
+ version: result.processor.version,
183
+ root: result.root,
184
+ };
185
+ } catch (error) {
186
+ (0, _utils.reportError)(this, callback, error);
187
+ return;
188
+ }
189
+ callback(null, result.css, map, { ast });
190
+ }
191
+ },
192
+ 922: (module, exports, __nccwpck_require__) => {
193
+ module = __nccwpck_require__.nmd(module);
194
+ Object.defineProperty(exports, "__esModule", { value: true });
195
+ exports.exec = exec;
196
+ exports.findPackageJSONDir = findPackageJSONDir;
197
+ exports.getPostcssImplementation = getPostcssImplementation;
198
+ exports.getPostcssOptions = getPostcssOptions;
199
+ exports.loadConfig = loadConfig;
200
+ exports.normalizeSourceMap = normalizeSourceMap;
201
+ exports.normalizeSourceMapAfterPostcss = normalizeSourceMapAfterPostcss;
202
+ exports.reportError = reportError;
203
+ exports.warningFactory = warningFactory;
204
+ var _path = _interopRequireDefault(__nccwpck_require__(17));
205
+ var _url = _interopRequireDefault(__nccwpck_require__(310));
206
+ var _module = _interopRequireDefault(__nccwpck_require__(188));
207
+ var _cosmiconfig = {};
208
+ function _interopRequireDefault(obj) {
209
+ return obj && obj.__esModule ? obj : { default: obj };
210
+ }
211
+ const parentModule = module;
212
+ const stat = (inputFileSystem, filePath) =>
213
+ new Promise((resolve, reject) => {
214
+ inputFileSystem.stat(filePath, (err, stats) => {
215
+ if (err) {
216
+ reject(err);
217
+ }
218
+ resolve(stats);
219
+ });
220
+ });
221
+ function exec(code, loaderContext) {
222
+ const { resource, context } = loaderContext;
223
+ const module = new _module.default(resource, parentModule);
224
+ module.paths = _module.default._nodeModulePaths(context);
225
+ module.filename = resource;
226
+ module._compile(code, resource);
227
+ return module.exports;
228
+ }
229
+ let tsLoader;
230
+ async function loadConfig(loaderContext, config, postcssOptions) {
231
+ const searchPath =
232
+ typeof config === "string"
233
+ ? _path.default.resolve(config)
234
+ : _path.default.dirname(loaderContext.resourcePath);
235
+ let stats;
236
+ try {
237
+ stats = await stat(loaderContext.fs, searchPath);
238
+ } catch (errorIgnore) {
239
+ throw new Error(`No PostCSS config found in: ${searchPath}`);
240
+ }
241
+ const moduleName = "postcss";
242
+ const searchPlaces = [
243
+ "package.json",
244
+ `${moduleName}.config.js`,
245
+ `${moduleName}.config.mjs`,
246
+ `${moduleName}.config.cjs`,
247
+ `${moduleName}.config.ts`,
248
+ `${moduleName}.config.mts`,
249
+ `${moduleName}.config.cts`,
250
+ `.${moduleName}rc`,
251
+ `.${moduleName}rc.json`,
252
+ `.${moduleName}rc.js`,
253
+ `.${moduleName}rc.mjs`,
254
+ `.${moduleName}rc.cjs`,
255
+ `.${moduleName}rc.ts`,
256
+ `.${moduleName}rc.mts`,
257
+ `.${moduleName}rc.cts`,
258
+ `.${moduleName}rc.yaml`,
259
+ `.${moduleName}rc.yml`,
260
+ `.config/${moduleName}rc`,
261
+ `.config/${moduleName}rc.json`,
262
+ `.config/${moduleName}rc.yaml`,
263
+ `.config/${moduleName}rc.yml`,
264
+ `.config/${moduleName}rc.js`,
265
+ `.config/${moduleName}rc.mjs`,
266
+ `.config/${moduleName}rc.cjs`,
267
+ `.config/${moduleName}rc.ts`,
268
+ `.config/${moduleName}rc.mts`,
269
+ `.config/${moduleName}rc.cts`,
270
+ ];
271
+ const loaders = {
272
+ ".js": async (...args) => {
273
+ let result;
274
+ try {
275
+ result = _cosmiconfig.defaultLoadersSync[".js"](...args);
276
+ } catch (error) {
277
+ let importESM;
278
+ try {
279
+ importESM = new Function("id", "return import(id);");
280
+ } catch (e) {
281
+ importESM = null;
282
+ }
283
+ if (
284
+ error.code === "ERR_REQUIRE_ESM" &&
285
+ _url.default.pathToFileURL &&
286
+ importESM
287
+ ) {
288
+ const urlForConfig = _url.default.pathToFileURL(args[0]);
289
+ result = await importESM(urlForConfig);
290
+ } else {
291
+ throw error;
292
+ }
293
+ }
294
+ if (result.default) {
295
+ return result.default;
296
+ }
297
+ return result;
298
+ },
299
+ ".cjs": _cosmiconfig.defaultLoadersSync[".cjs"],
300
+ ".mjs": async (...args) => {
301
+ let result;
302
+ let importESM;
303
+ try {
304
+ importESM = new Function("id", "return import(id);");
305
+ } catch (e) {
306
+ importESM = null;
307
+ }
308
+ if (_url.default.pathToFileURL && importESM) {
309
+ const urlForConfig = _url.default.pathToFileURL(args[0]);
310
+ result = await importESM(urlForConfig);
311
+ } else {
312
+ throw new Error("ESM is not supported");
313
+ }
314
+ if (result.default) {
315
+ return result.default;
316
+ }
317
+ return result;
318
+ },
319
+ };
320
+ if (!tsLoader) {
321
+ const opts = { interopDefault: true };
322
+ const jiti = __nccwpck_require__(993)(__filename, opts);
323
+ tsLoader = (filepath) => jiti(filepath);
324
+ }
325
+ loaders[".cts"] = tsLoader;
326
+ loaders[".mts"] = tsLoader;
327
+ loaders[".ts"] = tsLoader;
328
+ const explorer = (0, _cosmiconfig.cosmiconfig)(moduleName, {
329
+ searchStrategy: "global",
330
+ searchPlaces,
331
+ loaders,
332
+ });
333
+ let result;
334
+ try {
335
+ if (stats.isFile()) {
336
+ result = await explorer.load(searchPath);
337
+ } else {
338
+ result = await explorer.search(searchPath);
339
+ }
340
+ } catch (error) {
341
+ throw error;
342
+ }
343
+ if (!result) {
344
+ return {};
345
+ }
346
+ loaderContext.addBuildDependency(result.filepath);
347
+ loaderContext.addDependency(result.filepath);
348
+ if (result.isEmpty) {
349
+ return result;
350
+ }
351
+ if (typeof result.config === "function") {
352
+ const api = {
353
+ mode: loaderContext.mode,
354
+ file: loaderContext.resourcePath,
355
+ webpackLoaderContext: loaderContext,
356
+ env: loaderContext.mode,
357
+ options: postcssOptions || {},
358
+ };
359
+ return { ...result, config: result.config(api) };
360
+ }
361
+ return result;
362
+ }
363
+ function loadPlugin(plugin, options, file) {
364
+ try {
365
+ let loadedPlugin = require(plugin);
366
+ if (loadedPlugin.default) {
367
+ loadedPlugin = loadedPlugin.default;
368
+ }
369
+ if (!options || Object.keys(options).length === 0) {
370
+ return loadedPlugin;
371
+ }
372
+ return loadedPlugin(options);
373
+ } catch (error) {
374
+ throw new Error(
375
+ `Loading PostCSS "${plugin}" plugin failed: ${error.message}\n\n(@${file})`,
376
+ );
377
+ }
378
+ }
379
+ function pluginFactory() {
380
+ const listOfPlugins = new Map();
381
+ return (plugins) => {
382
+ if (typeof plugins === "undefined") {
383
+ return listOfPlugins;
384
+ }
385
+ if (Array.isArray(plugins)) {
386
+ for (const plugin of plugins) {
387
+ if (Array.isArray(plugin)) {
388
+ const [name, options] = plugin;
389
+ listOfPlugins.set(name, options);
390
+ } else if (plugin && typeof plugin === "function") {
391
+ listOfPlugins.set(plugin);
392
+ } else if (
393
+ plugin &&
394
+ Object.keys(plugin).length === 1 &&
395
+ (typeof plugin[Object.keys(plugin)[0]] === "object" ||
396
+ typeof plugin[Object.keys(plugin)[0]] === "boolean") &&
397
+ plugin[Object.keys(plugin)[0]] !== null
398
+ ) {
399
+ const [name] = Object.keys(plugin);
400
+ const options = plugin[name];
401
+ if (options === false) {
402
+ listOfPlugins.delete(name);
403
+ } else {
404
+ listOfPlugins.set(name, options);
405
+ }
406
+ } else if (plugin) {
407
+ listOfPlugins.set(plugin);
408
+ }
409
+ }
410
+ } else {
411
+ const objectPlugins = Object.entries(plugins);
412
+ for (const [name, options] of objectPlugins) {
413
+ if (options === false) {
414
+ listOfPlugins.delete(name);
415
+ } else {
416
+ listOfPlugins.set(name, options);
417
+ }
418
+ }
419
+ }
420
+ return listOfPlugins;
421
+ };
422
+ }
423
+ async function tryRequireThenImport(module) {
424
+ let exports;
425
+ try {
426
+ exports = require(module);
427
+ return exports;
428
+ } catch (requireError) {
429
+ let importESM;
430
+ try {
431
+ importESM = new Function("id", "return import(id);");
432
+ } catch (e) {
433
+ importESM = null;
434
+ }
435
+ if (requireError.code === "ERR_REQUIRE_ESM" && importESM) {
436
+ exports = await importESM(module);
437
+ return exports.default;
438
+ }
439
+ throw requireError;
440
+ }
441
+ }
442
+ async function getPostcssOptions(
443
+ loaderContext,
444
+ loadedConfig = {},
445
+ postcssOptions = {},
446
+ ) {
447
+ const file = loaderContext.resourcePath;
448
+ let normalizedPostcssOptions = postcssOptions;
449
+ if (typeof normalizedPostcssOptions === "function") {
450
+ normalizedPostcssOptions = normalizedPostcssOptions(loaderContext);
451
+ }
452
+ let plugins = [];
453
+ try {
454
+ const factory = pluginFactory();
455
+ if (loadedConfig.config && loadedConfig.config.plugins) {
456
+ factory(loadedConfig.config.plugins);
457
+ }
458
+ factory(normalizedPostcssOptions.plugins);
459
+ plugins = [...factory()].map((item) => {
460
+ const [plugin, options] = item;
461
+ if (typeof plugin === "string") {
462
+ return loadPlugin(plugin, options, file);
463
+ }
464
+ return plugin;
465
+ });
466
+ } catch (error) {
467
+ loaderContext.emitError(error);
468
+ }
469
+ const processOptionsFromConfig = { ...loadedConfig.config } || {};
470
+ if (processOptionsFromConfig.from) {
471
+ processOptionsFromConfig.from = _path.default.resolve(
472
+ _path.default.dirname(loadedConfig.filepath),
473
+ processOptionsFromConfig.from,
474
+ );
475
+ }
476
+ if (processOptionsFromConfig.to) {
477
+ processOptionsFromConfig.to = _path.default.resolve(
478
+ _path.default.dirname(loadedConfig.filepath),
479
+ processOptionsFromConfig.to,
480
+ );
481
+ }
482
+ const processOptionsFromOptions = { ...normalizedPostcssOptions };
483
+ if (processOptionsFromOptions.from) {
484
+ processOptionsFromOptions.from = _path.default.resolve(
485
+ loaderContext.rootContext,
486
+ processOptionsFromOptions.from,
487
+ );
488
+ }
489
+ if (processOptionsFromOptions.to) {
490
+ processOptionsFromOptions.to = _path.default.resolve(
491
+ loaderContext.rootContext,
492
+ processOptionsFromOptions.to,
493
+ );
494
+ }
495
+ const { plugins: __plugins, ...optionsFromConfig } =
496
+ processOptionsFromConfig;
497
+ const {
498
+ config: _config,
499
+ plugins: _plugins,
500
+ ...optionsFromOptions
501
+ } = processOptionsFromOptions;
502
+ const processOptions = {
503
+ from: file,
504
+ to: file,
505
+ map: false,
506
+ ...optionsFromConfig,
507
+ ...optionsFromOptions,
508
+ };
509
+ if (typeof processOptions.parser === "string") {
510
+ try {
511
+ processOptions.parser = await tryRequireThenImport(
512
+ processOptions.parser,
513
+ );
514
+ } catch (error) {
515
+ loaderContext.emitError(
516
+ new Error(
517
+ `Loading PostCSS "${processOptions.parser}" parser failed: ${error.message}\n\n(@${file})`,
518
+ ),
519
+ );
520
+ }
521
+ }
522
+ if (typeof processOptions.stringifier === "string") {
523
+ try {
524
+ processOptions.stringifier = await tryRequireThenImport(
525
+ processOptions.stringifier,
526
+ );
527
+ } catch (error) {
528
+ loaderContext.emitError(
529
+ new Error(
530
+ `Loading PostCSS "${processOptions.stringifier}" stringifier failed: ${error.message}\n\n(@${file})`,
531
+ ),
532
+ );
533
+ }
534
+ }
535
+ if (typeof processOptions.syntax === "string") {
536
+ try {
537
+ processOptions.syntax = await tryRequireThenImport(
538
+ processOptions.syntax,
539
+ );
540
+ } catch (error) {
541
+ loaderContext.emitError(
542
+ new Error(
543
+ `Loading PostCSS "${processOptions.syntax}" syntax failed: ${error.message}\n\n(@${file})`,
544
+ ),
545
+ );
546
+ }
547
+ }
548
+ if (processOptions.map === true) {
549
+ processOptions.map = { inline: true };
550
+ }
551
+ return { plugins, processOptions };
552
+ }
553
+ const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
554
+ const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
555
+ function getURLType(source) {
556
+ if (source[0] === "/") {
557
+ if (source[1] === "/") {
558
+ return "scheme-relative";
559
+ }
560
+ return "path-absolute";
561
+ }
562
+ if (IS_NATIVE_WIN32_PATH.test(source)) {
563
+ return "path-absolute";
564
+ }
565
+ return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
566
+ }
567
+ function normalizeSourceMap(map, resourceContext) {
568
+ let newMap = map;
569
+ if (typeof newMap === "string") {
570
+ newMap = JSON.parse(newMap);
571
+ }
572
+ delete newMap.file;
573
+ const { sourceRoot } = newMap;
574
+ delete newMap.sourceRoot;
575
+ if (newMap.sources) {
576
+ newMap.sources = newMap.sources.map((source) => {
577
+ const sourceType = getURLType(source);
578
+ if (
579
+ sourceType === "path-relative" ||
580
+ sourceType === "path-absolute"
581
+ ) {
582
+ const absoluteSource =
583
+ sourceType === "path-relative" && sourceRoot
584
+ ? _path.default.resolve(
585
+ sourceRoot,
586
+ _path.default.normalize(source),
587
+ )
588
+ : _path.default.normalize(source);
589
+ return _path.default.relative(resourceContext, absoluteSource);
590
+ }
591
+ return source;
592
+ });
593
+ }
594
+ return newMap;
595
+ }
596
+ function normalizeSourceMapAfterPostcss(map, resourceContext) {
597
+ const newMap = map;
598
+ delete newMap.file;
599
+ newMap.sourceRoot = "";
600
+ newMap.sources = newMap.sources.map((source) => {
601
+ if (source.indexOf("<") === 0) {
602
+ return source;
603
+ }
604
+ const sourceType = getURLType(source);
605
+ if (sourceType === "path-relative") {
606
+ return _path.default.resolve(resourceContext, source);
607
+ }
608
+ return source;
609
+ });
610
+ return newMap;
611
+ }
612
+ function findPackageJSONDir(cwd, statSync) {
613
+ let dir = cwd;
614
+ for (;;) {
615
+ try {
616
+ if (statSync(_path.default.join(dir, "package.json")).isFile()) {
617
+ break;
618
+ }
619
+ } catch (error) {}
620
+ const parent = _path.default.dirname(dir);
621
+ if (dir === parent) {
622
+ dir = null;
623
+ break;
624
+ }
625
+ dir = parent;
626
+ }
627
+ return dir;
628
+ }
629
+ function getPostcssImplementation(loaderContext, implementation) {
630
+ let resolvedImplementation = implementation;
631
+ if (!implementation || typeof implementation === "string") {
632
+ const postcssImplPkg = implementation || "postcss";
633
+ resolvedImplementation = require(postcssImplPkg);
634
+ }
635
+ return resolvedImplementation;
636
+ }
637
+ function reportError(loaderContext, callback, error) {
638
+ if (error.file) {
639
+ loaderContext.addDependency(error.file);
640
+ }
641
+ if (error.name === "CssSyntaxError") {
642
+ callback(syntaxErrorFactory(error));
643
+ } else {
644
+ callback(error);
645
+ }
646
+ }
647
+ function warningFactory(warning) {
648
+ let message = "";
649
+ if (typeof warning.line !== "undefined") {
650
+ message += `(${warning.line}:${warning.column}) `;
651
+ }
652
+ if (typeof warning.plugin !== "undefined") {
653
+ message += `from "${warning.plugin}" plugin: `;
654
+ }
655
+ message += warning.text;
656
+ if (warning.node) {
657
+ message += `\n\nCode:\n ${warning.node.toString()}\n`;
658
+ }
659
+ const obj = new Error(message, { cause: warning });
660
+ obj.stack = null;
661
+ return obj;
662
+ }
663
+ function syntaxErrorFactory(error) {
664
+ let message = "\nSyntaxError\n\n";
665
+ if (typeof error.line !== "undefined") {
666
+ message += `(${error.line}:${error.column}) `;
667
+ }
668
+ if (typeof error.plugin !== "undefined") {
669
+ message += `from "${error.plugin}" plugin: `;
670
+ }
671
+ message += error.file ? `${error.file} ` : "<css input> ";
672
+ message += `${error.reason}`;
673
+ const code = error.showSourceCode();
674
+ if (code) {
675
+ message += `\n\n${code}\n`;
676
+ }
677
+ const obj = new Error(message, { cause: error });
678
+ obj.stack = null;
679
+ return obj;
680
+ }
681
+ },
682
+ 993: (module) => {
683
+ module.exports = require("../jiti");
684
+ },
685
+ 188: (module) => {
686
+ module.exports = require("module");
687
+ },
688
+ 17: (module) => {
689
+ module.exports = require("path");
690
+ },
691
+ 310: (module) => {
692
+ module.exports = require("url");
693
+ },
694
+ 612: (module) => {
695
+ module.exports = JSON.parse(
696
+ '{"title":"PostCSS Loader options","type":"object","properties":{"postcssOptions":{"description":"Options to pass through to `Postcss`.","link":"https://github.com/webpack-contrib/postcss-loader#postcssOptions","anyOf":[{"type":"object","additionalProperties":true,"properties":{"config":{"description":"Allows to specify PostCSS config path.","link":"https://github.com/webpack-contrib/postcss-loader#config","anyOf":[{"description":"Allows to specify the path to the configuration file","type":"string"},{"description":"Enables/Disables autoloading config","type":"boolean"}]}}},{"instanceof":"Function"}]},"execute":{"description":"Enables/Disables PostCSS parser support in \'CSS-in-JS\'.","link":"https://github.com/webpack-contrib/postcss-loader#execute","type":"boolean"},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/postcss-loader#sourcemap","type":"boolean"},"implementation":{"description":"The implementation of postcss to use, instead of the locally installed version","link":"https://github.com/webpack-contrib/postcss-loader#implementation","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
697
+ );
698
+ },
699
+ 337: (module) => {
700
+ module.exports = JSON.parse(
701
+ '{"name":"postcss","version":"8.4.49","description":"Tool for transforming styles with JS plugins","engines":{"node":"^10 || ^12 || >=14"},"exports":{".":{"require":"./lib/postcss.js","import":"./lib/postcss.mjs"},"./lib/at-rule":"./lib/at-rule.js","./lib/comment":"./lib/comment.js","./lib/container":"./lib/container.js","./lib/css-syntax-error":"./lib/css-syntax-error.js","./lib/declaration":"./lib/declaration.js","./lib/fromJSON":"./lib/fromJSON.js","./lib/input":"./lib/input.js","./lib/lazy-result":"./lib/lazy-result.js","./lib/no-work-result":"./lib/no-work-result.js","./lib/list":"./lib/list.js","./lib/map-generator":"./lib/map-generator.js","./lib/node":"./lib/node.js","./lib/parse":"./lib/parse.js","./lib/parser":"./lib/parser.js","./lib/postcss":"./lib/postcss.js","./lib/previous-map":"./lib/previous-map.js","./lib/processor":"./lib/processor.js","./lib/result":"./lib/result.js","./lib/root":"./lib/root.js","./lib/rule":"./lib/rule.js","./lib/stringifier":"./lib/stringifier.js","./lib/stringify":"./lib/stringify.js","./lib/symbols":"./lib/symbols.js","./lib/terminal-highlight":"./lib/terminal-highlight.js","./lib/tokenize":"./lib/tokenize.js","./lib/warn-once":"./lib/warn-once.js","./lib/warning":"./lib/warning.js","./package.json":"./package.json"},"main":"./lib/postcss.js","types":"./lib/postcss.d.ts","keywords":["css","postcss","rework","preprocessor","parser","source map","transform","manipulation","transpiler"],"funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"author":"Andrey Sitnik <andrey@sitnik.ru>","license":"MIT","homepage":"https://postcss.org/","repository":"postcss/postcss","bugs":{"url":"https://github.com/postcss/postcss/issues"},"dependencies":{"nanoid":"^3.3.7","picocolors":"^1.1.1","source-map-js":"^1.2.1"},"browser":{"./lib/terminal-highlight":false,"source-map-js":false,"path":false,"url":false,"fs":false}}',
702
+ );
703
+ },
704
+ };
705
+ var __webpack_module_cache__ = {};
706
+ function __nccwpck_require__(moduleId) {
707
+ var cachedModule = __webpack_module_cache__[moduleId];
708
+ if (cachedModule !== undefined) {
709
+ return cachedModule.exports;
710
+ }
711
+ var module = (__webpack_module_cache__[moduleId] = {
712
+ id: moduleId,
713
+ loaded: false,
714
+ exports: {},
715
+ });
716
+ var threw = true;
717
+ try {
718
+ __webpack_modules__[moduleId](
719
+ module,
720
+ module.exports,
721
+ __nccwpck_require__,
722
+ );
723
+ threw = false;
724
+ } finally {
725
+ if (threw) delete __webpack_module_cache__[moduleId];
726
+ }
727
+ module.loaded = true;
728
+ return module.exports;
729
+ }
730
+ (() => {
731
+ __nccwpck_require__.nmd = (module) => {
732
+ module.paths = [];
733
+ if (!module.children) module.children = [];
734
+ return module;
735
+ };
736
+ })();
737
+ if (typeof __nccwpck_require__ !== "undefined")
738
+ __nccwpck_require__.ab = __dirname + "/";
739
+ var __webpack_exports__ = __nccwpck_require__(184);
740
+ module.exports = __webpack_exports__;
741
+ })();