Unverified Commit 788e4e22 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

Avoid a Next.js DTS plugin peer dependency

Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent cceb5f49
...@@ -201,7 +201,7 @@ For CDN deployments, configure the same header on the CDN response for the manif ...@@ -201,7 +201,7 @@ For CDN deployments, configure the same header on the CDN response for the manif
## Publishing TypeScript declarations ## Publishing TypeScript declarations
A **producer** that exposes TypeScript modules can opt into the upstream Module Federation type archive and declaration API. Install the optional build-time peer in the producing app: A **producer** that exposes TypeScript modules can opt into the upstream Module Federation type archive and declaration API. Install the optional build-time package in the producing app; Next.js does not declare it as a peer dependency:
```bash ```bash
pnpm add @module-federation/dts-plugin@^2.9.0 pnpm add @module-federation/dts-plugin@^2.9.0
......
...@@ -111,7 +111,6 @@ ...@@ -111,7 +111,6 @@
"styled-jsx": "5.1.6" "styled-jsx": "5.1.6"
}, },
"peerDependencies": { "peerDependencies": {
"@module-federation/dts-plugin": "^2.9.0",
"@opentelemetry/api": "^1.1.0", "@opentelemetry/api": "^1.1.0",
"@playwright/test": "^1.51.1", "@playwright/test": "^1.51.1",
"babel-plugin-react-compiler": "*", "babel-plugin-react-compiler": "*",
...@@ -120,9 +119,6 @@ ...@@ -120,9 +119,6 @@
"sass": "^1.3.0" "sass": "^1.3.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@module-federation/dts-plugin": {
"optional": true
},
"babel-plugin-react-compiler": { "babel-plugin-react-compiler": {
"optional": true "optional": true
}, },
......
...@@ -1255,9 +1255,6 @@ importers: ...@@ -1255,9 +1255,6 @@ importers:
packages/next: packages/next:
dependencies: dependencies:
'@module-federation/dts-plugin':
specifier: ^2.9.0
version: 2.9.1(typescript@6.0.2)
'@next/env': '@next/env':
specifier: workspace:* specifier: workspace:*
version: link:../next-env version: link:../next-env
...@@ -4425,24 +4422,12 @@ packages: ...@@ -4425,24 +4422,12 @@ packages:
resolution: {integrity: sha512-d//GE8/Yh7aC3e7p+kZG8JqqEAwwDUmAfvH1quogtbk+ksS6E0RR6toKKESPYYZVre0meqkJb27zb+dhqE9Sgw==} resolution: {integrity: sha512-d//GE8/Yh7aC3e7p+kZG8JqqEAwwDUmAfvH1quogtbk+ksS6E0RR6toKKESPYYZVre0meqkJb27zb+dhqE9Sgw==}
engines: {node: '>=18'} engines: {node: '>=18'}
'@module-federation/dts-plugin@2.9.1':
resolution: {integrity: sha512-OnJQNRrjUfI1UJu+rIUzC0jl2uQcpRp/hIbMLZChSleFLlYpvvMzu/s33E7oiST421HAg9gilgYLj1WAn1SSOw==}
peerDependencies:
typescript: ^4.9.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
vue-tsc: '>=1.0.24'
peerDependenciesMeta:
vue-tsc:
optional: true
'@module-federation/error-codes@0.21.6': '@module-federation/error-codes@0.21.6':
resolution: {integrity: sha512-MLJUCQ05KnoVl8xd6xs9a5g2/8U+eWmVxg7xiBMeR0+7OjdWUbHwcwgVFatRIwSZvFgKHfWEiI7wsU1q1XbTRQ==} resolution: {integrity: sha512-MLJUCQ05KnoVl8xd6xs9a5g2/8U+eWmVxg7xiBMeR0+7OjdWUbHwcwgVFatRIwSZvFgKHfWEiI7wsU1q1XbTRQ==}
'@module-federation/error-codes@2.9.1': '@module-federation/error-codes@2.9.1':
resolution: {integrity: sha512-5lqrIZTeMiKdn4uuX/+X8uN/4C0yqI8P3WO42DNRR7B9gCA4HMDCHrrxU8odQup9bzRsN5TJSz3av6d2iNmPgA==} resolution: {integrity: sha512-5lqrIZTeMiKdn4uuX/+X8uN/4C0yqI8P3WO42DNRR7B9gCA4HMDCHrrxU8odQup9bzRsN5TJSz3av6d2iNmPgA==}
'@module-federation/managers@2.9.1':
resolution: {integrity: sha512-X20XDvkTbClfG8Ig0VQW2GcUCzLAopb7fxdrVyk3kqLVeB6fLoNLhzA8K/S5xhnkeY7YhrOxZBujMnK5wETxtA==}
'@module-federation/runtime-core@0.21.6': '@module-federation/runtime-core@0.21.6':
resolution: {integrity: sha512-5Hd1Y5qp5lU/aTiK66lidMlM/4ji2gr3EXAtJdreJzkY+bKcI5+21GRcliZ4RAkICmvdxQU5PHPL71XmNc7Lsw==} resolution: {integrity: sha512-5Hd1Y5qp5lU/aTiK66lidMlM/4ji2gr3EXAtJdreJzkY+bKcI5+21GRcliZ4RAkICmvdxQU5PHPL71XmNc7Lsw==}
...@@ -4467,9 +4452,6 @@ packages: ...@@ -4467,9 +4452,6 @@ packages:
'@module-federation/sdk@2.9.1': '@module-federation/sdk@2.9.1':
resolution: {integrity: sha512-JneBWSHr9ZCZHa5geNUleVK2vBTugWXLIXlV72UAhgHm1cTMYKZljnhRSX59n7Xssz4Yk+m+W3rYg6Eb4ouL8w==} resolution: {integrity: sha512-JneBWSHr9ZCZHa5geNUleVK2vBTugWXLIXlV72UAhgHm1cTMYKZljnhRSX59n7Xssz4Yk+m+W3rYg6Eb4ouL8w==}
'@module-federation/third-party-dts-extractor@2.9.1':
resolution: {integrity: sha512-8H3/SWPD93EHmLG0F30J0ihsGI+LpCT7xdc6YXQWX+1lkgzwJoWTwm4j+LMQRP+1OtSxrpEW5ebcKqKeTZ2B+Q==}
'@module-federation/webpack-bundler-runtime@0.21.6': '@module-federation/webpack-bundler-runtime@0.21.6':
resolution: {integrity: sha512-7zIp3LrcWbhGuFDTUMLJ2FJvcwjlddqhWGxi/MW3ur1a+HaO8v5tF2nl+vElKmbG1DFLU/52l3PElVcWf/YcsQ==} resolution: {integrity: sha512-7zIp3LrcWbhGuFDTUMLJ2FJvcwjlddqhWGxi/MW3ur1a+HaO8v5tF2nl+vElKmbG1DFLU/52l3PElVcWf/YcsQ==}
...@@ -7598,10 +7580,6 @@ packages: ...@@ -7598,10 +7580,6 @@ packages:
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
hasBin: true hasBin: true
adm-zip@0.6.0:
resolution: {integrity: sha512-XleryMhbuksdKtofnWZ9Sk+4CUTbms4Mb/EU32SZwToAyZ5RgVos/ki8n+yr0LWHOGKuakbXTuuYNHLQjhddgg==}
engines: {node: '>=14.0'}
agent-base@6.0.2: agent-base@6.0.2:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
engines: {node: '>= 6.0.0'} engines: {node: '>= 6.0.0'}
...@@ -11912,11 +11890,6 @@ packages: ...@@ -11912,11 +11890,6 @@ packages:
isomorphic-unfetch@3.0.0: isomorphic-unfetch@3.0.0:
resolution: {integrity: sha512-V0tmJSYfkKokZ5mgl0cmfQMTb7MLHsBMngTkbLY0eXvKqiVRRoZP04Ly+KhKrJfKtzC9E6Pp15Jo+bwh7Vi2XQ==} resolution: {integrity: sha512-V0tmJSYfkKokZ5mgl0cmfQMTb7MLHsBMngTkbLY0eXvKqiVRRoZP04Ly+KhKrJfKtzC9E6Pp15Jo+bwh7Vi2XQ==}
isomorphic-ws@5.0.0:
resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==}
peerDependencies:
ws: '*'
isstream@0.1.2: isstream@0.1.2:
resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}
...@@ -17105,10 +17078,6 @@ packages: ...@@ -17105,10 +17078,6 @@ packages:
resolution: {integrity: sha512-RqslV2Us5BrllB+JeiZnK4peryVTndy9Dnqq62S3yYRRTj0tFQCwEniUy2167skdGOy3vqRzEvl1Dm4sV2ReDg==} resolution: {integrity: sha512-RqslV2Us5BrllB+JeiZnK4peryVTndy9Dnqq62S3yYRRTj0tFQCwEniUy2167skdGOy3vqRzEvl1Dm4sV2ReDg==}
engines: {node: '>=20.18.1'} engines: {node: '>=20.18.1'}
undici@7.29.0:
resolution: {integrity: sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==}
engines: {node: '>=20.18.1'}
unfetch@4.2.0: unfetch@4.2.0:
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==} resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
...@@ -17836,18 +17805,6 @@ packages: ...@@ -17836,18 +17805,6 @@ packages:
utf-8-validate: utf-8-validate:
optional: true optional: true
ws@8.21.3:
resolution: {integrity: sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: '>=5.0.2'
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
xdg-app-paths@5.1.0: xdg-app-paths@5.1.0:
resolution: {integrity: sha512-RAQ3WkPf4KTU1A8RtFx3gWywzVKe00tfOPFfl2NDGqbIFENQO4kqAJp7mhQjNj/33W5x5hiWWUdyfPq/5SU3QA==} resolution: {integrity: sha512-RAQ3WkPf4KTU1A8RtFx3gWywzVKe00tfOPFfl2NDGqbIFENQO4kqAJp7mhQjNj/33W5x5hiWWUdyfPq/5SU3QA==}
engines: {node: '>=6'} engines: {node: '>=6'}
...@@ -20874,30 +20831,11 @@ snapshots: ...@@ -20874,30 +20831,11 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@module-federation/dts-plugin@2.9.1(typescript@6.0.2)':
dependencies:
'@module-federation/error-codes': 2.9.1
'@module-federation/managers': 2.9.1
'@module-federation/sdk': 2.9.1
'@module-federation/third-party-dts-extractor': 2.9.1
adm-zip: 0.6.0
isomorphic-ws: 5.0.0(ws@8.21.3)
typescript: 6.0.2
undici: 7.29.0
ws: 8.21.3
transitivePeerDependencies:
- bufferutil
- utf-8-validate
'@module-federation/error-codes@0.21.6': {} '@module-federation/error-codes@0.21.6': {}
'@module-federation/error-codes@2.9.1': '@module-federation/error-codes@2.9.1':
optional: true optional: true
'@module-federation/managers@2.9.1':
dependencies:
'@module-federation/sdk': 2.9.1
'@module-federation/runtime-core@0.21.6': '@module-federation/runtime-core@0.21.6':
dependencies: dependencies:
'@module-federation/error-codes': 0.21.6 '@module-federation/error-codes': 0.21.6
...@@ -20938,8 +20876,6 @@ snapshots: ...@@ -20938,8 +20876,6 @@ snapshots:
'@module-federation/sdk@2.9.1': '@module-federation/sdk@2.9.1':
optional: true optional: true
'@module-federation/third-party-dts-extractor@2.9.1': {}
'@module-federation/webpack-bundler-runtime@0.21.6': '@module-federation/webpack-bundler-runtime@0.21.6':
dependencies: dependencies:
'@module-federation/runtime': 0.21.6 '@module-federation/runtime': 0.21.6
...@@ -24227,8 +24163,6 @@ snapshots: ...@@ -24227,8 +24163,6 @@ snapshots:
acorn@8.8.0: {} acorn@8.8.0: {}
adm-zip@0.6.0: {}
agent-base@6.0.2(supports-color@8.1.1): agent-base@6.0.2(supports-color@8.1.1):
dependencies: dependencies:
debug: 4.1.1(supports-color@8.1.1) debug: 4.1.1(supports-color@8.1.1)
...@@ -29740,10 +29674,6 @@ snapshots: ...@@ -29740,10 +29674,6 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- encoding - encoding
isomorphic-ws@5.0.0(ws@8.21.3):
dependencies:
ws: 8.21.3
isstream@0.1.2: {} isstream@0.1.2: {}
istanbul-lib-coverage@3.2.0: {} istanbul-lib-coverage@3.2.0: {}
...@@ -36480,8 +36410,6 @@ snapshots: ...@@ -36480,8 +36410,6 @@ snapshots:
undici@7.22.0: {} undici@7.22.0: {}
undici@7.29.0: {}
unfetch@4.2.0: {} unfetch@4.2.0: {}
unherit@1.1.2: unherit@1.1.2:
...@@ -37433,8 +37361,6 @@ snapshots: ...@@ -37433,8 +37361,6 @@ snapshots:
ws@8.2.3: {} ws@8.2.3: {}
ws@8.21.3: {}
xdg-app-paths@5.1.0: xdg-app-paths@5.1.0:
dependencies: dependencies:
xdg-portable: 7.3.0 xdg-portable: 7.3.0
...@@ -123,7 +123,7 @@ describeTurbopack('producer Module Federation declarations', () => { ...@@ -123,7 +123,7 @@ describeTurbopack('producer Module Federation declarations', () => {
}) })
if (!isNextDeploy) { if (!isNextDeploy) {
it('reports missing and incompatible optional producer peers', async () => { it('reports missing and incompatible producer packages', async () => {
const projectDir = await mkdtemp(join(tmpdir(), 'next-mf-no-peer-')) const projectDir = await mkdtemp(join(tmpdir(), 'next-mf-no-peer-'))
const incompatibleDir = await mkdtemp(join(tmpdir(), 'next-mf-old-peer-')) const incompatibleDir = await mkdtemp(join(tmpdir(), 'next-mf-old-peer-'))
const options = (dir: string) => ({ const options = (dir: string) => ({
...@@ -145,14 +145,14 @@ describeTurbopack('producer Module Federation declarations', () => { ...@@ -145,14 +145,14 @@ describeTurbopack('producer Module Federation declarations', () => {
'{"metaData":{}}' '{"metaData":{}}'
) )
} }
// An ancestor of tmpdir() may already provide this optional peer on CI. // An ancestor of tmpdir() may already provide this package on CI.
const fromProject = createRequire(join(projectDir, 'package.json')) const fromProject = createRequire(join(projectDir, 'package.json'))
let hasAncestorPeer = false let hasAncestorInstallation = false
try { try {
fromProject.resolve('@module-federation/dts-plugin/package.json') fromProject.resolve('@module-federation/dts-plugin/package.json')
hasAncestorPeer = true hasAncestorInstallation = true
} catch {} } catch {}
if (hasAncestorPeer) { if (hasAncestorInstallation) {
// In CI, a valid ancestor installation is expected to resolve here. // In CI, a valid ancestor installation is expected to resolve here.
expect( expect(
( (
...@@ -166,13 +166,13 @@ describeTurbopack('producer Module Federation declarations', () => { ...@@ -166,13 +166,13 @@ describeTurbopack('producer Module Federation declarations', () => {
writeModuleFederationTypes(options(projectDir)) writeModuleFederationTypes(options(projectDir))
).rejects.toThrow('Install it in the producing app') ).rejects.toThrow('Install it in the producing app')
} }
const peerDir = join( const installationDir = join(
incompatibleDir, incompatibleDir,
'node_modules/@module-federation/dts-plugin' 'node_modules/@module-federation/dts-plugin'
) )
await mkdir(peerDir, { recursive: true }) await mkdir(installationDir, { recursive: true })
await writeFile( await writeFile(
join(peerDir, 'package.json'), join(installationDir, 'package.json'),
'{"name":"@module-federation/dts-plugin","version":"1.0.0"}' '{"name":"@module-federation/dts-plugin","version":"1.0.0"}'
) )
await expect( await expect(
...@@ -186,9 +186,9 @@ describeTurbopack('producer Module Federation declarations', () => { ...@@ -186,9 +186,9 @@ describeTurbopack('producer Module Federation declarations', () => {
} }
}) })
// A nested project has no node_modules. Its optional DTS peer lives in the // A nested project has no node_modules. Its DTS package lives in the
// ancestor app, just as it does in a hoisted monorepo installation. // ancestor app, just as it does in a hoisted monorepo installation.
it('resolves a hoisted producer DTS peer from ancestor node_modules', async () => { it('resolves a hoisted producer DTS package from ancestor node_modules', async () => {
const projectDir = join(next.testDir, 'hoisted-producer') const projectDir = join(next.testDir, 'hoisted-producer')
const distDir = join(projectDir, '.next') const distDir = join(projectDir, '.next')
await mkdir(join(distDir, 'static'), { recursive: true }) await mkdir(join(distDir, 'static'), { recursive: true })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment