@mui/internal-code-infra 0.0.4-canary.10 → 0.0.4-canary.101

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.
Files changed (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +21 -7
  3. package/build/babel-config.d.mts +5 -1
  4. package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
  5. package/build/brokenLinksChecker/index.d.mts +192 -2
  6. package/build/changelog/fetchChangelogs.d.mts +3 -0
  7. package/build/changelog/types.d.ts +3 -1
  8. package/build/cli/cmdArgosPush.d.mts +8 -2
  9. package/build/cli/cmdBuild.d.mts +48 -2
  10. package/build/cli/cmdCopyFiles.d.mts +14 -2
  11. package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
  12. package/build/cli/cmdGenerateChangelog.d.mts +17 -2
  13. package/build/cli/cmdGithubAuth.d.mts +2 -2
  14. package/build/cli/cmdListWorkspaces.d.mts +14 -2
  15. package/build/cli/cmdNetlifyIgnore.d.mts +12 -2
  16. package/build/cli/cmdPublish.d.mts +23 -4
  17. package/build/cli/cmdPublishCanary.d.mts +20 -2
  18. package/build/cli/cmdPublishNewPackage.d.mts +10 -2
  19. package/build/cli/cmdRenameScope.d.mts +18 -0
  20. package/build/cli/cmdSetVersionOverrides.d.mts +5 -2
  21. package/build/cli/cmdVale.d.mts +46 -0
  22. package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
  23. package/build/eslint/baseConfig.d.mts +3 -1
  24. package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
  25. package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
  26. package/build/eslint/mui/rules/no-floating-cleanup.d.mts +5 -0
  27. package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
  28. package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
  29. package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +8 -2
  30. package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
  31. package/build/remark/config.d.mts +43 -0
  32. package/build/remark/createLintTester.d.mts +10 -0
  33. package/build/remark/firstBlockHeading.d.mts +4 -0
  34. package/build/remark/gitDiff.d.mts +2 -0
  35. package/build/remark/noSpaceInLinks.d.mts +2 -0
  36. package/build/remark/straightQuotes.d.mts +2 -0
  37. package/build/remark/tableAlignment.d.mts +2 -0
  38. package/build/remark/terminalLanguage.d.mts +2 -0
  39. package/build/utils/babel.d.mts +7 -1
  40. package/build/utils/build.d.mts +59 -37
  41. package/build/utils/extractErrorCodes.d.mts +9 -0
  42. package/build/utils/git.d.mts +16 -0
  43. package/build/utils/github.d.mts +13 -1
  44. package/build/utils/pnpm.d.mts +226 -20
  45. package/build/utils/testUtils.d.mts +28 -0
  46. package/build/utils/typescript.d.mts +6 -16
  47. package/package.json +79 -53
  48. package/src/babel-config.mjs +3 -1
  49. package/src/brokenLinksChecker/crawlWorker.mjs +240 -0
  50. package/src/brokenLinksChecker/index.mjs +263 -188
  51. package/src/changelog/fetchChangelogs.mjs +8 -2
  52. package/src/changelog/renderChangelog.mjs +1 -1
  53. package/src/changelog/types.ts +3 -1
  54. package/src/cli/cmdBuild.mjs +53 -88
  55. package/src/cli/cmdListWorkspaces.mjs +7 -1
  56. package/src/cli/cmdNetlifyIgnore.mjs +30 -5
  57. package/src/cli/cmdPublish.mjs +79 -37
  58. package/src/cli/cmdPublishCanary.mjs +96 -24
  59. package/src/cli/cmdPublishNewPackage.mjs +31 -8
  60. package/src/cli/cmdRenameScope.mjs +76 -0
  61. package/src/cli/cmdSetVersionOverrides.mjs +40 -34
  62. package/src/cli/cmdVale.mjs +513 -0
  63. package/src/cli/index.mjs +4 -0
  64. package/src/cli/packageJson.d.ts +2 -3
  65. package/src/eslint/baseConfig.mjs +51 -19
  66. package/src/eslint/docsConfig.mjs +2 -1
  67. package/src/eslint/mui/config.mjs +24 -4
  68. package/src/eslint/mui/index.mjs +6 -0
  69. package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
  70. package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
  71. package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
  72. package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
  73. package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
  74. package/src/estree-typescript.d.ts +1 -1
  75. package/src/remark/config.mjs +157 -0
  76. package/src/remark/createLintTester.mjs +19 -0
  77. package/src/remark/firstBlockHeading.mjs +87 -0
  78. package/src/remark/gitDiff.mjs +43 -0
  79. package/src/remark/noSpaceInLinks.mjs +42 -0
  80. package/src/remark/straightQuotes.mjs +31 -0
  81. package/src/remark/tableAlignment.mjs +23 -0
  82. package/src/remark/terminalLanguage.mjs +19 -0
  83. package/src/stylelint/index.mjs +2 -2
  84. package/src/untyped-plugins.d.ts +14 -14
  85. package/src/utils/build.mjs +604 -270
  86. package/src/utils/git.mjs +27 -7
  87. package/src/utils/pnpm.mjs +636 -60
  88. package/src/utils/testUtils.mjs +53 -0
  89. package/src/utils/typescript.mjs +23 -42
  90. package/vale/.vale.ini +1 -0
  91. package/vale/styles/MUI/CorrectReferenceAllCases.yml +42 -0
  92. package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
  93. package/vale/styles/MUI/GoogleLatin.yml +11 -0
  94. package/vale/styles/MUI/MuiBrandName.yml +22 -0
  95. package/vale/styles/MUI/NoBritish.yml +112 -0
  96. package/vale/styles/MUI/NoCompanyName.yml +17 -0
  97. package/build/markdownlint/duplicate-h1.d.mts +0 -56
  98. package/build/markdownlint/git-diff.d.mts +0 -11
  99. package/build/markdownlint/index.d.mts +0 -52
  100. package/build/markdownlint/straight-quotes.d.mts +0 -11
  101. package/build/markdownlint/table-alignment.d.mts +0 -11
  102. package/build/markdownlint/terminal-language.d.mts +0 -11
  103. package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
  104. package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
  105. package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
  106. package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
  107. package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
  108. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -28
  109. package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
  110. package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
  111. package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
  112. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
  113. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
  114. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
  115. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
  116. package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
  117. package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
  118. package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
  119. package/src/brokenLinksChecker/index.test.ts +0 -261
  120. package/src/changelog/categorizeCommits.test.ts +0 -319
  121. package/src/changelog/filterCommits.test.ts +0 -363
  122. package/src/changelog/parseCommitLabels.test.ts +0 -509
  123. package/src/changelog/renderChangelog.test.ts +0 -378
  124. package/src/changelog/sortSections.test.ts +0 -199
  125. package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
  126. package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
  127. package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
  128. package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
  129. package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
  130. package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
  131. package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
  132. package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
  133. package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
  134. package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
  135. package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
  136. package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
  137. package/src/markdownlint/duplicate-h1.mjs +0 -69
  138. package/src/markdownlint/git-diff.mjs +0 -31
  139. package/src/markdownlint/index.mjs +0 -62
  140. package/src/markdownlint/straight-quotes.mjs +0 -26
  141. package/src/markdownlint/table-alignment.mjs +0 -42
  142. package/src/markdownlint/terminal-language.mjs +0 -19
  143. package/src/utils/build.test.mjs +0 -705
  144. package/src/utils/template.test.mjs +0 -133
  145. package/src/utils/typescript.test.mjs +0 -380
@@ -1,78 +1,188 @@
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
- nonPublishedOnly?: boolean;
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
+ */
34
96
  filter?: string[];
35
97
  };
