Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThis PR releases version 3.0.0 for multiple br-utils packages with class-based APIs, removes processed changeset documentation files, and updates CHANGELOG.md entries with detailed release notes. Additionally, utility packages are bumped to v1.0.0, and Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
packages/br-utils/package.json (1)
72-76:⚠️ Potential issue | 🔴 CriticalFix the workspace: dependency resolution before publishing.*
The release script depends on a non-existent
workspace-version-resolvertool (^0.1.0) that will cause the release to fail. Additionally,workspace:*dependencies must not be published to npm—they break consumer installations.Replace
workspace:*with concrete semver ranges:
@lacussoft/utils:workspace:*→^1.0.0(stable)cnpj-utils:workspace:*→^3.0.0(stable)cpf-utils:workspace:*→^3.0.0(stable)Remove the non-functional
workspace-version-resolverfrom devDependencies and release script, then rely onchangeset publishalone (which handles version bumping) or implement a proper pre-publish transformation step using an existing, available tool.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/br-utils/package.json` around lines 72 - 76, Update package.json so published dependencies are real semver ranges and remove the broken workspace resolver: replace the three dependencies "@lacussoft/utils", "cnpj-utils", and "cpf-utils" currently set to "workspace:*" with concrete ranges "^1.0.0", "^3.0.0", and "^3.0.0" respectively, and remove any devDependency entry named "workspace-version-resolver" as well as any invocation of it in the "release" script; rely on "changeset publish" (or implement a supported pre-publish transformer) instead of calling the non-existent resolver.packages/cnpj-gen/package.json (1)
64-67:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifiers before publishing.The
workspace:*protocol won't resolve for npm consumers. Since both@lacussoft/cnpj-dvand@lacussoft/utilsare now at 1.0.0, use^specifiers per repo conventions.🔧 Proposed fix
"dependencies": { - "@lacussoft/cnpj-dv": "workspace:*", - "@lacussoft/utils": "workspace:*" + "@lacussoft/cnpj-dv": "^1.0.0", + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ~ for pre-1.0.0 versions and ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cnpj-gen/package.json` around lines 64 - 67, Update the dependency specifiers in package.json for the cnpj-gen package to replace workspace:* with concrete semver ranges: change "@lacussoft/cnpj-dv" and "@lacussoft/utils" from "workspace:*" to "^1.0.0" (per repo convention for packages >=1.0.0). Edit the "dependencies" block in packages/cnpj-gen/package.json so the two package entries use the caret semver specifier to ensure npm consumers can resolve them.packages/cnpj-utils/package.json (1)
68-73:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifiers before publishing.All dependencies are now at stable versions (>=1.0.0), so use
^specifiers.🔧 Proposed fix
"dependencies": { - "@lacussoft/cnpj-fmt": "workspace:*", - "@lacussoft/cnpj-gen": "workspace:*", - "@lacussoft/cnpj-val": "workspace:*", - "@lacussoft/utils": "workspace:*" + "@lacussoft/cnpj-fmt": "^3.0.0", + "@lacussoft/cnpj-gen": "^3.0.0", + "@lacussoft/cnpj-val": "^3.0.0", + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ~ for pre-1.0.0 versions and ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cnpj-utils/package.json` around lines 68 - 73, Update package.json dependencies to replace all "workspace:*" specifiers with concrete semver ranges using caret (^) for the stable packages; specifically change the versions for "@lacussoft/cnpj-fmt", "@lacussoft/cnpj-gen", "@lacussoft/cnpj-val", and "@lacussoft/utils" from "workspace:*" to the appropriate "^<version>" values (use the current published >=1.0.0 versions for each package) so the package.json no longer contains workspace:* entries before publishing.packages/cnpj-val/package.json (1)
63-66:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifiers before publishing.🔧 Proposed fix
"dependencies": { - "@lacussoft/cnpj-dv": "workspace:*", - "@lacussoft/utils": "workspace:*" + "@lacussoft/cnpj-dv": "^1.0.0", + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cnpj-val/package.json` around lines 63 - 66, package.json currently lists workspace:* for dependencies which must be replaced with concrete semver ranges before publishing; update the dependencies entry for "@lacussoft/cnpj-dv" and "@lacussoft/utils" in package.json to explicit semver specifiers (e.g., use caret ranges like ^1.0.0 or the exact versions you intend to publish) so consumers don’t receive workspace:* at install time and ensure the chosen versions reflect the released package compatibility.packages/cpf-fmt/package.json (1)
63-65:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifier before publishing.🔧 Proposed fix
"dependencies": { - "@lacussoft/utils": "workspace:*" + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cpf-fmt/package.json` around lines 63 - 65, Replace the placeholder workspace specifier for the dependency "@lacussoft/utils": "workspace:*" with a concrete semver range (e.g., "^1.0.0" or the actual package version you intend to publish) so the released package does not reference workspace:*; update the dependency entry in package.json to the chosen semver (prefer a caret range like ^<major>.<minor>.<patch> for published packages) and verify the version matches the published `@lacussoft/utils` release.packages/cpf-utils/package.json (1)
68-73:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifiers before publishing.All dependencies are now at stable versions (>=1.0.0), so use
^specifiers.🔧 Proposed fix
"dependencies": { - "@lacussoft/cpf-fmt": "workspace:*", - "@lacussoft/cpf-gen": "workspace:*", - "@lacussoft/cpf-val": "workspace:*", - "@lacussoft/utils": "workspace:*" + "@lacussoft/cpf-fmt": "^3.0.0", + "@lacussoft/cpf-gen": "^3.0.0", + "@lacussoft/cpf-val": "^3.0.0", + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ~ for pre-1.0.0 versions and ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cpf-utils/package.json` around lines 68 - 73, Replace the four workspace:* dependency specs in package.json for "@lacussoft/cpf-fmt", "@lacussoft/cpf-gen", "@lacussoft/cpf-val", and "@lacussoft/utils" with concrete caret semver ranges (e.g. ^1.0.0 or, better, ^<current-stable-version>) so published packages don't reference workspace:*; update each dependency value to a ^ version string reflecting the stable (>=1.0.0) release.packages/cpf-val/package.json (1)
63-66:⚠️ Potential issue | 🟠 MajorReplace
workspace:*with concrete semver specifiers before publishing.🔧 Proposed fix
"dependencies": { - "@lacussoft/cpf-dv": "workspace:*", - "@lacussoft/utils": "workspace:*" + "@lacussoft/cpf-dv": "^1.0.0", + "@lacussoft/utils": "^1.0.0" }Based on learnings: "In monorepos, avoid leaving workspace:* dependencies in released packages... use ^ for >=1.0.0 versions."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cpf-val/package.json` around lines 63 - 66, The package.json currently pins internal deps "@lacussoft/cpf-dv" and "@lacussoft/utils" to workspace:* which must be replaced before publishing; update those dependency entries to concrete semver specifiers (e.g., ^1.0.0 or the matching release versions for cpf-dv and utils) instead of "workspace:*", ensure package.json's "dependencies" entries for "@lacussoft/cpf-dv" and "@lacussoft/utils" use caret semver ranges for released versions, run a quick npm/yarn install or validation to confirm the resolved versions, and commit the updated package.json.packages/utils/CHANGELOG.md (1)
11-11:⚠️ Potential issue | 🟡 MinorUse a package-local README link here.
../../packages/utils/README.mddepends on the repository layout../README.mdkeeps the link valid when this changelog is viewed from the published package contents too.Proposed fix
-Named exports and a default object export; ESM, CommonJS, and UMD builds; zero dependencies; full TypeScript declarations. For installation, usage, and API details, see the [package README](../../packages/utils/README.md). +Named exports and a default object export; ESM, CommonJS, and UMD builds; zero dependencies; full TypeScript declarations. For installation, usage, and API details, see the [package README](./README.md).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/utils/CHANGELOG.md` at line 11, The changelog's README link is repository-relative and will break when the package is published; update the link in packages/utils/CHANGELOG.md (the line containing the README link) to use a package-local relative path by replacing "../../packages/utils/README.md" with "./README.md" so the changelog points to the README bundled with the published package.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cnpj-dv/package.json`:
- Line 3: The package.json currently uses the monorepo-only specifier
"workspace:*" for the dependency "@lacussoft/utils", which prevents consumers
from installing the published package; update the dependency entry for
"@lacussoft/utils" in package.json to a published semver range (e.g., "^1.0.0")
so npm clients can resolve it, ensuring the change replaces "workspace:*" with
"^1.0.0" before publishing.
In `@packages/cnpj-fmt/package.json`:
- Line 3: Update the dependency entry for "@lacussoft/utils" in package.json to
replace the workspace:* specifier with the concrete published semver range
(e.g., ^1.0.0) so the package manifest is release-ready; locate the dependency
key "@lacussoft/utils" in packages/cnpj-fmt's package.json and change its value
from "workspace:*" to the appropriate version range before publishing.
In `@packages/cpf-fmt/CHANGELOG.md`:
- Around line 7-9: Update the CHANGELOG entry to note that the UMD bundle
exposes abbreviated exception/type aliases while CommonJS exports the full
`CpfFormatter...` names; specifically amend the paragraph listing
`CpfFormatterInputTypeError` and `CpfFormatterInputLengthException` (and related
options error names) to add a sentence clarifying that browser consumers using
the UMD build should reference the abbreviated alias names (the UMD namespace
does not include the full `CpfFormatter*` identifiers) while CJS consumers can
use the full names.
In `@packages/cpf-gen/package.json`:
- Line 3: The package.json currently sets "version": "3.0.0" while some
dependencies still use the workspace:* specifier; before publishing replace all
workspace:* entries in dependencies and devDependencies with concrete semver
ranges (prefer caret-prefixed ranges like ^x.y.z) so consumers don’t receive an
install-broken manifest; locate the dependency entries in package.json (look for
any values equal to "workspace:*") and update them to the actual released
versions (or appropriate ^ ranges) and verify package-lock/yarn lock is
regenerated before publishing.
---
Outside diff comments:
In `@packages/br-utils/package.json`:
- Around line 72-76: Update package.json so published dependencies are real
semver ranges and remove the broken workspace resolver: replace the three
dependencies "@lacussoft/utils", "cnpj-utils", and "cpf-utils" currently set to
"workspace:*" with concrete ranges "^1.0.0", "^3.0.0", and "^3.0.0"
respectively, and remove any devDependency entry named
"workspace-version-resolver" as well as any invocation of it in the "release"
script; rely on "changeset publish" (or implement a supported pre-publish
transformer) instead of calling the non-existent resolver.
In `@packages/cnpj-gen/package.json`:
- Around line 64-67: Update the dependency specifiers in package.json for the
cnpj-gen package to replace workspace:* with concrete semver ranges: change
"@lacussoft/cnpj-dv" and "@lacussoft/utils" from "workspace:*" to "^1.0.0" (per
repo convention for packages >=1.0.0). Edit the "dependencies" block in
packages/cnpj-gen/package.json so the two package entries use the caret semver
specifier to ensure npm consumers can resolve them.
In `@packages/cnpj-utils/package.json`:
- Around line 68-73: Update package.json dependencies to replace all
"workspace:*" specifiers with concrete semver ranges using caret (^) for the
stable packages; specifically change the versions for "@lacussoft/cnpj-fmt",
"@lacussoft/cnpj-gen", "@lacussoft/cnpj-val", and "@lacussoft/utils" from
"workspace:*" to the appropriate "^<version>" values (use the current published
>=1.0.0 versions for each package) so the package.json no longer contains
workspace:* entries before publishing.
In `@packages/cnpj-val/package.json`:
- Around line 63-66: package.json currently lists workspace:* for dependencies
which must be replaced with concrete semver ranges before publishing; update the
dependencies entry for "@lacussoft/cnpj-dv" and "@lacussoft/utils" in
package.json to explicit semver specifiers (e.g., use caret ranges like ^1.0.0
or the exact versions you intend to publish) so consumers don’t receive
workspace:* at install time and ensure the chosen versions reflect the released
package compatibility.
In `@packages/cpf-fmt/package.json`:
- Around line 63-65: Replace the placeholder workspace specifier for the
dependency "@lacussoft/utils": "workspace:*" with a concrete semver range (e.g.,
"^1.0.0" or the actual package version you intend to publish) so the released
package does not reference workspace:*; update the dependency entry in
package.json to the chosen semver (prefer a caret range like
^<major>.<minor>.<patch> for published packages) and verify the version matches
the published `@lacussoft/utils` release.
In `@packages/cpf-utils/package.json`:
- Around line 68-73: Replace the four workspace:* dependency specs in
package.json for "@lacussoft/cpf-fmt", "@lacussoft/cpf-gen",
"@lacussoft/cpf-val", and "@lacussoft/utils" with concrete caret semver ranges
(e.g. ^1.0.0 or, better, ^<current-stable-version>) so published packages don't
reference workspace:*; update each dependency value to a ^ version string
reflecting the stable (>=1.0.0) release.
In `@packages/cpf-val/package.json`:
- Around line 63-66: The package.json currently pins internal deps
"@lacussoft/cpf-dv" and "@lacussoft/utils" to workspace:* which must be replaced
before publishing; update those dependency entries to concrete semver specifiers
(e.g., ^1.0.0 or the matching release versions for cpf-dv and utils) instead of
"workspace:*", ensure package.json's "dependencies" entries for
"@lacussoft/cpf-dv" and "@lacussoft/utils" use caret semver ranges for released
versions, run a quick npm/yarn install or validation to confirm the resolved
versions, and commit the updated package.json.
In `@packages/utils/CHANGELOG.md`:
- Line 11: The changelog's README link is repository-relative and will break
when the package is published; update the link in packages/utils/CHANGELOG.md
(the line containing the README link) to use a package-local relative path by
replacing "../../packages/utils/README.md" with "./README.md" so the changelog
points to the README bundled with the published package.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a72926dd-f6ad-4dd4-96de-fb7ffd0cd692
📒 Files selected for processing (34)
.changeset/curvy-hands-shop.md.changeset/twenty-hands-go.md.changeset/twenty-hands-join.md.changeset/twenty-hands-keep.md.changeset/twenty-hands-laugh.md.changeset/twenty-hands-melt.md.changeset/twenty-hands-navigate.md.changeset/twenty-hands-owe.md.changeset/twenty-hands-pay.md.changeset/twenty-hands-queue.mdpackages/br-utils/CHANGELOG.mdpackages/br-utils/package.jsonpackages/cnpj-dv/CHANGELOG.mdpackages/cnpj-dv/package.jsonpackages/cnpj-fmt/CHANGELOG.mdpackages/cnpj-fmt/package.jsonpackages/cnpj-gen/CHANGELOG.mdpackages/cnpj-gen/package.jsonpackages/cnpj-utils/CHANGELOG.mdpackages/cnpj-utils/package.jsonpackages/cnpj-val/CHANGELOG.mdpackages/cnpj-val/package.jsonpackages/cpf-dv/CHANGELOG.mdpackages/cpf-dv/package.jsonpackages/cpf-fmt/CHANGELOG.mdpackages/cpf-fmt/package.jsonpackages/cpf-gen/CHANGELOG.mdpackages/cpf-gen/package.jsonpackages/cpf-utils/CHANGELOG.mdpackages/cpf-utils/package.jsonpackages/cpf-val/CHANGELOG.mdpackages/cpf-val/package.jsonpackages/utils/CHANGELOG.mdpackages/utils/package.json
💤 Files with no reviewable changes (10)
- .changeset/curvy-hands-shop.md
- .changeset/twenty-hands-join.md
- .changeset/twenty-hands-go.md
- .changeset/twenty-hands-keep.md
- .changeset/twenty-hands-queue.md
- .changeset/twenty-hands-owe.md
- .changeset/twenty-hands-melt.md
- .changeset/twenty-hands-pay.md
- .changeset/twenty-hands-navigate.md
- .changeset/twenty-hands-laugh.md
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
br-utils@3.0.0
Major Changes
ac9d792: ### 🎉 v3 at a glance 🎊
BrUtilsclass instance withcpfandcnpjsub-modules;BrUtilsclass allows optional default settings for each (options orCpfUtils/CnpjUtilsinstances) and getters/setters forcpfandcnpj.cpf-utilsandcnpj-utilsare re-exported (e.g.cpfUtils,cnpjUtils,cpfFmt,cpfGen,cpfVal,cnpjFmt,cnpjGen,cnpjVal, and their classes, options, errors, types).cpf-utilsandcnpj-utils(flat format options, structured errors, class-based customization in each sub-module).BREAKING CHANGES
cpfandcnpjremoved: The package no longer exports standalonecpfandcnpjnames. Use the default instance (brUtils.cpf,brUtils.cnpj) or import the re-exported instancescpfUtilsandcnpjUtils. Code that didimport { cpf as cpfUtils, cnpj as cnpjUtils } from 'br-utils'must switch toimport brUtils from 'br-utils'and usebrUtils.cpf/brUtils.cnpj, or useimport { cpfUtils, cnpjUtils } from 'br-utils'.BrUtilsinstance: The default export is now an instance of theBrUtilsclass, not a plain object. It still exposescpfandcnpjfor the same usage pattern (brUtils.cpf.format(), etc.), but code that relied on the default being a plain object (e.g. spreading, or checking for specific own properties) may need updates.cpf-utilsandcnpj-utils(e.g.BrUtils,cpfUtils,cnpjUtils,cpfFmt,cnpjFmt, classes, errors). Code that assumed the default had onlycpfandcnpjor a minimal surface may need updates.New features
BrUtilsclass: Construct with optionalBrUtilsSettingsInput(cpfandcnpjas options objects orCpfUtils/CnpjUtilsinstances). Instance has getters/setters forcpfandcnpj; setters accept an instance, an options object, ornull/undefinedto reset to defaults.cpfUtils,cnpjUtils,cpfFmt,cpfGen,cpfVal,cnpjFmt,cnpjGen,cnpjVal, and all their classes, options, errors, and types frombr-utilswithout depending oncpf-utilsorcnpj-utilsdirectly.Improvements
cpf-utilsandcnpj-utils.Patch Changes
@lacussoft/cnpj-dv@1.0.0
Major Changes
f795b64: ### 🚀 Stable Version Released!
Utility class to calculate check digits on CNPJ (Brazilian legal entity ID). Main features:
@lacussoft/utilsFor detailed usage and API reference, see the README.
Patch Changes
@lacussoft/cnpj-fmt@3.0.0
Major Changes
6f8dc3f: Drop dependency to external libraries: deepmerge, html-escaper, num-only.
786fe41: ### 🎉 v3 at a glance 🎊
CnpjFormatterlets you set default options once and reuse them;format()accepts string or array of strings.dotKey,slashKey,dashKey,hiddenKey,hiddenStart,hiddenEnd) plusescape,encode, andonFail.CnpjFormatterInputTypeError,CnpjFormatterInputLengthException, options errors) for clearer error handling.BREAKING CHANGES
cnpjFmt()helper, but the main programmable API is theCnpjFormatterclass. You can create an instance with default options and callformat()without passing options every time.delimiters.dotis nowdotKeydelimiters.slashis nowslashKeydelimiters.dashis nowdashKeyhiddenRange.startis nowhiddenStarthiddenRange.endis nowhiddenEndhiddenKeyandescapekeep the same names.encode(URL-encode output).(value, error?)and the return value is used as the formatted result.nullorundefinednow falls back to the existing value (constructor or default) instead of causing runtime issues.New features
encodeoption: Whentrue, the formatted CNPJ is URL-encoded (e.g. for query parameters or paths).CnpjFormatterTypeError,CnpjFormatterInputTypeError,CnpjFormatterOptionsTypeError) and validation/range errors (CnpjFormatterException,CnpjFormatterInputLengthException,CnpjFormatterOptionsHiddenRangeInvalidException,CnpjFormatterOptionsForbiddenKeyCharacterException). Failures can still be handled via theonFailcallback without throwing.Improvements
html-escaper,deepmerge, andnum-only; in-house HTML escaping and option handling. It only depends on internal package@lacussoft/utilsnow.Patch Changes
@lacussoft/cnpj-gen@3.0.0
Major Changes
1f9a608: ### 🎉 v3 at a glance 🎊
0-9A-Z), with optionalnumericoralphabeticvia thetypeoption.CnpjGeneratorlets you set default options once and reuse them;generate()accepts optional per-call options. ThecnpjGen()helper remains for one-off usage.typeoption — Control character set:numeric,alphabetic, oralphanumeric(default). Prefix is sanitized (alphanumeric only, uppercased); only the randomly generated part followstype.CnpjGeneratorOptionsTypeError,CnpjGeneratorOptionPrefixInvalidException,CnpjGeneratorOptionTypeInvalidException) for options and prefix validation.BREAKING CHANGES
cnpjGen()helper, but the main programmable API is theCnpjGeneratorclass. You can create an instance with default options and callgenerate()without passing options every time. When aCnpjGeneratorOptionsinstance is passed to the constructor, it is used by reference; mutating it affects futuregenerate()calls.AB123CDE000155) instead of numeric-only. Usetype: 'numeric'to keep numeric-only behavior.typeoption: Options now includetype('numeric'|'alphabetic'|'alphanumeric', default'alphanumeric'). Invalid values throwCnpjGeneratorOptionTypeInvalidException.CnpjGeneratorOptionPrefixInvalidException(e.g. base ID or branch ID all zeros, or 12 repeated digits). Option type errors throwCnpjGeneratorOptionsTypeError.nullorundefinedwhen usingCnpjGeneratorOptionsfalls back to the existing value (constructor or default) instead of causing runtime issues.New features
CnpjGeneratorOptionsclass: Reusable options with getters/setters andset()for bulk updates; supports constructor merge and overrides. Static defaults:DEFAULT_FORMAT,DEFAULT_PREFIX,DEFAULT_TYPE. Read-onlyallgetter returns a frozen snapshot.CnpjGeneratorTypeError(base for option type errors),CnpjGeneratorOptionsTypeError,CnpjGeneratorException(base for rule errors),CnpjGeneratorOptionPrefixInvalidException,CnpjGeneratorOptionTypeInvalidException.Improvements
@lacussoft/cnpj-dvfor correct check-digit calculation. Invalid sequences (e.g. after prefix) trigger retry until a valid CNPJ is produced.cnpjGen,CnpjGenerator,CnpjGeneratorOptions, constants (CNPJ_LENGTH,CNPJ_PREFIX_MAX_LENGTH), exception classes, and types; CJS/UMD default export iscnpjGenwith the same members on its namespace.Patch Changes
cnpj-utils@3.0.0
Major Changes
9004cf7: ### 🎉 v3 at a glance 🎊
cnpjFmt/cnpjGen/cnpjValhelpers.CnpjUtilsclass with optional default formatter, generator, and validator (options or instances); default export remains a pre-built instance for one-off use.delimiters.dot→dotKey,delimiters.slash→slashKey,delimiters.dash→dashKey,hiddenRange.start/end→hiddenStart/hiddenEnd. Newencodeoption for URL-encoding.@lacussoft/cnpj-fmt,@lacussoft/cnpj-gen, and@lacussoft/cnpj-valare re-exported; you can useCnpjFormatter,CnpjGenerator,CnpjValidatorand their helpers directly fromcnpj-utils.BREAKING CHANGES
@lacussoft/cnpj-fmtv3). Nested option shapes are no longer supported:delimiters.dotis nowdotKeydelimiters.slashis nowslashKeydelimiters.dashis nowdashKeyhiddenRange.startis nowhiddenStarthiddenRange.endis nowhiddenEndonFailcallback signature may differ (e.g. receives(value, exception)); return value is still used as the result when input length ≠ 14.cnpjUtils.generate()now returns a 14-character alphanumeric string (e.g.AB123CDE000155) instead of numeric-only. Usegenerate({ type: 'numeric' })for the previous numeric-only behavior.CnpjGeneratorOptionPrefixInvalidException. Newtypeoption:'numeric'|'alphabetic'|'alphanumeric'(default).cnpjUtils.isValid()now throwsCnpjValidatorInputTypeErrorinstead of returningfalse. Validator now accepts an optional second argumentoptions?(caseSensitive,type); default validation is alphanumeric and case-sensitive.CnpjUtilsclass and re-exportscnpjFmt,cnpjGen,cnpjValand all their classes/options/errors. The default export is still aCnpjUtilsinstance, but that instance now carries those re-exports on its object (e.g.cnpjUtils.CnpjFormatter). Code that assumed a minimal default (onlyformat,generate,isValid) or specific tree-shaking surface may need updates.New features
typeandcaseSensitive.CnpjUtilsclass: Construct with optionalCnpjUtilsSettingsInput(formatter,generator,validatoras options objects or instances). Instance hasformat(),generate(),isValid()and getters/setters forformatter,generator,validator.cnpjFmt,CnpjFormatter,cnpjGen,CnpjGenerator,cnpjVal,CnpjValidator, options classes, and exception classes fromcnpj-utilswithout depending on the three packages directly.encodeoption: Whentrue, the formatted CNPJ is URL-encoded (e.g. for query params or paths).Improvements
cnpj-fmt,cnpj-gen, andcnpj-val.cnpj-utilsbehavior and options now fully reflect the v3 APIs of@lacussoft/cnpj-fmt,@lacussoft/cnpj-gen, and@lacussoft/cnpj-val.Patch Changes
@lacussoft/cnpj-val@3.0.0
Major Changes
dbe306d: ### 🎉 v3 at a glance 🎊
type('numeric'|'alphanumeric', default'alphanumeric').CnpjValidatorlets you set default options once and reuse them;isValid(cnpjInput, options?)accepts optional per-call overrides. ThecnpjVal()helper remains for one-off usage.typeandcaseSensitiveoptions — Control validation mode:typerestricts to digits only or allows letters;caseSensitive(defaulttrue) determines whether lowercase letters are accepted for alphanumeric CNPJ.CnpjValidatorInputTypeError,CnpjValidatorOptionsTypeError,CnpjValidatorOptionTypeInvalidException) for invalid input type or options; invalid CNPJ data still returnsfalsewithout throwing.stringorstring[](formatted or raw); non-alphanumeric characters are stripped according totype.BREAKING CHANGES
cnpjVal(cnpjInput)andCnpjValidator#isValid(cnpjInput)now throwCnpjValidatorInputTypeErrorwhencnpjInputis not a string or array of strings (e.g. passing a number). In v2, such calls likely returnedfalseor had unspecified behavior; they now fail fast with a typed error.cnpjVal(cnpjInput, options?)accepts an optional second argument. Existing one-argument calls remain valid; code that relied on a second argument being ignored or oncnpjValhaving a single parameter in its type signature may need to be updated.CnpjValidator,CnpjValidatorOptions, exception classes, and types alongside the defaultcnpjVal. If you depended on the package exposing only a single default function or on a specific export surface, update your imports or bundler config.false). Usetype: 'numeric'for numeric-only validation andcaseSensitive: falseto accept lowercase letters. Numeric-only CNPJ strings behave the same as in v2 when passed as a string.false.New features
type: 'numeric'restricts to digits-only (legacy behavior).CnpjValidatorclass: Reusable validator with default options;isValid(cnpjInput, options?)supports per-call option overrides. Constructor accepts a plain options object or aCnpjValidatorOptionsinstance (used by reference when passed).CnpjValidatorOptionsclass: Options with getters/setters (caseSensitive,type),set()for bulk updates, and constructor merge (defaultOptions?, ...overrides). Read-onlyallgetter returns a frozen snapshot. Static defaults:DEFAULT_CASE_SENSITIVE,DEFAULT_TYPE.CnpjValidatorTypeError(base for type errors),CnpjValidatorInputTypeError,CnpjValidatorOptionsTypeError,CnpjValidatorException(base for option value exceptions),CnpjValidatorOptionTypeInvalidException. Invalid option values (e.g.type: 'invalid') throw; invalid CNPJ data (wrong length, bad check digits, ineligible base/branch) still returnsfalse.CnpjInputisstring | string[]; array of strings is joined and validated like a single string.Improvements
@lacussoft/cnpj-dvfor check-digit verification; ineligible base/branch or repeated digits result infalse(no throw).cnpjVal,CnpjValidator,CnpjValidatorOptions,CNPJ_LENGTH, exception classes, and types; CJS/UMD default export iscnpjValwith the same members on its namespace.Patch Changes
@lacussoft/cpf-dv@1.0.0
Major Changes
fbe56e2: ### 🚀 Stable Version Released!
Utility class to calculate check digits on CPF (Brazilian individual taxpayer ID). Main features:
@lacussoft/utilsFor detailed usage and API reference, see the README.
Patch Changes
@lacussoft/cpf-fmt@3.0.0
Major Changes
2023f36: ### 🎉 v3 at a glance 🎊
CpfFormatterlets you set default options once and reuse them;format()accepts string or array of strings.dotKey,dashKey,hiddenKey,hiddenStart,hiddenEnd) plusescape,encode, andonFail.CpfFormatterInputTypeError,CpfFormatterInputLengthException, options errors) for clearer error handling.BREAKING CHANGES
cpfFmt()helper, but the main programmable API is theCpfFormatterclass. You can create an instance with default options and callformat()without passing options every time.delimiters.dotis nowdotKeydelimiters.dashis nowdashKeyhiddenRange.startis nowhiddenStarthiddenRange.endis nowhiddenEndhiddenKeyandescapekeep the same names.encode(URL-encode output).(value, error?)and the return value is used as the formatted result.nullorundefinednow falls back to the existing value (constructor or default) instead of causing runtime issues.New features
encodeoption: Whentrue, the formatted CPF is URL-encoded (e.g. for query parameters or paths).CpfFormatterTypeError,CpfFormatterInputTypeError,CpfFormatterOptionsTypeError) and validation/range errors (CpfFormatterException,CpfFormatterInputLengthException,CpfFormatterOptionsHiddenRangeInvalidException,CpfFormatterOptionsForbiddenKeyCharacterException). Failures can still be handled via theonFailcallback without throwing.Improvements
html-escaper,deepmerge, andnum-only; in-house HTML escaping and option handling. It only depends on internal package@lacussoft/utilsnow.Patch Changes
@lacussoft/cpf-gen@3.0.0
Major Changes
e812b8d: ### 🎉 v3 at a glance 🎊
CpfGeneratorlets you set default options once and reuse them;generate()accepts optional per-call options. ThecpfGen()helper remains for one-off usage.CpfGeneratorOptionswith getters/setters,set()for bulk updates, and constructor merge; read-onlyallgetter for a frozen snapshot.CpfGeneratorOptionsTypeError,CpfGeneratorOptionPrefixInvalidException) for invalid option types and prefix validation.999999999).BREAKING CHANGES
cpfGen()helper, but the main programmable API is theCpfGeneratorclass. You can create an instance with default options and callgenerate()without passing options every time. When aCpfGeneratorOptionsinstance is passed to the constructor, it is used by reference; mutating it affects futuregenerate()calls.CpfGeneratorOptionPrefixInvalidException(e.g. base all zeros, or 9 repeated digits). Option type errors (e.g. non-stringprefix) throwCpfGeneratorOptionsTypeError. Code that relied on the previous behavior or on generic errors may need to catch these exceptions.nullorundefinedwhen usingCpfGeneratorOptionsfalls back to the existing value (constructor or default) instead of causing runtime issues.New features
CpfGeneratorclass: Constructor accepts optional default options (plain object orCpfGeneratorOptions).generate(options?)returns a valid CPF; per-call options override instance defaults for that call only.optionsgetter returns the default options instance (mutations affect futuregenerate()calls).CpfGeneratorOptionsclass: Reusable options with getters/setters forformatandprefix, andset()for bulk updates; supports constructor merge and overrides. Static defaults:DEFAULT_FORMAT,DEFAULT_PREFIX. Read-onlyallgetter returns a frozen snapshot.CpfGeneratorTypeError(base for option type errors),CpfGeneratorOptionsTypeError,CpfGeneratorException(base for rule errors),CpfGeneratorOptionPrefixInvalidException.CPF_LENGTH(11) andCPF_PREFIX_MAX_LENGTH(9); typesCpfGeneratorOptionsInput,CpfGeneratorOptionsType,Nullable<T>.Improvements
@lacussoft/cpf-dvfor check-digit calculation. Invalid sequences (e.g. after prefix) trigger retry until a valid CPF is produced.cpfGen,CpfGenerator,CpfGeneratorOptions, constants (CPF_LENGTH,CPF_PREFIX_MAX_LENGTH), exception classes, and types; CJS/UMD default export iscpfGenwith the same members on its namespace.Patch Changes
cpf-utils@3.0.0
Major Changes
beb126e: ### 🎉 v3 at a glance 🎊
CpfUtilsclass with optional default formatter, generator, and validator (options or instances); default export remains a pre-built instance for one-off use.delimiters.dot→dotKey,delimiters.dash→dashKey,hiddenRange.start/end→hiddenStart/hiddenEnd. Newencodeoption for URL-encoding.@lacussoft/cpf-fmt,@lacussoft/cpf-gen, and@lacussoft/cpf-valare re-exported; you can useCpfFormatter,CpfGenerator,CpfValidatorand the helperscpfFmt,cpfGen,cpfValdirectly fromcpf-utils.BREAKING CHANGES
format,generate,isValidremoved: The package no longer exports standaloneformat,generate, andisValidfunctions. Use the default instance (cpfUtils.format(),cpfUtils.generate(),cpfUtils.isValid()) or import the helperscpfFmt,cpfGen,cpfValfor one-off calls. Code that didimport { format, generate, isValid } from 'cpf-utils'must switch toimport cpfUtils from 'cpf-utils'and callcpfUtils.format()etc., or useimport { cpfFmt, cpfGen, cpfVal } from 'cpf-utils'.@lacussoft/cpf-fmtv3). Nested option shapes are no longer supported:delimiters.dotis nowdotKeydelimiters.dashis nowdashKeyhiddenRange.startis nowhiddenStarthiddenRange.endis nowhiddenEndonFailcallback signature may differ (e.g. receives(value, exception)); return value is still used as the result when input length ≠ 11.cpfUtils.isValid()now throwsCpfValidatorInputTypeErrorinstead of returningfalseor unspecified behavior. Valid CPF data (wrong length, ineligible base, bad check digits) still returnsfalsewithout throwing.CpfGeneratorOptionPrefixInvalidException. Option type errors (e.g. non-stringprefix) throwCpfGeneratorOptionsTypeError.CpfUtilsclass and re-exportscpfFmt,cpfGen,cpfValand all their classes, options, errors, and types. Code that assumed only a minimal default (onlyformat,generate,isValidmethods) or a specific tree-shaking surface may need updates.New features
CpfUtilsclass: Construct with optionalCpfUtilsSettingsInput(formatter,generator,validatoras options objects or instances ofCpfFormatter/CpfGenerator/CpfValidator). Instance hasformat(),generate(),isValid()and getters/setters forformatter,generator,validator.cpfFmt,CpfFormatter,cpfGen,CpfGenerator,cpfVal,CpfValidator, options classes, and exception classes fromcpf-utilswithout depending on the three packages directly.encodeoption: Whentrue, the formatted CPF is URL-encoded (e.g. for query params or paths).Improvements
cnpj-utils,cpf-fmt,cpf-gen, andcpf-val.cpf-utilsbehavior and options now fully reflect the v3 APIs of@lacussoft/cpf-fmt,@lacussoft/cpf-gen, and@lacussoft/cpf-val.Patch Changes
@lacussoft/cpf-val@3.0.0
Major Changes
ffb9078: ### 🎉 v3 at a glance 🎊
CpfValidatorfor reusable validation;isValid(cpfInput)returnstrue/false. ThecpfVal(cpfInput)helper remains for one-off usage.stringorreadonly string[](formatted or raw); non-numeric characters are stripped before validation.CpfValidatorInputTypeError; invalid CPF data (wrong length, ineligible base, bad check digits) still returnsfalsewithout throwing.cpfVal,CpfValidator,CPF_LENGTH, exception classes, and types; uses@lacussoft/cpf-dvfor check-digit verification.BREAKING CHANGES
cpfVal(cpfInput)andCpfValidator#isValid(cpfInput)throwCpfValidatorInputTypeErrorwhencpfInputis not a string or array of strings (e.g.cpfVal(123),cpfVal(null)). In v2, such calls had unspecified behavior; they now fail fast with a typed error.CpfValidator,CPF_LENGTH,CpfValidatorTypeError,CpfValidatorInputTypeError,CpfValidatorException, andCpfInput. Code that assumed only a default export or a specific bundle surface may need to be updated.New features
CpfValidatorclass:new CpfValidator()withisValid(cpfInput); no options (CPF is numeric-only).CpfInputisstring | readonly string[]; array of strings is joined and validated like a single string.CpfValidatorTypeError(base),CpfValidatorInputTypeError(invalid input type),CpfValidatorException(base for future use). Invalid CPF values still returnfalse.Improvements
@lacussoft/cpf-dv; ineligible base (e.g. repeated digits) or wrong length yieldsfalse(no throw).Patch Changes
@lacussoft/utils@1.0.0
Major Changes
a152328: Reusable JavaScript/TypeScript utilities for LacusSolutions' packages. This major release establishes the public API:
describeType(value)— Returns human-readable type strings for error messages (primitives,NaN,Infinity, arrays likenumber[]or(number | string)[], empty arrays, and plain objects).escapeHTML(value)— Escapes&,<,>,",'with HTML entities for safe output and XSS mitigation.generateRandomSequence(size, type)— Generates random sequences of given length;typeis'numeric'(0–9),'alphabetic'(A–Z), or'alphanumeric'(0–9, A–Z). Exported type:SequenceType.Named exports and a default object export; ESM, CommonJS, and UMD builds; zero dependencies; full TypeScript declarations. For installation, usage, and API details, see the package README.
Summary by CodeRabbit
Release Notes