@mui/internal-code-infra 0.0.4-canary.99 → 0.1.1-canary.1
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 +4 -0
- package/build/babel-config.d.mts +4 -4
- package/build/babelPluginInlineEnvironmentVariables.d.mts +11 -0
- package/build/cli/cmdBuild.d.mts +1 -1
- package/build/cli/cmdListWorkspaces.d.mts +2 -2
- package/build/eslint/testConfig.d.mts +1 -7
- package/build/utils/build.d.mts +0 -15
- package/build/utils/extractErrorCodes.d.mts +7 -0
- package/build/utils/pnpm.d.mts +60 -3
- package/build/utils/typescript.d.mts +2 -2
- package/package.json +52 -53
- package/src/babel-config.mjs +32 -11
- package/src/babelPluginInlineEnvironmentVariables.mjs +45 -0
- package/src/brokenLinksChecker/index.mjs +3 -3
- package/src/cli/cmdArgosPush.mjs +2 -4
- package/src/cli/cmdBuild.mjs +8 -9
- package/src/cli/cmdCopyFiles.mjs +3 -3
- package/src/cli/cmdListWorkspaces.mjs +3 -31
- package/src/cli/cmdPublish.mjs +23 -29
- package/src/cli/cmdRenameScope.mjs +2 -1
- package/src/cli/cmdSetVersionOverrides.mjs +32 -25
- package/src/cli/cmdVale.mjs +3 -6
- package/src/cli/cmdValidateBuiltTypes.mjs +3 -4
- package/src/eslint/testConfig.mjs +3 -31
- package/src/untyped-plugins.d.ts +11 -49
- package/src/utils/build.mjs +0 -39
- package/src/utils/extractErrorCodes.mjs +12 -7
- package/src/utils/pnpm.mjs +211 -11
- package/src/utils/typescript.mjs +60 -42
package/README.md
CHANGED
|
@@ -70,3 +70,7 @@ pnpm code-infra publish-new-package --otp=123456
|
|
|
70
70
|
7. Finally, save the changes by clicking on `Update Package Settings` button.
|
|
71
71
|
|
|
72
72
|
After following these steps, the `Publish` workflow can be invoked again.
|
|
73
|
+
|
|
74
|
+
## Agent skills
|
|
75
|
+
|
|
76
|
+
The agent skills previously shipped with this package now live at the repository root. See [Install instructions](../../README.md#agent-skills).
|
package/build/babel-config.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ export type ReactCompilationMode = 'annotation' | 'syntax' | 'infer' | 'all';
|
|
|
14
14
|
* @param {string} [param0.reactCompilerReactVersion]
|
|
15
15
|
* @param {ReactCompilationMode} [param0.reactCompilerMode]
|
|
16
16
|
* @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
|
|
17
|
-
* @returns {import('@babel/core').
|
|
17
|
+
* @returns {import('@babel/core').InputOptions} The base Babel configuration.
|
|
18
18
|
*/
|
|
19
19
|
export declare function getBaseConfig({ debug, optimizeClsx, removePropTypes, noResolveImports, bundle, runtimeVersion, outExtension, reactCompilerReactVersion, reactCompilerMode, displayName, }: {
|
|
20
20
|
debug?: boolean;
|
|
@@ -29,7 +29,7 @@ export declare function getBaseConfig({ debug, optimizeClsx, removePropTypes, no
|
|
|
29
29
|
displayName?: {
|
|
30
30
|
allowedCallees?: Record<string, string[]>;
|
|
31
31
|
};
|
|
32
|
-
}): import('@babel/core').
|
|
32
|
+
}): import('@babel/core').InputOptions;
|
|
33
33
|
export type Options = {
|
|
34
34
|
bundle?: 'esm' | 'cjs';
|
|
35
35
|
noResolveImports?: boolean;
|
|
@@ -43,6 +43,6 @@ export type Options = {
|
|
|
43
43
|
*/
|
|
44
44
|
/**
|
|
45
45
|
* @param {import('@babel/core').ConfigAPI | Options} api
|
|
46
|
-
* @returns {import('@babel/core').
|
|
46
|
+
* @returns {import('@babel/core').InputOptions}
|
|
47
47
|
*/
|
|
48
|
-
export default function getBabelConfig(api: import('@babel/core').ConfigAPI | Options): import('@babel/core').
|
|
48
|
+
export default function getBabelConfig(api: import('@babel/core').ConfigAPI | Options): import('@babel/core').InputOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inlines `process.env.X` member expressions with their build-time value.
|
|
3
|
+
*
|
|
4
|
+
* Forked from `babel-plugin-transform-inline-environment-variables` (unmaintained, last
|
|
5
|
+
* published 2022) because it calls the now-removed `NodePath#toComputedKey()` under Babel 8's
|
|
6
|
+
* `@babel/traverse`. Behavior is otherwise identical to the upstream plugin.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('@babel/core').PluginAPI} api
|
|
9
|
+
* @returns {import('@babel/core').PluginObject}
|
|
10
|
+
*/
|
|
11
|
+
export default function babelPluginInlineEnvironmentVariables({ types: t }: import('@babel/core').PluginAPI): import('@babel/core').PluginObject;
|
package/build/cli/cmdBuild.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export type Args = {
|
|
|
8
8
|
/**
|
|
9
9
|
* - Output format (name, path, or json)
|
|
10
10
|
*/
|
|
11
|
-
output?: 'json' | 'path' | 'name'
|
|
11
|
+
output?: 'json' | 'path' | 'name';
|
|
12
12
|
/**
|
|
13
13
|
* - Git reference to filter changes since
|
|
14
14
|
*/
|
|
@@ -21,7 +21,7 @@ export type Args = {
|
|
|
21
21
|
/**
|
|
22
22
|
* @typedef {Object} Args
|
|
23
23
|
* @property {boolean} [publicOnly] - Whether to filter to only public packages
|
|
24
|
-
* @property {'json'|'path'|'name'
|
|
24
|
+
* @property {'json'|'path'|'name'} [output] - Output format (name, path, or json)
|
|
25
25
|
* @property {string} [sinceRef] - Git reference to filter changes since
|
|
26
26
|
* @property {string[]} [filter] - Same as filtering packages with --filter in pnpm. Only include packages matching the filter. See https://pnpm.io/filtering.
|
|
27
27
|
*/
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const baseSpecRules: import('eslint').Linter.Config;
|
|
5
5
|
/**
|
|
6
|
-
* @param {Object} [options]
|
|
7
|
-
* @param {boolean} [options.useMocha]
|
|
8
|
-
* @param {boolean} [options.useVitest]
|
|
9
6
|
* @returns {import('eslint').Linter.Config[]}
|
|
10
7
|
*/
|
|
11
|
-
export declare function createTestConfig(
|
|
12
|
-
useMocha?: boolean;
|
|
13
|
-
useVitest?: boolean;
|
|
14
|
-
}): import('eslint').Linter.Config[];
|
|
8
|
+
export declare function createTestConfig(): import('eslint').Linter.Config[];
|
package/build/utils/build.d.mts
CHANGED
|
@@ -107,18 +107,3 @@ export declare function markFn<F extends () => Promise<any>>(label: string, fn:
|
|
|
107
107
|
* @param {string} label
|
|
108
108
|
*/
|
|
109
109
|
export declare function measureFn(label: string): PerformanceMeasure;
|
|
110
|
-
/**
|
|
111
|
-
* A utility to map a function over an array of items in a worker pool.
|
|
112
|
-
*
|
|
113
|
-
* This function will create a pool of workers and distribute the items to be processed among them.
|
|
114
|
-
* Each worker will process items sequentially, but multiple workers will run in parallel.
|
|
115
|
-
*
|
|
116
|
-
* @function
|
|
117
|
-
* @template T
|
|
118
|
-
* @template R
|
|
119
|
-
* @param {T[]} items
|
|
120
|
-
* @param {(item: T) => Promise<R>} mapper
|
|
121
|
-
* @param {number} concurrency
|
|
122
|
-
* @returns {Promise<(R|Error)[]>}
|
|
123
|
-
*/
|
|
124
|
-
export declare function mapConcurrently<T, R>(items: T[], mapper: (item: T) => Promise<R>, concurrency: number): Promise<(R | Error)[]>;
|
|
@@ -12,6 +12,13 @@ export type Args = {
|
|
|
12
12
|
*/
|
|
13
13
|
detection?: import('@mui/internal-babel-plugin-minify-errors').Options['detection'];
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Extracts error codes from all files in a directory.
|
|
17
|
+
* @param {string[]} files
|
|
18
|
+
* @param {Set<string | Error>} errors
|
|
19
|
+
* @param {import('@mui/internal-babel-plugin-minify-errors').Options['detection']} [detection='opt-in']
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractErrorCodesForFiles(files: string[], errors: Set<string | Error>, detection?: import('@mui/internal-babel-plugin-minify-errors').Options['detection']): Promise<void>;
|
|
15
22
|
/**
|
|
16
23
|
* Extracts error codes from all workspace packages.
|
|
17
24
|
* @param {Args} args
|
package/build/utils/pnpm.d.mts
CHANGED
|
@@ -112,6 +112,16 @@ export declare function getWorkspacePackages(options?: GetWorkspacePackagesOptio
|
|
|
112
112
|
* @returns {Promise<string>} Normalized registry URL, ending in a slash
|
|
113
113
|
*/
|
|
114
114
|
export declare function getPublishRegistry(packagePath: string): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Get the version to release from the workspace-root package.json.
|
|
117
|
+
*
|
|
118
|
+
* Resolves the workspace root so the version is the monorepo's regardless of
|
|
119
|
+
* which directory publish runs from.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} [cwd] - Directory to resolve the workspace root from
|
|
122
|
+
* @returns {Promise<string | null>} Version string, or null when absent/invalid
|
|
123
|
+
*/
|
|
124
|
+
export declare function getReleaseVersion(cwd?: string): Promise<string | null>;
|
|
115
125
|
/**
|
|
116
126
|
* Filter to the packages that must be published by hand before CI can take over.
|
|
117
127
|
*
|
|
@@ -253,18 +263,65 @@ export declare function writeOverridesToWorkspace(workspaceDir: string, override
|
|
|
253
263
|
*/
|
|
254
264
|
export declare function renameWorkspaceScope(packages: (PublicPackage | PrivatePackage)[], fromScope: string, toScope: string): Promise<Map<string, string>>;
|
|
255
265
|
/**
|
|
256
|
-
*
|
|
266
|
+
* Pick the version to pin for a specifier whose newest match is too recent to
|
|
267
|
+
* satisfy a `minimumReleaseAge` cooldown.
|
|
268
|
+
*
|
|
269
|
+
* Only the three specifier shapes this tool is given are handled. An exact
|
|
270
|
+
* version is not a choice, so it stands and the install reports it. A range
|
|
271
|
+
* resolves within itself. A dist-tag repoints to the highest aged-in version
|
|
272
|
+
* sharing the major and prerelease-ness — except `latest`, which pnpm allows to
|
|
273
|
+
* cross majors. Unlike pnpm, a deprecated version is not passed over: `pnpm info`
|
|
274
|
+
* lists bare version strings, so that flag would cost a request per candidate.
|
|
275
|
+
*
|
|
276
|
+
* @param {string} requested - The specifier as given: a dist-tag, range or exact version
|
|
277
|
+
* @param {string} resolvedVersion - Version the specifier resolves to today
|
|
278
|
+
* @param {string[]} versions - Every published version, from `pnpm info <pkg> versions`
|
|
279
|
+
* @param {Record<string, string>} publishTimes - Version to ISO publish date, from `pnpm info <pkg> time`
|
|
280
|
+
* @param {number} cutoff - Epoch ms; versions published after this are too recent
|
|
281
|
+
* @param {string[]} [exemptVersions] - Versions `minimumReleaseAgeExclude` installs regardless of age
|
|
282
|
+
* @returns {string | null} Version to pin, or null when nothing qualifies
|
|
283
|
+
* @internal exported for unit tests
|
|
284
|
+
*/
|
|
285
|
+
export declare function selectAgedVersion(requested: string, resolvedVersion: string, versions: string[], publishTimes: Record<string, string>, cutoff: number, exemptVersions?: string[]): string | null;
|
|
286
|
+
/**
|
|
287
|
+
* Read the effective pnpm configuration, including everything resolved from
|
|
288
|
+
* pnpm-workspace.yaml. `config list` types the values and omits unset keys,
|
|
289
|
+
* where `config get` stringifies everything and prints `undefined`.
|
|
290
|
+
*
|
|
291
|
+
* @returns {Promise<Record<string, any>>} Parsed configuration
|
|
292
|
+
*/
|
|
293
|
+
export declare function readPnpmConfig(): Promise<Record<string, any>>;
|
|
294
|
+
/**
|
|
295
|
+
* Read the registry cooldown from pnpm config, so resolution stays in step with
|
|
296
|
+
* what the subsequent install will enforce.
|
|
297
|
+
*
|
|
298
|
+
* @returns {Promise<import('@pnpm/config.version-policy').PublishedByPolicy>} Cutoff date and exemption policy, both undefined when no cooldown is configured
|
|
299
|
+
*/
|
|
300
|
+
export declare function getMinimumReleaseAgePolicy(): Promise<import('@pnpm/config.version-policy').PublishedByPolicy>;
|
|
301
|
+
/**
|
|
302
|
+
* Resolve a package@version specifier to an exact version.
|
|
303
|
+
*
|
|
304
|
+
* Given a cooldown policy, the result is the newest version the install will
|
|
305
|
+
* actually accept — a dist-tag on a daily channel always points at a build too
|
|
306
|
+
* recent to install under one. See {@link selectAgedVersion}.
|
|
307
|
+
*
|
|
257
308
|
* @param {string} packageSpec - Package specifier in format "package@version"
|
|
309
|
+
* @param {import('@pnpm/config.version-policy').PublishedByPolicy} policy - Cooldown from {@link getMinimumReleaseAgePolicy}
|
|
258
310
|
* @returns {Promise<string>} Exact version string
|
|
259
311
|
*/
|
|
260
|
-
export declare function resolveVersion(packageSpec: string): Promise<string>;
|
|
312
|
+
export declare function resolveVersion(packageSpec: string, policy: import('@pnpm/config.version-policy').PublishedByPolicy): Promise<string>;
|
|
261
313
|
/**
|
|
262
314
|
* Find the version of a dependency for a specific package@version
|
|
315
|
+
*
|
|
316
|
+
* The parent's spec is often a range, so the cooldown applies here too. Stepping
|
|
317
|
+
* back stays within that range and so never contradicts the parent.
|
|
318
|
+
*
|
|
263
319
|
* @param {string} packageSpec - Package specifier in format "package@version"
|
|
264
320
|
* @param {string} dependency - Dependency name to look up
|
|
321
|
+
* @param {import('@pnpm/config.version-policy').PublishedByPolicy} policy - Registry cooldown to resolve within
|
|
265
322
|
* @returns {Promise<string>} Exact version string of the dependency
|
|
266
323
|
*/
|
|
267
|
-
export declare function findDependencyVersionFromSpec(packageSpec: string, dependency: string): Promise<string>;
|
|
324
|
+
export declare function findDependencyVersionFromSpec(packageSpec: string, dependency: string, policy: import('@pnpm/config.version-policy').PublishedByPolicy): Promise<string>;
|
|
268
325
|
/**
|
|
269
326
|
* Get the maximum semver version between two versions
|
|
270
327
|
* @param {string} a
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {string} tsconfig - The path to the tsconfig.json file.
|
|
4
4
|
* @param {string} outDir - The output directory for the declaration files.
|
|
5
5
|
* @param {Object} options
|
|
6
|
-
* @param {boolean} [options.useTsgo] - Whether to use
|
|
6
|
+
* @param {boolean} [options.useTsgo] - Whether to use the native TypeScript compiler.
|
|
7
7
|
*/
|
|
8
8
|
export declare function emitDeclarations(tsconfig: string, outDir: string, options: {
|
|
9
9
|
useTsgo?: boolean;
|
|
@@ -44,7 +44,7 @@ export declare function moveAndTransformDeclarations({ inputDir, buildDir, bundl
|
|
|
44
44
|
* @param {string} param0.buildDir - The build directory.
|
|
45
45
|
* @param {string} param0.cwd - The current working directory.
|
|
46
46
|
* @param {boolean} param0.skipTsc - Whether to skip running TypeScript compiler (tsc) for building types.
|
|
47
|
-
* @param {boolean} [param0.useTsgo=false] - Whether to build types using
|
|
47
|
+
* @param {boolean} [param0.useTsgo=false] - Whether to build types using the native TypeScript compiler.
|
|
48
48
|
* @param {'module' | 'commonjs'} [param0.packageType] - The package.json type field.
|
|
49
49
|
*/
|
|
50
50
|
export declare function createTypes({ bundles, srcDir, buildDir, cwd, skipTsc, useTsgo, packageType, verbose, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1-canary.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,39 +53,44 @@
|
|
|
53
53
|
"code-infra": "./bin/code-infra.mjs"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@argos-ci/core": "6.
|
|
57
|
-
"@babel/cli": "^
|
|
58
|
-
"@babel/core": "^
|
|
59
|
-
"@babel/plugin-syntax-jsx": "^
|
|
60
|
-
"@babel/plugin-syntax-typescript": "^
|
|
61
|
-
"@babel/plugin-transform-
|
|
62
|
-
"@babel/
|
|
63
|
-
"@babel/preset-
|
|
64
|
-
"@babel/preset-
|
|
65
|
-
"@
|
|
56
|
+
"@argos-ci/core": "6.8.4",
|
|
57
|
+
"@babel/cli": "^8.0.5",
|
|
58
|
+
"@babel/core": "^8.0.5",
|
|
59
|
+
"@babel/plugin-syntax-jsx": "^8.0.1",
|
|
60
|
+
"@babel/plugin-syntax-typescript": "^8.0.1",
|
|
61
|
+
"@babel/plugin-transform-react-pure-annotations": "^8.0.1",
|
|
62
|
+
"@babel/plugin-transform-runtime": "^8.0.1",
|
|
63
|
+
"@babel/preset-env": "^8.0.5",
|
|
64
|
+
"@babel/preset-react": "^8.0.1",
|
|
65
|
+
"@babel/preset-typescript": "^8.0.1",
|
|
66
|
+
"@eslint/compat": "^2.1.1",
|
|
66
67
|
"@eslint/js": "^10.0.1",
|
|
67
|
-
"@eslint/json": "^2.0
|
|
68
|
-
"@inquirer/confirm": "^6.
|
|
69
|
-
"@inquirer/select": "^5.2.
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
68
|
+
"@eslint/json": "^2.1.0",
|
|
69
|
+
"@inquirer/confirm": "^6.3.2",
|
|
70
|
+
"@inquirer/select": "^5.2.5",
|
|
71
|
+
"@mui/internal-babel-plugin-display-name": "2.0.1-canary.0",
|
|
72
|
+
"@mui/internal-babel-plugin-minify-errors": "3.0.1-canary.0",
|
|
73
|
+
"@mui/internal-babel-plugin-resolve-imports": "3.0.1-canary.0",
|
|
74
|
+
"@napi-rs/keyring": "^2.0.0",
|
|
75
|
+
"@octokit/auth-action": "^6.0.3",
|
|
76
|
+
"@octokit/oauth-methods": "^6.0.5",
|
|
73
77
|
"@octokit/rest": "^22.0.1",
|
|
78
|
+
"@pnpm/config.version-policy": "^1100.2.3",
|
|
74
79
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
75
|
-
"@
|
|
76
|
-
"@typescript-eslint/
|
|
77
|
-
"@
|
|
80
|
+
"@pnpm/parse-wanted-dependency": "^1001.0.0",
|
|
81
|
+
"@typescript-eslint/types": "^8.70.0",
|
|
82
|
+
"@typescript-eslint/utils": "^8.70.0",
|
|
83
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
78
84
|
"babel-plugin-optimize-clsx": "^2.6.2",
|
|
79
85
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
80
|
-
"babel-plugin-transform-import-meta": "^
|
|
81
|
-
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
86
|
+
"babel-plugin-transform-import-meta": "^3.0.0",
|
|
82
87
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
83
88
|
"babel-plugin-transform-remove-imports": "^1.8.1",
|
|
84
|
-
"chalk": "^
|
|
89
|
+
"chalk": "^6.0.0",
|
|
85
90
|
"clipboardy": "^5.3.2",
|
|
86
|
-
"content-type": "^
|
|
91
|
+
"content-type": "^3.1.0",
|
|
87
92
|
"env-ci": "^11.2.0",
|
|
88
|
-
"es-toolkit": "^1.
|
|
93
|
+
"es-toolkit": "^1.52.0",
|
|
89
94
|
"eslint-config-prettier": "^10.1.8",
|
|
90
95
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
91
96
|
"eslint-module-utils": "^2.14.0",
|
|
@@ -93,19 +98,18 @@
|
|
|
93
98
|
"eslint-plugin-import": "^2.32.0",
|
|
94
99
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
95
100
|
"eslint-plugin-mdx": "^3.8.1",
|
|
96
|
-
"eslint-plugin-mocha": "^11.3.0",
|
|
97
101
|
"eslint-plugin-react": "^7.37.5",
|
|
98
102
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
99
103
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
104
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
101
|
-
"execa": "^
|
|
105
|
+
"execa": "^10.0.1",
|
|
102
106
|
"git-url-parse": "^16.1.0",
|
|
103
|
-
"globals": "^17.
|
|
104
|
-
"globby": "^16.2.
|
|
105
|
-
"html-validate": "^11.
|
|
106
|
-
"minimatch": "^10.2.
|
|
107
|
-
"node-html-parser": "^9.0.
|
|
108
|
-
"open": "^11.0.
|
|
107
|
+
"globals": "^17.12.0",
|
|
108
|
+
"globby": "^16.2.4",
|
|
109
|
+
"html-validate": "^11.15.0",
|
|
110
|
+
"minimatch": "^10.2.6",
|
|
111
|
+
"node-html-parser": "^9.0.4",
|
|
112
|
+
"open": "^11.0.3",
|
|
109
113
|
"postcss-styled-syntax": "^0.7.2",
|
|
110
114
|
"regexp.escape": "^2.0.1",
|
|
111
115
|
"rehype-slug": "^6.0.0",
|
|
@@ -129,33 +133,26 @@
|
|
|
129
133
|
"resolve-pkg-maps": "^1.0.0",
|
|
130
134
|
"semver": "^7.8.5",
|
|
131
135
|
"stylelint-config-standard": "^40.0.0",
|
|
132
|
-
"typescript-eslint": "^8.
|
|
136
|
+
"typescript-eslint": "^8.70.0",
|
|
133
137
|
"unified": "^11.0.5",
|
|
134
138
|
"unified-lint-rule": "^3.0.1",
|
|
135
139
|
"unist-util-visit": "^5.1.0",
|
|
136
|
-
"yaml": "^2.9.
|
|
137
|
-
"yargs": "^18.
|
|
138
|
-
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.23",
|
|
139
|
-
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.41",
|
|
140
|
-
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30"
|
|
140
|
+
"yaml": "^2.9.1",
|
|
141
|
+
"yargs": "^18.1.0"
|
|
141
142
|
},
|
|
142
143
|
"peerDependencies": {
|
|
143
144
|
"@next/eslint-plugin-next": "*",
|
|
144
|
-
"@typescript/native-preview": ">=7.0.0-dev.0",
|
|
145
145
|
"eslint": "^9.0.0 || ^10.0.0",
|
|
146
146
|
"prettier": "^3.0.0",
|
|
147
|
-
"typescript": "^5.0.0 || ^6.0.0"
|
|
147
|
+
"typescript": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
148
148
|
},
|
|
149
149
|
"peerDependenciesMeta": {
|
|
150
|
-
"@typescript/native-preview": {
|
|
151
|
-
"optional": true
|
|
152
|
-
},
|
|
153
150
|
"typescript": {
|
|
154
151
|
"optional": true
|
|
155
152
|
}
|
|
156
153
|
},
|
|
157
154
|
"devDependencies": {
|
|
158
|
-
"@octokit/types": "
|
|
155
|
+
"@octokit/types": "18.0.0",
|
|
159
156
|
"@types/babel__core": "7.20.5",
|
|
160
157
|
"@types/babel__preset-env": "7.10.0",
|
|
161
158
|
"@types/env-ci": "3.1.4",
|
|
@@ -165,15 +162,17 @@
|
|
|
165
162
|
"@types/mdast": "4.0.4",
|
|
166
163
|
"@types/regexp.escape": "2.0.0",
|
|
167
164
|
"@types/yargs": "17.0.35",
|
|
168
|
-
"@typescript-eslint/parser": "8.
|
|
169
|
-
"@typescript-eslint/rule-tester": "8.
|
|
170
|
-
"
|
|
165
|
+
"@typescript-eslint/parser": "8.70.0",
|
|
166
|
+
"@typescript-eslint/rule-tester": "8.70.0",
|
|
167
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
168
|
+
"eslint": "10.10.0",
|
|
171
169
|
"get-port": "7.2.0",
|
|
172
|
-
"prettier": "3.9.
|
|
170
|
+
"prettier": "3.9.6",
|
|
173
171
|
"remark": "15.0.1",
|
|
174
172
|
"remark-mdx": "3.1.1",
|
|
175
173
|
"serve": "14.2.6",
|
|
176
|
-
"typescript
|
|
174
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
175
|
+
"typescript-eslint": "8.70.0"
|
|
177
176
|
},
|
|
178
177
|
"files": [
|
|
179
178
|
"bin",
|
|
@@ -188,10 +187,10 @@
|
|
|
188
187
|
"publishConfig": {
|
|
189
188
|
"access": "public"
|
|
190
189
|
},
|
|
191
|
-
"gitSha": "
|
|
190
|
+
"gitSha": "294ab9be74ab24116c64cd734568b8d0a9b30f18",
|
|
192
191
|
"scripts": {
|
|
193
|
-
"build": "
|
|
194
|
-
"typescript": "
|
|
192
|
+
"build": "tsc -p tsconfig.build.json",
|
|
193
|
+
"typescript": "tsc -noEmit",
|
|
195
194
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
|
196
195
|
"test:copy": "rm -rf build && node bin/code-infra.mjs copy-files --glob \"src/cli/*.mjs\" --glob \"src/eslint/**/*.mjs:esm\""
|
|
197
196
|
}
|
package/src/babel-config.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import pluginReactPureAnnotations from '@babel/plugin-transform-react-pure-annotations';
|
|
1
2
|
import pluginTransformRuntime from '@babel/plugin-transform-runtime';
|
|
2
3
|
import presetEnv from '@babel/preset-env';
|
|
3
4
|
import presetReact from '@babel/preset-react';
|
|
@@ -7,8 +8,11 @@ import pluginResolveImports from '@mui/internal-babel-plugin-resolve-imports';
|
|
|
7
8
|
import pluginOptimizeClsx from 'babel-plugin-optimize-clsx';
|
|
8
9
|
import pluginReactCompiler from 'babel-plugin-react-compiler';
|
|
9
10
|
import pluginTransformImportMeta from 'babel-plugin-transform-import-meta';
|
|
10
|
-
import pluginTransformInlineEnvVars from 'babel-plugin-transform-inline-environment-variables';
|
|
11
11
|
import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-types';
|
|
12
|
+
import pluginTransformInlineEnvVars from './babelPluginInlineEnvironmentVariables.mjs';
|
|
13
|
+
|
|
14
|
+
// Plain TypeScript, ie. files that can't contain JSX.
|
|
15
|
+
const TS_WITHOUT_JSX = /\.[cm]?ts$/;
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* @typedef {'annotation' | 'syntax' | 'infer' | 'all'} ReactCompilationMode
|
|
@@ -26,7 +30,7 @@ import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-type
|
|
|
26
30
|
* @param {string} [param0.reactCompilerReactVersion]
|
|
27
31
|
* @param {ReactCompilationMode} [param0.reactCompilerMode]
|
|
28
32
|
* @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
|
|
29
|
-
* @returns {import('@babel/core').
|
|
33
|
+
* @returns {import('@babel/core').InputOptions} The base Babel configuration.
|
|
30
34
|
*/
|
|
31
35
|
export function getBaseConfig({
|
|
32
36
|
debug = false,
|
|
@@ -44,22 +48,19 @@ export function getBaseConfig({
|
|
|
44
48
|
* @type {import('@babel/preset-env').Options}
|
|
45
49
|
*/
|
|
46
50
|
const presetEnvOptions = {
|
|
47
|
-
bugfixes: true,
|
|
48
51
|
debug,
|
|
49
52
|
modules: bundle === 'esm' ? false : 'commonjs',
|
|
50
53
|
// @TODO
|
|
51
54
|
browserslistEnv: bundle === 'esm' ? 'stable' : 'node',
|
|
52
55
|
};
|
|
53
56
|
/**
|
|
54
|
-
* @type {import('@babel/core').
|
|
57
|
+
* @type {import('@babel/core').PluginItem[]}
|
|
55
58
|
*/
|
|
56
59
|
const plugins = [
|
|
57
60
|
[
|
|
58
61
|
pluginTransformRuntime,
|
|
59
62
|
{
|
|
60
63
|
version: runtimeVersion,
|
|
61
|
-
regenerator: false,
|
|
62
|
-
useESModules: bundle === 'esm',
|
|
63
64
|
},
|
|
64
65
|
'@babel/plugin-transform-runtime',
|
|
65
66
|
],
|
|
@@ -143,12 +144,31 @@ export function getBaseConfig({
|
|
|
143
144
|
presets: [
|
|
144
145
|
[presetEnv, presetEnvOptions],
|
|
145
146
|
[
|
|
146
|
-
|
|
147
|
-
{
|
|
147
|
+
presetTypescript,
|
|
148
|
+
{
|
|
149
|
+
// Babel 8 defaults this to `true`, which keeps `import { type A } from 'x'` as a
|
|
150
|
+
// side-effect `import 'x'`. Restore full elision so type-only imports don't create
|
|
151
|
+
// runtime module cycles.
|
|
152
|
+
onlyRemoveTypeImports: false,
|
|
153
|
+
},
|
|
148
154
|
],
|
|
149
|
-
[presetTypescript],
|
|
150
155
|
],
|
|
151
156
|
plugins,
|
|
157
|
+
overrides: [
|
|
158
|
+
{
|
|
159
|
+
// Babel 8 keeps the JSX parser on for every file the React preset touches, which
|
|
160
|
+
// misparses generic arrows like `<T = unknown>(x) => x` in plain `.ts` files.
|
|
161
|
+
exclude: TS_WITHOUT_JSX,
|
|
162
|
+
presets: [[presetReact, { runtime: 'automatic' }]],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
// The React preset is off for those files, so re-add the one part of it they still
|
|
166
|
+
// need: `/*#__PURE__*/` on `React.createContext()` and friends, without which
|
|
167
|
+
// bundlers keep every unused context.
|
|
168
|
+
include: TS_WITHOUT_JSX,
|
|
169
|
+
plugins: [pluginReactPureAnnotations],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
152
172
|
};
|
|
153
173
|
}
|
|
154
174
|
|
|
@@ -161,7 +181,7 @@ export function getBaseConfig({
|
|
|
161
181
|
|
|
162
182
|
/**
|
|
163
183
|
* @param {import('@babel/core').ConfigAPI | Options} api
|
|
164
|
-
* @returns {import('@babel/core').
|
|
184
|
+
* @returns {import('@babel/core').InputOptions}
|
|
165
185
|
*/
|
|
166
186
|
export default function getBabelConfig(api) {
|
|
167
187
|
/** @type {'esm' | 'cjs'} */
|
|
@@ -183,7 +203,8 @@ export default function getBabelConfig(api) {
|
|
|
183
203
|
debug: process.env.MUI_BUILD_VERBOSE === 'true',
|
|
184
204
|
bundle,
|
|
185
205
|
outExtension: process.env.MUI_OUT_FILE_EXTENSION || null,
|
|
186
|
-
//
|
|
206
|
+
// Lower bound of @babel/runtime a consumer must ship; `code-infra build` reads the real
|
|
207
|
+
// version off the package's dependencies instead. Runtime 7 and 8 both satisfy this.
|
|
187
208
|
runtimeVersion: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
|
|
188
209
|
optimizeClsx: process.env.MUI_OPTIMIZE_CLSX === 'true',
|
|
189
210
|
removePropTypes: process.env.MUI_REMOVE_PROP_TYPES === 'true',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inlines `process.env.X` member expressions with their build-time value.
|
|
3
|
+
*
|
|
4
|
+
* Forked from `babel-plugin-transform-inline-environment-variables` (unmaintained, last
|
|
5
|
+
* published 2022) because it calls the now-removed `NodePath#toComputedKey()` under Babel 8's
|
|
6
|
+
* `@babel/traverse`. Behavior is otherwise identical to the upstream plugin.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('@babel/core').PluginAPI} api
|
|
9
|
+
* @returns {import('@babel/core').PluginObject}
|
|
10
|
+
*/
|
|
11
|
+
export default function babelPluginInlineEnvironmentVariables({ types: t }) {
|
|
12
|
+
/**
|
|
13
|
+
* @param {import('@babel/core').NodePath<import('@babel/core').types.MemberExpression>} path
|
|
14
|
+
*/
|
|
15
|
+
function isLeftSideOfAssignmentExpression(path) {
|
|
16
|
+
return t.isAssignmentExpression(path.parent) && path.parent.left === path.node;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
name: 'transform-inline-environment-variables',
|
|
21
|
+
visitor: {
|
|
22
|
+
MemberExpression(
|
|
23
|
+
path,
|
|
24
|
+
/** @type {{ opts?: { include?: string[], exclude?: string[] } }} */ {
|
|
25
|
+
opts: { include, exclude } = {},
|
|
26
|
+
},
|
|
27
|
+
) {
|
|
28
|
+
if (!path.get('object').matchesPattern('process.env')) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const key = t.toComputedKey(path.node);
|
|
33
|
+
|
|
34
|
+
if (
|
|
35
|
+
t.isStringLiteral(key) &&
|
|
36
|
+
!isLeftSideOfAssignmentExpression(path) &&
|
|
37
|
+
(!include || include.indexOf(key.value) !== -1) &&
|
|
38
|
+
(!exclude || exclude.indexOf(key.value) === -1)
|
|
39
|
+
) {
|
|
40
|
+
path.replaceWith(t.valueToNode(process.env[key.value]));
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import {
|
|
2
|
+
import { execa, parseCommandString } from 'execa';
|
|
3
3
|
import timers from 'node:timers/promises';
|
|
4
4
|
import * as fs from 'node:fs/promises';
|
|
5
5
|
import * as path from 'node:path';
|
|
@@ -626,7 +626,7 @@ export async function crawl(rawOptions) {
|
|
|
626
626
|
if (options.startCommand) {
|
|
627
627
|
console.log(chalk.blue(`Starting server with "${options.startCommand}"...`));
|
|
628
628
|
controller = new AbortController();
|
|
629
|
-
const appProcess =
|
|
629
|
+
const appProcess = execa({
|
|
630
630
|
stdout: 'pipe',
|
|
631
631
|
stderr: 'pipe',
|
|
632
632
|
cancelSignal: controller.signal,
|
|
@@ -634,7 +634,7 @@ export async function crawl(rawOptions) {
|
|
|
634
634
|
FORCE_COLOR: '1',
|
|
635
635
|
...process.env,
|
|
636
636
|
},
|
|
637
|
-
})
|
|
637
|
+
})`${parseCommandString(options.startCommand)}`;
|
|
638
638
|
|
|
639
639
|
// Prefix server logs
|
|
640
640
|
const serverPrefix = chalk.gray('server: ');
|
package/src/cli/cmdArgosPush.mjs
CHANGED
|
@@ -46,8 +46,6 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
46
46
|
const { folder, verbose = false } = argv;
|
|
47
47
|
|
|
48
48
|
const argosToken = requireEnv('ARGOS_TOKEN');
|
|
49
|
-
const circleSha1 = requireEnv('CIRCLE_SHA1');
|
|
50
|
-
const circleBranch = requireEnv('CIRCLE_BRANCH');
|
|
51
49
|
const circleBuildNum = requireEnv('CIRCLE_BUILD_NUM');
|
|
52
50
|
|
|
53
51
|
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'argos-screenshots-'));
|
|
@@ -92,8 +90,8 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
92
90
|
// eslint-disable-next-line no-await-in-loop
|
|
93
91
|
const result = await upload({
|
|
94
92
|
root: `${tempDir}/${i}`,
|
|
95
|
-
commit
|
|
96
|
-
|
|
93
|
+
// The SDK resolves `commit` and `branch`: it reads `ARGOS_COMMIT` and `ARGOS_BRANCH`
|
|
94
|
+
// first and falls back to `CIRCLE_SHA1` and `CIRCLE_BRANCH`.
|
|
97
95
|
token: argosToken,
|
|
98
96
|
threshold,
|
|
99
97
|
parallel: {
|