Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions crates/node_binding/napi-binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,13 @@ export declare enum BuiltinPluginName {
SplitChunksPlugin = 'SplitChunksPlugin',
RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
ShareRuntimePlugin = 'ShareRuntimePlugin',
SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
ContainerPlugin = 'ContainerPlugin',
ContainerReferencePlugin = 'ContainerReferencePlugin',
ProvideSharedPlugin = 'ProvideSharedPlugin',
ConsumeSharedPlugin = 'ConsumeSharedPlugin',
CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
ShareContainerPlugin = 'ShareContainerPlugin',
ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
Expand Down Expand Up @@ -1837,6 +1840,11 @@ export interface RawCircularDependencyRspackPluginOptions {
onEnd?: () => void
}

export interface RawCollectShareEntryPluginOptions {
consumes: Array<RawConsumeOptions>
filename?: string
}

export interface RawConsumeOptions {
key: string
import?: string
Expand Down Expand Up @@ -2584,6 +2592,12 @@ export interface RawOptimizationOptions {
avoidEntryIife: boolean
}

export interface RawOptimizeSharedConfig {
shareKey: string
treeshake: boolean
usedExports?: Array<string>
}

export interface RawOptions {
name?: string
mode?: undefined | 'production' | 'development' | 'none'
Expand Down Expand Up @@ -2820,6 +2834,21 @@ export interface RawRuntimeChunkOptions {
name: string | ((entrypoint: { name: string }) => string)
}

export interface RawShareContainerPluginOptions {
name: string
request: string
version: string
fileName?: string
library: JsLibraryOptions
}

export interface RawSharedUsedExportsOptimizerPluginOptions {
shared: Array<RawOptimizeSharedConfig>
injectUsedExports?: boolean
manifestFileName?: string
statsFileName?: string
}

export interface RawSizeLimitsPluginOptions {
assetFilter?: (assetFilename: string) => boolean
hints?: "error" | "warning"
Expand Down
61 changes: 1 addition & 60 deletions crates/node_binding/rspack.wasi-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,63 +63,4 @@ const {
},
})
export default __napiModule.exports
export const Assets = __napiModule.exports.Assets
export const AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock
export const Chunk = __napiModule.exports.Chunk
export const ChunkGraph = __napiModule.exports.ChunkGraph
export const ChunkGroup = __napiModule.exports.ChunkGroup
export const Chunks = __napiModule.exports.Chunks
export const CodeGenerationResult = __napiModule.exports.CodeGenerationResult
export const CodeGenerationResults = __napiModule.exports.CodeGenerationResults
export const ConcatenatedModule = __napiModule.exports.ConcatenatedModule
export const ContextModule = __napiModule.exports.ContextModule
export const Dependency = __napiModule.exports.Dependency
export const Diagnostics = __napiModule.exports.Diagnostics
export const EntryDataDto = __napiModule.exports.EntryDataDto
export const EntryDataDTO = __napiModule.exports.EntryDataDTO
export const EntryDependency = __napiModule.exports.EntryDependency
export const EntryOptionsDto = __napiModule.exports.EntryOptionsDto
export const EntryOptionsDTO = __napiModule.exports.EntryOptionsDTO
export const ExternalModule = __napiModule.exports.ExternalModule
export const JsCompilation = __napiModule.exports.JsCompilation
export const JsCompiler = __napiModule.exports.JsCompiler
export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
export const JsDependencies = __napiModule.exports.JsDependencies
export const JsEntries = __napiModule.exports.JsEntries
export const JsExportsInfo = __napiModule.exports.JsExportsInfo
export const JsModuleGraph = __napiModule.exports.JsModuleGraph
export const JsResolver = __napiModule.exports.JsResolver
export const JsResolverFactory = __napiModule.exports.JsResolverFactory
export const JsStats = __napiModule.exports.JsStats
export const KnownBuildInfo = __napiModule.exports.KnownBuildInfo
export const Module = __napiModule.exports.Module
export const ModuleGraphConnection = __napiModule.exports.ModuleGraphConnection
export const NativeWatcher = __napiModule.exports.NativeWatcher
export const NativeWatchResult = __napiModule.exports.NativeWatchResult
export const NormalModule = __napiModule.exports.NormalModule
export const RawExternalItemFnCtx = __napiModule.exports.RawExternalItemFnCtx
export const ReadonlyResourceData = __napiModule.exports.ReadonlyResourceData
export const ResolverFactory = __napiModule.exports.ResolverFactory
export const Sources = __napiModule.exports.Sources
export const VirtualFileStore = __napiModule.exports.VirtualFileStore
export const JsVirtualFileStore = __napiModule.exports.JsVirtualFileStore
export const async = __napiModule.exports.async
export const BuiltinPluginName = __napiModule.exports.BuiltinPluginName
export const cleanupGlobalTrace = __napiModule.exports.cleanupGlobalTrace
export const EnforceExtension = __napiModule.exports.EnforceExtension
export const EXPECTED_RSPACK_CORE_VERSION = __napiModule.exports.EXPECTED_RSPACK_CORE_VERSION
export const formatDiagnostic = __napiModule.exports.formatDiagnostic
export const JsLoaderState = __napiModule.exports.JsLoaderState
export const JsRspackSeverity = __napiModule.exports.JsRspackSeverity
export const loadBrowserslist = __napiModule.exports.loadBrowserslist
export const minify = __napiModule.exports.minify
export const minifySync = __napiModule.exports.minifySync
export const RawJavascriptParserCommonjsExports = __napiModule.exports.RawJavascriptParserCommonjsExports
export const RawRuleSetConditionType = __napiModule.exports.RawRuleSetConditionType
export const registerGlobalTrace = __napiModule.exports.registerGlobalTrace
export const RegisterJsTapKind = __napiModule.exports.RegisterJsTapKind
export const sync = __napiModule.exports.sync
export const syncTraceEvent = __napiModule.exports.syncTraceEvent
export const transform = __napiModule.exports.transform
export const transformSync = __napiModule.exports.transformSync

61 changes: 1 addition & 60 deletions crates/node_binding/rspack.wasi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,63 +108,4 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
},
})
module.exports = __napiModule.exports
module.exports.Assets = __napiModule.exports.Assets
module.exports.AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock
module.exports.Chunk = __napiModule.exports.Chunk
module.exports.ChunkGraph = __napiModule.exports.ChunkGraph
module.exports.ChunkGroup = __napiModule.exports.ChunkGroup
module.exports.Chunks = __napiModule.exports.Chunks
module.exports.CodeGenerationResult = __napiModule.exports.CodeGenerationResult
module.exports.CodeGenerationResults = __napiModule.exports.CodeGenerationResults
module.exports.ConcatenatedModule = __napiModule.exports.ConcatenatedModule
module.exports.ContextModule = __napiModule.exports.ContextModule
module.exports.Dependency = __napiModule.exports.Dependency
module.exports.Diagnostics = __napiModule.exports.Diagnostics
module.exports.EntryDataDto = __napiModule.exports.EntryDataDto
module.exports.EntryDataDTO = __napiModule.exports.EntryDataDTO
module.exports.EntryDependency = __napiModule.exports.EntryDependency
module.exports.EntryOptionsDto = __napiModule.exports.EntryOptionsDto
module.exports.EntryOptionsDTO = __napiModule.exports.EntryOptionsDTO
module.exports.ExternalModule = __napiModule.exports.ExternalModule
module.exports.JsCompilation = __napiModule.exports.JsCompilation
module.exports.JsCompiler = __napiModule.exports.JsCompiler
module.exports.JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
module.exports.JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
module.exports.JsDependencies = __napiModule.exports.JsDependencies
module.exports.JsEntries = __napiModule.exports.JsEntries
module.exports.JsExportsInfo = __napiModule.exports.JsExportsInfo
module.exports.JsModuleGraph = __napiModule.exports.JsModuleGraph
module.exports.JsResolver = __napiModule.exports.JsResolver
module.exports.JsResolverFactory = __napiModule.exports.JsResolverFactory
module.exports.JsStats = __napiModule.exports.JsStats
module.exports.KnownBuildInfo = __napiModule.exports.KnownBuildInfo
module.exports.Module = __napiModule.exports.Module
module.exports.ModuleGraphConnection = __napiModule.exports.ModuleGraphConnection
module.exports.NativeWatcher = __napiModule.exports.NativeWatcher
module.exports.NativeWatchResult = __napiModule.exports.NativeWatchResult
module.exports.NormalModule = __napiModule.exports.NormalModule
module.exports.RawExternalItemFnCtx = __napiModule.exports.RawExternalItemFnCtx
module.exports.ReadonlyResourceData = __napiModule.exports.ReadonlyResourceData
module.exports.ResolverFactory = __napiModule.exports.ResolverFactory
module.exports.Sources = __napiModule.exports.Sources
module.exports.VirtualFileStore = __napiModule.exports.VirtualFileStore
module.exports.JsVirtualFileStore = __napiModule.exports.JsVirtualFileStore
module.exports.async = __napiModule.exports.async
module.exports.BuiltinPluginName = __napiModule.exports.BuiltinPluginName
module.exports.cleanupGlobalTrace = __napiModule.exports.cleanupGlobalTrace
module.exports.EnforceExtension = __napiModule.exports.EnforceExtension
module.exports.EXPECTED_RSPACK_CORE_VERSION = __napiModule.exports.EXPECTED_RSPACK_CORE_VERSION
module.exports.formatDiagnostic = __napiModule.exports.formatDiagnostic
module.exports.JsLoaderState = __napiModule.exports.JsLoaderState
module.exports.JsRspackSeverity = __napiModule.exports.JsRspackSeverity
module.exports.loadBrowserslist = __napiModule.exports.loadBrowserslist
module.exports.minify = __napiModule.exports.minify
module.exports.minifySync = __napiModule.exports.minifySync
module.exports.RawJavascriptParserCommonjsExports = __napiModule.exports.RawJavascriptParserCommonjsExports
module.exports.RawRuleSetConditionType = __napiModule.exports.RawRuleSetConditionType
module.exports.registerGlobalTrace = __napiModule.exports.registerGlobalTrace
module.exports.RegisterJsTapKind = __napiModule.exports.RegisterJsTapKind
module.exports.sync = __napiModule.exports.sync
module.exports.syncTraceEvent = __napiModule.exports.syncTraceEvent
module.exports.transform = __napiModule.exports.transform
module.exports.transformSync = __napiModule.exports.transformSync

