@mui/internal-code-infra 0.0.4-canary.73 → 0.0.4-canary.74

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 (51) hide show
  1. package/package.json +5 -3
  2. package/src/cli/cmdPublish.mjs +32 -3
  3. package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
  4. package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
  5. package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
  6. package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
  7. package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
  8. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -29
  9. package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +0 -15
  10. package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
  11. package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
  12. package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
  13. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
  14. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
  15. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
  16. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
  17. package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
  18. package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
  19. package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
  20. package/src/brokenLinksChecker/index.test.ts +0 -301
  21. package/src/changelog/categorizeCommits.test.ts +0 -319
  22. package/src/changelog/filterCommits.test.ts +0 -363
  23. package/src/changelog/parseCommitLabels.test.ts +0 -509
  24. package/src/changelog/renderChangelog.test.ts +0 -378
  25. package/src/changelog/sortSections.test.ts +0 -199
  26. package/src/cli/cmdVale.test.mjs +0 -644
  27. package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
  28. package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
  29. package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
  30. package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
  31. package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
  32. package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
  33. package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
  34. package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
  35. package/src/eslint/mui/rules/no-floating-cleanup.test.mjs +0 -141
  36. package/src/eslint/mui/rules/no-guarded-throw.test.mjs +0 -206
  37. package/src/eslint/mui/rules/no-presentation-role.test.mjs +0 -33
  38. package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
  39. package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
  40. package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
  41. package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
  42. package/src/remark/firstBlockHeading.test.mjs +0 -107
  43. package/src/remark/gitDiff.test.mjs +0 -45
  44. package/src/remark/noSpaceInLinks.test.mjs +0 -22
  45. package/src/remark/straightQuotes.test.mjs +0 -25
  46. package/src/remark/tableAlignment.test.mjs +0 -28
  47. package/src/remark/terminalLanguage.test.mjs +0 -17
  48. package/src/utils/build.test.mjs +0 -1263
  49. package/src/utils/pnpm.test.mjs +0 -731
  50. package/src/utils/template.test.mjs +0 -133
  51. package/src/utils/typescript.test.mjs +0 -341
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.73",
3
+ "version": "0.0.4-canary.74",
4
4
  "author": "MUI Team",
5
5
  "description": "Infra scripts and configs to be used across MUI repos.",
6
6
  "license": "MIT",
@@ -181,12 +181,14 @@
181
181
  "src",
182
182
  "vale",
183
183
  "README.md",
184
- "LICENSE"
184
+ "LICENSE",
185
+ "!src/**/__fixtures__/**",
186
+ "!src/**/*.test.*"
185
187
  ],
186
188
  "publishConfig": {
187
189
  "access": "public"
188
190
  },
