@rspack-debug/browser 0.0.0-alpha.0 → 1.6.4
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.
- package/LICENSE +22 -0
- package/README.md +15 -0
- package/dist/BuildInfo.d.ts +17 -0
- package/dist/Chunk.d.ts +16 -0
- package/dist/ChunkGraph.d.ts +9 -0
- package/dist/Chunks.d.ts +12 -0
- package/dist/CodeGenerationResults.d.ts +1 -0
- package/dist/Compilation.d.ts +417 -0
- package/dist/Compiler.d.ts +223 -0
- package/dist/ConcatenatedModule.d.ts +1 -0
- package/dist/ContextModule.d.ts +1 -0
- package/dist/ContextModuleFactory.d.ts +13 -0
- package/dist/Diagnostics.d.ts +7 -0
- package/dist/Entrypoint.d.ts +2 -0
- package/dist/ErrorHelpers.d.ts +3 -0
- package/dist/ExecuteModulePlugin.d.ts +4 -0
- package/dist/ExportsInfo.d.ts +20 -0
- package/dist/ExternalModule.d.ts +1 -0
- package/dist/FileSystem.d.ts +54 -0
- package/dist/FileSystemInfo.d.ts +5 -0
- package/dist/Module.d.ts +42 -0
- package/dist/ModuleGraph.d.ts +19 -0
- package/dist/ModuleTypeConstants.d.ts +8 -0
- package/dist/MultiCompiler.d.ts +82 -0
- package/dist/MultiStats.d.ts +23 -0
- package/dist/MultiWatching.d.ts +27 -0
- package/dist/NativeWatchFileSystem.d.ts +23 -0
- package/dist/NormalModule.d.ts +15 -0
- package/dist/NormalModuleFactory.d.ts +23 -0
- package/dist/Resolver.d.ts +30 -0
- package/dist/ResolverFactory.d.ts +17 -0
- package/dist/RspackError.d.ts +12 -0
- package/dist/RuleSetCompiler.d.ts +9 -0
- package/dist/RuntimeGlobals.d.ts +328 -0
- package/dist/RuntimeModule.d.ts +32 -0
- package/dist/Stats.d.ts +17 -0
- package/dist/Template.d.ts +77 -0
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/Watching.d.ts +56 -0
- package/dist/binding.d.ts +8 -0
- package/dist/browser/BrowserHttpImportEsmPlugin.d.ts +48 -0
- package/dist/browser/BrowserRequirePlugin.d.ts +38 -0
- package/dist/browser/buffer.d.ts +1 -0
- package/dist/browser/fs.d.ts +13 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/service.d.ts +25 -0
- package/dist/builtin-loader/index.d.ts +1 -0
- package/dist/builtin-loader/lightningcss/index.d.ts +117 -0
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
- package/dist/builtin-loader/swc/index.d.ts +5 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
- package/dist/builtin-loader/swc/types.d.ts +83 -0
- package/dist/builtin-plugin/APIPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +59 -0
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +21 -0
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DataUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DefinePlugin.d.ts +16 -0
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +12 -0
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +25 -0
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FileUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +9 -0
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +9 -0
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
- package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +10 -0
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +17 -0
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +32 -0
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +14 -0
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +7 -0
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
- package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
- package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +49 -0
- package/dist/builtin-plugin/RslibPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimePlugin.d.ts +28 -0
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +19 -0
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +39 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +215 -0
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
- package/dist/builtin-plugin/WorkerPlugin.d.ts +13 -0
- package/dist/builtin-plugin/base.d.ts +45 -0
- package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
- package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
- package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
- package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
- package/dist/builtin-plugin/html-plugin/options.d.ts +82 -0
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +24 -0
- package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
- package/dist/builtin-plugin/index.d.ts +84 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +10 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +4 -0
- package/dist/config/adapter.d.ts +8 -0
- package/dist/config/adapterRuleUse.d.ts +391 -0
- package/dist/config/browserslistTargetHandler.d.ts +15 -0
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/devServer.d.ts +314 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/normalization.d.ts +169 -0
- package/dist/config/target.d.ts +89 -0
- package/dist/config/types.d.ts +2383 -0
- package/dist/container/ContainerPlugin.d.ts +40 -0
- package/dist/container/ContainerReferencePlugin.d.ts +33 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +37 -0
- package/dist/container/ModuleFederationPlugin.d.ts +15 -0
- package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +12 -0
- package/dist/container/index.d.ts +4 -0
- package/dist/container/options.d.ts +3 -0
- package/dist/error/ConcurrentCompilationError.d.ts +14 -0
- package/dist/exports.d.ts +166 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +66931 -0
- package/dist/index.mjs.LICENSE.txt +19 -0
- package/dist/lib/AbstractMethodError.d.ts +23 -0
- package/dist/lib/Cache.d.ts +65 -0
- package/dist/lib/CacheFacade.d.ts +139 -0
- package/dist/lib/DllPlugin.d.ts +42 -0
- package/dist/lib/DllReferencePlugin.d.ts +119 -0
- package/dist/lib/EntryOptionPlugin.d.ts +33 -0
- package/dist/lib/EnvironmentPlugin.d.ts +22 -0
- package/dist/lib/HookWebpackError.d.ts +40 -0
- package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
- package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
- package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
- package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
- package/dist/lib/WebpackError.d.ts +21 -0
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
- package/dist/lib/cache/mergeEtags.d.ts +17 -0
- package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
- package/dist/loader-runner/ModuleError.d.ts +13 -0
- package/dist/loader-runner/index.d.ts +34 -0
- package/dist/loader-runner/loadLoader.d.ts +12 -0
- package/dist/loader-runner/service.d.ts +71 -0
- package/dist/loader-runner/utils.d.ts +7 -0
- package/dist/loader-runner/worker.d.ts +14 -0
- package/dist/logging/Logger.d.ts +61 -0
- package/dist/logging/createConsoleLogger.d.ts +35 -0
- package/dist/logging/truncateArgs.d.ts +16 -0
- package/dist/napi-binding.d.ts +3128 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
- package/dist/node/NodeTemplatePlugin.d.ts +18 -0
- package/dist/node/NodeWatchFileSystem.d.ts +18 -0
- package/dist/node/nodeConsole.d.ts +15 -0
- package/dist/rspack.d.ts +16 -0
- package/dist/rspack.wasi-browser.js +125 -0
- package/dist/rspackOptionsApply.d.ts +4 -0
- package/dist/runtime/cssExtractHmr.d.ts +4 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +41 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +34 -0
- package/dist/sharing/SharePlugin.d.ts +51 -0
- package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
- package/dist/sharing/utils.d.ts +1 -0
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +20 -0
- package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
- package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
- package/dist/stats/StatsFactory.d.ts +57 -0
- package/dist/stats/StatsPrinter.d.ts +57 -0
- package/dist/stats/statsFactoryUtils.d.ts +341 -0
- package/dist/swc.d.ts +7 -0
- package/dist/taps/compilation.d.ts +8 -0
- package/dist/taps/compiler.d.ts +2 -0
- package/dist/taps/contextModuleFactory.d.ts +2 -0
- package/dist/taps/index.d.ts +6 -0
- package/dist/taps/javascriptModules.d.ts +2 -0
- package/dist/taps/normalModuleFactory.d.ts +2 -0
- package/dist/taps/types.d.ts +11 -0
- package/dist/trace/index.d.ts +46 -0
- package/dist/trace/traceHookPlugin.d.ts +5 -0
- package/dist/util/ArrayQueue.d.ts +45 -0
- package/dist/util/AsyncTask.d.ts +7 -0
- package/dist/util/MergeCaller.d.ts +10 -0
- package/dist/util/SizeFormatHelpers.d.ts +10 -0
- package/dist/util/SplitChunkSize.d.ts +5 -0
- package/dist/util/assertNotNil.d.ts +1 -0
- package/dist/util/assetCondition.d.ts +2 -0
- package/dist/util/asyncLib.d.ts +54 -0
- package/dist/util/bindingVersionCheck.d.ts +5 -0
- package/dist/util/cleverMerge.d.ts +24 -0
- package/dist/util/comparators.d.ts +16 -0
- package/dist/util/createHash.d.ts +16 -0
- package/dist/util/createReadonlyMap.d.ts +1 -0
- package/dist/util/fake.d.ts +9 -0
- package/dist/util/fs.d.ts +375 -0
- package/dist/util/hash/index.d.ts +26 -0
- package/dist/util/hash/md4.d.ts +11 -0
- package/dist/util/hash/wasm-hash.d.ts +51 -0
- package/dist/util/hash/xxhash64.d.ts +11 -0
- package/dist/util/identifier.d.ts +31 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/memoize.d.ts +2 -0
- package/dist/util/runtime.d.ts +2 -0
- package/dist/util/smartGrouping.d.ts +21 -0
- package/dist/util/source.d.ts +6 -0
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/wasi-worker-browser.mjs +23591 -0
- package/dist/wasi-worker-browser.mjs.LICENSE.txt +12 -0
- package/package.json +48 -9
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Compilation } from "../../Compilation";
|
|
2
|
+
export type TemplateRenderFunction = (params: Record<string, any>) => string | Promise<string>;
|
|
3
|
+
export type TemplateParamFunction = (params: Record<string, any>) => Record<string, any> | Promise<Record<string, any>>;
|
|
4
|
+
export type HtmlRspackPluginOptions = {
|
|
5
|
+
/** The title to use for the generated HTML document. */
|
|
6
|
+
title?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The file to write the HTML to. You can specify a subdirectory here too (e.g.: `"pages/index.html"`).
|
|
9
|
+
* @default "index.html"
|
|
10
|
+
*/
|
|
11
|
+
filename?: string | ((entry: string) => string);
|
|
12
|
+
/** The template file path. */
|
|
13
|
+
template?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The template file content, priority is greater than `template` option.
|
|
16
|
+
*
|
|
17
|
+
* When using a function, pass in the template parameters and use the returned string as the template content.
|
|
18
|
+
*/
|
|
19
|
+
templateContent?: string | TemplateRenderFunction;
|
|
20
|
+
/**
|
|
21
|
+
* Allows to overwrite the parameters used in the template.
|
|
22
|
+
*
|
|
23
|
+
* When using a function, pass in the original template parameters and use the returned object as the final template parameters.
|
|
24
|
+
*/
|
|
25
|
+
templateParameters?: Record<string, string> | boolean | TemplateParamFunction;
|
|
26
|
+
/**
|
|
27
|
+
* The script and link tag inject position in template. Use `false` to not inject.
|
|
28
|
+
* If not specified, it will be automatically determined based on `scriptLoading` value.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
inject?: boolean | "head" | "body";
|
|
32
|
+
/** The public path used for script and link tags. */
|
|
33
|
+
publicPath?: string;
|
|
34
|
+
/** Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. */
|
|
35
|
+
base?: string | {
|
|
36
|
+
href?: string;
|
|
37
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Modern browsers support non-blocking JavaScript loading ([`defer` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#defer)) to improve the page startup performance.
|
|
41
|
+
*
|
|
42
|
+
* Setting this option to `'module'` adds attribute `type="module"` to the `script`. This also implies `defer` attribute on the `script`, since modules are automatically deferred.
|
|
43
|
+
* @default "defer"
|
|
44
|
+
* */
|
|
45
|
+
scriptLoading?: "blocking" | "defer" | "module" | "systemjs-module";
|
|
46
|
+
/** Allows you to add only some chunks. */
|
|
47
|
+
chunks?: string[];
|
|
48
|
+
/** Allows you to skip some chunks. */
|
|
49
|
+
excludeChunks?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Allows to control how chunks should be sorted before they are included to the HTML.
|
|
52
|
+
* @default "auto"
|
|
53
|
+
*/
|
|
54
|
+
chunksSortMode?: "auto" | "manual";
|
|
55
|
+
/**
|
|
56
|
+
* Configure the SRI hash algorithm, which is disabled by default.
|
|
57
|
+
* @deprecated Use `experiments.SubresourceIntegrityPlugin` instead.
|
|
58
|
+
*/
|
|
59
|
+
sri?: "sha256" | "sha384" | "sha512";
|
|
60
|
+
/**
|
|
61
|
+
* Controls whether to minify the output, disabled by default.
|
|
62
|
+
*/
|
|
63
|
+
minify?: boolean;
|
|
64
|
+
/** Adds the given favicon path to the output HTML. */
|
|
65
|
+
favicon?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Allows to inject meta-tags.
|
|
68
|
+
* @default {}
|
|
69
|
+
*/
|
|
70
|
+
meta?: Record<string, string | Record<string, string>>;
|
|
71
|
+
/**
|
|
72
|
+
* If `true` then append a unique Rspack compilation hash to all included scripts and CSS files. This is useful for cache busting.
|
|
73
|
+
*/
|
|
74
|
+
hash?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Any other options will be passed by hooks.
|
|
77
|
+
*/
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
};
|
|
80
|
+
export declare const getPluginOptions: (compilation: Compilation, uid: number) => any;
|
|
81
|
+
export declare const setPluginOptions: (compilation: Compilation, uid: number, options: HtmlRspackPluginOptions) => void;
|
|
82
|
+
export declare const cleanPluginOptions: (compilation: Compilation, uid: number) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type JsHtmlPluginTag } from "../../binding";
|
|
2
|
+
import type { Compilation } from "../../Compilation";
|
|
3
|
+
import type { Compiler } from "../../Compiler";
|
|
4
|
+
import { type HtmlRspackPluginHooks } from "./hooks";
|
|
5
|
+
import { type HtmlRspackPluginOptions } from "./options";
|
|
6
|
+
declare const HtmlRspackPluginImpl: {
|
|
7
|
+
new (c?: HtmlRspackPluginOptions | undefined): {
|
|
8
|
+
name: string;
|
|
9
|
+
_args: [c?: HtmlRspackPluginOptions | undefined];
|
|
10
|
+
affectedHooks: keyof import("../../Compiler").CompilerHooks | undefined;
|
|
11
|
+
raw(compiler: Compiler): import("../../binding").BuiltinPlugin;
|
|
12
|
+
apply(compiler: Compiler): void;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `getCompilationHooks` instead.
|
|
18
|
+
*/
|
|
19
|
+
getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
|
|
20
|
+
getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
|
|
21
|
+
createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string) => JsHtmlPluginTag;
|
|
22
|
+
version: number;
|
|
23
|
+
};
|
|
24
|
+
export { HtmlRspackPlugin };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export * from "./APIPlugin";
|
|
2
|
+
export * from "./ArrayPushCallbackChunkFormatPlugin";
|
|
3
|
+
export * from "./AssetModulesPlugin";
|
|
4
|
+
export * from "./AsyncWebAssemblyModulesPlugin";
|
|
5
|
+
export * from "./BannerPlugin";
|
|
6
|
+
export * from "./BundlerInfoRspackPlugin";
|
|
7
|
+
export { createNativePlugin, RspackBuiltinPlugin } from "./base";
|
|
8
|
+
export * from "./ChunkPrefetchPreloadPlugin";
|
|
9
|
+
export * from "./CircularDependencyRspackPlugin";
|
|
10
|
+
export * from "./CommonJsChunkFormatPlugin";
|
|
11
|
+
export * from "./ContextReplacementPlugin";
|
|
12
|
+
export * from "./CopyRspackPlugin";
|
|
13
|
+
export * from "./CssChunkingPlugin";
|
|
14
|
+
export * from "./CssModulesPlugin";
|
|
15
|
+
export * from "./css-extract/index";
|
|
16
|
+
export * from "./DataUriPlugin";
|
|
17
|
+
export * from "./DefinePlugin";
|
|
18
|
+
export * from "./DeterministicChunkIdsPlugin";
|
|
19
|
+
export * from "./DeterministicModuleIdsPlugin";
|
|
20
|
+
export * from "./DllEntryPlugin";
|
|
21
|
+
export * from "./DllReferenceAgencyPlugin";
|
|
22
|
+
export * from "./DynamicEntryPlugin";
|
|
23
|
+
export * from "./ElectronTargetPlugin";
|
|
24
|
+
export * from "./EnableChunkLoadingPlugin";
|
|
25
|
+
export * from "./EnableLibraryPlugin";
|
|
26
|
+
export * from "./EnableWasmLoadingPlugin";
|
|
27
|
+
export * from "./EnsureChunkConditionsPlugin";
|
|
28
|
+
export * from "./EntryPlugin";
|
|
29
|
+
export * from "./EsmLibraryPlugin";
|
|
30
|
+
export * from "./EvalDevToolModulePlugin";
|
|
31
|
+
export * from "./EvalSourceMapDevToolPlugin";
|
|
32
|
+
export * from "./ExternalsPlugin";
|
|
33
|
+
export * from "./FetchCompileAsyncWasmPlugin";
|
|
34
|
+
export * from "./FileUriPlugin";
|
|
35
|
+
export * from "./FlagDependencyExportsPlugin";
|
|
36
|
+
export * from "./FlagDependencyUsagePlugin";
|
|
37
|
+
export * from "./HotModuleReplacementPlugin";
|
|
38
|
+
export * from "./HttpExternalsRspackPlugin";
|
|
39
|
+
export * from "./HttpUriPlugin";
|
|
40
|
+
export * from "./html-plugin/index";
|
|
41
|
+
export * from "./IgnorePlugin";
|
|
42
|
+
export * from "./InferAsyncModulesPlugin";
|
|
43
|
+
export * from "./InlineExportsPlugin";
|
|
44
|
+
export * from "./JavascriptModulesPlugin";
|
|
45
|
+
export * from "./JsLoaderRspackPlugin";
|
|
46
|
+
export * from "./JsonModulesPlugin";
|
|
47
|
+
export * from "./LibManifestPlugin";
|
|
48
|
+
export * from "./LightningCssMinimizerRspackPlugin";
|
|
49
|
+
export * from "./LightningCssMinimizerRspackPlugin";
|
|
50
|
+
export * from "./LimitChunkCountPlugin";
|
|
51
|
+
export * from "./lazy-compilation/middleware";
|
|
52
|
+
export * from "./MangleExportsPlugin";
|
|
53
|
+
export * from "./MergeDuplicateChunksPlugin";
|
|
54
|
+
export * from "./ModuleChunkFormatPlugin";
|
|
55
|
+
export * from "./ModuleConcatenationPlugin";
|
|
56
|
+
export * from "./ModuleInfoHeaderPlugin";
|
|
57
|
+
export * from "./NamedChunkIdsPlugin";
|
|
58
|
+
export * from "./NamedModuleIdsPlugin";
|
|
59
|
+
export * from "./NaturalChunkIdsPlugin";
|
|
60
|
+
export * from "./NaturalModuleIdsPlugin";
|
|
61
|
+
export * from "./NodeTargetPlugin";
|
|
62
|
+
export * from "./NoEmitOnErrorsPlugin";
|
|
63
|
+
export * from "./NormalModuleReplacementPlugin";
|
|
64
|
+
export * from "./OccurrenceChunkIdsPlugin";
|
|
65
|
+
export * from "./ProgressPlugin";
|
|
66
|
+
export * from "./ProvidePlugin";
|
|
67
|
+
export * from "./RealContentHashPlugin";
|
|
68
|
+
export * from "./RemoveDuplicateModulesPlugin";
|
|
69
|
+
export * from "./RemoveEmptyChunksPlugin";
|
|
70
|
+
export * from "./RsdoctorPlugin";
|
|
71
|
+
export * from "./RslibPlugin";
|
|
72
|
+
export * from "./RstestPlugin";
|
|
73
|
+
export * from "./RuntimeChunkPlugin";
|
|
74
|
+
export * from "./RuntimePlugin";
|
|
75
|
+
export * from "./SideEffectsFlagPlugin";
|
|
76
|
+
export * from "./SizeLimitsPlugin";
|
|
77
|
+
export * from "./SourceMapDevToolPlugin";
|
|
78
|
+
export * from "./SplitChunksPlugin";
|
|
79
|
+
export * from "./SubresourceIntegrityPlugin";
|
|
80
|
+
export * from "./SwcJsMinimizerPlugin";
|
|
81
|
+
export * from "./URLPlugin";
|
|
82
|
+
export * from "./WarnCaseSensitiveModulesPlugin";
|
|
83
|
+
export * from "./WebWorkerTemplatePlugin";
|
|
84
|
+
export * from "./WorkerPlugin";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Module } from "../../Module";
|
|
2
|
+
export declare const BuiltinLazyCompilationPlugin: {
|
|
3
|
+
new (currentActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, test?: RegExp | ((module: Module) => boolean) | undefined): {
|
|
4
|
+
name: string;
|
|
5
|
+
_args: [currentActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, test?: RegExp | ((module: Module) => boolean) | undefined];
|
|
6
|
+
affectedHooks: keyof import("../..").CompilerHooks | undefined;
|
|
7
|
+
raw(compiler: import("../..").Compiler): import("../../binding").BuiltinPlugin;
|
|
8
|
+
apply(compiler: import("../..").Compiler): void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Compiler, MultiCompiler } from "../..";
|
|
2
|
+
import type { MiddlewareHandler } from "../../config/devServer";
|
|
3
|
+
export declare const LAZY_COMPILATION_PREFIX = "/lazy-compilation-using-";
|
|
4
|
+
export declare const lazyCompilationMiddleware: (compiler: Compiler | MultiCompiler) => MiddlewareHandler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RawOptions } from "../binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { type LoaderContext, type LoaderDefinition, type LoaderDefinitionFunction, type PitchLoaderDefinitionFunction } from "./adapterRuleUse";
|
|
4
|
+
import type { RspackOptionsNormalized } from "./normalization";
|
|
5
|
+
import type { Resolve } from "./types";
|
|
6
|
+
export type { LoaderContext, LoaderDefinition, LoaderDefinitionFunction, PitchLoaderDefinitionFunction };
|
|
7
|
+
export declare const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions;
|
|
8
|
+
export declare function getRawResolve(resolve: Resolve): RawOptions["resolve"];
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import type { AssetInfo, RawModuleRuleUse, RawOptions } from "../binding";
|
|
2
|
+
import type { Compilation } from "../Compilation";
|
|
3
|
+
import type { Compiler } from "../Compiler";
|
|
4
|
+
import { type LoaderObject } from "../loader-runner";
|
|
5
|
+
import type { Logger } from "../logging/Logger";
|
|
6
|
+
import type { Module } from "../Module";
|
|
7
|
+
import type { ResolveRequest } from "../Resolver";
|
|
8
|
+
import type Hash from "../util/hash";
|
|
9
|
+
import type { RspackOptionsNormalized } from "./normalization";
|
|
10
|
+
import type { Mode, PublicPath, Resolve, RuleSetUseItem, Target } from "./types";
|
|
11
|
+
export declare const BUILTIN_LOADER_PREFIX = "builtin:";
|
|
12
|
+
export interface ComposeJsUseOptions {
|
|
13
|
+
context: RawOptions["context"];
|
|
14
|
+
mode: RawOptions["mode"];
|
|
15
|
+
experiments: RawOptions["experiments"];
|
|
16
|
+
compiler: Compiler;
|
|
17
|
+
}
|
|
18
|
+
export interface RawSourceMap {
|
|
19
|
+
/**
|
|
20
|
+
* The version of the source map format, always 3
|
|
21
|
+
*/
|
|
22
|
+
version: number;
|
|
23
|
+
/**
|
|
24
|
+
* A list of original sources used by the mappings field
|
|
25
|
+
*/
|
|
26
|
+
sources: string[];
|
|
27
|
+
/**
|
|
28
|
+
* A string with the encoded mapping data
|
|
29
|
+
*/
|
|
30
|
+
mappings: string;
|
|
31
|
+
/**
|
|
32
|
+
* The filename of the generated code that this source map is associated with
|
|
33
|
+
*/
|
|
34
|
+
file: string;
|
|
35
|
+
/**
|
|
36
|
+
* An optional source root string, used for relocating source files on a server
|
|
37
|
+
* or removing repeated values in the sources entry.
|
|
38
|
+
*/
|
|
39
|
+
sourceRoot?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An array containing the actual content of the original source files
|
|
42
|
+
*/
|
|
43
|
+
sourcesContent?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* A list of symbol names which may be used by the mappings field.
|
|
46
|
+
*/
|
|
47
|
+
names: string[];
|
|
48
|
+
/**
|
|
49
|
+
* A unique identifier for debugging purposes
|
|
50
|
+
*/
|
|
51
|
+
debugId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* An array of indices into the sources array, indicating which sources
|
|
54
|
+
* should be ignored by debuggers
|
|
55
|
+
*/
|
|
56
|
+
ignoreList?: number[];
|
|
57
|
+
}
|
|
58
|
+
export interface AdditionalData {
|
|
59
|
+
[index: string]: any;
|
|
60
|
+
}
|
|
61
|
+
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => void;
|
|
62
|
+
export type ErrorWithDetails = Error & {
|
|
63
|
+
details?: string;
|
|
64
|
+
};
|
|
65
|
+
export type ResolveCallback = (err: null | ErrorWithDetails, res?: string | false, req?: ResolveRequest) => void;
|
|
66
|
+
export interface DiagnosticLocation {
|
|
67
|
+
/** Text for highlighting the location */
|
|
68
|
+
text?: string;
|
|
69
|
+
/** 1-based line */
|
|
70
|
+
line: number;
|
|
71
|
+
/** 0-based column in bytes */
|
|
72
|
+
column: number;
|
|
73
|
+
/** Length in bytes */
|
|
74
|
+
length: number;
|
|
75
|
+
}
|
|
76
|
+
export interface Diagnostic {
|
|
77
|
+
message: string;
|
|
78
|
+
help?: string;
|
|
79
|
+
sourceCode?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Location to the source code.
|
|
82
|
+
* If `sourceCode` is not provided, location will be omitted.
|
|
83
|
+
*/
|
|
84
|
+
location?: DiagnosticLocation;
|
|
85
|
+
/**
|
|
86
|
+
* Optional filename to show.
|
|
87
|
+
* If provided, it becomes the `StatsError.file` value in stats.
|
|
88
|
+
*/
|
|
89
|
+
file?: string;
|
|
90
|
+
severity: "error" | "warning";
|
|
91
|
+
}
|
|
92
|
+
export interface LoaderExperiments {
|
|
93
|
+
emitDiagnostic(diagnostic: Diagnostic): void;
|
|
94
|
+
}
|
|
95
|
+
export interface ImportModuleOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Specify a layer in which this module is placed/compiled
|
|
98
|
+
*/
|
|
99
|
+
layer?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The public path used for the built modules
|
|
102
|
+
*/
|
|
103
|
+
publicPath?: PublicPath;
|
|
104
|
+
/**
|
|
105
|
+
* Target base uri
|
|
106
|
+
*/
|
|
107
|
+
baseUri?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface LoaderContext<OptionsType = {}> {
|
|
110
|
+
/**
|
|
111
|
+
* The version number of the loader API. Currently 2.
|
|
112
|
+
* This is useful for providing backwards compatibility. Using the version you can specify
|
|
113
|
+
* custom logic or fallbacks for breaking changes.
|
|
114
|
+
*/
|
|
115
|
+
version: 2;
|
|
116
|
+
/**
|
|
117
|
+
* The path string of the current module.
|
|
118
|
+
* @example `'/abc/resource.js?query#hash'`.
|
|
119
|
+
*/
|
|
120
|
+
resource: string;
|
|
121
|
+
/**
|
|
122
|
+
* The path string of the current module, excluding the query and fragment parameters.
|
|
123
|
+
* @example `'/abc/resource.js?query#hash'` in `'/abc/resource.js'`.
|
|
124
|
+
*/
|
|
125
|
+
resourcePath: string;
|
|
126
|
+
/**
|
|
127
|
+
* The query parameter for the path string of the current module.
|
|
128
|
+
* @example `'?query'` in `'/abc/resource.js?query#hash'`.
|
|
129
|
+
*/
|
|
130
|
+
resourceQuery: string;
|
|
131
|
+
/**
|
|
132
|
+
* The fragment parameter of the current module's path string.
|
|
133
|
+
* @example `'#hash'` in `'/abc/resource.js?query#hash'`.
|
|
134
|
+
*/
|
|
135
|
+
resourceFragment: string;
|
|
136
|
+
/**
|
|
137
|
+
* Tells Rspack that this loader will be called asynchronously. Returns `this.callback`.
|
|
138
|
+
*/
|
|
139
|
+
async(): LoaderContextCallback;
|
|
140
|
+
/**
|
|
141
|
+
* A function that can be called synchronously or asynchronously in order to return multiple
|
|
142
|
+
* results. The expected arguments are:
|
|
143
|
+
*
|
|
144
|
+
* 1. The first parameter must be `Error` or `null`, which marks the current module as a
|
|
145
|
+
* compilation failure.
|
|
146
|
+
* 2. The second argument is a `string` or `Buffer`, which indicates the contents of the file
|
|
147
|
+
* after the module has been processed by the loader.
|
|
148
|
+
* 3. The third parameter is a source map that can be processed by the loader.
|
|
149
|
+
* 4. The fourth parameter is ignored by Rspack and can be anything (e.g. some metadata).
|
|
150
|
+
*/
|
|
151
|
+
callback: LoaderContextCallback;
|
|
152
|
+
/**
|
|
153
|
+
* A function that sets the cacheable flag.
|
|
154
|
+
* By default, the processing results of the loader are marked as cacheable.
|
|
155
|
+
* Calling this method and passing `false` turns off the loader's ability to
|
|
156
|
+
* cache processing results.
|
|
157
|
+
*/
|
|
158
|
+
cacheable(cacheable?: boolean): void;
|
|
159
|
+
/**
|
|
160
|
+
* Tells if source map should be generated. Since generating source maps can be an expensive task,
|
|
161
|
+
* you should check if source maps are actually requested.
|
|
162
|
+
*/
|
|
163
|
+
sourceMap: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* The base path configured in Rspack config via `context`.
|
|
166
|
+
*/
|
|
167
|
+
rootContext: string;
|
|
168
|
+
/**
|
|
169
|
+
* The directory path of the currently processed module, which changes with the
|
|
170
|
+
* location of each processed module.
|
|
171
|
+
* For example, if the loader is processing `/project/src/components/Button.js`,
|
|
172
|
+
* then the value of `this.context` would be `/project/src/components`.
|
|
173
|
+
*/
|
|
174
|
+
context: string | null;
|
|
175
|
+
/**
|
|
176
|
+
* The index in the loaders array of the current loader.
|
|
177
|
+
*/
|
|
178
|
+
loaderIndex: number;
|
|
179
|
+
remainingRequest: string;
|
|
180
|
+
currentRequest: string;
|
|
181
|
+
previousRequest: string;
|
|
182
|
+
/**
|
|
183
|
+
* The module specifier string after being resolved.
|
|
184
|
+
* For example, if a `resource.js` is processed by `loader1.js` and `loader2.js`, the value of
|
|
185
|
+
* `this.request` will be `/path/to/loader1.js!/path/to/loader2.js!/path/to/resource.js`.
|
|
186
|
+
*/
|
|
187
|
+
request: string;
|
|
188
|
+
/**
|
|
189
|
+
* An array of all the loaders. It is writeable in the pitch phase.
|
|
190
|
+
* loaders = [{request: string, path: string, query: string, module: function}]
|
|
191
|
+
*
|
|
192
|
+
* In the example:
|
|
193
|
+
* [
|
|
194
|
+
* { request: "/abc/loader1.js?xyz",
|
|
195
|
+
* path: "/abc/loader1.js",
|
|
196
|
+
* query: "?xyz",
|
|
197
|
+
* module: [Function]
|
|
198
|
+
* },
|
|
199
|
+
* { request: "/abc/node_modules/loader2/index.js",
|
|
200
|
+
* path: "/abc/node_modules/loader2/index.js",
|
|
201
|
+
* query: "",
|
|
202
|
+
* module: [Function]
|
|
203
|
+
* }
|
|
204
|
+
* ]
|
|
205
|
+
*/
|
|
206
|
+
loaders: LoaderObject[];
|
|
207
|
+
/**
|
|
208
|
+
* The value of `mode` is read when Rspack is run.
|
|
209
|
+
* The possible values are: `'production'`, `'development'`, `'none'`
|
|
210
|
+
*/
|
|
211
|
+
mode?: Mode;
|
|
212
|
+
/**
|
|
213
|
+
* The current compilation target. Passed from `target` configuration options.
|
|
214
|
+
*/
|
|
215
|
+
target?: Target;
|
|
216
|
+
/**
|
|
217
|
+
* Whether HMR is enabled.
|
|
218
|
+
*/
|
|
219
|
+
hot?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Get the options passed in by the loader's user.
|
|
222
|
+
* @param schema To provide the best performance, Rspack does not perform the schema
|
|
223
|
+
* validation. If your loader requires schema validation, please call scheme-utils or
|
|
224
|
+
* zod on your own.
|
|
225
|
+
*/
|
|
226
|
+
getOptions(schema?: any): OptionsType;
|
|
227
|
+
/**
|
|
228
|
+
* Resolve a module specifier.
|
|
229
|
+
* @param context The absolute path to a directory. This directory is used as the starting
|
|
230
|
+
* location for resolving.
|
|
231
|
+
* @param request The module specifier to be resolved.
|
|
232
|
+
* @param callback A callback function that gives the resolved path.
|
|
233
|
+
*/
|
|
234
|
+
resolve(context: string, request: string, callback: (arg0: null | Error, arg1?: string | false, arg2?: ResolveRequest) => void): void;
|
|
235
|
+
/**
|
|
236
|
+
* Create a resolver like `this.resolve`.
|
|
237
|
+
*/
|
|
238
|
+
getResolve(options: Resolve): ((context: string, request: string, callback: ResolveCallback) => void) | ((context: string, request: string) => Promise<string | false | undefined>);
|
|
239
|
+
/**
|
|
240
|
+
* Get the logger of this compilation, through which messages can be logged.
|
|
241
|
+
*/
|
|
242
|
+
getLogger(name: string): Logger;
|
|
243
|
+
/**
|
|
244
|
+
* Emit an error. Unlike `throw` and `this.callback(err)` in the loader, it does not
|
|
245
|
+
* mark the current module as a compilation failure, it just adds an error to Rspack's
|
|
246
|
+
* Compilation and displays it on the command line at the end of this compilation.
|
|
247
|
+
*/
|
|
248
|
+
emitError(error: Error): void;
|
|
249
|
+
/**
|
|
250
|
+
* Emit a warning.
|
|
251
|
+
*/
|
|
252
|
+
emitWarning(warning: Error): void;
|
|
253
|
+
/**
|
|
254
|
+
* Emit a new file. This method allows you to create new files during the loader execution.
|
|
255
|
+
*/
|
|
256
|
+
emitFile(name: string, content: string | Buffer, sourceMap?: string, assetInfo?: AssetInfo): void;
|
|
257
|
+
/**
|
|
258
|
+
* Add a file as a dependency on the loader results so that any changes to them can be listened to.
|
|
259
|
+
* For example, `sass-loader`, `less-loader` use this trick to recompile when the imported style
|
|
260
|
+
* files change.
|
|
261
|
+
*/
|
|
262
|
+
addDependency(file: string): void;
|
|
263
|
+
/**
|
|
264
|
+
* Alias of `this.addDependency()`.
|
|
265
|
+
*/
|
|
266
|
+
dependency(file: string): void;
|
|
267
|
+
/**
|
|
268
|
+
* Add the directory as a dependency for the loader results so that any changes to the
|
|
269
|
+
* files in the directory can be listened to.
|
|
270
|
+
*/
|
|
271
|
+
addContextDependency(context: string): void;
|
|
272
|
+
/**
|
|
273
|
+
* Add a currently non-existent file as a dependency of the loader result, so that its
|
|
274
|
+
* creation and any changes can be listened. For example, when a new file is created at
|
|
275
|
+
* that path, it will trigger a rebuild.
|
|
276
|
+
*/
|
|
277
|
+
addMissingDependency(missing: string): void;
|
|
278
|
+
/**
|
|
279
|
+
* Removes all dependencies of the loader result.
|
|
280
|
+
*/
|
|
281
|
+
clearDependencies(): void;
|
|
282
|
+
getDependencies(): string[];
|
|
283
|
+
getContextDependencies(): string[];
|
|
284
|
+
getMissingDependencies(): string[];
|
|
285
|
+
addBuildDependency(file: string): void;
|
|
286
|
+
/**
|
|
287
|
+
* Compile and execute a module at the build time.
|
|
288
|
+
* This is an alternative lightweight solution for the child compiler.
|
|
289
|
+
* `importModule` will return a Promise if no callback is provided.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* const modulePath = path.resolve(__dirname, 'some-module.ts');
|
|
294
|
+
* const moduleExports = await this.importModule(modulePath, {
|
|
295
|
+
* // optional options
|
|
296
|
+
* });
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
importModule<T = any>(request: string, options: ImportModuleOptions | undefined, callback: (err?: null | Error, exports?: T) => any): void;
|
|
300
|
+
importModule<T = any>(request: string, options?: ImportModuleOptions): Promise<T>;
|
|
301
|
+
/**
|
|
302
|
+
* Access to the `compilation` object's `inputFileSystem` property.
|
|
303
|
+
*/
|
|
304
|
+
fs: any;
|
|
305
|
+
/**
|
|
306
|
+
* This is an experimental API and maybe subject to change.
|
|
307
|
+
* @experimental
|
|
308
|
+
*/
|
|
309
|
+
experiments: LoaderExperiments;
|
|
310
|
+
/**
|
|
311
|
+
* Access to some utilities.
|
|
312
|
+
*/
|
|
313
|
+
utils: {
|
|
314
|
+
/**
|
|
315
|
+
* Return a new request string using absolute paths when possible.
|
|
316
|
+
*/
|
|
317
|
+
absolutify: (context: string, request: string) => string;
|
|
318
|
+
/**
|
|
319
|
+
* Return a new request string avoiding absolute paths when possible.
|
|
320
|
+
*/
|
|
321
|
+
contextify: (context: string, request: string) => string;
|
|
322
|
+
/**
|
|
323
|
+
* Return a new Hash object from provided hash function.
|
|
324
|
+
*/
|
|
325
|
+
createHash: (algorithm?: string) => Hash;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* The value depends on the loader configuration:
|
|
329
|
+
* - If the current loader was configured with an options object, `this.query` will
|
|
330
|
+
* point to that object.
|
|
331
|
+
* - If the current loader has no options, but was invoked with a query string, this
|
|
332
|
+
* will be a string starting with `?`.
|
|
333
|
+
*/
|
|
334
|
+
query: string | OptionsType;
|
|
335
|
+
/**
|
|
336
|
+
* A data object shared between the pitch and the normal phase.
|
|
337
|
+
*/
|
|
338
|
+
data: unknown;
|
|
339
|
+
/**
|
|
340
|
+
* Access to the current Compiler object of Rspack.
|
|
341
|
+
*/
|
|
342
|
+
_compiler: Compiler;
|
|
343
|
+
/**
|
|
344
|
+
* Access to the current Compilation object of Rspack.
|
|
345
|
+
*/
|
|
346
|
+
_compilation: Compilation;
|
|
347
|
+
/**
|
|
348
|
+
* @deprecated Hacky access to the Module object being loaded.
|
|
349
|
+
*/
|
|
350
|
+
_module: Module;
|
|
351
|
+
/**
|
|
352
|
+
* Note: This is not a Rspack public API, maybe removed in future.
|
|
353
|
+
* Store some data from loader, and consume it from parser, it may be removed in the future
|
|
354
|
+
*
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
357
|
+
__internal__setParseMeta: (key: string, value: string) => void;
|
|
358
|
+
}
|
|
359
|
+
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
360
|
+
export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
361
|
+
/**
|
|
362
|
+
* Defines a loader for Rspack.
|
|
363
|
+
* A loader is a transformer that converts various types of modules into Rspack
|
|
364
|
+
* supported types. By using different kinds of loaders, you can extend Rspack to
|
|
365
|
+
* process additional module types, including JSX, Markdown, Sass, Less, and more.
|
|
366
|
+
*
|
|
367
|
+
* @template OptionsType - The type of options that the loader accepts
|
|
368
|
+
* @template ContextAdditions - Additional properties to add to the loader context
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* import type { LoaderDefinition } from '@rspack/core';
|
|
373
|
+
*
|
|
374
|
+
* type MyLoaderOptions = {
|
|
375
|
+
* foo: string;
|
|
376
|
+
* };
|
|
377
|
+
*
|
|
378
|
+
* const myLoader: LoaderDefinition<MyLoaderOptions> = function(source) {
|
|
379
|
+
* return someOperation(source);
|
|
380
|
+
* };
|
|
381
|
+
*
|
|
382
|
+
* export default myLoader;
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
|
|
386
|
+
raw?: false;
|
|
387
|
+
pitch?: PitchLoaderDefinitionFunction;
|
|
388
|
+
};
|
|
389
|
+
export declare function createRawModuleRuleUses(uses: RuleSetUseItem | RuleSetUseItem[], path: string, options: ComposeJsUseOptions): RawModuleRuleUse[];
|
|
390
|
+
export declare function isUseSourceMap(devtool: RspackOptionsNormalized["devtool"]): boolean;
|
|
391
|
+
export declare function isUseSimpleSourceMap(devtool: RspackOptionsNormalized["devtool"]): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 browsers supported browsers list
|
|
13
|
+
* @returns target properties
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolve: (browsers: string[]) => EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RspackOptionsNormalized } from "./normalization";
|
|
2
|
+
export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
|
|
3
|
+
export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
|
|
4
|
+
export declare const getPnpDefault: () => boolean;
|