| [9af201e] | 1 | # resolve package - session notes
|
|---|
| 2 |
|
|---|
| 3 | ## Versioning
|
|---|
| 4 | - Manual versioning only - do NOT use `npm version`
|
|---|
| 5 | - Edit package.json version directly, commit with message `v{version}`, then create annotated tag
|
|---|
| 6 | - Changelog lives in git tag annotations, not a separate file
|
|---|
| 7 | - Tag format: `git tag -a v{version} -m "{changelog}"`
|
|---|
| 8 |
|
|---|
| 9 | ## Code style
|
|---|
| 10 | - `__proto__: null` on ALL object literals (prototype pollution protection)
|
|---|
| 11 | - `.slice()` not `.substring()`
|
|---|
| 12 | - One exported function per file
|
|---|
| 13 | - Move nested/inner functions to module level when feasible
|
|---|
| 14 | - Prefer non-hoisted declarations (function declarations at module level, not expressions)
|
|---|
| 15 | - No mutation - copy objects instead of modifying inputs
|
|---|
| 16 |
|
|---|
| 17 | ## Testing
|
|---|
| 18 | - `test/list-exports` is a git submodule with sparse checkout
|
|---|
| 19 | - Tests should cover ALL entrypoints from fixtures, not just `'.'` subpaths
|
|---|
| 20 | - Use `extensions: ['.js', '.json']` when testing exports resolution
|
|---|
| 21 |
|
|---|
| 22 | ## exports field implementation
|
|---|
| 23 | - Uses `node-exports-info` for category semantics
|
|---|
| 24 | - Categories: pre-exports, broken, conditions, patterns, pattern-trailers, current
|
|---|
| 25 | - `exportsCategory` option or `engines: true` to auto-detect from consumer's engines.node
|
|---|
| 26 | - Self-reference resolution respects node_modules boundaries
|
|---|