189
- "gitSha": "a646322dc5697683ef464c5a05a0de6240de9f05",
191
+ "gitSha": "76639fa2eabf73261070fa2a6a964209de10688d",
190
192
  "scripts": {
191
193
  "build": "tsgo -p tsconfig.build.json",
192
194
  "typescript": "tsgo -noEmit",
@@ -143,8 +143,19 @@ async function checkGitHubReleaseExists(owner, repo, version) {
143
143
  */
144
144
  async function createGitTag(version, dryRun = false) {
145
145
  const tagName = `v${version}`;
146
+ // The CI smoke-test runs with a read-only token that can't push. It sets this
147
+ // so we tolerate the push failure explicitly, instead of assuming any dry-run
148
+ // permission error is expected.
149
+ const isPublishTest = process.env.IS_PUBLISH_TEST === 'true';
146
150
 
147
151
  try {
152
+ // Skip if the tag already exists locally. Tag creation is local and fails if it exists.
153
+ const { stdout: existingTag } = await $`git tag -l ${tagName}`;
154
+ if (existingTag.trim()) {
155
+ console.log(`🏷️ Git tag ${tagName} already exists, skipping`);
156
+ return;
157
+ }
158
+
148
159
  await $({
149
160
  env: {
150
161
  ...process.env,
@@ -152,10 +163,28 @@ async function createGitTag(version, dryRun = false) {
152
163
  GIT_COMMITTER_EMAIL: 'code-infra@mui.com',
153
164
  },
154
165
  })`git tag -a ${tagName} -m ${`Version ${version}`}`;
155
- const pushArgs = dryRun ? ['--dry-run'] : [];
156
- await $({ stdio: 'inherit' })`git push origin ${tagName} ${pushArgs}`;
157
166
 
158
- console.log(`🏷️ Created and pushed git tag ${tagName}${dryRun ? ' (dry-run)' : ''}`);
167
+ if (dryRun) {
168
+ // `git push --dry-run` still authenticates and needs push access. When the token
169
+ // can push, validate it for real; when it can't, only tolerate the failure if this
170
+ // is an explicit publish smoke-test and the error is a genuine permission denial.
171
+ try {
172
+ // Don't inherit stdio so stderr is captured and matchable below.
173
+ await $`git push origin ${tagName} --dry-run`;
174
+ console.log(`🏷️ Created git tag ${tagName} (dry-run)`);
175
+ } catch (/** @type {any} */ pushError) {
176
+ const message = pushError.stderr || pushError.message || '';
177
+ if (isPublishTest && /permission|403|denied/i.test(message)) {
178
+ console.log(`🏷️ Created git tag ${tagName} (dry-run, no push permission, skipped push)`);
179
+ return;
180
+ }
181
+ throw pushError;
182
+ }
183
+ return;
184
+ }
185
+ await $({ stdio: 'inherit' })`git push origin ${tagName}`;
186
+
187
+ console.log(`🏷️ Created and pushed git tag ${tagName}`);
159
188
  } catch (/** @type {any} */ error) {
160
189
  throw new Error(`Failed to create git tag: ${error.message}`);
161
190
  }
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Broken Links</title>
7
- </head>
8
- <body>
9
- <h1>Page with Broken Links</h1>
10
- <p>This page contains links to non-existent pages.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home (valid)</a></li>
14
- <li><a href="/does-not-exist.html">This page does not exist</a></li>
15
- <li><a href="/another-missing-page.html">Another missing page</a></li>
16
- <li><a href="/valid.html">Valid link</a></li>
17
- </ul>
18
- </nav>
19
- </body>
20
- </html>
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Broken Targets</title>
7
- </head>
8
- <body>
9
- <h1>Page with Broken Targets</h1>
10
- <p>This page contains links to valid pages but with invalid hash targets.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home (valid)</a></li>
14
- <li><a href="/with-anchors.html#section1">Valid anchor</a></li>
15
- <li><a href="/with-anchors.html#nonexistent">Non-existent anchor</a></li>
16
- <li><a href="/valid.html#missing-target">Valid page, missing target</a></li>
17
- <li><a href="/with-anchors.html#section2">Another valid anchor</a></li>
18
- <li><a href="/with-anchors.html#also-missing">Also missing</a></li>
19
- </ul>
20
- </nav>
21
- </body>
22
- </html>
@@ -1,20 +0,0 @@
1
- # Example Markdown File
2
-
3
- This is a markdown file with links:
4
-
5
- - [Link to valid page](/valid.html)
6
- - [Link to page with anchors](/with-anchors.html#section1)
7
- - [Broken markdown link](/broken-from-markdown.html)
8
- - [Relative link to valid page](valid.html)
9
- - [Relative link with dot-slash](./with-anchors.html)
10
- - [Relative broken link](broken-relative.html)
11
-
12
- ## Markdown Section
13
-
14
- This section has an anchor target (`#markdown-section`) generated by rehype-slug.
15
-
16
- This is a code block with a link that should NOT be extracted:
17
-
18
- ```html
19
- <a href="/this-should-not-be-checked.html">Link in code block</a>
20
- ```
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with External Links</title>
7
- </head>
8
- <body>
9
- <h1>Page with External Links</h1>
10
- <p>This page contains external links that should be ignored.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home (valid internal)</a></li>
14
- <li><a href="https://example.com">External link 1</a></li>
15
- <li><a href="https://github.com/mui">External link 2</a></li>
16
- <li><a href="http://localhost:9999/fake">External localhost</a></li>
17
- <li><a href="/valid.html">Valid internal link</a></li>
18
- </ul>
19
- </nav>
20
- </body>
21
- </html>
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Ignored Page</title>
7
- </head>
8
- <body>
9
- <h1>Ignored Page</h1>
10
- <p>This page should be ignored by the crawler.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/this-link-should-not-be-checked.html">Should not be checked</a></li>
14
- </ul>
15
- </nav>
16
- </body>
17
- </html>
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Test Site Home</title>
7
- </head>
8
- <body>
9
- <h1>Test Site Home</h1>
10
- <nav>
11
- <ul>
12
- <li><a href="/valid.html">Valid Page</a></li>
13
- <li><a href="/with-anchors.html">Page with Anchors</a></li>
14
- <li><a href="/broken-links.html">Page with Broken Links</a></li>
15
- <li><a href="/broken-targets.html">Page with Broken Targets</a></li>
16
- <li><a href="/external-links.html">Page with External Links</a></li>
17
- <li><a href="/nested/page.html">Nested Page</a></li>
18
- <li><a href="/ignored-page.html">Ignored Page</a></li>
19
- <li><a href="/page-with-ignored-content.html">Page with Ignored Content</a></li>
20
- <li><a href="/page-with-custom-targets.html">Page with Custom Targets</a></li>
21
- <li><a href="/page-with-known-target-links.html">Page with Known Target Links</a></li>
22
- <li><a href="/page-with-api-links.html">Page with API Links</a></li>
23
- <li><a href="/example.md">Example Markdown</a></li>
24
- <li><a href="/unclosed-tags.html">Page with Unclosed Tags</a></li>
25
- <li><a href="/invalid-html.html">Invalid HTML Page</a></li>
26
- </ul>
27
- </nav>
28
- </body>
29
- </html>
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Invalid HTML Page</title>
6
- </head>
7
- <body>
8
- <h1>Invalid HTML</h1>
9
- <!-- Duplicate ID (violates no-duplicate-id rule) -->
10
- <div id="dup">First</div>
11
- <div id="dup">Second</div>
12
- <!-- Raw ampersand (violates no-raw-characters rule) -->
13
- <p>Tom & Jerry</p>
14
- </body>
15
- </html>
@@ -1,5 +0,0 @@
1
- {
2
- "targets": {
3
- "/api-page.html": ["#method1", "#method2", "#method3"]
4
- }
5
- }
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Nested Page</title>
7
- </head>
8
- <body>
9
- <h1>Nested Page</h1>
10
- <p>This is a page in a nested directory.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home</a></li>
14
- <li><a href="/valid.html">Valid page</a></li>
15
- <li><a href="/with-anchors.html#section1">Link to anchor</a></li>
16
- <li><a href="../valid.html">Relative link to valid page</a></li>
17
- <li><a href="../broken-relative-html.html">Relative broken link from HTML</a></li>
18
- </ul>
19
- </nav>
20
- </body>
21
- </html>
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Orphaned Page</title>
7
- </head>
8
- <body>
9
- <h1>Orphaned Page</h1>
10
- <p>This page is not linked from anywhere and can only be discovered via seedUrls.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/valid.html">Valid Page</a></li>
14
- <li><a href="/valid.html/">Valid Page with trailing slash</a></li>
15
- <li><a href="/orphaned-broken-link.html">Broken link from orphaned page</a></li>
16
- <li><a href="/example.md">Markdown file with HTML snippet</a></li>
17
- </ul>
18
- </nav>
19
- </body>
20
- </html>
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with API Links</title>
7
- </head>
8
- <body>
9
- <h1>Page with API Links</h1>
10
- <p>This page links to API documentation with known targets.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home</a></li>
14
- <li><a href="/api-page.html#method1">API Method 1 (known)</a></li>
15
- <li><a href="/api-page.html#method2">API Method 2 (known)</a></li>
16
- <li><a href="/api-page.html#unknown-method">Unknown API method</a></li>
17
- </ul>
18
- </nav>
19
- </body>
20
- </html>
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Custom Targets</title>
7
- </head>
8
- <body>
9
- <h1>Page with Custom Targets</h1>
10
- <nav>
11
- <ul>
12
- <li><a href="/">Home</a></li>
13
- <li><a href="#custom-id">Link to custom ID</a></li>
14
- <li><a href="#__should-be-ignored">Link to ignored ID</a></li>
15
- </ul>
16
- </nav>
17
- <section id="custom-id">
18
- <h2>Custom ID Section</h2>
19
- </section>
20
- <section id="__should-be-ignored">
21
- <h2>This target should be ignored</h2>
22
- </section>
23
- </body>
24
- </html>
@@ -1,28 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Ignored Content</title>
7
- </head>
8
- <body>
9
- <h1>Page with Ignored Content</h1>
10
- <nav>
11
- <ul>
12
- <li><a href="/">Home</a></li>
13
- </ul>
14
- </nav>
15
- <aside class="sidebar">
16
- <h2>Sidebar (should be ignored)</h2>
17
- <ul>
18
- <li><a href="/sidebar-broken-link.html">Broken link in sidebar</a></li>
19
- </ul>
20
- </aside>
21
- <main>
22
- <p>Main content</p>
23
- <p>
24
- <a href="/broken-link-with-sidebar-class.html" class="sidebar">Link with sidebar class directly</a>
25
- </p>
26
- </main>
27
- </body>
28
- </html>
@@ -1,19 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Known Target Links</title>
7
- </head>
8
- <body>
9
- <h1>Page with Known Target Links</h1>
10
- <p>This page links to external pages with known targets.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home</a></li>
14
- <li><a href="/external-page.html#valid-target">Valid external target</a></li>
15
- <li><a href="/external-page.html#invalid-target">Invalid external target</a></li>
16
- </ul>
17
- </nav>
18
- </body>
19
- </html>
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Unclosed Tags</title></head><body><div class="wrapper"><main class="content"><a href="/broken-inside-unclosed-main.html">Broken link inside unclosed main</a><a href="/valid.html">Valid link inside unclosed main</a></main></div></body></html>
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Valid Page</title>
7
- </head>
8
- <body>
9
- <h1>Valid Page</h1>
10
- <p>This page has only valid internal links.</p>
11
- <nav>
12
- <ul>
13
- <li><a href="/">Home</a></li>
14
- <li><a href="/with-anchors.html#section1">Link to section 1</a></li>
15
- <li><a href="/with-anchors.html#section2">Link to section 2</a></li>
16
- <li><a href="/nested/page.html">Nested page</a></li>
17
- </ul>
18
- </nav>
19
- </body>
20
- </html>
@@ -1,31 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Page with Anchors</title>
7
- </head>
8
- <body>
9
- <h1>Page with Anchors</h1>
10
- <nav>
11
- <ul>
12
- <li><a href="/">Home</a></li>
13
- <li><a href="#section1">Jump to section 1</a></li>
14
- <li><a href="#section2">Jump to section 2</a></li>
15
- <li><a href="#section3">Jump to section 3</a></li>
16
- </ul>
17
- </nav>
18
- <section id="section1">
19
- <h2>Section 1</h2>
20
- <p>Content for section 1</p>
21
- </section>
22
- <section id="section2">
23
- <h2>Section 2</h2>
24
- <p>Content for section 2</p>
25
- </section>
26
- <section id="section3">
27
- <h2>Section 3</h2>
28
- <p>Content for section 3</p>
29
- </section>
30
- </body>
31
- </html>