@mui/internal-code-infra 0.0.3-canary.6 → 0.0.3-canary.60
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/README.md +55 -0
- package/build/babel-config.d.mts +40 -0
- package/build/brokenLinksChecker/index.d.mts +138 -0
- package/build/cli/cmdArgosPush.d.mts +13 -0
- package/build/cli/cmdBuild.d.mts +56 -0
- package/build/cli/cmdCopyFiles.d.mts +20 -0
- package/build/cli/cmdExtractErrorCodes.d.mts +3 -0
- package/build/cli/cmdGithubAuth.d.mts +6 -0
- package/build/cli/cmdListWorkspaces.d.mts +18 -0
- package/build/cli/cmdPublish.d.mts +27 -0
- package/build/cli/cmdPublishCanary.d.mts +30 -0
- package/build/cli/cmdPublishNewPackage.d.mts +8 -0
- package/build/cli/cmdSetVersionOverrides.d.mts +9 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -0
- package/build/cli/index.d.mts +1 -0
- package/build/eslint/baseConfig.d.mts +10 -0
- package/build/eslint/docsConfig.d.mts +4 -0
- package/build/eslint/extensions.d.mts +8 -0
- package/build/eslint/index.d.mts +4 -0
- package/build/eslint/jsonConfig.d.mts +4 -0
- package/build/eslint/material-ui/config.d.mts +8 -0
- package/build/eslint/material-ui/index.d.mts +2 -0
- package/build/eslint/material-ui/rules/disallow-active-element-as-key-event-target.d.mts +5 -0
- package/build/eslint/material-ui/rules/disallow-react-api-in-server-components.d.mts +2 -0
- package/build/eslint/material-ui/rules/docgen-ignore-before-comment.d.mts +2 -0
- package/build/eslint/material-ui/rules/mui-name-matches-component-name.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-empty-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-restricted-resolved-imports.d.mts +12 -0
- package/build/eslint/material-ui/rules/no-styled-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/rules-of-use-theme-variants.d.mts +9 -0
- package/build/eslint/material-ui/rules/straight-quotes.d.mts +5 -0
- package/build/eslint/testConfig.d.mts +14 -0
- package/build/markdownlint/duplicate-h1.d.mts +27 -0
- package/build/markdownlint/git-diff.d.mts +8 -0
- package/build/markdownlint/index.d.mts +56 -0
- package/build/markdownlint/straight-quotes.d.mts +8 -0
- package/build/markdownlint/table-alignment.d.mts +8 -0
- package/build/markdownlint/terminal-language.d.mts +8 -0
- package/build/prettier.d.mts +20 -0
- package/build/stylelint/index.d.mts +32 -0
- package/build/utils/babel.d.mts +71 -0
- package/build/utils/build.d.mts +50 -0
- package/build/utils/changelog.d.mts +64 -0
- package/build/utils/credentials.d.mts +17 -0
- package/build/utils/extractErrorCodes.d.mts +19 -0
- package/build/utils/git.d.mts +26 -0
- package/build/utils/github.d.mts +41 -0
- package/build/utils/pnpm.d.mts +238 -0
- package/build/utils/typescript.d.mts +35 -0
- package/package.json +92 -42
- package/src/babel-config.mjs +52 -8
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +22 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/example.md +9 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +21 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +17 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +26 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +5 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +19 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +24 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +28 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +19 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +31 -0
- package/src/brokenLinksChecker/index.mjs +641 -0
- package/src/brokenLinksChecker/index.test.ts +178 -0
- package/src/cli/cmdArgosPush.mjs +13 -2
- package/src/cli/cmdBuild.mjs +228 -31
- package/src/cli/cmdGithubAuth.mjs +36 -0
- package/src/cli/cmdListWorkspaces.mjs +2 -2
- package/src/cli/cmdPublish.mjs +203 -49
- package/src/cli/cmdPublishCanary.mjs +404 -46
- package/src/cli/cmdPublishNewPackage.mjs +86 -0
- package/src/cli/cmdSetVersionOverrides.mjs +17 -1
- package/src/cli/cmdValidateBuiltTypes.mjs +49 -0
- package/src/cli/index.mjs +6 -2
- package/src/cli/packageJson.d.ts +729 -0
- package/src/eslint/baseConfig.mjs +96 -78
- package/src/eslint/docsConfig.mjs +13 -13
- package/src/eslint/extensions.mjs +8 -8
- package/src/eslint/jsonConfig.mjs +40 -0
- package/src/eslint/material-ui/config.mjs +8 -9
- package/src/eslint/material-ui/rules/mui-name-matches-component-name.mjs +4 -2
- package/src/eslint/material-ui/rules/rules-of-use-theme-variants.mjs +2 -1
- package/src/eslint/testConfig.mjs +72 -66
- package/src/stylelint/index.mjs +46 -0
- package/src/untyped-plugins.d.ts +13 -0
- package/src/{cli → utils}/babel.mjs +10 -3
- package/src/utils/build.mjs +27 -1
- package/src/utils/changelog.mjs +157 -0
- package/src/utils/credentials.mjs +71 -0
- package/src/utils/extractErrorCodes.mjs +2 -2
- package/src/utils/git.mjs +67 -0
- package/src/utils/github.mjs +263 -0
- package/src/{cli → utils}/pnpm.mjs +23 -13
- package/src/{cli → utils}/typescript.mjs +13 -7
- package/src/cli/cmdJsonLint.mjs +0 -69
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits TypeScript declaration files.
|
|
3
|
+
* @param {string} tsconfig - The path to the tsconfig.json file.
|
|
4
|
+
* @param {string} outDir - The output directory for the declaration files.
|
|
5
|
+
*/
|
|
6
|
+
export function emitDeclarations(tsconfig: string, outDir: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} sourceDirectory
|
|
9
|
+
* @param {string} destinationDirectory
|
|
10
|
+
*/
|
|
11
|
+
export function copyDeclarations(sourceDirectory: string, destinationDirectory: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates TypeScript declaration files for the specified bundles.
|
|
14
|
+
* Types are first created in a temporary directory and then copied to the appropriate bundle directories parallelly.
|
|
15
|
+
* After copying, babel transformations are applied to the copied files because they need to be alongside the actual js files for proper resolution.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} param0
|
|
18
|
+
* @param {boolean} [param0.isMjsBuild] - Whether the build is for ESM (ECMAScript Modules).
|
|
19
|
+
* @param {{type: import('../utils/build.mjs').BundleType, dir: string}[]} param0.bundles - The bundles to create declarations for.
|
|
20
|
+
* @param {string} param0.srcDir - The source directory.
|
|
21
|
+
* @param {string} param0.buildDir - The build directory.
|
|
22
|
+
* @param {string} param0.cwd - The current working directory.
|
|
23
|
+
* @param {boolean} param0.skipTsc - Whether to skip running TypeScript compiler (tsc) for building types.
|
|
24
|
+
*/
|
|
25
|
+
export function createTypes({ bundles, srcDir, buildDir, cwd, skipTsc, isMjsBuild }: {
|
|
26
|
+
isMjsBuild?: boolean | undefined;
|
|
27
|
+
bundles: {
|
|
28
|
+
type: import("../utils/build.mjs").BundleType;
|
|
29
|
+
dir: string;
|
|
30
|
+
}[];
|
|
31
|
+
srcDir: string;
|
|
32
|
+
buildDir: string;
|
|
33
|
+
cwd: string;
|
|
34
|
+
skipTsc: boolean;
|
|
35
|
+
}): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.3-canary.
|
|
3
|
+
"version": "0.0.3-canary.60",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,76 +12,125 @@
|
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"exports": {
|
|
14
14
|
"./package.json": "./package.json",
|
|
15
|
-
"./
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
"./babel-config": {
|
|
16
|
+
"types": "./build/babel-config.d.mts",
|
|
17
|
+
"default": "./src/babel-config.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./changelog": {
|
|
20
|
+
"types": "./build/utils/changelog.d.mts",
|
|
21
|
+
"default": "./src/utils/changelog.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./eslint": {
|
|
24
|
+
"types": "./build/eslint/index.d.mts",
|
|
25
|
+
"default": "./src/eslint/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./github": {
|
|
28
|
+
"types": "./build/utils/github.d.mts",
|
|
29
|
+
"default": "./src/utils/github.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./markdownlint": {
|
|
32
|
+
"types": "./build/markdownlint/index.d.mts",
|
|
33
|
+
"default": "./src/markdownlint/index.mjs"
|
|
34
|
+
},
|
|
35
|
+
"./prettier": {
|
|
36
|
+
"types": "./build/prettier.d.mts",
|
|
37
|
+
"default": "./src/prettier.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./stylelint": {
|
|
40
|
+
"types": "./build/stylelint/index.d.mts",
|
|
41
|
+
"default": "./src/stylelint/index.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./brokenLinksChecker": {
|
|
44
|
+
"types": "./build/brokenLinksChecker/index.d.mts",
|
|
45
|
+
"default": "./src/brokenLinksChecker/index.mjs"
|
|
46
|
+
}
|
|
19
47
|
},
|
|
20
48
|
"bin": {
|
|
21
49
|
"code-infra": "./bin/code-infra.mjs"
|
|
22
50
|
},
|
|
23
51
|
"dependencies": {
|
|
24
|
-
"@argos-ci/core": "^4.
|
|
52
|
+
"@argos-ci/core": "^4.5.0",
|
|
25
53
|
"@babel/cli": "^7.28.3",
|
|
26
|
-
"@babel/core": "^7.28.
|
|
54
|
+
"@babel/core": "^7.28.5",
|
|
27
55
|
"@babel/plugin-syntax-jsx": "^7.27.1",
|
|
28
56
|
"@babel/plugin-syntax-typescript": "^7.27.1",
|
|
29
|
-
"@babel/plugin-transform-runtime": "^7.28.
|
|
30
|
-
"@babel/preset-env": "^7.28.
|
|
31
|
-
"@babel/preset-react": "^7.
|
|
32
|
-
"@babel/preset-typescript": "^7.
|
|
33
|
-
"@eslint/compat": "^
|
|
34
|
-
"@eslint/js": "^9.
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
57
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
58
|
+
"@babel/preset-env": "^7.28.5",
|
|
59
|
+
"@babel/preset-react": "^7.28.5",
|
|
60
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
61
|
+
"@eslint/compat": "^2.0.0",
|
|
62
|
+
"@eslint/js": "^9.39.1",
|
|
63
|
+
"@eslint/json": "^0.14.0",
|
|
64
|
+
"@inquirer/confirm": "^5.1.21",
|
|
65
|
+
"@inquirer/select": "^5.0.2",
|
|
66
|
+
"@napi-rs/keyring": "^1.2.0",
|
|
67
|
+
"@octokit/auth-action": "^6.0.2",
|
|
68
|
+
"@octokit/oauth-methods": "^6.0.2",
|
|
69
|
+
"@octokit/rest": "^22.0.1",
|
|
70
|
+
"@pnpm/find-workspace-dir": "^1000.1.3",
|
|
71
|
+
"@vitest/eslint-plugin": "^1.5.1",
|
|
39
72
|
"babel-plugin-optimize-clsx": "^2.6.2",
|
|
73
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
40
74
|
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
41
75
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
42
|
-
"babel-plugin-transform-remove-imports": "^1.8.
|
|
43
|
-
"chalk": "^5.6.
|
|
76
|
+
"babel-plugin-transform-remove-imports": "^1.8.1",
|
|
77
|
+
"chalk": "^5.6.2",
|
|
78
|
+
"clipboardy": "^5.0.1",
|
|
79
|
+
"content-type": "^1.0.5",
|
|
80
|
+
"env-ci": "^11.2.0",
|
|
44
81
|
"eslint-config-prettier": "^10.1.8",
|
|
45
82
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
46
83
|
"eslint-module-utils": "^2.12.1",
|
|
84
|
+
"eslint-plugin-compat": "^6.0.2",
|
|
47
85
|
"eslint-plugin-import": "^2.32.0",
|
|
48
86
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
49
|
-
"eslint-plugin-mocha": "^11.
|
|
87
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
50
88
|
"eslint-plugin-react": "^7.37.5",
|
|
51
89
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
52
|
-
"eslint-plugin-react-hooks": "^
|
|
53
|
-
"eslint-plugin-testing-library": "^7.
|
|
54
|
-
"execa": "^9.6.
|
|
90
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
91
|
+
"eslint-plugin-testing-library": "^7.13.3",
|
|
92
|
+
"execa": "^9.6.1",
|
|
55
93
|
"git-url-parse": "^16.1.0",
|
|
56
|
-
"globals": "^16.
|
|
57
|
-
"globby": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
94
|
+
"globals": "^16.5.0",
|
|
95
|
+
"globby": "^15.0.0",
|
|
96
|
+
"minimatch": "^10.1.1",
|
|
97
|
+
"node-html-parser": "^7.0.1",
|
|
98
|
+
"open": "^10.2.0",
|
|
99
|
+
"postcss-styled-syntax": "^0.7.1",
|
|
100
|
+
"regexp.escape": "^2.0.1",
|
|
101
|
+
"resolve-pkg-maps": "^1.0.0",
|
|
102
|
+
"semver": "^7.7.3",
|
|
103
|
+
"stylelint-config-standard": "^39.0.1",
|
|
104
|
+
"typescript-eslint": "^8.46.3",
|
|
62
105
|
"yargs": "^18.0.0",
|
|
63
|
-
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.
|
|
64
|
-
"@mui/internal-babel-plugin-
|
|
65
|
-
"@mui/internal-babel-plugin-
|
|
106
|
+
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.8",
|
|
107
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.28",
|
|
108
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.13"
|
|
66
109
|
},
|
|
67
110
|
"peerDependencies": {
|
|
111
|
+
"@next/eslint-plugin-next": "*",
|
|
68
112
|
"eslint": "^9.0.0",
|
|
69
|
-
"prettier": "
|
|
113
|
+
"prettier": "~3.5.3",
|
|
70
114
|
"typescript": "^5.0.0"
|
|
71
115
|
},
|
|
72
116
|
"devDependencies": {
|
|
117
|
+
"@octokit/types": "^16.0.0",
|
|
73
118
|
"@types/babel__core": "^7.20.5",
|
|
74
119
|
"@types/babel__preset-env": "^7.10.0",
|
|
75
|
-
"@types/
|
|
120
|
+
"@types/content-type": "^1.1.9",
|
|
121
|
+
"@types/env-ci": "^3.1.4",
|
|
122
|
+
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
76
123
|
"@types/estree": "^1.0.8",
|
|
77
124
|
"@types/estree-jsx": "^1.0.5",
|
|
78
|
-
"@types/
|
|
79
|
-
"@types/yargs": "^17.0.
|
|
80
|
-
"@typescript-eslint/parser": "^8.
|
|
81
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
82
|
-
"eslint": "^9.
|
|
83
|
-
"
|
|
84
|
-
"
|
|
125
|
+
"@types/regexp.escape": "^2.0.0",
|
|
126
|
+
"@types/yargs": "^17.0.35",
|
|
127
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
128
|
+
"@typescript-eslint/rule-tester": "^8.46.3",
|
|
129
|
+
"eslint": "^9.39.1",
|
|
130
|
+
"get-port": "^7.1.0",
|
|
131
|
+
"prettier": "~3.7.4",
|
|
132
|
+
"serve": "^14.2.5",
|
|
133
|
+
"typescript-eslint": "^8.46.3"
|
|
85
134
|
},
|
|
86
135
|
"files": [
|
|
87
136
|
"bin",
|
|
@@ -93,8 +142,9 @@
|
|
|
93
142
|
"publishConfig": {
|
|
94
143
|
"access": "public"
|
|
95
144
|
},
|
|
96
|
-
"gitSha": "
|
|
145
|
+
"gitSha": "6b3d5d685430c855b51214a5a6d756d3207380eb",
|
|
97
146
|
"scripts": {
|
|
147
|
+
"build": "tsc -p tsconfig.build.json",
|
|
98
148
|
"typescript": "tsc -p tsconfig.json",
|
|
99
149
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
|
100
150
|
"test:copy": "rm -rf build && node bin/code-infra.mjs copy-files --glob \"src/cli/*.mjs\" --glob \"src/eslint/**/*.mjs:esm\""
|
package/src/babel-config.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import presetTypescript from '@babel/preset-typescript';
|
|
|
5
5
|
import pluginDisplayName from '@mui/internal-babel-plugin-display-name';
|
|
6
6
|
import pluginResolveImports from '@mui/internal-babel-plugin-resolve-imports';
|
|
7
7
|
import pluginOptimizeClsx from 'babel-plugin-optimize-clsx';
|
|
8
|
+
import pluginReactCompiler from 'babel-plugin-react-compiler';
|
|
8
9
|
import pluginTransformInlineEnvVars from 'babel-plugin-transform-inline-environment-variables';
|
|
9
10
|
import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-types';
|
|
10
11
|
|
|
@@ -13,20 +14,24 @@ import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-type
|
|
|
13
14
|
* @param {boolean} [param0.debug]
|
|
14
15
|
* @param {boolean} [param0.optimizeClsx]
|
|
15
16
|
* @param {boolean} [param0.removePropTypes]
|
|
16
|
-
* @param {boolean} [param0.
|
|
17
|
+
* @param {boolean} [param0.noResolveImports]
|
|
17
18
|
* @param {'cjs' | 'esm'} param0.bundle
|
|
18
19
|
* @param {string | null} param0.outExtension - Specify the output file extension.
|
|
19
20
|
* @param {string} param0.runtimeVersion
|
|
21
|
+
* @param {string} [param0.reactCompilerReactVersion]
|
|
22
|
+
* @param {string} [param0.reactCompilerMode]
|
|
20
23
|
* @returns {import('@babel/core').TransformOptions} The base Babel configuration.
|
|
21
24
|
*/
|
|
22
25
|
export function getBaseConfig({
|
|
23
26
|
debug = false,
|
|
24
27
|
optimizeClsx = false,
|
|
25
28
|
removePropTypes = false,
|
|
26
|
-
|
|
29
|
+
noResolveImports = false,
|
|
27
30
|
bundle,
|
|
28
31
|
runtimeVersion,
|
|
29
32
|
outExtension,
|
|
33
|
+
reactCompilerReactVersion,
|
|
34
|
+
reactCompilerMode,
|
|
30
35
|
}) {
|
|
31
36
|
/**
|
|
32
37
|
* @type {import('@babel/preset-env').Options}
|
|
@@ -67,6 +72,24 @@ export function getBaseConfig({
|
|
|
67
72
|
],
|
|
68
73
|
];
|
|
69
74
|
|
|
75
|
+
if (reactCompilerReactVersion) {
|
|
76
|
+
/**
|
|
77
|
+
* @typedef {import('babel-plugin-react-compiler').PluginOptions} ReactCompilerOptions
|
|
78
|
+
*/
|
|
79
|
+
/** @type {ReactCompilerOptions} */
|
|
80
|
+
const reactCompilerOptions = {
|
|
81
|
+
target: /** @type {ReactCompilerOptions["target"]} */ (
|
|
82
|
+
reactCompilerReactVersion.split('.')[0] // comes from the package's peerDependencies
|
|
83
|
+
),
|
|
84
|
+
enableReanimatedCheck: false,
|
|
85
|
+
compilationMode: reactCompilerMode ?? 'annotation',
|
|
86
|
+
// Skip components with errors instead of failing the build
|
|
87
|
+
panicThreshold: 'none',
|
|
88
|
+
};
|
|
89
|
+
// The plugin must be the first one to run
|
|
90
|
+
plugins.unshift([pluginReactCompiler, reactCompilerOptions, 'babel-plugin-react-compiler']);
|
|
91
|
+
}
|
|
92
|
+
|
|
70
93
|
if (removePropTypes) {
|
|
71
94
|
plugins.push([
|
|
72
95
|
pluginRemovePropTypes,
|
|
@@ -81,7 +104,7 @@ export function getBaseConfig({
|
|
|
81
104
|
plugins.push([pluginOptimizeClsx, {}, 'babel-plugin-optimize-clsx']);
|
|
82
105
|
}
|
|
83
106
|
|
|
84
|
-
if (bundle === 'esm' && !
|
|
107
|
+
if (bundle === 'esm' && !noResolveImports) {
|
|
85
108
|
plugins.push([
|
|
86
109
|
pluginResolveImports,
|
|
87
110
|
{ outExtension },
|
|
@@ -119,20 +142,41 @@ export function getBaseConfig({
|
|
|
119
142
|
}
|
|
120
143
|
|
|
121
144
|
/**
|
|
122
|
-
* @
|
|
145
|
+
* @typedef {Object} Options
|
|
146
|
+
* @prop {'esm' | 'cjs'} [Options.bundle]
|
|
147
|
+
* @prop {boolean} [Options.noResolveImports]
|
|
148
|
+
* @prop {undefined} [options.env]
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {import('@babel/core').ConfigAPI | Options} api
|
|
153
|
+
* @returns {import('@babel/core').TransformOptions}
|
|
123
154
|
*/
|
|
124
155
|
export default function getBabelConfig(api) {
|
|
125
|
-
|
|
126
|
-
|
|
156
|
+
/** @type {'esm' | 'cjs'} */
|
|
157
|
+
let bundle;
|
|
158
|
+
/** @type {boolean} */
|
|
159
|
+
let noResolveImports;
|
|
160
|
+
|
|
161
|
+
if (api.env) {
|
|
162
|
+
// legacy
|
|
163
|
+
bundle = api.env(['regressions', 'stable']) ? 'esm' : 'cjs';
|
|
164
|
+
noResolveImports = api.env('test') || process.env.NODE_ENV === 'test';
|
|
165
|
+
} else {
|
|
166
|
+
bundle = api.bundle || 'esm';
|
|
167
|
+
noResolveImports = api.noResolveImports || false;
|
|
168
|
+
}
|
|
127
169
|
|
|
128
170
|
return getBaseConfig({
|
|
129
171
|
debug: process.env.MUI_BUILD_VERBOSE === 'true',
|
|
130
|
-
bundle
|
|
172
|
+
bundle,
|
|
131
173
|
outExtension: process.env.MUI_OUT_FILE_EXTENSION || null,
|
|
132
174
|
// any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
|
|
133
175
|
runtimeVersion: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
|
|
134
176
|
optimizeClsx: process.env.MUI_OPTIMIZE_CLSX === 'true',
|
|
135
177
|
removePropTypes: process.env.MUI_REMOVE_PROP_TYPES === 'true',
|
|
136
|
-
|
|
178
|
+
noResolveImports,
|
|
179
|
+
reactCompilerReactVersion: process.env.MUI_REACT_COMPILER_REACT_VERSION,
|
|
180
|
+
reactCompilerMode: process.env.MUI_REACT_COMPILER_MODE,
|
|
137
181
|
});
|
|
138
182
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with Broken Links</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with Broken Links</h1>
|
|
10
|
+
<p>This page contains links to non-existent pages.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home (valid)</a></li>
|
|
14
|
+
<li><a href="/does-not-exist.html">This page does not exist</a></li>
|
|
15
|
+
<li><a href="/another-missing-page.html">Another missing page</a></li>
|
|
16
|
+
<li><a href="/valid.html">Valid link</a></li>
|
|
17
|
+
</ul>
|
|
18
|
+
</nav>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with Broken Targets</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with Broken Targets</h1>
|
|
10
|
+
<p>This page contains links to valid pages but with invalid hash targets.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home (valid)</a></li>
|
|
14
|
+
<li><a href="/with-anchors.html#section1">Valid anchor</a></li>
|
|
15
|
+
<li><a href="/with-anchors.html#nonexistent">Non-existent anchor</a></li>
|
|
16
|
+
<li><a href="/valid.html#missing-target">Valid page, missing target</a></li>
|
|
17
|
+
<li><a href="/with-anchors.html#section2">Another valid anchor</a></li>
|
|
18
|
+
<li><a href="/with-anchors.html#also-missing">Also missing</a></li>
|
|
19
|
+
</ul>
|
|
20
|
+
</nav>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with External Links</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with External Links</h1>
|
|
10
|
+
<p>This page contains external links that should be ignored.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home (valid internal)</a></li>
|
|
14
|
+
<li><a href="https://example.com">External link 1</a></li>
|
|
15
|
+
<li><a href="https://github.com/mui">External link 2</a></li>
|
|
16
|
+
<li><a href="http://localhost:9999/fake">External localhost</a></li>
|
|
17
|
+
<li><a href="/valid.html">Valid internal link</a></li>
|
|
18
|
+
</ul>
|
|
19
|
+
</nav>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Ignored Page</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Ignored Page</h1>
|
|
10
|
+
<p>This page should be ignored by the crawler.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/this-link-should-not-be-checked.html">Should not be checked</a></li>
|
|
14
|
+
</ul>
|
|
15
|
+
</nav>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Test Site Home</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Test Site Home</h1>
|
|
10
|
+
<nav>
|
|
11
|
+
<ul>
|
|
12
|
+
<li><a href="/valid.html">Valid Page</a></li>
|
|
13
|
+
<li><a href="/with-anchors.html">Page with Anchors</a></li>
|
|
14
|
+
<li><a href="/broken-links.html">Page with Broken Links</a></li>
|
|
15
|
+
<li><a href="/broken-targets.html">Page with Broken Targets</a></li>
|
|
16
|
+
<li><a href="/external-links.html">Page with External Links</a></li>
|
|
17
|
+
<li><a href="/nested/page.html">Nested Page</a></li>
|
|
18
|
+
<li><a href="/ignored-page.html">Ignored Page</a></li>
|
|
19
|
+
<li><a href="/page-with-ignored-content.html">Page with Ignored Content</a></li>
|
|
20
|
+
<li><a href="/page-with-custom-targets.html">Page with Custom Targets</a></li>
|
|
21
|
+
<li><a href="/page-with-known-target-links.html">Page with Known Target Links</a></li>
|
|
22
|
+
<li><a href="/page-with-api-links.html">Page with API Links</a></li>
|
|
23
|
+
</ul>
|
|
24
|
+
</nav>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Nested Page</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Nested Page</h1>
|
|
10
|
+
<p>This is a page in a nested directory.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home</a></li>
|
|
14
|
+
<li><a href="/valid.html">Valid page</a></li>
|
|
15
|
+
<li><a href="/with-anchors.html#section1">Link to anchor</a></li>
|
|
16
|
+
</ul>
|
|
17
|
+
</nav>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Orphaned Page</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Orphaned Page</h1>
|
|
10
|
+
<p>This page is not linked from anywhere and can only be discovered via seedUrls.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/valid.html">Valid Page</a></li>
|
|
14
|
+
<li><a href="/valid.html/">Valid Page with trailing slash</a></li>
|
|
15
|
+
<li><a href="/orphaned-broken-link.html">Broken link from orphaned page</a></li>
|
|
16
|
+
<li><a href="/example.md">Markdown file with HTML snippet</a></li>
|
|
17
|
+
</ul>
|
|
18
|
+
</nav>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with API Links</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with API Links</h1>
|
|
10
|
+
<p>This page links to API documentation with known targets.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home</a></li>
|
|
14
|
+
<li><a href="/api-page.html#method1">API Method 1 (known)</a></li>
|
|
15
|
+
<li><a href="/api-page.html#method2">API Method 2 (known)</a></li>
|
|
16
|
+
<li><a href="/api-page.html#unknown-method">Unknown API method</a></li>
|
|
17
|
+
</ul>
|
|
18
|
+
</nav>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with Custom Targets</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with Custom Targets</h1>
|
|
10
|
+
<nav>
|
|
11
|
+
<ul>
|
|
12
|
+
<li><a href="/">Home</a></li>
|
|
13
|
+
<li><a href="#custom-id">Link to custom ID</a></li>
|
|
14
|
+
<li><a href="#__should-be-ignored">Link to ignored ID</a></li>
|
|
15
|
+
</ul>
|
|
16
|
+
</nav>
|
|
17
|
+
<section id="custom-id">
|
|
18
|
+
<h2>Custom ID Section</h2>
|
|
19
|
+
</section>
|
|
20
|
+
<section id="__should-be-ignored">
|
|
21
|
+
<h2>This target should be ignored</h2>
|
|
22
|
+
</section>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with Ignored Content</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with Ignored Content</h1>
|
|
10
|
+
<nav>
|
|
11
|
+
<ul>
|
|
12
|
+
<li><a href="/">Home</a></li>
|
|
13
|
+
</ul>
|
|
14
|
+
</nav>
|
|
15
|
+
<aside class="sidebar">
|
|
16
|
+
<h2>Sidebar (should be ignored)</h2>
|
|
17
|
+
<ul>
|
|
18
|
+
<li><a href="/sidebar-broken-link.html">Broken link in sidebar</a></li>
|
|
19
|
+
</ul>
|
|
20
|
+
</aside>
|
|
21
|
+
<main>
|
|
22
|
+
<p>Main content</p>
|
|
23
|
+
<p>
|
|
24
|
+
<a href="/broken-link-with-sidebar-class.html" class="sidebar">Link with sidebar class directly</a>
|
|
25
|
+
</p>
|
|
26
|
+
</main>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Page with Known Target Links</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Page with Known Target Links</h1>
|
|
10
|
+
<p>This page links to external pages with known targets.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home</a></li>
|
|
14
|
+
<li><a href="/external-page.html#valid-target">Valid external target</a></li>
|
|
15
|
+
<li><a href="/external-page.html#invalid-target">Invalid external target</a></li>
|
|
16
|
+
</ul>
|
|
17
|
+
</nav>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Valid Page</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>Valid Page</h1>
|
|
10
|
+
<p>This page has only valid internal links.</p>
|
|
11
|
+
<nav>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><a href="/">Home</a></li>
|
|
14
|
+
<li><a href="/with-anchors.html#section1">Link to section 1</a></li>
|
|
15
|
+
<li><a href="/with-anchors.html#section2">Link to section 2</a></li>
|
|
16
|
+
<li><a href="/nested/page.html">Nested page</a></li>
|
|
17
|
+
</ul>
|
|
18
|
+
</nav>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|