@mui/internal-code-infra 0.0.4-canary.5 → 0.0.4-canary.51

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 (109) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -8
  3. package/build/babel-config.d.mts +11 -3
  4. package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
  5. package/build/brokenLinksChecker/index.d.mts +45 -2
  6. package/build/changelog/types.d.ts +1 -1
  7. package/build/cli/cmdArgosPush.d.mts +2 -2
  8. package/build/cli/cmdBuild.d.mts +2 -2
  9. package/build/cli/cmdCopyFiles.d.mts +2 -2
  10. package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
  11. package/build/cli/cmdGenerateChangelog.d.mts +2 -2
  12. package/build/cli/cmdGithubAuth.d.mts +2 -2
  13. package/build/cli/cmdListWorkspaces.d.mts +4 -2
  14. package/build/cli/cmdNetlifyIgnore.d.mts +3 -2
  15. package/build/cli/cmdPublish.d.mts +4 -2
  16. package/build/cli/cmdPublishCanary.d.mts +3 -3
  17. package/build/cli/cmdPublishNewPackage.d.mts +4 -2
  18. package/build/cli/cmdSetVersionOverrides.d.mts +2 -2
  19. package/build/cli/cmdVale.d.mts +46 -0
  20. package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
  21. package/build/eslint/baseConfig.d.mts +3 -1
  22. package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
  23. package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
  24. package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
  25. package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
  26. package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +2 -2
  27. package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
  28. package/build/markdownlint/duplicate-h1.d.mts +1 -1
  29. package/build/markdownlint/git-diff.d.mts +1 -1
  30. package/build/markdownlint/index.d.mts +1 -1
  31. package/build/markdownlint/straight-quotes.d.mts +1 -1
  32. package/build/markdownlint/table-alignment.d.mts +1 -1
  33. package/build/markdownlint/terminal-language.d.mts +1 -1
  34. package/build/remark/config.d.mts +43 -0
  35. package/build/remark/createLintTester.d.mts +10 -0
  36. package/build/remark/firstBlockHeading.d.mts +4 -0
  37. package/build/remark/gitDiff.d.mts +2 -0
  38. package/build/remark/noSpaceInLinks.d.mts +2 -0
  39. package/build/remark/straightQuotes.d.mts +2 -0
  40. package/build/remark/tableAlignment.d.mts +2 -0
  41. package/build/remark/terminalLanguage.d.mts +2 -0
  42. package/build/utils/babel.d.mts +1 -1
  43. package/build/utils/build.d.mts +4 -4
  44. package/build/utils/github.d.mts +1 -1
  45. package/build/utils/pnpm.d.mts +68 -2
  46. package/build/utils/testUtils.d.mts +7 -0
  47. package/build/utils/typescript.d.mts +2 -2
  48. package/package.json +62 -35
  49. package/src/babel-config.mjs +9 -3
  50. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +1 -0
  51. package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +15 -0
  52. package/src/brokenLinksChecker/crawlWorker.mjs +217 -0
  53. package/src/brokenLinksChecker/index.mjs +217 -164
  54. package/src/brokenLinksChecker/index.test.ts +50 -13
  55. package/src/changelog/categorizeCommits.test.ts +5 -5
  56. package/src/changelog/fetchChangelogs.mjs +6 -2
  57. package/src/changelog/parseCommitLabels.test.ts +5 -5
  58. package/src/changelog/renderChangelog.mjs +1 -1
  59. package/src/changelog/types.ts +1 -1
  60. package/src/cli/cmdListWorkspaces.mjs +9 -2
  61. package/src/cli/cmdNetlifyIgnore.mjs +35 -93
  62. package/src/cli/cmdPublish.mjs +51 -14
  63. package/src/cli/cmdPublishCanary.mjs +128 -132
  64. package/src/cli/cmdPublishNewPackage.mjs +27 -6
  65. package/src/cli/cmdVale.mjs +513 -0
  66. package/src/cli/cmdVale.test.mjs +644 -0
  67. package/src/cli/index.mjs +2 -0
  68. package/src/cli/packageJson.d.ts +1 -1
  69. package/src/eslint/baseConfig.mjs +45 -20
  70. package/src/eslint/docsConfig.mjs +2 -1
  71. package/src/eslint/jsonConfig.mjs +2 -1
  72. package/src/eslint/mui/config.mjs +21 -1
  73. package/src/eslint/mui/index.mjs +4 -0
  74. package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
  75. package/src/eslint/mui/rules/no-guarded-throw.test.mjs +206 -0
  76. package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
  77. package/src/eslint/mui/rules/no-presentation-role.test.mjs +33 -0
  78. package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
  79. package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
  80. package/src/eslint/testConfig.mjs +2 -1
  81. package/src/estree-typescript.d.ts +1 -1
  82. package/src/remark/config.mjs +157 -0
  83. package/src/remark/createLintTester.mjs +19 -0
  84. package/src/remark/firstBlockHeading.mjs +87 -0
  85. package/src/remark/firstBlockHeading.test.mjs +107 -0
  86. package/src/remark/gitDiff.mjs +43 -0
  87. package/src/remark/gitDiff.test.mjs +45 -0
  88. package/src/remark/noSpaceInLinks.mjs +42 -0
  89. package/src/remark/noSpaceInLinks.test.mjs +22 -0
  90. package/src/remark/straightQuotes.mjs +31 -0
  91. package/src/remark/straightQuotes.test.mjs +25 -0
  92. package/src/remark/tableAlignment.mjs +23 -0
  93. package/src/remark/tableAlignment.test.mjs +28 -0
  94. package/src/remark/terminalLanguage.mjs +19 -0
  95. package/src/remark/terminalLanguage.test.mjs +17 -0
  96. package/src/untyped-plugins.d.ts +11 -11
  97. package/src/utils/build.mjs +18 -1
  98. package/src/utils/build.test.mjs +585 -575
  99. package/src/utils/pnpm.mjs +192 -3
  100. package/src/utils/pnpm.test.mjs +580 -0
  101. package/src/utils/testUtils.mjs +18 -0
  102. package/src/utils/typescript.test.mjs +249 -272
  103. package/vale/.vale.ini +1 -0
  104. package/vale/styles/MUI/CorrectReferenceAllCases.yml +43 -0
  105. package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
  106. package/vale/styles/MUI/GoogleLatin.yml +11 -0
  107. package/vale/styles/MUI/MuiBrandName.yml +22 -0
  108. package/vale/styles/MUI/NoBritish.yml +112 -0
  109. package/vale/styles/MUI/NoCompanyName.yml +17 -0
