@mui/internal-code-infra 0.0.4-canary.1 → 0.0.4-canary.100
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/LICENSE +1 -1
- package/README.md +22 -8
- package/build/babel-config.d.mts +11 -3
- package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
- package/build/brokenLinksChecker/index.d.mts +192 -2
- package/build/changelog/fetchChangelogs.d.mts +3 -0
- package/build/changelog/types.d.ts +3 -1
- package/build/cli/cmdArgosPush.d.mts +8 -2
- package/build/cli/cmdBuild.d.mts +48 -2
- package/build/cli/cmdCopyFiles.d.mts +14 -2
- package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
- package/build/cli/cmdGenerateChangelog.d.mts +17 -2
- package/build/cli/cmdGithubAuth.d.mts +2 -2
- package/build/cli/cmdListWorkspaces.d.mts +16 -2
- package/build/cli/cmdNetlifyIgnore.d.mts +12 -2
- package/build/cli/cmdPublish.d.mts +24 -4
- package/build/cli/cmdPublishCanary.d.mts +21 -2
- package/build/cli/cmdPublishNewPackage.d.mts +10 -2
- package/build/cli/cmdRenameScope.d.mts +18 -0
- package/build/cli/cmdSetVersionOverrides.d.mts +5 -2
- package/build/cli/cmdVale.d.mts +46 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
- package/build/eslint/baseConfig.d.mts +3 -1
- package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
- package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
- package/build/eslint/mui/rules/no-floating-cleanup.d.mts +5 -0
- package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
- package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
- package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +8 -2
- package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
- package/build/remark/config.d.mts +43 -0
- package/build/remark/createLintTester.d.mts +10 -0
- package/build/remark/firstBlockHeading.d.mts +4 -0
- package/build/remark/gitDiff.d.mts +2 -0
- package/build/remark/noSpaceInLinks.d.mts +2 -0
- package/build/remark/straightQuotes.d.mts +2 -0
- package/build/remark/tableAlignment.d.mts +2 -0
- package/build/remark/terminalLanguage.d.mts +2 -0
- package/build/utils/babel.d.mts +7 -1
- package/build/utils/build.d.mts +59 -37
- package/build/utils/extractErrorCodes.d.mts +9 -0
- package/build/utils/git.d.mts +16 -0
- package/build/utils/github.d.mts +13 -1
- package/build/utils/pnpm.d.mts +200 -7
- package/build/utils/testUtils.d.mts +28 -0
- package/build/utils/typescript.d.mts +6 -16
- package/package.json +83 -56
- package/src/babel-config.mjs +9 -3
- package/src/brokenLinksChecker/crawlWorker.mjs +240 -0
- package/src/brokenLinksChecker/index.mjs +263 -188
- package/src/build-env.d.ts +13 -0
- package/src/changelog/fetchChangelogs.mjs +8 -2
- package/src/changelog/renderChangelog.mjs +1 -1
- package/src/changelog/types.ts +3 -1
- package/src/cli/cmdBuild.mjs +51 -85
- package/src/cli/cmdListWorkspaces.mjs +16 -3
- package/src/cli/cmdNetlifyIgnore.mjs +34 -93
- package/src/cli/cmdPublish.mjs +105 -36
- package/src/cli/cmdPublishCanary.mjs +145 -109
- package/src/cli/cmdPublishNewPackage.mjs +31 -8
- package/src/cli/cmdRenameScope.mjs +76 -0
- package/src/cli/cmdSetVersionOverrides.mjs +8 -9
- package/src/cli/cmdVale.mjs +513 -0
- package/src/cli/index.mjs +4 -0
- package/src/cli/packageJson.d.ts +2 -3
- package/src/eslint/baseConfig.mjs +51 -19
- package/src/eslint/docsConfig.mjs +2 -1
- package/src/eslint/mui/config.mjs +24 -4
- package/src/eslint/mui/index.mjs +6 -0
- package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
- package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
- package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
- package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
- package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
- package/src/estree-typescript.d.ts +1 -1
- package/src/remark/config.mjs +157 -0
- package/src/remark/createLintTester.mjs +19 -0
- package/src/remark/firstBlockHeading.mjs +87 -0
- package/src/remark/gitDiff.mjs +43 -0
- package/src/remark/noSpaceInLinks.mjs +42 -0
- package/src/remark/straightQuotes.mjs +31 -0
- package/src/remark/tableAlignment.mjs +23 -0
- package/src/remark/terminalLanguage.mjs +19 -0
- package/src/stylelint/index.mjs +2 -2
- package/src/untyped-plugins.d.ts +14 -14
- package/src/utils/build.mjs +604 -270
- package/src/utils/git.mjs +27 -7
- package/src/utils/pnpm.mjs +549 -26
- package/src/utils/testUtils.mjs +53 -0
- package/src/utils/typescript.mjs +23 -42
- package/vale/.vale.ini +1 -0
- package/vale/styles/MUI/CorrectReferenceAllCases.yml +42 -0
- package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
- package/vale/styles/MUI/GoogleLatin.yml +11 -0
- package/vale/styles/MUI/MuiBrandName.yml +22 -0
- package/vale/styles/MUI/NoBritish.yml +112 -0
- package/vale/styles/MUI/NoCompanyName.yml +17 -0
- package/build/markdownlint/duplicate-h1.d.mts +0 -56
- package/build/markdownlint/git-diff.d.mts +0 -11
- package/build/markdownlint/index.d.mts +0 -52
- package/build/markdownlint/straight-quotes.d.mts +0 -11
- package/build/markdownlint/table-alignment.d.mts +0 -11
- package/build/markdownlint/terminal-language.d.mts +0 -11
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
- package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
- package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -28
- package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
- package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
- package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
- package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
- package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
- package/src/brokenLinksChecker/index.test.ts +0 -261
- package/src/changelog/categorizeCommits.test.ts +0 -319
- package/src/changelog/filterCommits.test.ts +0 -363
- package/src/changelog/parseCommitLabels.test.ts +0 -509
- package/src/changelog/renderChangelog.test.ts +0 -378
- package/src/changelog/sortSections.test.ts +0 -199
- package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
- package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
- package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
- package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
- package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
- package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
- package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
- package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
- package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
- package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
- package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
- package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
- package/src/markdownlint/duplicate-h1.mjs +0 -69
- package/src/markdownlint/git-diff.mjs +0 -31
- package/src/markdownlint/index.mjs +0 -62
- package/src/markdownlint/straight-quotes.mjs +0 -26
- package/src/markdownlint/table-alignment.mjs +0 -42
- package/src/markdownlint/terminal-language.mjs +0 -19
- package/src/utils/build.test.mjs +0 -705
- package/src/utils/template.test.mjs +0 -133
- package/src/utils/typescript.test.mjs +0 -380
package/build/utils/pnpm.d.mts
CHANGED
|
@@ -1,61 +1,226 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
export type PrivatePackage = {
|
|
3
|
+
/**
|
|
4
|
+
* - Package name
|
|
5
|
+
*/
|
|
3
6
|
name?: string;
|
|
7
|
+
/**
|
|
8
|
+
* - Package version
|
|
9
|
+
*/
|
|
4
10
|
version?: string;
|
|
11
|
+
/**
|
|
12
|
+
* - Package directory path
|
|
13
|
+
*/
|
|
5
14
|
path: string;
|
|
15
|
+
/**
|
|
16
|
+
* - Whether the package is private
|
|
17
|
+
*/
|
|
6
18
|
isPrivate: true;
|
|
7
19
|
};
|
|
8
20
|
export type PublicPackage = {
|
|
21
|
+
/**
|
|
22
|
+
* - Package name
|
|
23
|
+
*/
|
|
9
24
|
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* - Package version
|
|
27
|
+
*/
|
|
10
28
|
version: string;
|
|
29
|
+
/**
|
|
30
|
+
* - Package directory path
|
|
31
|
+
*/
|
|
11
32
|
path: string;
|
|
33
|
+
/**
|
|
34
|
+
* - Whether the package is private
|
|
35
|
+
*/
|
|
12
36
|
isPrivate: false;
|
|
13
37
|
};
|
|
14
38
|
export type VersionInfo = {
|
|
39
|
+
/**
|
|
40
|
+
* - Whether current version exists on npm
|
|
41
|
+
*/
|
|
15
42
|
currentVersionExists: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* - Latest canary version if available
|
|
45
|
+
*/
|
|
16
46
|
latestCanaryVersion: string | null;
|
|
17
47
|
};
|
|
18
48
|
export type PublishOptions = {
|
|
49
|
+
/**
|
|
50
|
+
* - Whether to run in dry-run mode
|
|
51
|
+
*/
|
|
19
52
|
dryRun?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* - Whether to skip git checks
|
|
55
|
+
*/
|
|
20
56
|
noGitChecks?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* - NPM dist tag to publish to
|
|
59
|
+
*/
|
|
21
60
|
tag?: string;
|
|
22
61
|
};
|
|
23
62
|
export type PnpmListResultItem = {
|
|
63
|
+
/**
|
|
64
|
+
* - Package name
|
|
65
|
+
*/
|
|
24
66
|
name?: string;
|
|
67
|
+
/**
|
|
68
|
+
* - Package version
|
|
69
|
+
*/
|
|
25
70
|
version?: string;
|
|
71
|
+
/**
|
|
72
|
+
* - Package directory path
|
|
73
|
+
*/
|
|
26
74
|
path: string;
|
|
75
|
+
/**
|
|
76
|
+
* - Whether the package is private
|
|
77
|
+
*/
|
|
27
78
|
private: boolean;
|
|
28
79
|
};
|
|
29
80
|
export type GetWorkspacePackagesOptions = {
|
|
81
|
+
/**
|
|
82
|
+
* - Git reference to filter changes since
|
|
83
|
+
*/
|
|
30
84
|
sinceRef?: string | null;
|
|
85
|
+
/**
|
|
86
|
+
* - Whether to filter to only public packages
|
|
87
|
+
*/
|
|
31
88
|
publicOnly?: boolean;
|
|
32
|
-
|
|
89
|
+
/**
|
|
90
|
+
* - Current working directory to run pnpm command in
|
|
91
|
+
*/
|
|
33
92
|
cwd?: string;
|
|
93
|
+
/**
|
|
94
|
+
* - Same as filtering packages with --filter in pnpm. Only include packages matching the filter. See https://pnpm.io/filtering.
|
|
95
|
+
*/
|
|
96
|
+
filter?: string[];
|
|
34
97
|
};
|
|
35
98
|
export declare function getWorkspacePackages(options?: {
|
|
36
99
|
publicOnly: true;
|
|
37
100
|
} & GetWorkspacePackagesOptions): Promise<PublicPackage[]>;
|
|
38
|
-
export declare function getWorkspacePackages(options?: {
|
|
39
|
-
nonPublishedOnly: true;
|
|
40
|
-
} & GetWorkspacePackagesOptions): Promise<PublicPackage[]>;
|
|
41
101
|
export declare function getWorkspacePackages(options?: {
|
|
42
102
|
publicOnly?: false | undefined;
|
|
43
103
|
} & GetWorkspacePackagesOptions): Promise<PrivatePackage[]>;
|
|
44
104
|
export declare function getWorkspacePackages(options?: GetWorkspacePackagesOptions): Promise<(PrivatePackage | PublicPackage)[]>;
|
|
45
105
|
/**
|
|
46
|
-
*
|
|
106
|
+
* Resolve the registry a package will be published to.
|
|
107
|
+
*
|
|
108
|
+
* Only `publishConfig.registry` and the ambient `npm_config_registry` are
|
|
109
|
+
* consulted — `.npmrc` layering and `@scope:registry` entries are not.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} packagePath - Path to the package directory
|
|
112
|
+
* @returns {Promise<string>} Normalized registry URL, ending in a slash
|
|
113
|
+
*/
|
|
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>;
|
|
125
|
+
/**
|
|
126
|
+
* Filter to the packages that must be published by hand before CI can take over.
|
|
127
|
+
*
|
|
128
|
+
* A brand new package has to be pushed once manually (see
|
|
129
|
+
* `code-infra publish-new-package`) before the OIDC-based workflow can publish
|
|
130
|
+
* it, so the release fails with a clear message instead of a confusing 404
|
|
131
|
+
* midway through. See {@link getPackageVersionInfo} for the version-level check.
|
|
132
|
+
*
|
|
133
|
+
* @param {PublicPackage[]} packages - Packages to check
|
|
134
|
+
* @returns {Promise<PublicPackage[]>} The subset needing a manual first publish
|
|
135
|
+
*/
|
|
136
|
+
export declare function getPackagesNeedingManualPublish(packages: PublicPackage[]): Promise<PublicPackage[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Get package version info from registry.
|
|
139
|
+
*
|
|
140
|
+
* Resolves through `pnpm view`, which reports a lookup failure the same way it
|
|
141
|
+
* reports a missing version. Use {@link getPackagesNeedingManualPublish} where
|
|
142
|
+
* absence has to be told apart from an error.
|
|
143
|
+
*
|
|
47
144
|
* @param {string} packageName - Name of the package
|
|
48
145
|
* @param {string} baseVersion - Base version to check
|
|
49
146
|
* @returns {Promise<VersionInfo>} Version information
|
|
50
147
|
*/
|
|
51
148
|
export declare function getPackageVersionInfo(packageName: string, baseVersion: string): Promise<VersionInfo>;
|
|
149
|
+
export type PublishSummaryEntry = {
|
|
150
|
+
name: string;
|
|
151
|
+
version: string;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* @typedef {Object} PublishSummaryEntry
|
|
155
|
+
* @property {string} name
|
|
156
|
+
* @property {string} version
|
|
157
|
+
*/
|
|
52
158
|
/**
|
|
53
159
|
* Publish packages with the given options
|
|
54
160
|
* @param {PublicPackage[]} packages - Packages to publish
|
|
55
161
|
* @param {PublishOptions} [options={}] - Publishing options
|
|
56
|
-
* @returns {Promise<
|
|
162
|
+
* @returns {Promise<PublishSummaryEntry[]>}
|
|
163
|
+
*/
|
|
164
|
+
export declare function publishPackages(packages: PublicPackage[], options?: PublishOptions): Promise<PublishSummaryEntry[]>;
|
|
165
|
+
export type GetTransitiveDependenciesOptions = {
|
|
166
|
+
/**
|
|
167
|
+
* - Map of workspace package name to directory path
|
|
168
|
+
*/
|
|
169
|
+
workspacePathByName?: Map<string, string>;
|
|
170
|
+
/**
|
|
171
|
+
* - Whether to include devDependencies in the traversal
|
|
172
|
+
*/
|
|
173
|
+
includeDev?: boolean;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Get all transitive workspace dependencies for a set of packages.
|
|
177
|
+
*
|
|
178
|
+
* Only follows deps whose version spec starts with `workspace:` (e.g. `workspace:*`
|
|
179
|
+
* or `workspace:^`), meaning they are sourced directly from the monorepo. An
|
|
180
|
+
* alias spec (`workspace:@scope/name@range`) is followed to the package it
|
|
181
|
+
* targets, which need not match the dependency key. Pinned
|
|
182
|
+
* external versions (e.g. `^1.0.0`) are ignored even when the package name exists
|
|
183
|
+
* in the workspace. Traverses `dependencies` and optionally `devDependencies`.
|
|
184
|
+
* Results are cached per package so each package is read from disk at most once
|
|
185
|
+
* regardless of how many roots depend on it.
|
|
186
|
+
*
|
|
187
|
+
* @param {string[]} packageNames - Package names to start the traversal from
|
|
188
|
+
* @param {GetTransitiveDependenciesOptions} [options]
|
|
189
|
+
* @returns {Promise<Set<string>>} All reachable workspace package names, including the input packages themselves
|
|
57
190
|
*/
|
|
58
|
-
export declare function
|
|
191
|
+
export declare function getTransitiveDependencies(packageNames: string[], options?: GetTransitiveDependenciesOptions): Promise<Set<string>>;
|
|
192
|
+
/**
|
|
193
|
+
* Pure validation logic: given a publish set and workspace maps, checks that all
|
|
194
|
+
* transitive hard workspace dependencies are covered and none are private.
|
|
195
|
+
*
|
|
196
|
+
* A hard dependency is one listed in `dependencies` (not `peerDependencies` or
|
|
197
|
+
* `devDependencies`) using a `workspace:` version specifier (e.g. `workspace:*` or
|
|
198
|
+
* `workspace:^`). Peer dependencies are never bundled and dev dependencies are not installed
|
|
199
|
+
* on consumer devices - both are excluded regardless of version specifier. Pinned-version
|
|
200
|
+
* references in `dependencies` are also excluded - they resolve from the registry and do
|
|
201
|
+
* not need to be co-published.
|
|
202
|
+
*
|
|
203
|
+
* @param {PublicPackage[]} packages - The packages intended for publishing
|
|
204
|
+
* @param {Map<string, PublicPackage | PrivatePackage>} workspacePackageByName - All workspace packages by name
|
|
205
|
+
* @param {Map<string, string>} workspacePathByName - Map of workspace package name to directory path
|
|
206
|
+
* @returns {Promise<{issues: string[]}>}
|
|
207
|
+
* List of human-readable issue strings. Empty when the dependency set is valid.
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
export declare function checkPublishDependencies(packages: PublicPackage[], workspacePackageByName: Map<string, PublicPackage | PrivatePackage>, workspacePathByName: Map<string, string>): Promise<{
|
|
211
|
+
issues: string[];
|
|
212
|
+
}>;
|
|
213
|
+
/**
|
|
214
|
+
* Validate that a set of packages covers all of their transitive hard workspace dependencies,
|
|
215
|
+
* and that none of those dependencies are private (which would make them unpublishable).
|
|
216
|
+
*
|
|
217
|
+
* @param {PublicPackage[]} packages - The packages intended for publishing
|
|
218
|
+
* @returns {Promise<{issues: string[]}>}
|
|
219
|
+
* List of human-readable issue strings. Empty when the dependency set is valid.
|
|
220
|
+
*/
|
|
221
|
+
export declare function validatePublishDependencies(packages: PublicPackage[]): Promise<{
|
|
222
|
+
issues: string[];
|
|
223
|
+
}>;
|
|
59
224
|
/**
|
|
60
225
|
* Read package.json from a directory
|
|
61
226
|
* @param {string} packagePath - Path to package directory
|
|
@@ -69,6 +234,34 @@ export declare function readPackageJson(packagePath: string): Promise<import('..
|
|
|
69
234
|
* @returns {Promise<void>}
|
|
70
235
|
*/
|
|
71
236
|
export declare function writePackageJson(packagePath: string, packageJson: Object): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Write the computed overrides into whichever manifest already defines
|
|
239
|
+
* overrides — preferring pnpm-workspace.yaml, falling back to package.json
|
|
240
|
+
* `pnpm.overrides`, defaulting to pnpm-workspace.yaml — and persist the result.
|
|
241
|
+
* A missing pnpm-workspace.yaml is treated as empty, so a fresh file is created
|
|
242
|
+
* with just the `overrides:` block. Rejects a `resolutions` field in
|
|
243
|
+
* package.json because pnpm 11 silently ignores it.
|
|
244
|
+
*
|
|
245
|
+
* @param {string} workspaceDir - Workspace root directory
|
|
246
|
+
* @param {Record<string, string>} overrides - Overrides to apply
|
|
247
|
+
* @returns {Promise<void>}
|
|
248
|
+
*/
|
|
249
|
+
export declare function writeOverridesToWorkspace(workspaceDir: string, overrides: Record<string, string>): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Move the publishable workspace packages in one scope to another.
|
|
252
|
+
*
|
|
253
|
+
* Only packages that are part of the workspace are touched, so dependencies
|
|
254
|
+
* that merely share the scope but come from the registry (say `@base-ui/react`
|
|
255
|
+
* alongside a workspace `@base-ui/mosaic`) are left alone. Dependents keep the
|
|
256
|
+
* original dependency name and gain a `workspace:` alias, so imports in the
|
|
257
|
+
* repo resolve exactly as before.
|
|
258
|
+
*
|
|
259
|
+
* @param {(PublicPackage | PrivatePackage)[]} packages - All workspace packages
|
|
260
|
+
* @param {string} fromScope - Scope to move away from
|
|
261
|
+
* @param {string} toScope - Scope to move to
|
|
262
|
+
* @returns {Promise<Map<string, string>>} Old package name to new package name
|
|
263
|
+
*/
|
|
264
|
+
export declare function renameWorkspaceScope(packages: (PublicPackage | PrivatePackage)[], fromScope: string, toScope: string): Promise<Map<string, string>>;
|
|
72
265
|
/**
|
|
73
266
|
* Resolve a package@version specifier to an exact version
|
|
74
267
|
* @param {string} packageSpec - Package specifier in format "package@version"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a temporary directory and registers an `onTestFinished` hook to
|
|
3
|
+
* remove it automatically when the current test ends — even if the test throws.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Promise<string>} The path of the created temporary directory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function makeTempDir(): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Write a package.json into a subdirectory of a temp workspace.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} root - Workspace root
|
|
12
|
+
* @param {string} dir - Subdirectory to create
|
|
13
|
+
* @param {object} pkgJson - Manifest contents
|
|
14
|
+
* @returns {Promise<string>} The package directory
|
|
15
|
+
*/
|
|
16
|
+
export declare function writePackage(root: string, dir: string, pkgJson: object): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} name
|
|
19
|
+
* @param {string} pkgPath
|
|
20
|
+
* @returns {import('./pnpm.mjs').PublicPackage}
|
|
21
|
+
*/
|
|
22
|
+
export declare function publicPkg(name: string, pkgPath: string): import('./pnpm.mjs').PublicPackage;
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @param {string} pkgPath
|
|
26
|
+
* @returns {import('./pnpm.mjs').PrivatePackage}
|
|
27
|
+
*/
|
|
28
|
+
export declare function privatePkg(name: string, pkgPath: string): import('./pnpm.mjs').PrivatePackage;
|
|
@@ -22,19 +22,14 @@ export declare function copyDeclarations(sourceDirectory: string, destinationDir
|
|
|
22
22
|
* @param {Object} param0
|
|
23
23
|
* @param {string} param0.inputDir
|
|
24
24
|
* @param {string} param0.buildDir
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {boolean} [param0.isFlat]
|
|
25
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles
|
|
27
26
|
* @param {'module' | 'commonjs'} [param0.packageType]
|
|
28
27
|
* @returns
|
|
29
28
|
*/
|
|
30
|
-
export declare function moveAndTransformDeclarations({ inputDir, buildDir, bundles,
|
|
29
|
+
export declare function moveAndTransformDeclarations({ inputDir, buildDir, bundles, packageType }: {
|
|
31
30
|
inputDir: string;
|
|
32
31
|
buildDir: string;
|
|
33
|
-
bundles:
|
|
34
|
-
type: import('../utils/build.mjs').BundleType;
|
|
35
|
-
dir: string;
|
|
36
|
-
}[];
|
|
37
|
-
isFlat?: boolean;
|
|
32
|
+
bundles: import('../utils/build.mjs').BundleType[];
|
|
38
33
|
packageType?: 'module' | 'commonjs';
|
|
39
34
|
}): Promise<void>;
|
|
40
35
|
/**
|
|
@@ -43,9 +38,8 @@ export declare function moveAndTransformDeclarations({ inputDir, buildDir, bundl
|
|
|
43
38
|
* After copying, babel transformations are applied to the copied files because they need to be alongside the actual js files for proper resolution.
|
|
44
39
|
*
|
|
45
40
|
* @param {Object} param0
|
|
46
|
-
* @param {boolean} [param0.isFlat = false] - Whether to place generated declaration files in a flattened directory.
|
|
47
41
|
* @param {boolean} [param0.verbose = false] - Whether to log additional information while generating and moving declaration files.
|
|
48
|
-
* @param {
|
|
42
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles - The bundles to create declarations for.
|
|
49
43
|
* @param {string} param0.srcDir - The source directory.
|
|
50
44
|
* @param {string} param0.buildDir - The build directory.
|
|
51
45
|
* @param {string} param0.cwd - The current working directory.
|
|
@@ -53,13 +47,9 @@ export declare function moveAndTransformDeclarations({ inputDir, buildDir, bundl
|
|
|
53
47
|
* @param {boolean} [param0.useTsgo=false] - Whether to build types using typescript native (tsgo).
|
|
54
48
|
* @param {'module' | 'commonjs'} [param0.packageType] - The package.json type field.
|
|
55
49
|
*/
|
|
56
|
-
export declare function createTypes({ bundles, srcDir, buildDir, cwd, skipTsc, useTsgo,
|
|
57
|
-
isFlat?: boolean;
|
|
50
|
+
export declare function createTypes({ bundles, srcDir, buildDir, cwd, skipTsc, useTsgo, packageType, verbose, }: {
|
|
58
51
|
verbose?: boolean;
|
|
59
|
-
bundles:
|
|
60
|
-
type: import('../utils/build.mjs').BundleType;
|
|
61
|
-
dir: string;
|
|
62
|
-
}[];
|
|
52
|
+
bundles: import('../utils/build.mjs').BundleType[];
|
|
63
53
|
srcDir: string;
|
|
64
54
|
buildDir: string;
|
|
65
55
|
cwd: string;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.4-canary.
|
|
3
|
+
"version": "0.0.4-canary.100",
|
|
4
|
+
"author": "MUI Team",
|
|
4
5
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
|
-
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git+https://github.com/mui/mui-public.git",
|
|
@@ -28,9 +29,9 @@
|
|
|
28
29
|
"types": "./build/utils/github.d.mts",
|
|
29
30
|
"default": "./src/utils/github.mjs"
|
|
30
31
|
},
|
|
31
|
-
"./
|
|
32
|
-
"types": "./build/
|
|
33
|
-
"default": "./src/
|
|
32
|
+
"./remark": {
|
|
33
|
+
"types": "./build/remark/config.d.mts",
|
|
34
|
+
"default": "./src/remark/config.mjs"
|
|
34
35
|
},
|
|
35
36
|
"./prettier": {
|
|
36
37
|
"types": "./build/prettier.d.mts",
|
|
@@ -43,34 +44,37 @@
|
|
|
43
44
|
"./brokenLinksChecker": {
|
|
44
45
|
"types": "./build/brokenLinksChecker/index.d.mts",
|
|
45
46
|
"default": "./src/brokenLinksChecker/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./build-env": {
|
|
49
|
+
"types": "./src/build-env.d.ts"
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
52
|
"bin": {
|
|
49
53
|
"code-infra": "./bin/code-infra.mjs"
|
|
50
54
|
},
|
|
51
55
|
"dependencies": {
|
|
52
|
-
"@argos-ci/core": "
|
|
53
|
-
"@babel/cli": "^7.
|
|
54
|
-
"@babel/core": "^7.29.
|
|
55
|
-
"@babel/plugin-syntax-jsx": "^7.
|
|
56
|
-
"@babel/plugin-syntax-typescript": "^7.
|
|
57
|
-
"@babel/plugin-transform-runtime": "^7.29.
|
|
58
|
-
"@babel/preset-env": "^7.29.
|
|
59
|
-
"@babel/preset-react": "^7.
|
|
60
|
-
"@babel/preset-typescript": "^7.
|
|
61
|
-
"@eslint/compat": "^2.0
|
|
56
|
+
"@argos-ci/core": "6.5.0",
|
|
57
|
+
"@babel/cli": "^7.29.7",
|
|
58
|
+
"@babel/core": "^7.29.7",
|
|
59
|
+
"@babel/plugin-syntax-jsx": "^7.29.7",
|
|
60
|
+
"@babel/plugin-syntax-typescript": "^7.29.7",
|
|
61
|
+
"@babel/plugin-transform-runtime": "^7.29.7",
|
|
62
|
+
"@babel/preset-env": "^7.29.7",
|
|
63
|
+
"@babel/preset-react": "^7.29.7",
|
|
64
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
65
|
+
"@eslint/compat": "^2.1.0",
|
|
62
66
|
"@eslint/js": "^10.0.1",
|
|
63
|
-
"@eslint/json": "^
|
|
64
|
-
"@inquirer/confirm": "^6.
|
|
65
|
-
"@inquirer/select": "^5.
|
|
66
|
-
"@napi-rs/keyring": "^1.
|
|
67
|
+
"@eslint/json": "^2.0.1",
|
|
68
|
+
"@inquirer/confirm": "^6.1.1",
|
|
69
|
+
"@inquirer/select": "^5.2.1",
|
|
70
|
+
"@napi-rs/keyring": "^1.3.0",
|
|
67
71
|
"@octokit/auth-action": "^6.0.2",
|
|
68
72
|
"@octokit/oauth-methods": "^6.0.2",
|
|
69
73
|
"@octokit/rest": "^22.0.1",
|
|
70
|
-
"@pnpm/find-workspace-dir": "^1000.1.
|
|
71
|
-
"@typescript-eslint/types": "^8.
|
|
72
|
-
"@typescript-eslint/utils": "^8.
|
|
73
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
74
|
+
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
75
|
+
"@typescript-eslint/types": "^8.64.0",
|
|
76
|
+
"@typescript-eslint/utils": "^8.64.0",
|
|
77
|
+
"@vitest/eslint-plugin": "^1.6.23",
|
|
74
78
|
"babel-plugin-optimize-clsx": "^2.6.2",
|
|
75
79
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
76
80
|
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
@@ -78,51 +82,69 @@
|
|
|
78
82
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
79
83
|
"babel-plugin-transform-remove-imports": "^1.8.1",
|
|
80
84
|
"chalk": "^5.6.2",
|
|
81
|
-
"clipboardy": "^5.3.
|
|
82
|
-
"content-type": "^
|
|
85
|
+
"clipboardy": "^5.3.2",
|
|
86
|
+
"content-type": "^2.0.0",
|
|
83
87
|
"env-ci": "^11.2.0",
|
|
88
|
+
"es-toolkit": "^1.49.0",
|
|
84
89
|
"eslint-config-prettier": "^10.1.8",
|
|
85
|
-
"eslint-import-resolver-typescript": "^4.4.
|
|
86
|
-
"eslint-module-utils": "^2.
|
|
87
|
-
"eslint-plugin-compat": "^
|
|
90
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
91
|
+
"eslint-module-utils": "^2.14.0",
|
|
92
|
+
"eslint-plugin-compat": "^7.0.2",
|
|
88
93
|
"eslint-plugin-import": "^2.32.0",
|
|
89
94
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
90
|
-
"eslint-plugin-
|
|
95
|
+
"eslint-plugin-mdx": "^3.8.1",
|
|
96
|
+
"eslint-plugin-mocha": "^11.3.0",
|
|
91
97
|
"eslint-plugin-react": "^7.37.5",
|
|
92
98
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
93
|
-
"eslint-plugin-react-hooks": "^7.
|
|
94
|
-
"eslint-plugin-testing-library": "^7.16.
|
|
95
|
-
"es-toolkit": "^1.44.0",
|
|
99
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
|
+
"eslint-plugin-testing-library": "^7.16.2",
|
|
96
101
|
"execa": "^9.6.1",
|
|
97
102
|
"git-url-parse": "^16.1.0",
|
|
98
|
-
"globals": "^
|
|
99
|
-
"globby": "^16.
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
103
|
+
"globals": "^17.7.0",
|
|
104
|
+
"globby": "^16.2.2",
|
|
105
|
+
"html-validate": "^11.5.6",
|
|
106
|
+
"minimatch": "^10.2.5",
|
|
107
|
+
"node-html-parser": "^9.0.0",
|
|
108
|
+
"open": "^11.0.0",
|
|
109
|
+
"postcss-styled-syntax": "^0.7.2",
|
|
104
110
|
"regexp.escape": "^2.0.1",
|
|
105
111
|
"rehype-slug": "^6.0.0",
|
|
106
112
|
"rehype-stringify": "^10.0.1",
|
|
113
|
+
"remark-frontmatter": "^5.0.0",
|
|
107
114
|
"remark-gfm": "^4.0.1",
|
|
115
|
+
"remark-lint": "^10.0.1",
|
|
116
|
+
"remark-lint-code-block-style": "^4.0.1",
|
|
117
|
+
"remark-lint-fenced-code-flag": "^4.2.0",
|
|
118
|
+
"remark-lint-heading-increment": "^4.0.1",
|
|
119
|
+
"remark-lint-heading-style": "^4.0.1",
|
|
120
|
+
"remark-lint-no-duplicate-headings": "^4.0.1",
|
|
121
|
+
"remark-lint-no-empty-url": "^4.0.1",
|
|
122
|
+
"remark-lint-no-heading-punctuation": "^4.0.1",
|
|
123
|
+
"remark-lint-no-multiple-toplevel-headings": "^4.0.1",
|
|
124
|
+
"remark-lint-no-undefined-references": "^5.0.2",
|
|
125
|
+
"remark-lint-no-unused-definitions": "^4.0.2",
|
|
126
|
+
"remark-lint-table-pipes": "^5.0.1",
|
|
108
127
|
"remark-parse": "^11.0.0",
|
|
109
128
|
"remark-rehype": "^11.1.2",
|
|
110
129
|
"resolve-pkg-maps": "^1.0.0",
|
|
111
|
-
"semver": "^7.
|
|
130
|
+
"semver": "^7.8.5",
|
|
112
131
|
"stylelint-config-standard": "^40.0.0",
|
|
113
|
-
"typescript-eslint": "^8.
|
|
132
|
+
"typescript-eslint": "^8.64.0",
|
|
114
133
|
"unified": "^11.0.5",
|
|
134
|
+
"unified-lint-rule": "^3.0.1",
|
|
135
|
+
"unist-util-visit": "^5.1.0",
|
|
136
|
+
"yaml": "^2.9.0",
|
|
115
137
|
"yargs": "^18.0.0",
|
|
116
|
-
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.
|
|
117
|
-
"@mui/internal-babel-plugin-
|
|
118
|
-
"@mui/internal-babel-plugin-
|
|
138
|
+
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.23",
|
|
139
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30",
|
|
140
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.41"
|
|
119
141
|
},
|
|
120
142
|
"peerDependencies": {
|
|
121
143
|
"@next/eslint-plugin-next": "*",
|
|
122
144
|
"@typescript/native-preview": ">=7.0.0-dev.0",
|
|
123
145
|
"eslint": "^9.0.0 || ^10.0.0",
|
|
124
146
|
"prettier": "^3.0.0",
|
|
125
|
-
"typescript": "^5.0.0"
|
|
147
|
+
"typescript": "^5.0.0 || ^6.0.0"
|
|
126
148
|
},
|
|
127
149
|
"peerDependenciesMeta": {
|
|
128
150
|
"@typescript/native-preview": {
|
|
@@ -136,35 +158,40 @@
|
|
|
136
158
|
"@octokit/types": "16.0.0",
|
|
137
159
|
"@types/babel__core": "7.20.5",
|
|
138
160
|
"@types/babel__preset-env": "7.10.0",
|
|
139
|
-
"@types/content-type": "1.1.9",
|
|
140
161
|
"@types/env-ci": "3.1.4",
|
|
141
162
|
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
142
|
-
"@types/estree": "1.0.
|
|
163
|
+
"@types/estree": "1.0.9",
|
|
143
164
|
"@types/estree-jsx": "1.0.5",
|
|
165
|
+
"@types/mdast": "4.0.4",
|
|
144
166
|
"@types/regexp.escape": "2.0.0",
|
|
145
167
|
"@types/yargs": "17.0.35",
|
|
146
|
-
"@typescript-eslint/parser": "8.
|
|
147
|
-
"@typescript-eslint/rule-tester": "8.
|
|
148
|
-
"eslint": "10.0
|
|
149
|
-
"get-port": "7.
|
|
150
|
-
"prettier": "3.
|
|
151
|
-
"
|
|
152
|
-
"
|
|
168
|
+
"@typescript-eslint/parser": "8.64.0",
|
|
169
|
+
"@typescript-eslint/rule-tester": "8.64.0",
|
|
170
|
+
"eslint": "10.7.0",
|
|
171
|
+
"get-port": "7.2.0",
|
|
172
|
+
"prettier": "3.9.5",
|
|
173
|
+
"remark": "15.0.1",
|
|
174
|
+
"remark-mdx": "3.1.1",
|
|
175
|
+
"serve": "14.2.6",
|
|
176
|
+
"typescript-eslint": "8.64.0"
|
|
153
177
|
},
|
|
154
178
|
"files": [
|
|
155
179
|
"bin",
|
|
156
180
|
"build",
|
|
157
181
|
"src",
|
|
182
|
+
"vale",
|
|
158
183
|
"README.md",
|
|
159
|
-
"LICENSE"
|
|
184
|
+
"LICENSE",
|
|
185
|
+
"!src/**/__fixtures__/**",
|
|
186
|
+
"!src/**/*.test.*"
|
|
160
187
|
],
|
|
161
188
|
"publishConfig": {
|
|
162
189
|
"access": "public"
|
|
163
190
|
},
|
|
164
|
-
"gitSha": "
|
|
191
|
+
"gitSha": "6542022a25f84984a49b5a8beafdff2df0e0966b",
|
|
165
192
|
"scripts": {
|
|
166
193
|
"build": "tsgo -p tsconfig.build.json",
|
|
167
|
-
"typescript": "tsgo -
|
|
194
|
+
"typescript": "tsgo -noEmit",
|
|
168
195
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
|
169
196
|
"test:copy": "rm -rf build && node bin/code-infra.mjs copy-files --glob \"src/cli/*.mjs\" --glob \"src/eslint/**/*.mjs:esm\""
|
|
170
197
|
}
|
package/src/babel-config.mjs
CHANGED
|
@@ -10,6 +10,10 @@ import pluginTransformImportMeta from 'babel-plugin-transform-import-meta';
|
|
|
10
10
|
import pluginTransformInlineEnvVars from 'babel-plugin-transform-inline-environment-variables';
|
|
11
11
|
import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-types';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {'annotation' | 'syntax' | 'infer' | 'all'} ReactCompilationMode
|
|
15
|
+
*/
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* @param {Object} param0
|
|
15
19
|
* @param {boolean} [param0.debug]
|
|
@@ -20,7 +24,8 @@ import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-type
|
|
|
20
24
|
* @param {string | null} param0.outExtension - Specify the output file extension.
|
|
21
25
|
* @param {string} param0.runtimeVersion
|
|
22
26
|
* @param {string} [param0.reactCompilerReactVersion]
|
|
23
|
-
* @param {
|
|
27
|
+
* @param {ReactCompilationMode} [param0.reactCompilerMode]
|
|
28
|
+
* @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
|
|
24
29
|
* @returns {import('@babel/core').TransformOptions} The base Babel configuration.
|
|
25
30
|
*/
|
|
26
31
|
export function getBaseConfig({
|
|
@@ -33,6 +38,7 @@ export function getBaseConfig({
|
|
|
33
38
|
outExtension,
|
|
34
39
|
reactCompilerReactVersion,
|
|
35
40
|
reactCompilerMode,
|
|
41
|
+
displayName,
|
|
36
42
|
}) {
|
|
37
43
|
/**
|
|
38
44
|
* @type {import('@babel/preset-env').Options}
|
|
@@ -57,7 +63,7 @@ export function getBaseConfig({
|
|
|
57
63
|
},
|
|
58
64
|
'@babel/plugin-transform-runtime',
|
|
59
65
|
],
|
|
60
|
-
[pluginDisplayName, {}, '@mui/internal-babel-plugin-display-name'],
|
|
66
|
+
[pluginDisplayName, { ...displayName }, '@mui/internal-babel-plugin-display-name'],
|
|
61
67
|
[
|
|
62
68
|
pluginTransformInlineEnvVars,
|
|
63
69
|
{
|
|
@@ -183,6 +189,6 @@ export default function getBabelConfig(api) {
|
|
|
183
189
|
removePropTypes: process.env.MUI_REMOVE_PROP_TYPES === 'true',
|
|
184
190
|
noResolveImports,
|
|
185
191
|
reactCompilerReactVersion: process.env.MUI_REACT_COMPILER_REACT_VERSION,
|
|
186
|
-
reactCompilerMode: process.env.MUI_REACT_COMPILER_MODE,
|
|
192
|
+
reactCompilerMode: /** @type {ReactCompilationMode} */ (process.env.MUI_REACT_COMPILER_MODE),
|
|
187
193
|
});
|
|
188
194
|
}
|