3 changes: 2 additions & 1 deletion crates/rspack_binding_api/src/plugins/interceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ use crate::{
JsContextModuleFactoryAfterResolveDataWrapper, JsContextModuleFactoryAfterResolveResult,
JsContextModuleFactoryBeforeResolveDataWrapper, JsContextModuleFactoryBeforeResolveResult,
},
dependency::DependencyWrapper,
html::{
JsAfterEmitData, JsAfterTemplateExecutionData, JsAlterAssetTagGroupsData, JsAlterAssetTagsData,
JsBeforeAssetTagGenerationData, JsBeforeEmitData,
Expand All @@ -94,7 +95,7 @@ use crate::{
runtime::{
JsAdditionalTreeRuntimeRequirementsArg, JsAdditionalTreeRuntimeRequirementsResult,
JsCreateLinkData, JsCreateScriptData, JsLinkPrefetchData, JsLinkPreloadData, JsRuntimeGlobals,
JsRuntimeRequirementInTreeArg, JsRuntimeRequirementInTreeResult,
JsRuntimeRequirementInTreeArg, JsRuntimeRequirementInTreeResult, JsRuntimeSpec,
},
source::JsSourceToJs,
};
Expand Down
34 changes: 30 additions & 4 deletions crates/rspack_binding_api/src/raw_options/raw_builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ use napi_derive::napi;
use raw_dll::{RawDllReferenceAgencyPluginOptions, RawFlagAllModulesAsUsedPluginOptions};
use raw_ids::RawOccurrenceChunkIdsPluginOptions;
use raw_lightning_css_minimizer::RawLightningCssMinimizerRspackPluginOptions;
use raw_mf::{RawModuleFederationManifestPluginOptions, RawModuleFederationRuntimePluginOptions};
use raw_mf::{
RawCollectShareEntryPluginOptions, RawModuleFederationManifestPluginOptions,
RawModuleFederationRuntimePluginOptions, RawProvideOptions,
RawSharedUsedExportsOptimizerPluginOptions,
};
use raw_sri::RawSubresourceIntegrityPluginOptions;
use rspack_core::{BoxPlugin, Plugin, PluginExt};
use rspack_error::{Result, ToStringResultToRspackResultExt};
Expand Down Expand Up @@ -75,8 +79,9 @@ use rspack_plugin_lightning_css_minimizer::LightningCssMinimizerRspackPlugin;
use rspack_plugin_limit_chunk_count::LimitChunkCountPlugin;
use rspack_plugin_merge_duplicate_chunks::MergeDuplicateChunksPlugin;
use rspack_plugin_mf::{
ConsumeSharedPlugin, ContainerPlugin, ContainerReferencePlugin, ModuleFederationManifestPlugin,
ModuleFederationRuntimePlugin, ProvideSharedPlugin, ShareRuntimePlugin,
CollectSharedEntryPlugin, ConsumeSharedPlugin, ContainerPlugin, ContainerReferencePlugin,
ModuleFederationManifestPlugin, ModuleFederationRuntimePlugin, ProvideSharedPlugin,
ShareContainerPlugin, ShareRuntimePlugin, SharedUsedExportsOptimizerPlugin,
};
use rspack_plugin_module_info_header::ModuleInfoHeaderPlugin;
use rspack_plugin_module_replacement::{ContextReplacementPlugin, NormalModuleReplacementPlugin};
Expand Down Expand Up @@ -117,7 +122,7 @@ use self::{
raw_limit_chunk_count::RawLimitChunkCountPluginOptions,
raw_mf::{
RawConsumeSharedPluginOptions, RawContainerPluginOptions, RawContainerReferencePluginOptions,
RawProvideOptions,
RawShareContainerPluginOptions,
},
raw_normal_replacement::RawNormalModuleReplacementPluginOptions,
raw_runtime_chunk::RawRuntimeChunkOptions,
Expand Down Expand Up @@ -167,10 +172,13 @@ pub enum BuiltinPluginName {
SplitChunksPlugin,
RemoveDuplicateModulesPlugin,
ShareRuntimePlugin,
SharedUsedExportsOptimizerPlugin,
ContainerPlugin,
ContainerReferencePlugin,
ProvideSharedPlugin,
ConsumeSharedPlugin,
CollectSharedEntryPlugin,
ShareContainerPlugin,
ModuleFederationRuntimePlugin,
ModuleFederationManifestPlugin,
NamedModuleIdsPlugin,
Expand Down Expand Up @@ -463,6 +471,12 @@ impl<'a> BuiltinPlugin<'a> {
)
.boxed(),
),
BuiltinPluginName::SharedUsedExportsOptimizerPlugin => {
let options = downcast_into::<RawSharedUsedExportsOptimizerPluginOptions>(self.options)
.map_err(|report| napi::Error::from_reason(report.to_string()))?
.into();
plugins.push(SharedUsedExportsOptimizerPlugin::new(options).boxed());
}
BuiltinPluginName::ContainerPlugin => {
plugins.push(
ContainerPlugin::new(
Expand Down Expand Up @@ -492,6 +506,18 @@ impl<'a> BuiltinPlugin<'a> {
provides.sort_unstable_by_key(|(k, _)| k.to_string());
plugins.push(ProvideSharedPlugin::new(provides).boxed())
}
BuiltinPluginName::CollectSharedEntryPlugin => {
let options = downcast_into::<RawCollectShareEntryPluginOptions>(self.options)
.map_err(|report| napi::Error::from_reason(report.to_string()))?
.into();
plugins.push(CollectSharedEntryPlugin::new(options).boxed())
}
BuiltinPluginName::ShareContainerPlugin => {
let options = downcast_into::<RawShareContainerPluginOptions>(self.options)
.map_err(|report| napi::Error::from_reason(report.to_string()))?
.into();
plugins.push(ShareContainerPlugin::new(options).boxed())
}
BuiltinPluginName::ConsumeSharedPlugin => plugins.push(
ConsumeSharedPlugin::new(
downcast_into::<RawConsumeSharedPluginOptions>(self.options)
Expand Down
Loading