@ohos-ports/rspack-core 1.1.8-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 (243) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +25 -0
  3. package/compiled/@swc/types/index.d.ts +1962 -0
  4. package/compiled/@swc/types/index.js +19 -0
  5. package/compiled/@swc/types/license +201 -0
  6. package/compiled/@swc/types/package.json +1 -0
  7. package/compiled/browserslist/index.d.ts +1 -0
  8. package/compiled/browserslist/index.js +2053 -0
  9. package/compiled/browserslist/license +20 -0
  10. package/compiled/browserslist/package.json +1 -0
  11. package/compiled/enhanced-resolve/CachedInputFileSystem.js +664 -0
  12. package/compiled/enhanced-resolve/index.d.ts +1123 -0
  13. package/compiled/enhanced-resolve/license +20 -0
  14. package/compiled/enhanced-resolve/package.json +1 -0
  15. package/compiled/graceful-fs/index.d.ts +13 -0
  16. package/compiled/graceful-fs/index.js +1063 -0
  17. package/compiled/graceful-fs/license +15 -0
  18. package/compiled/graceful-fs/package.json +1 -0
  19. package/compiled/watchpack/index.d.ts +216 -0
  20. package/compiled/watchpack/index.js +2075 -0
  21. package/compiled/watchpack/license +20 -0
  22. package/compiled/watchpack/package.json +1 -0
  23. package/compiled/webpack-sources/index.d.ts +130 -0
  24. package/compiled/webpack-sources/index.js +3520 -0
  25. package/compiled/webpack-sources/license +21 -0
  26. package/compiled/webpack-sources/package.json +1 -0
  27. package/compiled/zod/index.d.ts +1733 -0
  28. package/compiled/zod/index.js +4405 -0
  29. package/compiled/zod/license +21 -0
  30. package/compiled/zod/package.json +1 -0
  31. package/dist/Chunk.d.ts +40 -0
  32. package/dist/ChunkGraph.d.ts +12 -0
  33. package/dist/ChunkGroup.d.ts +26 -0
  34. package/dist/Compilation.d.ts +421 -0
  35. package/dist/Compiler.d.ts +154 -0
  36. package/dist/ContextModuleFactory.d.ts +13 -0
  37. package/dist/DependenciesBlock.d.ts +10 -0
  38. package/dist/Dependency.d.ts +11 -0
  39. package/dist/Entrypoint.d.ts +8 -0
  40. package/dist/ErrorHelpers.d.ts +16 -0
  41. package/dist/ExecuteModulePlugin.d.ts +4 -0
  42. package/dist/FileSystem.d.ts +29 -0
  43. package/dist/FileSystemInfo.d.ts +5 -0
  44. package/dist/Module.d.ts +93 -0
  45. package/dist/ModuleGraph.d.ts +10 -0
  46. package/dist/ModuleTypeConstants.d.ts +93 -0
  47. package/dist/MultiCompiler.d.ts +68 -0
  48. package/dist/MultiStats.d.ts +22 -0
  49. package/dist/MultiWatching.d.ts +26 -0
  50. package/dist/NormalModule.d.ts +12 -0
  51. package/dist/NormalModuleFactory.d.ts +20 -0
  52. package/dist/Resolver.d.ts +16 -0
  53. package/dist/ResolverFactory.d.ts +14 -0
  54. package/dist/RspackError.d.ts +8 -0
  55. package/dist/RuleSetCompiler.d.ts +9 -0
  56. package/dist/RuntimeGlobals.d.ts +324 -0
  57. package/dist/RuntimeModule.d.ts +32 -0
  58. package/dist/Stats.d.ts +17 -0
  59. package/dist/Template.d.ts +77 -0
  60. package/dist/Watching.d.ts +35 -0
  61. package/dist/builtin-loader/index.d.ts +1 -0
  62. package/dist/builtin-loader/lightningcss/index.d.ts +95 -0
  63. package/dist/builtin-loader/swc/index.d.ts +3 -0
  64. package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
  65. package/dist/builtin-loader/swc/types.d.ts +19 -0
  66. package/dist/builtin-plugin/APIPlugin.d.ts +10 -0
  67. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +10 -0
  68. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +10 -0
  69. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +10 -0
  70. package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
  71. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +15 -0
  72. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +10 -0
  73. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +10 -0
  74. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +10 -0
  75. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +15 -0
  76. package/dist/builtin-plugin/CssModulesPlugin.d.ts +10 -0
  77. package/dist/builtin-plugin/DataUriPlugin.d.ts +10 -0
  78. package/dist/builtin-plugin/DefinePlugin.d.ts +17 -0
  79. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +10 -0
  80. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +8 -0
  81. package/dist/builtin-plugin/DllEntryPlugin.d.ts +13 -0
  82. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
  83. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
  84. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +10 -0
  85. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +10 -0
  86. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
  87. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +10 -0
  88. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +10 -0
  89. package/dist/builtin-plugin/EntryPlugin.d.ts +27 -0
  90. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
  91. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
  92. package/dist/builtin-plugin/ExternalsPlugin.d.ts +10 -0
  93. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +10 -0
  94. package/dist/builtin-plugin/FileUriPlugin.d.ts +10 -0
  95. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +10 -0
  96. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +10 -0
  97. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -0
  98. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
  99. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +112 -0
  100. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +10 -0
  101. package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
  102. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +10 -0
  103. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
  104. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +11 -0
  105. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +10 -0
  106. package/dist/builtin-plugin/LibManifestPlugin.d.ts +18 -0
  107. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +33 -0
  108. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +15 -0
  109. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -0
  110. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +10 -0
  111. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +10 -0
  112. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -0
  113. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +10 -0
  114. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +10 -0
  115. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +10 -0
  116. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +8 -0
  117. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +10 -0
  118. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +10 -0
  119. package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
  120. package/dist/builtin-plugin/ProvidePlugin.d.ts +11 -0
  121. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +10 -0
  122. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
  123. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +10 -0
  124. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
  125. package/dist/builtin-plugin/RuntimePlugin.d.ts +10 -0
  126. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +10 -0
  127. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +20 -0
  128. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
  129. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
  130. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +213 -0
  131. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +10 -0
  132. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
  133. package/dist/builtin-plugin/WorkerPlugin.d.ts +13 -0
  134. package/dist/builtin-plugin/base.d.ts +22 -0
  135. package/dist/builtin-plugin/css-extract/index.d.ts +23 -0
  136. package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
  137. package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
  138. package/dist/builtin-plugin/index.d.ts +71 -0
  139. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +46 -0
  140. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +24 -0
  141. package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +13 -0
  142. package/dist/config/adapter.d.ts +10 -0
  143. package/dist/config/adapterRuleUse.d.ts +157 -0
  144. package/dist/config/browserslistTargetHandler.d.ts +21 -0
  145. package/dist/config/defaults.d.ts +12 -0
  146. package/dist/config/index.d.ts +5 -0
  147. package/dist/config/normalization.d.ts +128 -0
  148. package/dist/config/target.d.ts +89 -0
  149. package/dist/config/types.d.ts +2136 -0
  150. package/dist/config/utils.d.ts +16 -0
  151. package/dist/config/zod.d.ts +4090 -0
  152. package/dist/container/ContainerPlugin.d.ts +40 -0
  153. package/dist/container/ContainerReferencePlugin.d.ts +33 -0
  154. package/dist/container/ModuleFederationPlugin.d.ts +13 -0
  155. package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
  156. package/dist/container/ModuleFederationRuntimePlugin.d.ts +10 -0
  157. package/dist/container/options.d.ts +3 -0
  158. package/dist/cssExtractHmr.js +224 -0
  159. package/dist/cssExtractLoader.js +278 -0
  160. package/dist/error/ConcurrentCompilationError.d.ts +14 -0
  161. package/dist/exports.d.ts +167 -0
  162. package/dist/index.d.ts +10 -0
  163. package/dist/index.js +20251 -0
  164. package/dist/lib/AbstractMethodError.d.ts +24 -0
  165. package/dist/lib/Cache.d.ts +65 -0
  166. package/dist/lib/CacheFacade.d.ts +167 -0
  167. package/dist/lib/DllPlugin.d.ts +42 -0
  168. package/dist/lib/DllReferencePlugin.d.ts +119 -0
  169. package/dist/lib/EntryOptionPlugin.d.ts +33 -0
  170. package/dist/lib/EnvironmentPlugin.d.ts +22 -0
  171. package/dist/lib/HookWebpackError.d.ts +40 -0
  172. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  173. package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
  174. package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
  175. package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
  176. package/dist/lib/NormalModuleReplacementPlugin.d.ts +29 -0
  177. package/dist/lib/WebpackError.d.ts +23 -0
  178. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  179. package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
  180. package/dist/lib/cache/mergeEtags.d.ts +17 -0
  181. package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
  182. package/dist/loader-runner/index.d.ts +40 -0
  183. package/dist/loader-runner/loadLoader.d.ts +11 -0
  184. package/dist/logging/Logger.d.ts +61 -0
  185. package/dist/logging/createConsoleLogger.d.ts +35 -0
  186. package/dist/logging/truncateArgs.d.ts +16 -0
  187. package/dist/moduleFederationDefaultRuntime.js +1 -0
  188. package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
  189. package/dist/node/NodeTemplatePlugin.d.ts +18 -0
  190. package/dist/node/NodeWatchFileSystem.d.ts +18 -0
  191. package/dist/node/nodeConsole.d.ts +15 -0
  192. package/dist/rspack.d.ts +16 -0
  193. package/dist/rspackOptionsApply.d.ts +4 -0
  194. package/dist/runtime/cssExtractHmr.d.ts +4 -0
  195. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  196. package/dist/sharing/ConsumeSharedPlugin.d.ts +41 -0
  197. package/dist/sharing/ProvideSharedPlugin.d.ts +34 -0
  198. package/dist/sharing/SharePlugin.d.ts +51 -0
  199. package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
  200. package/dist/sharing/utils.d.ts +1 -0
  201. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +4 -0
  202. package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
  203. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
  204. package/dist/stats/StatsFactory.d.ts +57 -0
  205. package/dist/stats/StatsPrinter.d.ts +57 -0
  206. package/dist/stats/statsFactoryUtils.d.ts +295 -0
  207. package/dist/util/ArrayQueue.d.ts +45 -0
  208. package/dist/util/AssetInfo.d.ts +7 -0
  209. package/dist/util/MergeCaller.d.ts +9 -0
  210. package/dist/util/SizeFormatHelpers.d.ts +10 -0
  211. package/dist/util/SplitChunkSize.d.ts +5 -0
  212. package/dist/util/assertNotNil.d.ts +1 -0
  213. package/dist/util/assetCondition.d.ts +2 -0
  214. package/dist/util/asyncLib.d.ts +54 -0
  215. package/dist/util/bindingVersionCheck.d.ts +5 -0
  216. package/dist/util/cleverMerge.d.ts +54 -0
  217. package/dist/util/comparators.d.ts +20 -0
  218. package/dist/util/createHash.d.ts +16 -0
  219. package/dist/util/createReadonlyMap.d.ts +1 -0
  220. package/dist/util/fake.d.ts +9 -0
  221. package/dist/util/fs.d.ts +342 -0
  222. package/dist/util/hash/BatchedHash.d.ts +29 -0
  223. package/dist/util/hash/index.d.ts +17 -0
  224. package/dist/util/hash/md4.d.ts +11 -0
  225. package/dist/util/hash/wasm-hash.d.ts +52 -0
  226. package/dist/util/hash/xxhash64.d.ts +11 -0
  227. package/dist/util/identifier.d.ts +79 -0
  228. package/dist/util/index.d.ts +19 -0
  229. package/dist/util/memoize.d.ts +3 -0
  230. package/dist/util/smartGrouping.d.ts +21 -0
  231. package/dist/util/source.d.ts +7 -0
  232. package/dist/util/validate.d.ts +6 -0
  233. package/hot/dev-server.js +75 -0
  234. package/hot/emitter.js +21 -0
  235. package/hot/lazy-compilation-node.js +50 -0
  236. package/hot/lazy-compilation-web.js +83 -0
  237. package/hot/log-apply-result.js +49 -0
  238. package/hot/log.js +79 -0
  239. package/hot/only-dev-server.js +103 -0
  240. package/hot/poll.js +40 -0
  241. package/hot/signal.js +66 -0
  242. package/module.d.ts +244 -0
  243. package/package.json +55 -0
