@mui/internal-docs-infra 0.12.1-canary.16 → 0.12.1-canary.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-docs-infra",
3
- "version": "0.12.1-canary.16",
3
+ "version": "0.12.1-canary.17",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI Infra - internal documentation creation tools.",
6
6
  "license": "MIT",
@@ -804,5 +804,5 @@
804
804
  "bin": {
805
805
  "docs-infra": "./cli/index.mjs"
806
806
  },
807
- "gitSha": "c11419b9b49a34230751911dc3bbd5fc2764b05b"
807
+ "gitSha": "14c9893b74d335869a4479c9666c184f1a73ee06"
808
808
  }
@@ -170,12 +170,62 @@ function readCommitShaFromGit() {
170
170
  return undefined;
171
171
  }
172
172
  }
173
+
174
+ /**
175
+ * Work around https://github.com/vercel/next.js/issues/91735.
176
+ * Next.js 16.2 does not assign MDX files to the React Server Components webpack layer.
177
+ */
178
+ function patchMdxWebpackLayers(rules) {
179
+ for (const rule of rules) {
180
+ if (!rule || typeof rule !== 'object') {
181
+ continue;
182
+ }
183
+ const webpackRule = rule;
184
+
185
+ // page.mdx just verifies the regex matches MDX files
186
+ if (webpackRule.test instanceof RegExp && webpackRule.test.test('page.mdx')) {
187
+ const loaders = Array.isArray(webpackRule.use) ? webpackRule.use : [webpackRule.use];
188
+ for (const loader of loaders) {
189
+ if (!loader || typeof loader !== 'object') {
190
+ continue;
191
+ }
192
+ const webpackLoader = loader;
193
+ const {
194
+ options
195
+ } = webpackLoader;
196
+ if (typeof webpackLoader.loader === 'string' && webpackLoader.loader.includes('next-swc-loader') && options && typeof options === 'object') {
197
+ const webpackOptions = options;
198
+ if (webpackOptions.bundleLayer == null) {
199
+ webpackOptions.bundleLayer = 'rsc';
200
+ } else {
201
+ // Next.js now assigns the bundle layer itself, so this workaround is obsolete.
202
+ throw new Error('MDX webpack layer workaround is obsolete; remove patchMdxWebpackLayers (see https://github.com/vercel/next.js/issues/91735).');
203
+ }
204
+ }
205
+ }
206
+ }
207
+ if (Array.isArray(webpackRule.oneOf)) {
208
+ patchMdxWebpackLayers(webpackRule.oneOf);
209
+ }
210
+ if (Array.isArray(webpackRule.rules)) {
211
+ patchMdxWebpackLayers(webpackRule.rules);
212
+ }
213
+ }
214
+ }
173
215
  export function withDeploymentConfig(nextConfig) {
216
+ const consumerWebpack = nextConfig.webpack;
217
+ const webpack = (config, context) => {
218
+ if (context.isServer && config?.module && Array.isArray(config.module.rules)) {
219
+ patchMdxWebpackLayers(config.module.rules);
220
+ }
221
+ return consumerWebpack ? consumerWebpack(config, context) : config;
222
+ };
174
223
  return {
175
224
  trailingSlash: true,
176
225
  reactStrictMode: true,
177
226
  productionBrowserSourceMaps: true,
178
227
  ...nextConfig,
228
+ webpack,
179
229
  env: {
180
230
  // production | staging | pull-request | development
181
231
  DEPLOY_ENV,