@mui/internal-code-infra 0.1.1-canary.4 → 0.1.1-canary.40
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 +36 -4
- package/build/babel-config.d.mts +7 -1
- package/build/changelog/changelogChanges.d.mts +42 -0
- package/build/changelog/changelogGrouping.d.mts +52 -0
- package/build/changelog/changelogMarkdown.d.mts +69 -0
- package/build/changelog/changelogTags.d.mts +15 -0
- package/build/changelog/changelogTitle.d.mts +28 -0
- package/build/changelog/fetchChangelogData.d.mts +16 -0
- package/build/changelog/fetchChangelogs.d.mts +11 -12
- package/build/changelog/index.d.mts +25 -0
- package/build/changelog/octokit.d.mts +7 -0
- package/build/changelog/types.d.ts +174 -0
- package/build/eslint/baseConfig.d.mts +1 -1
- package/build/eslint/index.d.mts +1 -0
- package/build/eslint/mui/rules/no-constructor-assigned-field.d.mts +50 -0
- package/build/eslint/nodeSupportConfig.d.mts +11 -0
- package/build/eslint/packageJsonConfig.d.mts +7 -0
- package/build/remark/config.d.mts +5 -14
- package/build/utils/babelPlugin.d.mts +8 -0
- package/build/utils/build.d.mts +22 -0
- package/build/utils/cjsSourcesPlugin.d.mts +11 -0
- package/build/utils/credentials.d.mts +2 -2
- package/build/utils/dtsExportsPlugin.d.mts +8 -0
- package/build/utils/dtsNamespacesPlugin.d.mts +19 -0
- package/build/utils/fileUrlEntriesPlugin.d.mts +9 -0
- package/build/utils/getPublishedPkgJson.d.mts +20 -0
- package/build/utils/git.d.mts +30 -9
- package/build/utils/github.d.mts +8 -0
- package/build/utils/jsNamespacesPlugin.d.mts +13 -0
- package/build/utils/pnpm.d.mts +67 -3
- package/build/utils/publint.d.mts +6 -0
- package/build/utils/rolldownOutput.d.mts +38 -0
- package/build/utils/testUtils.d.mts +8 -0
- package/build/utils/typescript.d.mts +17 -0
- package/package.json +61 -49
- package/src/babel-config.mjs +35 -1
- package/src/brokenLinksChecker/index.mjs +8 -1
- package/src/changelog/changelogChanges.mjs +479 -0
- package/src/changelog/changelogGrouping.mjs +148 -0
- package/src/changelog/changelogMarkdown.mjs +110 -0
- package/src/changelog/changelogTags.mjs +34 -0
- package/src/changelog/changelogTitle.mjs +56 -0
- package/src/changelog/fetchChangelogData.mjs +172 -0
- package/src/changelog/fetchChangelogs.mjs +47 -34
- package/src/changelog/index.mjs +34 -0
- package/src/changelog/octokit.mjs +35 -0
- package/src/changelog/types.ts +187 -0
- package/src/cli/cmdBaseline.mjs +31 -0
- package/src/cli/cmdBuild.mjs +20 -89
- package/src/cli/cmdBuildNew.mjs +471 -0
- package/src/cli/cmdNetlifyIgnore.mjs +14 -7
- package/src/cli/cmdPublish.mjs +17 -3
- package/src/cli/cmdPublishNewPackage.mjs +11 -4
- package/src/cli/cmdValidateBuiltTypes.mjs +447 -32
- package/src/cli/index.mjs +4 -0
- package/src/eslint/baseConfig.mjs +10 -2
- package/src/eslint/docsConfig.mjs +28 -10
- package/src/eslint/index.mjs +1 -0
- package/src/eslint/jsonConfig.mjs +2 -1
- package/src/eslint/mui/config.mjs +16 -1
- package/src/eslint/mui/index.mjs +2 -0
- package/src/eslint/mui/rules/disallow-react-api-in-server-components.mjs +4 -1
- package/src/eslint/mui/rules/no-constructor-assigned-field.mjs +183 -0
- package/src/eslint/nodeSupportConfig.mjs +70 -0
- package/src/eslint/packageJsonConfig.mjs +50 -0
- package/src/eslint/testConfig.mjs +4 -2
- package/src/remark/config.mjs +60 -13
- package/src/utils/babelPlugin.mjs +52 -0
- package/src/utils/build.mjs +81 -0
- package/src/utils/cjsSourcesPlugin.mjs +92 -0
- package/src/utils/credentials.mjs +4 -3
- package/src/utils/dtsExportsPlugin.mjs +103 -0
- package/src/utils/dtsNamespacesPlugin.mjs +226 -0
- package/src/utils/extractErrorCodes.mjs +1 -3
- package/src/utils/fileUrlEntriesPlugin.mjs +84 -0
- package/src/utils/getPublishedPkgJson.mjs +86 -0
- package/src/utils/git.mjs +107 -46
- package/src/utils/github.mjs +27 -0
- package/src/utils/jsNamespacesPlugin.mjs +505 -0
- package/src/utils/pnpm.mjs +126 -25
- package/src/utils/publint.mjs +34 -0
- package/src/utils/rolldownOutput.mjs +70 -0
- package/src/utils/testUtils.mjs +26 -0
- package/src/utils/typescript.mjs +23 -13
- package/vale/styles/MUI/GoogleLatin.yml +5 -2
- package/build/cli/cmdArgosPush.d.mts +0 -18
- package/build/cli/cmdBuild.d.mts +0 -64
- package/build/cli/cmdCopyFiles.d.mts +0 -20
- package/build/cli/cmdExtractErrorCodes.d.mts +0 -6
- package/build/cli/cmdGenerateChangelog.d.mts +0 -32
- package/build/cli/cmdGithubAuth.d.mts +0 -11
- package/build/cli/cmdListWorkspaces.d.mts +0 -29
- package/build/cli/cmdNetlifyIgnore.d.mts +0 -17
- package/build/cli/cmdPublish.d.mts +0 -32
- package/build/cli/cmdPublishCanary.d.mts +0 -34
- package/build/cli/cmdPublishNewPackage.d.mts +0 -17
- package/build/cli/cmdRenameScope.d.mts +0 -18
- package/build/cli/cmdSetVersionOverrides.d.mts +0 -9
- package/build/cli/cmdVale.d.mts +0 -46
- package/build/cli/cmdValidateBuiltTypes.d.mts +0 -2
- package/build/cli/index.d.mts +0 -1
- package/vale/styles/MUI/CorrectRererenceCased.yml +0 -14
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ This is stored in the `docs` top-level directory.
|
|
|
14
14
|
|
|
15
15
|
1. Go to the publish action -
|
|
16
16
|
|
|
17
|
-
- [Base
|
|
17
|
+
- [Base UI](https://github.com/mui/base-ui/actions/workflows/publish.yml)
|
|
18
18
|
- [Core](https://github.com/mui/material-ui/actions/workflows/publish.yml)
|
|
19
|
-
- [MUI
|
|
19
|
+
- [MUI X](https://github.com/mui/mui-x/actions/workflows/publish.yml)
|
|
20
20
|
|
|
21
21
|
2. Choose "Run workflow" dropdown
|
|
22
22
|
|
|
@@ -24,12 +24,15 @@ This is stored in the `docs` top-level directory.
|
|
|
24
24
|
> - **Commit SHA to release from:** the commit that contains the merged release on master. This commit is linked to the GitHub release.
|
|
25
25
|
> - **Run in dry-run mode:** Used for debugging.
|
|
26
26
|
> - **Create GitHub release:** Keep selected if you want a GitHub release to be automatically created from the changelog.
|
|
27
|
-
> - **npm dist tag to publish to** Use to publish legacy or canary versions.
|
|
27
|
+
> - **npm dist tag to publish to** Use to publish legacy or canary versions. The publish fails before it publishes anything when a dist-tag would move to a lower version. `latest` and `latest-*` also cannot move to a prerelease unless they already point to one, and `latest-*` cannot change its major.
|
|
28
28
|
|
|
29
29
|
3. Click "Run workflow"
|
|
30
30
|
4. Refresh the page to see the newly created workflow, and click it.
|
|
31
31
|
5. The next screen shows "@username requested your review to deploy to npm-publish", click "Review deployments" and authorize your workflow run. **Never approve workflow runs you didn't initiaite.**
|
|
32
32
|
|
|
33
|
+
> [!NOTE]
|
|
34
|
+
> A CI dry run (`code-infra publish --ci --dry-run`) runs the same dist-tag check. On a branch that does not publish to `latest`, pass the dist-tag of the release to it, for example `--tag next` for prereleases or `--tag latest-v8` for a previous major.
|
|
35
|
+
|
|
33
36
|
> [!IMPORTANT]
|
|
34
37
|
> Go through the below steps if there is an error that says `The following packages are new and need to be published manually first` in the publish flow.
|
|
35
38
|
|
|
@@ -59,7 +62,7 @@ If publishing fails with npm asking for `otp`, run the command again with 6 digi
|
|
|
59
62
|
pnpm code-infra publish-new-package --otp=123456
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
3. Go to the settings link for each package,
|
|
65
|
+
3. Go to the settings link for each package, for example, `https://www.npmjs.com/package/<pkg-name>/access`, and setup `Trusted Publisher`.
|
|
63
66
|
4. In the `Select your publisher` step in the above link, click on the `GitHub Actions` button to configure GitHub Actions-based trusted publishing.
|
|
64
67
|
5. Fill in the details of the repo -
|
|
65
68
|
1. `Organization or user` as `mui`,
|
|
@@ -74,3 +77,32 @@ After following these steps, the `Publish` workflow can be invoked again.
|
|
|
74
77
|
## Agent skills
|
|
75
78
|
|
|
76
79
|
The agent skills previously shipped with this package now live at the repository root. See [Install instructions](../../README.md#agent-skills).
|
|
80
|
+
|
|
81
|
+
## Upcoming tsdown builds
|
|
82
|
+
|
|
83
|
+
`code-infra build-new` is experimental. It compiles the `src` modules behind the package's
|
|
84
|
+
`exports`, `imports` and `bin`, plus every module they import, to the `publishConfig.directory` with
|
|
85
|
+
tsdown, keeping every package import external. Modules loaded with
|
|
86
|
+
`new URL('./file', import.meta.url)`, such as workers, are built too, and the URL points at their
|
|
87
|
+
output. It copies files with tsdown's `copy` option using the same `--copy` rules as
|
|
88
|
+
`code-infra build`. It writes the same `package.json` as `code-infra build` (the deprecated
|
|
89
|
+
`--no-expand` keeps `exports`/`imports` patterns). Every JavaScript file starts with the package's
|
|
90
|
+
license header. Oxc strips types, compiles JSX and lowers syntax for the `stable` (ESM) and `node`
|
|
91
|
+
(CJS) browserslist environments, and `MUI_VERSION` variables are inlined. Babel runs the workspace
|
|
92
|
+
`babel.config.js` with `getBaseConfig` reduced to the MUI plugins Oxc lacks: display names, React
|
|
93
|
+
pure annotations, prop-types removal and clsx optimization, plus the React compiler with
|
|
94
|
+
`--enableReactCompiler`. Babel helpers, and the helpers Oxc's lowering needs, are imported from the
|
|
95
|
+
`@babel/runtime` version the package depends on; the build fails when the output imports them
|
|
96
|
+
without that dependency. Declarations come from tsdown's `dts` with the workspace TypeScript 7 `tsc`
|
|
97
|
+
and the package's `tsconfig.build.json` (`--no-buildTypes` skips them); hand-written `.d.ts` files
|
|
98
|
+
need explicit exports. The output keeps `export * as` and `import * as` namespaces, which Rolldown
|
|
99
|
+
turns into `<name>_exports` objects in unbundled builds. A namespace stays an object when Rolldown
|
|
100
|
+
inlines its constants into it, when the module reads it itself, or, in JavaScript, when it is
|
|
101
|
+
imported next to a default import or by a quoted name. The output is validated with publint, as in
|
|
102
|
+
`code-infra build`. With
|
|
103
|
+
`--cjsCopy`, imported `.cjs` sources are emitted unchanged and imported as-is, as in
|
|
104
|
+
`code-infra build`, and the local modules they `require` are built at the paths they name; the build
|
|
105
|
+
fails when no bundle outputs a module at that path. `--cjsCopy` is deprecated: only
|
|
106
|
+
`@mui/material-nextjs` needs it, until `next` has an `exports` map
|
|
107
|
+
([vercel/next.js#77200](https://github.com/vercel/next.js/issues/77200)). Continue using
|
|
108
|
+
`code-infra build` for package builds.
|
package/build/babel-config.d.mts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export type ReactCompilationMode = 'annotation' | 'syntax' | 'infer' | 'all';
|
|
2
|
+
export type Compiler = 'babel' | 'oxc';
|
|
2
3
|
/**
|
|
3
4
|
* @typedef {'annotation' | 'syntax' | 'infer' | 'all'} ReactCompilationMode
|
|
4
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {'babel' | 'oxc'} Compiler
|
|
8
|
+
*/
|
|
5
9
|
/**
|
|
6
10
|
* @param {Object} param0
|
|
7
11
|
* @param {boolean} [param0.debug]
|
|
@@ -14,9 +18,10 @@ export type ReactCompilationMode = 'annotation' | 'syntax' | 'infer' | 'all';
|
|
|
14
18
|
* @param {string} [param0.reactCompilerReactVersion]
|
|
15
19
|
* @param {ReactCompilationMode} [param0.reactCompilerMode]
|
|
16
20
|
* @param {{ allowedCallees?: Record<string, string[]> }} [param0.displayName] - Options for the display name plugin.
|
|
21
|
+
* @param {Compiler} [param0.compiler] - `oxc` keeps only the plugins Oxc has no equivalent for.
|
|
17
22
|
* @returns {import('@babel/core').InputOptions} The base Babel configuration.
|
|
18
23
|
*/
|
|
19
|
-
export declare function getBaseConfig({ debug, optimizeClsx, removePropTypes, noResolveImports, bundle, runtimeVersion, outExtension, reactCompilerReactVersion, reactCompilerMode, displayName, }: {
|
|
24
|
+
export declare function getBaseConfig({ debug, optimizeClsx, removePropTypes, noResolveImports, bundle, runtimeVersion, outExtension, reactCompilerReactVersion, reactCompilerMode, displayName, compiler, }: {
|
|
20
25
|
debug?: boolean;
|
|
21
26
|
optimizeClsx?: boolean;
|
|
22
27
|
removePropTypes?: boolean;
|
|
@@ -29,6 +34,7 @@ export declare function getBaseConfig({ debug, optimizeClsx, removePropTypes, no
|
|
|
29
34
|
displayName?: {
|
|
30
35
|
allowedCallees?: Record<string, string[]>;
|
|
31
36
|
};
|
|
37
|
+
compiler?: Compiler;
|
|
32
38
|
}): import('@babel/core').InputOptions;
|
|
33
39
|
export type Options = {
|
|
34
40
|
bundle?: 'esm' | 'cjs';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Octokit = import('@octokit/rest').Octokit;
|
|
2
|
+
export type GitHubRepository = import('./types.ts').GitHubRepository;
|
|
3
|
+
export type ChangelogAuthor = import('./types.ts').ChangelogAuthor;
|
|
4
|
+
export type ChangelogChange = import('./types.ts').ChangelogChange;
|
|
5
|
+
export type Commit = Awaited<ReturnType<Octokit['repos']['compareCommitsWithBasehead']>>['data']['commits'][number];
|
|
6
|
+
export type PullRequest = {
|
|
7
|
+
number: number;
|
|
8
|
+
title: string;
|
|
9
|
+
body: string | null;
|
|
10
|
+
user: {
|
|
11
|
+
login: string;
|
|
12
|
+
type: string;
|
|
13
|
+
} | null;
|
|
14
|
+
assignees?: {
|
|
15
|
+
login: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}[] | null;
|
|
18
|
+
author_association: string;
|
|
19
|
+
labels: {
|
|
20
|
+
name?: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} options
|
|
25
|
+
* @param {Octokit} options.octokit
|
|
26
|
+
* @param {GitHubRepository} options.repository
|
|
27
|
+
* @param {string} options.previousSha
|
|
28
|
+
* @param {string} options.releaseSha
|
|
29
|
+
* @param {boolean} options.includeDirectCommits
|
|
30
|
+
* @param {string[]} [options.excludeBots] - Bots whose changes are left out, as `app/<slug>` or login
|
|
31
|
+
* @param {AbortController} options.controller - Aborted when a request fails
|
|
32
|
+
* @returns {Promise<ChangelogChange[]>}
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchChangelogChanges({ octokit, repository, previousSha, releaseSha, includeDirectCommits, excludeBots, controller, }: {
|
|
35
|
+
octokit: Octokit;
|
|
36
|
+
repository: GitHubRepository;
|
|
37
|
+
previousSha: string;
|
|
38
|
+
releaseSha: string;
|
|
39
|
+
includeDirectCommits: boolean;
|
|
40
|
+
excludeBots?: string[];
|
|
41
|
+
controller: AbortController;
|
|
42
|
+
}): Promise<ChangelogChange[]>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type ChangelogChange = import('./types.ts').ChangelogChange;
|
|
2
|
+
export type ChangelogAuthor = import('./types.ts').ChangelogAuthor;
|
|
3
|
+
export type ChangelogCredits = import('./types.ts').ChangelogCredits;
|
|
4
|
+
/**
|
|
5
|
+
* The labels of a change, and the ones its title prefixes stand for. A label wins over the prefixes
|
|
6
|
+
* for its kind, the part before the colon: `scope: charts` leaves the scopes of the title out.
|
|
7
|
+
*
|
|
8
|
+
* @param {Pick<ChangelogChange, 'labels' | 'title'>} change
|
|
9
|
+
* @param {Record<string, readonly string[]>} [prefixes] - Labels that a prefix stands for, with the
|
|
10
|
+
* prefix spelled in any way
|
|
11
|
+
* @returns {string[]}
|
|
12
|
+
*/
|
|
13
|
+
export declare function readLabels(change: Pick<ChangelogChange, 'labels' | 'title'>, prefixes?: Record<string, readonly string[]>): string[];
|
|
14
|
+
/**
|
|
15
|
+
* The values of one kind of label: `labelValues(['scope: charts', 'docs'], 'scope')` is `['charts']`.
|
|
16
|
+
*
|
|
17
|
+
* @param {readonly string[]} labels
|
|
18
|
+
* @param {string} kind
|
|
19
|
+
* @returns {string[]}
|
|
20
|
+
*/
|
|
21
|
+
export declare function labelValues(labels: readonly string[], kind: string): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Groups items that can be in several groups, or in none. Items keep their order.
|
|
24
|
+
*
|
|
25
|
+
* @template Item
|
|
26
|
+
* @template {string} Group
|
|
27
|
+
* @param {Iterable<Item>} items
|
|
28
|
+
* @param {(item: Item) => Group | readonly Group[] | null | undefined} getGroups
|
|
29
|
+
* @returns {Map<Group, Item[]>}
|
|
30
|
+
*/
|
|
31
|
+
export declare function groupBy<Item, Group extends string>(items: Iterable<Item>, getGroups: (item: Item) => Group | readonly Group[] | null | undefined): Map<Group, Item[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Sorts by prefixes, then by the rest of the title. Changes of the same title are sorted by pull
|
|
34
|
+
* request, so that the order never depends on the order they are given in.
|
|
35
|
+
*
|
|
36
|
+
* @template {Pick<ChangelogChange, 'title' | 'pullRequest' | 'sha'>} Change
|
|
37
|
+
* @param {Iterable<Change>} changes
|
|
38
|
+
* @returns {Change[]}
|
|
39
|
+
*/
|
|
40
|
+
export declare function sortByTitle<Change extends Pick<ChangelogChange, 'title' | 'pullRequest' | 'sha'>>(changes: Iterable<Change>): Change[];
|
|
41
|
+
/**
|
|
42
|
+
* The authors of changes, once each and in alphabetical order. Someone who joined the team during
|
|
43
|
+
* the release is credited as team.
|
|
44
|
+
*
|
|
45
|
+
* @param {Iterable<Pick<ChangelogChange, 'author'>>} changes
|
|
46
|
+
* @param {Object} [options]
|
|
47
|
+
* @param {readonly string[]} [options.exclude] - Logins
|
|
48
|
+
* @returns {ChangelogCredits}
|
|
49
|
+
*/
|
|
50
|
+
export declare function creditAuthors(changes: Iterable<Pick<ChangelogChange, 'author'>>, { exclude }?: {
|
|
51
|
+
exclude?: readonly string[];
|
|
52
|
+
}): ChangelogCredits;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').ChangelogAuthor} ChangelogAuthor
|
|
3
|
+
* @typedef {import('./types.ts').ChangelogChange} ChangelogChange
|
|
4
|
+
* @typedef {import('./types.ts').ChangelogData} ChangelogData
|
|
5
|
+
* @typedef {import('./types.ts').MarkdownBlock} MarkdownBlock
|
|
6
|
+
* @typedef {import('./types.ts').MarkdownInline} MarkdownInline
|
|
7
|
+
*/
|
|
8
|
+
export type ChangelogAuthor = import('./types.ts').ChangelogAuthor;
|
|
9
|
+
export type ChangelogChange = import('./types.ts').ChangelogChange;
|
|
10
|
+
export type ChangelogData = import('./types.ts').ChangelogData;
|
|
11
|
+
export type MarkdownBlock = import('./types.ts').MarkdownBlock;
|
|
12
|
+
export type MarkdownInline = import('./types.ts').MarkdownInline;
|
|
13
|
+
/**
|
|
14
|
+
* Joins blocks with a blank line in between. Empty ones are left out. Blank lines inside a block,
|
|
15
|
+
* such as the ones of a code block, stay as they are.
|
|
16
|
+
*
|
|
17
|
+
* @param {...MarkdownBlock} blocks
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
export declare function joinBlocks(...blocks: MarkdownBlock[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* A heading and what is below it, or nothing when there is nothing below it.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} heading
|
|
25
|
+
* @param {...MarkdownBlock} blocks
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
export declare function section(heading: string, ...blocks: MarkdownBlock[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* @param {Iterable<MarkdownInline>} items
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
export declare function bulletList(items: Iterable<MarkdownInline>): string;
|
|
34
|
+
/**
|
|
35
|
+
* Joins the parts of a line with a space. Empty ones are left out.
|
|
36
|
+
*
|
|
37
|
+
* @param {...MarkdownInline} parts
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
export declare function joinWords(...parts: MarkdownInline[]): string;
|
|
41
|
+
/**
|
|
42
|
+
* `#123`, or the short SHA of a change without a pull request.
|
|
43
|
+
*
|
|
44
|
+
* @param {Pick<ChangelogChange, 'pullRequest' | 'sha'>} change
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
export declare function formatReference({ pullRequest, sha }: Pick<ChangelogChange, 'pullRequest' | 'sha'>): string;
|
|
48
|
+
/**
|
|
49
|
+
* `@login`, or the name of an author without a GitHub account. Empty when neither is known.
|
|
50
|
+
*
|
|
51
|
+
* @param {Pick<ChangelogAuthor, 'login' | 'name'> | null} author
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatAuthor(author: Pick<ChangelogAuthor, 'login' | 'name'> | null): string;
|
|
55
|
+
/**
|
|
56
|
+
* `Jan 2, 2026`, in UTC like the date of a release.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} date - ISO 8601
|
|
59
|
+
* @returns {string}
|
|
60
|
+
*/
|
|
61
|
+
export declare function formatDate(date: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* What is below the heading of a release: a comment with the range it was generated from, and its
|
|
64
|
+
* date.
|
|
65
|
+
*
|
|
66
|
+
* @param {Pick<ChangelogData, 'previous' | 'release' | 'date'>} data
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
export declare function formatSubHeader({ previous, release, date }: Pick<ChangelogData, 'previous' | 'release' | 'date'>): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closest version tag behind a commit. Tags on the commit itself are the release being made, not
|
|
3
|
+
* the one before it.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {string} options.cwd
|
|
7
|
+
* @param {string | null} options.remote - Remote to fetch the tags and the commit from
|
|
8
|
+
* @param {string} options.sha
|
|
9
|
+
* @returns {Promise<string>}
|
|
10
|
+
*/
|
|
11
|
+
export declare function findPreviousVersionTag({ cwd, remote, sha }: {
|
|
12
|
+
cwd: string;
|
|
13
|
+
remote: string | null;
|
|
14
|
+
sha: string;
|
|
15
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').ChangelogTitle} ChangelogTitle
|
|
3
|
+
*/
|
|
4
|
+
export type ChangelogTitle = import('./types.ts').ChangelogTitle;
|
|
5
|
+
/**
|
|
6
|
+
* Splits the leading `[prefixes]` off a title.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} title
|
|
9
|
+
* @returns {ChangelogTitle}
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseTitle(title: string): ChangelogTitle;
|
|
12
|
+
/**
|
|
13
|
+
* The candidate that a prefix is a spelling of: case, spaces, hyphens and underscores don't matter.
|
|
14
|
+
*
|
|
15
|
+
* @template {string} Candidate
|
|
16
|
+
* @param {string} prefix
|
|
17
|
+
* @param {Iterable<Candidate>} candidates
|
|
18
|
+
* @returns {Candidate | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export declare function matchPrefix<Candidate extends string>(prefix: string, candidates: Iterable<Candidate>): Candidate | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Rewrites the prefixes of a title. Duplicates and prefixes that become empty are left out.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} title
|
|
25
|
+
* @param {(prefix: string) => string} rewrite
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
export declare function mapPrefixes(title: string, rewrite: (prefix: string) => string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type FetchChangelogDataOptions = import('./types.ts').FetchChangelogDataOptions;
|
|
2
|
+
export type GitHubRepository = import('./types.ts').GitHubRepository;
|
|
3
|
+
export type ChangelogData = import('./types.ts').ChangelogData;
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('./types.ts').FetchChangelogDataOptions} FetchChangelogDataOptions
|
|
6
|
+
* @typedef {import('./types.ts').GitHubRepository} GitHubRepository
|
|
7
|
+
* @typedef {import('./types.ts').ChangelogData} ChangelogData
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Collects what happened in a release: its changes and its packages. Run inside a checkout of the
|
|
11
|
+
* repository, every option is optional.
|
|
12
|
+
*
|
|
13
|
+
* @param {FetchChangelogDataOptions} [options]
|
|
14
|
+
* @returns {Promise<ChangelogData>}
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchChangelogData(options?: FetchChangelogDataOptions): Promise<ChangelogData>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type OctokitType = import('@octokit/rest').Octokit;
|
|
2
|
-
export type FetchedCommitDetails = import('./types').FetchedCommitDetails;
|
|
2
|
+
export type FetchedCommitDetails = import('./types.js').FetchedCommitDetails;
|
|
3
3
|
export type FetchCommitsOptions = {
|
|
4
4
|
repo: string;
|
|
5
5
|
lastRelease: string;
|
|
@@ -8,12 +8,20 @@ export type FetchCommitsOptions = {
|
|
|
8
8
|
* - GitHub organization name, defaults to 'mui'
|
|
9
9
|
*/
|
|
10
10
|
org?: string;
|
|
11
|
+
/**
|
|
12
|
+
* - Called as commits are listed and their pull request details are fetched
|
|
13
|
+
*/
|
|
14
|
+
onProgress?: (progress: {
|
|
15
|
+
phase: string;
|
|
16
|
+
count: number;
|
|
17
|
+
total: number;
|
|
18
|
+
}) => void;
|
|
11
19
|
};
|
|
12
20
|
/**
|
|
13
21
|
* @typedef {import('@octokit/rest').Octokit} OctokitType
|
|
14
22
|
*/
|
|
15
23
|
/**
|
|
16
|
-
* @typedef {import('./types').FetchedCommitDetails} FetchedCommitDetails
|
|
24
|
+
* @typedef {import('./types.js').FetchedCommitDetails} FetchedCommitDetails
|
|
17
25
|
*/
|
|
18
26
|
/**
|
|
19
27
|
* @typedef {Object} FetchCommitsOptions
|
|
@@ -21,17 +29,8 @@ export type FetchCommitsOptions = {
|
|
|
21
29
|
* @property {string} lastRelease
|
|
22
30
|
* @property {string} release
|
|
23
31
|
* @property {string} [org='mui'] - GitHub organization name, defaults to 'mui'
|
|
32
|
+
* @property {(progress: { phase: string; count: number; total: number }) => void} [onProgress] - Called as commits are listed and their pull request details are fetched
|
|
24
33
|
*/
|
|
25
|
-
/**
|
|
26
|
-
* @param {Object} opts
|
|
27
|
-
* @param {string} opts.cwd
|
|
28
|
-
* @param {boolean} [opts.fetchAll=true] Whether to fetch all tags from all remotes before finding the latest tag.
|
|
29
|
-
* @returns {Promise<string>}
|
|
30
|
-
*/
|
|
31
|
-
export declare function findLatestTaggedVersion(opts: {
|
|
32
|
-
cwd: string;
|
|
33
|
-
fetchAll?: boolean;
|
|
34
|
-
}): Promise<string>;
|
|
35
34
|
/**
|
|
36
35
|
* Fetches commits between two refs (lastRelease..release) including PR details.
|
|
37
36
|
* Automatically handles GitHub OAuth authentication if none provided.
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Changelog generation utilities.
|
|
3
3
|
*/
|
|
4
|
+
export type FetchChangelogDataOptions = import('./types.ts').FetchChangelogDataOptions;
|
|
5
|
+
export type ChangelogData = import('./types.ts').ChangelogData;
|
|
6
|
+
export type ChangelogChange = import('./types.ts').ChangelogChange;
|
|
7
|
+
export type ChangelogAuthor = import('./types.ts').ChangelogAuthor;
|
|
8
|
+
export type ChangelogPackage = import('./types.ts').ChangelogPackage;
|
|
9
|
+
export type ChangelogTitle = import('./types.ts').ChangelogTitle;
|
|
10
|
+
export type ChangelogCredits = import('./types.ts').ChangelogCredits;
|
|
11
|
+
export type MarkdownBlock = import('./types.ts').MarkdownBlock;
|
|
12
|
+
export type MarkdownInline = import('./types.ts').MarkdownInline;
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import('./types.ts').FetchChangelogDataOptions} FetchChangelogDataOptions
|
|
15
|
+
* @typedef {import('./types.ts').ChangelogData} ChangelogData
|
|
16
|
+
* @typedef {import('./types.ts').ChangelogChange} ChangelogChange
|
|
17
|
+
* @typedef {import('./types.ts').ChangelogAuthor} ChangelogAuthor
|
|
18
|
+
* @typedef {import('./types.ts').ChangelogPackage} ChangelogPackage
|
|
19
|
+
* @typedef {import('./types.ts').ChangelogTitle} ChangelogTitle
|
|
20
|
+
* @typedef {import('./types.ts').ChangelogCredits} ChangelogCredits
|
|
21
|
+
* @typedef {import('./types.ts').MarkdownBlock} MarkdownBlock
|
|
22
|
+
* @typedef {import('./types.ts').MarkdownInline} MarkdownInline
|
|
23
|
+
*/
|
|
4
24
|
export { generateChangelog } from './generateChangelog.mjs';
|
|
5
25
|
export * from './loadChangelogConfig.mjs';
|
|
6
26
|
export * from './fetchChangelogs.mjs';
|
|
27
|
+
export { fetchChangelogData } from './fetchChangelogData.mjs';
|
|
28
|
+
export { creditAuthors, groupBy, labelValues, readLabels, sortByTitle, } from './changelogGrouping.mjs';
|
|
29
|
+
export { bulletList, formatAuthor, formatDate, formatReference, formatSubHeader, joinBlocks, joinWords, section, } from './changelogMarkdown.mjs';
|
|
30
|
+
export { mapPrefixes, matchPrefix, parseTitle } from './changelogTitle.mjs';
|
|
31
|
+
export { findLatestTaggedVersion } from '../utils/git.mjs';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { RepoInfo } from '../utils/git.mjs';
|
|
1
3
|
/**
|
|
2
4
|
* Commit details fetched from GitHub including PR information and labels.
|
|
3
5
|
*/
|
|
@@ -390,3 +392,175 @@ export interface GenerateChangelogResult {
|
|
|
390
392
|
all: string[];
|
|
391
393
|
};
|
|
392
394
|
}
|
|
395
|
+
export type GitHubRepository = Pick<RepoInfo, 'owner' | 'repo'>;
|
|
396
|
+
export interface ReleaseRef {
|
|
397
|
+
/**
|
|
398
|
+
* The ref as given. A local `HEAD` is replaced by its SHA.
|
|
399
|
+
*/
|
|
400
|
+
ref: string;
|
|
401
|
+
sha: string;
|
|
402
|
+
}
|
|
403
|
+
export interface ChangelogAuthor {
|
|
404
|
+
/**
|
|
405
|
+
* `null` for a commit author without a linked GitHub account.
|
|
406
|
+
*/
|
|
407
|
+
login: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* Git author name. Only known for direct commits.
|
|
410
|
+
*/
|
|
411
|
+
name: string | null;
|
|
412
|
+
association: 'team' | 'community' | 'first-timer';
|
|
413
|
+
/**
|
|
414
|
+
* Whether it is a bot that works on its own. Not for Copilot, which works for a person.
|
|
415
|
+
*/
|
|
416
|
+
isBot: boolean;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* A merged pull request, or a commit that landed without one.
|
|
420
|
+
*/
|
|
421
|
+
export interface ChangelogChange {
|
|
422
|
+
/**
|
|
423
|
+
* Subject of the commit, without the references that the other fields already carry: the pull
|
|
424
|
+
* request it belongs to and, for a cherry-pick, the original pull request and its author.
|
|
425
|
+
*/
|
|
426
|
+
title: string;
|
|
427
|
+
/**
|
|
428
|
+
* Full commit message.
|
|
429
|
+
*/
|
|
430
|
+
message: string;
|
|
431
|
+
sha: string;
|
|
432
|
+
/**
|
|
433
|
+
* Page of the pull request, or of the commit when there is none.
|
|
434
|
+
*/
|
|
435
|
+
url: string;
|
|
436
|
+
labels: string[];
|
|
437
|
+
/**
|
|
438
|
+
* Whether the pull request has the `breaking` or the `breaking change` label.
|
|
439
|
+
*/
|
|
440
|
+
isBreakingChange: boolean;
|
|
441
|
+
pullRequest: {
|
|
442
|
+
number: number;
|
|
443
|
+
title: string;
|
|
444
|
+
body: string;
|
|
445
|
+
/**
|
|
446
|
+
* Not necessarily the author of the change: a cherry-pick can be opened by a bot, and Copilot
|
|
447
|
+
* works for a person. `null` when the GitHub account was deleted.
|
|
448
|
+
*/
|
|
449
|
+
openedBy: ChangelogAuthor | null;
|
|
450
|
+
} | null;
|
|
451
|
+
/**
|
|
452
|
+
* `null` when the GitHub account was deleted.
|
|
453
|
+
*/
|
|
454
|
+
author: ChangelogAuthor | null;
|
|
455
|
+
/**
|
|
456
|
+
* When the pull request was opened, or the commit authored. ISO 8601.
|
|
457
|
+
*/
|
|
458
|
+
createdAt: string | null;
|
|
459
|
+
/**
|
|
460
|
+
* When the pull request was merged, or the commit committed. ISO 8601.
|
|
461
|
+
*/
|
|
462
|
+
mergedAt: string | null;
|
|
463
|
+
}
|
|
464
|
+
export interface ChangelogPackage {
|
|
465
|
+
name: string;
|
|
466
|
+
version: string | null;
|
|
467
|
+
/**
|
|
468
|
+
* Whether the package can't be published: marked as private, or without a version.
|
|
469
|
+
*/
|
|
470
|
+
private: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Directory relative to the workspace root, with `/` separators. `.` for the root package.
|
|
473
|
+
*/
|
|
474
|
+
path: string;
|
|
475
|
+
/**
|
|
476
|
+
* Whether the version differs from the previous release. `true` for a new package, `null` when the
|
|
477
|
+
* previous release isn't available locally.
|
|
478
|
+
*/
|
|
479
|
+
changed: boolean | null;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* What happened in a release, as JSON-serializable data.
|
|
483
|
+
*/
|
|
484
|
+
export interface ChangelogData {
|
|
485
|
+
repository: GitHubRepository;
|
|
486
|
+
previous: ReleaseRef;
|
|
487
|
+
release: ReleaseRef;
|
|
488
|
+
version: string;
|
|
489
|
+
/**
|
|
490
|
+
* ISO 8601.
|
|
491
|
+
*/
|
|
492
|
+
date: string;
|
|
493
|
+
/**
|
|
494
|
+
* Oldest first.
|
|
495
|
+
*/
|
|
496
|
+
changes: ChangelogChange[];
|
|
497
|
+
/**
|
|
498
|
+
* Named packages in the working tree, sorted by path. Without a workspace, only the root package.
|
|
499
|
+
*/
|
|
500
|
+
packages: ChangelogPackage[];
|
|
501
|
+
}
|
|
502
|
+
export interface FetchChangelogDataOptions {
|
|
503
|
+
/**
|
|
504
|
+
* A directory of the released workspace.
|
|
505
|
+
* @default process.cwd()
|
|
506
|
+
*/
|
|
507
|
+
cwd?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Repository name. Defaults to the one the checkout's remote points at.
|
|
510
|
+
*/
|
|
511
|
+
repo?: string;
|
|
512
|
+
/**
|
|
513
|
+
* @default 'mui'
|
|
514
|
+
*/
|
|
515
|
+
org?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Ref of the previous release. Defaults to the closest version tag before `release`.
|
|
518
|
+
*/
|
|
519
|
+
lastRelease?: string;
|
|
520
|
+
/**
|
|
521
|
+
* Ref of the release.
|
|
522
|
+
* @default 'HEAD'
|
|
523
|
+
*/
|
|
524
|
+
release?: string;
|
|
525
|
+
/**
|
|
526
|
+
* Defaults to the version `release` is a tag of, else the version of the root package.
|
|
527
|
+
*/
|
|
528
|
+
version?: string;
|
|
529
|
+
/**
|
|
530
|
+
* Defaults to the commit date when `release` is a version tag, else now.
|
|
531
|
+
*/
|
|
532
|
+
date?: Date | string;
|
|
533
|
+
/**
|
|
534
|
+
* Include commits that landed without a pull request.
|
|
535
|
+
* @default false
|
|
536
|
+
*/
|
|
537
|
+
includeDirectCommits?: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Bots whose changes are left out, as `app/<slug>` like in GitHub search, or as their login, such
|
|
540
|
+
* as `renovate[bot]`. A change is left out when its author or the opener of its pull request is
|
|
541
|
+
* one of them. Pass `[]` to keep all.
|
|
542
|
+
* @default ['app/renovate', 'app/code-infra-renovate']
|
|
543
|
+
*/
|
|
544
|
+
excludeBots?: string[];
|
|
545
|
+
/**
|
|
546
|
+
* GitHub client. Defaults to one authenticated as the developer running it.
|
|
547
|
+
*/
|
|
548
|
+
octokit?: Octokit;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Title of a change, split into its leading `[prefixes]` and the rest.
|
|
552
|
+
*/
|
|
553
|
+
export interface ChangelogTitle {
|
|
554
|
+
prefixes: string[];
|
|
555
|
+
text: string;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Authors to credit, once each.
|
|
559
|
+
*/
|
|
560
|
+
export interface ChangelogCredits {
|
|
561
|
+
all: ChangelogAuthor[];
|
|
562
|
+
team: ChangelogAuthor[];
|
|
563
|
+
community: ChangelogAuthor[];
|
|
564
|
+
}
|
|
565
|
+
export type MarkdownInline = string | false | null | undefined;
|
|
566
|
+
export type MarkdownBlock = MarkdownInline | readonly MarkdownBlock[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {Object} [params]
|
|
3
3
|
* @param {boolean} [params.enableReactCompiler] - Whether to enable React Compiler.
|
|
4
|
-
* @param {boolean} [params.consistentTypeImports] - Whether to enforce consistent type imports.
|
|
4
|
+
* @param {boolean} [params.consistentTypeImports] - Whether to enforce consistent type imports. Defaults to `true`.
|
|
5
5
|
* @param {boolean} [params.materialUi] - Whether to enable Material UI specific rules (mui/material-ui-*).
|
|
6
6
|
* @param {string} [params.baseDirectory] - The base directory for the configuration.
|
|
7
7
|
* @param {boolean} [params.markdown] - @deprecated Markdown/MDX linting is enabled by default; this option no longer needs to be passed. To skip markdown linting, use eslint ignore patterns for the relevant files.
|
package/build/eslint/index.d.mts
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export type PropertyDefinition = import('@typescript-eslint/utils').TSESTree.PropertyDefinition;
|
|
3
|
+
export type Node = import('@typescript-eslint/utils').TSESTree.Node;
|
|
4
|
+
/**
|
|
5
|
+
* ESLint rule that disallows assigning a class field in the constructor when it is also
|
|
6
|
+
* declared as a (non-`declare`) class field.
|
|
7
|
+
*
|
|
8
|
+
* Babel 8 only strips TypeScript fields marked `declare` (see mui/material-ui#49241), so a
|
|
9
|
+
* field without an initializer is emitted as a property definition that sets it to
|
|
10
|
+
* `undefined` before the constructor assigns it again. Either initialize the field at its
|
|
11
|
+
* declaration, or mark it `declare` so it only serves as a type annotation.
|
|
12
|
+
*
|
|
13
|
+
* `declare` fields are exempt from TypeScript's strict property initialization check
|
|
14
|
+
* (TS2564), so prefer initializing at the declaration where the value doesn't depend on
|
|
15
|
+
* constructor arguments. The `declare` suggestion is only offered when every path through the
|
|
16
|
+
* constructor assigns the field, i.e. for an unconditional top-level assignment.
|
|
17
|
+
*
|
|
18
|
+
* Only plain `=` assignments count: compound assignments read the field rather than
|
|
19
|
+
* re-initialize it. A field with an initializer is only reported for an unconditional
|
|
20
|
+
* top-level assignment, as a conditional one overrides a default. Private (`#`) and decorated
|
|
21
|
+
* fields are ignored: they are runtime declarations that `declare` can't replace.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Invalid
|
|
25
|
+
* class ModalManager {
|
|
26
|
+
* private modals: Modal[];
|
|
27
|
+
* constructor() {
|
|
28
|
+
* this.modals = [];
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Valid - initialized at the declaration
|
|
34
|
+
* class ModalManager {
|
|
35
|
+
* private modals: Modal[] = [];
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Valid - declared only, assigned in the constructor
|
|
40
|
+
* class ModalManager {
|
|
41
|
+
* declare private modals: Modal[];
|
|
42
|
+
* constructor(modals: Modal[]) {
|
|
43
|
+
* this.modals = modals;
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
*/
|
|
47
|
+
declare const _default: ESLintUtils.RuleModule<"addDeclare" | "assignedInConstructor", [], unknown, ESLintUtils.RuleListener> & {
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
export default _default;
|