@mui/internal-code-infra 0.0.3-canary.8 → 0.0.3-canary.81
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 +55 -0
- package/build/babel-config.d.mts +40 -0
- package/build/brokenLinksChecker/index.d.mts +178 -0
- package/build/cli/cmdArgosPush.d.mts +13 -0
- package/build/cli/cmdBuild.d.mts +56 -0
- package/build/cli/cmdCopyFiles.d.mts +20 -0
- package/build/cli/cmdExtractErrorCodes.d.mts +3 -0
- package/build/cli/cmdGithubAuth.d.mts +6 -0
- package/build/cli/cmdListWorkspaces.d.mts +18 -0
- package/build/cli/cmdPublish.d.mts +27 -0
- package/build/cli/cmdPublishCanary.d.mts +30 -0
- package/build/cli/cmdPublishNewPackage.d.mts +8 -0
- package/build/cli/cmdSetVersionOverrides.d.mts +9 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -0
- package/build/cli/index.d.mts +1 -0
- package/build/eslint/baseConfig.d.mts +12 -0
- package/build/eslint/docsConfig.d.mts +4 -0
- package/build/eslint/extensions.d.mts +8 -0
- package/build/eslint/index.d.mts +4 -0
- package/build/eslint/jsonConfig.d.mts +4 -0
- package/build/eslint/material-ui/config.d.mts +10 -0
- package/build/eslint/material-ui/index.d.mts +2 -0
- package/build/eslint/material-ui/rules/add-undef-to-optional.d.mts +5 -0
- package/build/eslint/material-ui/rules/consistent-production-guard.d.mts +36 -0
- package/build/eslint/material-ui/rules/disallow-active-element-as-key-event-target.d.mts +5 -0
- package/build/eslint/material-ui/rules/disallow-react-api-in-server-components.d.mts +2 -0
- package/build/eslint/material-ui/rules/docgen-ignore-before-comment.d.mts +2 -0
- package/build/eslint/material-ui/rules/mui-name-matches-component-name.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-empty-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/no-restricted-resolved-imports.d.mts +12 -0
- package/build/eslint/material-ui/rules/no-styled-box.d.mts +5 -0
- package/build/eslint/material-ui/rules/nodeEnvUtils.d.mts +23 -0
- package/build/eslint/material-ui/rules/require-dev-wrapper.d.mts +28 -0
- package/build/eslint/material-ui/rules/rules-of-use-theme-variants.d.mts +9 -0
- package/build/eslint/material-ui/rules/straight-quotes.d.mts +5 -0
- package/build/eslint/testConfig.d.mts +14 -0
- package/build/markdownlint/duplicate-h1.d.mts +27 -0
- package/build/markdownlint/git-diff.d.mts +8 -0
- package/build/markdownlint/index.d.mts +56 -0
- package/build/markdownlint/straight-quotes.d.mts +8 -0
- package/build/markdownlint/table-alignment.d.mts +8 -0
- package/build/markdownlint/terminal-language.d.mts +8 -0
- package/build/prettier.d.mts +20 -0
- package/build/stylelint/index.d.mts +32 -0
- package/build/utils/babel.d.mts +71 -0
- package/build/utils/build.d.mts +50 -0
- package/build/utils/changelog.d.mts +64 -0
- package/build/utils/credentials.d.mts +17 -0
- package/build/utils/extractErrorCodes.d.mts +19 -0
- package/build/utils/git.d.mts +30 -0
- package/build/utils/github.d.mts +41 -0
- package/build/utils/pnpm.d.mts +238 -0
- package/build/utils/typescript.d.mts +35 -0
- package/package.json +108 -49
- package/src/babel-config.mjs +31 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +22 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/example.md +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +21 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +17 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +28 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +5 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +21 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +24 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +28 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +19 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +1 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +20 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +31 -0
- package/src/brokenLinksChecker/index.mjs +798 -0
- package/src/brokenLinksChecker/index.test.ts +261 -0
- package/src/cli/cmdArgosPush.mjs +13 -2
- package/src/cli/cmdBuild.mjs +76 -30
- package/src/cli/cmdGithubAuth.mjs +36 -0
- package/src/cli/cmdListWorkspaces.mjs +2 -2
- package/src/cli/cmdPublish.mjs +203 -49
- package/src/cli/cmdPublishCanary.mjs +404 -46
- package/src/cli/cmdPublishNewPackage.mjs +86 -0
- package/src/cli/cmdSetVersionOverrides.mjs +17 -1
- package/src/cli/cmdValidateBuiltTypes.mjs +49 -0
- package/src/cli/index.mjs +6 -2
- package/src/cli/packageJson.d.ts +729 -0
- package/src/eslint/baseConfig.mjs +99 -79
- package/src/eslint/docsConfig.mjs +26 -13
- package/src/eslint/extensions.mjs +8 -8
- package/src/eslint/jsonConfig.mjs +40 -0
- package/src/eslint/material-ui/config.mjs +21 -9
- package/src/eslint/material-ui/index.mjs +7 -0
- package/src/eslint/material-ui/rules/add-undef-to-optional.mjs +127 -0
- package/src/eslint/material-ui/rules/add-undef-to-optional.test.mjs +361 -0
- package/src/eslint/material-ui/rules/consistent-production-guard.mjs +95 -0
- package/src/eslint/material-ui/rules/consistent-production-guard.test.mjs +162 -0
- package/src/eslint/material-ui/rules/disallow-react-api-in-server-components.mjs +83 -14
- package/src/eslint/material-ui/rules/disallow-react-api-in-server-components.test.mjs +305 -0
- package/src/eslint/material-ui/rules/mui-name-matches-component-name.mjs +4 -2
- package/src/eslint/material-ui/rules/nodeEnvUtils.mjs +41 -0
- package/src/eslint/material-ui/rules/require-dev-wrapper.mjs +154 -0
- package/src/eslint/material-ui/rules/require-dev-wrapper.test.mjs +265 -0
- package/src/eslint/material-ui/rules/rules-of-use-theme-variants.mjs +2 -1
- package/src/eslint/testConfig.mjs +73 -66
- package/src/stylelint/index.mjs +46 -0
- package/src/untyped-plugins.d.ts +20 -0
- package/src/{cli → utils}/babel.mjs +10 -3
- package/src/utils/build.mjs +27 -1
- package/src/utils/changelog.mjs +160 -0
- package/src/utils/credentials.mjs +71 -0
- package/src/utils/extractErrorCodes.mjs +10 -3
- package/src/utils/git.mjs +65 -0
- package/src/utils/github.mjs +263 -0
- package/src/{cli → utils}/pnpm.mjs +23 -13
- package/src/cli/cmdJsonLint.mjs +0 -69
- /package/src/{cli → utils}/typescript.mjs +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
1
|
# @mui/internal-code-infra
|
|
2
2
|
|
|
3
3
|
Scripts and configs to be used across MUI repos.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
This is stored in the `docs` top-level directory.
|
|
8
|
+
|
|
9
|
+
[Read in Markdown](../../docs/app/code-infra/page.mdx)
|
|
10
|
+
|
|
11
|
+
[Read in Browser](https://mui-internal.netlify.app/code-infra)
|
|
12
|
+
|
|
13
|
+
## Publishing packages
|
|
14
|
+
|
|
15
|
+
1. Go to the publish action -
|
|
16
|
+
|
|
17
|
+
- [Base UI](https://github.com/mui/base-ui/actions/workflows/publish.yml)
|
|
18
|
+
- [Core](https://github.com/mui/material-ui/actions/workflows/publish.yml)
|
|
19
|
+
- [MUI X](https://github.com/mui/mui-x/actions/workflows/publish.yml)
|
|
20
|
+
|
|
21
|
+
2. Choose "Run workflow" dropdown
|
|
22
|
+
|
|
23
|
+
> - **Branch:** master
|
|
24
|
+
> - **Commit SHA to release from:** the commit that contains the merged release on master. This commit is linked to the GitHub release.
|
|
25
|
+
> - **Run in dry-run mode:** Used for debugging.
|
|
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.
|
|
28
|
+
|
|
29
|
+
3. Click "Run workflow"
|
|
30
|
+
4. Refresh the page to see the newly created workflow, and click it.
|
|
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
|
+
|
|
33
|
+
> [!IMPORTANT]
|
|
34
|
+
> 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
|
+
|
|
36
|
+
### Adding and publishing new packages
|
|
37
|
+
|
|
38
|
+
Whenever news packages are added to the repo (that will get published to npm) or a private package is turned into a public one, follow the below steps before invoking the publish workflow of the previous section.
|
|
39
|
+
|
|
40
|
+
1. Goto your repo's code base on your system, open terminal and run:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm code-infra publish-new-package
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This command detects the new public packages in the repo and asks for your confirmation before publishing them to the npm registry. Add the `--dryRun` flag to skip the actual publishing.
|
|
47
|
+
|
|
48
|
+
2. Goto the settings link for each packages, ie, https://www.npmjs.com/package/<pkg-name>/access , and setup `Trusted Publisher`.
|
|
49
|
+
3. In `Select your publisher` step in the above link, click on the `Github Actions` button to configure Github actions based trusted publishing.
|
|
50
|
+
4. Fill in the details of the repo -
|
|
51
|
+
1. `Organization or user` as `mui`,
|
|
52
|
+
2. `Repository` as per the new package
|
|
53
|
+
3. `Workflow filename*` should be `publish.yml`
|
|
54
|
+
4. `Environment name` should be `npm-publish`
|
|
55
|
+
5. In the `Publishing access` section, toggle the recommended option of `Require two-factor authentication and disallow tokens`.
|
|
56
|
+
6. Finally, save the changes by clicking on `Update Package Settings` button.
|
|
57
|
+
|
|
58
|
+
After following these steps, the `Publish` workflow can be invoked again.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} param0
|
|
3
|
+
* @param {boolean} [param0.debug]
|
|
4
|
+
* @param {boolean} [param0.optimizeClsx]
|
|
5
|
+
* @param {boolean} [param0.removePropTypes]
|
|
6
|
+
* @param {boolean} [param0.noResolveImports]
|
|
7
|
+
* @param {'cjs' | 'esm'} param0.bundle
|
|
8
|
+
* @param {string | null} param0.outExtension - Specify the output file extension.
|
|
9
|
+
* @param {string} param0.runtimeVersion
|
|
10
|
+
* @param {string} [param0.reactCompilerReactVersion]
|
|
11
|
+
* @param {string} [param0.reactCompilerMode]
|
|
12
|
+
* @returns {import('@babel/core').TransformOptions} The base Babel configuration.
|
|
13
|
+
*/
|
|
14
|
+
export function getBaseConfig({ debug, optimizeClsx, removePropTypes, noResolveImports, bundle, runtimeVersion, outExtension, reactCompilerReactVersion, reactCompilerMode, }: {
|
|
15
|
+
debug?: boolean | undefined;
|
|
16
|
+
optimizeClsx?: boolean | undefined;
|
|
17
|
+
removePropTypes?: boolean | undefined;
|
|
18
|
+
noResolveImports?: boolean | undefined;
|
|
19
|
+
bundle: "cjs" | "esm";
|
|
20
|
+
outExtension: string | null;
|
|
21
|
+
runtimeVersion: string;
|
|
22
|
+
reactCompilerReactVersion?: string | undefined;
|
|
23
|
+
reactCompilerMode?: string | undefined;
|
|
24
|
+
}): import("@babel/core").TransformOptions;
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {Object} Options
|
|
27
|
+
* @prop {'esm' | 'cjs'} [Options.bundle]
|
|
28
|
+
* @prop {boolean} [Options.noResolveImports]
|
|
29
|
+
* @prop {undefined} [options.env]
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @param {import('@babel/core').ConfigAPI | Options} api
|
|
33
|
+
* @returns {import('@babel/core').TransformOptions}
|
|
34
|
+
*/
|
|
35
|
+
export default function getBabelConfig(api: import("@babel/core").ConfigAPI | Options): import("@babel/core").TransformOptions;
|
|
36
|
+
export type Options = {
|
|
37
|
+
bundle?: "cjs" | "esm" | undefined;
|
|
38
|
+
noResolveImports?: boolean | undefined;
|
|
39
|
+
env?: undefined;
|
|
40
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crawls a website starting from seed URLs, discovering all internal links and checking for broken links/targets.
|
|
3
|
+
* @param {CrawlOptions} rawOptions - Configuration options for the crawl
|
|
4
|
+
* @returns {Promise<CrawlResult>} Crawl results including all links, pages, and issues found
|
|
5
|
+
*/
|
|
6
|
+
export function crawl(rawOptions: CrawlOptions): Promise<CrawlResult>;
|
|
7
|
+
/**
|
|
8
|
+
* Maps page URLs to sets of known target IDs (anchors) on that page.
|
|
9
|
+
* Used to track which link targets (e.g., #section-id) exist on each page.
|
|
10
|
+
*/
|
|
11
|
+
export type LinkStructure = Map<string, Set<string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Serialized representation of LinkStructure for JSON storage.
|
|
14
|
+
* Converts Maps and Sets to plain objects and arrays for file persistence.
|
|
15
|
+
*/
|
|
16
|
+
export type SerializedLinkStructure = {
|
|
17
|
+
/**
|
|
18
|
+
* - Object mapping page URLs to arrays of target IDs
|
|
19
|
+
*/
|
|
20
|
+
targets: Record<string, string[]>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Data about a crawled page including its URL, HTTP status, and available link targets.
|
|
24
|
+
*/
|
|
25
|
+
export type PageData = {
|
|
26
|
+
/**
|
|
27
|
+
* - The normalized page URL (without trailing slash unless root)
|
|
28
|
+
*/
|
|
29
|
+
url: string;
|
|
30
|
+
/**
|
|
31
|
+
* - HTTP status code from the response (e.g., 200, 404, 500)
|
|
32
|
+
*/
|
|
33
|
+
status: number;
|
|
34
|
+
/**
|
|
35
|
+
* - Set of available anchor targets on the page, keyed by hash (e.g., '#intro')
|
|
36
|
+
*/
|
|
37
|
+
targets: Set<string>;
|
|
38
|
+
/**
|
|
39
|
+
* - Content-type of the page (e.g., 'text/html', 'text/markdown')
|
|
40
|
+
*/
|
|
41
|
+
contentType: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Represents a hyperlink found during crawling.
|
|
45
|
+
*/
|
|
46
|
+
export type Link = {
|
|
47
|
+
/**
|
|
48
|
+
* - URL of the page where this link was found, or null for seed URLs
|
|
49
|
+
*/
|
|
50
|
+
src: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* - Accessible name/text content of the link element, or null for seed URLs
|
|
53
|
+
*/
|
|
54
|
+
text: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* - The href attribute value (may be relative or absolute, with or without hash)
|
|
57
|
+
*/
|
|
58
|
+
href: string;
|
|
59
|
+
/**
|
|
60
|
+
* - Content-type of the source page (e.g., 'text/html', 'text/markdown')
|
|
61
|
+
*/
|
|
62
|
+
contentType?: string | null | undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Rule for ignoring broken links. All properties are optional but at least one must be defined.
|
|
66
|
+
* Properties use OR logic internally (any pattern can match), AND logic between properties (all specified must match).
|
|
67
|
+
*/
|
|
68
|
+
export type IgnoreRule = {
|
|
69
|
+
/**
|
|
70
|
+
* - Pattern(s) to match source page path
|
|
71
|
+
*/
|
|
72
|
+
path?: string | RegExp | (string | RegExp)[] | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* - Pattern(s) to match broken link href
|
|
75
|
+
*/
|
|
76
|
+
href?: string | RegExp | (string | RegExp)[] | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* - Pattern(s) to match source page content-type
|
|
79
|
+
*/
|
|
80
|
+
contentType?: string | RegExp | (string | RegExp)[] | undefined;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Normalized ignore rule where all properties are arrays (or undefined).
|
|
84
|
+
*/
|
|
85
|
+
export type NormalizedIgnoreRule = {
|
|
86
|
+
path: (string | RegExp)[] | undefined;
|
|
87
|
+
href: (string | RegExp)[] | undefined;
|
|
88
|
+
contentType: (string | RegExp)[] | undefined;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Configuration options for the broken links crawler.
|
|
92
|
+
*/
|
|
93
|
+
export type CrawlOptions = {
|
|
94
|
+
/**
|
|
95
|
+
* - Shell command to start the dev server (e.g., 'npm run dev'). If null, assumes server is already running
|
|
96
|
+
*/
|
|
97
|
+
startCommand?: string | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* - Base URL of the site to crawl (e.g., 'http://localhost:3000')
|
|
100
|
+
*/
|
|
101
|
+
host: string;
|
|
102
|
+
/**
|
|
103
|
+
* - File path to write discovered link targets to. If null, targets are not persisted
|
|
104
|
+
*/
|
|
105
|
+
outPath?: string | null | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* - Array of regex patterns to exclude from crawling (e.g., [/^\/api\//] to skip /api/* routes)
|
|
108
|
+
*/
|
|
109
|
+
ignoredPaths?: RegExp[] | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* - CSS selectors for elements whose nested links should be ignored (e.g., ['.sidebar', 'footer'])
|
|
112
|
+
*/
|
|
113
|
+
ignoredContent?: string[] | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* - Set of element IDs to ignore as link targets (defaults to '__next', '__NEXT_DATA__')
|
|
116
|
+
*/
|
|
117
|
+
ignoredTargets?: Set<string> | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* - Pre-populated map of known valid targets to skip crawling (useful for external pages)
|
|
120
|
+
*/
|
|
121
|
+
knownTargets?: Map<string, Set<string>> | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* - URLs to fetch known targets from (fetched JSON will be merged with knownTargets)
|
|
124
|
+
*/
|
|
125
|
+
knownTargetsDownloadUrl?: string[] | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* - Number of concurrent page fetches (defaults to 4)
|
|
128
|
+
*/
|
|
129
|
+
concurrency?: number | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* - Starting URLs for the crawl (defaults to ['/'])
|
|
132
|
+
*/
|
|
133
|
+
seedUrls?: string[] | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* - Rules to ignore broken links. Each rule can have path, href, contentType, and/or has properties. All specified properties must match (AND logic). Within a property, multiple values use OR logic.
|
|
136
|
+
*/
|
|
137
|
+
ignores?: IgnoreRule[] | undefined;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Fully resolved configuration with all optional fields filled with defaults.
|
|
141
|
+
*/
|
|
142
|
+
export type ResolvedCrawlOptions = Omit<Required<CrawlOptions>, "ignores"> & {
|
|
143
|
+
ignores: NormalizedIgnoreRule[];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Represents a broken link or broken link target discovered during crawling.
|
|
147
|
+
*/
|
|
148
|
+
export type Issue = {
|
|
149
|
+
/**
|
|
150
|
+
* - Type of issue: 'broken-link' for 404 pages, 'broken-target' for missing anchors
|
|
151
|
+
*/
|
|
152
|
+
type: "broken-link" | "broken-target";
|
|
153
|
+
/**
|
|
154
|
+
* - Human-readable description of the issue (e.g., 'Target not found', 'Page returned error 404')
|
|
155
|
+
*/
|
|
156
|
+
message: string;
|
|
157
|
+
/**
|
|
158
|
+
* - The link object that has the issue
|
|
159
|
+
*/
|
|
160
|
+
link: Link;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Results from a complete crawl operation.
|
|
164
|
+
*/
|
|
165
|
+
export type CrawlResult = {
|
|
166
|
+
/**
|
|
167
|
+
* - All links discovered during the crawl
|
|
168
|
+
*/
|
|
169
|
+
links: Set<Link>;
|
|
170
|
+
/**
|
|
171
|
+
* - All pages crawled, keyed by normalized URL
|
|
172
|
+
*/
|
|
173
|
+
pages: Map<string, PageData>;
|
|
174
|
+
/**
|
|
175
|
+
* - All broken links and broken targets found
|
|
176
|
+
*/
|
|
177
|
+
issues: Issue[];
|
|
178
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export type Args = {
|
|
5
|
+
/**
|
|
6
|
+
* - Run with verbose logging
|
|
7
|
+
*/
|
|
8
|
+
verbose?: boolean | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* - Screenshots folder path
|
|
11
|
+
*/
|
|
12
|
+
folder: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
2
|
+
export default _default;
|
|
3
|
+
export type Args = {
|
|
4
|
+
/**
|
|
5
|
+
* - The bundles to build.
|
|
6
|
+
*/
|
|
7
|
+
bundle: import("../utils/build.mjs").BundleType[];
|
|
8
|
+
/**
|
|
9
|
+
* - The large files to build.
|
|
10
|
+
*/
|
|
11
|
+
hasLargeFiles: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* - Whether to skip generating a package.json file in the /esm folder.
|
|
14
|
+
*/
|
|
15
|
+
skipBundlePackageJson: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* - The directory to copy the cjs files to.
|
|
18
|
+
*/
|
|
19
|
+
cjsOutDir: string;
|
|
20
|
+
/**
|
|
21
|
+
* - Whether to enable verbose logging.
|
|
22
|
+
*/
|
|
23
|
+
verbose: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* - Whether to build types for the package.
|
|
26
|
+
*/
|
|
27
|
+
buildTypes: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* - Whether to build types for the package.
|
|
30
|
+
*/
|
|
31
|
+
skipTsc: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* - Whether to skip checking for Babel runtime dependencies in the package.
|
|
34
|
+
*/
|
|
35
|
+
skipBabelRuntimeCheck: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* - Whether to skip generating the package.json file in the bundle output.
|
|
38
|
+
*/
|
|
39
|
+
skipPackageJson: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* - Whether to skip checking for main field in package.json.
|
|
42
|
+
*/
|
|
43
|
+
skipMainCheck: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* - Globs to be ignored by Babel.
|
|
46
|
+
*/
|
|
47
|
+
ignore: string[];
|
|
48
|
+
/**
|
|
49
|
+
* - Files/Directories to be copied. Can be a glob pattern.
|
|
50
|
+
*/
|
|
51
|
+
copy?: string[] | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* - Whether to use the React compiler.
|
|
54
|
+
*/
|
|
55
|
+
enableReactCompiler?: boolean | undefined;
|
|
56
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
2
|
+
export default _default;
|
|
3
|
+
export type Args = {
|
|
4
|
+
/**
|
|
5
|
+
* Run in silent mode without logging
|
|
6
|
+
*/
|
|
7
|
+
silent?: boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Exclude default files from the copy operation
|
|
10
|
+
*/
|
|
11
|
+
excludeDefaults?: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Glob patterns to copy
|
|
14
|
+
*/
|
|
15
|
+
glob?: string[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Extra files to copy
|
|
18
|
+
*/
|
|
19
|
+
files?: string[] | undefined;
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export type PublicPackage = import("../utils/pnpm.mjs").PublicPackage;
|
|
5
|
+
export type Args = {
|
|
6
|
+
/**
|
|
7
|
+
* - Whether to filter to only public packages
|
|
8
|
+
*/
|
|
9
|
+
publicOnly?: boolean | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* - Output format (name, path, or json)
|
|
12
|
+
*/
|
|
13
|
+
output?: "name" | "path" | "json" | "publish-dir" | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* - Git reference to filter changes since
|
|
16
|
+
*/
|
|
17
|
+
sinceRef?: string | undefined;
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export type Args = {
|
|
5
|
+
/**
|
|
6
|
+
* Run in dry-run mode without publishing
|
|
7
|
+
*/
|
|
8
|
+
"dry-run": boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Create a GitHub draft release after publishing
|
|
11
|
+
*/
|
|
12
|
+
"github-release": boolean;
|
|
13
|
+
/**
|
|
14
|
+
* NPM dist tag to publish to
|
|
15
|
+
*/
|
|
16
|
+
tag: string;
|
|
17
|
+
/**
|
|
18
|
+
* Runs in CI environment
|
|
19
|
+
*/
|
|
20
|
+
ci: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Git SHA to use for the GitHub release workflow (local only)
|
|
23
|
+
*/
|
|
24
|
+
sha?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type PublicPackage = import("../utils/pnpm.mjs").PublicPackage;
|
|
27
|
+
export type PublishOptions = import("../utils/pnpm.mjs").PublishOptions;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export type Commit = {
|
|
5
|
+
/**
|
|
6
|
+
* - Commit SHA
|
|
7
|
+
*/
|
|
8
|
+
sha: string;
|
|
9
|
+
/**
|
|
10
|
+
* - Commit message
|
|
11
|
+
*/
|
|
12
|
+
message: string;
|
|
13
|
+
/**
|
|
14
|
+
* - Commit author
|
|
15
|
+
*/
|
|
16
|
+
author: string;
|
|
17
|
+
};
|
|
18
|
+
export type PublicPackage = import("../utils/pnpm.mjs").PublicPackage;
|
|
19
|
+
export type VersionInfo = import("../utils/pnpm.mjs").VersionInfo;
|
|
20
|
+
export type PublishOptions = import("../utils/pnpm.mjs").PublishOptions;
|
|
21
|
+
export type Args = {
|
|
22
|
+
/**
|
|
23
|
+
* - Whether to run in dry-run mode
|
|
24
|
+
*/
|
|
25
|
+
dryRun?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* - Whether to create GitHub releases for canary packages
|
|
28
|
+
*/
|
|
29
|
+
githubRelease?: boolean | undefined;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} [params]
|
|
3
|
+
* @param {boolean} [params.enableReactCompiler] - Whether to enable React Compiler.
|
|
4
|
+
* @param {boolean} [params.consistentTypeImports] - Whether to enforce consistent type imports.
|
|
5
|
+
* @param {string} [params.baseDirectory] - The base directory for the configuration.
|
|
6
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
7
|
+
*/
|
|
8
|
+
export function createBaseConfig({ enableReactCompiler, consistentTypeImports, baseDirectory, }?: {
|
|
9
|
+
enableReactCompiler?: boolean | undefined;
|
|
10
|
+
consistentTypeImports?: boolean | undefined;
|
|
11
|
+
baseDirectory?: string | undefined;
|
|
12
|
+
}): import("eslint").Linter.Config[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const EXTENSION_JS: ".?(c|m)js?(x)";
|
|
2
|
+
export const EXTENSION_JS_NO_MODULE: ".js?(x)";
|
|
3
|
+
export const EXTENSION_TS: ".?(c|m)[jt]s?(x)";
|
|
4
|
+
export const EXTENSION_TS_NO_MODULE: ".[jt]s?(x)";
|
|
5
|
+
export const EXTENSION_TS_ONLY: ".?(c|m)ts?(x)";
|
|
6
|
+
export const EXTENSION_TS_ONLY_NO_MODULE: ".ts?(x)";
|
|
7
|
+
export const EXTENSION_DTS: ".d.?(c|m)ts?(x)";
|
|
8
|
+
export const EXTENSION_TEST_FILE: ".test.?(c|m)[jt]s?(x)";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} [options]
|
|
3
|
+
* @param {boolean} [options.enableReactCompiler] - Whether to enable React Compiler.
|
|
4
|
+
* @param {boolean} [options.consistentTypeImports] - Whether to enforce consistent type imports.
|
|
5
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
6
|
+
*/
|
|
7
|
+
export function createCoreConfig(options?: {
|
|
8
|
+
enableReactCompiler?: boolean | undefined;
|
|
9
|
+
consistentTypeImports?: boolean | undefined;
|
|
10
|
+
}): import("eslint").Linter.Config[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default rule;
|
|
2
|
+
/**
|
|
3
|
+
* ESLint rule that enforces consistent patterns for production guard checks.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Valid - comparing with 'production'
|
|
7
|
+
* if (process.env.NODE_ENV !== 'production') {}
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Valid - comparing with 'production'
|
|
11
|
+
* if (process.env.NODE_ENV === 'production') {}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Invalid - comparing with 'development'
|
|
15
|
+
* if (process.env.NODE_ENV === 'development') {}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Invalid - comparing with 'test'
|
|
19
|
+
* if (process.env.NODE_ENV !== 'test') {}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Invalid - non-static construct
|
|
23
|
+
* const env = 'production';
|
|
24
|
+
* if (process.env.NODE_ENV !== env) {}
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Usage in ESLint config
|
|
28
|
+
* {
|
|
29
|
+
* rules: {
|
|
30
|
+
* 'material-ui/consistent-production-guard': 'error'
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* @type {import('eslint').Rule.RuleModule}
|
|
35
|
+
*/
|
|
36
|
+
declare const rule: import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: import("eslint").Rule.RuleModule;
|
|
2
|
+
export default _default;
|
|
3
|
+
export type PatternConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* - The pattern to match against resolved imports
|
|
6
|
+
*/
|
|
7
|
+
pattern: string;
|
|
8
|
+
/**
|
|
9
|
+
* - Custom message to show when the pattern matches
|
|
10
|
+
*/
|
|
11
|
+
message?: string | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for ESLint rules dealing with process.env.NODE_ENV
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a node is process.env.NODE_ENV
|
|
6
|
+
* @param {import('estree').Node} node
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function isProcessEnvNodeEnv(node: import("estree").Node): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a node is a Literal with a specific value
|
|
12
|
+
* @param {import('estree').Node} node
|
|
13
|
+
* @param {string} value
|
|
14
|
+
* @returns {boolean}
|
|
15
|
+
*/
|
|
16
|
+
export function isLiteralEq(node: import("estree").Node, value: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if a node is a Literal with a value not equal to the specified one
|
|
19
|
+
* @param {import('estree').Node} node
|
|
20
|
+
* @param {string} value
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
export function isLiteralNeq(node: import("estree").Node, value: string): boolean;
|