@mui/internal-docs-infra 0.2.3-canary.4 → 0.2.3-canary.6

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,2 @@
1
- export * from "./withDocsInfra.js";
1
+ export * from "./withDocsInfra.js";
2
+ export * from "./withDeploymentConfig.js";
@@ -1 +1,2 @@
1
- export * from "./withDocsInfra.js";
1
+ export * from "./withDocsInfra.js";
2
+ export * from "./withDeploymentConfig.js";
@@ -0,0 +1,2 @@
1
+ import type { NextConfig } from 'next';
2
+ export declare function withDeploymentConfig<T extends NextConfig>(nextConfig: T): T;
@@ -0,0 +1,70 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /**
3
+ * See the docs of the Netlify environment variables:
4
+ * https://docs.netlify.com/configure-builds/environment-variables/#build-metadata.
5
+ *
6
+ * A few comments:
7
+ * - process.env.CONTEXT === 'production' means that the branch in Netlify was configured as production.
8
+ * For example, the `master` branch of the Core team is considered a `production` build on Netlify based
9
+ * on https://app.netlify.com/sites/material-ui/settings/deploys#branches.
10
+ * - Each team has different site https://app.netlify.com/teams/mui/sites.
11
+ * The following logic must be compatible with all of them.
12
+ */
13
+ var DEPLOY_ENV = 'development';
14
+
15
+ // Same as process.env.PULL_REQUEST_ID
16
+ if (process.env.CONTEXT === 'deploy-preview') {
17
+ DEPLOY_ENV = 'pull-request';
18
+ }
19
+ if (process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-deploy') {
20
+ DEPLOY_ENV = 'production';
21
+ }
22
+
23
+ // The 'master' and 'next' branches are NEVER a production environment. We use these branches for staging.
24
+ if ((process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-deploy') && (process.env.HEAD === 'master' || process.env.HEAD === 'next')) {
25
+ DEPLOY_ENV = 'staging';
26
+ }
27
+ /**
28
+ * ====================================================================================
29
+ */
30
+
31
+ process.env.DEPLOY_ENV = DEPLOY_ENV;
32
+ export function withDeploymentConfig(nextConfig) {
33
+ return _extends(_extends({
34
+ trailingSlash: true,
35
+ reactStrictMode: true
36
+ }, nextConfig), {}, {
37
+ env: _extends(_extends({
38
+ // production | staging | pull-request | development
39
+ DEPLOY_ENV: DEPLOY_ENV
40
+ }, nextConfig.env), {}, {
41
+ // https://docs.netlify.com/configure-builds/environment-variables/#git-metadata
42
+ // reference ID (also known as "SHA" or "hash") of the commit we're building.
43
+ COMMIT_REF: process.env.COMMIT_REF,
44
+ // ID of the PR and the Deploy Preview it generated (for example, 1211)
45
+ PULL_REQUEST_ID: process.env.REVIEW_ID,
46
+ // This can be set manually in the .env to see the ads in dev mode.
47
+ ENABLE_AD_IN_DEV_MODE: process.env.ENABLE_AD_IN_DEV_MODE,
48
+ // URL representing the unique URL for an individual deploy, e.g.
49
+ // https://5b243e66dd6a547b4fee73ae--petsof.netlify.app
50
+ SITE_DEPLOY_URL: process.env.DEPLOY_URL,
51
+ // Name of the site, its Netlify subdomain; for example, material-ui-docs
52
+ SITE_NAME: process.env.SITE_NAME,
53
+ // For template images
54
+ TEMPLATE_IMAGE_URL: ''
55
+ }),
56
+ experimental: _extends(_extends({
57
+ scrollRestoration: true,
58
+ workerThreads: false
59
+ }, process.env.CI ? {
60
+ cpus: 2
61
+ } : {}), nextConfig.experimental),
62
+ eslint: _extends({
63
+ ignoreDuringBuilds: true
64
+ }, nextConfig.eslint),
65
+ typescript: _extends({
66
+ // Motivated by https://github.com/vercel/next.js/issues/7687
67
+ ignoreBuildErrors: true
68
+ }, nextConfig.typescript)
69
+ });
70
+ }
@@ -1,18 +1,5 @@
1
- import type { Configuration as WebpackConfig, RuleSetRule } from 'webpack';
2
- export interface NextConfig {
3
- pageExtensions?: string[];
4
- output?: 'export' | 'standalone' | undefined;
5
- turbopack?: {
6
- rules?: Record<string, {
7
- loaders: {
8
- loader: string;
9
- options: Record<string, unknown>;
10
- }[] | string[];
11
- }>;
12
- };
13
- webpack?: (config: WebpackConfig, options: WebpackOptions) => WebpackConfig;
14
- [key: string]: any;
15
- }
1
+ import type { NextConfig } from 'next';
2
+ import type { RuleSetRule } from 'webpack';
16
3
  export interface WebpackOptions {
17
4
  buildId: string;
18
5
  dev: boolean;
@@ -1,8 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
- // Define minimal NextConfig type to avoid importing from 'next'
5
-
6
4
  // Define webpack options interface based on Next.js webpack function signature
7
5
 
8
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-docs-infra",
3
- "version": "0.2.3-canary.4",
3
+ "version": "0.2.3-canary.6",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI Infra - internal documentation creation tools.",
6
6
  "keywords": [
@@ -45,6 +45,9 @@
45
45
  "peerDependenciesMeta": {
46
46
  "@types/react": {
47
47
  "optional": true
48
+ },
49
+ "next": {
50
+ "optional": true
48
51
  }
49
52
  },
50
53
  "publishConfig": {
@@ -53,7 +56,7 @@
53
56
  "engines": {
54
57
  "node": ">=22.12.0"
55
58
  },
56
- "gitSha": "4d51789a03dc4370bffac554cd147e3972c4cb9c",
59
+ "gitSha": "7792c854384c026e3a5209fc0711ffdac50640ff",
57
60
  "type": "commonjs",
58
61
  "exports": {
59
62
  "./package.json": "./package.json",