Migrate to TypeScript source with Node test runner#1
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ini.tstosrc/ini.tswith compiled output todist/directorytestanddescribefromnode:testmoduleexpect().toEqual()to@hapi/code'sexpect().equal()APItsconfig.jsonto output todist/with properrootDirandoutDirsettingstest/tsconfig.jsonfor test compilation todist-test/jest.config.js)mainentry point fromini.jstodist/ini.jstypesentry point todist/ini.d.tsbrowserfield (no longer using minified builds)@hapi/codeand@types/node)ini.js,ini.min.js,*.map,*.d.tsfrom root) and Jest configurationImplementation Details
node --enable-source-maps --testfor better debugging experiencetsc --buildfor incremental buildshttps://claude.ai/code/session_014bMuvf21f6AjmdEPgzvdr5