36
98
  export declare function getWorkspacePackages(options?: {
37
99
  publicOnly: true;
38
100
  } & GetWorkspacePackagesOptions): Promise<PublicPackage[]>;
39
- export declare function getWorkspacePackages(options?: {
40
- nonPublishedOnly: true;
41
- } & GetWorkspacePackagesOptions): Promise<PublicPackage[]>;
42
101
  export declare function getWorkspacePackages(options?: {
43
102
  publicOnly?: false | undefined;
44
103
  } & GetWorkspacePackagesOptions): Promise<PrivatePackage[]>;
45
104
  export declare function getWorkspacePackages(options?: GetWorkspacePackagesOptions): Promise<(PrivatePackage | PublicPackage)[]>;
46
105
  /**
47
- * Get package version info from registry
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
+ *
48
144
  * @param {string} packageName - Name of the package
49
145
  * @param {string} baseVersion - Base version to check
50
146
  * @returns {Promise<VersionInfo>} Version information
51
147
  */
52
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
+ */
53
158
  /**
54
159
  * Publish packages with the given options
55
160
  * @param {PublicPackage[]} packages - Packages to publish
56
161
  * @param {PublishOptions} [options={}] - Publishing options
57
- * @returns {Promise<void>}
162
+ * @returns {Promise<PublishSummaryEntry[]>}
58
163
  */
