Skip to content

Migrate to TypeScript source with Node test runner#1

Merged
rjrodger merged 6 commits intomainfrom
claude/update-ini-plugin-tR1HV
Mar 10, 2026
Merged

Migrate to TypeScript source with Node test runner#1
rjrodger merged 6 commits intomainfrom
claude/update-ini-plugin-tR1HV

Conversation

@rjrodger
Copy link
Contributor

Summary

Refactored the project build system and testing infrastructure by migrating from compiled JavaScript sources to TypeScript sources with proper build output directories, and replaced Jest with Node's native test runner.

Key Changes

  • Source Organization: Moved TypeScript source from root ini.ts to src/ini.ts with compiled output to dist/ directory
  • Test Framework Migration: Replaced Jest with Node's native test and describe from node:test module
  • Test Assertion Library: Switched from Jest's expect().toEqual() to @hapi/code's expect().equal() API
  • Build Configuration:
    • Updated tsconfig.json to output to dist/ with proper rootDir and outDir settings
    • Added separate test/tsconfig.json for test compilation to dist-test/
    • Removed Jest configuration (jest.config.js)
  • Package.json Updates:
    • Updated main entry point from ini.js to dist/ini.js
    • Updated types entry point to dist/ini.d.ts
    • Removed browser field (no longer using minified builds)
    • Updated test scripts to use Node's test runner with source maps enabled
    • Simplified build and clean scripts
    • Updated dev dependencies (removed Jest, added @hapi/code and @types/node)
  • Cleanup: Removed compiled JavaScript artifacts (ini.js, ini.min.js, *.map, *.d.ts from root) and Jest configuration
  • CI/CD: Removed Coveralls integration from GitHub Actions workflow

Implementation Details

  • Tests now run with node --enable-source-maps --test for better debugging experience
  • TypeScript compilation uses tsc --build for incremental builds
  • Source maps are preserved for both source and test code
  • Target updated to ES2021 for better modern JavaScript support

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5

claude added 6 commits March 10, 2026 16:16
- Move source to src/ directory with project references (tsc --build)
- Switch from Jest to Node.js built-in test runner with @hapi/code
- Output compiled files to dist/ and dist-test/ directories
- Update package.json: main/types point to dist/, files includes src/dist
- Remove minified version (ini.min.js) and browser field
- Remove esbuild, es-jest, jest, prettier devDependencies
- Add @hapi/code and @types/node devDependencies
- Update .gitignore to exclude dist/, dist-test/, *.tsbuildinfo
- Remove Coveralls step from CI workflow

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
- Change node-version matrix from [18.x, 20.x, 22.x] to [24.x]
- Update actions/checkout from v2 to v4
- Update actions/setup-node from v1 to v4

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
Multiline values require a custom lex matcher (order 8.4e6) that runs
before Hoover's endofline block, because newlines terminate values at
the lex level and cannot be handled in the parser.

Options via `multiline` (boolean or object):
- continuation: char before newline indicating continuation (default '\\')
- indent: when true, indented continuation lines extend the value

The matcher replicates Hoover endofline behavior (escapes, trimming,
comment termination) and adds continuation/indent handling. It only
activates in value context during rule open state, matching the same
conditions as Hoover's endofline block (parent 'pair'/'elem', state 'o').

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
New `section.duplicate` option controls behavior when the same section
header appears multiple times:
- 'merge' (default): combine keys from all occurrences, last value wins
- 'override': last section occurrence replaces earlier ones entirely
- 'error': throw when a previously declared section header reappears

Tracks explicitly declared section paths per parse call using a Set
(cleared on each parse). Intermediate paths created by nested sections
like [a.b] do NOT count as declared [a] sections, so [a.b] followed
by [a] does not trigger an error.

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
Tests cover enabling Jsonic's number lexer via post-config so numeric
INI values are parsed as actual numbers: integers, floats, scientific
notation, hex, mixed types with strings, values in sections, and
arrays. Also verifies the default behavior (numbers as strings).

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
…d escaping

Inline comments are now off by default (breaking change). The new
comment.inline option controls:
- active: whether inline comments are enabled (default: false)
- chars: which characters trigger inline comments (default: ['#', ';'])
- escape.backslash: allow \; and \# to produce literals (default: true)
- escape.whitespace: require whitespace before comment char (default: false)

The custom value lex matcher is now also registered when whitespace-prefix
detection is needed (not just for multiline), handling the case where
Hoover's fixed end tokens can't express "preceded by whitespace" logic.

https://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5
@rjrodger rjrodger merged commit bc1e8c0 into main Mar 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants