@mui/internal-code-infra 0.0.4-canary.7 → 0.0.4-canary.71
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/LICENSE +1 -1
- package/README.md +19 -8
- package/build/babel-config.d.mts +11 -3
- package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
- package/build/brokenLinksChecker/index.d.mts +45 -2
- package/build/changelog/types.d.ts +1 -1
- package/build/cli/cmdArgosPush.d.mts +2 -2
- package/build/cli/cmdBuild.d.mts +3 -2
- package/build/cli/cmdCopyFiles.d.mts +2 -2
- package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
- package/build/cli/cmdGenerateChangelog.d.mts +2 -2
- package/build/cli/cmdGithubAuth.d.mts +2 -2
- package/build/cli/cmdListWorkspaces.d.mts +6 -4
- package/build/cli/cmdNetlifyIgnore.d.mts +3 -2
- package/build/cli/cmdPublish.d.mts +4 -2
- package/build/cli/cmdPublishCanary.d.mts +3 -3
- package/build/cli/cmdPublishNewPackage.d.mts +4 -2
- package/build/cli/cmdSetVersionOverrides.d.mts +2 -2
- package/build/cli/cmdVale.d.mts +46 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
- package/build/eslint/baseConfig.d.mts +3 -1
- package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
- package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
- package/build/eslint/mui/rules/no-floating-cleanup.d.mts +5 -0
- package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
- package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
- package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +2 -2
- package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
- package/build/remark/config.d.mts +43 -0
- package/build/remark/createLintTester.d.mts +10 -0
- package/build/remark/firstBlockHeading.d.mts +4 -0
- package/build/remark/gitDiff.d.mts +2 -0
- package/build/remark/noSpaceInLinks.d.mts +2 -0
- package/build/remark/straightQuotes.d.mts +2 -0
- package/build/remark/tableAlignment.d.mts +2 -0
- package/build/remark/terminalLanguage.d.mts +2 -0
- package/build/utils/babel.d.mts +1 -1
- package/build/utils/build.d.mts +56 -37
- package/build/utils/github.d.mts +1 -1
- package/build/utils/pnpm.d.mts +81 -2
- package/build/utils/testUtils.d.mts +7 -0
- package/build/utils/typescript.d.mts +6 -16
- package/package.json +60 -38
- package/src/babel-config.mjs +9 -3
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +1 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +15 -0
- package/src/brokenLinksChecker/crawlWorker.mjs +217 -0
- package/src/brokenLinksChecker/index.mjs +263 -188
- package/src/brokenLinksChecker/index.test.ts +53 -13
- package/src/changelog/categorizeCommits.test.ts +5 -5
- package/src/changelog/fetchChangelogs.mjs +6 -2
- package/src/changelog/parseCommitLabels.test.ts +5 -5
- package/src/changelog/renderChangelog.mjs +1 -1
- package/src/changelog/types.ts +1 -1
- package/src/cli/cmdBuild.mjs +51 -85
- package/src/cli/cmdListWorkspaces.mjs +12 -27
- package/src/cli/cmdNetlifyIgnore.mjs +34 -93
- package/src/cli/cmdPublish.mjs +55 -15
- package/src/cli/cmdPublishCanary.mjs +128 -132
- package/src/cli/cmdPublishNewPackage.mjs +27 -6
- package/src/cli/cmdSetVersionOverrides.mjs +8 -9
- package/src/cli/cmdVale.mjs +513 -0
- package/src/cli/cmdVale.test.mjs +644 -0
- package/src/cli/index.mjs +2 -0
- package/src/cli/packageJson.d.ts +1 -1
- package/src/eslint/baseConfig.mjs +51 -19
- package/src/eslint/docsConfig.mjs +2 -1
- package/src/eslint/mui/config.mjs +24 -4
- package/src/eslint/mui/index.mjs +6 -0
- package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
- package/src/eslint/mui/rules/no-floating-cleanup.test.mjs +141 -0
- package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
- package/src/eslint/mui/rules/no-guarded-throw.test.mjs +206 -0
- package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
- package/src/eslint/mui/rules/no-presentation-role.test.mjs +33 -0
- package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
- package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
- package/src/estree-typescript.d.ts +1 -1
- package/src/remark/config.mjs +157 -0
- package/src/remark/createLintTester.mjs +19 -0
- package/src/remark/firstBlockHeading.mjs +87 -0
- package/src/remark/firstBlockHeading.test.mjs +107 -0
- package/src/remark/gitDiff.mjs +43 -0
- package/src/remark/gitDiff.test.mjs +45 -0
- package/src/remark/noSpaceInLinks.mjs +42 -0
- package/src/remark/noSpaceInLinks.test.mjs +22 -0
- package/src/remark/straightQuotes.mjs +31 -0
- package/src/remark/straightQuotes.test.mjs +25 -0
- package/src/remark/tableAlignment.mjs +23 -0
- package/src/remark/tableAlignment.test.mjs +28 -0
- package/src/remark/terminalLanguage.mjs +19 -0
- package/src/remark/terminalLanguage.test.mjs +17 -0
- package/src/untyped-plugins.d.ts +11 -11
- package/src/utils/build.mjs +604 -270
- package/src/utils/build.test.mjs +1079 -521
- package/src/utils/git.mjs +16 -7
- package/src/utils/pnpm.mjs +255 -3
- package/src/utils/pnpm.test.mjs +731 -0
- package/src/utils/testUtils.mjs +18 -0
- package/src/utils/typescript.mjs +23 -42
- package/src/utils/typescript.test.mjs +234 -273
- package/vale/.vale.ini +1 -0
- package/vale/styles/MUI/CorrectReferenceAllCases.yml +43 -0
- package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
- package/vale/styles/MUI/GoogleLatin.yml +11 -0
- package/vale/styles/MUI/MuiBrandName.yml +22 -0
- package/vale/styles/MUI/NoBritish.yml +112 -0
- package/vale/styles/MUI/NoCompanyName.yml +17 -0
- package/build/markdownlint/duplicate-h1.d.mts +0 -56
- package/build/markdownlint/git-diff.d.mts +0 -11
- package/build/markdownlint/index.d.mts +0 -52
- package/build/markdownlint/straight-quotes.d.mts +0 -11
- package/build/markdownlint/table-alignment.d.mts +0 -11
- package/build/markdownlint/terminal-language.d.mts +0 -11
- package/src/markdownlint/duplicate-h1.mjs +0 -69
- package/src/markdownlint/git-diff.mjs +0 -31
- package/src/markdownlint/index.mjs +0 -62
- package/src/markdownlint/straight-quotes.mjs +0 -26
- package/src/markdownlint/table-alignment.mjs +0 -42
- package/src/markdownlint/terminal-language.mjs +0 -19
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as os from 'node:os';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { onTestFinished } from 'vitest';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a temporary directory and registers an `onTestFinished` hook to
|
|
8
|
+
* remove it automatically when the current test ends — even if the test throws.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<string>} The path of the created temporary directory.
|
|
11
|
+
*/
|
|
12
|
+
export async function makeTempDir() {
|
|
13
|
+
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'code-infra-test-'));
|
|
14
|
+
onTestFinished(async () => {
|
|
15
|
+
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
16
|
+
});
|
|
17
|
+
return tmpDir;
|
|
18
|
+
}
|
package/src/utils/typescript.mjs
CHANGED
|
@@ -111,30 +111,21 @@ export async function copyDeclarations(sourceDirectory, destinationDirectory, op
|
|
|
111
111
|
* @param {Object} param0
|
|
112
112
|
* @param {string} param0.inputDir
|
|
113
113
|
* @param {string} param0.buildDir
|
|
114
|
-
* @param {
|
|
115
|
-
* @param {boolean} [param0.isFlat]
|
|
114
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles
|
|
116
115
|
* @param {'module' | 'commonjs'} [param0.packageType]
|
|
117
116
|
* @returns
|
|
118
117
|
*/
|
|
119
|
-
export async function moveAndTransformDeclarations({
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
isFlat,
|
|
124
|
-
packageType,
|
|
125
|
-
}) {
|
|
126
|
-
// Directly copy to the bundle directory if there's only one bundle, mainly for esm, since
|
|
127
|
-
// the js files are inside 'esm' folder. resolve-imports plugin needs d.ts to be alongside js files to
|
|
128
|
-
// resolve paths correctly.
|
|
129
|
-
const toCopyDir = bundles.length === 1 ? path.join(buildDir, bundles[0].dir) : buildDir;
|
|
130
|
-
await fs.cp(inputDir, toCopyDir, {
|
|
118
|
+
export async function moveAndTransformDeclarations({ inputDir, buildDir, bundles, packageType }) {
|
|
119
|
+
// d.ts files sit alongside the js files in the build root so the resolve-imports
|
|
120
|
+
// plugin can resolve paths correctly.
|
|
121
|
+
await fs.cp(inputDir, buildDir, {
|
|
131
122
|
recursive: true,
|
|
132
123
|
force: false,
|
|
133
124
|
});
|
|
134
125
|
|
|
135
|
-
const dtsFiles = await globby('**/*.d.ts', { absolute: true, cwd:
|
|
126
|
+
const dtsFiles = await globby('**/*.d.ts', { absolute: true, cwd: buildDir });
|
|
136
127
|
if (dtsFiles.length === 0) {
|
|
137
|
-
console.log(`No d.ts files found in ${
|
|
128
|
+
console.log(`No d.ts files found in ${buildDir}. Skipping transformation.`);
|
|
138
129
|
return;
|
|
139
130
|
}
|
|
140
131
|
|
|
@@ -144,37 +135,30 @@ export async function moveAndTransformDeclarations({
|
|
|
144
135
|
// Normalize to native separators to make path comparisons reliable on Windows
|
|
145
136
|
const nativeDtsFile = path.normalize(dtsFile);
|
|
146
137
|
const content = await fs.readFile(nativeDtsFile, 'utf8');
|
|
147
|
-
const relativePath = path.relative(
|
|
138
|
+
const relativePath = path.relative(buildDir, nativeDtsFile);
|
|
148
139
|
|
|
149
|
-
const writesToOriginalPath =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
isFlat,
|
|
154
|
-
isType: true,
|
|
155
|
-
packageType,
|
|
156
|
-
});
|
|
157
|
-
const outFileRelative = relativePath.replace(/\.d\.ts$/, newFileExtension);
|
|
158
|
-
const outFilePath = path.join(buildDir, bundle.dir, outFileRelative);
|
|
159
|
-
// Ensure both paths are normalized before comparison (fixes Windows posix vs win32 separators)
|
|
160
|
-
return path.resolve(outFilePath) === path.resolve(nativeDtsFile);
|
|
140
|
+
const writesToOriginalPath = bundles.some((bundle) => {
|
|
141
|
+
const newFileExtension = getOutExtension(bundle, {
|
|
142
|
+
isType: true,
|
|
143
|
+
packageType,
|
|
161
144
|
});
|
|
145
|
+
const outFileRelative = relativePath.replace(/\.d\.ts$/, newFileExtension);
|
|
146
|
+
const outFilePath = path.join(buildDir, outFileRelative);
|
|
147
|
+
// Ensure both paths are normalized before comparison (fixes Windows posix vs win32 separators)
|
|
148
|
+
return path.resolve(outFilePath) === path.resolve(nativeDtsFile);
|
|
149
|
+
});
|
|
162
150
|
|
|
163
151
|
await Promise.all(
|
|
164
152
|
bundles.map(async (bundle) => {
|
|
165
|
-
const importExtension = getOutExtension(bundle
|
|
166
|
-
isFlat,
|
|
153
|
+
const importExtension = getOutExtension(bundle, {
|
|
167
154
|
packageType,
|
|
168
155
|
});
|
|
169
|
-
const newFileExtension = getOutExtension(bundle
|
|
170
|
-
isFlat,
|
|
156
|
+
const newFileExtension = getOutExtension(bundle, {
|
|
171
157
|
isType: true,
|
|
172
158
|
packageType,
|
|
173
159
|
});
|
|
174
|
-
const outFileRelative =
|
|
175
|
-
|
|
176
|
-
: relativePath;
|
|
177
|
-
const outFilePath = path.join(buildDir, bundle.dir, outFileRelative);
|
|
160
|
+
const outFileRelative = relativePath.replace(/\.d\.ts$/, newFileExtension);
|
|
161
|
+
const outFilePath = path.join(buildDir, outFileRelative);
|
|
178
162
|
|
|
179
163
|
const babelPlugins = [
|
|
180
164
|
[pluginTypescriptSyntax, { dts: true }],
|
|
@@ -194,7 +178,7 @@ export async function moveAndTransformDeclarations({
|
|
|
194
178
|
}
|
|
195
179
|
}),
|
|
196
180
|
);
|
|
197
|
-
if (
|
|
181
|
+
if (!writesToOriginalPath) {
|
|
198
182
|
await fs.unlink(nativeDtsFile);
|
|
199
183
|
}
|
|
200
184
|
},
|
|
@@ -208,9 +192,8 @@ export async function moveAndTransformDeclarations({
|
|
|
208
192
|
* After copying, babel transformations are applied to the copied files because they need to be alongside the actual js files for proper resolution.
|
|
209
193
|
*
|
|
210
194
|
* @param {Object} param0
|
|
211
|
-
* @param {boolean} [param0.isFlat = false] - Whether to place generated declaration files in a flattened directory.
|
|
212
195
|
* @param {boolean} [param0.verbose = false] - Whether to log additional information while generating and moving declaration files.
|
|
213
|
-
* @param {
|
|
196
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles - The bundles to create declarations for.
|
|
214
197
|
* @param {string} param0.srcDir - The source directory.
|
|
215
198
|
* @param {string} param0.buildDir - The build directory.
|
|
216
199
|
* @param {string} param0.cwd - The current working directory.
|
|
@@ -225,7 +208,6 @@ export async function createTypes({
|
|
|
225
208
|
cwd,
|
|
226
209
|
skipTsc,
|
|
227
210
|
useTsgo = false,
|
|
228
|
-
isFlat = false,
|
|
229
211
|
packageType,
|
|
230
212
|
verbose,
|
|
231
213
|
}) {
|
|
@@ -253,7 +235,6 @@ export async function createTypes({
|
|
|
253
235
|
inputDir: tmpDir,
|
|
254
236
|
buildDir,
|
|
255
237
|
bundles,
|
|
256
|
-
isFlat,
|
|
257
238
|
packageType,
|
|
258
239
|
});
|
|
259
240
|
} finally {
|