59
- export declare function publishPackages(packages: PublicPackage[], options?: PublishOptions): Promise<void>;
164
+ export declare function publishPackages(packages: PublicPackage[], options?: PublishOptions): Promise<PublishSummaryEntry[]>;
60
165
  export type GetTransitiveDependenciesOptions = {
166
+ /**
167
+ * - Map of workspace package name to directory path
168
+ */
61
169
  workspacePathByName?: Map<string, string>;
170
+ /**
171
+ * - Whether to include devDependencies in the traversal
172
+ */
62
173
  includeDev?: boolean;
63
174
  };
64
- /**
65
- * @typedef {Object} GetTransitiveDependenciesOptions
66
- * @property {Map<string, string>} [workspacePathByName] - Map of workspace package name to directory path
67
- * @property {boolean} [includeDev=true] - Whether to include devDependencies in the traversal
68
- */
69
175
  /**
70
176
  * Get all transitive workspace dependencies for a set of packages.
71
177
  *
72
- * Traverses `dependencies`, `peerDependencies`, and optionally `devDependencies`,
73
- * following only packages that exist in `workspacePathByName`. Results are cached
74
- * per package so each package is read from disk at most once regardless of how many
75
- * roots depend on it.
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.
76
186
  *
77
187
  * @param {string[]} packageNames - Package names to start the traversal from
78
188
  * @param {GetTransitiveDependenciesOptions} [options]
@@ -80,7 +190,28 @@ export type GetTransitiveDependenciesOptions = {
80
190
  */
81
191
  export declare function getTransitiveDependencies(packageNames: string[], options?: GetTransitiveDependenciesOptions): Promise<Set<string>>;
82
192
  /**
83
- * Validate that a set of packages covers all of their transitive workspace dependencies,
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,
84
215
  * and that none of those dependencies are private (which would make them unpublishable).
85
216
  *
86
217
  * @param {PublicPackage[]} packages - The packages intended for publishing
@@ -104,18 +235,93 @@ export declare function readPackageJson(packagePath: string): Promise<import('..
104
235
  */
105
236
  export declare function writePackageJson(packagePath: string, packageJson: Object): Promise<void>;
106
237
  /**
107
- * Resolve a package@version specifier to an exact version
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>>;
265
+ /**
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
+ *
108
308
  * @param {string} packageSpec - Package specifier in format "package@version"
309
+ * @param {import('@pnpm/config.version-policy').PublishedByPolicy} policy - Cooldown from {@link getMinimumReleaseAgePolicy}
109
310
  * @returns {Promise<string>} Exact version string
110
311
  */
