@mui/internal-code-infra 0.0.4-canary.11 → 0.0.4-canary.111
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 +25 -7
- package/build/babel-config.d.mts +5 -1
- package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
- package/build/brokenLinksChecker/index.d.mts +192 -2
- package/build/changelog/fetchChangelogs.d.mts +3 -0
- package/build/changelog/types.d.ts +3 -1
- package/build/cli/cmdArgosPush.d.mts +8 -2
- package/build/cli/cmdBuild.d.mts +48 -2
- package/build/cli/cmdCopyFiles.d.mts +14 -2
- package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
- package/build/cli/cmdGenerateChangelog.d.mts +17 -2
- package/build/cli/cmdGithubAuth.d.mts +2 -2
- package/build/cli/cmdListWorkspaces.d.mts +14 -2
- package/build/cli/cmdNetlifyIgnore.d.mts +12 -2
- package/build/cli/cmdPublish.d.mts +23 -4
- package/build/cli/cmdPublishCanary.d.mts +20 -2
- package/build/cli/cmdPublishNewPackage.d.mts +10 -2
- package/build/cli/cmdRenameScope.d.mts +18 -0
- package/build/cli/cmdSetVersionOverrides.d.mts +5 -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 +8 -2
- package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
- package/build/eslint/testConfig.d.mts +1 -7
- 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 +7 -1
- package/build/utils/build.d.mts +59 -37
- package/build/utils/extractErrorCodes.d.mts +9 -0
- package/build/utils/git.d.mts +16 -0
- package/build/utils/github.d.mts +13 -1
- package/build/utils/pnpm.d.mts +226 -20
- package/build/utils/testUtils.d.mts +28 -0
- package/build/utils/typescript.d.mts +8 -18
- package/package.json +86 -63
- package/src/babel-config.mjs +3 -1
- package/src/brokenLinksChecker/crawlWorker.mjs +240 -0
- package/src/brokenLinksChecker/index.mjs +265 -190
- package/src/changelog/fetchChangelogs.mjs +8 -2
- package/src/changelog/renderChangelog.mjs +1 -1
- package/src/changelog/types.ts +3 -1
- package/src/cli/cmdBuild.mjs +56 -91
- package/src/cli/cmdListWorkspaces.mjs +7 -1
- package/src/cli/cmdNetlifyIgnore.mjs +30 -5
- package/src/cli/cmdPublish.mjs +101 -53
- package/src/cli/cmdPublishCanary.mjs +96 -24
- package/src/cli/cmdPublishNewPackage.mjs +31 -8
- package/src/cli/cmdRenameScope.mjs +76 -0
- package/src/cli/cmdSetVersionOverrides.mjs +40 -34
- package/src/cli/cmdVale.mjs +513 -0
- package/src/cli/index.mjs +4 -0
- package/src/cli/packageJson.d.ts +2 -3
- 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-guarded-throw.mjs +115 -0
- package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
- package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
- package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
- package/src/eslint/testConfig.mjs +3 -31
- 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/gitDiff.mjs +43 -0
- package/src/remark/noSpaceInLinks.mjs +42 -0
- package/src/remark/straightQuotes.mjs +31 -0
- package/src/remark/tableAlignment.mjs +23 -0
- package/src/remark/terminalLanguage.mjs +19 -0
- package/src/stylelint/index.mjs +2 -2
- package/src/untyped-plugins.d.ts +14 -14
- package/src/utils/build.mjs +604 -270
- package/src/utils/git.mjs +27 -7
- package/src/utils/pnpm.mjs +636 -60
- package/src/utils/testUtils.mjs +53 -0
- package/src/utils/typescript.mjs +78 -81
- package/vale/.vale.ini +1 -0
- package/vale/styles/MUI/CorrectReferenceAllCases.yml +42 -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/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
- package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
- package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -28
- package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
- package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
- package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
- package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
- package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
- package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
- package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
- package/src/brokenLinksChecker/index.test.ts +0 -261
- package/src/changelog/categorizeCommits.test.ts +0 -319
- package/src/changelog/filterCommits.test.ts +0 -363
- package/src/changelog/parseCommitLabels.test.ts +0 -509
- package/src/changelog/renderChangelog.test.ts +0 -378
- package/src/changelog/sortSections.test.ts +0 -199
- package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
- package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
- package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
- package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
- package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
- package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
- package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
- package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
- package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
- package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
- package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
- package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
- 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
- package/src/utils/build.test.mjs +0 -705
- package/src/utils/template.test.mjs +0 -133
- package/src/utils/typescript.test.mjs +0 -380
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import { writePackageJson } from './pnpm.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a temporary directory and registers an `onTestFinished` hook to
|
|
10
|
+
* remove it automatically when the current test ends — even if the test throws.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<string>} The path of the created temporary directory.
|
|
13
|
+
*/
|
|
14
|
+
export async function makeTempDir() {
|
|
15
|
+
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'code-infra-test-'));
|
|
16
|
+
onTestFinished(async () => {
|
|
17
|
+
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
return tmpDir;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Write a package.json into a subdirectory of a temp workspace.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} root - Workspace root
|
|
26
|
+
* @param {string} dir - Subdirectory to create
|
|
27
|
+
* @param {object} pkgJson - Manifest contents
|
|
28
|
+
* @returns {Promise<string>} The package directory
|
|
29
|
+
*/
|
|
30
|
+
export async function writePackage(root, dir, pkgJson) {
|
|
31
|
+
const pkgDir = path.join(root, dir);
|
|
32
|
+
await fs.mkdir(pkgDir, { recursive: true });
|
|
33
|
+
await writePackageJson(pkgDir, pkgJson);
|
|
34
|
+
return pkgDir;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} name
|
|
39
|
+
* @param {string} pkgPath
|
|
40
|
+
* @returns {import('./pnpm.mjs').PublicPackage}
|
|
41
|
+
*/
|
|
42
|
+
export function publicPkg(name, pkgPath) {
|
|
43
|
+
return { name, version: '1.0.0', path: pkgPath, isPrivate: false };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} name
|
|
48
|
+
* @param {string} pkgPath
|
|
49
|
+
* @returns {import('./pnpm.mjs').PrivatePackage}
|
|
50
|
+
*/
|
|
51
|
+
export function privatePkg(name, pkgPath) {
|
|
52
|
+
return { name, version: '1.0.0', path: pkgPath, isPrivate: true };
|
|
53
|
+
}
|
package/src/utils/typescript.mjs
CHANGED
|
@@ -14,21 +14,43 @@ import { getOutExtension, mapConcurrently } from '../utils/build.mjs';
|
|
|
14
14
|
const $$ = $({ stdio: 'inherit' });
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {string}
|
|
19
|
-
* @
|
|
17
|
+
* Finds a CLI shim in a directory's node_modules/.bin.
|
|
18
|
+
* @param {string} dir
|
|
19
|
+
* @param {string} name
|
|
20
|
+
* @returns {Promise<string | null>}
|
|
20
21
|
*/
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const tsgoPath = path.join(workspaceDir, 'node_modules', '.bin', 'tsgo');
|
|
27
|
-
const exists = await fs.stat(tsgoPath).then(
|
|
22
|
+
async function findBin(dir, name) {
|
|
23
|
+
const binPath = path.join(dir, 'node_modules', '.bin', name);
|
|
24
|
+
const exists = await fs.stat(binPath).then(
|
|
28
25
|
(stat) => stat.isFile(),
|
|
29
26
|
() => false,
|
|
30
27
|
);
|
|
31
|
-
return exists ?
|
|
28
|
+
return exists ? binPath : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Resolves the native/JS TypeScript CLI pair from the workspace root's
|
|
33
|
+
* `node_modules/.bin`: tsgo/tsc when the legacy `tsgo` shim exists, tsc/tsc6
|
|
34
|
+
* otherwise, with bare `tsc` from PATH as the JS fallback.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} cwd
|
|
37
|
+
* @returns {Promise<{ native: string | null, js: string }>}
|
|
38
|
+
*/
|
|
39
|
+
async function findTscPair(cwd) {
|
|
40
|
+
const workspaceDir = await findWorkspaceDir(cwd);
|
|
41
|
+
if (!workspaceDir) {
|
|
42
|
+
return { native: null, js: 'tsc' };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const [tsgo, tsc, tsc6] = await Promise.all([
|
|
46
|
+
findBin(workspaceDir, 'tsgo'),
|
|
47
|
+
findBin(workspaceDir, 'tsc'),
|
|
48
|
+
findBin(workspaceDir, 'tsc6'),
|
|
49
|
+
]);
|
|
50
|
+
if (tsgo) {
|
|
51
|
+
return { native: tsgo, js: 'tsc' };
|
|
52
|
+
}
|
|
53
|
+
return { native: tsc, js: tsc6 ?? 'tsc' };
|
|
32
54
|
}
|
|
33
55
|
|
|
34
56
|
/**
|
|
@@ -36,44 +58,38 @@ async function findTsgo(cwd) {
|
|
|
36
58
|
* @param {string} tsconfig - The path to the tsconfig.json file.
|
|
37
59
|
* @param {string} outDir - The output directory for the declaration files.
|
|
38
60
|
* @param {Object} options
|
|
39
|
-
* @param {boolean} [options.useTsgo] - Whether to use
|
|
61
|
+
* @param {boolean} [options.useTsgo] - Whether to use the native TypeScript compiler.
|
|
40
62
|
*/
|
|
41
63
|
export async function emitDeclarations(tsconfig, outDir, options) {
|
|
42
64
|
const { useTsgo = false } = options ?? {};
|
|
43
65
|
const tsconfigDir = path.dirname(tsconfig);
|
|
44
66
|
const rootDir = path.resolve(tsconfigDir, './src');
|
|
45
67
|
|
|
46
|
-
const
|
|
68
|
+
const pair = await findTscPair(tsconfigDir);
|
|
69
|
+
const tsgoPath = useTsgo ? pair.native : null;
|
|
47
70
|
if (useTsgo && !tsgoPath) {
|
|
48
71
|
throw new Error(
|
|
49
|
-
'--tsgo flag was passed
|
|
72
|
+
'--tsgo flag was passed but no native TypeScript cli was found. Either remove the flag to use the JS compiler or install TypeScript 7 at the workspace root, as "typescript@^7" or under an alias such as "@typescript/native".',
|
|
50
73
|
);
|
|
51
74
|
}
|
|
52
75
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
--declaration
|
|
71
|
-
--emitDeclarationOnly
|
|
72
|
-
--noEmit false
|
|
73
|
-
--composite false
|
|
74
|
-
--incremental false
|
|
75
|
-
--declarationMap false`;
|
|
76
|
-
}
|
|
76
|
+
const tscPath = tsgoPath ?? pair.js;
|
|
77
|
+
console.log(
|
|
78
|
+
tsgoPath
|
|
79
|
+
? `Using ts-native for declaration emit: ${tscPath}`
|
|
80
|
+
: `Using ${tscPath} for declaration emit`,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
await $$`${tscPath}
|
|
84
|
+
-p ${tsconfig}
|
|
85
|
+
--rootDir ${rootDir}
|
|
86
|
+
--outDir ${outDir}
|
|
87
|
+
--declaration
|
|
88
|
+
--emitDeclarationOnly
|
|
89
|
+
--noEmit false
|
|
90
|
+
--composite false
|
|
91
|
+
--incremental false
|
|
92
|
+
--declarationMap false`;
|
|
77
93
|
}
|
|
78
94
|
|
|
79
95
|
/**
|
|
@@ -111,30 +127,21 @@ export async function copyDeclarations(sourceDirectory, destinationDirectory, op
|
|
|
111
127
|
* @param {Object} param0
|
|
112
128
|
* @param {string} param0.inputDir
|
|
113
129
|
* @param {string} param0.buildDir
|
|
114
|
-
* @param {
|
|
115
|
-
* @param {boolean} [param0.isFlat]
|
|
130
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles
|
|
116
131
|
* @param {'module' | 'commonjs'} [param0.packageType]
|
|
117
132
|
* @returns
|
|
118
133
|
*/
|
|
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, {
|
|
134
|
+
export async function moveAndTransformDeclarations({ inputDir, buildDir, bundles, packageType }) {
|
|
135
|
+
// d.ts files sit alongside the js files in the build root so the resolve-imports
|
|
136
|
+
// plugin can resolve paths correctly.
|
|
137
|
+
await fs.cp(inputDir, buildDir, {
|
|
131
138
|
recursive: true,
|
|
132
139
|
force: false,
|
|
133
140
|
});
|
|
134
141
|
|
|
135
|
-
const dtsFiles = await globby('**/*.d.ts', { absolute: true, cwd:
|
|
142
|
+
const dtsFiles = await globby('**/*.d.ts', { absolute: true, cwd: buildDir });
|
|
136
143
|
if (dtsFiles.length === 0) {
|
|
137
|
-
console.log(`No d.ts files found in ${
|
|
144
|
+
console.log(`No d.ts files found in ${buildDir}. Skipping transformation.`);
|
|
138
145
|
return;
|
|
139
146
|
}
|
|
140
147
|
|
|
@@ -144,37 +151,30 @@ export async function moveAndTransformDeclarations({
|
|
|
144
151
|
// Normalize to native separators to make path comparisons reliable on Windows
|
|
145
152
|
const nativeDtsFile = path.normalize(dtsFile);
|
|
146
153
|
const content = await fs.readFile(nativeDtsFile, 'utf8');
|
|
147
|
-
const relativePath = path.relative(
|
|
154
|
+
const relativePath = path.relative(buildDir, nativeDtsFile);
|
|
148
155
|
|
|
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);
|
|
156
|
+
const writesToOriginalPath = bundles.some((bundle) => {
|
|
157
|
+
const newFileExtension = getOutExtension(bundle, {
|
|
158
|
+
isType: true,
|
|
159
|
+
packageType,
|
|
161
160
|
});
|
|
161
|
+
const outFileRelative = relativePath.replace(/\.d\.ts$/, newFileExtension);
|
|
162
|
+
const outFilePath = path.join(buildDir, outFileRelative);
|
|
163
|
+
// Ensure both paths are normalized before comparison (fixes Windows posix vs win32 separators)
|
|
164
|
+
return path.resolve(outFilePath) === path.resolve(nativeDtsFile);
|
|
165
|
+
});
|
|
162
166
|
|
|
163
167
|
await Promise.all(
|
|
164
168
|
bundles.map(async (bundle) => {
|
|
165
|
-
const importExtension = getOutExtension(bundle
|
|
166
|
-
isFlat,
|
|
169
|
+
const importExtension = getOutExtension(bundle, {
|
|
167
170
|
packageType,
|
|
168
171
|
});
|
|
169
|
-
const newFileExtension = getOutExtension(bundle
|
|
170
|
-
isFlat,
|
|
172
|
+
const newFileExtension = getOutExtension(bundle, {
|
|
171
173
|
isType: true,
|
|
172
174
|
packageType,
|
|
173
175
|
});
|
|
174
|
-
const outFileRelative =
|
|
175
|
-
|
|
176
|
-
: relativePath;
|
|
177
|
-
const outFilePath = path.join(buildDir, bundle.dir, outFileRelative);
|
|
176
|
+
const outFileRelative = relativePath.replace(/\.d\.ts$/, newFileExtension);
|
|
177
|
+
const outFilePath = path.join(buildDir, outFileRelative);
|
|
178
178
|
|
|
179
179
|
const babelPlugins = [
|
|
180
180
|
[pluginTypescriptSyntax, { dts: true }],
|
|
@@ -194,7 +194,7 @@ export async function moveAndTransformDeclarations({
|
|
|
194
194
|
}
|
|
195
195
|
}),
|
|
196
196
|
);
|
|
197
|
-
if (
|
|
197
|
+
if (!writesToOriginalPath) {
|
|
198
198
|
await fs.unlink(nativeDtsFile);
|
|
199
199
|
}
|
|
200
200
|
},
|
|
@@ -208,14 +208,13 @@ export async function moveAndTransformDeclarations({
|
|
|
208
208
|
* After copying, babel transformations are applied to the copied files because they need to be alongside the actual js files for proper resolution.
|
|
209
209
|
*
|
|
210
210
|
* @param {Object} param0
|
|
211
|
-
* @param {boolean} [param0.isFlat = false] - Whether to place generated declaration files in a flattened directory.
|
|
212
211
|
* @param {boolean} [param0.verbose = false] - Whether to log additional information while generating and moving declaration files.
|
|
213
|
-
* @param {
|
|
212
|
+
* @param {import('../utils/build.mjs').BundleType[]} param0.bundles - The bundles to create declarations for.
|
|
214
213
|
* @param {string} param0.srcDir - The source directory.
|
|
215
214
|
* @param {string} param0.buildDir - The build directory.
|
|
216
215
|
* @param {string} param0.cwd - The current working directory.
|
|
217
216
|
* @param {boolean} param0.skipTsc - Whether to skip running TypeScript compiler (tsc) for building types.
|
|
218
|
-
* @param {boolean} [param0.useTsgo=false] - Whether to build types using
|
|
217
|
+
* @param {boolean} [param0.useTsgo=false] - Whether to build types using the native TypeScript compiler.
|
|
219
218
|
* @param {'module' | 'commonjs'} [param0.packageType] - The package.json type field.
|
|
220
219
|
*/
|
|
221
220
|
export async function createTypes({
|
|
@@ -225,7 +224,6 @@ export async function createTypes({
|
|
|
225
224
|
cwd,
|
|
226
225
|
skipTsc,
|
|
227
226
|
useTsgo = false,
|
|
228
|
-
isFlat = false,
|
|
229
227
|
packageType,
|
|
230
228
|
verbose,
|
|
231
229
|
}) {
|
|
@@ -253,7 +251,6 @@ export async function createTypes({
|
|
|
253
251
|
inputDir: tmpDir,
|
|
254
252
|
buildDir,
|
|
255
253
|
bundles,
|
|
256
|
-
isFlat,
|
|
257
254
|
packageType,
|
|
258
255
|
});
|
|
259
256
|
} finally {
|
package/vale/.vale.ini
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
StylesPath = styles
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Enforce a single way to write specific terms or phrases.
|
|
2
|
+
extends: substitution
|
|
3
|
+
message: Use '%s' instead of '%s'
|
|
4
|
+
level: error
|
|
5
|
+
ignorecase: true # There is only one correct way to spell those, so we want to match inputs regardless of case.
|
|
6
|
+
# swap maps tokens in form of bad: good
|
|
7
|
+
# for more information: https://vale.sh/docs/topics/styles/#substitution
|
|
8
|
+
swap:
|
|
9
|
+
' api': ' API'
|
|
10
|
+
'typescript ': 'TypeScript '
|
|
11
|
+
' ts': ' TypeScript'
|
|
12
|
+
javascript: JavaScript
|
|
13
|
+
' js': ' JavaScript'
|
|
14
|
+
' css ': ' CSS '
|
|
15
|
+
' html ': ' HTML '
|
|
16
|
+
NPM: npm # https://css-tricks.com/start-sentence-npm/
|
|
17
|
+
Github: GitHub
|
|
18
|
+
StackOverflow: Stack Overflow
|
|
19
|
+
Stack Overflow: Stack Overflow
|
|
20
|
+
CSS modules: CSS Modules
|
|
21
|
+
Tailwind CSS: Tailwind CSS
|
|
22
|
+
Heat map: Heatmap
|
|
23
|
+
Tree map: Treemap
|
|
24
|
+
Sparkline Chart: Sparkline chart
|
|
25
|
+
Gauge Chart: Gauge chart
|
|
26
|
+
Treemap Chart: Treemap chart
|
|
27
|
+
sub-component: subcomponent
|
|
28
|
+
sub-components: subcomponents
|
|
29
|
+
use-case: use case
|
|
30
|
+
usecase: use case
|
|
31
|
+
Material 3: Material Design 3
|
|
32
|
+
VSCode: VS Code
|
|
33
|
+
VS Code: VS Code
|
|
34
|
+
'Codesandbox ': 'CodeSandbox '
|
|
35
|
+
code sandbox: CodeSandbox
|
|
36
|
+
Stackblitz: StackBlitz
|
|
37
|
+
Webpack: webpack # https://x.com/wSokra/status/855800490713649152
|
|
38
|
+
app router: App Router # Next.js
|
|
39
|
+
pages router: Pages Router # Next.js
|
|
40
|
+
page router: Pages Router # Next.js
|
|
41
|
+
eslint: ESLint
|
|
42
|
+
ES modules: ES modules
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Write things correctly, please no wrong references.
|
|
2
|
+
extends: substitution
|
|
3
|
+
message: Use '%s' instead of '%s'
|
|
4
|
+
level: error
|
|
5
|
+
ignorecase: false
|
|
6
|
+
# swap maps tokens in form of bad: good
|
|
7
|
+
# for more information: https://vale.sh/docs/topics/styles/#substitution
|
|
8
|
+
swap:
|
|
9
|
+
eg: e.g.
|
|
10
|
+
eg\.: e.g.
|
|
11
|
+
e\.g: e.g.
|
|
12
|
+
ie: i.e.
|
|
13
|
+
ie\.: i.e.
|
|
14
|
+
i\.e: i.e.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
extends: substitution
|
|
2
|
+
message: Use '%s' instead of '%s'
|
|
3
|
+
link: https://developers.google.com/style/abbreviations
|
|
4
|
+
ignorecase: false
|
|
5
|
+
level: error
|
|
6
|
+
nonword: true
|
|
7
|
+
action:
|
|
8
|
+
name: replace
|
|
9
|
+
swap:
|
|
10
|
+
'\b(?:eg|e\.g\.)(?=[\s,;])': for example
|
|
11
|
+
'\b(?:ie|i\.e\.)(?=[\s,;])': that is
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Without a non-breaking space, brand names can be split in the middle
|
|
2
|
+
# with the start and end on two different lines.
|
|
3
|
+
# For example, Apple does this meticulously with their brand name: https://www.apple.com/macbook-air/.
|
|
4
|
+
# Also read https://www.chrisdpeters.com/blog/using-non-breaking-spaces-to-help-with-branding/ for why.
|
|
5
|
+
extends: substitution
|
|
6
|
+
message: Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('%s' instead of '%s')
|
|
7
|
+
level: error
|
|
8
|
+
ignorecase: true
|
|
9
|
+
# swap maps tokens in form of bad: good
|
|
10
|
+
# for more information: https://vale.sh/docs/topics/styles/#substitution
|
|
11
|
+
swap:
|
|
12
|
+
Material UI: Material UI
|
|
13
|
+
MUI X: MUI X
|
|
14
|
+
Base UI: Base UI
|
|
15
|
+
MUI Base: MUI Base
|
|
16
|
+
MUI System: MUI System
|
|
17
|
+
MUI Store: MUI Store
|
|
18
|
+
MUI Core: MUI Core
|
|
19
|
+
MUI Toolpad: Toolpad
|
|
20
|
+
MUI Toolpad: Toolpad
|
|
21
|
+
MUI Connect: MUI Connect
|
|
22
|
+
Pigment CSS: Pigment CSS
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
extends: substitution
|
|
2
|
+
message: Use the US spelling '%s' instead of the British '%s'
|
|
3
|
+
link: https://www.notion.so/mui-org/Writing-style-guide-2a957a4168a54d47b14bae026d06a24b?pvs=4#25755bff02764565b954631236ab183d
|
|
4
|
+
level: error
|
|
5
|
+
ignorecase: true
|
|
6
|
+
swap:
|
|
7
|
+
aeon: eon
|
|
8
|
+
aeroplane: airplane
|
|
9
|
+
ageing: aging
|
|
10
|
+
aluminium: aluminum
|
|
11
|
+
anaemia: anemia
|
|
12
|
+
anaesthesia: anesthesia
|
|
13
|
+
analyse: analyze
|
|
14
|
+
annexe: annex
|
|
15
|
+
apologise: apologize
|
|
16
|
+
authorisation: authorization
|
|
17
|
+
authorise: authorize
|
|
18
|
+
authorised: authorized
|
|
19
|
+
authorising: authorizing
|
|
20
|
+
behaviour: behavior
|
|
21
|
+
bellow: below
|
|
22
|
+
busses: buses
|
|
23
|
+
calibre: caliber
|
|
24
|
+
categorise: categorize
|
|
25
|
+
categorised: categorized
|
|
26
|
+
categorises: categorizes
|
|
27
|
+
categorising: categorizing
|
|
28
|
+
centre: center
|
|
29
|
+
cheque: check
|
|
30
|
+
civilisation: civilization
|
|
31
|
+
civilise: civilize
|
|
32
|
+
colour: color
|
|
33
|
+
cosy: cozy
|
|
34
|
+
cypher: cipher
|
|
35
|
+
defence: defense
|
|
36
|
+
dependant: dependent
|
|
37
|
+
distil: distill
|
|
38
|
+
draught: draft
|
|
39
|
+
encyclopaedia: encyclopedia
|
|
40
|
+
enquiry: inquiry
|
|
41
|
+
enrol: enroll
|
|
42
|
+
enrolment: enrollment
|
|
43
|
+
enthral: enthrall
|
|
44
|
+
favourite: favorite
|
|
45
|
+
fibre: fiber
|
|
46
|
+
fillet: filet
|
|
47
|
+
flavour: flavor
|
|
48
|
+
fulfil: fulfill
|
|
49
|
+
furore: furor
|
|
50
|
+
gaol: jail
|
|
51
|
+
grey: gray
|
|
52
|
+
honour: honor
|
|
53
|
+
humour: humor
|
|
54
|
+
initialled: initialed
|
|
55
|
+
initialling: initialing
|
|
56
|
+
instil: instill
|
|
57
|
+
jewellery: jewelry
|
|
58
|
+
labelled: labeled
|
|
59
|
+
labelling: labeling
|
|
60
|
+
labour: labor
|
|
61
|
+
libellous: libelous
|
|
62
|
+
licence: license
|
|
63
|
+
likeable: likable
|
|
64
|
+
liveable: livable
|
|
65
|
+
lustre: luster
|
|
66
|
+
manoeuvre: maneuver
|
|
67
|
+
marvellous: marvelous
|
|
68
|
+
meagre: meager
|
|
69
|
+
metre: meter
|
|
70
|
+
modelling: modeling
|
|
71
|
+
moustache: mustache
|
|
72
|
+
neighbour: neighbor
|
|
73
|
+
normalise: normalize
|
|
74
|
+
offence: offense
|
|
75
|
+
optimise: optimize
|
|
76
|
+
optimised: optimized
|
|
77
|
+
optimising: optimizing
|
|
78
|
+
organise: organize
|
|
79
|
+
orientated: oriented
|
|
80
|
+
paralyse: paralyze
|
|
81
|
+
plough: plow
|
|
82
|
+
pretence: pretense
|
|
83
|
+
programme: program
|
|
84
|
+
pyjamas: pajamas
|
|
85
|
+
rateable: ratable
|
|
86
|
+
realise: realize
|
|
87
|
+
recognise: recognize
|
|
88
|
+
reconnoitre: reconnoiter
|
|
89
|
+
rumour: rumor
|
|
90
|
+
sabre: saber
|
|
91
|
+
saleable: salable
|
|
92
|
+
saltpetre: saltpeter
|
|
93
|
+
sceptic: skeptic
|
|
94
|
+
sepulchre: sepulcher
|
|
95
|
+
signalling: signaling
|
|
96
|
+
sizeable: sizable
|
|
97
|
+
skilful: skillful
|
|
98
|
+
smoulder: smolder
|
|
99
|
+
sombre: somber
|
|
100
|
+
speciality: specialty
|
|
101
|
+
spectre: specter
|
|
102
|
+
splendour: splendor
|
|
103
|
+
standardise: standardize
|
|
104
|
+
standardised: standardized
|
|
105
|
+
sulphur: sulfur
|
|
106
|
+
theatre: theater
|
|
107
|
+
travelled: traveled
|
|
108
|
+
traveller: traveler
|
|
109
|
+
travelling: traveling
|
|
110
|
+
unshakeable: unshakable
|
|
111
|
+
wilful: willful
|
|
112
|
+
yoghurt: yogurt
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
extends: existence
|
|
2
|
+
message: We avoid referencing the company name '%s'. Instead you can reference a product or the team.
|
|
3
|
+
level: warning
|
|
4
|
+
ignorecase: false
|
|
5
|
+
tokens:
|
|
6
|
+
- 'MUI \w+'
|
|
7
|
+
exceptions:
|
|
8
|
+
- 'MUI X'
|
|
9
|
+
- 'MUI System'
|
|
10
|
+
- 'MUI Store'
|
|
11
|
+
- 'MUI Core'
|
|
12
|
+
- 'MUI Connect'
|
|
13
|
+
# valid use of a regular space
|
|
14
|
+
- 'MUI organization'
|
|
15
|
+
- 'MUI ecosystem'
|
|
16
|
+
- 'MUI products'
|
|
17
|
+
- 'MUI team'
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {[string, string]} Attr
|
|
3
|
-
*/
|
|
4
|
-
export type Attr = [string, string];
|
|
5
|
-
export type Token = {
|
|
6
|
-
type: string;
|
|
7
|
-
info: string;
|
|
8
|
-
tag: string;
|
|
9
|
-
content: string;
|
|
10
|
-
lineNumber: number;
|
|
11
|
-
attrs: Attr[];
|
|
12
|
-
};
|
|
13
|
-
export type OnErrorObj = {
|
|
14
|
-
lineNumber: number;
|
|
15
|
-
detail?: string;
|
|
16
|
-
};
|
|
17
|
-
export type OnError = (err: OnErrorObj) => void;
|
|
18
|
-
export type MdParams = {
|
|
19
|
-
name: string;
|
|
20
|
-
lines: string[];
|
|
21
|
-
tokens: Token[];
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {Object} Token
|
|
25
|
-
* @property {string} type
|
|
26
|
-
* @property {string} info
|
|
27
|
-
* @property {string} tag
|
|
28
|
-
* @property {string} content
|
|
29
|
-
* @property {number} lineNumber
|
|
30
|
-
* @property {Attr[]} attrs
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {Object} OnErrorObj
|
|
34
|
-
* @property {number} lineNumber
|
|
35
|
-
* @property {string} [detail]
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* @typedef {(err: OnErrorObj) => void} OnError
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* @typedef {Object} MdParams
|
|
42
|
-
* @property {string} name
|
|
43
|
-
* @property {string[]} lines
|
|
44
|
-
* @property {Token[]} tokens
|
|
45
|
-
*/
|
|
46
|
-
declare const _default: {
|
|
47
|
-
names: string[];
|
|
48
|
-
description: string;
|
|
49
|
-
tags: string[];
|
|
50
|
-
/**
|
|
51
|
-
* @param {import('./duplicate-h1.mjs').MdParams} params
|
|
52
|
-
* @param {import('./duplicate-h1.mjs').OnError} onError
|
|
53
|
-
*/
|
|
54
|
-
function: (params: MdParams, onError: OnError) => void;
|
|
55
|
-
};
|
|
56
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
names: string[];
|
|
3
|
-
description: string;
|
|
4
|
-
tags: string[];
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('./duplicate-h1.mjs').MdParams} params
|
|
7
|
-
* @param {import('./duplicate-h1.mjs').OnError} onError
|
|
8
|
-
*/
|
|
9
|
-
function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import straightQuotes from './straight-quotes.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Create a base configuration for markdownlint.
|
|
4
|
-
* @param {Object} options
|
|
5
|
-
* @param {(typeof straightQuotes)[]} [options.rules] - An array of custom rules to include.
|
|
6
|
-
* @param {string[]} [options.ignores] - An array of glob patterns to ignore.
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function createBaseConfig(options?: {
|
|
10
|
-
rules?: (typeof straightQuotes)[];
|
|
11
|
-
ignores?: string[];
|
|
12
|
-
}): {
|
|
13
|
-
config: {
|
|
14
|
-
default: boolean;
|
|
15
|
-
MD004: boolean;
|
|
16
|
-
MD009: {
|
|
17
|
-
br_spaces: number;
|
|
18
|
-
strict: boolean;
|
|
19
|
-
list_item_empty_lines: boolean;
|
|
20
|
-
};
|
|
21
|
-
MD013: boolean;
|
|
22
|
-
MD014: boolean;
|
|
23
|
-
MD024: {
|
|
24
|
-
siblings_only: boolean;
|
|
25
|
-
};
|
|
26
|
-
MD025: {
|
|
27
|
-
level: number;
|
|
28
|
-
front_matter_title: string;
|
|
29
|
-
};
|
|
30
|
-
MD033: boolean;
|
|
31
|
-
MD034: boolean;
|
|
32
|
-
MD028: boolean;
|
|
33
|
-
MD029: boolean;
|
|
34
|
-
MD031: boolean;
|
|
35
|
-
MD036: boolean;
|
|
36
|
-
MD051: boolean;
|
|
37
|
-
MD052: boolean;
|
|
38
|
-
MD059: boolean;
|
|
39
|
-
straightQuotes: boolean;
|
|
40
|
-
gitDiff: boolean;
|
|
41
|
-
tableAlignment: boolean;
|
|
42
|
-
terminalLanguage: boolean;
|
|
43
|
-
duplicateH1: boolean;
|
|
44
|
-
};
|
|
45
|
-
customRules: {
|
|
46
|
-
names: string[];
|
|
47
|
-
description: string;
|
|
48
|
-
tags: string[];
|
|
49
|
-
function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
|
|
50
|
-
}[];
|
|
51
|
-
ignores: string[];
|
|
52
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
names: string[];
|
|
3
|
-
description: string;
|
|
4
|
-
tags: string[];
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('./duplicate-h1.mjs').MdParams} params
|
|
7
|
-
* @param {import('./duplicate-h1.mjs').OnError} onError
|
|
8
|
-
*/
|
|
9
|
-
function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
names: string[];
|
|
3
|
-
description: string;
|
|
4
|
-
tags: string[];
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('./duplicate-h1.mjs').MdParams} params
|
|
7
|
-
* @param {import('./duplicate-h1.mjs').OnError} onError
|
|
8
|
-
*/
|
|
9
|
-
function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|