@mui/internal-code-infra 0.1.1-canary.24 → 0.1.1-canary.26
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/build/cli/cmdBuild.d.mts
CHANGED
|
@@ -35,6 +35,10 @@ export type Args = {
|
|
|
35
35
|
* - Whether to skip checking for main field in package.json.
|
|
36
36
|
*/
|
|
37
37
|
skipMainCheck: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* - Whether to skip validating the output directory with publint.
|
|
40
|
+
*/
|
|
41
|
+
skipPublint: boolean;
|
|
38
42
|
/**
|
|
39
43
|
* - Globs to be ignored by Babel.
|
|
40
44
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.1.1-canary.
|
|
3
|
+
"version": "0.1.1-canary.26",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"node-html-parser": "^9.0.5",
|
|
117
117
|
"open": "^11.0.4",
|
|
118
118
|
"postcss-styled-syntax": "^0.7.4",
|
|
119
|
+
"publint": "^0.3.25",
|
|
119
120
|
"regexp.escape": "^2.0.1",
|
|
120
121
|
"rehype-slug": "^6.0.0",
|
|
121
122
|
"rehype-stringify": "^10.0.1",
|
|
@@ -191,7 +192,7 @@
|
|
|
191
192
|
"publishConfig": {
|
|
192
193
|
"access": "public"
|
|
193
194
|
},
|
|
194
|
-
"gitSha": "
|
|
195
|
+
"gitSha": "cb47b4587dd0f55f095a4fe67c059dd8baf2acba",
|
|
195
196
|
"scripts": {
|
|
196
197
|
"build": "tsc -p tsconfig.build.json",
|
|
197
198
|
"typescript": "tsc -noEmit",
|
package/src/cli/cmdBuild.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import { readPnpmConfig } from '../utils/pnpm.mjs';
|
|
|
28
28
|
* @property {boolean} skipBabelRuntimeCheck - Whether to skip checking for Babel runtime dependencies in the package.
|
|
29
29
|
* @property {boolean} skipPackageJson - Whether to skip generating the package.json file in the bundle output.
|
|
30
30
|
* @property {boolean} skipMainCheck - Whether to skip checking for main field in package.json.
|
|
31
|
+
* @property {boolean} skipPublint - Whether to skip validating the output directory with publint.
|
|
31
32
|
* @property {string[]} ignore - Globs to be ignored by Babel.
|
|
32
33
|
* @property {string[]} [copy] - Files/Directories to be copied. Can be a glob pattern.
|
|
33
34
|
* @property {boolean} [enableReactCompiler] - Whether to use the React compiler.
|
|
@@ -216,6 +217,11 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
216
217
|
default: false,
|
|
217
218
|
description: 'Skip checking for main field in package.json.',
|
|
218
219
|
})
|
|
220
|
+
.option('skipPublint', {
|
|
221
|
+
type: 'boolean',
|
|
222
|
+
default: false,
|
|
223
|
+
description: 'Skip validating the output directory with publint.',
|
|
224
|
+
})
|
|
219
225
|
.option('copy', {
|
|
220
226
|
type: 'string',
|
|
221
227
|
array: true,
|
|
@@ -392,9 +398,48 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
392
398
|
buildDir,
|
|
393
399
|
verbose: args.verbose,
|
|
394
400
|
});
|
|
401
|
+
|
|
402
|
+
if (!args.skipPublint) {
|
|
403
|
+
await validateWithPublint(buildDir);
|
|
404
|
+
}
|
|
395
405
|
},
|
|
396
406
|
});
|
|
397
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Lints the output directory with publint. Errors fail the build, warnings are only reported.
|
|
410
|
+
* @param {string} buildDir - The build directory to validate.
|
|
411
|
+
* @returns {Promise<void>}
|
|
412
|
+
*/
|
|
413
|
+
async function validateWithPublint(buildDir) {
|
|
414
|
+
const [{ publint }, { formatMessage }] = await Promise.all([
|
|
415
|
+
import('publint'),
|
|
416
|
+
import('publint/utils'),
|
|
417
|
+
]);
|
|
418
|
+
// Everything in the output directory is published, so there is nothing to pack.
|
|
419
|
+
const result = await publint({ pkgDir: buildDir, pack: false, level: 'warning' });
|
|
420
|
+
const { pkg } = result;
|
|
421
|
+
// TODO: remove this filter and bump publint to >=0.3.25, which ships the fix from
|
|
422
|
+
// https://github.com/publint/publint/pull/265 (publint checks `browser` values
|
|
423
|
+
// that point at another package as local files).
|
|
424
|
+
const messages = result.messages.filter((message) => {
|
|
425
|
+
if (message.code !== 'FILE_DOES_NOT_EXIST' || message.path[0] !== 'browser') {
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
const value = message.path.length === 2 ? pkg.browser?.[message.path[1]] : undefined;
|
|
429
|
+
return typeof value !== 'string' || value.startsWith('.');
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
for (const message of messages) {
|
|
433
|
+
const log = message.type === 'error' ? console.error : console.warn;
|
|
434
|
+
log(`publint ${message.type}: ${formatMessage(message, pkg)}`);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const errorCount = messages.filter((message) => message.type === 'error').length;
|
|
438
|
+
if (errorCount > 0) {
|
|
439
|
+
throw new Error(`publint found ${errorCount} error(s) in "${buildDir}".`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
398
443
|
/**
|
|
399
444
|
* @param {Object} param0
|
|
400
445
|
* @param {string} param0.cwd - The current working directory.
|
|
@@ -91,6 +91,9 @@ export function createTestConfig() {
|
|
|
91
91
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
|
92
92
|
// end migration
|
|
93
93
|
'vitest/prefer-importing-vitest-globals': 'error',
|
|
94
|
+
// Vitest accepts a failure message as the second argument of `expect`, also when it is
|
|
95
|
+
// not a literal.
|
|
96
|
+
'vitest/valid-expect': ['error', { maxArgs: 2 }],
|
|
94
97
|
},
|
|
95
98
|
},
|
|
96
99
|
);
|