111
- export declare function resolveVersion(packageSpec: string): Promise<string>;
312
+ export declare function resolveVersion(packageSpec: string, policy: import('@pnpm/config.version-policy').PublishedByPolicy): Promise<string>;
112
313
  /**
113
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
+ *
114
319
  * @param {string} packageSpec - Package specifier in format "package@version"
115
320
  * @param {string} dependency - Dependency name to look up
321
+ * @param {import('@pnpm/config.version-policy').PublishedByPolicy} policy - Registry cooldown to resolve within
116
322
  * @returns {Promise<string>} Exact version string of the dependency
117
323
  */
118
- 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>;
119
325
  /**
120
326
  * Get the maximum semver version between two versions
121
327
  * @param {string} a
@@ -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 {{type: import('../utils/build.mjs').BundleType, dir: string}[]} param0.bundles
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, isFlat, packageType }: {
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 {{type: import('../utils/build.mjs').BundleType, dir: string}[]} param0.bundles - The bundles to create declarations for.
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, isFlat, packageType, verbose }: {
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.10",
3
+ "version": "0.0.4-canary.101",
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
- "./markdownlint": {
32
- "types": "./build/markdownlint/index.d.mts",
33
- "default": "./src/markdownlint/index.mjs"
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",
@@ -52,28 +53,30 @@
52
53
  "code-infra": "./bin/code-infra.mjs"
53
54
  },
54
55
  "dependencies": {
55
- "@argos-ci/core": "^5.1.1",
56
- "@babel/cli": "^7.28.6",
57
- "@babel/core": "^7.29.0",
58
- "@babel/plugin-syntax-jsx": "^7.28.6",
59
- "@babel/plugin-syntax-typescript": "^7.28.6",
60
- "@babel/plugin-transform-runtime": "^7.29.0",
61
- "@babel/preset-env": "^7.29.0",
62
- "@babel/preset-react": "^7.28.5",
63
- "@babel/preset-typescript": "^7.28.5",
64
- "@eslint/compat": "^2.0.3",
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",
65
66
  "@eslint/js": "^10.0.1",
66
- "@eslint/json": "^1.1.0",
67
- "@inquirer/confirm": "^6.0.8",
68
- "@inquirer/select": "^5.1.0",
69
- "@napi-rs/keyring": "^1.2.0",
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",
70
71
  "@octokit/auth-action": "^6.0.2",
71
72
  "@octokit/oauth-methods": "^6.0.2",
72
73
  "@octokit/rest": "^22.0.1",
73
- "@pnpm/find-workspace-dir": "^1000.1.4",
74
- "@typescript-eslint/types": "^8.57.1",
75
- "@typescript-eslint/utils": "^8.57.1",
76
- "@vitest/eslint-plugin": "^1.6.11",
74
+ "@pnpm/config.version-policy": "^1100.1.9",
75
+ "@pnpm/find-workspace-dir": "^1000.1.5",
76
+ "@pnpm/parse-wanted-dependency": "^1001.0.0",
77
+ "@typescript-eslint/types": "^8.64.0",
78
+ "@typescript-eslint/utils": "^8.64.0",
79
+ "@vitest/eslint-plugin": "^1.6.23",
77
80
  "babel-plugin-optimize-clsx": "^2.6.2",
78
81
  "babel-plugin-react-compiler": "^1.0.0",
79
82
  "babel-plugin-transform-import-meta": "^2.3.3",
@@ -81,51 +84,69 @@
81
84
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
82
85
  "babel-plugin-transform-remove-imports": "^1.8.1",
83
86
  "chalk": "^5.6.2",
84
- "clipboardy": "^5.3.1",
85
- "content-type": "^1.0.5",
87
+ "clipboardy": "^5.3.2",
88
+ "content-type": "^2.0.0",
86
89
  "env-ci": "^11.2.0",
90
+ "es-toolkit": "^1.49.0",
87
91
  "eslint-config-prettier": "^10.1.8",
88
- "eslint-import-resolver-typescript": "^4.4.4",
89
- "eslint-module-utils": "^2.12.1",
90
- "eslint-plugin-compat": "^7.0.1",
92
+ "eslint-import-resolver-typescript": "^4.4.5",
93
+ "eslint-module-utils": "^2.14.0",
94
+ "eslint-plugin-compat": "^7.0.2",
91
95
  "eslint-plugin-import": "^2.32.0",
92
96
  "eslint-plugin-jsx-a11y": "^6.10.2",
93
- "eslint-plugin-mocha": "^11.2.0",
97
+ "eslint-plugin-mdx": "^3.8.1",
98
+ "eslint-plugin-mocha": "^11.3.0",
94
99
  "eslint-plugin-react": "^7.37.5",
95
100
  "eslint-plugin-react-compiler": "^19.1.0-rc.2",
96
- "eslint-plugin-react-hooks": "^7.0.1",
97
- "eslint-plugin-testing-library": "^7.16.0",
98
- "es-toolkit": "^1.45.1",
101
+ "eslint-plugin-react-hooks": "^7.1.1",
102
+ "eslint-plugin-testing-library": "^7.16.2",
99
103
  "execa": "^9.6.1",
100
104
  "git-url-parse": "^16.1.0",
101
- "globals": "^17.4.0",
102
- "globby": "^16.1.1",
103
- "minimatch": "^10.2.4",
104
- "node-html-parser": "^7.1.0",
105
+ "globals": "^17.7.0",
106
+ "globby": "^16.2.2",
107
+ "html-validate": "^11.5.6",
108
+ "minimatch": "^10.2.5",
109
+ "node-html-parser": "^9.0.0",
105
110
  "open": "^11.0.0",
106
- "postcss-styled-syntax": "^0.7.1",
111
+ "postcss-styled-syntax": "^0.7.2",
107
112
  "regexp.escape": "^2.0.1",
108
113
  "rehype-slug": "^6.0.0",
109
114
  "rehype-stringify": "^10.0.1",
115
+ "remark-frontmatter": "^5.0.0",
110
116
  "remark-gfm": "^4.0.1",
117
+ "remark-lint": "^10.0.1",
118
+ "remark-lint-code-block-style": "^4.0.1",
119
+ "remark-lint-fenced-code-flag": "^4.2.0",
120
+ "remark-lint-heading-increment": "^4.0.1",
121
+ "remark-lint-heading-style": "^4.0.1",
122
+ "remark-lint-no-duplicate-headings": "^4.0.1",
123
+ "remark-lint-no-empty-url": "^4.0.1",
124
+ "remark-lint-no-heading-punctuation": "^4.0.1",
125
+ "remark-lint-no-multiple-toplevel-headings": "^4.0.1",
126
+ "remark-lint-no-undefined-references": "^5.0.2",
127
+ "remark-lint-no-unused-definitions": "^4.0.2",
128
+ "remark-lint-table-pipes": "^5.0.1",
111
129
  "remark-parse": "^11.0.0",
112
130
  "remark-rehype": "^11.1.2",
113
131
  "resolve-pkg-maps": "^1.0.0",
114
- "semver": "^7.7.4",
132
+ "semver": "^7.8.5",
115
133
  "stylelint-config-standard": "^40.0.0",
116
- "typescript-eslint": "^8.57.1",
134
+ "typescript-eslint": "^8.64.0",
117
135
  "unified": "^11.0.5",
136
+ "unified-lint-rule": "^3.0.1",
137
+ "unist-util-visit": "^5.1.0",
138
+ "yaml": "^2.9.0",
118
139
  "yargs": "^18.0.0",
119
- "@mui/internal-babel-plugin-display-name": "1.0.4-canary.14",
120
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.33",
121
- "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.24"
140
+ "@mui/internal-babel-plugin-display-name": "1.0.4-canary.23",
141
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30",
142
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.41"
122
143
  },
123
144
  "peerDependencies": {
124
145
  "@next/eslint-plugin-next": "*",
125
146
  "@typescript/native-preview": ">=7.0.0-dev.0",
126
147
  "eslint": "^9.0.0 || ^10.0.0",
127
148
  "prettier": "^3.0.0",
128
- "typescript": "^5.0.0"
149
+ "typescript": "^5.0.0 || ^6.0.0"
129
150
  },
130
151
  "peerDependenciesMeta": {
131
152
  "@typescript/native-preview": {
@@ -139,32 +160,37 @@
139
160
  "@octokit/types": "16.0.0",
140
161
  "@types/babel__core": "7.20.5",
141
162
  "@types/babel__preset-env": "7.10.0",
142
- "@types/content-type": "1.1.9",
143
163
  "@types/env-ci": "3.1.4",
144
164
  "@types/eslint-plugin-jsx-a11y": "6.10.1",
145
- "@types/estree": "1.0.8",
165
+ "@types/estree": "1.0.9",
146
166
  "@types/estree-jsx": "1.0.5",
167
+ "@types/mdast": "4.0.4",
147
168
  "@types/regexp.escape": "2.0.0",
148
169
  "@types/yargs": "17.0.35",
149
- "@typescript-eslint/parser": "8.57.1",
150
- "@typescript-eslint/rule-tester": "8.57.1",
151
- "eslint": "10.0.3",
152
- "get-port": "7.1.0",
153
- "prettier": "3.8.1",
170
+ "@typescript-eslint/parser": "8.64.0",
171
+ "@typescript-eslint/rule-tester": "8.64.0",
172
+ "eslint": "10.7.0",
173
+ "get-port": "7.2.0",
174
+ "prettier": "3.9.5",
175
+ "remark": "15.0.1",
176
+ "remark-mdx": "3.1.1",
154
177
  "serve": "14.2.6",
155
- "typescript-eslint": "8.57.1"
178
+ "typescript-eslint": "8.64.0"
156
179
  },
157
180
  "files": [
158
181
  "bin",
159
182
  "build",
160
183
  "src",
184
+ "vale",
161
185
  "README.md",
162
- "LICENSE"
186
+ "LICENSE",
187
+ "!src/**/__fixtures__/**",
188
+ "!src/**/*.test.*"
163
189
  ],
