An audit of the last commit found two real problems and several claims of mine that went further than the evidence. **cereale/min was not tree-shakable.** scripts/build-bundle.mjs used esbuild's `minify: true`, whose minifyWhitespace pass strips comments — /*#__PURE__*/ annotations included. The published entry point therefore reproduced exactly the bug the previous commit fixed: one decorator came out at 5,066 bytes with all 26 unrelated rule messages, against 1,837 from the per-module entry. Every source-level check stayed green, because they all bundled src/ and the annotations are stripped on the way into dist/. It is now minified for syntax and identifiers but not whitespace: 33.9 KB raw and 9.6 KB gzipped against 26.0/8.7, so about a kilobyte over the wire for a file that behaves correctly however it is used. One decorator via cereale/min is now 1,996 bytes. The build asserts the annotation count survives, and treeshake.test.ts now bundles the published artifact as well as the source — the gap that let this through. **sideEffects was partly inert.** `./dist/cjs/metadata.js` could never match: the build writes dist/cjs/package.json, which becomes the nearest descriptor for everything beneath it, so bundlers read sideEffects from there. That file now carries its own declaration. `./src/metadata.ts` was missing while src/ is published, which declared the Symbol.metadata install droppable in the source tree. Five module-scope caches in utils.ts are annotated for the same reason as the rules. I checked the audit's third blocker — that the Symbol.metadata install is dropped by bundlers — and it is not. It survives every case where it is load-bearing (a decorator import, toPlainSync, modelOf, and a decorated model bundled with an app). It is dropped only when importing nothing but flattenErrors, which needs no metadata, so that is correct. Corrections to my own wording: - "all three bundlers land within 20 bytes" held only for the one-decorator row; larger imports differ by up to a few hundred bytes - "measured through three bundlers, and pinned by a test" read as though the test covered all three; it covers esbuild, on source and on dist - "every rule is a top-level call" — 30 of the 68 are - the docs page "loads nothing from the network" — it fetches its own vendored compiler, same-origin, on first Run. It has no third-party dependencies, which is the claim I should have made - cereale/min's size, everywhere it appears Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SAcqrz3FcadkYr3xG32CjK
96 lines
2.8 KiB
JSON
96 lines
2.8 KiB
JSON
{
|
|
"name": "cereale",
|
|
"version": "0.4.0",
|
|
"description": "Strongly typed JSON mapping and validation for TypeScript classes \u2014 validated domain objects, not validated data. A zero-dependency replacement for class-validator + class-transformer, on TC39 standard decorators.",
|
|
"type": "module",
|
|
"main": "./dist/cjs/index.js",
|
|
"module": "./dist/esm/index.js",
|
|
"types": "./dist/esm/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/esm/index.d.ts",
|
|
"import": "./dist/esm/index.js",
|
|
"require": "./dist/cjs/index.js"
|
|
},
|
|
"./vite": {
|
|
"types": "./dist/esm/vite.d.ts",
|
|
"import": "./dist/esm/vite.js",
|
|
"require": "./dist/cjs/vite.js"
|
|
},
|
|
"./min": {
|
|
"types": "./dist/esm/index.d.ts",
|
|
"default": "./dist/cereale.min.js"
|
|
}
|
|
},
|
|
"sideEffects": [
|
|
"./dist/esm/metadata.js",
|
|
"./dist/cereale.min.js",
|
|
"./src/metadata.ts"
|
|
],
|
|
"files": [
|
|
"dist",
|
|
"src",
|
|
"FRAMEWORKS.md",
|
|
"CHANGELOG.md",
|
|
"!src/**/*.test.ts",
|
|
"!src/example.ts"
|
|
],
|
|
"scripts": {
|
|
"build": "rm -rf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && node scripts/build-bundle.mjs",
|
|
"build:docs": "node scripts/build-docs.mjs",
|
|
"demo": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/example.ts",
|
|
"type-check": "tsc --noEmit",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:coverage": "vitest run --coverage",
|
|
"lint": "eslint .",
|
|
"lint:fix": "eslint . --fix",
|
|
"verify": "npm run type-check && npm run lint && npm run test && npm run build && npm run check:types && npm run check:docs",
|
|
"prepublishOnly": "npm run verify",
|
|
"check:docs": "node scripts/check-docs.mjs",
|
|
"check:types": "node scripts/check-types.mjs"
|
|
},
|
|
"engines": {
|
|
"node": ">=20.0.0"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/avalon-vanguard/cereale.git"
|
|
},
|
|
"keywords": [
|
|
"json",
|
|
"validation",
|
|
"decorators",
|
|
"standard-decorators",
|
|
"typescript",
|
|
"dto",
|
|
"serialization",
|
|
"class-validator",
|
|
"class-transformer",
|
|
"class-validator-alternative"
|
|
],
|
|
"author": "Avalon Vanguard",
|
|
"license": "MIT",
|
|
"bugs": {
|
|
"url": "https://github.com/avalon-vanguard/cereale/issues"
|
|
},
|
|
"homepage": "https://avalon-vanguard.github.io/cereale/",
|
|
"devDependencies": {
|
|
"@babel/standalone": "^8.0.4",
|
|
"@eslint/js": "^10.0.1",
|
|
"@swc/core": "^1.15.47",
|
|
"@types/node": "^25.6.0",
|
|
"@vitest/coverage-v8": "^4.1.4",
|
|
"esbuild": "^0.25.0",
|
|
"eslint": "^10.2.1",
|
|
"globals": "^17.5.0",
|
|
"ts-node": "^10.9.2",
|
|
"typescript": "^6.0.2",
|
|
"typescript-eslint": "^8.58.2",
|
|
"vitest": "^4.1.4"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public"
|
|
}
|
|
}
|