diff --git a/apps/modernjs/CHANGELOG.md b/apps/modernjs/CHANGELOG.md index ea9772ff115..62402c701b3 100644 --- a/apps/modernjs/CHANGELOG.md +++ b/apps/modernjs/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/modernjsapp +## 0.1.80 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + ## 0.1.79 ### Patch Changes diff --git a/apps/modernjs/package.json b/apps/modernjs/package.json index 57d5d4635db..abf193c5cdf 100644 --- a/apps/modernjs/package.json +++ b/apps/modernjs/package.json @@ -1,7 +1,7 @@ { "name": "@module-federation/modernjsapp", "private": true, - "version": "0.1.79", + "version": "0.1.80", "scripts": { "reset": "npx rimraf ./**/node_modules", "dev": "modern dev", diff --git a/apps/website-new/CHANGELOG.md b/apps/website-new/CHANGELOG.md index d462e4d539c..a9957cd1f38 100644 --- a/apps/website-new/CHANGELOG.md +++ b/apps/website-new/CHANGELOG.md @@ -1,5 +1,11 @@ # website-new +## 1.0.22 + +### Patch Changes + +- @module-federation/error-codes@0.8.9 + ## 1.0.21 ### Patch Changes diff --git a/apps/website-new/docs/en/configure/dts.mdx b/apps/website-new/docs/en/configure/dts.mdx index 4cb4bab1481..a584fa0f749 100644 --- a/apps/website-new/docs/en/configure/dts.mdx +++ b/apps/website-new/docs/en/configure/dts.mdx @@ -224,3 +224,11 @@ tsconfig configuration file path - Default value: `undefined` The working directory to run the compiler + +### displayErrorInTerminal + +- Type: `boolean` +- Required: No +- Default value: `true` + +Whether print error log in terminal diff --git a/apps/website-new/docs/zh/configure/dts.mdx b/apps/website-new/docs/zh/configure/dts.mdx index 56533fbafde..3c4b945abba 100644 --- a/apps/website-new/docs/zh/configure/dts.mdx +++ b/apps/website-new/docs/zh/configure/dts.mdx @@ -216,3 +216,19 @@ interface DtsHostOptions { - 默认值:`path.join(process.cwd(),'./tsconfig.json')` tsconfig 配置文件路径 + +### cwd + +- 类型:`string` +- 是否必填:否 +- 默认值:`undefined` + +运行 tsc 的路径,默认为项目根目录。 + +### displayErrorInTerminal + +- 类型:`boolean` +- 是否必填:否 +- 默认值:`true` + +是否在 terminal 输出错误日志 diff --git a/apps/website-new/docs/zh/configure/experiments.mdx b/apps/website-new/docs/zh/configure/experiments.mdx index ca1fda1f90e..5a88eb2d766 100644 --- a/apps/website-new/docs/zh/configure/experiments.mdx +++ b/apps/website-new/docs/zh/configure/experiments.mdx @@ -35,9 +35,9 @@ new ModuleFederationPlugin({ 这些配置可用于下列场景: -- 设置`runtimeChunk: 'single'`。 -- 避免在应用程序顶部或用户代码入口点使用“import()”,以防止急切消费错误。过去,这通常是强制性的,并且在示例应用程序中通常被视为“import('./bootstrap.js')”。 -- 将模块联合运行时包移动到运行时块中,使它们远离入口点 - 减少代码重复 +- 设置 `runtimeChunk: 'single'`。 +- 避免在应用的顶部或用户代码的入口点使用 import(),以防止 `eager` 的错误。在过去,这通常是强制性的,并且常见的示例应用中会看到 `import('./bootstrap.js')`。 +- 将模块联邦运行时包移入运行时代码块,将它们从入口点中移出,从而减少代码重复。 下面会详细解释对应的场景。 @@ -50,7 +50,7 @@ new ModuleFederationPlugin({ 2)异步启动 -:::警告 +:::warning 此模式仍然允许设置异步入口。导出 UMD 库时,它会返回 Promise resolve 导出。 如果您手动 require() Node 中的入口点,它将 module.exports 设置为 Promise.resolve(exports)。 ::: @@ -61,7 +61,7 @@ new ModuleFederationPlugin({ 不再出现共享依赖 `eager consumption` 错误,因为文件本身的初始化表现为异步块。 -3) 提升 MF 运行时访问优先级 +3)提升 MF 运行时访问优先级 与原先在入口挂载 MF runtime 不同,现在将会提升到 bundler runtime 初始化阶段挂载 MF runtime 。 diff --git a/apps/website-new/package.json b/apps/website-new/package.json index ca9109d78c5..dd78582d9e0 100644 --- a/apps/website-new/package.json +++ b/apps/website-new/package.json @@ -1,6 +1,6 @@ { "name": "website-new", - "version": "1.0.21", + "version": "1.0.22", "private": true, "scripts": { "dev": "rspress dev", diff --git a/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md b/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md index f66491dacff..c5ca7b8e70c 100644 --- a/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md +++ b/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/bridge-react-webpack-plugin +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/bridge/bridge-react-webpack-plugin/package.json b/packages/bridge/bridge-react-webpack-plugin/package.json index 865692edfeb..8328cdab97c 100644 --- a/packages/bridge/bridge-react-webpack-plugin/package.json +++ b/packages/bridge/bridge-react-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-react-webpack-plugin", - "version": "0.8.8", + "version": "0.8.9", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/bridge-react/CHANGELOG.md b/packages/bridge/bridge-react/CHANGELOG.md index 5edb8758d6c..ac11af46793 100644 --- a/packages/bridge/bridge-react/CHANGELOG.md +++ b/packages/bridge/bridge-react/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/bridge-react +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 +- @module-federation/bridge-shared@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/bridge/bridge-react/package.json b/packages/bridge/bridge-react/package.json index dc0481789a6..2178d081879 100644 --- a/packages/bridge/bridge-react/package.json +++ b/packages/bridge/bridge-react/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-react", - "version": "0.8.8", + "version": "0.8.9", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/bridge-shared/CHANGELOG.md b/packages/bridge/bridge-shared/CHANGELOG.md index bd3f92ae864..1fbc9f3dbe2 100644 --- a/packages/bridge/bridge-shared/CHANGELOG.md +++ b/packages/bridge/bridge-shared/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/bridge-shared +## 0.8.9 + ## 0.8.8 ## 0.8.7 diff --git a/packages/bridge/bridge-shared/package.json b/packages/bridge/bridge-shared/package.json index 1f506ce69e8..19985a0a91a 100644 --- a/packages/bridge/bridge-shared/package.json +++ b/packages/bridge/bridge-shared/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-shared", - "version": "0.8.8", + "version": "0.8.9", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/vue3-bridge/CHANGELOG.md b/packages/bridge/vue3-bridge/CHANGELOG.md index d20d7f34125..cac989b2319 100644 --- a/packages/bridge/vue3-bridge/CHANGELOG.md +++ b/packages/bridge/vue3-bridge/CHANGELOG.md @@ -1,5 +1,13 @@ # @module-federation/bridge-vue3 +## 0.8.9 + +### Patch Changes + +- @module-federation/runtime@0.8.9 +- @module-federation/sdk@0.8.9 +- @module-federation/bridge-shared@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/bridge/vue3-bridge/package.json b/packages/bridge/vue3-bridge/package.json index 2d667f4b81b..7faa9973dda 100644 --- a/packages/bridge/vue3-bridge/package.json +++ b/packages/bridge/vue3-bridge/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/module-federation/core", "directory": "packages/vue3-bridge" }, - "version": "0.8.8", + "version": "0.8.9", "publishConfig": { "access": "public" }, diff --git a/packages/chrome-devtools/CHANGELOG.md b/packages/chrome-devtools/CHANGELOG.md index 9d3a8ddc5cc..1a79dde255e 100644 --- a/packages/chrome-devtools/CHANGELOG.md +++ b/packages/chrome-devtools/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/devtools +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/chrome-devtools/package.json b/packages/chrome-devtools/package.json index 28110f62621..1ed0bd0293a 100644 --- a/packages/chrome-devtools/package.json +++ b/packages/chrome-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/devtools", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "repository": { "type": "git", diff --git a/packages/data-prefetch/CHANGELOG.md b/packages/data-prefetch/CHANGELOG.md index 7f7ac03a9b7..199ebe501f8 100644 --- a/packages/data-prefetch/CHANGELOG.md +++ b/packages/data-prefetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/data-prefetch +## 0.8.9 + +### Patch Changes + +- @module-federation/runtime@0.8.9 +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/data-prefetch/package.json b/packages/data-prefetch/package.json index deacd277459..1daf6c68379 100644 --- a/packages/data-prefetch/package.json +++ b/packages/data-prefetch/package.json @@ -1,7 +1,7 @@ { "name": "@module-federation/data-prefetch", "description": "Module Federation Data Prefetch", - "version": "0.8.8", + "version": "0.8.9", "author": "nieyan ", "homepage": "https://github.com/module-federation/core", "license": "MIT", diff --git a/packages/dts-plugin/CHANGELOG.md b/packages/dts-plugin/CHANGELOG.md index 8af3c6c6897..dc949edcd34 100644 --- a/packages/dts-plugin/CHANGELOG.md +++ b/packages/dts-plugin/CHANGELOG.md @@ -1,5 +1,22 @@ # @module-federation/dts-plugin +## 0.8.9 + +### Patch Changes + +- 6e3afc6: feat(dts-plugin): support pass headers when request types url +- 1be9d62: feat(dts-plugin): add dts.displayErrorInTerminal to help control display error +- 6e3afc6: fix(dts-plugin): set outputDir default value +- 6e3afc6: fix(dts-plugin): use remoteTarPath first to fetch hot types +- 6e3afc6: fix(dts-plugin): only consume types in dev +- 6e3afc6: fix(dts-plugin): throw error while downloading types archive hit historyApiFallback +- 6e3afc6: fix(dts-plugin): generateTypes should after consumeTypes finished +- 6e3afc6: fix(dts-plugin): dev plugin should apply after fetchPromise resolved + - @module-federation/sdk@0.8.9 + - @module-federation/managers@0.8.9 + - @module-federation/third-party-dts-extractor@0.8.9 + - @module-federation/error-codes@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/dts-plugin/package.json b/packages/dts-plugin/package.json index bf41e35d2dd..0a5f0266624 100644 --- a/packages/dts-plugin/package.json +++ b/packages/dts-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/dts-plugin", - "version": "0.8.8", + "version": "0.8.9", "author": "hanric ", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/packages/dts-plugin/src/core/interfaces/DTSManagerOptions.ts b/packages/dts-plugin/src/core/interfaces/DTSManagerOptions.ts index 13590eb74c7..99cded775ea 100644 --- a/packages/dts-plugin/src/core/interfaces/DTSManagerOptions.ts +++ b/packages/dts-plugin/src/core/interfaces/DTSManagerOptions.ts @@ -1,3 +1,4 @@ +import { moduleFederationPlugin } from '@module-federation/sdk'; import { HostOptions } from './HostOptions'; import { RemoteOptions } from './RemoteOptions'; @@ -5,4 +6,5 @@ export interface DTSManagerOptions { remote?: RemoteOptions; host?: HostOptions; extraOptions?: Record; + displayErrorInTerminal?: moduleFederationPlugin.PluginDtsOptions['displayErrorInTerminal']; } diff --git a/packages/dts-plugin/src/core/lib/DTSManager.ts b/packages/dts-plugin/src/core/lib/DTSManager.ts index 2d5597fc011..ab1c6e3d7ea 100644 --- a/packages/dts-plugin/src/core/lib/DTSManager.ts +++ b/packages/dts-plugin/src/core/lib/DTSManager.ts @@ -166,7 +166,9 @@ class DTSManager { logger.success('Federated types created correctly'); } catch (error) { if (this.options.remote?.abortOnError === false) { - logger.error(`Unable to compile federated types, ${error}`); + if (this.options.displayErrorInTerminal) { + logger.error(`Unable to compile federated types${error}`); + } } else { throw error; } @@ -263,10 +265,11 @@ class DTSManager { const filePath = path.join(destinationPath, REMOTE_API_TYPES_FILE_NAME); fs.writeFileSync(filePath, apiTypeFile); this.loadedRemoteAPIAlias.add(remoteInfo.alias); + fileLog(`success`, 'downloadAPITypes', 'info'); } catch (err) { fileLog( `Unable to download "${remoteInfo.name}" api types, ${err}`, - 'consumeTargetRemotes', + 'downloadAPITypes', 'error', ); } @@ -420,17 +423,17 @@ class DTSManager { async updateTypes(options: UpdateTypesOptions): Promise { try { - // can use remoteTarPath directly in the future const { remoteName, updateMode, + remoteTarPath, remoteInfo: updatedRemoteInfo, once, } = options; const hostName = this.options?.host?.moduleFederationConfig?.name; fileLog( - `updateTypes options:, ${JSON.stringify(options, null, 2)}`, - 'consumeTypes', + `options: ${JSON.stringify(options, null, 2)};\nhostName: ${hostName}`, + 'updateTypes', 'info', ); if (updateMode === UpdateMode.POSITIVE && remoteName === hostName) { @@ -454,19 +457,39 @@ class DTSManager { const consumeTypes = async ( requiredRemoteInfo: Required, ) => { + fileLog(`consumeTypes start`, 'updateTypes', 'info'); + if (!requiredRemoteInfo.zipUrl) { + throw new Error( + `Can not get ${requiredRemoteInfo.name}'s types archive url!`, + ); + } const [_alias, destinationPath] = await this.consumeTargetRemotes( hostOptions, - requiredRemoteInfo, + { + ...requiredRemoteInfo, + // use remoteTarPath first + zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl, + }, ); await this.downloadAPITypes(requiredRemoteInfo, destinationPath); + fileLog(`consumeTypes end`, 'updateTypes', 'info'); }; - + fileLog( + `loadedRemoteInfo: ${JSON.stringify(loadedRemoteInfo, null, 2)}`, + 'updateTypes', + 'info', + ); if (!loadedRemoteInfo) { const remoteInfo = Object.values(mapRemotesToDownload).find( (item) => { return item.name === remoteName; }, ); + fileLog( + `remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, + 'updateTypes', + 'info', + ); if (remoteInfo) { if (!this.remoteAliasMap[remoteInfo.alias]) { const requiredRemoteInfo = @@ -496,7 +519,7 @@ class DTSManager { null, 2, )}`, - 'consumeTypes', + 'updateTypes', 'info', ); await consumeDynamicRemoteTypes(); diff --git a/packages/dts-plugin/src/core/lib/archiveHandler.ts b/packages/dts-plugin/src/core/lib/archiveHandler.ts index 77c0bc5ab83..66cf717cbc4 100644 --- a/packages/dts-plugin/src/core/lib/archiveHandler.ts +++ b/packages/dts-plugin/src/core/lib/archiveHandler.ts @@ -63,6 +63,14 @@ export const downloadTypesArchive = (hostOptions: Required) => { const response = await axiosGet(url, { responseType: 'arraybuffer', }).catch(downloadErrorLogger(destinationFolder, url)); + if ( + typeof response.headers?.['content-type'] === 'string' && + response.headers['content-type'].includes('text/html') + ) { + throw new Error( + `${url} receives invalid content-type: ${response.headers['content-type']}`, + ); + } try { if (hostOptions.deleteTypesFolder) { @@ -81,6 +89,11 @@ export const downloadTypesArchive = (hostOptions: Required) => { const zip = new AdmZip(Buffer.from(response.data)); zip.extractAllTo(destinationPath, true); + fileLog( + `zip.extractAllTo success destinationPath: ${destinationPath}; url: ${url}`, + 'downloadTypesArchive', + 'info', + ); return [destinationFolder, destinationPath]; } catch (error: any) { fileLog( diff --git a/packages/dts-plugin/src/core/lib/typeScriptCompiler.test.ts b/packages/dts-plugin/src/core/lib/typeScriptCompiler.test.ts index 788276042c0..897e222830b 100644 --- a/packages/dts-plugin/src/core/lib/typeScriptCompiler.test.ts +++ b/packages/dts-plugin/src/core/lib/typeScriptCompiler.test.ts @@ -308,9 +308,6 @@ describe('typeScriptCompiler', () => { { name: 'GenerateTypesPlugin.d.ts', }, - { - name: 'TypesPlugin.d.ts', - }, { name: 'utils.d.ts', }, diff --git a/packages/dts-plugin/src/core/lib/typeScriptCompiler.ts b/packages/dts-plugin/src/core/lib/typeScriptCompiler.ts index d6af86836d7..1897bbdde6c 100644 --- a/packages/dts-plugin/src/core/lib/typeScriptCompiler.ts +++ b/packages/dts-plugin/src/core/lib/typeScriptCompiler.ts @@ -66,7 +66,7 @@ function writeTempTsConfig( const createHash = (contents: string) => { return crypto.createHash('md5').update(contents).digest('hex'); }; - const hash = createHash(`${JSON.stringify(tsConfig)}${name}`); + const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`); const tempTsConfigJsonPath = resolve( context, 'node_modules', diff --git a/packages/dts-plugin/src/core/lib/utils.ts b/packages/dts-plugin/src/core/lib/utils.ts index d503e893265..ac106e7a353 100644 --- a/packages/dts-plugin/src/core/lib/utils.ts +++ b/packages/dts-plugin/src/core/lib/utils.ts @@ -3,7 +3,7 @@ import path from 'path'; import axios, { type AxiosRequestConfig } from 'axios'; import http from 'http'; import https from 'https'; -import { moduleFederationPlugin } from '@module-federation/sdk'; +import { moduleFederationPlugin, getProcessEnv } from '@module-federation/sdk'; import ansiColors from 'ansi-colors'; import { retrieveRemoteConfig } from '../configurations/remotePlugin'; import { HostOptions } from '../interfaces/HostOptions'; @@ -132,8 +132,23 @@ export function cloneDeepOptions(options: DTSManagerOptions) { }); } +const getEnvHeaders = (): Record => { + const headersStr = getProcessEnv()['MF_ENV_HEADERS'] || '{}'; + + return { + ...JSON.parse(headersStr), + }; +}; + export async function axiosGet(url: string, config?: AxiosRequestConfig) { const httpAgent = new http.Agent({ family: 4 }); const httpsAgent = new https.Agent({ family: 4 }); - return axios.get(url, { httpAgent, httpsAgent, ...config }); + return axios.get(url, { + httpAgent, + httpsAgent, + ...{ + headers: getEnvHeaders(), + }, + ...config, + }); } diff --git a/packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts b/packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts index 9c5082fa946..ac1a899607b 100644 --- a/packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts +++ b/packages/dts-plugin/src/plugins/ConsumeTypesPlugin.ts @@ -4,23 +4,33 @@ import { type moduleFederationPlugin, } from '@module-federation/sdk'; import { validateOptions, consumeTypes } from '../core/index'; +import { isPrd } from './utils'; export class ConsumeTypesPlugin implements WebpackPluginInstance { pluginOptions: moduleFederationPlugin.ModuleFederationPluginOptions; dtsOptions: moduleFederationPlugin.PluginDtsOptions; defaultOptions: moduleFederationPlugin.DtsHostOptions; + callback: () => void; + constructor( pluginOptions: moduleFederationPlugin.ModuleFederationPluginOptions, dtsOptions: moduleFederationPlugin.PluginDtsOptions, defaultOptions: moduleFederationPlugin.DtsHostOptions, + callback: () => void, ) { this.pluginOptions = pluginOptions; this.dtsOptions = dtsOptions; this.defaultOptions = defaultOptions; + this.callback = callback; } apply(compiler: Compiler) { - const { dtsOptions, defaultOptions, pluginOptions } = this; + const { dtsOptions, defaultOptions, pluginOptions, callback } = this; + + if (isPrd()) { + callback(); + return; + } const normalizedConsumeTypes = normalizeOptions( @@ -30,6 +40,7 @@ export class ConsumeTypesPlugin implements WebpackPluginInstance { )(dtsOptions.consumeTypes); if (!normalizedConsumeTypes) { + callback(); return; } @@ -41,11 +52,18 @@ export class ConsumeTypesPlugin implements WebpackPluginInstance { ...normalizedConsumeTypes, }, extraOptions: dtsOptions.extraOptions || {}, + displayErrorInTerminal: dtsOptions.displayErrorInTerminal, }; validateOptions(finalOptions.host); // only consume once , if remotes update types , DevPlugin will auto sync the latest types - consumeTypes(finalOptions); + consumeTypes(finalOptions) + .then(() => { + callback(); + }) + .catch(() => { + callback(); + }); } } diff --git a/packages/dts-plugin/src/plugins/DevPlugin.ts b/packages/dts-plugin/src/plugins/DevPlugin.ts index 064fe6a9c6f..a46e2858c5b 100644 --- a/packages/dts-plugin/src/plugins/DevPlugin.ts +++ b/packages/dts-plugin/src/plugins/DevPlugin.ts @@ -1,6 +1,6 @@ import fs from 'fs-extra'; -import chalk from 'chalk'; -import { type DevWorker, createDevWorker } from '../dev-worker'; +import path from 'path'; +import { createDevWorker } from '../dev-worker'; import { moduleFederationPlugin, normalizeOptions, @@ -12,11 +12,12 @@ import { getIPV4, logger, } from '../server'; -import type { Compiler, WebpackPluginInstance } from 'webpack'; -import path from 'path'; -import { isDev } from './utils'; +import { getCompilerOutputDir, isDev } from './utils'; import { isTSProject } from '../core/lib/utils'; +import type { Compiler, WebpackPluginInstance } from 'webpack'; +import type { DevWorker } from '../dev-worker'; + enum PROCESS_EXIT_CODE { SUCCESS = 0, FAILURE = 1, @@ -35,9 +36,17 @@ export class DevPlugin implements WebpackPluginInstance { readonly name = 'MFDevPlugin'; private _options: moduleFederationPlugin.ModuleFederationPluginOptions; private _devWorker?: DevWorker; + dtsOptions: moduleFederationPlugin.PluginDtsOptions; + fetchTypesPromise: Promise; - constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions) { + constructor( + options: moduleFederationPlugin.ModuleFederationPluginOptions, + dtsOptions: moduleFederationPlugin.PluginDtsOptions, + fetchTypesPromise: Promise, + ) { this._options = options; + this.fetchTypesPromise = fetchTypesPromise; + this.dtsOptions = dtsOptions; } static ensureLiveReloadEntry( @@ -167,6 +176,7 @@ export class DevPlugin implements WebpackPluginInstance { generateTypes: defaultGenerateTypes, consumeTypes: defaultConsumeTypes, extraOptions: {}, + displayErrorInTerminal: this.dtsOptions?.displayErrorInTerminal, }, 'mfOptions.dts', )(dts); @@ -191,10 +201,7 @@ export class DevPlugin implements WebpackPluginInstance { ? undefined : normalizedDtsOptions.implementation, context: compiler.context, - outputDir: path.relative( - compiler.context, - compiler.outputPath || compiler.options.output.path, - ), + outputDir: getCompilerOutputDir(compiler), moduleFederationConfig: { ...this._options, }, @@ -246,14 +253,15 @@ export class DevPlugin implements WebpackPluginInstance { ) { remote.tsConfigPath = normalizedDtsOptions.tsConfigPath; } - - this._devWorker = createDevWorker({ - name, - remote: remote, - host: host, - extraOptions: extraOptions, - disableLiveReload: normalizedDev.disableHotTypesReload, - disableHotTypesReload: normalizedDev.disableHotTypesReload, + this.fetchTypesPromise.then(() => { + this._devWorker = createDevWorker({ + name, + remote: remote, + host: host, + extraOptions: extraOptions, + disableLiveReload: normalizedDev.disableHotTypesReload, + disableHotTypesReload: normalizedDev.disableHotTypesReload, + }); }); this._stopWhenSIGTERMOrSIGINT(); diff --git a/packages/dts-plugin/src/plugins/DtsPlugin.ts b/packages/dts-plugin/src/plugins/DtsPlugin.ts index d4e024472bd..84d1a9bdd52 100644 --- a/packages/dts-plugin/src/plugins/DtsPlugin.ts +++ b/packages/dts-plugin/src/plugins/DtsPlugin.ts @@ -1,7 +1,11 @@ -import type { Compiler, WebpackPluginInstance } from 'webpack'; -import { type moduleFederationPlugin } from '@module-federation/sdk'; import { DevPlugin } from './DevPlugin'; -import { TypesPlugin } from './TypesPlugin'; +import { normalizeOptions } from '@module-federation/sdk'; +import { ConsumeTypesPlugin } from './ConsumeTypesPlugin'; +import { GenerateTypesPlugin } from './GenerateTypesPlugin'; +import { isTSProject } from '../core'; + +import { type moduleFederationPlugin } from '@module-federation/sdk'; +import type { Compiler, WebpackPluginInstance } from 'webpack'; export class DtsPlugin implements WebpackPluginInstance { options: moduleFederationPlugin.ModuleFederationPluginOptions; @@ -11,7 +15,61 @@ export class DtsPlugin implements WebpackPluginInstance { apply(compiler: Compiler) { const { options } = this; - new DevPlugin(options).apply(compiler); - new TypesPlugin(options).apply(compiler); + + const defaultGenerateTypes = { + generateAPITypes: true, + compileInChildProcess: true, + abortOnError: false, + extractThirdParty: true, + extractRemoteTypes: true, + }; + const defaultConsumeTypes = { abortOnError: false, consumeAPITypes: true }; + const normalizedDtsOptions = + normalizeOptions( + isTSProject(options.dts, compiler.context), + { + generateTypes: defaultGenerateTypes, + consumeTypes: defaultConsumeTypes, + extraOptions: {}, + displayErrorInTerminal: true, + }, + 'mfOptions.dts', + )(options.dts); + + if (typeof normalizedDtsOptions !== 'object') { + return; + } + + let consumeTypesPromiseResolve; + const consumeTypesPromise: Promise = new Promise((resolve) => { + consumeTypesPromiseResolve = resolve; + }); + + let generateTypesPromiseResolve; + const generateTypesPromise: Promise = new Promise((resolve) => { + generateTypesPromiseResolve = resolve; + }); + + // Because the plugin will delete dist/@mf-types.zip while generating types, which will be used in GenerateTypesPlugin + // So it should apply after GenerateTypesPlugin + new DevPlugin(options, normalizedDtsOptions, generateTypesPromise).apply( + compiler, + ); + + // The exposes files may use remote types, so it need to consume types first, otherwise the generate types will fail + new GenerateTypesPlugin( + options, + normalizedDtsOptions, + defaultGenerateTypes, + consumeTypesPromise, + generateTypesPromiseResolve, + ).apply(compiler); + + new ConsumeTypesPlugin( + options, + normalizedDtsOptions, + defaultConsumeTypes, + consumeTypesPromiseResolve, + ).apply(compiler); } } diff --git a/packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts b/packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts index 9059d36c967..d617cf06b10 100644 --- a/packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts +++ b/packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts @@ -1,6 +1,7 @@ import type { Compiler, WebpackPluginInstance } from 'webpack'; import fs from 'fs'; -import { isDev } from './utils'; +import path from 'path'; +import { isDev, getCompilerOutputDir } from './utils'; import { normalizeOptions, type moduleFederationPlugin, @@ -12,25 +13,36 @@ import { retrieveTypesAssetsInfo, type DTSManagerOptions, } from '../core/index'; -import path from 'path'; export class GenerateTypesPlugin implements WebpackPluginInstance { pluginOptions: moduleFederationPlugin.ModuleFederationPluginOptions; dtsOptions: moduleFederationPlugin.PluginDtsOptions; defaultOptions: moduleFederationPlugin.DtsRemoteOptions; + consumeTypesPromise: Promise; + callback: () => void; constructor( pluginOptions: moduleFederationPlugin.ModuleFederationPluginOptions, dtsOptions: moduleFederationPlugin.PluginDtsOptions, defaultOptions: moduleFederationPlugin.DtsRemoteOptions, + consumeTypesPromise: Promise, + callback: () => void, ) { this.pluginOptions = pluginOptions; this.dtsOptions = dtsOptions; this.defaultOptions = defaultOptions; + this.consumeTypesPromise = consumeTypesPromise; + this.callback = callback; } apply(compiler: Compiler) { - const { dtsOptions, defaultOptions, pluginOptions } = this; + const { + dtsOptions, + defaultOptions, + pluginOptions, + consumeTypesPromise, + callback, + } = this; const normalizedGenerateTypes = normalizeOptions( @@ -40,6 +52,7 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { )(dtsOptions.generateTypes); if (!normalizedGenerateTypes) { + callback(); return; } @@ -47,14 +60,12 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { remote: { implementation: dtsOptions.implementation, context: compiler.context, - outputDir: path.relative( - compiler.context, - compiler.outputPath || compiler.options.output.path, - ), + outputDir: getCompilerOutputDir(compiler), moduleFederationConfig: pluginOptions, ...normalizedGenerateTypes, }, extraOptions: dtsOptions.extraOptions || {}, + displayErrorInTerminal: dtsOptions.displayErrorInTerminal, }; if (dtsOptions.tsConfigPath && !finalOptions.remote.tsConfigPath) { @@ -79,86 +90,6 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { const generateTypesFn = getGenerateTypesFn(); let compiledOnce = false; - const emitTypesFilesDev = async () => { - try { - if (!isDev()) { - return; - } - const { zipTypesPath, apiTypesPath, zipName, apiFileName } = - retrieveTypesAssetsInfo(finalOptions.remote); - - await generateTypesFn(finalOptions); - const config = finalOptions.remote.moduleFederationConfig; - let zipPrefix = ''; - if (typeof config.manifest === 'object' && config.manifest.filePath) { - zipPrefix = config.manifest.filePath; - } else if ( - typeof config.manifest === 'object' && - config.manifest.fileName - ) { - zipPrefix = path.dirname(config.manifest.fileName); - } else if (config.filename) { - zipPrefix = path.dirname(config.filename); - } - - if (zipTypesPath) { - const zipContent = fs.readFileSync(zipTypesPath); - const zipOutputPath = path.join( - compiler.outputPath, - zipPrefix, - zipName, - ); - await new Promise((resolve, reject) => { - compiler.outputFileSystem.mkdir( - path.dirname(zipOutputPath), - (err) => { - if (err) reject(err); - else { - compiler.outputFileSystem.writeFile( - zipOutputPath, - zipContent, - (writeErr) => { - if (writeErr) reject(writeErr); - else resolve(); - }, - ); - } - }, - ); - }); - } - - if (apiTypesPath) { - const apiContent = fs.readFileSync(apiTypesPath); - const apiOutputPath = path.join( - compiler.outputPath, - zipPrefix, - apiFileName, - ); - await new Promise((resolve, reject) => { - compiler.outputFileSystem.mkdir( - path.dirname(apiOutputPath), - (err) => { - if (err) reject(err); - else { - compiler.outputFileSystem.writeFile( - apiOutputPath, - apiContent, - (writeErr) => { - if (writeErr) reject(writeErr); - else resolve(); - }, - ); - } - }, - ); - }); - } - } catch (err) { - console.error(err); - } - }; - compiler.hooks.thisCompilation.tap('mf:generateTypes', (compilation) => { compilation.hooks.processAssets.tapPromise( { @@ -168,13 +99,14 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER, }, async () => { + await consumeTypesPromise; try { if (pluginOptions.dev === false && compiledOnce) { return; } if (compiledOnce) { - emitTypesFilesDev(); + // Dev types will be generated by DevPlugin, the archive filename usually is dist/.dev-server.zip return; } @@ -201,7 +133,8 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { zipPrefix = path.dirname(config.filename); } - if (zipTypesPath) { + const zipAssetName = path.join(zipPrefix, zipName); + if (zipTypesPath && !compilation.getAsset(zipAssetName)) { compilation.emitAsset( path.join(zipPrefix, zipName), new compiler.webpack.sources.RawSource( @@ -211,7 +144,8 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { ); } - if (apiTypesPath) { + const apiAssetName = path.join(zipPrefix, apiFileName); + if (apiTypesPath && !compilation.getAsset(apiAssetName)) { compilation.emitAsset( path.join(zipPrefix, apiFileName), new compiler.webpack.sources.RawSource( @@ -221,8 +155,15 @@ export class GenerateTypesPlugin implements WebpackPluginInstance { ); } compiledOnce = true; + callback(); } catch (err) { - console.error('Error in mf:generateTypes processAssets hook:', err); + callback(); + if (finalOptions.displayErrorInTerminal) { + console.error( + 'Error in mf:generateTypes processAssets hook:', + err, + ); + } } }, ); diff --git a/packages/dts-plugin/src/plugins/TypesPlugin.ts b/packages/dts-plugin/src/plugins/TypesPlugin.ts deleted file mode 100644 index 34fb67f8b6a..00000000000 --- a/packages/dts-plugin/src/plugins/TypesPlugin.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - normalizeOptions, - type moduleFederationPlugin, -} from '@module-federation/sdk'; -import type { Compiler, WebpackPluginInstance } from 'webpack'; -import { ConsumeTypesPlugin } from './ConsumeTypesPlugin'; -import { GenerateTypesPlugin } from './GenerateTypesPlugin'; -import { isTSProject } from '../core'; - -class TypesPlugin implements WebpackPluginInstance { - options: moduleFederationPlugin.ModuleFederationPluginOptions; - constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions) { - this.options = options; - } - - apply(compiler: Compiler) { - const { options } = this; - - const defaultGenerateTypes = { - generateAPITypes: true, - compileInChildProcess: true, - abortOnError: false, - extractThirdParty: true, - extractRemoteTypes: true, - }; - const defaultConsumeTypes = { abortOnError: false, consumeAPITypes: true }; - const normalizedDtsOptions = - normalizeOptions( - isTSProject(options.dts, compiler.context), - { - generateTypes: defaultGenerateTypes, - consumeTypes: defaultConsumeTypes, - extraOptions: {}, - }, - 'mfOptions.dts', - )(options.dts); - - if (typeof normalizedDtsOptions !== 'object') { - return; - } - - new GenerateTypesPlugin( - options, - normalizedDtsOptions, - defaultGenerateTypes, - ).apply(compiler); - new ConsumeTypesPlugin( - options, - normalizedDtsOptions, - defaultConsumeTypes, - ).apply(compiler); - } -} - -export { TypesPlugin }; diff --git a/packages/dts-plugin/src/plugins/utils.ts b/packages/dts-plugin/src/plugins/utils.ts index cc934f49835..0b9c9306fed 100644 --- a/packages/dts-plugin/src/plugins/utils.ts +++ b/packages/dts-plugin/src/plugins/utils.ts @@ -1,3 +1,21 @@ +import path from 'path'; + +import type { Compiler } from 'webpack'; + export function isDev(): boolean { return process.env['NODE_ENV'] === 'development'; } +export function isPrd(): boolean { + return process.env['NODE_ENV'] === 'production'; +} + +export function getCompilerOutputDir(compiler: Compiler) { + try { + return path.relative( + compiler.context, + compiler.outputPath || compiler.options.output.path, + ); + } catch (err) { + return ''; + } +} diff --git a/packages/enhanced/CHANGELOG.md b/packages/enhanced/CHANGELOG.md index 33590f7b330..2560833e4d4 100644 --- a/packages/enhanced/CHANGELOG.md +++ b/packages/enhanced/CHANGELOG.md @@ -1,5 +1,29 @@ # @module-federation/enhanced +## 0.8.9 + +### Patch Changes + +- 6e3afc6: fix(enhanced): no push ModuleFederationPlugin self +- Updated dependencies [6e3afc6] +- Updated dependencies [1be9d62] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] + - @module-federation/dts-plugin@0.8.9 + - @module-federation/manifest@0.8.9 + - @module-federation/rspack@0.8.9 + - @module-federation/sdk@0.8.9 + - @module-federation/runtime-tools@0.8.9 + - @module-federation/managers@0.8.9 + - @module-federation/bridge-react-webpack-plugin@0.8.9 + - @module-federation/data-prefetch@0.8.9 + - @module-federation/error-codes@0.8.9 + - @module-federation/inject-external-runtime-core-plugin@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/enhanced/package.json b/packages/enhanced/package.json index f062db3fc3d..441c7f2a3bd 100644 --- a/packages/enhanced/package.json +++ b/packages/enhanced/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/enhanced", - "version": "0.8.8", + "version": "0.8.9", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "repository": { diff --git a/packages/enhanced/src/wrapper/ModuleFederationPlugin.ts b/packages/enhanced/src/wrapper/ModuleFederationPlugin.ts index 36339a41e2b..5994c53c5df 100644 --- a/packages/enhanced/src/wrapper/ModuleFederationPlugin.ts +++ b/packages/enhanced/src/wrapper/ModuleFederationPlugin.ts @@ -1,12 +1,7 @@ -import type { - WebpackPluginInstance, - Compiler, - WebpackPluginFunction, -} from 'webpack'; +import type { WebpackPluginInstance, Compiler } from 'webpack'; import type { moduleFederationPlugin } from '@module-federation/sdk'; import type IModuleFederationPlugin from '../lib/container/ModuleFederationPlugin'; import type { ResourceInfo } from '@module-federation/manifest'; -import type { Falsy } from 'webpack/declarations/WebpackOptions'; import { getWebpackPath } from '@module-federation/sdk/normalize-webpack-path'; import path from 'node:path'; @@ -26,14 +21,6 @@ export default class ModuleFederationPlugin implements WebpackPluginInstance { } apply(compiler: Compiler) { - if ( - !compiler.options.plugins.find( - (p: WebpackPluginInstance | WebpackPluginFunction | Falsy) => - p && (p as WebpackPluginInstance)['name'] === PLUGIN_NAME, - ) - ) { - compiler.options.plugins.push(this); - } process.env['FEDERATION_WEBPACK_PATH'] = process.env['FEDERATION_WEBPACK_PATH'] || getWebpackPath(compiler); const CoreModuleFederationPlugin = diff --git a/packages/error-codes/CHANGELOG.md b/packages/error-codes/CHANGELOG.md index 1e4fab34c00..c7af3791adb 100644 --- a/packages/error-codes/CHANGELOG.md +++ b/packages/error-codes/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/error-codes +## 0.8.9 + ## 0.8.8 ## 0.8.7 diff --git a/packages/error-codes/package.json b/packages/error-codes/package.json index ba527835d84..e8bc85ac473 100644 --- a/packages/error-codes/package.json +++ b/packages/error-codes/package.json @@ -4,7 +4,7 @@ "author": "zhanghang ", "public": true, "sideEffects": false, - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "repository": { "type": "git", diff --git a/packages/esbuild/CHANGELOG.md b/packages/esbuild/CHANGELOG.md index 9b3599b18fd..642a2cb9b18 100644 --- a/packages/esbuild/CHANGELOG.md +++ b/packages/esbuild/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/esbuild +## 0.0.52 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 0.0.51 ### Patch Changes diff --git a/packages/esbuild/package.json b/packages/esbuild/package.json index 82e7abf0648..23b7093d2c1 100644 --- a/packages/esbuild/package.json +++ b/packages/esbuild/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/esbuild", - "version": "0.0.51", + "version": "0.0.52", "author": "Zack Jackson (@ScriptedAlchemy)", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.js", diff --git a/packages/managers/CHANGELOG.md b/packages/managers/CHANGELOG.md index 3dce7fde4b0..2583971ee15 100644 --- a/packages/managers/CHANGELOG.md +++ b/packages/managers/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/managers +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/managers/package.json b/packages/managers/package.json index de287740741..5905b573e2f 100644 --- a/packages/managers/package.json +++ b/packages/managers/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/managers", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "description": "Provide managers for helping handle mf data .", "keywords": [ diff --git a/packages/manifest/CHANGELOG.md b/packages/manifest/CHANGELOG.md index 4034a12544c..c40ee1c75ac 100644 --- a/packages/manifest/CHANGELOG.md +++ b/packages/manifest/CHANGELOG.md @@ -1,5 +1,21 @@ # @module-federation/manifest +## 0.8.9 + +### Patch Changes + +- Updated dependencies [6e3afc6] +- Updated dependencies [1be9d62] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] + - @module-federation/dts-plugin@0.8.9 + - @module-federation/sdk@0.8.9 + - @module-federation/managers@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/manifest/package.json b/packages/manifest/package.json index d920b72364f..219ab7870d5 100644 --- a/packages/manifest/package.json +++ b/packages/manifest/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/manifest", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "description": "Provide manifest/stats for webpack/rspack MF project .", "keywords": [ diff --git a/packages/manifest/src/StatsManager.ts b/packages/manifest/src/StatsManager.ts index 873624a1e84..941374a0d5f 100644 --- a/packages/manifest/src/StatsManager.ts +++ b/packages/manifest/src/StatsManager.ts @@ -134,7 +134,7 @@ class StatsManager { (this._options?.library?.type as RemoteEntryType | undefined) || 'global', }, - types: getTypesMetaInfo(this._options, compiler.context), + types: getTypesMetaInfo(this._options, compiler.context, compilation), globalName: globalName, pluginVersion: this._pluginVersion, }; diff --git a/packages/manifest/src/utils.ts b/packages/manifest/src/utils.ts index bc90b5158d2..cecd6a40bfd 100644 --- a/packages/manifest/src/utils.ts +++ b/packages/manifest/src/utils.ts @@ -261,6 +261,7 @@ export function getFileName( export function getTypesMetaInfo( pluginOptions: moduleFederationPlugin.ModuleFederationPluginOptions, context: string, + compilation: Compilation, ): MetaDataTypes { const defaultRemoteOptions = { generateAPITypes: true, @@ -303,11 +304,32 @@ export function getTypesMetaInfo( moduleFederationConfig: pluginOptions, }); + const zip = path.join(zipPrefix, zipName); + const api = path.join(zipPrefix, apiFileName); + + if (!zip || !compilation.getAsset(zip)) { + return { + path: '', + name: '', + zip: '', + api: '', + }; + } + + if (!api || !compilation.getAsset(api)) { + return { + path: '', + name: '', + zip, + api: '', + }; + } + return { path: '', name: '', - zip: path.join(zipPrefix, zipName), - api: path.join(zipPrefix, apiFileName), + zip, + api, }; } catch (err) { logger.warn( diff --git a/packages/modernjs/CHANGELOG.md b/packages/modernjs/CHANGELOG.md index 114c5ed6592..2b53c4e13bc 100644 --- a/packages/modernjs/CHANGELOG.md +++ b/packages/modernjs/CHANGELOG.md @@ -1,5 +1,15 @@ # @module-federation/modern-js +## 0.8.9 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + - @module-federation/node@2.6.22 + - @module-federation/rsbuild-plugin@0.8.9 + - @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/modernjs/package.json b/packages/modernjs/package.json index 4622580862b..40054453a38 100644 --- a/packages/modernjs/package.json +++ b/packages/modernjs/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/modern-js", - "version": "0.8.8", + "version": "0.8.9", "files": [ "dist/", "types.d.ts", diff --git a/packages/nextjs-mf/CHANGELOG.md b/packages/nextjs-mf/CHANGELOG.md index e880e3cec60..41ebbe2cef4 100644 --- a/packages/nextjs-mf/CHANGELOG.md +++ b/packages/nextjs-mf/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/nextjs-mf +## 8.8.12 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + - @module-federation/node@2.6.22 + - @module-federation/runtime@0.8.9 + - @module-federation/webpack-bundler-runtime@0.8.9 + - @module-federation/sdk@0.8.9 + ## 8.8.11 ### Patch Changes diff --git a/packages/nextjs-mf/package.json b/packages/nextjs-mf/package.json index 357823c7c09..7ed8f25f560 100644 --- a/packages/nextjs-mf/package.json +++ b/packages/nextjs-mf/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/nextjs-mf", - "version": "8.8.11", + "version": "8.8.12", "license": "MIT", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 86a52723167..ea655bdb99e 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -1,5 +1,15 @@ # @module-federation/node +## 2.6.22 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + - @module-federation/runtime@0.8.9 + - @module-federation/sdk@0.8.9 + - @module-federation/utilities@3.1.40 + ## 2.6.21 ### Patch Changes diff --git a/packages/node/package.json b/packages/node/package.json index 0b1423195e0..5652eef67dc 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,7 +1,7 @@ { "public": true, "name": "@module-federation/node", - "version": "2.6.21", + "version": "2.6.22", "type": "commonjs", "main": "./dist/src/index.js", "exports": { diff --git a/packages/retry-plugin/CHANGELOG.md b/packages/retry-plugin/CHANGELOG.md index e361a856adc..9becfc2689b 100644 --- a/packages/retry-plugin/CHANGELOG.md +++ b/packages/retry-plugin/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/retry-plugin +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/retry-plugin/package.json b/packages/retry-plugin/package.json index 7cc4bed0d03..565207c7b2c 100644 --- a/packages/retry-plugin/package.json +++ b/packages/retry-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/retry-plugin", - "version": "0.8.8", + "version": "0.8.9", "author": "danpeen ", "main": "./dist/index.js", "module": "./dist/esm/index.js", diff --git a/packages/rsbuild-plugin/CHANGELOG.md b/packages/rsbuild-plugin/CHANGELOG.md index 299ec15726f..11e889bf394 100644 --- a/packages/rsbuild-plugin/CHANGELOG.md +++ b/packages/rsbuild-plugin/CHANGELOG.md @@ -1,5 +1,13 @@ # @module-federation/rsbuild-plugin +## 0.8.9 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + - @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/rsbuild-plugin/package.json b/packages/rsbuild-plugin/package.json index 31a7ab6707a..c2dc57cfce1 100644 --- a/packages/rsbuild-plugin/package.json +++ b/packages/rsbuild-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/rsbuild-plugin", - "version": "0.8.8", + "version": "0.8.9", "description": "Module Federation plugin for Rsbuild", "homepage": "https://module-federation.io", "bugs": { diff --git a/packages/rspack/CHANGELOG.md b/packages/rspack/CHANGELOG.md index 93b57057692..6750e9436eb 100644 --- a/packages/rspack/CHANGELOG.md +++ b/packages/rspack/CHANGELOG.md @@ -1,5 +1,25 @@ # @module-federation/rspack +## 0.8.9 + +### Patch Changes + +- Updated dependencies [6e3afc6] +- Updated dependencies [1be9d62] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] +- Updated dependencies [6e3afc6] + - @module-federation/dts-plugin@0.8.9 + - @module-federation/manifest@0.8.9 + - @module-federation/sdk@0.8.9 + - @module-federation/runtime-tools@0.8.9 + - @module-federation/managers@0.8.9 + - @module-federation/bridge-react-webpack-plugin@0.8.9 + - @module-federation/inject-external-runtime-core-plugin@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 7c74101e818..ebd00eba876 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/rspack", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "keywords": [ "Module Federation", diff --git a/packages/runtime-core/CHANGELOG.md b/packages/runtime-core/CHANGELOG.md index 7ede5e3c9f0..ecf8a277aa8 100644 --- a/packages/runtime-core/CHANGELOG.md +++ b/packages/runtime-core/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/runtime +## 0.6.17 + +### Patch Changes + +- @module-federation/sdk@0.8.9 +- @module-federation/error-codes@0.8.9 + ## 0.6.16 ### Patch Changes diff --git a/packages/runtime-core/package.json b/packages/runtime-core/package.json index 3b728485fd8..147fb4e154b 100644 --- a/packages/runtime-core/package.json +++ b/packages/runtime-core/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/runtime-core", - "version": "0.6.16", + "version": "0.6.17", "author": "zhouxiao ", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.mjs", diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md b/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md index 009d9d4d5b9..8a508accd34 100644 --- a/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/inject-external-runtime-core-plugin +## 0.8.9 + +### Patch Changes + +- @module-federation/runtime-tools@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json index 3a2b3b8bb7c..a6b728b5141 100644 --- a/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/inject-external-runtime-core-plugin", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "description": "A sdk for support module federation", "keywords": [ diff --git a/packages/runtime-tools/CHANGELOG.md b/packages/runtime-tools/CHANGELOG.md index 59d3297a2d3..11516c9d2e3 100644 --- a/packages/runtime-tools/CHANGELOG.md +++ b/packages/runtime-tools/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/runtime-tools +## 0.8.9 + +### Patch Changes + +- @module-federation/runtime@0.8.9 +- @module-federation/webpack-bundler-runtime@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/runtime-tools/package.json b/packages/runtime-tools/package.json index 85d83a6dd1f..0a4b2bb90fa 100644 --- a/packages/runtime-tools/package.json +++ b/packages/runtime-tools/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/runtime-tools", - "version": "0.8.8", + "version": "0.8.9", "author": "zhanghang ", "main": "./dist/index.cjs", "module": "./dist/index.esm.mjs", diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index 5dad7467d99..7e8b40d6a49 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,13 @@ # @module-federation/runtime +## 0.8.9 + +### Patch Changes + +- @module-federation/sdk@0.8.9 +- @module-federation/error-codes@0.8.9 +- @module-federation/runtime-core@0.6.17 + ## 0.8.8 ### Patch Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index af0929fd5cd..37644146e66 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/runtime", - "version": "0.8.8", + "version": "0.8.9", "author": "zhouxiao ", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.mjs", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 21a09bb0b33..d64d7dd4960 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/sdk +## 0.8.9 + ## 0.8.8 ## 0.8.7 diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f13a258b036..7c17cecad60 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/sdk", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "description": "A sdk for support module federation", "keywords": [ diff --git a/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts b/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts index eaebe467176..70105e26ac5 100644 --- a/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts +++ b/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts @@ -167,6 +167,7 @@ export interface PluginDtsOptions { extraOptions?: Record; implementation?: string; cwd?: string; + displayErrorInTerminal?: boolean; } export type AsyncBoundaryOptions = { diff --git a/packages/storybook-addon/CHANGELOG.md b/packages/storybook-addon/CHANGELOG.md index 5ec80866ffa..8b844a7f4c8 100644 --- a/packages/storybook-addon/CHANGELOG.md +++ b/packages/storybook-addon/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/storybook-addon +## 4.0.1 + +### Patch Changes + +- Updated dependencies [6e3afc6] + - @module-federation/enhanced@0.8.9 + - @module-federation/sdk@0.8.9 + - @module-federation/utilities@3.1.40 + ## 4.0.0 ### Major Changes diff --git a/packages/storybook-addon/package.json b/packages/storybook-addon/package.json index d71bf2a2c51..f501f86f068 100644 --- a/packages/storybook-addon/package.json +++ b/packages/storybook-addon/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/storybook-addon", - "version": "4.0.0", + "version": "4.0.1", "description": "Storybook addon to consume remote module federated apps/components", "type": "commonjs", "license": "MIT", @@ -63,8 +63,8 @@ }, "peerDependencies": { "@rsbuild/core": "^1.0.1", - "@module-federation/utilities": "^3.1.39", - "@module-federation/sdk": "^0.8.8", + "@module-federation/utilities": "^3.1.40", + "@module-federation/sdk": "^0.8.9", "@nx/react": ">= 16.0.0", "@nx/webpack": ">= 16.0.0", "@storybook/core": ">= 8.2.0", diff --git a/packages/third-party-dts-extractor/CHANGELOG.md b/packages/third-party-dts-extractor/CHANGELOG.md index 75933d10d9d..d68e362ed86 100644 --- a/packages/third-party-dts-extractor/CHANGELOG.md +++ b/packages/third-party-dts-extractor/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/third-party-dts-extractor +## 0.8.9 + ## 0.8.8 ## 0.8.7 diff --git a/packages/third-party-dts-extractor/package.json b/packages/third-party-dts-extractor/package.json index 6d670a57f80..a9dcf5b132f 100644 --- a/packages/third-party-dts-extractor/package.json +++ b/packages/third-party-dts-extractor/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/third-party-dts-extractor", - "version": "0.8.8", + "version": "0.8.9", "files": [ "dist/", "README.md" diff --git a/packages/utilities/CHANGELOG.md b/packages/utilities/CHANGELOG.md index 09a98c1ac81..64cf3f8f029 100644 --- a/packages/utilities/CHANGELOG.md +++ b/packages/utilities/CHANGELOG.md @@ -1,5 +1,11 @@ # @module-federation/utilities +## 3.1.40 + +### Patch Changes + +- @module-federation/sdk@0.8.9 + ## 3.1.39 ### Patch Changes diff --git a/packages/utilities/package.json b/packages/utilities/package.json index bb026d7e367..beeca44baff 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/utilities", - "version": "3.1.39", + "version": "3.1.40", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.js", "types": "./dist/index.cjs.d.ts", diff --git a/packages/webpack-bundler-runtime/CHANGELOG.md b/packages/webpack-bundler-runtime/CHANGELOG.md index ff8f3825cb6..a014ca6d8a4 100644 --- a/packages/webpack-bundler-runtime/CHANGELOG.md +++ b/packages/webpack-bundler-runtime/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/webpack-bundler-runtime +## 0.8.9 + +### Patch Changes + +- @module-federation/runtime@0.8.9 +- @module-federation/sdk@0.8.9 + ## 0.8.8 ### Patch Changes diff --git a/packages/webpack-bundler-runtime/package.json b/packages/webpack-bundler-runtime/package.json index 5848696b34c..69f66bb0bf4 100644 --- a/packages/webpack-bundler-runtime/package.json +++ b/packages/webpack-bundler-runtime/package.json @@ -1,7 +1,7 @@ { "public": true, "name": "@module-federation/webpack-bundler-runtime", - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "description": "Module Federation Runtime for webpack", "keywords": [