remote-components 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2VQGCACH.js → chunk-52BJ7VFA.js} +30 -18
- package/dist/chunk-52BJ7VFA.js.map +1 -0
- package/dist/{chunk-KKBEMQU7.cjs → chunk-AWWWK2ZY.cjs} +28 -28
- package/dist/{chunk-KEPHL25S.js → chunk-D5GNZB6O.js} +2 -1
- package/dist/chunk-D5GNZB6O.js.map +1 -0
- package/dist/{chunk-W5ESPGHH.js → chunk-GBFUPMMI.js} +5 -5
- package/dist/{chunk-ER73O65F.cjs → chunk-I47KE3EC.cjs} +23 -23
- package/dist/{chunk-6IUP26UK.cjs → chunk-LCXO7BUY.cjs} +3 -3
- package/dist/{chunk-OO4AMJWO.js → chunk-LQ7VQ74E.js} +2 -2
- package/dist/{chunk-42N2ZLE2.js → chunk-NZAB7REE.js} +6 -6
- package/dist/{chunk-KYJWRZ2B.js → chunk-QKB74MLO.js} +3 -3
- package/dist/{chunk-F44NODUS.cjs → chunk-RJW3EZJP.cjs} +26 -26
- package/dist/{chunk-HNZVEIKN.js → chunk-SJM7AAGU.js} +2 -2
- package/dist/{chunk-ZPMTZ3KJ.js → chunk-SZFCBE54.js} +2 -2
- package/dist/{chunk-XCFYWSLD.cjs → chunk-T64P7BAG.cjs} +31 -19
- package/dist/chunk-T64P7BAG.cjs.map +1 -0
- package/dist/{chunk-CREXMFMF.cjs → chunk-TZT7DLO5.cjs} +4 -4
- package/dist/{chunk-R4QFK5TN.cjs → chunk-X6W464D6.cjs} +4 -4
- package/dist/{chunk-7MVFHOIP.cjs → chunk-Z2SLBFQL.cjs} +2 -1
- package/dist/chunk-Z2SLBFQL.cjs.map +1 -0
- package/dist/config/nextjs.cjs +5 -11
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +2 -8
- package/dist/config/nextjs.js.map +1 -1
- package/dist/host/html.cjs +27 -27
- package/dist/host/html.js +10 -10
- package/dist/host/nextjs/app/client-only.cjs +13 -13
- package/dist/host/nextjs/app/client-only.js +8 -8
- package/dist/host/react.cjs +9 -9
- package/dist/host/react.js +8 -8
- package/dist/internal/config/webpack/next-client-pages-loader.cjs +27 -15
- package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -1
- package/dist/internal/config/webpack/next-client-pages-loader.d.ts +3 -5
- package/dist/internal/config/webpack/next-client-pages-loader.js +27 -15
- package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -1
- package/dist/internal/host/nextjs/app-client.d.ts +1 -1
- package/dist/internal/host/react/context.d.ts +2 -2
- package/dist/internal/host/shared/pipeline.d.ts +2 -2
- package/dist/internal/runtime/loaders/component-loader.d.ts +2 -2
- package/dist/internal/runtime/loaders/static-loader.d.ts +2 -1
- package/dist/internal/runtime/namespace.cjs +1 -0
- package/dist/internal/runtime/namespace.cjs.map +1 -1
- package/dist/internal/runtime/namespace.d.ts +2 -1
- package/dist/internal/runtime/namespace.js +1 -0
- package/dist/internal/runtime/namespace.js.map +1 -1
- package/dist/internal/runtime/types.d.ts +2 -1
- package/dist/remote/html.cjs +1 -1
- package/dist/remote/html.js +1 -1
- package/dist/{script-6W5JRBZK.cjs → script-D5AD7HLV.cjs} +4 -4
- package/dist/{script-IFEBOLIA.js → script-VPOI7ARP.js} +3 -3
- package/dist/{server-handoff-ce13bebc.d.ts → server-handoff-8c89b856.d.ts} +2 -2
- package/dist/{static-loader-X4TSF5KW.js → static-loader-OHSAUD62.js} +3 -3
- package/dist/static-loader-UDIXK5MV.cjs +11 -0
- package/dist/{turbopack-NPGO3MWS.js → turbopack-5LW6V6IT.js} +5 -5
- package/dist/{turbopack-WRMKPNN4.cjs → turbopack-KRKECGY2.cjs} +12 -12
- package/dist/{types-59251814.d.ts → types-8b0edd78.d.ts} +7 -0
- package/dist/{webpack-DUBHPYD6.js → webpack-NPZNXRNL.js} +5 -5
- package/dist/{webpack-KSCMCL7M.cjs → webpack-TTZDARNY.cjs} +12 -12
- package/package.json +1 -1
- package/dist/chunk-2VQGCACH.js.map +0 -1
- package/dist/chunk-7MVFHOIP.cjs.map +0 -1
- package/dist/chunk-KEPHL25S.js.map +0 -1
- package/dist/chunk-XCFYWSLD.cjs.map +0 -1
- package/dist/static-loader-ZYD5BO4D.cjs +0 -11
- /package/dist/{chunk-KKBEMQU7.cjs.map → chunk-AWWWK2ZY.cjs.map} +0 -0
- /package/dist/{chunk-W5ESPGHH.js.map → chunk-GBFUPMMI.js.map} +0 -0
- /package/dist/{chunk-ER73O65F.cjs.map → chunk-I47KE3EC.cjs.map} +0 -0
- /package/dist/{chunk-6IUP26UK.cjs.map → chunk-LCXO7BUY.cjs.map} +0 -0
- /package/dist/{chunk-OO4AMJWO.js.map → chunk-LQ7VQ74E.js.map} +0 -0
- /package/dist/{chunk-42N2ZLE2.js.map → chunk-NZAB7REE.js.map} +0 -0
- /package/dist/{chunk-KYJWRZ2B.js.map → chunk-QKB74MLO.js.map} +0 -0
- /package/dist/{chunk-F44NODUS.cjs.map → chunk-RJW3EZJP.cjs.map} +0 -0
- /package/dist/{chunk-HNZVEIKN.js.map → chunk-SJM7AAGU.js.map} +0 -0
- /package/dist/{chunk-ZPMTZ3KJ.js.map → chunk-SZFCBE54.js.map} +0 -0
- /package/dist/{chunk-CREXMFMF.cjs.map → chunk-TZT7DLO5.cjs.map} +0 -0
- /package/dist/{chunk-R4QFK5TN.cjs.map → chunk-X6W464D6.cjs.map} +0 -0
- /package/dist/{script-6W5JRBZK.cjs.map → script-D5AD7HLV.cjs.map} +0 -0
- /package/dist/{script-IFEBOLIA.js.map → script-VPOI7ARP.js.map} +0 -0
- /package/dist/{static-loader-X4TSF5KW.js.map → static-loader-OHSAUD62.js.map} +0 -0
- /package/dist/{static-loader-ZYD5BO4D.cjs.map → static-loader-UDIXK5MV.cjs.map} +0 -0
- /package/dist/{turbopack-NPGO3MWS.js.map → turbopack-5LW6V6IT.js.map} +0 -0
- /package/dist/{turbopack-WRMKPNN4.cjs.map → turbopack-KRKECGY2.cjs.map} +0 -0
- /package/dist/{webpack-DUBHPYD6.js.map → webpack-NPZNXRNL.js.map} +0 -0
- /package/dist/{webpack-KSCMCL7M.cjs.map → webpack-TTZDARNY.cjs.map} +0 -0
package/dist/config/nextjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CORE_REACT_SHARED_KEYS,
|
|
3
3
|
VENDOR_SHARED
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-SJM7AAGU.js";
|
|
5
|
+
import "../chunk-D5GNZB6O.js";
|
|
6
6
|
import {
|
|
7
|
-
RemoteComponentsError,
|
|
8
7
|
logDebug,
|
|
9
8
|
logError,
|
|
10
9
|
logWarn
|
|
@@ -261,11 +260,6 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
|
|
|
261
260
|
const projectId = resolveProjectId(packageJson.name);
|
|
262
261
|
process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;
|
|
263
262
|
if (hasPagesDirectory()) {
|
|
264
|
-
if (process.env.TURBOPACK) {
|
|
265
|
-
throw new RemoteComponentsError(
|
|
266
|
-
"Remote Components does not support Next.js Pages Router with Turbopack. Use webpack instead (`next dev` / `next build` without `--turbo`)."
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
263
|
const nextMajor = getNextMajorVersion();
|
|
270
264
|
if (nextMajor !== void 0 && nextMajor < 16) {
|
|
271
265
|
const log = process.env.NODE_ENV !== "production" || process.env.VERCEL_ENV === "preview" ? logWarn : logDebug;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/nextjs/index.ts","../../src/utils/project-id.ts","../../src/utils/project-id-env.ts","../../src/config/webpack/nextjs.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\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 {\n CORE_REACT_SHARED_KEYS,\n VENDOR_SHARED,\n} from '#internal/host/shared/shared-module-resolver';\nimport { RemoteComponentsError } from '#internal/utils/error';\nimport { logDebug, logError, logWarn } from '#internal/utils/logger';\nimport { resolveProjectId } from '#internal/utils/project-id';\nimport { transform as webpackTransform } from '../webpack/nextjs';\n\nfunction getNextMajorVersion(): number | undefined {\n try {\n const nextPkgPath = findUpSync('node_modules/next/package.json', {\n cwd: process.cwd(),\n });\n if (!nextPkgPath) return undefined;\n const { version } = JSON.parse(readFileSync(nextPkgPath, 'utf8')) as {\n version: string;\n };\n const major = version.split('.')[0];\n return major ? Number.parseInt(major, 10) : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction hasPagesDirectory(): boolean {\n return (\n existsSync(join(process.cwd(), 'pages')) ||\n existsSync(join(process.cwd(), 'src/pages'))\n );\n}\n\ninterface ZodSchema {\n safeParse: (data: unknown) => { success: boolean };\n}\n\nfunction readProjectPackageJson(): { name: string; type: string } {\n const defaults = { name: basename(process.cwd()), type: 'module' };\n try {\n const packageJsonPath = findUpSync('package.json', {\n cwd: process.cwd(),\n });\n if (packageJsonPath) {\n return {\n ...defaults,\n ...(JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name: string;\n type: string;\n }),\n };\n }\n } catch {\n // noop\n }\n return defaults;\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` (loader only), 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 { withRemoteComponentsConfig } from 'remote-components/config/nextjs';\n *\n * const nextConfig = {\n * // your Next.js configuration\n * };\n *\n * export default withRemoteComponentsConfig(\n * withMicrofrontends(nextConfig),\n * {\n * shared: ['some-package', 'another-package'],\n * },\n * );\n * ```\n */\nexport function withRemoteComponentsConfig(\n nextConfig: NextConfig,\n options?: WithRemoteComponentsOptions,\n) {\n const virtualRemoteComponentAppSharedRemote = join(\n process.cwd(),\n '.remote-components/shared/app-remote.tsx',\n );\n const virtualRemoteComponentPagesSharedRemote = join(\n process.cwd(),\n '.remote-components/shared/pages-remote.tsx',\n );\n const virtualRemoteComponentAppSharedHost = join(\n process.cwd(),\n '.remote-components/shared/app-host.tsx',\n );\n const virtualRemoteComponentPagesSharedHost = join(\n process.cwd(),\n '.remote-components/shared/pages-host.tsx',\n );\n\n const appShared = new Set([\n ...CORE_REACT_SHARED_KEYS,\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/dist/shared/lib/image-loader',\n 'next/script',\n 'next/dist/client/script',\n 'next/dist/build/polyfills/process',\n ...(options?.shared ?? []),\n ]);\n const pagesShared = new Set([\n ...CORE_REACT_SHARED_KEYS,\n 'next/router',\n 'next/link',\n 'next/dist/shared/lib/image-loader',\n 'next/script',\n 'next/form',\n ...(options?.shared ?? []),\n ]);\n\n const vendorShared = { ...VENDOR_SHARED };\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 packageJson = readProjectPackageJson();\n\n const exportPre =\n packageJson.type !== 'module'\n ? 'module.exports = { shared: { '\n : 'export const shared = { ';\n const exportPost = packageJson.type !== 'module' ? '} };\\n' : '};\\n';\n\n const resolveSharedPath = (moduleName: string): string | undefined => {\n try {\n const resolved = resolve(process.cwd(), moduleName);\n if (resolved) {\n return relative(process.cwd(), resolved).replace(\n /^(?<relative>\\.\\.\\/)+/,\n '',\n );\n }\n } catch {\n // if module resolution using enhanced-resolve fails, fallback to require.resolve called in the shared/remote file\n }\n };\n\n const generateSharedRemote = (sharedRemote: Set<string>) =>\n `'use client';\\n${exportPre}${Array.from(sharedRemote)\n .reduce<string[]>((acc, curr) => {\n const path = resolveSharedPath(curr);\n acc.push(\n `[${\n vendorShared[curr] ??\n (path ? `'${path}'` : `require.resolve('${curr}')`)\n }]: '${curr}',`,\n );\n acc.push(\n `['__remote_shared_module_${curr}']: () => import('${curr}'),`,\n );\n return acc;\n }, [])\n .join('\\n')}${exportPost}`;\n const generateSharedHost = (sharedHost: Set<string>) =>\n `'use client';\\n${exportPre}${Array.from(sharedHost)\n .reduce<string[]>((acc, curr) => {\n acc.push(`['${curr}']: () => import('${curr}'),`);\n return acc;\n }, [])\n .join('\\n')}${exportPost}`;\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',\n ];\n\n nextConfig.env = {\n ...nextConfig.env,\n REMOTE_COMPONENTS_CONFIGURED: '1',\n };\n\n const alias = {\n '#remote-components/remote/defaults/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedRemote,\n )}`,\n '#remote-components/remote/defaults/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedRemote,\n )}`,\n '#remote-components/host/defaults/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedHost,\n )}`,\n '#remote-components/host/defaults/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedHost,\n )}`,\n };\n\n const projectId = resolveProjectId(packageJson.name);\n process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;\n\n if (hasPagesDirectory()) {\n if (process.env.TURBOPACK) {\n throw new RemoteComponentsError(\n 'Remote Components does not support Next.js Pages Router with Turbopack. ' +\n 'Use webpack instead (`next dev` / `next build` without `--turbo`).',\n );\n }\n // Log instead of throwing for the version check because\n // withRemoteComponentsConfig is shared by both hosts and remotes.\n // Only Pages Router hosts are broken on Next.js < 16 — remotes\n // work fine and must not have their builds blocked.\n const nextMajor = getNextMajorVersion();\n if (nextMajor !== undefined && nextMajor < 16) {\n const log =\n process.env.NODE_ENV !== 'production' ||\n process.env.VERCEL_ENV === 'preview'\n ? logWarn\n : logDebug;\n log(\n 'Config',\n `Remote Components does not support Pages Router hosts on Next.js ${nextMajor}. ` +\n 'Pages Router remotes are unaffected. Upgrade to Next.js 16+ for host support.',\n );\n }\n }\n\n if (process.env.TURBOPACK) {\n if (\n !(configSchema as ZodSchema).safeParse({\n turbopack: {\n resolveAlias: {\n ...alias,\n },\n },\n compiler: {\n defineServer: {\n REMOTE_COMPONENTS_PROJECT_ID: projectId,\n },\n },\n }).success\n ) {\n logError(\n 'Config',\n 'Turbopack support requires a Next.js version that includes `compiler.defineServer`. ' +\n 'Upgrade Next.js to continue using Remote Components with Turbopack.',\n );\n process.exit(1);\n }\n nextConfig.turbopack = {\n ...nextConfig.turbopack,\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 { readFileSync } from 'node:fs';\nimport { findUpSync } from 'find-up';\nimport { resolveProjectIdFromEnv } from './project-id-env';\n\n/**\n * Resolves the project ID using environment variables first, then\n * falling back to `.vercel/project.json` and finally the package name.\n * Node-only — requires file system access.\n */\nexport function resolveProjectId(packageName: string): string {\n const fromEnv = resolveProjectIdFromEnv();\n if (fromEnv) return fromEnv;\n\n try {\n const projectPath = findUpSync('.vercel/project.json', {\n cwd: process.cwd(),\n });\n if (projectPath) {\n return (\n JSON.parse(readFileSync(projectPath, 'utf8')) as { projectId: string }\n ).projectId;\n }\n } catch {\n // fallback below\n }\n\n return packageName;\n}\n","/**\n * Resolves the project ID from environment variables only.\n * Safe for edge/browser contexts where file system access is unavailable.\n */\nexport function resolveProjectIdFromEnv(): string | undefined {\n return (\n process.env.REMOTE_COMPONENTS_PROJECT_ID ||\n process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION ||\n process.env.VERCEL_PROJECT_ID ||\n undefined\n );\n}\n","import { join } from 'node:path';\nimport type { NextConfig } from 'next';\nimport type { WebpackOptionsNormalized } from 'webpack';\nimport { ConditionalExecPlugin } from './plugins/conditional-exec';\nimport { ModuleIdEmbedPlugin } from './plugins/module-id-embed';\nimport { PatchRequirePlugin } from './plugins/patch-require';\nimport { RemoteWebpackRequirePlugin } from './plugins/remote-webpack-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, { isServer: webpackContext.isServer }),\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,WAAW,gBAAAA,eAAc,qBAAqB;AACnE,SAAS,UAAU,SAAS,QAAAC,OAAM,gBAAgB;AAClD,OAAO,qBAAqB;AAC5B,SAAS,cAAAC,mBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,OAAO,gCAAgC;;;ACNvC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;;;ACGpB,SAAS,0BAA8C;AAC5D,SACE,QAAQ,IAAI,gCACZ,QAAQ,IAAI,uCACZ,QAAQ,IAAI,qBACZ;AAEJ;;;ADFO,SAAS,iBAAiB,aAA6B;AAC5D,QA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AEA,QAAM,YAAY,iBAAiB,YAAY,IAAI;AACnD,UAAQ,IAAI,+BAA+B;AAE3C,MAAI,kBAAkB,GAAG;AACvB,QAAI,QAAQ,IAAI,WAAW;AACzB,YAAM,IAAI;AAAA,QACR;AAAA,MAEF;AAAA,IACF;AAKA,UAAM,YAAY,oBAAoB;AACtC,QAAI,cAAc,UAAa,YAAY,IAAI;AAC7C,YAAM,MACJ,QAAQ,IAAI,aAAa,gBACzB,QAAQ,IAAI,eAAe,YACvB,UACA;AACN;AAAA,QACE;AAAA,QACA,oEAAoE;AAAA,MAEtE;AAAA,IACF;AAAA,EACF;AAEA,MAAI,QAAQ,IAAI,WAAW;AACzB,QACE,CAAE,aAA2B,UAAU;AAAA,MACrC,WAAW;AAAA,QACT,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;AACA;AAAA,QACE;AAAA,QACA;AAAA,MAEF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,eAAW,YAAY;AAAA,MACrB,GAAG,WAAW;AAAA,MACd,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":["readFileSync","join","findUpSync","findUpSync","readFileSync","join"]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/nextjs/index.ts","../../src/utils/project-id.ts","../../src/utils/project-id-env.ts","../../src/config/webpack/nextjs.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\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 {\n CORE_REACT_SHARED_KEYS,\n VENDOR_SHARED,\n} from '#internal/host/shared/shared-module-resolver';\nimport { logDebug, logError, logWarn } from '#internal/utils/logger';\nimport { resolveProjectId } from '#internal/utils/project-id';\nimport { transform as webpackTransform } from '../webpack/nextjs';\n\nfunction getNextMajorVersion(): number | undefined {\n try {\n const nextPkgPath = findUpSync('node_modules/next/package.json', {\n cwd: process.cwd(),\n });\n if (!nextPkgPath) return undefined;\n const { version } = JSON.parse(readFileSync(nextPkgPath, 'utf8')) as {\n version: string;\n };\n const major = version.split('.')[0];\n return major ? Number.parseInt(major, 10) : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction hasPagesDirectory(): boolean {\n return (\n existsSync(join(process.cwd(), 'pages')) ||\n existsSync(join(process.cwd(), 'src/pages'))\n );\n}\n\ninterface ZodSchema {\n safeParse: (data: unknown) => { success: boolean };\n}\n\nfunction readProjectPackageJson(): { name: string; type: string } {\n const defaults = { name: basename(process.cwd()), type: 'module' };\n try {\n const packageJsonPath = findUpSync('package.json', {\n cwd: process.cwd(),\n });\n if (packageJsonPath) {\n return {\n ...defaults,\n ...(JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name: string;\n type: string;\n }),\n };\n }\n } catch {\n // noop\n }\n return defaults;\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` (loader only), 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 { withRemoteComponentsConfig } from 'remote-components/config/nextjs';\n *\n * const nextConfig = {\n * // your Next.js configuration\n * };\n *\n * export default withRemoteComponentsConfig(\n * withMicrofrontends(nextConfig),\n * {\n * shared: ['some-package', 'another-package'],\n * },\n * );\n * ```\n */\nexport function withRemoteComponentsConfig(\n nextConfig: NextConfig,\n options?: WithRemoteComponentsOptions,\n) {\n const virtualRemoteComponentAppSharedRemote = join(\n process.cwd(),\n '.remote-components/shared/app-remote.tsx',\n );\n const virtualRemoteComponentPagesSharedRemote = join(\n process.cwd(),\n '.remote-components/shared/pages-remote.tsx',\n );\n const virtualRemoteComponentAppSharedHost = join(\n process.cwd(),\n '.remote-components/shared/app-host.tsx',\n );\n const virtualRemoteComponentPagesSharedHost = join(\n process.cwd(),\n '.remote-components/shared/pages-host.tsx',\n );\n\n const appShared = new Set([\n ...CORE_REACT_SHARED_KEYS,\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/dist/shared/lib/image-loader',\n 'next/script',\n 'next/dist/client/script',\n 'next/dist/build/polyfills/process',\n ...(options?.shared ?? []),\n ]);\n const pagesShared = new Set([\n ...CORE_REACT_SHARED_KEYS,\n 'next/router',\n 'next/link',\n 'next/dist/shared/lib/image-loader',\n 'next/script',\n 'next/form',\n ...(options?.shared ?? []),\n ]);\n\n const vendorShared = { ...VENDOR_SHARED };\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 packageJson = readProjectPackageJson();\n\n const exportPre =\n packageJson.type !== 'module'\n ? 'module.exports = { shared: { '\n : 'export const shared = { ';\n const exportPost = packageJson.type !== 'module' ? '} };\\n' : '};\\n';\n\n const resolveSharedPath = (moduleName: string): string | undefined => {\n try {\n const resolved = resolve(process.cwd(), moduleName);\n if (resolved) {\n return relative(process.cwd(), resolved).replace(\n /^(?<relative>\\.\\.\\/)+/,\n '',\n );\n }\n } catch {\n // if module resolution using enhanced-resolve fails, fallback to require.resolve called in the shared/remote file\n }\n };\n\n const generateSharedRemote = (sharedRemote: Set<string>) =>\n `'use client';\\n${exportPre}${Array.from(sharedRemote)\n .reduce<string[]>((acc, curr) => {\n const path = resolveSharedPath(curr);\n acc.push(\n `[${\n vendorShared[curr] ??\n (path ? `'${path}'` : `require.resolve('${curr}')`)\n }]: '${curr}',`,\n );\n acc.push(\n `['__remote_shared_module_${curr}']: () => import('${curr}'),`,\n );\n return acc;\n }, [])\n .join('\\n')}${exportPost}`;\n const generateSharedHost = (sharedHost: Set<string>) =>\n `'use client';\\n${exportPre}${Array.from(sharedHost)\n .reduce<string[]>((acc, curr) => {\n acc.push(`['${curr}']: () => import('${curr}'),`);\n return acc;\n }, [])\n .join('\\n')}${exportPost}`;\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',\n ];\n\n nextConfig.env = {\n ...nextConfig.env,\n REMOTE_COMPONENTS_CONFIGURED: '1',\n };\n\n const alias = {\n '#remote-components/remote/defaults/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedRemote,\n )}`,\n '#remote-components/remote/defaults/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedRemote,\n )}`,\n '#remote-components/host/defaults/app': `./${relative(\n process.cwd(),\n virtualRemoteComponentAppSharedHost,\n )}`,\n '#remote-components/host/defaults/pages': `./${relative(\n process.cwd(),\n virtualRemoteComponentPagesSharedHost,\n )}`,\n };\n\n const projectId = resolveProjectId(packageJson.name);\n process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;\n\n if (hasPagesDirectory()) {\n // Log instead of throwing for the version check because\n // withRemoteComponentsConfig is shared by both hosts and remotes.\n // Only Pages Router hosts are broken on Next.js < 16 — remotes\n // work fine and must not have their builds blocked.\n const nextMajor = getNextMajorVersion();\n if (nextMajor !== undefined && nextMajor < 16) {\n const log =\n process.env.NODE_ENV !== 'production' ||\n process.env.VERCEL_ENV === 'preview'\n ? logWarn\n : logDebug;\n log(\n 'Config',\n `Remote Components does not support Pages Router hosts on Next.js ${nextMajor}. ` +\n 'Pages Router remotes are unaffected. Upgrade to Next.js 16+ for host support.',\n );\n }\n }\n\n if (process.env.TURBOPACK) {\n if (\n !(configSchema as ZodSchema).safeParse({\n turbopack: {\n resolveAlias: {\n ...alias,\n },\n },\n compiler: {\n defineServer: {\n REMOTE_COMPONENTS_PROJECT_ID: projectId,\n },\n },\n }).success\n ) {\n logError(\n 'Config',\n 'Turbopack support requires a Next.js version that includes `compiler.defineServer`. ' +\n 'Upgrade Next.js to continue using Remote Components with Turbopack.',\n );\n process.exit(1);\n }\n nextConfig.turbopack = {\n ...nextConfig.turbopack,\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 { readFileSync } from 'node:fs';\nimport { findUpSync } from 'find-up';\nimport { resolveProjectIdFromEnv } from './project-id-env';\n\n/**\n * Resolves the project ID using environment variables first, then\n * falling back to `.vercel/project.json` and finally the package name.\n * Node-only — requires file system access.\n */\nexport function resolveProjectId(packageName: string): string {\n const fromEnv = resolveProjectIdFromEnv();\n if (fromEnv) return fromEnv;\n\n try {\n const projectPath = findUpSync('.vercel/project.json', {\n cwd: process.cwd(),\n });\n if (projectPath) {\n return (\n JSON.parse(readFileSync(projectPath, 'utf8')) as { projectId: string }\n ).projectId;\n }\n } catch {\n // fallback below\n }\n\n return packageName;\n}\n","/**\n * Resolves the project ID from environment variables only.\n * Safe for edge/browser contexts where file system access is unavailable.\n */\nexport function resolveProjectIdFromEnv(): string | undefined {\n return (\n process.env.REMOTE_COMPONENTS_PROJECT_ID ||\n process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION ||\n process.env.VERCEL_PROJECT_ID ||\n undefined\n );\n}\n","import { join } from 'node:path';\nimport type { NextConfig } from 'next';\nimport type { WebpackOptionsNormalized } from 'webpack';\nimport { ConditionalExecPlugin } from './plugins/conditional-exec';\nimport { ModuleIdEmbedPlugin } from './plugins/module-id-embed';\nimport { PatchRequirePlugin } from './plugins/patch-require';\nimport { RemoteWebpackRequirePlugin } from './plugins/remote-webpack-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, { isServer: webpackContext.isServer }),\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,WAAW,gBAAAA,eAAc,qBAAqB;AACnE,SAAS,UAAU,SAAS,QAAAC,OAAM,gBAAgB;AAClD,OAAO,qBAAqB;AAC5B,SAAS,cAAAC,mBAAkB;AAE3B,SAAS,oBAAoB;AAC7B,OAAO,gCAAgC;;;ACNvC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;;;ACGpB,SAAS,0BAA8C;AAC5D,SACE,QAAQ,IAAI,gCACZ,QAAQ,IAAI,uCACZ,QAAQ,IAAI,qBACZ;AAEJ;;;ADFO,SAAS,iBAAiB,aAA6B;AAC5D,QAAM,UAAU,wBAAwB;AACxC,MAAI;AAA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AI;AACnD,UAAQ,IAAI,+BAA+B;AAE3C,MAAI,kBAAkB,GAAG;AAKvB,UAAM,YAAY,oBAAoB;AACtC,QAAI,cAAc,UAAa,YAAY,IAAI;AAC7C,YAAM,MACJ,QAAQ,IAAI,aAAa,gBACzB,QAAQ,IAAI,eAAe,YACvB,UACA;AACN;AAAA,QACE;AAAA,QACA,oEAAoE;AAAA,MAEtE;AAAA,IACF;AAAA,EACF;AAEA,MAAI,QAAQ,IAAI,WAAW;AACzB,QACE,CAAE,aAA2B,UAAU;AAAA,MACrC,WAAW;AAAA,QACT,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;AACA;AAAA,QACE;AAAA,QACA;AAAA,MAEF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,eAAW,YAAY;AAAA,MACrB,GAAG,WAAW;AAAA,MACd,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":["readFileSync","join","findUpSync","findUpSync","readFileSync","join"]}
|
package/dist/host/html.cjs
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../chunk-
|
|
12
|
-
require('../chunk-
|
|
13
|
-
require('../chunk-
|
|
14
|
-
require('../chunk-
|
|
10
|
+
var _chunkI47KE3ECcjs = require('../chunk-I47KE3EC.cjs');
|
|
11
|
+
require('../chunk-LCXO7BUY.cjs');
|
|
12
|
+
require('../chunk-RJW3EZJP.cjs');
|
|
13
|
+
require('../chunk-T64P7BAG.cjs');
|
|
14
|
+
require('../chunk-TZT7DLO5.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkX6W464D6cjs = require('../chunk-X6W464D6.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkZ2SLBFQLcjs = require('../chunk-Z2SLBFQL.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -124,10 +124,10 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
if (type === "webpack") {
|
|
127
|
-
const { webpackRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../webpack-
|
|
127
|
+
const { webpackRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../webpack-TTZDARNY.cjs")));
|
|
128
128
|
return webpackRuntime(bundle, shared, remoteShared, resolveClientUrl);
|
|
129
129
|
} else if (type === "turbopack") {
|
|
130
|
-
const { turbopackRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../turbopack-
|
|
130
|
+
const { turbopackRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../turbopack-KRKECGY2.cjs")));
|
|
131
131
|
return turbopackRuntime(
|
|
132
132
|
url,
|
|
133
133
|
bundle,
|
|
@@ -136,7 +136,7 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
136
136
|
resolveClientUrl
|
|
137
137
|
);
|
|
138
138
|
} else if (type === "script") {
|
|
139
|
-
const { scriptRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../script-
|
|
139
|
+
const { scriptRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../script-D5AD7HLV.cjs")));
|
|
140
140
|
return scriptRuntime(resolveClientUrl);
|
|
141
141
|
}
|
|
142
142
|
throw new (0, _chunkRUWR74XQcjs.RemoteComponentsError)(
|
|
@@ -148,15 +148,15 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
148
148
|
var _jsxruntime = require('react/jsx-runtime');
|
|
149
149
|
if (typeof HTMLElement !== "undefined") {
|
|
150
150
|
class RemoteComponent extends HTMLElement {constructor(...args) { super(...args); RemoteComponent.prototype.__init.call(this);RemoteComponent.prototype.__init2.call(this);RemoteComponent.prototype.__init3.call(this);RemoteComponent.prototype.__init4.call(this);RemoteComponent.prototype.__init5.call(this);RemoteComponent.prototype.__init6.call(this);RemoteComponent.prototype.__init7.call(this); }
|
|
151
|
-
__init() {this.name =
|
|
152
|
-
__init2() {this.bundle =
|
|
151
|
+
__init() {this.name = _chunkX6W464D6cjs.DEFAULT_COMPONENT_NAME}
|
|
152
|
+
__init2() {this.bundle = _chunkX6W464D6cjs.DEFAULT_BUNDLE_NAME}
|
|
153
153
|
|
|
154
154
|
__init3() {this.__next = null}
|
|
155
155
|
__init4() {this.fouc = null}
|
|
156
|
-
__init5() {this.hostState =
|
|
156
|
+
__init5() {this.hostState = _chunkI47KE3ECcjs.createHostState.call(void 0, )}
|
|
157
157
|
__init6() {this.root = null}
|
|
158
158
|
|
|
159
|
-
__init7() {this.emitter =
|
|
159
|
+
__init7() {this.emitter = _chunkI47KE3ECcjs.makeEventEmitter.call(void 0, this)}
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
|
|
@@ -278,10 +278,10 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
278
278
|
let url = null;
|
|
279
279
|
let html = this.innerHTML;
|
|
280
280
|
if (src) {
|
|
281
|
-
url =
|
|
282
|
-
this.name =
|
|
281
|
+
url = _chunkI47KE3ECcjs.getClientOrServerUrl.call(void 0, src, window.location.href);
|
|
282
|
+
this.name = _chunkI47KE3ECcjs.resolveNameFromSrc.call(void 0, src, this.name);
|
|
283
283
|
}
|
|
284
|
-
const resolveClientUrl = url ?
|
|
284
|
+
const resolveClientUrl = url ? _chunkI47KE3ECcjs.bindResolveClientUrl.call(void 0, this.resolveClientUrl, url.href) : void 0;
|
|
285
285
|
if (!remoteComponentChild && url) {
|
|
286
286
|
const fetchInit = {
|
|
287
287
|
credentials: this.credentials || "same-origin"
|
|
@@ -292,7 +292,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
292
292
|
);
|
|
293
293
|
let res;
|
|
294
294
|
try {
|
|
295
|
-
res = await
|
|
295
|
+
res = await _chunkI47KE3ECcjs.fetchWithHooks.call(void 0, resolvedUrl, fetchInit, {
|
|
296
296
|
onRequest: this.onRequest,
|
|
297
297
|
onResponse: this.onResponse,
|
|
298
298
|
abortController: this.hostState.abortController
|
|
@@ -319,7 +319,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
const effectiveUrl = _nullishCoalesce(url, () => ( new URL(window.location.href)));
|
|
322
|
-
const { doc, parsed } =
|
|
322
|
+
const { doc, parsed } = _chunkI47KE3ECcjs.preparePipeline.call(void 0, {
|
|
323
323
|
html,
|
|
324
324
|
name: this.name,
|
|
325
325
|
url: effectiveUrl,
|
|
@@ -343,7 +343,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
343
343
|
this.name = resolvedName;
|
|
344
344
|
this.bundle = parsedMetadata.bundle;
|
|
345
345
|
if (url) {
|
|
346
|
-
|
|
346
|
+
_chunkZ2SLBFQLcjs.getNamespace.call(void 0, ).bundleUrls[this.bundle] = url;
|
|
347
347
|
}
|
|
348
348
|
const metadataEl = document.createElement("script");
|
|
349
349
|
metadataEl.type = "application/json";
|
|
@@ -362,7 +362,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
362
362
|
if (this.hostState.prevIsRemoteComponent) {
|
|
363
363
|
if (this.hostState.prevUrl) {
|
|
364
364
|
const prevUrl = this.hostState.prevUrl;
|
|
365
|
-
const nsUnmount =
|
|
365
|
+
const nsUnmount = _chunkZ2SLBFQLcjs.getNamespace.call(void 0, );
|
|
366
366
|
if (nsUnmount.unmountFns[prevUrl.href]) {
|
|
367
367
|
await Promise.all(
|
|
368
368
|
Array.from(_nullishCoalesce(nsUnmount.unmountFns[prevUrl.href], () => ( []))).map(
|
|
@@ -552,9 +552,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
552
552
|
};
|
|
553
553
|
if (rsc) {
|
|
554
554
|
_optionalChain([rsc, 'access', _62 => _62.parentElement, 'optionalAccess', _63 => _63.removeChild, 'call', _64 => _64(rsc)]);
|
|
555
|
-
const rscName = `__remote_component_rsc_${
|
|
555
|
+
const rscName = `__remote_component_rsc_${_chunkX6W464D6cjs.escapeString.call(void 0,
|
|
556
556
|
url.href
|
|
557
|
-
)}_${
|
|
557
|
+
)}_${_chunkX6W464D6cjs.escapeString.call(void 0, this.name)}`;
|
|
558
558
|
const rscClone = document.createElement("script");
|
|
559
559
|
rscClone.id = `${rscName}_rsc`;
|
|
560
560
|
rscClone.textContent = _nullishCoalesce(_optionalChain([rsc, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.replace, 'call', _67 => _67(
|
|
@@ -567,7 +567,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
567
567
|
name,
|
|
568
568
|
initial
|
|
569
569
|
}) => {
|
|
570
|
-
const stream =
|
|
570
|
+
const stream = _chunkI47KE3ECcjs.createRSCStream.call(void 0,
|
|
571
571
|
rscName,
|
|
572
572
|
_nullishCoalesce(self[rscName], () => ( [`0:[null]
|
|
573
573
|
`]))
|
|
@@ -661,9 +661,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
661
661
|
if (this.fouc) {
|
|
662
662
|
this.root.removeChild(this.fouc);
|
|
663
663
|
}
|
|
664
|
-
} else if (
|
|
664
|
+
} else if (_chunkZ2SLBFQLcjs.getNamespace.call(void 0, ).mountFns[url.href]) {
|
|
665
665
|
await Promise.all(
|
|
666
|
-
Array.from(_nullishCoalesce(
|
|
666
|
+
Array.from(_nullishCoalesce(_chunkZ2SLBFQLcjs.getNamespace.call(void 0, ).mountFns[url.href], () => ( []))).map(
|
|
667
667
|
async (mount) => {
|
|
668
668
|
try {
|
|
669
669
|
await mount(this.root);
|
|
@@ -689,7 +689,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
689
689
|
customElements.define("remote-component", RemoteComponent);
|
|
690
690
|
}
|
|
691
691
|
function registerSharedModules(modules = {}) {
|
|
692
|
-
const ns =
|
|
692
|
+
const ns = _chunkZ2SLBFQLcjs.getNamespace.call(void 0, );
|
|
693
693
|
Object.entries(modules).forEach(([key, value]) => {
|
|
694
694
|
ns.hostSharedModules[key] = value;
|
|
695
695
|
});
|
package/dist/host/html.js
CHANGED
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
makeEventEmitter,
|
|
8
8
|
preparePipeline,
|
|
9
9
|
resolveNameFromSrc
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-NZAB7REE.js";
|
|
11
|
+
import "../chunk-SZFCBE54.js";
|
|
12
|
+
import "../chunk-QKB74MLO.js";
|
|
13
|
+
import "../chunk-52BJ7VFA.js";
|
|
14
|
+
import "../chunk-LQ7VQ74E.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_BUNDLE_NAME,
|
|
17
17
|
DEFAULT_COMPONENT_NAME,
|
|
18
18
|
escapeString
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-SJM7AAGU.js";
|
|
20
20
|
import {
|
|
21
21
|
getNamespace
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-D5GNZB6O.js";
|
|
23
23
|
import {
|
|
24
24
|
RemoteComponentsError,
|
|
25
25
|
errorFromFailedFetch,
|
|
@@ -124,10 +124,10 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
if (type === "webpack") {
|
|
127
|
-
const { webpackRuntime } = await import("../webpack-
|
|
127
|
+
const { webpackRuntime } = await import("../webpack-NPZNXRNL.js");
|
|
128
128
|
return webpackRuntime(bundle, shared, remoteShared, resolveClientUrl);
|
|
129
129
|
} else if (type === "turbopack") {
|
|
130
|
-
const { turbopackRuntime } = await import("../turbopack-
|
|
130
|
+
const { turbopackRuntime } = await import("../turbopack-5LW6V6IT.js");
|
|
131
131
|
return turbopackRuntime(
|
|
132
132
|
url,
|
|
133
133
|
bundle,
|
|
@@ -136,7 +136,7 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
136
136
|
resolveClientUrl
|
|
137
137
|
);
|
|
138
138
|
} else if (type === "script") {
|
|
139
|
-
const { scriptRuntime } = await import("../script-
|
|
139
|
+
const { scriptRuntime } = await import("../script-VPOI7ARP.js");
|
|
140
140
|
return scriptRuntime(resolveClientUrl);
|
|
141
141
|
}
|
|
142
142
|
throw new RemoteComponentsError(
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkAWWWK2ZYcjs = require('../../../chunk-AWWWK2ZY.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('../../../chunk-
|
|
9
|
-
require('../../../chunk-
|
|
10
|
-
require('../../../chunk-
|
|
11
|
-
require('../../../chunk-
|
|
7
|
+
var _chunkI47KE3ECcjs = require('../../../chunk-I47KE3EC.cjs');
|
|
8
|
+
require('../../../chunk-LCXO7BUY.cjs');
|
|
9
|
+
require('../../../chunk-RJW3EZJP.cjs');
|
|
10
|
+
require('../../../chunk-T64P7BAG.cjs');
|
|
11
|
+
require('../../../chunk-TZT7DLO5.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
require('../../../chunk-
|
|
15
|
+
var _chunkX6W464D6cjs = require('../../../chunk-X6W464D6.cjs');
|
|
16
|
+
require('../../../chunk-Z2SLBFQL.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkRUWR74XQcjs = require('../../../chunk-RUWR74XQ.cjs');
|
|
@@ -29,8 +29,8 @@ var _react = require('react');
|
|
|
29
29
|
function resolveForBundle(unbound, bundle) {
|
|
30
30
|
if (!unbound)
|
|
31
31
|
return void 0;
|
|
32
|
-
const remoteSrc = _nullishCoalesce(_optionalChain([
|
|
33
|
-
return
|
|
32
|
+
const remoteSrc = _nullishCoalesce(_optionalChain([_chunkX6W464D6cjs.getScope.call(void 0, bundle), 'optionalAccess', _2 => _2.url, 'access', _3 => _3.href]), () => ( ""));
|
|
33
|
+
return _chunkI47KE3ECcjs.bindResolveClientUrl.call(void 0, unbound, remoteSrc);
|
|
34
34
|
}
|
|
35
35
|
function createImageLoaderSharedEntries({
|
|
36
36
|
bound,
|
|
@@ -39,13 +39,13 @@ function createImageLoaderSharedEntries({
|
|
|
39
39
|
const loaderEntry = (bundle) => {
|
|
40
40
|
const resolveClientUrl = _nullishCoalesce(bound, () => ( resolveForBundle(unbound, bundle)));
|
|
41
41
|
return Promise.resolve({
|
|
42
|
-
default:
|
|
42
|
+
default: _chunkX6W464D6cjs.createRemoteImageLoader.call(void 0, bundle, resolveClientUrl),
|
|
43
43
|
__esModule: true
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
const imageEntry = async (bundle) => {
|
|
47
47
|
const resolveClientUrl = _nullishCoalesce(bound, () => ( resolveForBundle(unbound, bundle)));
|
|
48
|
-
const rawLoader =
|
|
48
|
+
const rawLoader = _chunkX6W464D6cjs.createRemoteImageLoader.call(void 0, bundle, resolveClientUrl);
|
|
49
49
|
const remoteLoader = Object.assign(
|
|
50
50
|
(p) => rawLoader({ ...p, config: { path: "/_next/image" } }),
|
|
51
51
|
{ __next_img_default: true }
|
|
@@ -189,7 +189,7 @@ function ConsumeRemoteComponent2(props) {
|
|
|
189
189
|
return _nullishCoalesce(props.children, () => ( null));
|
|
190
190
|
}
|
|
191
191
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
192
|
-
|
|
192
|
+
_chunkAWWWK2ZYcjs.ConsumeRemoteComponent,
|
|
193
193
|
{
|
|
194
194
|
...props,
|
|
195
195
|
shared: sharedModules(props.shared, props.resolveClientUrl)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
ConsumeRemoteComponent
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-GBFUPMMI.js";
|
|
5
5
|
import {
|
|
6
6
|
bindResolveClientUrl
|
|
7
|
-
} from "../../../chunk-
|
|
8
|
-
import "../../../chunk-
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
11
|
-
import "../../../chunk-
|
|
7
|
+
} from "../../../chunk-NZAB7REE.js";
|
|
8
|
+
import "../../../chunk-SZFCBE54.js";
|
|
9
|
+
import "../../../chunk-QKB74MLO.js";
|
|
10
|
+
import "../../../chunk-52BJ7VFA.js";
|
|
11
|
+
import "../../../chunk-LQ7VQ74E.js";
|
|
12
12
|
import {
|
|
13
13
|
createRemoteImageLoader,
|
|
14
14
|
getScope
|
|
15
|
-
} from "../../../chunk-
|
|
16
|
-
import "../../../chunk-
|
|
15
|
+
} from "../../../chunk-SJM7AAGU.js";
|
|
16
|
+
import "../../../chunk-D5GNZB6O.js";
|
|
17
17
|
import {
|
|
18
18
|
logWarn
|
|
19
19
|
} from "../../../chunk-S2A4TFLS.js";
|
package/dist/host/react.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
3
|
+
var _chunkAWWWK2ZYcjs = require('../chunk-AWWWK2ZY.cjs');
|
|
4
|
+
require('../chunk-I47KE3EC.cjs');
|
|
5
|
+
require('../chunk-LCXO7BUY.cjs');
|
|
6
|
+
require('../chunk-RJW3EZJP.cjs');
|
|
7
|
+
require('../chunk-T64P7BAG.cjs');
|
|
8
|
+
require('../chunk-TZT7DLO5.cjs');
|
|
9
|
+
require('../chunk-X6W464D6.cjs');
|
|
10
|
+
require('../chunk-Z2SLBFQL.cjs');
|
|
11
11
|
require('../chunk-RUWR74XQ.cjs');
|
|
12
12
|
require('../chunk-TCFLEBQM.cjs');
|
|
13
13
|
require('../chunk-KE7QPAQ4.cjs');
|
|
14
14
|
require('../chunk-SHFJ5OQA.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.ConsumeRemoteComponent =
|
|
17
|
+
exports.ConsumeRemoteComponent = _chunkAWWWK2ZYcjs.ConsumeRemoteComponent;
|
|
18
18
|
//# sourceMappingURL=react.cjs.map
|
package/dist/host/react.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConsumeRemoteComponent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-GBFUPMMI.js";
|
|
4
|
+
import "../chunk-NZAB7REE.js";
|
|
5
|
+
import "../chunk-SZFCBE54.js";
|
|
6
|
+
import "../chunk-QKB74MLO.js";
|
|
7
|
+
import "../chunk-52BJ7VFA.js";
|
|
8
|
+
import "../chunk-LQ7VQ74E.js";
|
|
9
|
+
import "../chunk-SJM7AAGU.js";
|
|
10
|
+
import "../chunk-D5GNZB6O.js";
|
|
11
11
|
import "../chunk-S2A4TFLS.js";
|
|
12
12
|
import "../chunk-GAXJTFBV.js";
|
|
13
13
|
import "../chunk-X6YKUJKH.js";
|
|
@@ -25,6 +25,26 @@ var import_namespace = require("#internal/runtime/namespace");
|
|
|
25
25
|
var import_error = require("#internal/utils/error");
|
|
26
26
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
27
27
|
const self = globalThis;
|
|
28
|
+
const ns = (0, import_namespace.getNamespace)();
|
|
29
|
+
ns.pageComponentCache ??= {};
|
|
30
|
+
const cacheKey = `${bundle}:${route}`;
|
|
31
|
+
const applyBundleCss = () => {
|
|
32
|
+
const elements = ns.cssCache[bundle] ?? [];
|
|
33
|
+
if (styleContainer) {
|
|
34
|
+
for (const el of elements) {
|
|
35
|
+
styleContainer.appendChild(el.cloneNode(true));
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
for (const el of elements) {
|
|
39
|
+
document.head.appendChild(el);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const cachedEntry = ns.pageComponentCache[cacheKey];
|
|
44
|
+
if (cachedEntry) {
|
|
45
|
+
applyBundleCss();
|
|
46
|
+
return cachedEntry;
|
|
47
|
+
}
|
|
28
48
|
const nextCssOriginal = document.querySelector(
|
|
29
49
|
`[id="__next_css__DO_NOT_USE__"]:not([data-bundle="${bundle}"][data-route="${route}"])`
|
|
30
50
|
);
|
|
@@ -86,9 +106,9 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
86
106
|
default: null
|
|
87
107
|
})
|
|
88
108
|
];
|
|
89
|
-
const { default: Component } = componentLoader();
|
|
90
|
-
const { default: App } = appLoader();
|
|
91
|
-
const cssCache =
|
|
109
|
+
const { default: Component = null } = componentLoader();
|
|
110
|
+
const { default: App = null } = appLoader();
|
|
111
|
+
const cssCache = ns.cssCache;
|
|
92
112
|
if (!cssCache[bundle]) {
|
|
93
113
|
const cssRE = /\.s?css$/;
|
|
94
114
|
Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).filter((id) => cssRE.test(id)).forEach((id) => {
|
|
@@ -109,17 +129,7 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
109
129
|
}
|
|
110
130
|
cssCache[bundle] = elements;
|
|
111
131
|
}
|
|
112
|
-
|
|
113
|
-
const elements = cssCache[bundle];
|
|
114
|
-
elements.forEach((el) => {
|
|
115
|
-
styleContainer.appendChild(el.cloneNode(true));
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
const elements = cssCache[bundle];
|
|
119
|
-
elements.forEach((el) => {
|
|
120
|
-
document.head.appendChild(el);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
132
|
+
applyBundleCss();
|
|
123
133
|
delete self.__NEXT_P;
|
|
124
134
|
self.__NEXT_P = __NEXT_P_ORIGINAL;
|
|
125
135
|
if (nextCssOriginal) {
|
|
@@ -127,7 +137,9 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
127
137
|
}
|
|
128
138
|
nextCss.remove();
|
|
129
139
|
nextCssEnd.remove();
|
|
130
|
-
|
|
140
|
+
const result = { Component, App };
|
|
141
|
+
ns.pageComponentCache[cacheKey] = result;
|
|
142
|
+
return result;
|
|
131
143
|
}
|
|
132
144
|
return { Component: null, App: null };
|
|
133
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/config/webpack/next-client-pages-loader.ts"],"sourcesContent":["import { getNamespace } from '#internal/runtime/namespace';\nimport { RemoteComponentsError } from '#internal/utils/error';\n\n// module loader for Next.js Pages Router\nexport function nextClientPagesLoader(\n bundle: string,\n route: string,\n styleContainer: HTMLHeadElement | ShadowRoot | null = document.head,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string | number) => unknown) & {\n c?: Record<\n string | number,\n { id: string; parents: string[]; children: string[] }\n >;\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n type?: 'turbopack' | 'webpack';\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // Next.js client pages loader reference storage\n __NEXT_P?: [\n (\n | [\n string,\n () => { default?: React.ComponentType<Record<string, unknown>> },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n ];\n };\n\n // temporarily remove the original Next.js CSS loader\n const nextCssOriginal = document.querySelector(\n `[id=\"__next_css__DO_NOT_USE__\"]:not([data-bundle=\"${bundle}\"][data-route=\"${route}\"])`,\n );\n if (nextCssOriginal) {\n nextCssOriginal.parentNode?.removeChild(nextCssOriginal);\n }\n\n // create a new Next.js CSS loader element\n const nextCss = document.createElement('noscript');\n nextCss.id = '__next_css__DO_NOT_USE__';\n nextCss.setAttribute('data-bundle', bundle);\n nextCss.setAttribute('data-route', route);\n const nextCssEnd = document.createElement('noscript');\n nextCssEnd.id = '__next_css__DO_NOT_USE_END__';\n nextCssEnd.setAttribute('data-bundle', bundle);\n nextCssEnd.setAttribute('data-route', route);\n document.head.appendChild(nextCssEnd);\n document.head.appendChild(nextCss);\n\n // find the page component loader chunk\n const componentLoaderChunk =\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // find the app loader chunk\n const appLoaderChunk =\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // if we didn't find the component loader or app loader, throw an error\n if (!(componentLoaderChunk && appLoaderChunk)) {\n throw new RemoteComponentsError(\n `Next.js client pages loader not found in bundle \"${bundle}\".`,\n );\n }\n\n // temporarily store the original __NEXT_P reference\n // this is required to avoid conflicts with the Next.js client pages loader\n // which uses the same global variable to store the page components\n const __NEXT_P_ORIGINAL = self.__NEXT_P;\n const selfOriginal = self;\n delete selfOriginal.__NEXT_P;\n\n // load the component and app loader chunks\n self.__remote_webpack_require__?.[bundle]?.(\n self.__remote_webpack_require__[bundle].type !== 'turbopack'\n ? componentLoaderChunk\n : `[${bundle}] ${componentLoaderChunk}`,\n );\n if (\n typeof appLoaderChunk === 'string' ||\n (typeof appLoaderChunk === 'number' && appLoaderChunk !== -1)\n ) {\n self.__remote_webpack_require__?.[bundle]?.(\n self.__remote_webpack_require__[bundle].type !== 'turbopack'\n ? appLoaderChunk\n : `[${bundle}] ${appLoaderChunk}`,\n );\n }\n\n // if we have the __NEXT_P global variable, we can extract the component and app\n if (self.__NEXT_P) {\n const [, componentLoader] = self.__NEXT_P[0] ?? [\n undefined,\n () => ({ default: null }),\n ];\n const [, appLoader] = self.__NEXT_P[2] ?? [\n undefined,\n () => ({\n default: null,\n }),\n ];\n const { default: Component } = componentLoader();\n const { default: App } = appLoader();\n\n const cssCache = getNamespace().cssCache;\n\n if (!cssCache[bundle]) {\n // load the CSS files from the remote bundle\n const cssRE = /\\.s?css$/;\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {})\n .filter((id) => cssRE.test(id))\n .forEach((id) => {\n self.__remote_webpack_require__?.[bundle]?.(id);\n });\n\n Object.keys(self.__remote_webpack_module_map__?.[bundle] ?? {})\n .filter((path) => cssRE.test(path))\n .forEach((path) => {\n const id = self.__remote_webpack_module_map__?.[bundle]?.[path];\n if (id) {\n self.__remote_webpack_require__?.[bundle]?.(id);\n }\n });\n\n const elements = [];\n let node = nextCss.previousSibling;\n while (node && node !== nextCssEnd) {\n elements.push(node);\n node.remove();\n node = nextCss.previousSibling;\n }\n cssCache[bundle] = elements;\n }\n\n // if the styleContainer is provided, we need to move the styles to it\n if (styleContainer) {\n const elements = cssCache[bundle];\n elements.forEach((el) => {\n styleContainer.appendChild(el.cloneNode(true));\n });\n } else {\n // if no styleContainer is provided, we need to move the styles back to the head\n const elements = cssCache[bundle];\n elements.forEach((el) => {\n document.head.appendChild(el);\n });\n }\n\n // restore the original __NEXT_P reference\n delete self.__NEXT_P;\n self.__NEXT_P = __NEXT_P_ORIGINAL;\n\n // restore the original Next.js CSS loader\n if (nextCssOriginal) {\n nextCssOriginal.parentNode?.appendChild(nextCssOriginal);\n }\n\n nextCss.remove();\n nextCssEnd.remove();\n\n return { Component, App };\n }\n\n return { Component: null, App: null };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA6B;AAC7B,mBAAsC;AAG/B,SAAS,sBACd,QACA,OACA,iBAAsD,SAAS,MAC/D;AAEA,QAAM,OAAO;AAsDb,QAAM,kBAAkB,SAAS;AAAA,IAC/B,qDAAqD,wBAAwB;AAAA,EAC/E;AACA,MAAI,iBAAiB;AACnB,oBAAgB,YAAY,YAAY,eAAe;AAAA,EACzD;AAGA,QAAM,UAAU,SAAS,cAAc,UAAU;AACjD,UAAQ,KAAK;AACb,UAAQ,aAAa,eAAe,MAAM;AAC1C,UAAQ,aAAa,cAAc,KAAK;AACxC,QAAM,aAAa,SAAS,cAAc,UAAU;AACpD,aAAW,KAAK;AAChB,aAAW,aAAa,eAAe,MAAM;AAC7C,aAAW,aAAa,cAAc,KAAK;AAC3C,WAAS,KAAK,YAAY,UAAU;AACpC,WAAS,KAAK,YAAY,OAAO;AAGjC,QAAM,uBACJ,OAAO,KAAK,KAAK,6BAA6B,MAAM,GAAG,KAAK,CAAC,CAAC,EAAE;AAAA,IAC9D,CAAC,QACC,IAAI,SAAS,8CAA8C,KAC3D,IAAI,SAAS,QAAQ,mBAAmB,KAAK,IAAI;AAAA,EACrD,KACA,OAAO,K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,QAAQ,SAAS,YAAY;AAClC,iBAAS,KAAK,IAAI;AAClB,aAAK,OAAO;AACZ,eAAO,QAAQ;AAAA,MACjB;AACA,eAAS,MAAM,IAAI;AAAA,IACrB;AAGA,QAAI,gBAAgB;AAClB,YAAM,WAAW,SAAS,MAAM;AAChC,eAAS,QAAQ,CAAC,OAAO;AACvB,uBAAe,YAAY,GAAG,UAAU,IAAI,CAAC;AAAA,MAC/C,CAAC;AAAA,IACH,OAAO;AAEL,YAAM,WAAW,SAAS,MAAM;AAChC,eAAS,QAAQ,CAAC,OAAO;AACvB,iBAAS,KAAK,YAAY,EAAE;AAAA,MAC9B,CAAC;AAAA,IACH;AAGA,WAAO,KAAK;AACZ,SAAK,WAAW;AAGhB,QAAI,iBAAiB;AACnB,sBAAgB,YAAY,YAAY,eAAe;AAAA,IACzD;AAEA,YAAQ,OAAO;AACf,eAAW,OAAO;AAElB,WAAO,EAAE,WAAW,IAAI;AAAA,EAC1B;AAEA,SAAO,EAAE,WAAW,MAAM,KAAK,KAAK;AACtC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/config/webpack/next-client-pages-loader.ts"],"sourcesContent":["import { getNamespace } from '#internal/runtime/namespace';\nimport { RemoteComponentsError } from '#internal/utils/error';\n\n// module loader for Next.js Pages Router\nexport function nextClientPagesLoader(\n bundle: string,\n route: string,\n styleContainer: HTMLHeadElement | ShadowRoot | null = document.head,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string | number) => unknown) & {\n c?: Record<\n string | number,\n { id: string; parents: string[]; children: string[] }\n >;\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n type?: 'turbopack' | 'webpack';\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // Next.js client pages loader reference storage\n __NEXT_P?: [\n (\n | [\n string,\n () => { default?: React.ComponentType<Record<string, unknown>> },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n ];\n };\n\n const ns = getNamespace();\n ns.pageComponentCache ??= {};\n const cacheKey = `${bundle}:${route}`;\n\n // Applies the cached CSS for `bundle` into the caller's styleContainer.\n // Mirrors the final CSS-attach step of the fresh-load path so that cache\n // hits and additional host instances (each with their own shadow root)\n // still receive the styles.\n const applyBundleCss = () => {\n const elements = ns.cssCache[bundle] ?? [];\n if (styleContainer) {\n for (const el of elements) {\n styleContainer.appendChild(el.cloneNode(true));\n }\n } else {\n for (const el of elements) {\n document.head.appendChild(el);\n }\n }\n };\n\n // On repeat loads (e.g. after history.back()) the next-client-pages-loader\n // chunk is already cached by webpack and its factory won't re-run, so\n // __NEXT_P wouldn't be populated. Reuse the Component/App extracted on the\n // first load, but still run the CSS attach below because the caller may be\n // a different host instance with its own styleContainer.\n const cachedEntry = ns.pageComponentCache[cacheKey];\n if (cachedEntry) {\n applyBundleCss();\n return cachedEntry;\n }\n\n // temporarily remove the original Next.js CSS loader\n const nextCssOriginal = document.querySelector(\n `[id=\"__next_css__DO_NOT_USE__\"]:not([data-bundle=\"${bundle}\"][data-route=\"${route}\"])`,\n );\n if (nextCssOriginal) {\n nextCssOriginal.parentNode?.removeChild(nextCssOriginal);\n }\n\n // create a new Next.js CSS loader element\n const nextCss = document.createElement('noscript');\n nextCss.id = '__next_css__DO_NOT_USE__';\n nextCss.setAttribute('data-bundle', bundle);\n nextCss.setAttribute('data-route', route);\n const nextCssEnd = document.createElement('noscript');\n nextCssEnd.id = '__next_css__DO_NOT_USE_END__';\n nextCssEnd.setAttribute('data-bundle', bundle);\n nextCssEnd.setAttribute('data-route', route);\n document.head.appendChild(nextCssEnd);\n document.head.appendChild(nextCss);\n\n // find the page component loader chunk\n const componentLoaderChunk =\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // find the app loader chunk\n const appLoaderChunk =\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // if we didn't find the component loader or app loader, throw an error\n if (!(componentLoaderChunk && appLoaderChunk)) {\n throw new RemoteComponentsError(\n `Next.js client pages loader not found in bundle \"${bundle}\".`,\n );\n }\n\n // temporarily store the original __NEXT_P reference\n // this is required to avoid conflicts with the Next.js client pages loader\n // which uses the same global variable to store the page components\n const __NEXT_P_ORIGINAL = self.__NEXT_P;\n const selfOriginal = self;\n delete selfOriginal.__NEXT_P;\n\n // load the component and app loader chunks\n self.__remote_webpack_require__?.[bundle]?.(\n self.__remote_webpack_require__[bundle].type !== 'turbopack'\n ? componentLoaderChunk\n : `[${bundle}] ${componentLoaderChunk}`,\n );\n if (\n typeof appLoaderChunk === 'string' ||\n (typeof appLoaderChunk === 'number' && appLoaderChunk !== -1)\n ) {\n self.__remote_webpack_require__?.[bundle]?.(\n self.__remote_webpack_require__[bundle].type !== 'turbopack'\n ? appLoaderChunk\n : `[${bundle}] ${appLoaderChunk}`,\n );\n }\n\n // if we have the __NEXT_P global variable, we can extract the component and app\n if (self.__NEXT_P) {\n const [, componentLoader] = self.__NEXT_P[0] ?? [\n undefined,\n () => ({ default: null }),\n ];\n const [, appLoader] = self.__NEXT_P[2] ?? [\n undefined,\n () => ({\n default: null,\n }),\n ];\n const { default: Component = null } = componentLoader();\n const { default: App = null } = appLoader();\n\n const cssCache = ns.cssCache;\n\n if (!cssCache[bundle]) {\n // load the CSS files from the remote bundle\n const cssRE = /\\.s?css$/;\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {})\n .filter((id) => cssRE.test(id))\n .forEach((id) => {\n self.__remote_webpack_require__?.[bundle]?.(id);\n });\n\n Object.keys(self.__remote_webpack_module_map__?.[bundle] ?? {})\n .filter((path) => cssRE.test(path))\n .forEach((path) => {\n const id = self.__remote_webpack_module_map__?.[bundle]?.[path];\n if (id) {\n self.__remote_webpack_require__?.[bundle]?.(id);\n }\n });\n\n const elements = [];\n let node = nextCss.previousSibling;\n while (node && node !== nextCssEnd) {\n elements.push(node);\n node.remove();\n node = nextCss.previousSibling;\n }\n cssCache[bundle] = elements;\n }\n\n applyBundleCss();\n\n // restore the original __NEXT_P reference\n delete self.__NEXT_P;\n self.__NEXT_P = __NEXT_P_ORIGINAL;\n\n // restore the original Next.js CSS loader\n if (nextCssOriginal) {\n nextCssOriginal.parentNode?.appendChild(nextCssOriginal);\n }\n\n nextCss.remove();\n nextCssEnd.remove();\n\n const result = { Component, App };\n ns.pageComponentCache[cacheKey] = result;\n return result;\n }\n\n return { Component: null, App: null };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA6B;AAC7B,mBAAsC;AAG/B,SAAS,sBACd,QACA,OACA,iBAAsD,SAAS,MAC/D;AAEA,QAAM,OAAO;AAqDb,QAAM,SAAK,+BAAa;AACxB,KAAG,uBAAuB,CAAC;AAC3B,QAAM,WAAW,GAAG,UAAU;AAM9B,QAAM,iBAAiB,MAAM;AAC3B,UAAM,WAAW,GAAG,SAAS,MAAM,KAAK,CAAC;AACzC,QAAI,gBAAgB;AAClB,iBAAW,MAAM,UAAU;AACzB,uBAAe,YAAY,GAAG,UAAU,IAAI,CAAC;AAAA,MAC/C;AAAA,IACF,OAAO;AACL,iBAAW,MAAM,UAAU;AACzB,iBAAS,KAAK,YAAY,EAAE;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AAOA,QAAM,cAAc,GAAG,mBAAmB,QAAQ;AAClD,MAAI,aAAa;AACf,mBAAe;AACf,WAAO;AAAA,EACT;AAGA,QAAM,kBAAkB,SAAS;AAAA,IAC/B,qDAAqD,wBAAwB;AAAA,EAC/E;AACA,MAAI,iBAAiB;AACnB,oBAAgB,YAAY,YAAY,eAAe;AAAA,EACzD;AAGA,QAAM,UAAU,SAAS,cAAc,UAAU;AACjD,UAAQ,KAAK;AACb,UAAQ,aAAa,eAAe,MAAM;AAC1C,UAAQ,aAAa,cAAc,KAAK;AACxC,QAAM,aAAa,SAAS,cAAc,UAAU;AACpD,aAAW,KAAK;AAChB,aAAW,aAAa,eAAe,MAAM;AAC7C,aAAW,aAAa,cAAc,KAAK;AAC3C,WAAS,KAAK,YAAY,UAAU;AACpC,WAAS,KAAK,YAAY,OAAO;AAGjC,QAAM,uBACJ,OAAO,KAAK,KAAK,6BAA6B,MAAM,GAAG,KAAK,CAAC,CAAC,E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N,eAAK,6BAA6B,MAAM,IAAI,EAAE;AAAA,QAChD;AAAA,MACF,CAAC;AAEH,YAAM,WAAW,CAAC;AAClB,UAAI,OAAO,QAAQ;AACnB,aAAO,QAAQ,SAAS,YAAY;AAClC,iBAAS,KAAK,IAAI;AAClB,aAAK,OAAO;AACZ,eAAO,QAAQ;AAAA,MACjB;AACA,eAAS,MAAM,IAAI;AAAA,IACrB;AAEA,mBAAe;AAGf,WAAO,KAAK;AACZ,SAAK,WAAW;AAGhB,QAAI,iBAAiB;AACnB,sBAAgB,YAAY,YAAY,eAAe;AAAA,IACzD;AAEA,YAAQ,OAAO;AACf,eAAW,OAAO;AAElB,UAAM,SAAS,EAAE,WAAW,IAAI;AAChC,OAAG,mBAAmB,QAAQ,IAAI;AAClC,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,WAAW,MAAM,KAAK,KAAK;AACtC;","names":[]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
1
|
declare function nextClientPagesLoader(bundle: string, route: string, styleContainer?: HTMLHeadElement | ShadowRoot | null): {
|
|
4
|
-
Component:
|
|
5
|
-
App:
|
|
2
|
+
Component: React.ComponentType<Record<string, unknown>> | null;
|
|
3
|
+
App: React.ComponentType<{
|
|
6
4
|
Component: React.ComponentType<Record<string, unknown>>;
|
|
7
|
-
} & Record<string, unknown>> | null
|
|
5
|
+
} & Record<string, unknown>> | null;
|
|
8
6
|
};
|
|
9
7
|
|
|
10
8
|
export { nextClientPagesLoader };
|