@ohos-ports/rspack-core 2.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +15 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +176 -0
- package/compiled/@rspack/lite-tapable/license +22 -0
- package/compiled/@rspack/lite-tapable/package.json +1 -0
- package/compiled/@swc/types/index.d.ts +2284 -0
- package/compiled/@swc/types/index.js +19 -0
- package/compiled/@swc/types/license +201 -0
- package/compiled/@swc/types/package.json +1 -0
- package/compiled/connect-next/index.d.ts +57 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +455 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/open/index.d.ts +161 -0
- package/compiled/open/package.json +1 -0
- package/compiled/tinypool/LICENSE +24 -0
- package/compiled/tinypool/README.md +214 -0
- package/compiled/tinypool/dist/common-Bo3KCGim.js +31 -0
- package/compiled/tinypool/dist/entry/process.d.ts +1 -0
- package/compiled/tinypool/dist/entry/process.js +72 -0
- package/compiled/tinypool/dist/entry/utils.d.ts +7 -0
- package/compiled/tinypool/dist/entry/utils.js +3 -0
- package/compiled/tinypool/dist/entry/worker.d.ts +1 -0
- package/compiled/tinypool/dist/entry/worker.js +76 -0
- package/compiled/tinypool/dist/index.d.ts +199 -0
- package/compiled/tinypool/dist/index.js +784 -0
- package/compiled/tinypool/dist/utils-B--2TaWv.js +38 -0
- package/compiled/tinypool/dist/utils-De75vAgL.js +10 -0
- package/compiled/tinypool/package.json +55 -0
- package/compiled/watchpack/index.d.ts +3 -0
- package/compiled/watchpack/index.js +3811 -0
- package/compiled/watchpack/license +20 -0
- package/compiled/watchpack/package.json +8 -0
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +335 -0
- package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
- package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
- package/compiled/watchpack/types/index.d.ts +269 -0
- package/compiled/watchpack/types/reducePlan.d.ts +34 -0
- package/compiled/watchpack/types/util/globToRegExp.d.ts +2 -0
- package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
- package/compiled/watchpack/types/watchpack.d.ts +2 -0
- package/compiled/webpack-sources/index.js +5835 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +1 -0
- package/compiled/webpack-sources/types.d.ts +500 -0
- package/dist/612~0.js +32 -0
- package/dist/612~3.js +32 -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 +448 -0
- package/dist/Compiler.d.ts +229 -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 +15 -0
- package/dist/FileSystem.d.ts +54 -0
- package/dist/FileSystemInfo.d.ts +5 -0
- package/dist/Module.d.ts +41 -0
- package/dist/ModuleGraph.d.ts +22 -0
- package/dist/ModuleGraphConnection.d.ts +10 -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 +52 -0
- package/dist/NormalModule.d.ts +14 -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 +360 -0
- package/dist/RuntimeModule.d.ts +34 -0
- package/dist/RuntimeTemplate.d.ts +151 -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/builtin-loader/lightningcss/index.d.ts +114 -0
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
- package/dist/builtin-loader/swc/index.d.ts +3 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
- package/dist/builtin-loader/swc/types.d.ts +60 -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/CaseSensitivePlugin.d.ts +9 -0
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +33 -0
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +60 -0
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +7 -0
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +12 -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/CssHttpExternalsRspackPlugin.d.ts +9 -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 +18 -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 +16 -0
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -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 +13 -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/HashedModuleIdsPlugin.d.ts +10 -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 +30 -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 +28 -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 +12 -0
- package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +20 -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 +46 -0
- package/dist/builtin-plugin/RslibPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RstestPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimePlugin.d.ts +25 -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 +12 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +39 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +216 -0
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +16 -0
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WorkerPlugin.d.ts +14 -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 +10 -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 +77 -0
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +20 -0
- package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
- package/dist/builtin-plugin/index.d.ts +92 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +10 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +12 -0
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +47 -0
- package/dist/builtin-plugin/rsc/index.d.ts +24 -0
- package/dist/checkNodeVersion.d.ts +1 -0
- package/dist/config/adapter.d.ts +8 -0
- package/dist/config/adapterRuleUse.d.ts +424 -0
- package/dist/config/browserslistTargetHandler.d.ts +15 -0
- package/dist/config/defaults.d.ts +15 -0
- package/dist/config/devServer.d.ts +179 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/normalization.d.ts +156 -0
- package/dist/config/target.d.ts +100 -0
- package/dist/config/types.d.ts +2728 -0
- package/dist/container/ContainerPlugin.d.ts +41 -0
- package/dist/container/ContainerReferencePlugin.d.ts +34 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +44 -0
- package/dist/container/ModuleFederationPlugin.d.ts +34 -0
- package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +16 -0
- package/dist/container/options.d.ts +3 -0
- package/dist/cssExtractHmr.js +99 -0
- package/dist/cssExtractLoader.js +117 -0
- package/dist/error/ConcurrentCompilationError.d.ts +14 -0
- package/dist/exports.d.ts +192 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14552 -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 +39 -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 +16 -0
- package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
- package/dist/loader-runner/ModuleError.d.ts +13 -0
- package/dist/loader-runner/cache.d.ts +18 -0
- package/dist/loader-runner/dependencies.d.ts +22 -0
- package/dist/loader-runner/index.d.ts +35 -0
- package/dist/loader-runner/loadLoader.d.ts +12 -0
- package/dist/loader-runner/service.d.ts +77 -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/moduleFederationDefaultRuntime.js +1 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
- package/dist/node/NodeTemplatePlugin.d.ts +18 -0
- package/dist/node/NodeWatchFileSystem.d.ts +30 -0
- package/dist/node/nodeConsole.d.ts +15 -0
- package/dist/rspack.d.ts +24 -0
- package/dist/rspackOptionsApply.d.ts +4 -0
- package/dist/runtime/cssExtractHmr.d.ts +4 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +54 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +37 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +54 -0
- package/dist/sharing/SharePlugin.d.ts +89 -0
- package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +19 -0
- package/dist/sharing/utils.d.ts +2 -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 +338 -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/externalModule.d.ts +2 -0
- package/dist/taps/index.d.ts +7 -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 +47 -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 +11 -0
- package/dist/util/fs.d.ts +376 -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 +57 -0
- package/dist/util/index.d.ts +9 -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/supportsColor.d.ts +6 -0
- package/dist/util/targetsVersion.d.ts +2 -0
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/web/JsonpTemplatePlugin.d.ts +13 -0
- package/dist/webworker/WebWorkerTemplatePlugin.d.ts +13 -0
- package/dist/worker.js +971 -0
- package/hot/dev-server.js +76 -0
- package/hot/emitter.js +23 -0
- package/hot/lazy-compilation-node.js +109 -0
- package/hot/lazy-compilation-web.js +97 -0
- package/hot/log-apply-result.js +52 -0
- package/hot/log.js +87 -0
- package/hot/only-dev-server.js +104 -0
- package/hot/poll.js +41 -0
- package/hot/signal.js +68 -0
- package/module.d.ts +310 -0
- package/package.json +79 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config/index.js';
|
|
5
|
+
import { type ShareScope } from '../sharing/SharePlugin.js';
|
|
6
|
+
export type ContainerPluginOptions = {
|
|
7
|
+
exposes: Exposes;
|
|
8
|
+
filename?: FilenameTemplate;
|
|
9
|
+
library?: LibraryOptions;
|
|
10
|
+
name: string;
|
|
11
|
+
runtime?: EntryRuntime;
|
|
12
|
+
shareScope?: ShareScope;
|
|
13
|
+
enhanced?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;
|
|
16
|
+
export type ExposesItem = string;
|
|
17
|
+
export type ExposesItems = ExposesItem[];
|
|
18
|
+
export type ExposesObject = {
|
|
19
|
+
[k: string]: ExposesConfig | ExposesItem | ExposesItems;
|
|
20
|
+
};
|
|
21
|
+
export type ExposesConfig = {
|
|
22
|
+
import: ExposesItem | ExposesItems;
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare class ContainerPlugin extends RspackBuiltinPlugin {
|
|
26
|
+
name: BuiltinPluginName;
|
|
27
|
+
_options: {
|
|
28
|
+
name: string;
|
|
29
|
+
shareScope: ShareScope;
|
|
30
|
+
library: LibraryOptions;
|
|
31
|
+
runtime: EntryRuntime | undefined;
|
|
32
|
+
filename: string | undefined;
|
|
33
|
+
exposes: [string, {
|
|
34
|
+
import: string[];
|
|
35
|
+
name: string | undefined;
|
|
36
|
+
}][];
|
|
37
|
+
enhanced: boolean;
|
|
38
|
+
};
|
|
39
|
+
constructor(options: ContainerPluginOptions);
|
|
40
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
41
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { ExternalsType } from '../config/index.js';
|
|
5
|
+
import { type ShareScope } from '../sharing/SharePlugin.js';
|
|
6
|
+
export type ContainerReferencePluginOptions = {
|
|
7
|
+
remoteType: ExternalsType;
|
|
8
|
+
remotes: Remotes;
|
|
9
|
+
shareScope?: ShareScope;
|
|
10
|
+
enhanced?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
|
|
13
|
+
export type RemotesItem = string;
|
|
14
|
+
export type RemotesItems = RemotesItem[];
|
|
15
|
+
export type RemotesObject = {
|
|
16
|
+
[k: string]: RemotesConfig | RemotesItem | RemotesItems;
|
|
17
|
+
};
|
|
18
|
+
export type RemotesConfig = {
|
|
19
|
+
external: RemotesItem | RemotesItems;
|
|
20
|
+
shareScope?: ShareScope;
|
|
21
|
+
};
|
|
22
|
+
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
23
|
+
name: BuiltinPluginName;
|
|
24
|
+
_options: {
|
|
25
|
+
remoteType: ExternalsType;
|
|
26
|
+
remotes: [string, {
|
|
27
|
+
external: string[];
|
|
28
|
+
shareScope: ShareScope;
|
|
29
|
+
}][];
|
|
30
|
+
enhanced: boolean;
|
|
31
|
+
};
|
|
32
|
+
constructor(options: ContainerReferencePluginOptions);
|
|
33
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import { type ModuleFederationPluginOptions } from './ModuleFederationPlugin.js';
|
|
5
|
+
export type RemoteAliasMap = Record<string, {
|
|
6
|
+
name: string;
|
|
7
|
+
entry?: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type ManifestExposeOption = {
|
|
10
|
+
path: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
export type ManifestSharedOption = {
|
|
14
|
+
name: string;
|
|
15
|
+
version?: string;
|
|
16
|
+
requiredVersion?: string;
|
|
17
|
+
singleton?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type InternalManifestPluginOptions = {
|
|
20
|
+
name?: string;
|
|
21
|
+
globalName?: string;
|
|
22
|
+
filePath?: string;
|
|
23
|
+
disableAssetsAnalyze?: boolean;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
remoteAliasMap?: RemoteAliasMap;
|
|
26
|
+
exposes?: ManifestExposeOption[];
|
|
27
|
+
shared?: ManifestSharedOption[];
|
|
28
|
+
};
|
|
29
|
+
export type ModuleFederationManifestPluginOptions = boolean | Pick<InternalManifestPluginOptions, 'disableAssetsAnalyze' | 'filePath' | 'fileName'>;
|
|
30
|
+
export declare function getFileName(manifestOptions: ModuleFederationManifestPluginOptions): {
|
|
31
|
+
statsFileName: string;
|
|
32
|
+
manifestFileName: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
|
|
36
|
+
* To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
39
|
+
name: BuiltinPluginName;
|
|
40
|
+
private rawOpts;
|
|
41
|
+
constructor(opts: ModuleFederationPluginOptions);
|
|
42
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import type { ExternalsType } from '../config/index.js';
|
|
3
|
+
import type { ShareScope } from '../sharing/SharePlugin.js';
|
|
4
|
+
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
|
|
5
|
+
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
|
|
6
|
+
import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin.js';
|
|
7
|
+
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, 'enhanced'> {
|
|
8
|
+
runtimePlugins?: RuntimePlugins;
|
|
9
|
+
implementation?: string;
|
|
10
|
+
shareStrategy?: 'version-first' | 'loaded-first';
|
|
11
|
+
manifest?: ModuleFederationManifestPluginOptions;
|
|
12
|
+
injectTreeShakingUsedExports?: boolean;
|
|
13
|
+
treeShakingSharedDir?: string;
|
|
14
|
+
treeShakingSharedExcludePlugins?: string[];
|
|
15
|
+
treeShakingSharedPlugins?: string[];
|
|
16
|
+
experiments?: ModuleFederationRuntimeExperimentsOptions;
|
|
17
|
+
}
|
|
18
|
+
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
19
|
+
export declare class ModuleFederationPlugin {
|
|
20
|
+
private _options;
|
|
21
|
+
private _treeShakingSharedPlugin?;
|
|
22
|
+
constructor(_options: ModuleFederationPluginOptions);
|
|
23
|
+
apply(compiler: Compiler): void;
|
|
24
|
+
}
|
|
25
|
+
interface RemoteInfo {
|
|
26
|
+
alias: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
entry?: string;
|
|
29
|
+
externalType: ExternalsType;
|
|
30
|
+
shareScope: ShareScope;
|
|
31
|
+
}
|
|
32
|
+
type RemoteInfos = Record<string, RemoteInfo[]>;
|
|
33
|
+
export declare function getRemoteInfos(options: ModuleFederationPluginOptions): RemoteInfos;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config/index.js';
|
|
3
|
+
import { type Shared, type ShareScope } from '../sharing/SharePlugin.js';
|
|
4
|
+
import { type Exposes } from './ContainerPlugin.js';
|
|
5
|
+
import { type Remotes } from './ContainerReferencePlugin.js';
|
|
6
|
+
export interface ModuleFederationPluginV1Options {
|
|
7
|
+
exposes?: Exposes;
|
|
8
|
+
filename?: string;
|
|
9
|
+
library?: LibraryOptions;
|
|
10
|
+
name: string;
|
|
11
|
+
remoteType?: ExternalsType;
|
|
12
|
+
remotes?: Remotes;
|
|
13
|
+
runtime?: EntryRuntime;
|
|
14
|
+
shareScope?: ShareScope;
|
|
15
|
+
shared?: Shared;
|
|
16
|
+
enhanced?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class ModuleFederationPluginV1 {
|
|
19
|
+
private _options;
|
|
20
|
+
constructor(_options: ModuleFederationPluginV1Options);
|
|
21
|
+
apply(compiler: Compiler): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ModuleFederationRuntimeExperimentsOptions {
|
|
2
|
+
asyncStartup?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface ModuleFederationRuntimeOptions {
|
|
5
|
+
entryRuntime?: string;
|
|
6
|
+
experiments?: ModuleFederationRuntimeExperimentsOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare const ModuleFederationRuntimePlugin: {
|
|
9
|
+
new (options?: ModuleFederationRuntimeOptions | undefined): {
|
|
10
|
+
name: string;
|
|
11
|
+
_args: [options?: ModuleFederationRuntimeOptions | undefined];
|
|
12
|
+
affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
|
|
13
|
+
raw(compiler: import("../index.js").Compiler): import("@ohos-ports/rspack-binding").BuiltinPlugin;
|
|
14
|
+
apply(compiler: import("../index.js").Compiler): void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type ContainerOptionsFormat<T> = (string | Record<string, string | string[] | T>)[] | Record<string, string | string[] | T>;
|
|
2
|
+
export declare const parseOptions: <T, R>(options: ContainerOptionsFormat<T>, normalizeSimple: (a: string | string[], b: string) => R, normalizeOptions: (a: T, b: string) => R) => [string, R][];
|
|
3
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
function normalizeUrl(url) {
|
|
2
|
+
let urlString = url.trim();
|
|
3
|
+
if (/^data:/i.test(urlString)) return urlString;
|
|
4
|
+
let protocol = -1 !== urlString.indexOf('//') ? `${urlString.split('//')[0]}//` : '', components = urlString.replace(RegExp(protocol, 'i'), '').split('/'), host = components[0].toLowerCase().replace(/\.$/, '');
|
|
5
|
+
return components[0] = '', protocol + host + components.reduce((accumulator, item)=>{
|
|
6
|
+
switch(item){
|
|
7
|
+
case '..':
|
|
8
|
+
accumulator.pop();
|
|
9
|
+
break;
|
|
10
|
+
case '.':
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
accumulator.push(item);
|
|
14
|
+
}
|
|
15
|
+
return accumulator;
|
|
16
|
+
}, []).join('/');
|
|
17
|
+
}
|
|
18
|
+
let srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach: forEach } = Array.prototype;
|
|
19
|
+
function noop() {}
|
|
20
|
+
function updateCss(el, url) {
|
|
21
|
+
let normalizedUrl;
|
|
22
|
+
if (url) normalizedUrl = url;
|
|
23
|
+
else {
|
|
24
|
+
let href = el.getAttribute('href');
|
|
25
|
+
if (!href) return;
|
|
26
|
+
normalizedUrl = href.split('?')[0];
|
|
27
|
+
}
|
|
28
|
+
if (!isUrlRequest(el.href) || !1 === el.isLoaded || !normalizedUrl || !(normalizedUrl.indexOf('.css') > -1)) return;
|
|
29
|
+
el.visited = !0;
|
|
30
|
+
let newEl = el.cloneNode();
|
|
31
|
+
newEl.isLoaded = !1, newEl.addEventListener('load', ()=>{
|
|
32
|
+
!newEl.isLoaded && (newEl.isLoaded = !0, el.parentNode && el.parentNode.removeChild(el));
|
|
33
|
+
}), newEl.addEventListener('error', ()=>{
|
|
34
|
+
!newEl.isLoaded && (newEl.isLoaded = !0, el.parentNode && el.parentNode.removeChild(el));
|
|
35
|
+
}), newEl.href = `${normalizedUrl}?${Date.now()}`;
|
|
36
|
+
let parent = el.parentNode;
|
|
37
|
+
parent && (el.nextSibling ? parent.insertBefore(newEl, el.nextSibling) : parent.appendChild(newEl));
|
|
38
|
+
}
|
|
39
|
+
function reloadAll() {
|
|
40
|
+
let elements = document.querySelectorAll('link');
|
|
41
|
+
forEach.call(elements, (el)=>{
|
|
42
|
+
!0 !== el.visited && updateCss(el);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function isUrlRequest(url) {
|
|
46
|
+
return !!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
|
|
47
|
+
}
|
|
48
|
+
function cssReload(moduleId, options) {
|
|
49
|
+
var fn;
|
|
50
|
+
let timeout;
|
|
51
|
+
if (noDocument) return console.log('[HMR] No `window.document` found, CSS HMR disabled'), noop;
|
|
52
|
+
let getScriptSrc = function(moduleId) {
|
|
53
|
+
let src = srcByModuleId[moduleId];
|
|
54
|
+
if (!src) {
|
|
55
|
+
if (document.currentScript) ({ src } = document.currentScript);
|
|
56
|
+
else {
|
|
57
|
+
let scripts = document.getElementsByTagName("script"), lastScriptTag = scripts[scripts.length - 1];
|
|
58
|
+
lastScriptTag && ({ src } = lastScriptTag);
|
|
59
|
+
}
|
|
60
|
+
srcByModuleId[moduleId] = src;
|
|
61
|
+
}
|
|
62
|
+
return (fileMap)=>{
|
|
63
|
+
if (!src) return null;
|
|
64
|
+
let splitResult = src.match(/([^\\/]+)\.js$/), filename = splitResult && splitResult[1];
|
|
65
|
+
return filename && fileMap ? fileMap.split(',').map((mapRule)=>{
|
|
66
|
+
let reg = RegExp(`${filename}\\.js$`, 'g');
|
|
67
|
+
return normalizeUrl(src.replace(reg, `${mapRule.replace(/{fileName}/g, filename)}.css`));
|
|
68
|
+
}) : [
|
|
69
|
+
src.replace('.js', '.css')
|
|
70
|
+
];
|
|
71
|
+
};
|
|
72
|
+
}(moduleId);
|
|
73
|
+
return fn = function() {
|
|
74
|
+
let src = getScriptSrc(options.filename), reloaded = function(src) {
|
|
75
|
+
if (!src) return !1;
|
|
76
|
+
let elements = document.querySelectorAll('link'), loaded = !1;
|
|
77
|
+
return forEach.call(elements, (el)=>{
|
|
78
|
+
var href;
|
|
79
|
+
let ret, normalizedHref;
|
|
80
|
+
if (!el.href) return;
|
|
81
|
+
let url = (href = el.href, ret = '', normalizedHref = normalizeUrl(href), src.some((url)=>{
|
|
82
|
+
normalizedHref.indexOf(src) > -1 && (ret = url);
|
|
83
|
+
}), ret);
|
|
84
|
+
!isUrlRequest(url) || !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
|
|
85
|
+
}), loaded;
|
|
86
|
+
}(src);
|
|
87
|
+
if (options.locals) {
|
|
88
|
+
console.log('[HMR] Detected local CSS Modules. Reload all CSS'), reloadAll();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
reloaded ? console.log('[HMR] CSS reload %s', src && src.join(' ')) : (console.log('[HMR] Reload all CSS'), reloadAll());
|
|
92
|
+
}, timeout = 0, function(...args) {
|
|
93
|
+
let self = this;
|
|
94
|
+
clearTimeout(timeout), timeout = setTimeout(function() {
|
|
95
|
+
return fn.apply(self, args);
|
|
96
|
+
}, 50);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export { cssReload, normalizeUrl };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
function isAbsolutePath(str) {
|
|
3
|
+
return node_path.posix.isAbsolute(str) || node_path.win32.isAbsolute(str);
|
|
4
|
+
}
|
|
5
|
+
let PLUGIN_NAME = 'css-extract-rspack-plugin', pluginSymbol = Symbol.for(PLUGIN_NAME), RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = 'rspack-css-extract://', MODULE_TYPE = 'css/mini-extract', AUTO_PUBLIC_PATH = '__css_extract_public_path_auto__', ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = '__css_extract_single_dot_path_segment__';
|
|
6
|
+
function hotLoader(content, context) {
|
|
7
|
+
let localsJsonString = JSON.stringify(JSON.stringify(context.locals)), pluginData = context.loaderContext[pluginSymbol], changeSignal = pluginData?.runtime === !1 ? `\n // ${Date.now()}` : '';
|
|
8
|
+
return `${content}
|
|
9
|
+
if(module.hot) {
|
|
10
|
+
(function() {
|
|
11
|
+
var localsJsonString = ${localsJsonString};${changeSignal}
|
|
12
|
+
var cssReload = require(${function(loaderContext, request) {
|
|
13
|
+
if (void 0 !== loaderContext.utils && 'function' == typeof loaderContext.utils.contextify) return JSON.stringify(loaderContext.utils.contextify(loaderContext.context || loaderContext.rootContext, request));
|
|
14
|
+
let splitted = request.split('!'), { context } = loaderContext;
|
|
15
|
+
return JSON.stringify(splitted.map((part)=>{
|
|
16
|
+
let splittedPart = part.match(/^(.*?)(\?.*)/), query = splittedPart ? splittedPart[2] : '', singlePath = splittedPart ? splittedPart[1] : part;
|
|
17
|
+
if (isAbsolutePath(singlePath) && context) {
|
|
18
|
+
var str;
|
|
19
|
+
if (isAbsolutePath(singlePath = node_path.relative(context, singlePath))) return singlePath + query;
|
|
20
|
+
str = singlePath, RELATIVE_PATH_REGEXP.test(str) || (singlePath = `./${singlePath}`);
|
|
21
|
+
}
|
|
22
|
+
return singlePath.replace(/\\/g, '/') + query;
|
|
23
|
+
}).join('!'));
|
|
24
|
+
}(context.loaderContext, node_path.join(import.meta.dirname, 'cssExtractHmr.js'))}).cssReload(module.id, ${JSON.stringify(context.options ?? {})});
|
|
25
|
+
// only invalidate when locals change
|
|
26
|
+
if (
|
|
27
|
+
module.hot.data &&
|
|
28
|
+
module.hot.data.value &&
|
|
29
|
+
module.hot.data.value !== localsJsonString
|
|
30
|
+
) {
|
|
31
|
+
module.hot.invalidate();
|
|
32
|
+
} else {
|
|
33
|
+
module.hot.accept();
|
|
34
|
+
}
|
|
35
|
+
module.hot.dispose(function(data) {
|
|
36
|
+
data.value = localsJsonString;
|
|
37
|
+
cssReload();
|
|
38
|
+
});
|
|
39
|
+
})();
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
let pitch = function(request, _, data) {
|
|
44
|
+
let publicPathForExtract;
|
|
45
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) {
|
|
46
|
+
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
47
|
+
e.stack = void 0, this.emitWarning(e);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath;
|
|
51
|
+
this.addDependency(filepath);
|
|
52
|
+
let { publicPath } = this._compilation.outputOptions;
|
|
53
|
+
'string' == typeof options.publicPath ? publicPath = options.publicPath : 'function' == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), 'auto' === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = 'string' == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath;
|
|
54
|
+
let handleExports = (originalExports)=>{
|
|
55
|
+
let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
|
|
56
|
+
try {
|
|
57
|
+
let exports = originalExports.__esModule ? originalExports.default : originalExports;
|
|
58
|
+
if (namedExport = originalExports.__esModule && (!originalExports.default || !('locals' in originalExports.default))) for (let key of Object.keys(originalExports))'default' !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
|
|
59
|
+
else locals = exports?.locals;
|
|
60
|
+
if (Array.isArray(exports) && emit) {
|
|
61
|
+
let identifierCountMap = new Map();
|
|
62
|
+
dependencies = exports.map(([id, content, media, sourceMap, supports, layer])=>{
|
|
63
|
+
let context = this.rootContext, count = identifierCountMap.get(id) || 0;
|
|
64
|
+
return identifierCountMap.set(id, count + 1), {
|
|
65
|
+
identifier: id,
|
|
66
|
+
context,
|
|
67
|
+
content,
|
|
68
|
+
media,
|
|
69
|
+
supports,
|
|
70
|
+
layer,
|
|
71
|
+
identifierIndex: count,
|
|
72
|
+
sourceMap: sourceMap ? JSON.stringify(sourceMap) : void 0,
|
|
73
|
+
filepath
|
|
74
|
+
};
|
|
75
|
+
}).filter((item)=>null !== item);
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
callback(e);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let result = function() {
|
|
82
|
+
if (locals) {
|
|
83
|
+
if (namedExport) {
|
|
84
|
+
let identifiers = Array.from(function*() {
|
|
85
|
+
let identifierId = 0;
|
|
86
|
+
for (let key of Object.keys(locals))identifierId += 1, yield [
|
|
87
|
+
`_${identifierId.toString(16)}`,
|
|
88
|
+
key
|
|
89
|
+
];
|
|
90
|
+
}()), localsString = identifiers.map(([id, key])=>{
|
|
91
|
+
var value;
|
|
92
|
+
return `\nvar ${id} = ${'function' == typeof (value = locals[key]) ? value.toString() : JSON.stringify(value)};`;
|
|
93
|
+
}).join(''), exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(', ')} }`;
|
|
94
|
+
return void 0 !== options.defaultExport && options.defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(', ')} }\n` : `${localsString}\n${exportsString}\n`;
|
|
95
|
+
}
|
|
96
|
+
return `\n${esModule ? 'export default' : 'module.exports = '} ${JSON.stringify(locals)};`;
|
|
97
|
+
}
|
|
98
|
+
return esModule ? '\nexport {};' : '';
|
|
99
|
+
}(), resultSource = `// extracted by ${PLUGIN_NAME}`;
|
|
100
|
+
resultSource += this.hot && emit ? hotLoader(result, {
|
|
101
|
+
loaderContext: this,
|
|
102
|
+
options,
|
|
103
|
+
locals: locals
|
|
104
|
+
}) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
|
|
105
|
+
};
|
|
106
|
+
this.importModule(`${this.resourcePath}.rspack[javascript/auto]!=!!!${request}`, {
|
|
107
|
+
layer: options.layer,
|
|
108
|
+
publicPath: publicPathForExtract,
|
|
109
|
+
baseUri: `${BASE_URI}/`
|
|
110
|
+
}, (error, exports)=>{
|
|
111
|
+
error ? callback(error) : handleExports(exports);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
export default function(content) {
|
|
115
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) return content;
|
|
116
|
+
};
|
|
117
|
+
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, hotLoader, pitch };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ConcurrentCompilationError.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Maksim Nazarjev @acupofspirt
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
export default class ConcurrentCompilationError extends Error {
|
|
11
|
+
name: string;
|
|
12
|
+
message: string;
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
declare const rspackVersion: string;
|
|
2
|
+
declare const version: string;
|
|
3
|
+
export type { Asset, AssetInfo, Assets, ChunkPathData, CompilationParams, LogEntry, PathData, } from './Compilation.js';
|
|
4
|
+
export { Compilation } from './Compilation.js';
|
|
5
|
+
export { Compiler, type CompilerHooks } from './Compiler.js';
|
|
6
|
+
export type { MultiCompilerOptions, MultiRspackOptions } from './MultiCompiler.js';
|
|
7
|
+
export { MultiCompiler } from './MultiCompiler.js';
|
|
8
|
+
export { rspackVersion, version };
|
|
9
|
+
import { RspackOptionsApply } from './rspackOptionsApply.js';
|
|
10
|
+
export type { ChunkGroup } from '@ohos-ports/rspack-binding';
|
|
11
|
+
export { AsyncDependenciesBlock, Dependency, EntryDependency, } from '@ohos-ports/rspack-binding';
|
|
12
|
+
export type { Chunk } from './Chunk.js';
|
|
13
|
+
export { ConcatenatedModule } from './ConcatenatedModule.js';
|
|
14
|
+
export { ContextModule } from './ContextModule.js';
|
|
15
|
+
export { ExternalModule, type ExternalModuleCompilationHooks, } from './ExternalModule.js';
|
|
16
|
+
export type { ResolveData, ResourceDataWithData } from './Module.js';
|
|
17
|
+
export { Module } from './Module.js';
|
|
18
|
+
export type { default as ModuleGraph } from './ModuleGraph.js';
|
|
19
|
+
export { ModuleGraphConnection, type ConnectionState, } from './ModuleGraphConnection.js';
|
|
20
|
+
export { MultiStats } from './MultiStats.js';
|
|
21
|
+
export { NormalModule } from './NormalModule.js';
|
|
22
|
+
export type { NormalModuleFactory } from './NormalModuleFactory.js';
|
|
23
|
+
export { type RspackError, type RspackSeverity, ValidationError, } from './RspackError.js';
|
|
24
|
+
export { RuntimeGlobals } from './RuntimeGlobals.js';
|
|
25
|
+
export { RuntimeModule } from './RuntimeModule.js';
|
|
26
|
+
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './Stats.js';
|
|
27
|
+
export { Stats } from './Stats.js';
|
|
28
|
+
export { StatsErrorCode } from './stats/statsFactoryUtils.js';
|
|
29
|
+
export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
|
|
30
|
+
import * as ModuleFilenameHelpers from './lib/ModuleFilenameHelpers.js';
|
|
31
|
+
export { Template } from './Template.js';
|
|
32
|
+
export { RuntimeTemplate } from './RuntimeTemplate.js';
|
|
33
|
+
export type { ConcatenationArg } from './RuntimeTemplate.js';
|
|
34
|
+
export { ModuleFilenameHelpers };
|
|
35
|
+
export declare const WebpackError: ErrorConstructor;
|
|
36
|
+
export type { Watching } from './Watching.js';
|
|
37
|
+
import * as sources from '../compiled/webpack-sources/types.js';
|
|
38
|
+
export { sources };
|
|
39
|
+
import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from './config/index.js';
|
|
40
|
+
type Config = {
|
|
41
|
+
getNormalizedRspackOptions: typeof getNormalizedRspackOptions;
|
|
42
|
+
applyRspackOptionsDefaults: typeof applyRspackOptionsDefaults;
|
|
43
|
+
getNormalizedWebpackOptions: typeof getNormalizedRspackOptions;
|
|
44
|
+
applyWebpackOptionsDefaults: typeof applyRspackOptionsDefaults;
|
|
45
|
+
};
|
|
46
|
+
export declare const config: Config;
|
|
47
|
+
export type * from './config/index.js';
|
|
48
|
+
import { cachedCleverMerge as cleverMerge } from './util/cleverMerge.js';
|
|
49
|
+
import { createHash } from './util/createHash.js';
|
|
50
|
+
export declare const util: {
|
|
51
|
+
createHash: typeof createHash;
|
|
52
|
+
cleverMerge: typeof cleverMerge;
|
|
53
|
+
};
|
|
54
|
+
export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginHandlerInfo, ProgressPluginOptions, ProvidePluginOptions, } from './builtin-plugin/index.js';
|
|
55
|
+
export { BannerPlugin, CaseSensitivePlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin/index.js';
|
|
56
|
+
export { DllPlugin, type DllPluginOptions } from './lib/DllPlugin.js';
|
|
57
|
+
export { DllReferencePlugin, type DllReferencePluginOptions, type DllReferencePluginOptionsContent, type DllReferencePluginOptionsManifest, type DllReferencePluginOptionsSourceType, } from './lib/DllReferencePlugin.js';
|
|
58
|
+
export { default as EntryOptionPlugin } from './lib/EntryOptionPlugin.js';
|
|
59
|
+
export { EnvironmentPlugin } from './lib/EnvironmentPlugin.js';
|
|
60
|
+
export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin.js';
|
|
61
|
+
export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin.js';
|
|
62
|
+
export type { OutputFileSystem, WatchFileSystem } from './util/fs.js';
|
|
63
|
+
import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
|
|
64
|
+
import JsonpTemplatePlugin from './web/JsonpTemplatePlugin.js';
|
|
65
|
+
export { SubresourceIntegrityPlugin };
|
|
66
|
+
interface Web {
|
|
67
|
+
FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
|
|
68
|
+
JsonpTemplatePlugin: typeof JsonpTemplatePlugin;
|
|
69
|
+
}
|
|
70
|
+
export declare const web: Web;
|
|
71
|
+
import { NodeTargetPlugin } from './builtin-plugin/index.js';
|
|
72
|
+
import NodeEnvironmentPlugin from './node/NodeEnvironmentPlugin.js';
|
|
73
|
+
import NodeTemplatePlugin from './node/NodeTemplatePlugin.js';
|
|
74
|
+
interface Node {
|
|
75
|
+
NodeTargetPlugin: typeof NodeTargetPlugin;
|
|
76
|
+
NodeTemplatePlugin: typeof NodeTemplatePlugin;
|
|
77
|
+
NodeEnvironmentPlugin: typeof NodeEnvironmentPlugin;
|
|
78
|
+
}
|
|
79
|
+
export { lazyCompilationMiddleware };
|
|
80
|
+
export declare const node: Node;
|
|
81
|
+
import { ElectronTargetPlugin } from './builtin-plugin/index.js';
|
|
82
|
+
interface Electron {
|
|
83
|
+
ElectronTargetPlugin: typeof ElectronTargetPlugin;
|
|
84
|
+
}
|
|
85
|
+
export declare const electron: Electron;
|
|
86
|
+
import { CompactHashedChunkIdsPlugin, CompactHashedModuleIdsPlugin, DeterministicModuleIdsPlugin, HashedModuleIdsPlugin, SyncModuleIdsPlugin } from './builtin-plugin/index.js';
|
|
87
|
+
interface Ids {
|
|
88
|
+
CompactHashedChunkIdsPlugin: typeof CompactHashedChunkIdsPlugin;
|
|
89
|
+
CompactHashedModuleIdsPlugin: typeof CompactHashedModuleIdsPlugin;
|
|
90
|
+
/** @deprecated Use `CompactHashedChunkIdsPlugin` instead. */
|
|
91
|
+
CompatHashedChunkIdsPlugin: typeof CompactHashedChunkIdsPlugin;
|
|
92
|
+
/** @deprecated Use `CompactHashedModuleIdsPlugin` instead. */
|
|
93
|
+
CompatHashedModuleIdsPlugin: typeof CompactHashedModuleIdsPlugin;
|
|
94
|
+
DeterministicModuleIdsPlugin: typeof DeterministicModuleIdsPlugin;
|
|
95
|
+
HashedModuleIdsPlugin: typeof HashedModuleIdsPlugin;
|
|
96
|
+
}
|
|
97
|
+
export declare const ids: Ids;
|
|
98
|
+
import { EnableLibraryPlugin } from './builtin-plugin/index.js';
|
|
99
|
+
interface Library {
|
|
100
|
+
EnableLibraryPlugin: typeof EnableLibraryPlugin;
|
|
101
|
+
}
|
|
102
|
+
export declare const library: Library;
|
|
103
|
+
import { EnableWasmLoadingPlugin } from './builtin-plugin/index.js';
|
|
104
|
+
interface Wasm {
|
|
105
|
+
EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin;
|
|
106
|
+
}
|
|
107
|
+
export declare const wasm: Wasm;
|
|
108
|
+
import { EnableChunkLoadingPlugin, JavascriptModulesPlugin } from './builtin-plugin/index.js';
|
|
109
|
+
interface JavaScript {
|
|
110
|
+
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
|
|
111
|
+
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
|
|
112
|
+
}
|
|
113
|
+
export declare const javascript: JavaScript;
|
|
114
|
+
import WebWorkerTemplatePlugin from './webworker/WebWorkerTemplatePlugin.js';
|
|
115
|
+
interface Webworker {
|
|
116
|
+
WebWorkerTemplatePlugin: typeof WebWorkerTemplatePlugin;
|
|
117
|
+
}
|
|
118
|
+
export declare const webworker: Webworker;
|
|
119
|
+
import { CssChunkingPlugin, LimitChunkCountPlugin, RealContentHashPlugin, RemoveDuplicateModulesPlugin, RsdoctorPlugin, RslibPlugin, RstestPlugin, RuntimeChunkPlugin, SplitChunksPlugin } from './builtin-plugin/index.js';
|
|
120
|
+
interface Optimize {
|
|
121
|
+
LimitChunkCountPlugin: typeof LimitChunkCountPlugin;
|
|
122
|
+
RealContentHashPlugin: typeof RealContentHashPlugin;
|
|
123
|
+
RuntimeChunkPlugin: typeof RuntimeChunkPlugin;
|
|
124
|
+
SplitChunksPlugin: typeof SplitChunksPlugin;
|
|
125
|
+
}
|
|
126
|
+
export declare const optimize: Optimize;
|
|
127
|
+
import { ModuleFederationPlugin } from './container/ModuleFederationPlugin.js';
|
|
128
|
+
export type { ModuleFederationPluginOptions } from './container/ModuleFederationPlugin.js';
|
|
129
|
+
import { ModuleFederationPluginV1 } from './container/ModuleFederationPluginV1.js';
|
|
130
|
+
export type { ModuleFederationPluginV1Options } from './container/ModuleFederationPluginV1.js';
|
|
131
|
+
import { ContainerPlugin } from './container/ContainerPlugin.js';
|
|
132
|
+
import { ContainerReferencePlugin } from './container/ContainerReferencePlugin.js';
|
|
133
|
+
export type { ContainerPluginOptions, Exposes, ExposesConfig, ExposesItem, ExposesItems, ExposesObject, } from './container/ContainerPlugin.js';
|
|
134
|
+
export type { ContainerReferencePluginOptions, Remotes, RemotesConfig, RemotesItem, RemotesItems, RemotesObject, } from './container/ContainerReferencePlugin.js';
|
|
135
|
+
export declare const container: {
|
|
136
|
+
ContainerPlugin: typeof ContainerPlugin;
|
|
137
|
+
ContainerReferencePlugin: typeof ContainerReferencePlugin;
|
|
138
|
+
ModuleFederationPlugin: typeof ModuleFederationPlugin;
|
|
139
|
+
ModuleFederationPluginV1: typeof ModuleFederationPluginV1;
|
|
140
|
+
};
|
|
141
|
+
import { ConsumeSharedPlugin } from './sharing/ConsumeSharedPlugin.js';
|
|
142
|
+
import { ProvideSharedPlugin } from './sharing/ProvideSharedPlugin.js';
|
|
143
|
+
import { SharePlugin } from './sharing/SharePlugin.js';
|
|
144
|
+
import { TreeShakingSharedPlugin } from './sharing/TreeShakingSharedPlugin.js';
|
|
145
|
+
export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, } from './sharing/ConsumeSharedPlugin.js';
|
|
146
|
+
export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject, } from './sharing/ProvideSharedPlugin.js';
|
|
147
|
+
export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions, } from './sharing/SharePlugin.js';
|
|
148
|
+
export type { TreeshakingSharedPluginOptions } from './sharing/TreeShakingSharedPlugin.js';
|
|
149
|
+
export declare const sharing: {
|
|
150
|
+
ProvideSharedPlugin: typeof ProvideSharedPlugin;
|
|
151
|
+
TreeShakingSharedPlugin: typeof TreeShakingSharedPlugin;
|
|
152
|
+
ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
|
|
153
|
+
SharePlugin: typeof SharePlugin;
|
|
154
|
+
};
|
|
155
|
+
export type { FeatureOptions as LightningcssFeatureOptions, LoaderOptions as LightningcssLoaderOptions, } from './builtin-loader/lightningcss/index.js';
|
|
156
|
+
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig, } from './builtin-loader/swc/index.js';
|
|
157
|
+
export type { CircularCheckRspackPluginOptions, CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions, } from './builtin-plugin/index.js';
|
|
158
|
+
export { CircularCheckRspackPlugin, CircularDependencyRspackPlugin, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin, } from './builtin-plugin/index.js';
|
|
159
|
+
import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from '@ohos-ports/rspack-binding';
|
|
160
|
+
import { createNativePlugin } from './builtin-plugin/index.js';
|
|
161
|
+
import { minify, minifySync, transform, transformSync } from './swc.js';
|
|
162
|
+
import { VirtualModulesPlugin } from './VirtualModulesPlugin.js';
|
|
163
|
+
interface Experiments {
|
|
164
|
+
globalTrace: {
|
|
165
|
+
register: (filter: string, layer: 'logger' | 'perfetto', output: string) => Promise<void>;
|
|
166
|
+
cleanup: () => Promise<void>;
|
|
167
|
+
};
|
|
168
|
+
RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
|
|
169
|
+
RsdoctorPlugin: typeof RsdoctorPlugin;
|
|
170
|
+
RstestPlugin: typeof RstestPlugin;
|
|
171
|
+
RslibPlugin: typeof RslibPlugin;
|
|
172
|
+
swc: {
|
|
173
|
+
transform: typeof transform;
|
|
174
|
+
minify: typeof minify;
|
|
175
|
+
transformSync: typeof transformSync;
|
|
176
|
+
minifySync: typeof minifySync;
|
|
177
|
+
};
|
|
178
|
+
resolver: {
|
|
179
|
+
ResolverFactory: typeof ResolverFactory;
|
|
180
|
+
EnforceExtension: typeof EnforceExtension;
|
|
181
|
+
async: typeof resolveAsync;
|
|
182
|
+
sync: typeof resolveSync;
|
|
183
|
+
};
|
|
184
|
+
CssChunkingPlugin: typeof CssChunkingPlugin;
|
|
185
|
+
createNativePlugin: typeof createNativePlugin;
|
|
186
|
+
VirtualModulesPlugin: typeof VirtualModulesPlugin;
|
|
187
|
+
ids: {
|
|
188
|
+
SyncModuleIdsPlugin: typeof SyncModuleIdsPlugin;
|
|
189
|
+
};
|
|
190
|
+
rsc: typeof rsc;
|
|
191
|
+
}
|
|
192
|
+
export declare const experiments: Experiments;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './checkNodeVersion.js';
|
|
2
|
+
import * as rspackExports from './exports.js';
|
|
3
|
+
import { rspack as rspackFn } from './rspack.js';
|
|
4
|
+
type Rspack = typeof rspackFn & typeof rspackExports & {
|
|
5
|
+
rspack: Rspack;
|
|
6
|
+
webpack: Rspack;
|
|
7
|
+
};
|
|
8
|
+
declare const rspack: Rspack;
|
|
9
|
+
export * from './exports.js';
|
|
10
|
+
export default rspack;
|
|
11
|
+
export { rspack };
|