@@ -0,0 +1,25 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { createLintTester } from './createLintTester.mjs';
3
+ import plugin from './straightQuotes.mjs';
4
+
5
+ const lint = createLintTester(plugin);
6
+
7
+ describe('remark-lint-mui-straight-quotes', () => {
8
+ it('accepts straight quotes', () => {
9
+ expect(lint(`# Title\n\nA paragraph with "straight" and 'simple' quotes.\n`)).toEqual([]);
10
+ });
11
+
12
+ it('flags curly double quotes with correct location', () => {
13
+ const messages = lint(`# Title\n\nA paragraph with “curly” quotes.\n`);
14
+ expect(messages).toHaveLength(2);
15
+ expect(messages[0]).toMatchObject({ line: 3, column: 18 });
16
+ expect(messages[1]).toMatchObject({ line: 3, column: 24 });
17
+ });
18
+
19
+ it('flags curly single quotes', () => {
20
+ const messages = lint(`Use ‘single’ curly quotes too.\n`);
21
+ expect(messages).toHaveLength(2);
22
+ expect(messages[0]).toMatchObject({ line: 1, column: 5 });
23
+ expect(messages[1]).toMatchObject({ line: 1, column: 12 });
24
+ });
25
+ });
@@ -0,0 +1,23 @@
1
+ import { lintRule } from 'unified-lint-rule';
2
+ import { visit } from 'unist-util-visit';
3
+
4
+ const remarkLintMuiTableAlignment = lintRule(
5
+ {
6
+ origin: 'remark-lint:mui-table-alignment',
7
+ url: 'https://github.com/mui/mui-public',
8
+ },
9
+ /** @param {import('mdast').Root} tree */
10
+ (tree, file) => {
11
+ visit(tree, 'table', (node) => {
12
+ const align = node.align ?? [];
13
+ if (align.some((value) => value == null)) {
14
+ file.message(
15
+ 'Table columns should declare an explicit alignment (`:---`, `---:`, or `:---:`).',
16
+ node,
17
+ );
18
+ }
19
+ });
20
+ },
21
+ );
22
+
23
+ export default remarkLintMuiTableAlignment;
@@ -0,0 +1,28 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { createLintTester } from './createLintTester.mjs';
3
+ import plugin from './tableAlignment.mjs';
4
+
5
+ const lint = createLintTester(plugin);
6
+
7
+ describe('remark-lint-mui-table-alignment', () => {
8
+ it('accepts tables with explicit alignment on every column', () => {
9
+ const input = `| A | B |\n| :- | -: |\n| 1 | 2 |\n`;
10
+ expect(lint(input)).toEqual([]);
11
+ });
12
+
13
+ it('flags tables with at least one column missing alignment', () => {
14
+ const input = `| A | B |\n| :- | -- |\n| 1 | 2 |\n`;
15
+ const messages = lint(input);
16
+ expect(messages).toHaveLength(1);
17
+ });
18
+
19
+ it('flags tables with no alignment at all', () => {
20
+ const input = `| A | B |\n| - | - |\n| 1 | 2 |\n`;
21
+ const messages = lint(input);
22
+ expect(messages).toHaveLength(1);
23
+ });
24
+
25
+ it('does not flag non-table content', () => {
26
+ expect(lint(`# Heading\n\nSome paragraph.\n`)).toEqual([]);
27
+ });
28
+ });
@@ -0,0 +1,19 @@
1
+ import { lintRule } from 'unified-lint-rule';
2
+ import { visit } from 'unist-util-visit';
3
+
4
+ const remarkLintMuiTerminalLanguage = lintRule(
5
+ {
6
+ origin: 'remark-lint:mui-terminal-language',
7
+ url: 'https://github.com/mui/mui-public',
8
+ },
9
+ /** @param {import('mdast').Root} tree */
10
+ (tree, file) => {
11
+ visit(tree, 'code', (node) => {
12
+ if (node.lang === 'sh' && node.position) {
13
+ file.message('Use `bash` instead of `sh` as the code block language.', node);
14
+ }
15
+ });
16
+ },
17
+ );
18
+
19
+ export default remarkLintMuiTerminalLanguage;
@@ -0,0 +1,17 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { createLintTester } from './createLintTester.mjs';
3
+ import plugin from './terminalLanguage.mjs';
4
+
5
+ const lint = createLintTester(plugin);
6
+
7
+ describe('remark-lint-mui-terminal-language', () => {
8
+ it('accepts bash and other languages', () => {
9
+ expect(lint(`\`\`\`bash\necho hi\n\`\`\`\n`)).toEqual([]);
10
+ expect(lint(`\`\`\`js\nconst x = 1;\n\`\`\`\n`)).toEqual([]);
11
+ });
12
+
13
+ it('flags `sh` code fences', () => {
14
+ const messages = lint(`\`\`\`sh\necho hi\n\`\`\`\n`);
15
+ expect(messages).toHaveLength(1);
16
+ });
17
+ });
@@ -13,77 +13,77 @@ declare module 'eslint-config-airbnb' {
13
13
  }
