@mui/internal-code-infra 0.0.4-canary.99 → 0.1.1-canary.0
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 +51 -53
- package/src/babel-config.mjs +21 -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.0",
|
|
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,43 @@
|
|
|
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-runtime": "^
|
|
62
|
-
"@babel/preset-env": "^
|
|
63
|
-
"@babel/preset-react": "^
|
|
64
|
-
"@babel/preset-typescript": "^
|
|
65
|
-
"@eslint/compat": "^2.1.
|
|
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-runtime": "^8.0.1",
|
|
62
|
+
"@babel/preset-env": "^8.0.5",
|
|
63
|
+
"@babel/preset-react": "^8.0.1",
|
|
64
|
+
"@babel/preset-typescript": "^8.0.1",
|
|
65
|
+
"@eslint/compat": "^2.1.1",
|
|
66
66
|
"@eslint/js": "^10.0.1",
|
|
67
|
-
"@eslint/json": "^2.0
|
|
68
|
-
"@inquirer/confirm": "^6.
|
|
69
|
-
"@inquirer/select": "^5.2.
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
67
|
+
"@eslint/json": "^2.1.0",
|
|
68
|
+
"@inquirer/confirm": "^6.3.2",
|
|
69
|
+
"@inquirer/select": "^5.2.5",
|
|
70
|
+
"@mui/internal-babel-plugin-display-name": "2.0.1-canary.0",
|
|
71
|
+
"@mui/internal-babel-plugin-minify-errors": "3.0.1-canary.0",
|
|
72
|
+
"@mui/internal-babel-plugin-resolve-imports": "3.0.1-canary.0",
|
|
73
|
+
"@napi-rs/keyring": "^2.0.0",
|
|
74
|
+
"@octokit/auth-action": "^6.0.3",
|
|
75
|
+
"@octokit/oauth-methods": "^6.0.5",
|
|
73
76
|
"@octokit/rest": "^22.0.1",
|
|
77
|
+
"@pnpm/config.version-policy": "^1100.2.3",
|
|
74
78
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
75
|
-
"@
|
|
76
|
-
"@typescript-eslint/
|
|
77
|
-
"@
|
|
79
|
+
"@pnpm/parse-wanted-dependency": "^1001.0.0",
|
|
80
|
+
"@typescript-eslint/types": "^8.70.0",
|
|
81
|
+
"@typescript-eslint/utils": "^8.70.0",
|
|
82
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
78
83
|
"babel-plugin-optimize-clsx": "^2.6.2",
|
|
79
84
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
80
|
-
"babel-plugin-transform-import-meta": "^
|
|
81
|
-
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
85
|
+
"babel-plugin-transform-import-meta": "^3.0.0",
|
|
82
86
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
83
87
|
"babel-plugin-transform-remove-imports": "^1.8.1",
|
|
84
|
-
"chalk": "^
|
|
88
|
+
"chalk": "^6.0.0",
|
|
85
89
|
"clipboardy": "^5.3.2",
|
|
86
|
-
"content-type": "^
|
|
90
|
+
"content-type": "^3.1.0",
|
|
87
91
|
"env-ci": "^11.2.0",
|
|
88
|
-
"es-toolkit": "^1.
|
|
92
|
+
"es-toolkit": "^1.52.0",
|
|
89
93
|
"eslint-config-prettier": "^10.1.8",
|
|
90
94
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
91
95
|
"eslint-module-utils": "^2.14.0",
|
|
@@ -93,19 +97,18 @@
|
|
|
93
97
|
"eslint-plugin-import": "^2.32.0",
|
|
94
98
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
95
99
|
"eslint-plugin-mdx": "^3.8.1",
|
|
96
|
-
"eslint-plugin-mocha": "^11.3.0",
|
|
97
100
|
"eslint-plugin-react": "^7.37.5",
|
|
98
101
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
99
102
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
103
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
101
|
-
"execa": "^
|
|
104
|
+
"execa": "^10.0.1",
|
|
102
105
|
"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.
|
|
106
|
+
"globals": "^17.12.0",
|
|
107
|
+
"globby": "^16.2.4",
|
|
108
|
+
"html-validate": "^11.15.0",
|
|
109
|
+
"minimatch": "^10.2.6",
|
|
110
|
+
"node-html-parser": "^9.0.4",
|
|
111
|
+
"open": "^11.0.3",
|
|
109
112
|
"postcss-styled-syntax": "^0.7.2",
|
|
110
113
|
"regexp.escape": "^2.0.1",
|
|
111
114
|
"rehype-slug": "^6.0.0",
|
|
@@ -129,33 +132,26 @@
|
|
|
129
132
|
"resolve-pkg-maps": "^1.0.0",
|
|
130
133
|
"semver": "^7.8.5",
|
|
131
134
|
"stylelint-config-standard": "^40.0.0",
|
|
132
|
-
"typescript-eslint": "^8.
|
|
135
|
+
"typescript-eslint": "^8.70.0",
|
|
133
136
|
"unified": "^11.0.5",
|
|
134
137
|
"unified-lint-rule": "^3.0.1",
|
|
135
138
|
"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"
|
|
139
|
+
"yaml": "^2.9.1",
|
|
140
|
+
"yargs": "^18.1.0"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"@next/eslint-plugin-next": "*",
|
|
144
|
-
"@typescript/native-preview": ">=7.0.0-dev.0",
|
|
145
144
|
"eslint": "^9.0.0 || ^10.0.0",
|
|
146
145
|
"prettier": "^3.0.0",
|
|
147
|
-
"typescript": "^5.0.0 || ^6.0.0"
|
|
146
|
+
"typescript": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
148
147
|
},
|
|
149
148
|
"peerDependenciesMeta": {
|
|
150
|
-
"@typescript/native-preview": {
|
|
151
|
-
"optional": true
|
|
152
|
-
},
|
|
153
149
|
"typescript": {
|
|
154
150
|
"optional": true
|
|
155
151
|
}
|
|
156
152
|
},
|
|
157
153
|
"devDependencies": {
|
|
158
|
-
"@octokit/types": "
|
|
154
|
+
"@octokit/types": "18.0.0",
|
|
159
155
|
"@types/babel__core": "7.20.5",
|
|
160
156
|
"@types/babel__preset-env": "7.10.0",
|
|
161
157
|
"@types/env-ci": "3.1.4",
|
|
@@ -165,15 +161,17 @@
|
|
|
165
161
|
"@types/mdast": "4.0.4",
|
|
166
162
|
"@types/regexp.escape": "2.0.0",
|
|
167
163
|
"@types/yargs": "17.0.35",
|
|
168
|
-
"@typescript-eslint/parser": "8.
|
|
169
|
-
"@typescript-eslint/rule-tester": "8.
|
|
170
|
-
"
|
|
164
|
+
"@typescript-eslint/parser": "8.70.0",
|
|
165
|
+
"@typescript-eslint/rule-tester": "8.70.0",
|
|
166
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
167
|
+
"eslint": "10.10.0",
|
|
171
168
|
"get-port": "7.2.0",
|
|
172
|
-
"prettier": "3.9.
|
|
169
|
+
"prettier": "3.9.6",
|
|
173
170
|
"remark": "15.0.1",
|
|
174
171
|
"remark-mdx": "3.1.1",
|
|
175
172
|
"serve": "14.2.6",
|
|
176
|
-
"typescript
|
|
173
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
174
|
+
"typescript-eslint": "8.70.0"
|
|
177
175
|
},
|
|
178
176
|
"files": [
|
|
179
177
|
"bin",
|
|
@@ -188,10 +186,10 @@
|
|
|
188
186
|
"publishConfig": {
|
|
189
187
|
"access": "public"
|
|
190
188
|
},
|
|
191
|
-
"gitSha": "
|
|
189
|
+
"gitSha": "764e3b3cfc14293e74e93f3413609025f502bab9",
|
|
192
190
|
"scripts": {
|
|
193
|
-
"build": "
|
|
194
|
-
"typescript": "
|
|
191
|
+
"build": "tsc -p tsconfig.build.json",
|
|
192
|
+
"typescript": "tsc -noEmit",
|
|
195
193
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
|
196
194
|
"test:copy": "rm -rf build && node bin/code-infra.mjs copy-files --glob \"src/cli/*.mjs\" --glob \"src/eslint/**/*.mjs:esm\""
|
|
197
195
|
}
|
package/src/babel-config.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import pluginResolveImports from '@mui/internal-babel-plugin-resolve-imports';
|
|
|
7
7
|
import pluginOptimizeClsx from 'babel-plugin-optimize-clsx';
|
|
8
8
|
import pluginReactCompiler from 'babel-plugin-react-compiler';
|
|
9
9
|
import pluginTransformImportMeta from 'babel-plugin-transform-import-meta';
|
|
10
|
-
import pluginTransformInlineEnvVars from 'babel-plugin-transform-inline-environment-variables';
|
|
11
10
|
import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-types';
|
|
11
|
+
import pluginTransformInlineEnvVars from './babelPluginInlineEnvironmentVariables.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @typedef {'annotation' | 'syntax' | 'infer' | 'all'} ReactCompilationMode
|
|
@@ -26,7 +26,7 @@ import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-type
|
|
|
26
26
|
* @param {string} [param0.reactCompilerReactVersion]
|
|
27
27
|
* @param {ReactCompilationMode} [param0.reactCompilerMode]
|
|
28
28
|
* @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
|
|
29
|
-
* @returns {import('@babel/core').
|
|
29
|
+
* @returns {import('@babel/core').InputOptions} The base Babel configuration.
|
|
30
30
|
*/
|
|
31
31
|
export function getBaseConfig({
|
|
32
32
|
debug = false,
|
|
@@ -44,22 +44,19 @@ export function getBaseConfig({
|
|
|
44
44
|
* @type {import('@babel/preset-env').Options}
|
|
45
45
|
*/
|
|
46
46
|
const presetEnvOptions = {
|
|
47
|
-
bugfixes: true,
|
|
48
47
|
debug,
|
|
49
48
|
modules: bundle === 'esm' ? false : 'commonjs',
|
|
50
49
|
// @TODO
|
|
51
50
|
browserslistEnv: bundle === 'esm' ? 'stable' : 'node',
|
|
52
51
|
};
|
|
53
52
|
/**
|
|
54
|
-
* @type {import('@babel/core').
|
|
53
|
+
* @type {import('@babel/core').PluginItem[]}
|
|
55
54
|
*/
|
|
56
55
|
const plugins = [
|
|
57
56
|
[
|
|
58
57
|
pluginTransformRuntime,
|
|
59
58
|
{
|
|
60
59
|
version: runtimeVersion,
|
|
61
|
-
regenerator: false,
|
|
62
|
-
useESModules: bundle === 'esm',
|
|
63
60
|
},
|
|
64
61
|
'@babel/plugin-transform-runtime',
|
|
65
62
|
],
|
|
@@ -143,12 +140,24 @@ export function getBaseConfig({
|
|
|
143
140
|
presets: [
|
|
144
141
|
[presetEnv, presetEnvOptions],
|
|
145
142
|
[
|
|
146
|
-
|
|
147
|
-
{
|
|
143
|
+
presetTypescript,
|
|
144
|
+
{
|
|
145
|
+
// Babel 8 defaults this to `true`, which keeps `import { type A } from 'x'` as a
|
|
146
|
+
// side-effect `import 'x'`. Restore full elision so type-only imports don't create
|
|
147
|
+
// runtime module cycles.
|
|
148
|
+
onlyRemoveTypeImports: false,
|
|
149
|
+
},
|
|
148
150
|
],
|
|
149
|
-
[presetTypescript],
|
|
150
151
|
],
|
|
151
152
|
plugins,
|
|
153
|
+
overrides: [
|
|
154
|
+
{
|
|
155
|
+
// Babel 8 keeps the JSX parser on for every file the React preset touches, which
|
|
156
|
+
// misparses generic arrows like `<T = unknown>(x) => x` in plain `.ts` files.
|
|
157
|
+
exclude: /\.[cm]?ts$/,
|
|
158
|
+
presets: [[presetReact, { runtime: 'automatic' }]],
|
|
159
|
+
},
|
|
160
|
+
],
|
|
152
161
|
};
|
|
153
162
|
}
|
|
154
163
|
|
|
@@ -161,7 +170,7 @@ export function getBaseConfig({
|
|
|
161
170
|
|
|
162
171
|
/**
|
|
163
172
|
* @param {import('@babel/core').ConfigAPI | Options} api
|
|
164
|
-
* @returns {import('@babel/core').
|
|
173
|
+
* @returns {import('@babel/core').InputOptions}
|
|
165
174
|
*/
|
|
166
175
|
export default function getBabelConfig(api) {
|
|
167
176
|
/** @type {'esm' | 'cjs'} */
|
|
@@ -183,7 +192,8 @@ export default function getBabelConfig(api) {
|
|
|
183
192
|
debug: process.env.MUI_BUILD_VERBOSE === 'true',
|
|
184
193
|
bundle,
|
|
185
194
|
outExtension: process.env.MUI_OUT_FILE_EXTENSION || null,
|
|
186
|
-
//
|
|
195
|
+
// Lower bound of @babel/runtime a consumer must ship; `code-infra build` reads the real
|
|
196
|
+
// version off the package's dependencies instead. Runtime 7 and 8 both satisfy this.
|
|
187
197
|
runtimeVersion: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
|
|
188
198
|
optimizeClsx: process.env.MUI_OPTIMIZE_CLSX === 'true',
|
|
189
199
|
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: {
|