Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
## Description
sizeofvar allows you to get a realistic memory size of any variable upon initialization or variable setting.

## ✨ What's New

### Latest: v1.0.13 (October 2026)

- **Dev-tooling dependency bump ([#32](https://github.com/CLDMV/sizeofvar/pull/32))** β€” `@cldmv/fix-headers` moves from 2.1.1 to 2.1.4, the tool that maintains the repository's file headers. It produced no header changes here, so only `package.json` and the lockfile changed. The `sizeofvar()` function is unchanged; it's a drop-in replacement for the previous version.
- [View full v1.0.13 Changelog](https://github.com/CLDMV/sizeofvar/blob/master/docs/changelog/v1/v1.0.13.md)

### Recent Releases

- **v1.0.12** (October 2026) β€” CI only: the in-repo PR mirror job now always runs and reports under a non-required name instead of being skipped ([Changelog](https://github.com/CLDMV/sizeofvar/blob/master/docs/changelog/v1/v1.0.12.md))
- **v1.0.11** (October 2026) β€” CI only: a skipped PR-run mirror job no longer satisfies the `βœ… Required PR Check` ruleset gate ([Changelog](https://github.com/CLDMV/sizeofvar/blob/master/docs/changelog/v1/v1.0.11.md))
- **v1.0.10** (October 2026) β€” workflows synced to the CLDMV/.github v4.29.2 templates, bundle-size workflow, shared fix-headers config (comment-only header in `sizeofvar.js`); no runtime change ([Changelog](https://github.com/CLDMV/sizeofvar/blob/master/docs/changelog/v1/v1.0.10.md))
- **v1.0.9** (September 2026) β€” vitest 5 test toolchain, a CI Node matrix of 22.12.0–26, and signed hotfix-redirector cherry-picks; no runtime change ([Changelog](https://github.com/CLDMV/sizeofvar/blob/master/docs/changelog/v1/v1.0.9.md))

πŸ“š **For complete version history and detailed release notes, see the [docs/changelog/](https://github.com/CLDMV/sizeofvar/tree/master/docs/changelog/) folder.**

## Install
```bash
npm i @cldmv/sizeofvar --save
Expand Down
30 changes: 30 additions & 0 deletions docs/changelog/v1/v1.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# sizeofvar v1.0.1 Changelog

**Release Date**: March 2018
**Release Type**: Patch

---

## Overview

First release of sizeofvar, published to npm as `@cldmv/sizeofvar` (an unscoped `sizeofvar` package was published and withdrawn the same day). It bundles everything from the initial import on 2018-03-01 through the scoping of the package to CLDMV.

---

## ✨ Features

- **`sizeofvar(value)`** estimates the V8 memory footprint of a value at initialization or assignment time. `sizeofvar.js` exports a single function that works out the type of the value (boolean, number, string, object, array) and returns a byte count using per-type base sizes.
- **Recursion** β€” objects and arrays are walked recursively; nested members are costed with their own per-type adjustments, and objects with several keys add a per-key-group overhead. Top-level values and nested values use different base sizes.
- **Numbers above 2^31** add an extra allocation, and numbers stored in arrays carry a small additional cost.
- **Memory test harness** β€” `test/test-mem.js` plus per-type scripts under `test/sizeofvar/` (array, bool, number, object, object-complex, object-key-length, object-string, string) compare the returned number against what Node reports. It is run with `node --expose-gc test/test-mem.js <command> [-v]`, where `-v` enables verbose output. The harness uses `yargs` (a dev dependency) for argument parsing.
- **Package** β€” scoped as `@cldmv/sizeofvar`, GPL-3.0, entry point `sizeofvar.js`, with a README covering install, usage and the test commands.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.1.md](./v1.0.1.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- First release; there is nothing to upgrade from. Install with `npm i @cldmv/sizeofvar --save`.
41 changes: 41 additions & 0 deletions docs/changelog/v1/v1.0.10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# sizeofvar v1.0.10 Changelog

**Release Date**: October 2026
**Release Type**: Patch

---

## Overview

A large CI and tooling sync. The only change to `sizeofvar.js` is an added comment header, so runtime behaviour is unchanged.

---

## πŸ”§ CI & tooling

### Sync with CLDMV/.github v4.29.2 templates ([#21](https://github.com/CLDMV/sizeofvar/pull/21))

Refreshes all workflow callers and adds `member-auto-merge.yml` (enables auto-merge on org members' PRs into `next`/`hotfixes`; does not approve), `pr-notify.yml`, `provenance.yml` (SLSA provenance on release) and `release-merge.yml`. `ci.yml`'s `max_node_major` now defaults to blank, inheriting the reusable workflow's default.

### Bundle-size workflow ([#22](https://github.com/CLDMV/sizeofvar/pull/22))

Adds `bundle-size.yml` (diffs `*.js` after `npm run build:ci` on PRs to `master`) and restores the full workflow list in the release-merge workflow.

### Shared fix-headers config and uniform headers ([#24](https://github.com/CLDMV/sizeofvar/pull/24))

Adds a `fix:headers` script and `.configs/fix-headers.json` extending `@cldmv/configs/fix-headers.json`, and stamps a uniform comment header onto `sizeofvar.js`, the tests and the workflow files. Comment headers only; no code changed in `sizeofvar.js`.

## πŸ”§ Dependencies

- New dev dependencies `@cldmv/configs` (`^1.2.0`) and `@cldmv/fix-headers` (`^2.1.1`).
- vitest group and patch bumps ([#18](https://github.com/CLDMV/sizeofvar/pull/18), [#19](https://github.com/CLDMV/sizeofvar/pull/19), [#25](https://github.com/CLDMV/sizeofvar/pull/25), [#26](https://github.com/CLDMV/sizeofvar/pull/26)): `vitest` and `@vitest/coverage-v8` 5.0.0 β†’ 5.0.2 in the lockfile only; `package.json` ranges stay `^5.0.0`. Dev dependencies, test/CI toolchain only.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.10.md](./v1.0.10.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.9. No runtime code changed.
28 changes: 28 additions & 0 deletions docs/changelog/v1/v1.0.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# sizeofvar v1.0.11 Changelog

**Release Date**: October 2026
**Release Type**: Patch

---

## Overview

CI-only fix to the required-check job. No runtime code changed.

---

## πŸ”§ CI & tooling

### Stop the skipped PR-run mirror from satisfying Required PR Check ([#28](https://github.com/CLDMV/sizeofvar/pull/28))

On an in-repo feature PR the `pull_request` run skipped the `βœ… Required PR Check` mirror job, and GitHub treats a skipped required check as passing, so a PR could become mergeable before the push run's tests finished. The job name became an expression so the skipped job no longer posts under the required name.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.11.md](./v1.0.11.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.10. No runtime code changed.
28 changes: 28 additions & 0 deletions docs/changelog/v1/v1.0.12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# sizeofvar v1.0.12 Changelog

**Release Date**: October 2026
**Release Type**: Patch

---

## Overview

CI-only follow-up to v1.0.11. No runtime code changed.

---

## πŸ”§ CI & tooling

### Run the in-repo PR mirror job instead of skipping it ([#30](https://github.com/CLDMV/sizeofvar/pull/30))

GitHub does not evaluate the `name:` of a skipped job, so v1.0.11's skipped job showed raw expression text. The mirror job now always runs; on the in-repo PR path it reports as `⏭️ Required PR Check (reported by the push run)` and exits as a no-op, while every status-owning path reports `βœ… Required PR Check`.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.12.md](./v1.0.12.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.11. No runtime code changed.
30 changes: 30 additions & 0 deletions docs/changelog/v1/v1.0.13.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# sizeofvar v1.0.13 Changelog

**Release Date**: October 2026
**Release Type**: Patch
**Branch**: `next` β†’ `master`

---

## Overview

A single dev-tooling dependency patch. `@cldmv/fix-headers`, which maintains the comment headers at the top of the repository's source, test, config and workflow files, moves from 2.1.1 to 2.1.4. No runtime code changed: `sizeofvar.js` is exactly as in v1.0.12, and the package still has no runtime dependencies.

The bump was made with a header restamp in mind, but fix-headers 2.1.4 produced no header changes in this repository, so the only files touched are `package.json` and `package-lock.json`.

---

## πŸ”§ Dependencies

- **`@cldmv/fix-headers` `2.1.1` β†’ `2.1.4`** ([#32](https://github.com/CLDMV/sizeofvar/pull/32)), dev dependency. The 2.1.x line no longer stamps a header into files that have no usable comment syntax (strict JSON such as `package.json`, and Markdown unless explicitly forced), never walks into `node_modules` or other dependency folders, and processes every repeated `--input` value instead of only the last. It only runs through the `fix:headers` script; nothing that ships depends on it.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.13.md](./v1.0.13.md) β€” this changelog.
- Changelogs for earlier releases that shipped without one were added in the same pass (see the [docs/changelog/](https://github.com/CLDMV/sizeofvar/tree/master/docs/changelog/) folder).

---

## Upgrade notes

- No breaking changes, and no runtime code changed. It's a drop-in replacement for v1.0.12.
22 changes: 22 additions & 0 deletions docs/changelog/v1/v1.0.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# sizeofvar v1.0.2 Changelog

**Release Date**: March 2018
**Release Type**: Patch

---

## Overview

Version-only bump. `package.json` moved from 1.0.1 to 1.0.2 and nothing else changed. There are no code changes in this release and it was not published to npm.

---

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.2.md](./v1.0.2.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes. No code changes; this version was tagged but not published to npm, so v1.0.1 β†’ v1.0.3 is the effective upgrade path.
23 changes: 23 additions & 0 deletions docs/changelog/v1/v1.0.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# sizeofvar v1.0.3 Changelog

**Release Date**: March 2018
**Release Type**: Patch

---

## Overview

Documentation fix: the README install command now uses the scoped package name. No runtime code changed.

---

## πŸ“š Documentation

- README install command changed from `npm i sizeofvar --save` to `npm i @cldmv/sizeofvar --save`.
- **NEW:** [docs/changelog/v1/v1.0.3.md](./v1.0.3.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.2. Only the README and version changed; `sizeofvar.js` is untouched.
23 changes: 23 additions & 0 deletions docs/changelog/v1/v1.0.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# sizeofvar v1.0.4 Changelog

**Release Date**: March 2018
**Release Type**: Patch

---

## Overview

Documentation fix: the README usage example now requires the scoped package name. No runtime code changed.

---

## πŸ“š Documentation

- README usage example changed from `require('sizeofvar')` to `require('@cldmv/sizeofvar')`.
- **NEW:** [docs/changelog/v1/v1.0.4.md](./v1.0.4.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.3. Only the README and version changed; `sizeofvar.js` is untouched.
47 changes: 47 additions & 0 deletions docs/changelog/v1/v1.0.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# sizeofvar v1.0.5 Changelog

**Release Date**: August 2026
**Release Type**: Patch

---

## Overview

First release through the CLDMV v4 `next` β†’ `master` release flow, and the first after a long gap: the previous release was v1.0.4 in 2018. It adds the CI/release workflows and replaces the old memory-harness scripts with a vitest suite. `sizeofvar.js` is unchanged, so runtime behaviour is identical to v1.0.4.

It also carries a 2019 README addition (a contributors section) that had never been released.

---

## πŸ”§ CI & tooling

### Adopt CLDMV @v4 workflows + vitest-runner tests ([#2](https://github.com/CLDMV/sizeofvar/pull/2))

Adds the v4 staging-branch workflow set under `.github/workflows/` (CI, publish, feature-pr, next-release, hotfixes-release, next-reset, hotfix-redirector, labeler, pr-title-normalizer, master-commit-audit, release-notify, tag-health, update-major-version-tags, v4-bootstrap, cla, codeql, scorecard, dependency-review, dependabot-auto-merge, stale, welcome, branch-retention), all thin callers of `CLDMV/.github` reusables pinned `@v4`, plus `.github/dependabot.yml`. Releases now go through the `next` β†’ `master` release PR.

### Build script stub for the coverage job ([#4](https://github.com/CLDMV/sizeofvar/pull/4))

Adds `build` and `build:ci` scripts that only echo, because the coverage-badge job runs `npm run build`. The package has no build step.

### Vitest suite replaces the memory harness ([#2](https://github.com/CLDMV/sizeofvar/pull/2))

- The old `test/test-mem.js` harness and the `test/sizeofvar/*.js` scripts are removed, replaced by vitest tests in `tests/` (arrays, booleans, edge types, numbers, objects, random properties, strings) with `.configs/vitest.config.mjs` and a `tests/run-vitest.mjs` runner.
- New scripts: `test`, `test:watch`, `coverage`, `ci:coverage`. The previous `test` script was an `echo` stub.
- The `node --expose-gc test/test-mem.js` instructions are no longer applicable.

## πŸ”§ Dependencies

- Removed the `yargs` devDependency. Its only use at the previous release (`git grep`) was argument parsing in the deleted `test/test-mem.js` harness, so nothing remained that used it.
- Added dev dependencies `@cldmv/vitest-runner`, `vitest` and `@vitest/coverage-v8` (`^4.1.10`). These affect only the test/CI toolchain, not consumers.
- Added `publishConfig.access: public`.

## πŸ“š Documentation

- README gains a Contributors section (committed in 2019, first released here).
- **NEW:** [docs/changelog/v1/v1.0.5.md](./v1.0.5.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.4. The exported function is unchanged; only repository tooling, tests and dev dependencies changed.
29 changes: 29 additions & 0 deletions docs/changelog/v1/v1.0.6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# sizeofvar v1.0.6 Changelog

**Release Date**: August 2026
**Release Type**: Patch

---

## Overview

Test-file rename. Test files move to the fleet-wide `*.test.vitest.mjs` naming convention and the vitest config and runner are updated to match. No runtime code changed.

---

## πŸ”§ CI & tooling

### Wire vitest config + runner to the new test-file suffix ([#6](https://github.com/CLDMV/sizeofvar/pull/6))

- `tests/*.test.mjs` renamed to `tests/*.test.vitest.mjs` (pure renames, contents unchanged).
- `.configs/vitest.config.mjs`, `tests/run-vitest.mjs` and the `package.json` scripts updated to the new pattern.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.6.md](./v1.0.6.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.5. No runtime code changed.
28 changes: 28 additions & 0 deletions docs/changelog/v1/v1.0.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# sizeofvar v1.0.7 Changelog

**Release Date**: August 2026
**Release Type**: Patch

---

## Overview

CI-only release. The CI concurrency rules are changed so release-relevant runs are never cancelled. No runtime code changed.

---

## πŸ”§ CI & tooling

### Never supersede release-relevant CI runs ([#8](https://github.com/CLDMV/sizeofvar/pull/8))

`ci.yml` concurrency now gives pushes to the release base branch, to `next`/`hotfixes`, and the `next`/`hotfixes` release PRs a unique concurrency group per run; feature branches still cancel superseded runs. Previously a burst of pushes during a release could cancel a pending run and leave a red cancelled check on the release PR.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.7.md](./v1.0.7.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.6. No runtime code changed.
34 changes: 34 additions & 0 deletions docs/changelog/v1/v1.0.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# sizeofvar v1.0.8 Changelog

**Release Date**: August 2026
**Release Type**: Patch

---

## Overview

Dev-dependency lockfile refresh plus a bot-identity CI fix. No runtime code changed.

---

## πŸ”§ CI & tooling

### Bot identity secrets ([#11](https://github.com/CLDMV/sizeofvar/pull/11))

`feature-pr.yml`, `next-release.yml` and `hotfixes-release.yml` pass `BOT_NAME` and `BOT_EMAIL` (from `CLDMV_BOT_NAME` / `CLDMV_BOT_EMAIL`) so bot-authored commits and PRs use the real bot identity.

## πŸ”§ Dependencies

### Patch group bump ([#10](https://github.com/CLDMV/sizeofvar/pull/10))

Lockfile-only update of the vitest toolchain's transitive packages (for example `rolldown` and `@oxc-project/types`). `package.json` ranges did not change. These are dev dependencies and only affect the test/CI toolchain.

## πŸ“š Documentation

- **NEW:** [docs/changelog/v1/v1.0.8.md](./v1.0.8.md) β€” this changelog (added retroactively).

---

## Upgrade notes

- No breaking changes β€” drop-in for v1.0.7. No runtime code changed.
Loading
Loading