14
14
 
15
15
  declare module 'eslint-config-airbnb-base/rules/best-practices' {
16
- import { Linter } from 'eslint';
16
+ import { type Linter } from 'eslint';
17
17
 
18
18
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
19
19
  export default config;
20
20
  }
21
21
 
22
22
  declare module 'eslint-config-airbnb-base/rules/errors' {
23
- import { Linter } from 'eslint';
23
+ import { type Linter } from 'eslint';
24
24
 
25
25
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
26
26
  export default config;
27
27
  }
28
28
 
29
29
  declare module 'eslint-config-airbnb-base/rules/es6' {
30
- import { Linter } from 'eslint';
30
+ import { type Linter } from 'eslint';
31
31
 
32
32
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
33
33
  export default config;
34
34
  }
35
35
 
36
36
  declare module 'eslint-config-airbnb-base/rules/imports' {
37
- import { Linter } from 'eslint';
37
+ import { type Linter } from 'eslint';
38
38
 
39
39
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
40
40
  export default config;
41
41
  }
42
42
 
43
43
  declare module 'eslint-config-airbnb-base/rules/node' {
44
- import { Linter } from 'eslint';
44
+ import { type Linter } from 'eslint';
45
45
 
46
46
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
47
47
  export default config;
48
48
  }
49
49
 
