feat(utils, types): mark the exports v12 removes as @deprecated
Seventh PR of the v11.1.0 cleanup (R10, R11): every export v12 removes is marked @deprecated, naming its replacement. Nothing changes at runtime, and no deprecated export emits a new warning.
Summary
packages/utils/src/readFile.ts
+/** @deprecated Removed in v12. Use `readFileAsync` instead. */
export function readFile(file: string): string;
+/** @deprecated Removed in v12. Use `readFileAsync` instead. */
export function readFile(file: string, asBuffer: true): Buffer;
... # every overload carries the tag
| Package | Deprecated export | Use instead |
|---|---|---|
| utils | readFile (every overload), writeFile, getContentFromFiles, isValidFile | their …Async versions |
| utils | deleteFile | fs.promises.unlink |
| utils | getSourceMapBoolean | extractSourceMapOption |
| utils | tryResolveBuiltIn, tryResolveNpmPackage, tryResolveLocalFile | resolveCompressor |
| utils | getKnownExportName | getCompressorEntry(name)?.exportName, with the canonical name (it doesn't resolve aliases: "gcc" → undefined) |
| utils | isLocalPath | none (resolveCompressor accepts local paths) |
| utils | validateMinifyResult | none (run already validates every result) |
| utils | buildArgs, toBuildArgsOptions, BuildArgsOptions, warnDeprecation, resetDeprecationWarnings | none |
| utils | WildcardOptions.publicFolder (the object form of wildcards options) | pass the public folder as a string |
| utils | WildcardOptions.ignore | none |
| types | ImageFormat | none |
| types | Settings.option (the CLI's raw -O string) | options |
wildcards itself isn't deprecated. The changeset (utils minor, types minor) carries this table, so it becomes the 11.1.0 changelog entry. The utils README and AGENTS.md list the deprecated exports, and the README example uses the async functions.
Evidence
- Comment-only source diff: every changed line under
packages/*/srcis a comment. No code line changed. - Exports unchanged: the exported names of
utils(50) andtypes(10) are identical todevelop. The built.d.tsand.jsfiles are byte-identical once comments are stripped. - Editors flag them: run on a consumer file that imports the built package, TypeScript's language service reports
'readFile' is deprecated(6385/6387) for all 4readFilecall shapes, and forImageFormat,WildcardOptions,BuildArgsOptionsandsettings.option. The replacements are not flagged:readFileAsync,writeFileAsync,resolveCompressor,wildcards(x, "public")andsettings.options. - Same behavior (AE6): sync
readFile, in every variant including the missing-file and directory errors, and 10 other deprecated functions produce identical output ondevelop's build and this branch's. Nothing is printed toconsole.warnorconsole.error. - Gate: build, lint, typecheck,
check-exportsand both guards pass, as do 1141 of 1141 tests.
Merge Danger
Door: two-way. It's a revert away.
Blast Radius: small
- Runtime: no change. Comments only.
- Editors and lint: consumers see strikethrough on these imports. A consumer whose lint fails on deprecated APIs (e.g.
@typescript-eslint/no-deprecatedas an error) will start failing. That's the point of the notice, and it's a v12 heads-up. - Not flagged: a call like
wildcards(x, { publicFolder })isn't flagged in editors, only code that namesWildcardOptions. Flagging the call would need a separate deprecated overload, which could break callers who pass theWildcardOptions | stringunion. - Internal callers unchanged (the next cleanup PR moves them):
validateMinifyResultin cssnano, oxc and minify-html; syncisValidFilein threeutilsfiles;Settings.optionin the CLI.
Summary by cubic
Marks every export that v12 removes as @deprecated in its JSDoc, so editors show them struck through with a replacement hint. Nothing changes at runtime: no output, signatures, or behavior is altered.
@node-minify/utilsdeprecatesreadFile,writeFile,getContentFromFiles,isValidFile,deleteFile,getSourceMapBoolean, thetryResolve*helpers,getKnownExportName,isLocalPath,validateMinifyResult,buildArgs,toBuildArgsOptions,BuildArgsOptions,warnDeprecation,resetDeprecationWarnings, and theWildcardOptionsobject form.@node-minify/typesdeprecatesImageFormatandSettings.option.- Every
readFileoverload carries the tag so all call shapes are flagged. WildcardOptions.publicFolderis replaced by passing the public folder as a string;WildcardOptions.ignorehas no replacement.getKnownExportName's replacement takes the canonical compressor name sincegetCompressorEntrydoes not resolve aliases such asgcc.- README and
AGENTS.mdlist each deprecated export with its replacement, and the README example now uses the async functions. - A changeset records the deprecations and becomes the 11.1.0 changelog entry. No deprecated export emits a new runtime warning, including
warnDeprecationitself.
Consumers whose lint rules fail on deprecated APIs will start failing on these imports; that is the intended v12 heads-up. Internal callers still using the deprecated functions migrate in a separate cleanup.