remote-components 0.0.25 → 0.0.26

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/config/index.ts","../../src/next/config/webpack/index.ts","../../src/next/config/webpack/plugins/remote-webpack-require-runtime-module.ts","../../src/next/config/webpack/plugins/remote-webpack-require.ts","../../src/next/config/webpack/plugins/module-id-embed.ts","../../src/next/config/webpack/plugins/module-id-embed-runtime-module.ts","../../src/next/config/webpack/plugins/conditional-exec.ts","../../src/next/config/webpack/plugins/patch-require.ts"],"sourcesContent":["import { basename, dirname, join, relative } from 'node:path';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport enhancedResolve from 'enhanced-resolve';\nimport { findUpSync } from 'find-up';\nimport type { NextConfig } from 'next';\nimport { configSchema } from 'next/dist/server/config-schema.js';\nimport TsConfigPathsWebpackPlugin from 'tsconfig-paths-webpack-plugin';\nimport { transform as webpackTransform } from './webpack';\n\ninterface ZodSchema {\n safeParse: (data: unknown) => { success: boolean };\n}\n\ninterface WithRemoteComponentsOptions {\n /**\n * An array of package names that should be shared between the host and remote components.\n * This is useful for ensuring that both the host and remote components use the same version\n * of shared libraries.\n *\n * Essential packages are included by default: `react`, `react-dom`, `next/navigation`, `next/link`, `next/form`, `next/image`, and `next/script`.\n */\n shared?: string[];\n}\n\n/**\n * This function configures Next.js to support Remote Components.\n * You need to also use the `withMicrofrontends` function to extend your Next.js configuration.\n *\n * @param nextConfig - The Next.js configuration object.\n * @param options - Optional configuration for remote components.\n * @returns The modified Next.js configuration object with remote components support.\n *\n * @example\n *\n * ```js\n * import { withMicrofrontends } from '@vercel/microfrontends/next/config';\n * import { withRemoteComponents } from 'remote-components/next/config';\n *\n * const nextConfig = {\n * // your Next.js configuration\n * };\n *\n * export default withRemoteComponents(\n * withMicrofrontends(nextConfig),\n * {\n * shared: ['some-package', 'another-package'],\n * },\n * );\n * ```\n */\nexport function withRemoteComponents(\n nextConfig: NextConfig,\n options?: WithRemoteComponentsOptions,\n) {\n const virtualRemoteComponentAppSharedRemote = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/app-remote.tsx',\n );\n const virtualRemoteComponentPagesSharedRemote = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/pages-remote.tsx',\n );\n const virtualRemoteComponentAppSharedHost = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/app-host.tsx',\n );\n const virtualRemoteComponentPagesSharedHost = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/pages-host.tsx',\n );\n\n const appShared = new Set([\n ...[\n 'react',\n 'react/jsx-dev-runtime',\n 'react/jsx-runtime',\n 'react-dom',\n 'react-dom/client',\n 'next/navigation',\n 'next/dist/client/components/navigation',\n 'next/link',\n 'next/dist/client/app-dir/link',\n 'next/form',\n 'next/dist/client/app-dir/form',\n 'next/image',\n 'next/dist/client/image-component',\n 'next/dist/api/image',\n 'next/script',\n 'next/dist/client/script',\n ],\n ...(options?.shared ?? []),\n ]);\n const pagesShared = new Set([\n ...[\n 'react',\n 'react/jsx-dev-runtime',\n 'react/jsx-runtime',\n 'react-dom',\n 'react-dom/client',\n 'next/router',\n 'next/link',\n 'next/image',\n 'next/script',\n 'next/form',\n ],\n ...(options?.shared ?? []),\n ]);\n\n const vendorShared: Record<string, string> = {\n react: `'/react/index.js'`,\n 'react/jsx-dev-runtime': `'/react/jsx-dev-runtime.js'`,\n 'react/jsx-runtime': `'/react/jsx-runtime.js'`,\n 'react-dom': `'/react-dom/index.js'`,\n };\n\n // resolve using enhanced-resolve\n // named import does not work with enhanced-resolve when using cjs\n // eslint-disable-next-line import/no-named-as-default-member\n const resolve = enhancedResolve.create.sync({\n conditionNames: ['browser', 'import', 'module', 'require'],\n ...(existsSync(join(process.cwd(), 'tsconfig.json'))\n ? {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n plugins: [\n new TsConfigPathsWebpackPlugin({\n configFile: join(process.cwd(), 'tsconfig.json'),\n }) as unknown as enhancedResolve.Plugin,\n ],\n }\n : {}),\n });\n\n const generateSharedRemote = (sharedRemote: Set<string>) =>\n `'use client';\\nmodule.exports = { shared: { ${Array.from(sharedRemote)\n .reduce<string[]>((acc, curr) => {\n let path;\n try {\n path = resolve(process.cwd(), curr);\n if (path) {\n path = relative(process.cwd(), path).replace(\n /^(?<relative>\\.\\.\\/)+/,\n '',\n );\n }\n } catch {\n // noop\n // if module resolution using enhanced-resolve fails, fallback to require.resolve called in the shared/remote file\n }\n acc.push(\n `[${vendorShared[curr] ?? (path ? `'${path}'` : `require.resolve('${curr}')`)}]: '${curr}',`,\n );\n acc.push(\n `['__remote_shared_module_${curr}']: () => import('${curr}'),`,\n );\n return acc;\n }, [])\n .join('\\n')} } };\\n`;\n const generateSharedHost = (sharedHost: Set<string>) =>\n `'use client';\\nmodule.exports = { shared: { ${Array.from(sharedHost)\n .reduce<string[]>((acc, curr) => {\n acc.push(`['${curr}']: () => import('${curr}'),`);\n return acc;\n }, [])\n .join('\\n')} } };\\n`;\n\n const appSharedRemote = generateSharedRemote(appShared);\n const pagesSharedRemote = generateSharedRemote(pagesShared);\n\n const appSharedHost = generateSharedHost(appShared);\n const pagesSharedHost = generateSharedHost(pagesShared);\n\n const emitSharedFiles = () => {\n mkdirSync(dirname(virtualRemoteComponentAppSharedRemote), {\n recursive: true,\n });\n\n writeFileSync(\n virtualRemoteComponentAppSharedRemote,\n appSharedRemote,\n 'utf-8',\n );\n writeFileSync(\n virtualRemoteComponentPagesSharedRemote,\n pagesSharedRemote,\n 'utf-8',\n );\n writeFileSync(virtualRemoteComponentAppSharedHost, appSharedHost, 'utf-8');\n writeFileSync(\n virtualRemoteComponentPagesSharedHost,\n pagesSharedHost,\n 'utf-8',\n );\n };\n\n nextConfig.transpilePackages = [\n ...(nextConfig.transpilePackages ?? []),\n 'remote-components/next',\n 'remote-components/next/remote',\n 'remote-components/next/host',\n 'remote-components/next/host/pages-router',\n 'remote-components/next/host/client',\n '@remote-components/shared/remote/app',\n '@remote-components/shared/remote/pages',\n '@remote-components/shared/host/app',\n '@remote-components/shared/host/pages',\n ];\n\n const alias = {\n '@remote-components/shared/remote/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedRemote,\n )}`,\n '@remote-components/shared/remote/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedRemote,\n )}`,\n '@remote-components/shared/host/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedHost,\n )}`,\n '@remote-components/shared/host/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedHost,\n )}`,\n };\n\n let projectId =\n process.env.REMOTE_COMPONENTS_PROJECT_ID ||\n process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION ||\n process.env.VERCEL_PROJECT_ID;\n\n if (!projectId) {\n try {\n const projectPath = findUpSync('.vercel/project.json', {\n cwd: process.cwd(),\n });\n if (projectPath) {\n projectId = (\n JSON.parse(readFileSync(projectPath, 'utf8')) as { projectId: string }\n ).projectId;\n }\n } catch {\n // fallback to env‑var above\n }\n }\n\n if (!projectId) {\n const packageJsonPath = findUpSync('package.json', {\n cwd: process.cwd(),\n });\n if (packageJsonPath) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n };\n projectId = packageJson.name || basename(process.cwd());\n } else {\n projectId = basename(process.cwd());\n }\n }\n\n process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;\n\n if (process.env.TURBOPACK) {\n if (\n !(configSchema as ZodSchema).safeParse({\n turbopack: {\n moduleIds: 'named',\n resolveAlias: {\n ...alias,\n },\n },\n compiler: {\n defineServer: {\n REMOTE_COMPONENTS_PROJECT_ID: projectId,\n },\n },\n }).success\n ) {\n // eslint-disable-next-line no-console\n console.error(\n 'You need to use a Next.js version which supports the `turbopack` and `compiler.defineServer` configuration for Turbopack support with Remote Components.',\n );\n process.exit(1);\n }\n nextConfig.turbopack = {\n ...nextConfig.turbopack,\n moduleIds: 'named',\n resolveAlias: {\n ...nextConfig.turbopack?.resolveAlias,\n ...alias,\n },\n };\n nextConfig.compiler = {\n ...nextConfig.compiler,\n defineServer: {\n ...nextConfig.compiler?.defineServer,\n 'process.env.REMOTE_COMPONENTS_PROJECT_ID': projectId,\n },\n };\n emitSharedFiles();\n return nextConfig;\n }\n\n // apply the webpack transform\n return webpackTransform(nextConfig, {\n app: { name: projectId },\n alias,\n emitSharedFiles,\n });\n}\n","import { join } from 'node:path';\nimport type { NextConfig } from 'next';\nimport type { WebpackOptionsNormalized } from 'webpack';\nimport { RemoteWebpackRequirePlugin } from './plugins/remote-webpack-require';\nimport { ModuleIdEmbedPlugin } from './plugins/module-id-embed';\nimport { ConditionalExecPlugin } from './plugins/conditional-exec';\nimport { PatchRequirePlugin } from './plugins/patch-require';\n\nexport function transform(\n nextConfig: NextConfig,\n {\n app,\n alias = {},\n emitSharedFiles = () => {\n // no-op by default\n },\n }: {\n app: { name: string };\n alias?: Record<string, string>;\n emitSharedFiles?: () => void;\n },\n) {\n const webpackConfig = nextConfig.webpack;\n\n nextConfig.webpack = (\n baseConfig: WebpackOptionsNormalized,\n webpackContext,\n ) => {\n // execute the client config first, otherwise their config may accidentally\n // overwrite our required config - leading to unexpected errors.\n const config = (\n typeof webpackConfig === 'function'\n ? (webpackConfig(baseConfig, webpackContext) ?? baseConfig)\n : baseConfig\n ) as WebpackOptionsNormalized;\n\n // remote component specific plugins\n config.plugins.push(\n new RemoteWebpackRequirePlugin(app.name),\n new ModuleIdEmbedPlugin(app.name),\n new ConditionalExecPlugin(app.name),\n new PatchRequirePlugin(app.name),\n );\n if (!webpackContext.isServer) {\n // change the chunk loading global to avoid conflicts with other remote components\n config.output.chunkLoadingGlobal = `__remote_chunk_loading_global_${app.name}__`;\n }\n\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve.alias,\n ...Object.fromEntries(\n Object.entries(alias).map(([key, value]) => [\n key,\n join(process.cwd(), value),\n ]),\n ),\n },\n };\n\n emitSharedFiles();\n return config;\n };\n\n return nextConfig;\n}\n","export function createRemoteWebpackRequireRuntimeModule(webpack: {\n RuntimeModule: new (name: string, stage?: number) => object;\n}) {\n return class RemoteWebpackRequireRuntimeModule extends webpack.RuntimeModule {\n appName: string;\n\n constructor(appName: string) {\n super('remote-webpack-require');\n this.appName = appName;\n }\n\n generate(): null | string {\n return `globalThis.__remote_webpack_require__ = globalThis.__remote_webpack_require__ || {}; globalThis.__remote_webpack_require__[\"${this.appName}\"] = __webpack_require__;`;\n }\n };\n}\n","import type { Compiler, RuntimeModule } from 'webpack';\nimport { createRemoteWebpackRequireRuntimeModule } from './remote-webpack-require-runtime-module';\n\nexport class RemoteWebpackRequirePlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const RemoteWebpackRequireRuntimeModule =\n createRemoteWebpackRequireRuntimeModule(compiler.webpack);\n\n compiler.hooks.thisCompilation.tap(\n 'RemoteWebpackRequirePlugin',\n (compilation) => {\n compilation.hooks.runtimeRequirementInTree\n .for('__webpack_require__')\n .tap('RemoteWebpackRequirePlugin', (chunk) => {\n compilation.addRuntimeModule(\n chunk,\n new RemoteWebpackRequireRuntimeModule(\n this.appName,\n ) as unknown as RuntimeModule,\n );\n });\n },\n );\n }\n}\n","import { relative } from 'node:path';\nimport type { NormalModule, Compiler, RuntimeModule } from 'webpack';\nimport { createModuleIdEmbedRuntimeModule } from './module-id-embed-runtime-module';\n\nconst cwd = process.cwd();\n\nexport class ModuleIdEmbedPlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const ModuleIdEmbedRuntimeModule = createModuleIdEmbedRuntimeModule(\n compiler.webpack,\n );\n\n compiler.hooks.thisCompilation.tap('ModuleIdEmbedPlugin', (compilation) => {\n const moduleMap = {} as Record<string, string | number>;\n\n compilation.hooks.runtimeRequirementInTree\n .for(compiler.webpack.RuntimeGlobals.require)\n .tap('ModuleIdEmbedPlugin', (chunk, set) => {\n for (const [key, entry] of compilation.entrypoints) {\n for (const entryChunk of entry.chunks) {\n if (key.includes('nextjs-pages-remote')) {\n for (const mod of compilation.chunkGraph.getChunkModulesIterable(\n entryChunk,\n )) {\n const id = compilation.chunkGraph.getModuleId(mod);\n const normalModule = mod as NormalModule;\n if (id && (normalModule.resource || normalModule.request)) {\n moduleMap[\n relative(\n cwd,\n normalModule.resource || normalModule.request,\n )\n ] = id;\n }\n }\n }\n }\n }\n for (const mod of compilation.modules) {\n const id = compilation.chunkGraph.getModuleId(mod);\n if (id && mod.layer?.endsWith('browser')) {\n const normalModule = mod as NormalModule;\n if (normalModule.resource || normalModule.request) {\n moduleMap[\n relative(cwd, normalModule.resource || normalModule.request)\n ] = id;\n }\n }\n }\n\n if (Object.keys(moduleMap).length > 0) {\n compilation.addRuntimeModule(\n chunk,\n new ModuleIdEmbedRuntimeModule(\n this.appName,\n moduleMap,\n ) as unknown as RuntimeModule,\n );\n\n set.add(compiler.webpack.RuntimeGlobals.require);\n }\n });\n });\n }\n}\n","export function createModuleIdEmbedRuntimeModule(webpack: {\n RuntimeModule: new (name: string, stage?: number) => object;\n}) {\n return class ModuleIdEmbedRuntimeModule extends webpack.RuntimeModule {\n appName: string;\n moduleMap: Record<string | number, unknown>;\n\n constructor(appName: string, moduleMap: Record<string | number, unknown>) {\n super('remote-webpack-module-id-embed');\n this.appName = appName;\n this.moduleMap = moduleMap;\n }\n\n generate(): null | string {\n return `globalThis.__remote_webpack_module_map__ = globalThis.__remote_webpack_module_map__ || {}; globalThis.__remote_webpack_module_map__[\"${this.appName}\"] = ${JSON.stringify(this.moduleMap)};`;\n }\n };\n}\n","import type { Compiler } from 'webpack';\n\nexport class ConditionalExecPlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const { Compilation, sources } = compiler.webpack;\n\n compiler.hooks.thisCompilation.tap(\n 'ConditionalExecPlugin',\n (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: 'ConditionalExecPlugin',\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n (assets) => {\n for (const [name, source] of Object.entries(assets)) {\n if (name.endsWith('.js')) {\n const patchedSource = source\n .source()\n .toString()\n .replace(\n `var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))`,\n `var __webpack_exec__ = (moduleId) => { if (globalThis.__DISABLE_WEBPACK_EXEC__ && globalThis.__DISABLE_WEBPACK_EXEC__[\"${this.appName}\"]) return; return __webpack_require__(__webpack_require__.s = moduleId); }`,\n );\n compilation.updateAsset(\n name,\n new sources.RawSource(patchedSource),\n );\n }\n }\n },\n );\n },\n );\n }\n}\n","import type { Compiler } from 'webpack';\n\n// This plugin patches the webpack require function to support loading remote components in Next.js\nexport class PatchRequirePlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const { sources } = compiler.webpack;\n\n compiler.hooks.thisCompilation.tap('PatchRequirePlugin', (compilation) => {\n compilation.mainTemplate.hooks.requireExtensions.tap(\n 'PatchRequirePlugin',\n (source) => {\n return new sources.ConcatSource(\n source,\n `const __webpack_require_orig__ = __webpack_require__;\nconst REMOTE_RE = /\\\\[(?<bundle>[^\\\\]]+)\\\\] (?<id>.*)/;\n__webpack_require__ = function __remote_webpack_require__(remoteId) {\n const match = REMOTE_RE.exec(remoteId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_orig__(remoteId);\n }\n if (typeof self.__remote_webpack_require__?.[bundle] !== 'function') {\n throw new Error(\\`Remote component loading error: \"\\${bundle}\"\\`);\n }\n return self.__remote_webpack_require__[bundle](self.__remote_webpack_require__[bundle].type === 'turbopack' ? remoteId : id);\n};\nObject.assign(__webpack_require__, __webpack_require_orig__);\nconst __webpack_require_l__ = __webpack_require__.l;\n__webpack_require__.l = function __remote_webpack_require_l__(url, done, key, chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_l__(new URL(url, globalThis.__remote_bundle_url__?.[\"${this.appName}\"] ?? location.origin).href, done, key, chunkId);\n }\n return done();\n};\nconst __webpack_require_o__ = __webpack_require__.o;\n__webpack_require__.o = function __remote_webpack_require_o__(installedChunks, chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_o__(installedChunks, chunkId);\n }\n return installedChunks[chunkId] = 0;\n};\nconst __webpack_require_e__ = __webpack_require__.e;\n__webpack_require__.e = function __remote_webpack_require_e__(chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_e__(chunkId);\n }\n return Promise.resolve([]);\n};`,\n )\n .source()\n .toString();\n },\n );\n });\n }\n}\n"],"mappings":";AAAA,SAAS,UAAU,SAAS,QAAAA,OAAM,YAAAC,iBAAgB;AAClD,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,OAAO,qBAAqB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,OAAO,gCAAgC;;;ACNvC,SAAS,YAAY;;;ACAd,SAAS,wCAAwC,SAErD;AACD,SAAO,MAAM,0CAA0C,QAAQ,cAAc;AAAA,IAG3E,YAAY,SAAiB;AAC3B,YAAM,wBAAwB;AAC9B,WAAK,UAAU;AAAA,IACjB;AAAA,IAEA,WAA0B;AACxB,aAAO,+HAA+H,KAAK;AAAA,IAC7I;AAAA,EACF;AACF;;;ACZO,IAAM,6BAAN,MAAiC;AAAA,EAGtC,YAAY,SAAiB;AAC3B,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,MAAM,UAAoB;AACxB,UAAM,oCACJ,w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K,MAAM,aAAa,aAAa,MAAM,CAAC,EAC5C;AAAA,MACJ;AAAA,IACF,QAAE;AAAA,IAEF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,kBAAkB,WAAW,gBAAgB;AAAA,MACjD,KAAK,QAAQ,IAAI;AAAA,IACnB,CAAC;AACD,QAAI,iBAAiB;AACnB,YAAM,cAAc,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;AAGpE,kBAAY,YAAY,QAAQ,SAAS,QAAQ,IAAI,CAAC;AAAA,IACxD,OAAO;AACL,kBAAY,SAAS,QAAQ,IAAI,CAAC;AAAA,IACpC;AAAA,EACF;AAEA,UAAQ,IAAI,+BAA+B;AAE3C,MAAI,QAAQ,IAAI,WAAW;AACzB,QACE,CAAE,aAA2B,UAAU;AAAA,MACrC,WAAW;AAAA,QACT,WAAW;AAAA,QACX,cAAc;AAAA,UACZ,GAAG;AAAA,QACL;AAAA,MACF;AAAA,MACA,UAAU;AAAA,QACR,cAAc;AAAA,UACZ,8BAA8B;AAAA,QAChC;AAAA,MACF;AAAA,IACF,CAAC,EAAE,SACH;AAEA,cAAQ;AAAA,QACN;AAAA,MACF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,eAAW,YAAY;AAAA,MACrB,GAAG,WAAW;AAAA,MACd,WAAW;AAAA,MACX,cAAc;AAAA,QACZ,GAAG,WAAW,WAAW;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AACA,eAAW,WAAW;AAAA,MACpB,GAAG,WAAW;AAAA,MACd,cAAc;AAAA,QACZ,GAAG,WAAW,UAAU;AAAA,QACxB,4CAA4C;AAAA,MAC9C;AAAA,IACF;AACA,oBAAgB;AAChB,WAAO;AAAA,EACT;AAGA,SAAO,UAAiB,YAAY;AAAA,IAClC,KAAK,EAAE,MAAM,UAAU;AAAA,IACvB;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":["join","relative","join","relative"]}
1
+ {"version":3,"sources":["../../src/next/config/index.ts","../../src/next/config/webpack/index.ts","../../src/next/config/webpack/plugins/remote-webpack-require-runtime-module.ts","../../src/next/config/webpack/plugins/remote-webpack-require.ts","../../src/next/config/webpack/plugins/module-id-embed.ts","../../src/next/config/webpack/plugins/module-id-embed-runtime-module.ts","../../src/next/config/webpack/plugins/conditional-exec.ts","../../src/next/config/webpack/plugins/patch-require.ts"],"sourcesContent":["import { basename, dirname, join, relative } from 'node:path';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport enhancedResolve from 'enhanced-resolve';\nimport { findUpSync } from 'find-up';\nimport type { NextConfig } from 'next';\nimport { configSchema } from 'next/dist/server/config-schema.js';\nimport TsConfigPathsWebpackPlugin from 'tsconfig-paths-webpack-plugin';\nimport { transform as webpackTransform } from './webpack';\n\ninterface ZodSchema {\n safeParse: (data: unknown) => { success: boolean };\n}\n\ninterface WithRemoteComponentsOptions {\n /**\n * An array of package names that should be shared between the host and remote components.\n * This is useful for ensuring that both the host and remote components use the same version\n * of shared libraries.\n *\n * Essential packages are included by default: `react`, `react-dom`, `next/navigation`, `next/link`, `next/form`, `next/image`, and `next/script`.\n */\n shared?: string[];\n}\n\n/**\n * This function configures Next.js to support Remote Components.\n * You need to also use the `withMicrofrontends` function to extend your Next.js configuration.\n *\n * @param nextConfig - The Next.js configuration object.\n * @param options - Optional configuration for remote components.\n * @returns The modified Next.js configuration object with remote components support.\n *\n * @example\n *\n * ```js\n * import { withMicrofrontends } from '@vercel/microfrontends/next/config';\n * import { withRemoteComponents } from 'remote-components/next/config';\n *\n * const nextConfig = {\n * // your Next.js configuration\n * };\n *\n * export default withRemoteComponents(\n * withMicrofrontends(nextConfig),\n * {\n * shared: ['some-package', 'another-package'],\n * },\n * );\n * ```\n */\nexport function withRemoteComponents(\n nextConfig: NextConfig,\n options?: WithRemoteComponentsOptions,\n) {\n const virtualRemoteComponentAppSharedRemote = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/app-remote.tsx',\n );\n const virtualRemoteComponentPagesSharedRemote = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/pages-remote.tsx',\n );\n const virtualRemoteComponentAppSharedHost = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/app-host.tsx',\n );\n const virtualRemoteComponentPagesSharedHost = join(\n process.cwd(),\n nextConfig.distDir ?? '.next',\n 'remote-components/shared/pages-host.tsx',\n );\n\n const appShared = new Set([\n ...[\n 'react',\n 'react/jsx-dev-runtime',\n 'react/jsx-runtime',\n 'react-dom',\n 'react-dom/client',\n 'next/navigation',\n 'next/dist/client/components/navigation',\n 'next/link',\n 'next/dist/client/app-dir/link',\n 'next/form',\n 'next/dist/client/app-dir/form',\n 'next/image',\n 'next/dist/client/image-component',\n 'next/dist/api/image',\n 'next/script',\n 'next/dist/client/script',\n 'next/dist/build/polyfills/process',\n ],\n ...(options?.shared ?? []),\n ]);\n const pagesShared = new Set([\n ...[\n 'react',\n 'react/jsx-dev-runtime',\n 'react/jsx-runtime',\n 'react-dom',\n 'react-dom/client',\n 'next/router',\n 'next/link',\n 'next/image',\n 'next/script',\n 'next/form',\n ],\n ...(options?.shared ?? []),\n ]);\n\n const vendorShared: Record<string, string> = {\n react: `'/react/index.js'`,\n 'react/jsx-dev-runtime': `'/react/jsx-dev-runtime.js'`,\n 'react/jsx-runtime': `'/react/jsx-runtime.js'`,\n 'react-dom': `'/react-dom/index.js'`,\n };\n\n // resolve using enhanced-resolve\n // named import does not work with enhanced-resolve when using cjs\n // eslint-disable-next-line import/no-named-as-default-member\n const resolve = enhancedResolve.create.sync({\n conditionNames: ['browser', 'import', 'module', 'require'],\n ...(existsSync(join(process.cwd(), 'tsconfig.json'))\n ? {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n plugins: [\n new TsConfigPathsWebpackPlugin({\n configFile: join(process.cwd(), 'tsconfig.json'),\n }) as unknown as enhancedResolve.Plugin,\n ],\n }\n : {}),\n });\n\n const generateSharedRemote = (sharedRemote: Set<string>) =>\n `'use client';\\nmodule.exports = { shared: { ${Array.from(sharedRemote)\n .reduce<string[]>((acc, curr) => {\n let path;\n try {\n path = resolve(process.cwd(), curr);\n if (path) {\n path = relative(process.cwd(), path).replace(\n /^(?<relative>\\.\\.\\/)+/,\n '',\n );\n }\n } catch {\n // noop\n // if module resolution using enhanced-resolve fails, fallback to require.resolve called in the shared/remote file\n }\n acc.push(\n `[${vendorShared[curr] ?? (path ? `'${path}'` : `require.resolve('${curr}')`)}]: '${curr}',`,\n );\n acc.push(\n `['__remote_shared_module_${curr}']: () => import('${curr}'),`,\n );\n return acc;\n }, [])\n .join('\\n')} } };\\n`;\n const generateSharedHost = (sharedHost: Set<string>) =>\n `'use client';\\nmodule.exports = { shared: { ${Array.from(sharedHost)\n .reduce<string[]>((acc, curr) => {\n acc.push(`['${curr}']: () => import('${curr}'),`);\n return acc;\n }, [])\n .join('\\n')} } };\\n`;\n\n const appSharedRemote = generateSharedRemote(appShared);\n const pagesSharedRemote = generateSharedRemote(pagesShared);\n\n const appSharedHost = generateSharedHost(appShared);\n const pagesSharedHost = generateSharedHost(pagesShared);\n\n const emitSharedFiles = () => {\n mkdirSync(dirname(virtualRemoteComponentAppSharedRemote), {\n recursive: true,\n });\n\n writeFileSync(\n virtualRemoteComponentAppSharedRemote,\n appSharedRemote,\n 'utf-8',\n );\n writeFileSync(\n virtualRemoteComponentPagesSharedRemote,\n pagesSharedRemote,\n 'utf-8',\n );\n writeFileSync(virtualRemoteComponentAppSharedHost, appSharedHost, 'utf-8');\n writeFileSync(\n virtualRemoteComponentPagesSharedHost,\n pagesSharedHost,\n 'utf-8',\n );\n };\n\n nextConfig.transpilePackages = [\n ...(nextConfig.transpilePackages ?? []),\n 'remote-components/next',\n 'remote-components/next/remote',\n 'remote-components/next/host',\n 'remote-components/next/host/pages-router',\n 'remote-components/next/host/client',\n '@remote-components/shared/remote/app',\n '@remote-components/shared/remote/pages',\n '@remote-components/shared/host/app',\n '@remote-components/shared/host/pages',\n ];\n\n const alias = {\n '@remote-components/shared/remote/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedRemote,\n )}`,\n '@remote-components/shared/remote/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedRemote,\n )}`,\n '@remote-components/shared/host/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedHost,\n )}`,\n '@remote-components/shared/host/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedHost,\n )}`,\n };\n\n let projectId =\n process.env.REMOTE_COMPONENTS_PROJECT_ID ||\n process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION ||\n process.env.VERCEL_PROJECT_ID;\n\n if (!projectId) {\n try {\n const projectPath = findUpSync('.vercel/project.json', {\n cwd: process.cwd(),\n });\n if (projectPath) {\n projectId = (\n JSON.parse(readFileSync(projectPath, 'utf8')) as { projectId: string }\n ).projectId;\n }\n } catch {\n // fallback to env‑var above\n }\n }\n\n if (!projectId) {\n const packageJsonPath = findUpSync('package.json', {\n cwd: process.cwd(),\n });\n if (packageJsonPath) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n };\n projectId = packageJson.name || basename(process.cwd());\n } else {\n projectId = basename(process.cwd());\n }\n }\n\n process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;\n\n if (process.env.TURBOPACK) {\n if (\n !(configSchema as ZodSchema).safeParse({\n turbopack: {\n moduleIds: 'named',\n resolveAlias: {\n ...alias,\n },\n },\n compiler: {\n defineServer: {\n REMOTE_COMPONENTS_PROJECT_ID: projectId,\n },\n },\n }).success\n ) {\n // eslint-disable-next-line no-console\n console.error(\n 'You need to use a Next.js version which supports the `turbopack` and `compiler.defineServer` configuration for Turbopack support with Remote Components.',\n );\n process.exit(1);\n }\n nextConfig.turbopack = {\n ...nextConfig.turbopack,\n moduleIds: 'named',\n resolveAlias: {\n ...nextConfig.turbopack?.resolveAlias,\n ...alias,\n },\n };\n nextConfig.compiler = {\n ...nextConfig.compiler,\n defineServer: {\n ...nextConfig.compiler?.defineServer,\n 'process.env.REMOTE_COMPONENTS_PROJECT_ID': projectId,\n },\n };\n emitSharedFiles();\n return nextConfig;\n }\n\n // apply the webpack transform\n return webpackTransform(nextConfig, {\n app: { name: projectId },\n alias,\n emitSharedFiles,\n });\n}\n","import { join } from 'node:path';\nimport type { NextConfig } from 'next';\nimport type { WebpackOptionsNormalized } from 'webpack';\nimport { RemoteWebpackRequirePlugin } from './plugins/remote-webpack-require';\nimport { ModuleIdEmbedPlugin } from './plugins/module-id-embed';\nimport { ConditionalExecPlugin } from './plugins/conditional-exec';\nimport { PatchRequirePlugin } from './plugins/patch-require';\n\nexport function transform(\n nextConfig: NextConfig,\n {\n app,\n alias = {},\n emitSharedFiles = () => {\n // no-op by default\n },\n }: {\n app: { name: string };\n alias?: Record<string, string>;\n emitSharedFiles?: () => void;\n },\n) {\n const webpackConfig = nextConfig.webpack;\n\n nextConfig.webpack = (\n baseConfig: WebpackOptionsNormalized,\n webpackContext,\n ) => {\n // execute the client config first, otherwise their config may accidentally\n // overwrite our required config - leading to unexpected errors.\n const config = (\n typeof webpackConfig === 'function'\n ? (webpackConfig(baseConfig, webpackContext) ?? baseConfig)\n : baseConfig\n ) as WebpackOptionsNormalized;\n\n // remote component specific plugins\n config.plugins.push(\n new RemoteWebpackRequirePlugin(app.name),\n new ModuleIdEmbedPlugin(app.name),\n new ConditionalExecPlugin(app.name),\n new PatchRequirePlugin(app.name),\n );\n if (!webpackContext.isServer) {\n // change the chunk loading global to avoid conflicts with other remote components\n config.output.chunkLoadingGlobal = `__remote_chunk_loading_global_${app.name}__`;\n }\n\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve.alias,\n ...Object.fromEntries(\n Object.entries(alias).map(([key, value]) => [\n key,\n join(process.cwd(), value),\n ]),\n ),\n },\n };\n\n emitSharedFiles();\n return config;\n };\n\n return nextConfig;\n}\n","export function createRemoteWebpackRequireRuntimeModule(webpack: {\n RuntimeModule: new (name: string, stage?: number) => object;\n}) {\n return class RemoteWebpackRequireRuntimeModule extends webpack.RuntimeModule {\n appName: string;\n\n constructor(appName: string) {\n super('remote-webpack-require');\n this.appName = appName;\n }\n\n generate(): null | string {\n return `globalThis.__remote_webpack_require__ = globalThis.__remote_webpack_require__ || {}; globalThis.__remote_webpack_require__[\"${this.appName}\"] = __webpack_require__;`;\n }\n };\n}\n","import type { Compiler, RuntimeModule } from 'webpack';\nimport { createRemoteWebpackRequireRuntimeModule } from './remote-webpack-require-runtime-module';\n\nexport class RemoteWebpackRequirePlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const RemoteWebpackRequireRuntimeModule =\n createRemoteWebpackRequireRuntimeModule(compiler.webpack);\n\n compiler.hooks.thisCompilation.tap(\n 'RemoteWebpackRequirePlugin',\n (compilation) => {\n compilation.hooks.runtimeRequirementInTree\n .for('__webpack_require__')\n .tap('RemoteWebpackRequirePlugin', (chunk) => {\n compilation.addRuntimeModule(\n chunk,\n new RemoteWebpackRequireRuntimeModule(\n this.appName,\n ) as unknown as RuntimeModule,\n );\n });\n },\n );\n }\n}\n","import { relative } from 'node:path';\nimport type { NormalModule, Compiler, RuntimeModule } from 'webpack';\nimport { createModuleIdEmbedRuntimeModule } from './module-id-embed-runtime-module';\n\nconst cwd = process.cwd();\n\nexport class ModuleIdEmbedPlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const ModuleIdEmbedRuntimeModule = createModuleIdEmbedRuntimeModule(\n compiler.webpack,\n );\n\n compiler.hooks.thisCompilation.tap('ModuleIdEmbedPlugin', (compilation) => {\n const moduleMap = {} as Record<string, string | number>;\n\n compilation.hooks.runtimeRequirementInTree\n .for(compiler.webpack.RuntimeGlobals.require)\n .tap('ModuleIdEmbedPlugin', (chunk, set) => {\n for (const [key, entry] of compilation.entrypoints) {\n for (const entryChunk of entry.chunks) {\n if (key.includes('nextjs-pages-remote')) {\n for (const mod of compilation.chunkGraph.getChunkModulesIterable(\n entryChunk,\n )) {\n const id = compilation.chunkGraph.getModuleId(mod);\n const normalModule = mod as NormalModule;\n if (id && (normalModule.resource || normalModule.request)) {\n moduleMap[\n relative(\n cwd,\n normalModule.resource || normalModule.request,\n )\n ] = id;\n }\n }\n }\n }\n }\n for (const mod of compilation.modules) {\n const id = compilation.chunkGraph.getModuleId(mod);\n if (id && mod.layer?.endsWith('browser')) {\n const normalModule = mod as NormalModule;\n if (normalModule.resource || normalModule.request) {\n moduleMap[\n relative(cwd, normalModule.resource || normalModule.request)\n ] = id;\n }\n }\n }\n\n if (Object.keys(moduleMap).length > 0) {\n compilation.addRuntimeModule(\n chunk,\n new ModuleIdEmbedRuntimeModule(\n this.appName,\n moduleMap,\n ) as unknown as RuntimeModule,\n );\n\n set.add(compiler.webpack.RuntimeGlobals.require);\n }\n });\n });\n }\n}\n","export function createModuleIdEmbedRuntimeModule(webpack: {\n RuntimeModule: new (name: string, stage?: number) => object;\n}) {\n return class ModuleIdEmbedRuntimeModule extends webpack.RuntimeModule {\n appName: string;\n moduleMap: Record<string | number, unknown>;\n\n constructor(appName: string, moduleMap: Record<string | number, unknown>) {\n super('remote-webpack-module-id-embed');\n this.appName = appName;\n this.moduleMap = moduleMap;\n }\n\n generate(): null | string {\n return `globalThis.__remote_webpack_module_map__ = globalThis.__remote_webpack_module_map__ || {}; globalThis.__remote_webpack_module_map__[\"${this.appName}\"] = ${JSON.stringify(this.moduleMap)};`;\n }\n };\n}\n","import type { Compiler } from 'webpack';\n\nexport class ConditionalExecPlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const { Compilation, sources } = compiler.webpack;\n\n compiler.hooks.thisCompilation.tap(\n 'ConditionalExecPlugin',\n (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: 'ConditionalExecPlugin',\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n (assets) => {\n for (const [name, source] of Object.entries(assets)) {\n if (name.endsWith('.js')) {\n const patchedSource = source\n .source()\n .toString()\n .replace(\n `var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))`,\n `var __webpack_exec__ = (moduleId) => { if (globalThis.__DISABLE_WEBPACK_EXEC__ && globalThis.__DISABLE_WEBPACK_EXEC__[\"${this.appName}\"]) return; return __webpack_require__(__webpack_require__.s = moduleId); }`,\n );\n compilation.updateAsset(\n name,\n new sources.RawSource(patchedSource),\n );\n }\n }\n },\n );\n },\n );\n }\n}\n","import type { Compiler } from 'webpack';\n\n// This plugin patches the webpack require function to support loading remote components in Next.js\nexport class PatchRequirePlugin {\n appName: string;\n\n constructor(appName: string) {\n this.appName = appName;\n }\n\n apply(compiler: Compiler) {\n const { sources } = compiler.webpack;\n\n compiler.hooks.thisCompilation.tap('PatchRequirePlugin', (compilation) => {\n compilation.mainTemplate.hooks.requireExtensions.tap(\n 'PatchRequirePlugin',\n (source) => {\n return new sources.ConcatSource(\n source,\n `const __webpack_require_orig__ = __webpack_require__;\nconst REMOTE_RE = /\\\\[(?<bundle>[^\\\\]]+)\\\\] (?<id>.*)/;\n__webpack_require__ = function __remote_webpack_require__(remoteId) {\n const match = REMOTE_RE.exec(remoteId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_orig__(remoteId);\n }\n if (typeof self.__remote_webpack_require__?.[bundle] !== 'function') {\n throw new Error(\\`Remote component loading error: \"\\${bundle}\"\\`);\n }\n return self.__remote_webpack_require__[bundle](self.__remote_webpack_require__[bundle].type === 'turbopack' ? remoteId : id);\n};\nObject.assign(__webpack_require__, __webpack_require_orig__);\nconst __webpack_require_l__ = __webpack_require__.l;\n__webpack_require__.l = function __remote_webpack_require_l__(url, done, key, chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_l__(new URL(url, globalThis.__remote_bundle_url__?.[\"${this.appName}\"] ?? location.origin).href, done, key, chunkId);\n }\n return done();\n};\nconst __webpack_require_o__ = __webpack_require__.o;\n__webpack_require__.o = function __remote_webpack_require_o__(installedChunks, chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_o__(installedChunks, chunkId);\n }\n return installedChunks[chunkId] = 0;\n};\nconst __webpack_require_e__ = __webpack_require__.e;\n__webpack_require__.e = function __remote_webpack_require_e__(chunkId) {\n const match = REMOTE_RE.exec(chunkId);\n const bundle = match?.groups?.bundle;\n const id = match?.groups?.id;\n if (!(id && bundle)) {\n return __webpack_require_e__(chunkId);\n }\n return Promise.resolve([]);\n};`,\n )\n .source()\n .toString();\n },\n );\n });\n }\n}\n"],"mappings":";AAAA,SAAS,UAAU,SAAS,QAAAA,OAAM,YAAAC,iBAAgB;AAClD,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,OAAO,qBAAqB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,OAAO,gCAAgC;;;ACNvC,SAAS,YAAY;;;ACAd,SAAS,wCAAwC,SAErD;AACD,SAAO,MAAM,0CAA0C,QAAQ,cAAc;AAAA,IAG3E,YAAY,SAAiB;AAC3B,YAAM,wBAAwB;AAC9B,WAAK,UAAU;AAAA,IACjB;AAAA,IAEA,WAA0B;AACxB,aAAO,+HAA+H,KAAK;AAAA,IAC7I;AAAA,EACF;AACF;;;ACZO,IAAM,6BAAN,MAAiC;AAAA,EAGtC,YAAY,SAAiB;AAC3B,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,MAAM,UAAoB;AACxB,UAAM,oCACJ,wCAAwC,SAAS,OAAO;AAE1D,aAAS,MAAM,gBAAgB;AAAA,MAC7B;AAAA,MACA,CAAC,gBAAgB;AACf,oBAAY,MAAM,yBACf,IAAI,qBAAqB,EACz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ACd,UAAM,kBAAkB,WAAW,gBAAgB;AAAA,MACjD,KAAK,QAAQ,IAAI;AAAA,IACnB,CAAC;AACD,QAAI,iBAAiB;AACnB,YAAM,cAAc,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;AAGpE,kBAAY,YAAY,QAAQ,SAAS,QAAQ,IAAI,CAAC;AAAA,IACxD,OAAO;AACL,kBAAY,SAAS,QAAQ,IAAI,CAAC;AAAA,IACpC;AAAA,EACF;AAEA,UAAQ,IAAI,+BAA+B;AAE3C,MAAI,QAAQ,IAAI,WAAW;AACzB,QACE,CAAE,aAA2B,UAAU;AAAA,MACrC,WAAW;AAAA,QACT,WAAW;AAAA,QACX,cAAc;AAAA,UACZ,GAAG;AAAA,QACL;AAAA,MACF;AAAA,MACA,UAAU;AAAA,QACR,cAAc;AAAA,UACZ,8BAA8B;AAAA,QAChC;AAAA,MACF;AAAA,IACF,CAAC,EAAE,SACH;AAEA,cAAQ;AAAA,QACN;AAAA,MACF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,eAAW,YAAY;AAAA,MACrB,GAAG,WAAW;AAAA,MACd,WAAW;AAAA,MACX,cAAc;AAAA,QACZ,GAAG,WAAW,WAAW;AAAA,QACzB,GAAG;AAAA,MACL;AAAA,IACF;AACA,eAAW,WAAW;AAAA,MACpB,GAAG,WAAW;AAAA,MACd,cAAc;AAAA,QACZ,GAAG,WAAW,UAAU;AAAA,QACxB,4CAA4C;AAAA,MAC9C;AAAA,IACF;AACA,oBAAgB;AAChB,WAAO;AAAA,EACT;AAGA,SAAO,UAAiB,YAAY;AAAA,IAClC,KAAK,EAAE,MAAM,UAAU;AAAA,IACvB;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":["join","relative","join","relative"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-components",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "private": false,
5
5
  "description": "Compose remote components at runtime between microfrontends applications.",
6
6
  "keywords": [