diff --git a/tools/clean.js b/tools/clean.js index c869447..ada9e9f 100644 --- a/tools/clean.js +++ b/tools/clean.js @@ -4,4 +4,4 @@ import { rimraf } from 'rimraf'; -await rimraf(['cjs', 'esm', 'types']); +await rimraf(['cjs', 'esm']); diff --git a/tools/fix-types.js b/tools/fix-types.js index b0d097f..486827c 100644 --- a/tools/fix-types.js +++ b/tools/fix-types.js @@ -8,32 +8,32 @@ import { readdir, rename } from 'node:fs/promises'; /** * @function renameDts - * @description Rename `.d.ts` files in a directory to a specified extension - * @param {string} dir The target directory to process - * @param {string} ext The new extension to replace `.d.ts` + * @description Rename `.d.ts` files in a directory to a specified extension. + * @param {string} dir The target directory to process. + * @param {string} ext The new extension to replace `.d.ts`. * @returns {Promise} */ async function renameDts(dir, ext) { - // Stack to manage directories + // Stack to manage directories. const stack = [dir]; while (stack.length > 0) { const currentDir = stack.pop(); - // Read items in the current directory + // Read items in the current directory. const items = await readdir(currentDir, { withFileTypes: true }); - // Collect all tasks for the current directory + // Collect all tasks for the current directory. const tasks = items.map(async item => { const sourcePath = join(currentDir, item.name); if (item.isDirectory()) { - // If it's a directory, push it onto the stack + // If it's a directory, push it onto the stack. stack.push(sourcePath); } else if (item.isFile()) { const re = /\.d\.ts$/i; - // If the file matches `.d.ts`, rename it + // If the file matches `.d.ts`, rename it. if (re.test(sourcePath)) { const targetPath = sourcePath.replace(re, ext); @@ -42,7 +42,7 @@ async function renameDts(dir, ext) { } }); - // Process all tasks concurrently for the current directory + // Process all tasks concurrently for the current directory. await Promise.all(tasks); } } diff --git a/tools/plugins/tree-shake.js b/tools/plugins/tree-shake.js index d9f3d91..cbe7777 100644 --- a/tools/plugins/tree-shake.js +++ b/tools/plugins/tree-shake.js @@ -6,7 +6,7 @@ import MagicString from 'magic-string'; /*** * @function treeShake - * @description Fixed tree shaking for typescript and rollup preserve modules + * @description Fixed tree shaking for typescript and rollup preserve modules. * @return {import('rollup').Plugin} */ export default function treeShake() { diff --git a/tools/rollup.base.js b/tools/rollup.base.js index 508e8f1..76590da 100644 --- a/tools/rollup.base.js +++ b/tools/rollup.base.js @@ -10,9 +10,9 @@ import { createRequire, isBuiltin } from 'node:module'; const pkg = createRequire(import.meta.url)('../package.json'); const externals = [ - // Dependencies + // Dependencies. ...Object.keys(pkg.dependencies || {}), - // Peer dependencies + // Peer dependencies. ...Object.keys(pkg.peerDependencies || {}) ]; @@ -41,7 +41,7 @@ function env() { /** * @function rollup - * @param {boolean} [esnext] + * @param {boolean} [esnext] Is esnext. * @return {import('rollup').RollupOptions} */ export default function rollup(esnext) {