50
50
  declare module 'eslint-config-airbnb-base/rules/strict' {
51
- import { Linter } from 'eslint';
51
+ import { type Linter } from 'eslint';
52
52
 
53
53
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
54
54
  export default config;
55
55
  }
56
56
 
57
57
  declare module 'eslint-config-airbnb-base/rules/style' {
58
- import { Linter } from 'eslint';
58
+ import { type Linter } from 'eslint';
59
59
 
60
60
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
61
61
  export default config;
62
62
  }
63
63
 
64
64
  declare module 'eslint-config-airbnb-base/rules/variables' {
65
- import { Linter } from 'eslint';
65
+ import { type Linter } from 'eslint';
66
66
 
67
67
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
68
68
  export default config;
69
69
  }
70
70
 
71
71
  declare module 'eslint-config-airbnb/rules/react' {
72
- import { Linter } from 'eslint';
72
+ import { type Linter } from 'eslint';
73
73
 
74
74
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
75
75
  export default config;
76
76
  }
77
77
 
78
78
  declare module 'eslint-config-airbnb/rules/react-a11y' {
79
- import { Linter } from 'eslint';
79
+ import { type Linter } from 'eslint';
80
80
 
81
81
  declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
82
82
  export default config;
83
83
  }
84
84
 
85
85
  declare module '@next/eslint-plugin-next' {
86
- import { Linter } from 'eslint';
86
+ import { type Linter } from 'eslint';
87
87
 
88
88
  interface NextEslintPluginConfig extends Linter.LegacyConfig {
89
89
  flatConfig: {
@@ -34,6 +34,20 @@ export function getOutExtension(bundle, options = {}) {
34
34
  return bundle === 'cjs' ? '.js' : '.mjs';
35
35
  }
36
36
 
37
+ /**
38
+ * Returns a new object with `import` first, `require` second, `default` last,
39
+ * and any other condition keys preserved in their original relative order in between.
40
+ * @param {Record<string, any>} conditions
41
+ * @returns {Record<string, any>}
42
+ */
43
+ function sortExportConditions(conditions) {
44
+ /** @type {Record<string, number | undefined>} */
45
+ const order = { import: 0, require: 1, default: 3 };
46
+ return Object.fromEntries(
47
+ Object.entries(conditions).sort(([a], [b]) => (order[a] ?? 2) - (order[b] ?? 2)),
48
+ );
49
+ }
50
+
37
51
  /**
38
52
  * @param {Object} param0
39
53
  * @param {NonNullable<import('../cli/packageJson').PackageJson.Exports>} param0.importPath
@@ -367,7 +381,8 @@ export async function createPackageExports({
367
381
  }
368
382
  });
369
383
 
370
- // Transform import/require to default/require pattern
384
+ // Rebuild condition objects with stable key order; bundles run in parallel so
385
+ // import/require insertion order would otherwise depend on Promise timing.
371
386
  Object.keys(newExports).forEach((key) => {
372
387
  const exportVal = newExports[key];
373
388
  if (Array.isArray(exportVal)) {
@@ -387,6 +402,8 @@ export async function createPackageExports({
387
402
  ? defaultExport.default
388
403
  : defaultExport;
389
404
  }
405
+
406
+ newExports[key] = sortExportConditions(exportVal);
390
407
  }
391
408
  });
392
409