@@ -0,0 +1,22 @@
1
+ import type * as binding from "@rspack/binding";
2
+ import type { Compiler, RspackPluginInstance } from "..";
3
+ type AffectedHooks = keyof Compiler["hooks"];
4
+ export declare const HOOKS_CAN_NOT_INHERENT_FROM_PARENT: string[];
5
+ export declare function canInherentFromParent(affectedHooks?: AffectedHooks): boolean;
6
+ export declare abstract class RspackBuiltinPlugin implements RspackPluginInstance {
7
+ abstract raw(compiler: Compiler): binding.BuiltinPlugin | undefined;
8
+ abstract name: binding.BuiltinPluginName;
9
+ affectedHooks?: AffectedHooks;
10
+ apply(compiler: Compiler): void;
11
+ }
12
+ export declare function createBuiltinPlugin<R>(name: binding.BuiltinPluginName, options: R): binding.BuiltinPlugin;
13
+ export declare function create<T extends any[], R>(name: binding.BuiltinPluginName, resolve: (this: Compiler, ...args: T) => R, affectedHooks?: AffectedHooks): {
14
+ new (...args: T): {
15
+ name: binding.BuiltinPluginName;
16
+ _args: T;
17
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
18
+ raw(compiler: Compiler): binding.BuiltinPlugin;
19
+ apply(compiler: Compiler): void;
20
+ };
21
+ };
22
+ export {};
@@ -0,0 +1,23 @@
1
+ import { type RawCssExtractPluginOption } from "@rspack/binding";
2
+ import type { Compiler } from "../..";
3
+ export * from "./loader";
4
+ export type { CssExtractRspackLoaderOptions } from "./loader";
5
+ export interface CssExtractRspackPluginOptions {
6
+ filename?: RawCssExtractPluginOption["filename"];
7
+ chunkFilename?: RawCssExtractPluginOption["chunkFilename"];
8
+ ignoreOrder?: boolean;
9
+ insert?: string | ((linkTag: HTMLLinkElement) => void);
10
+ attributes?: Record<string, string>;
11
+ linkType?: string | "text/css" | false;
12
+ runtime?: boolean;
13
+ pathinfo?: boolean;
14
+ }
15
+ export declare class CssExtractRspackPlugin {
16
+ static pluginName: string;
17
+ static loader: string;
18
+ options: CssExtractRspackPluginOptions;
19
+ constructor(options?: CssExtractRspackPluginOptions);
20
+ apply(compiler: Compiler): void;
21
+ normalizeOptions(options: CssExtractRspackPluginOptions): RawCssExtractPluginOption;
22
+ }
23
+ export default CssExtractRspackPlugin;
@@ -0,0 +1,21 @@
1
+ import type { LoaderContext, LoaderDefinition } from "../..";
2
+ export declare const BASE_URI = "webpack://";
3
+ export declare const MODULE_TYPE = "css/mini-extract";
4
+ export declare const AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__";
5
+ export declare const ABSOLUTE_PUBLIC_PATH = "webpack:///mini-css-extract-plugin/";
6
+ export declare const SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
7
+ export interface CssExtractRspackLoaderOptions {
8
+ publicPath?: string | ((resourcePath: string, context: string) => string);
9
+ emit?: boolean;
10
+ esModule?: boolean;
11
+ layer?: string;
12
+ defaultExport?: boolean;
13
+ }
14
+ export declare function hotLoader(content: string, context: {
15
+ loaderContext: LoaderContext;
16
+ options?: CssExtractRspackLoaderOptions;
17
+ locals?: Record<string, string>;
18
+ }): string;
19
+ declare const loader: LoaderDefinition;
20
+ export declare const pitch: LoaderDefinition["pitch"];
21
+ export default loader;
@@ -0,0 +1,6 @@
1
+ import type { LoaderContext } from "../..";
2
+ export declare function isAbsolutePath(str: string): boolean;
3
+ export declare const PLUGIN_NAME = "css-extract-rspack-plugin";
4
+ export declare function isRelativePath(str: string): boolean;
5
+ export declare function stringifyRequest(loaderContext: LoaderContext, request: string): string;
6
+ export declare function stringifyLocal(value: any): any;
@@ -0,0 +1,71 @@
1
+ export { RspackBuiltinPlugin } from "./base";
2
+ export * from "./APIPlugin";
3
+ export * from "./ArrayPushCallbackChunkFormatPlugin";
4
+ export * from "./AssetModulesPlugin";
5
+ export * from "./AsyncWebAssemblyModulesPlugin";
6
+ export * from "./BannerPlugin";
7
+ export * from "./BundlerInfoRspackPlugin";
8
+ export * from "./ChunkPrefetchPreloadPlugin";
9
+ export * from "./CommonJsChunkFormatPlugin";
10
+ export * from "./CopyRspackPlugin";
11
+ export * from "./css-extract/index";
12
+ export * from "./CssModulesPlugin";
13
+ export * from "./DataUriPlugin";
14
+ export * from "./DefinePlugin";
15
+ export * from "./DeterministicChunkIdsPlugin";
16
+ export * from "./DeterministicModuleIdsPlugin";
17
+ export * from "./DynamicEntryPlugin";
18
+ export * from "./ElectronTargetPlugin";
19
+ export * from "./EnableChunkLoadingPlugin";
20
+ export * from "./EnableLibraryPlugin";
21
+ export * from "./EnableWasmLoadingPlugin";
22
+ export * from "./EnsureChunkConditionsPlugin";
23
+ export * from "./EntryPlugin";
24
+ export * from "./EvalDevToolModulePlugin";
25
+ export * from "./EvalSourceMapDevToolPlugin";
26
+ export * from "./ExternalsPlugin";
27
+ export * from "./FileUriPlugin";
28
+ export * from "./FlagDependencyExportsPlugin";
29
+ export * from "./FlagDependencyUsagePlugin";
30
+ export * from "./HotModuleReplacementPlugin";
31
+ export * from "./HtmlRspackPlugin";
32
+ export * from "./HttpExternalsRspackPlugin";
33
+ export * from "./IgnorePlugin";
34
+ export * from "./InferAsyncModulesPlugin";
35
+ export * from "./JavascriptModulesPlugin";
36
+ export * from "./JsLoaderRspackPlugin";
37
+ export * from "./JsonModulesPlugin";
38
+ export * from "./lazy-compilation/plugin";
39
+ export * from "./LimitChunkCountPlugin";
40
+ export * from "./MangleExportsPlugin";
41
+ export * from "./MergeDuplicateChunksPlugin";
42
+ export * from "./ModuleChunkFormatPlugin";
43
+ export * from "./ModuleConcatenationPlugin";
44
+ export * from "./NamedChunkIdsPlugin";
45
+ export * from "./NamedModuleIdsPlugin";
46
+ export * from "./NaturalChunkIdsPlugin";
47
+ export * from "./NaturalModuleIdsPlugin";
48
+ export * from "./NodeTargetPlugin";
49
+ export * from "./ProgressPlugin";
50
+ export * from "./ProvidePlugin";
51
+ export * from "./RealContentHashPlugin";
52
+ export * from "./RemoveEmptyChunksPlugin";
53
+ export * from "./RuntimeChunkPlugin";
54
+ export * from "./RuntimePlugin";
55
+ export * from "./SideEffectsFlagPlugin";
56
+ export * from "./SizeLimitsPlugin";
57
+ export * from "./SourceMapDevToolPlugin";
58
+ export * from "./SplitChunksPlugin";
59
+ export * from "./LightningCssMinimizerRspackPlugin";
60
+ export * from "./RemoveDuplicateModulesPlugin";
61
+ export * from "./LightningCssMinimizerRspackPlugin";
62
+ export * from "./SwcJsMinimizerPlugin";
63
+ export * from "./WarnCaseSensitiveModulesPlugin";
64
+ export * from "./WebWorkerTemplatePlugin";
65
+ export * from "./WorkerPlugin";
66
+ export * from "./FetchCompileAsyncWasmPlugin";
67
+ export * from "./NoEmitOnErrorsPlugin";
68
+ export * from "./ContextReplacementPlugin";
69
+ export * from "./LibManifestPlugin";
70
+ export * from "./DllEntryPlugin";
71
+ export * from "./DllReferenceAgencyPlugin";
@@ -0,0 +1,46 @@
1
+ import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "node:http";
2
+ import type { ListenOptions, Server } from "node:net";
3
+ import type { SecureContextOptions, TlsOptions } from "node:tls";
4
+ import type { Compiler } from "../..";
5
+ export interface LazyCompilationDefaultBackendOptions {
6
+ /**
7
+ * A custom client.
8
+ */
9
+ client?: string;
10
+ /**
11
+ * Specifies where to listen to from the server.
12
+ */
13
+ listen?: number | ListenOptions | ((server: Server) => void);
14
+ /**
15
+ * Specifies the protocol the client should use to connect to the server.
16
+ */
17
+ protocol?: "http" | "https";
18
+ /**
19
+ * Specifies how to create the server handling the EventSource requests.
20
+ */
21
+ server?: ServerOptionsImport<typeof IncomingMessage> | ServerOptionsHttps<typeof IncomingMessage, typeof ServerResponse> | (() => Server);
22
+ }
23
+ export type ServerOptionsHttps<Request extends typeof IncomingMessage = typeof IncomingMessage, Response extends typeof ServerResponse = typeof ServerResponse> = SecureContextOptions & TlsOptions & ServerOptionsImport<Request, Response>;
24
+ declare const getBackend: (options: Omit<LazyCompilationDefaultBackendOptions, "client"> & {
25
+ client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>;
26
+ }) => (compiler: Compiler, callback: (err: any, obj?: {
27
+ dispose: (callback: (err: any) => void) => void;
28
+ module: (args: {
29
+ module: string;
30
+ path: string;
31
+ }) => {
32
+ data: string;
33
+ client: string;
34
+ active: boolean;
35
+ };
36
+ }) => void) => void;
37
+ export default getBackend;
38
+ export declare function dispose(callback: any): void;
39
+ export declare function moduleImpl(args: {
40
+ module: string;
41
+ path: string;
42
+ }): {
43
+ active: boolean;
44
+ data: string;
45
+ client: string;
46
+ };
@@ -0,0 +1,24 @@
1
+ import { BuiltinPluginName, type JsModule } from "@rspack/binding";
2
+ export declare const BuiltinLazyCompilationPlugin: {
3
+ new (module: (args: {
4
+ module: string;
5
+ path: string;
6
+ }) => {
7
+ active: boolean;
8
+ data: string;
9
+ client: string;
10
+ }, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean) | undefined): {
11
+ name: BuiltinPluginName;
12
+ _args: [module: (args: {
13
+ module: string;
14
+ path: string;
15
+ }) => {
16
+ active: boolean;
17
+ data: string;
18
+ client: string;
19
+ }, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean) | undefined];
20
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
21
+ raw(compiler: import("../..").Compiler): import("@rspack/binding").BuiltinPlugin;
22
+ apply(compiler: import("../..").Compiler): void;
23
+ };
24
+ };
@@ -0,0 +1,13 @@
1
+ import type { JsModule } from "@rspack/binding";
2
+ import type { Compiler } from "../..";
3
+ import { type LazyCompilationDefaultBackendOptions } from "./backend";
4
+ export default class LazyCompilationPlugin {
5
+ cacheable: boolean;
6
+ entries: boolean;
7
+ imports: boolean;
8
+ test?: RegExp | ((m: JsModule) => boolean);
9
+ backend?: LazyCompilationDefaultBackendOptions;
10
+ constructor(cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean), backend?: LazyCompilationDefaultBackendOptions);
11
+ apply(compiler: Compiler): void;
12
+ }
13
+ export { LazyCompilationPlugin };
@@ -0,0 +1,10 @@
1
+ import { type JsLibraryOptions, type RawOptions } from "@rspack/binding";
2
+ import type { Compiler } from "../Compiler";
3
+ import { type LoaderContext, type LoaderDefinition, type LoaderDefinitionFunction } from "./adapterRuleUse";
4
+ import type { RspackOptionsNormalized } from "./normalization";
5
+ import type { ChunkLoading, LibraryOptions, Resolve } from "./types";
6
+ export type { LoaderContext, LoaderDefinition, LoaderDefinitionFunction };
7
+ export declare const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions;
8
+ export declare function getRawResolve(resolve: Resolve): RawOptions["resolve"];
9
+ export declare function getRawLibrary(library: LibraryOptions): JsLibraryOptions;
10
+ export declare function getRawChunkLoading(chunkLoading: ChunkLoading): string;
@@ -0,0 +1,157 @@
1
+ import type { JsAssetInfo, RawModuleRuleUse, RawOptions } from "@rspack/binding";
2
+ import type { ResolveRequest } from "../../compiled/enhanced-resolve";
3
+ import type { Compilation } from "../Compilation";
4
+ import type { Compiler } from "../Compiler";
5
+ import type { Module } from "../Module";
6
+ import { type LoaderObject } from "../loader-runner";
7
+ import type { Logger } from "../logging/Logger";
8
+ import type Hash from "../util/hash";
9
+ import type { Mode, PublicPath, Resolve, RuleSetUseItem, Target } from "./types";
10
+ export declare const BUILTIN_LOADER_PREFIX = "builtin:";
11
+ export interface ComposeJsUseOptions {
12
+ devtool: RawOptions["devtool"];
13
+ context: RawOptions["context"];
14
+ mode: RawOptions["mode"];
15
+ experiments: RawOptions["experiments"];
16
+ compiler: Compiler;
17
+ }
18
+ export interface SourceMap {
19
+ version: number;
20
+ sources: string[];
21
+ mappings: string;
22
+ file?: string;
23
+ sourceRoot?: string;
24
+ sourcesContent?: string[];
25
+ names?: string[];
26
+ }
27
+ export interface AdditionalData {
28
+ [index: string]: any;
29
+ }
30
+ export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => void;
31
+ export type ErrorWithDetails = Error & {
32
+ details?: string;
33
+ };
34
+ export type ResolveCallback = (err: null | ErrorWithDetails, res?: string | false, req?: ResolveRequest) => void;
35
+ export interface DiagnosticLocation {
36
+ /** Text for highlighting the location */
37
+ text?: string;
38
+ /** 1-based line */
39
+ line: number;
40
+ /** 0-based column in bytes */
41
+ column: number;
42
+ /** Length in bytes */
43
+ length: number;
44
+ }
45
+ export interface Diagnostic {
46
+ message: string;
47
+ help?: string;
48
+ sourceCode?: string;
49
+ /**
50
+ * Location to the source code.
51
+ *
52
+ * If `sourceCode` is not provided, location will be omitted.
53
+ */
54
+ location?: DiagnosticLocation;
55
+ file?: string;
56
+ severity: "error" | "warning";
57
+ }
58
+ interface LoaderExperiments {
59
+ emitDiagnostic(diagnostic: Diagnostic): void;
60
+ }
61
+ export interface LoaderContext<OptionsType = {}> {
62
+ version: 2;
63
+ resource: string;
64
+ resourcePath: string;
65
+ resourceQuery: string;
66
+ resourceFragment: string;
67
+ async(): LoaderContextCallback;
68
+ callback: LoaderContextCallback;
69
+ cacheable(cacheable?: boolean): void;
70
+ sourceMap: boolean;
71
+ rootContext: string;
72
+ context: string | null;
73
+ loaderIndex: number;
74
+ remainingRequest: string;
75
+ currentRequest: string;
76
+ previousRequest: string;
77
+ request: string;
78
+ /**
79
+ * An array of all the loaders. It is writeable in the pitch phase.
80
+ * loaders = [{request: string, path: string, query: string, module: function}]
81
+ *
82
+ * In the example:
83
+ * [
84
+ * { request: "/abc/loader1.js?xyz",
85
+ * path: "/abc/loader1.js",
86
+ * query: "?xyz",
87
+ * module: [Function]
88
+ * },
89
+ * { request: "/abc/node_modules/loader2/index.js",
90
+ * path: "/abc/node_modules/loader2/index.js",
91
+ * query: "",
92
+ * module: [Function]
93
+ * }
94
+ * ]
95
+ */
96
+ loaders: LoaderObject[];
97
+ mode?: Mode;
98
+ target?: Target;
99
+ hot?: boolean;
100
+ /**
101
+ * @param schema To provide the best performance, Rspack does not perform the schema validation. If your loader requires schema validation, please call scheme-utils or zod on your own.
102
+ */
103
+ getOptions(schema?: any): OptionsType;
104
+ resolve(context: string, request: string, callback: (arg0: null | Error, arg1?: string | false, arg2?: ResolveRequest) => void): void;
105
+ getResolve(options: Resolve): ((context: string, request: string, callback: ResolveCallback) => void) | ((context: string, request: string) => Promise<string | false | undefined>);
106
+ getLogger(name: string): Logger;
107
+ emitError(error: Error): void;
108
+ emitWarning(warning: Error): void;
109
+ emitFile(name: string, content: string | Buffer, sourceMap?: string, assetInfo?: JsAssetInfo): void;
110
+ addDependency(file: string): void;
111
+ dependency(file: string): void;
112
+ addContextDependency(context: string): void;
113
+ addMissingDependency(missing: string): void;
114
+ clearDependencies(): void;
115
+ getDependencies(): string[];
116
+ getContextDependencies(): string[];
117
+ getMissingDependencies(): string[];
118
+ addBuildDependency(file: string): void;
119
+ importModule(request: string, options: {
120
+ layer?: string;
121
+ publicPath?: PublicPath;
122
+ baseUri?: string;
123
+ }, callback: (err?: Error, res?: any) => void): void;
124
+ fs: any;
125
+ /**
126
+ * This is an experimental API and maybe subject to change.
127
+ * @experimental
128
+ */
129
+ experiments: LoaderExperiments;
130
+ utils: {
131
+ absolutify: (context: string, request: string) => string;
132
+ contextify: (context: string, request: string) => string;
133
+ createHash: (algorithm?: string) => Hash;
134
+ };
135
+ query: string | OptionsType;
136
+ data: unknown;
137
+ _compiler: Compiler;
138
+ _compilation: Compilation;
139
+ _module: Module;
140
+ /**
141
+ * Note: This is not a webpack public API, maybe removed in future.
142
+ * Store some data from loader, and consume it from parser, it may be removed in the future
143
+ *
144
+ * @internal
145
+ */
146
+ __internal__parseMeta: Record<string, string>;
147
+ }
148
+ export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer>;
149
+ export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer>;
150
+ export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
151
+ raw?: false;
152
+ pitch?: PitchLoaderDefinitionFunction;
153
+ };
154
+ export declare function createRawModuleRuleUses(uses: RuleSetUseItem | RuleSetUseItem[], path: string, options: ComposeJsUseOptions): RawModuleRuleUse[];
155
+ export declare function isUseSourceMap(devtool: RawOptions["devtool"]): boolean;
156
+ export declare function isUseSimpleSourceMap(devtool: RawOptions["devtool"]): boolean;
157
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/browserslistTargetHandler.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Sergey Melyukov @smelukov
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+ import type { ApiTargetProperties, EcmaTargetProperties, PlatformTargetProperties } from "./target";
11
+ /**
12
+ * @param input input string
13
+ * @param context the context directory
14
+ * @returns selected browsers
15
+ */
16
+ export declare const load: (input: string | null | undefined, context: string) => string[] | undefined;
17
+ /**
18
+ * @param browsers supported browsers list
19
+ * @returns target properties
20
+ */
21
+ export declare const resolve: (browsers: string[]) => EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/defaults.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+ import type { RspackOptionsNormalized } from "./normalization";
11
+ export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
12
+ export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
@@ -0,0 +1,5 @@
1
+ export * from "./adapter";
2
+ export * from "./defaults";
3
+ export * from "./normalization";
4
+ export * from "./zod";
5
+ export type * from "./types";
@@ -0,0 +1,128 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/normalization.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+ import type { Compilation } from "../Compilation";
11
+ import type { AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, ExperimentCacheOptions, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./types";
12
+ export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
13
+ export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
14
+ export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
15
+ export interface EntryStaticNormalized {
16
+ [k: string]: EntryDescriptionNormalized;
17
+ }
18
+ export type EntryDescriptionNormalized = Pick<EntryDescription, "runtime" | "chunkLoading" | "asyncChunks" | "publicPath" | "baseUri" | "filename" | "library" | "layer"> & {
19
+ import?: string[];
20
+ dependOn?: string[];
21
+ };
22
+ export interface OutputNormalized {
23
+ path?: Path;
24
+ pathinfo?: boolean | "verbose";
25
+ clean?: Clean;
26
+ publicPath?: PublicPath;
27
+ filename?: Filename;
28
+ chunkFilename?: ChunkFilename;
29
+ crossOriginLoading?: CrossOriginLoading;
30
+ cssFilename?: CssFilename;
31
+ cssChunkFilename?: CssChunkFilename;
32
+ hotUpdateMainFilename?: HotUpdateMainFilename;
33
+ hotUpdateChunkFilename?: HotUpdateChunkFilename;
34
+ hotUpdateGlobal?: HotUpdateGlobal;
35
+ assetModuleFilename?: AssetModuleFilename;
36
+ uniqueName?: UniqueName;
37
+ chunkLoadingGlobal?: ChunkLoadingGlobal;
38
+ enabledLibraryTypes?: EnabledLibraryTypes;
39
+ library?: LibraryOptions;
40
+ module?: OutputModule;
41
+ strictModuleErrorHandling?: StrictModuleErrorHandling;
42
+ globalObject?: GlobalObject;
43
+ importFunctionName?: ImportFunctionName;
44
+ importMetaName?: ImportMetaName;
45
+ iife?: Iife;
46
+ wasmLoading?: WasmLoading;
47
+ enabledWasmLoadingTypes?: EnabledWasmLoadingTypes;
48
+ webassemblyModuleFilename?: WebassemblyModuleFilename;
49
+ chunkFormat?: string | false;
50
+ chunkLoading?: string | false;
51
+ enabledChunkLoadingTypes?: string[];
52
+ trustedTypes?: TrustedTypes;
53
+ sourceMapFilename?: SourceMapFilename;
54
+ hashDigest?: HashDigest;
55
+ hashDigestLength?: HashDigestLength;
56
+ hashFunction?: HashFunction;
57
+ hashSalt?: HashSalt;
58
+ asyncChunks?: boolean;
59
+ workerChunkLoading?: ChunkLoading;
60
+ workerWasmLoading?: WasmLoading;
61
+ workerPublicPath?: WorkerPublicPath;
62
+ scriptType?: ScriptType;
63
+ devtoolNamespace?: DevtoolNamespace;
64
+ devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
65
+ devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
66
+ environment?: Environment;
67
+ charset?: boolean;
68
+ chunkLoadTimeout?: number;
69
+ compareBeforeEmit?: boolean;
70
+ }
71
+ export interface ModuleOptionsNormalized {
72
+ defaultRules?: RuleSetRules;
73
+ rules: RuleSetRules;
74
+ parser: ParserOptionsByModuleType;
75
+ generator: GeneratorOptionsByModuleType;
76
+ noParse?: NoParseOption;
77
+ }
78
+ export interface ExperimentsNormalized {
79
+ cache?: ExperimentCacheOptions;
80
+ lazyCompilation?: false | LazyCompilationOptions;
81
+ asyncWebAssembly?: boolean;
82
+ outputModule?: boolean;
83
+ topLevelAwait?: boolean;
84
+ css?: boolean;
85
+ layers?: boolean;
86
+ incremental?: false | Incremental;
87
+ futureDefaults?: boolean;
88
+ rspackFuture?: RspackFutureOptions;
89
+ }
90
+ export type IgnoreWarningsNormalized = ((warning: Error, compilation: Compilation) => boolean)[];
91
+ export type OptimizationRuntimeChunkNormalized = false | {
92
+ name: string | ((entrypoint: {
93
+ name: string;
94
+ }) => string);
95
+ };
96
+ export interface RspackOptionsNormalized {
97
+ name?: Name;
98
+ dependencies?: Dependencies;
99
+ context?: Context;
100
+ mode?: Mode;
101
+ entry: EntryNormalized;
102
+ output: OutputNormalized;
103
+ resolve: Resolve;
104
+ resolveLoader: Resolve;
105
+ module: ModuleOptionsNormalized;
106
+ target?: Target;
107
+ externals?: Externals;
108
+ externalsType?: ExternalsType;
109
+ externalsPresets: ExternalsPresets;
110
+ infrastructureLogging: InfrastructureLogging;
111
+ devtool?: DevTool;
112
+ node: Node;
113
+ loader: Loader;
114
+ snapshot: SnapshotOptions;
115
+ cache?: CacheOptions;
116
+ stats: StatsValue;
117
+ optimization: Optimization;
118
+ plugins: Plugins;
119
+ experiments: ExperimentsNormalized;
120
+ watch?: Watch;
121
+ watchOptions: WatchOptions;
122
+ devServer?: DevServer;
123
+ ignoreWarnings?: IgnoreWarningsNormalized;
124
+ performance?: Performance;
125
+ profile?: Profile;
126
+ amd?: string;
127
+ bail?: Bail;
128
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @param context the context directory
3
+ * @returns default target
4
+ */
5
+ export declare const getDefaultTarget: (context: string) => "browserslist" | "web";
6
+ export type PlatformTargetProperties = {
7
+ /** web platform, importing of http(s) and std: is available */
8
+ web: boolean | null;
9
+ /** browser platform, running in a normal web browser */
10
+ browser: boolean | null;
11
+ /** (Web)Worker platform, running in a web/shared/service worker */
12
+ webworker: boolean | null;
13
+ /** node platform, require of node built-in modules is available */
14
+ node: boolean | null;
15
+ /** nwjs platform, require of legacy nw.gui is available */
16
+ nwjs: boolean | null;
17
+ /** electron platform, require of some electron built-in modules is available */
18
+ electron: boolean | null;
19
+ };
20
+ export type ElectronContextTargetProperties = {
21
+ /** in main context */
22
+ electronMain: boolean | null;
23
+ /** in preload context */
24
+ electronPreload: boolean | null;
25
+ /** in renderer context with node integration */
26
+ electronRenderer: boolean | null;
27
+ };
28
+ export type ApiTargetProperties = {
29
+ /** has require function available */
30
+ require: boolean | null;
31
+ /** has node.js built-in modules available */
32
+ nodeBuiltins: boolean | null;
33
+ /** node.js allows to use `node:` prefix for core modules */
34
+ nodePrefixForCoreModules: boolean | null;
35
+ /** has document available (allows script tags) */
36
+ document: boolean | null;
37
+ /** has importScripts available */
38
+ importScripts: boolean | null;
39
+ /** has importScripts available when creating a worker */
40
+ importScriptsInWorker: boolean | null;
41
+ /** has fetch function available for WebAssembly */
42
+ fetchWasm: boolean | null;
43
+ /** has global variable available */
44
+ global: boolean | null;
45
+ };
46
+ export type EcmaTargetProperties = {
47
+ /** has globalThis variable available */
48
+ globalThis: boolean | null;
49
+ /** big int literal syntax is available */
50
+ bigIntLiteral: boolean | null;
51
+ /** const and let variable declarations are available */
52
+ const: boolean | null;
53
+ /** arrow functions are available */
54
+ arrowFunction: boolean | null;
55
+ /** for of iteration is available */
56
+ forOf: boolean | null;
57
+ /** destructuring is available */
58
+ destructuring: boolean | null;
59
+ /** async import() is available */
60
+ dynamicImport: boolean | null;
61
+ /** async import() is available when creating a worker */
62
+ dynamicImportInWorker: boolean | null;
63
+ /** ESM syntax is available (when in module) */
64
+ module: boolean | null;
65
+ /** optional chaining is available */
66
+ optionalChaining: boolean | null;
67
+ /** template literal is available */
68
+ templateLiteral: boolean | null;
69
+ /** async functions and await are available */
70
+ asyncFunction: boolean | null;
71
+ };
72
+ type Never<T> = {
73
+ [P in keyof T]?: never;
74
+ };
75
+ type Mix<A, B> = (A & Never<B>) | (Never<A> & B) | (A & B);
76
+ type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>;
77
+ /**
78
+ * @param target the target
79
+ * @param context the context directory
80
+ * @returns target properties
81
+ */
82
+ export declare const getTargetProperties: (target: string, context: string) => TargetProperties;
83
+ /**
84
+ * @param targets the targets
85
+ * @param context the context directory
86
+ * @returns target properties
87
+ */
88
+ export declare const getTargetsProperties: (targets: string[], context: string) => TargetProperties;
89
+ export {};