@mui/internal-code-infra 0.0.4-canary.11 → 0.0.4-canary.110

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 (147) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +25 -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/eslint/testConfig.d.mts +1 -7
  32. package/build/remark/config.d.mts +43 -0
  33. package/build/remark/createLintTester.d.mts +10 -0
  34. package/build/remark/firstBlockHeading.d.mts +4 -0
  35. package/build/remark/gitDiff.d.mts +2 -0
  36. package/build/remark/noSpaceInLinks.d.mts +2 -0
  37. package/build/remark/straightQuotes.d.mts +2 -0
  38. package/build/remark/tableAlignment.d.mts +2 -0
  39. package/build/remark/terminalLanguage.d.mts +2 -0
  40. package/build/utils/babel.d.mts +7 -1
  41. package/build/utils/build.d.mts +59 -37
  42. package/build/utils/extractErrorCodes.d.mts +9 -0
  43. package/build/utils/git.d.mts +16 -0
  44. package/build/utils/github.d.mts +13 -1
  45. package/build/utils/pnpm.d.mts +226 -20
  46. package/build/utils/testUtils.d.mts +28 -0
  47. package/build/utils/typescript.d.mts +6 -16
  48. package/package.json +82 -57
  49. package/src/babel-config.mjs +3 -1
  50. package/src/brokenLinksChecker/crawlWorker.mjs +240 -0
  51. package/src/brokenLinksChecker/index.mjs +265 -190
  52. package/src/changelog/fetchChangelogs.mjs +8 -2
  53. package/src/changelog/renderChangelog.mjs +1 -1
  54. package/src/changelog/types.ts +3 -1
  55. package/src/cli/cmdBuild.mjs +53 -88
  56. package/src/cli/cmdListWorkspaces.mjs +7 -1
  57. package/src/cli/cmdNetlifyIgnore.mjs +30 -5
  58. package/src/cli/cmdPublish.mjs +101 -53
  59. package/src/cli/cmdPublishCanary.mjs +96 -24
  60. package/src/cli/cmdPublishNewPackage.mjs +31 -8
  61. package/src/cli/cmdRenameScope.mjs +76 -0
  62. package/src/cli/cmdSetVersionOverrides.mjs +40 -34
  63. package/src/cli/cmdVale.mjs +513 -0
  64. package/src/cli/index.mjs +4 -0
  65. package/src/cli/packageJson.d.ts +2 -3
  66. package/src/eslint/baseConfig.mjs +51 -19
  67. package/src/eslint/docsConfig.mjs +2 -1
  68. package/src/eslint/mui/config.mjs +24 -4
  69. package/src/eslint/mui/index.mjs +6 -0
  70. package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
  71. package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
  72. package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
  73. package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
  74. package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
  75. package/src/eslint/testConfig.mjs +3 -31
  76. package/src/estree-typescript.d.ts +1 -1
  77. package/src/remark/config.mjs +157 -0
  78. package/src/remark/createLintTester.mjs +19 -0
  79. package/src/remark/firstBlockHeading.mjs +87 -0
  80. package/src/remark/gitDiff.mjs +43 -0
  81. package/src/remark/noSpaceInLinks.mjs +42 -0
  82. package/src/remark/straightQuotes.mjs +31 -0
  83. package/src/remark/tableAlignment.mjs +23 -0
  84. package/src/remark/terminalLanguage.mjs +19 -0
  85. package/src/stylelint/index.mjs +2 -2
  86. package/src/untyped-plugins.d.ts +14 -14
  87. package/src/utils/build.mjs +604 -270
  88. package/src/utils/git.mjs +27 -7
  89. package/src/utils/pnpm.mjs +636 -60
  90. package/src/utils/testUtils.mjs +53 -0
  91. package/src/utils/typescript.mjs +23 -42
  92. package/vale/.vale.ini +1 -0
  93. package/vale/styles/MUI/CorrectReferenceAllCases.yml +42 -0
  94. package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
  95. package/vale/styles/MUI/GoogleLatin.yml +11 -0
  96. package/vale/styles/MUI/MuiBrandName.yml +22 -0
  97. package/vale/styles/MUI/NoBritish.yml +112 -0
  98. package/vale/styles/MUI/NoCompanyName.yml +17 -0
  99. package/build/markdownlint/duplicate-h1.d.mts +0 -56
  100. package/build/markdownlint/git-diff.d.mts +0 -11
  101. package/build/markdownlint/index.d.mts +0 -52
  102. package/build/markdownlint/straight-quotes.d.mts +0 -11
  103. package/build/markdownlint/table-alignment.d.mts +0 -11
  104. package/build/markdownlint/terminal-language.d.mts +0 -11
  105. package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
  106. package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
  107. package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
  108. package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
  109. package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
  110. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -28
  111. package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
  112. package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
  113. package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
  114. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
  115. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
  116. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
  117. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
  118. package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
  119. package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
  120. package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
  121. package/src/brokenLinksChecker/index.test.ts +0 -261
  122. package/src/changelog/categorizeCommits.test.ts +0 -319
  123. package/src/changelog/filterCommits.test.ts +0 -363
  124. package/src/changelog/parseCommitLabels.test.ts +0 -509
  125. package/src/changelog/renderChangelog.test.ts +0 -378
  126. package/src/changelog/sortSections.test.ts +0 -199
  127. package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
  128. package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
  129. package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
  130. package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
  131. package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
  132. package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
  133. package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
  134. package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
  135. package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
  136. package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
  137. package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
  138. package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
  139. package/src/markdownlint/duplicate-h1.mjs +0 -69
  140. package/src/markdownlint/git-diff.mjs +0 -31
  141. package/src/markdownlint/index.mjs +0 -62
  142. package/src/markdownlint/straight-quotes.mjs +0 -26
  143. package/src/markdownlint/table-alignment.mjs +0 -42
  144. package/src/markdownlint/terminal-language.mjs +0 -19
  145. package/src/utils/build.test.mjs +0 -705
  146. package/src/utils/template.test.mjs +0 -133
  147. package/src/utils/typescript.test.mjs +0 -380