164
190
  "publishConfig": {
165
191
  "access": "public"
166
192
  },
167
- "gitSha": "b989d008bd34fbf9fb9d3395da2f6a32536f574d",
193
+ "gitSha": "cbb48ed31d032fb3e0f5b02d9eaf72fcd5828376",
168
194
  "scripts": {
169
195
  "build": "tsgo -p tsconfig.build.json",
170
196
  "typescript": "tsgo -noEmit",
@@ -25,6 +25,7 @@ import pluginRemovePropTypes from 'babel-plugin-transform-react-remove-prop-type
25
25
  * @param {string} param0.runtimeVersion
26
26
  * @param {string} [param0.reactCompilerReactVersion]
27
27
  * @param {ReactCompilationMode} [param0.reactCompilerMode]
28
+ * @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
28
29
  * @returns {import('@babel/core').TransformOptions} The base Babel configuration.
29
30
  */
30
31
  export function getBaseConfig({
@@ -37,6 +38,7 @@ export function getBaseConfig({
37
38
  outExtension,
38
39
  reactCompilerReactVersion,
39
40
  reactCompilerMode,
41
+ displayName,
40
42
  }) {
41
43
  /**
42
44
  * @type {import('@babel/preset-env').Options}
@@ -61,7 +63,7 @@ export function getBaseConfig({
61
63
  },
62
64
  '@babel/plugin-transform-runtime',
63
65
  ],
64
- [pluginDisplayName, {}, '@mui/internal-babel-plugin-display-name'],
66
+ [pluginDisplayName, { ...displayName }, '@mui/internal-babel-plugin-display-name'],
65
67
  [
66
68
  pluginTransformInlineEnvVars,
67
69
  {