package/src/utils/git.mjs CHANGED
@@ -24,6 +24,10 @@ export async function getRepositoryInfo(cwd = process.cwd()) {
24
24
  * @type {Set<string>}
25
25
  */
26
26
  const repoRemotes = new Set();
27
+ /**
28
+ * @type {Map<string, { owner: string, repo: string }>}
29
+ */
30
+ const validRemotes = new Map();
27
31
 
28
32
  for (const line of lines) {
29
33
  // Match pattern: "remoteName url (fetch|push)"
@@ -36,20 +40,25 @@ export async function getRepositoryInfo(cwd = process.cwd()) {
36
40
  cause[remoteName] = `Remote is not a GitHub repository under 'mui' organization: ${url}`;
37
41
  continue;
38
42
  }
39
- return {
40
- owner: parsed.owner,
41
- repo: parsed.name,
42
- remoteName,
43
- };
43
+ if (!validRemotes.has(remoteName)) {
44
+ validRemotes.set(remoteName, { owner: parsed.owner, repo: parsed.name });
45
+ }
44
46
  } catch (error) {
45
47
  cause[remoteName] = `Failed to parse URL for remote ${remoteName}: ${url}`;
46
48
  }
47
- }
48
- if (type !== '(push)') {
49
+ } else if (type !== '(push)') {
49
50
  throw new Error(`Unexpected line format for "git remote -v": "${line}"`);
50
51
  }
51
52
  }
52
53
 
54
+ const preferredOrder = ['upstream', 'origin', ...validRemotes.keys()];
55
+ for (const name of preferredOrder) {
56
+ const match = validRemotes.get(name);
57
+ if (match) {
58
+ return { ...match, remoteName: name };
59
+ }
60
+ }
61
+
53
62
  throw new Error(
54
63
  `Failed to find correct remote(s) in : ${Array.from(repoRemotes.keys()).join(', ')}`,
55
64
  { cause },
@@ -64,3 +73,14 @@ export async function getCurrentGitSha() {
64
73
  const result = await $`git rev-parse HEAD`;
65
74
  return result.stdout.trim();
66
75
  }
76
+
77
+ /**
78
+ * Check whether a tag already exists on the origin remote
79
+ * @param {string} tagName - Tag name to check (e.g. `v1.2.3`)
80
+ * @param {string} [cwd=process.cwd()]
81
+ * @returns {Promise<boolean>} True if the tag exists on origin
82
+ */
83
+ export async function remoteGitTagExists(tagName, cwd = process.cwd()) {
84
+ const { stdout } = await $({ cwd })`git ls-remote --tags origin refs/tags/${tagName}`;
85
+ return stdout.trim().length > 0;
86
+ }