{"name":"@one-ini/wasm","version":"0.2.2","keywords":["editorconfig","ini","parser","ast"],"license":"MIT","_id":"@one-ini/wasm@0.2.2","maintainers":[{"name":"florianb","email":"florian.neumann@mindkeeper.solutions"},{"name":"hildjj","email":"joe-github@cursive.net"}],"homepage":"https://github.com/one-ini/core#readme","bugs":{"url":"https://github.com/one-ini/core/issues"},"dist":{"shasum":"a27743b11b48c72085e035b8b30675ff9777c615","tarball":"http://registry-npm.ywwl.com/@one-ini/wasm/download/@one-ini/wasm-0.2.2.tgz","fileCount":6,"integrity":"sha512-zDYAKD+//+H5TANBg0YMZgrc84uxnv8jWFEf3lN8cYHr/nt5cxrr6cz0QFtUEK2Y0W6gb9aS1bu9JiQaKN2qpA==","signatures":[{"sig":"MEUCICex4TICSyoNKi7aJlRZyk0lAjNSi70LmUiIEiRFW38KAiEArLHR8r0+vMmeGo+RT2HIhcQANMqAkwjUE7jCKCQV27Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIBbMzx8lecJ3Bh1y4R0Nce9rz0aV7S2jW6F/VrXWPJylAiEAm8pdcW2lS0dx7BAcwrehHcP92x0hcCoEK9WY2J9oVCQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@one-ini%2fwasm@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":102179,"size":40137,"noattachment":false,"key":"/@one-ini/wasm/-/@one-ini/wasm-0.2.2.tgz"},"main":"one_ini.js","types":"one_ini.d.ts","gitHead":"419db04af776d85e5c5b75b06684c01d7937d210","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"461fdff2-caae-4bb5-9372-99938c7997f1"}},"repository":{"url":"git+https://github.com/one-ini/core.git","type":"git"},"_npmVersion":"11.20.0","description":"Parse EditorConfig-INI file contents into AST","directories":{},"_nodeVersion":"26.12.1","collaborators":["Jed Mao <jedmao@outlook.com>","Joe Hildebrand <joe-github@cursive.net>","Florian Neumann <florian.neumann@mindkeeper.solutions>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wasm_0.2.2_1792986372865_0.730625692986479","host":"s3://npm-registry-packages-npm-production"},"readme":"# One INI\n\nThe core implementation of an AST based, idiomatic INI parser which aims to provide an easy to implement and consistent INI-standard.\n\nThis reference implementation is provided as Rust-library and WASM-package.\n\n<!-- markdownlint-disable -->\n\n[![GitHub Actions](https://github.com/jedmao/editorconfig-ini/workflows/Rust/badge.svg?event=push)](https://github.com/jedmao/editorconfig-ini/actions)\n\n<!-- markdownlint-restore -->\n\n<!-- markdownlint-disable commands-show-output -->\n\nThe work on this project started with the search for an universal parser for the [EditorConfig INI file format specification](https://spec.editorconfig.org/#file-format).\n\n## Development setup\n\nInstall Rust via rustup and Node.js 26 (including npm), then run:\n\n```sh\ncargo setup\n```\n\nThis installs `wasm-pack` for WASM builds and `cargo-tarpaulin` for coverage.\nCargo uses the toolchain, components, and WASM target from `rust-toolchain.toml`.\nThe `--locked` install uses each tool's published lockfile; tool versions are not pinned.\n\n## WASM\n\nTo use from [Web Assembly](https://webassembly.org/), compile with:\n\n```sh\nwasm-pack build --release --target nodejs\n```\n\nand run the (limited) WASM tests with:\n\n```sh\nwasm-pack test --node\n```\n\nYou can call the generated JS wrapper with either:\n\n```js\nimport { parse_to_json } from './pkg/one_ini.js'\n\nconst results = parse_to_json(`\nroot = true\n\n[*]\n# always use unix line endings\nend_of_line = lf\n`)\n\n// {\n//   \"version\": \"0.1.0\",\n//   \"body\": [\n//     { \"type\": \"Pair\", \"key\": \"root\", \"value\": \"true\" },\n//     {\n//       \"type\": \"Section\",\n//       \"name\": \"*\",\n//       \"body\": [\n//         { \"type\": \"Comment\", \"indicator\": \"#\", \"value\": \"always use unix line endings\" },\n//         { \"type\": \"Pair\", \"key\": \"end_of_line\", \"value\": \"lf\" }\n//       ]\n//     }\n//   ]\n// }\n```\n\nor:\n\n```js\nimport { parse_to_uint32array, TokenTypes } from './pkg/editorconfig_ini.js'\nconst buf = Buffer.from(`\nroot = true\n\n[*]\n# always use unix line endings\nend_of_line = lf\n`, 'utf8')\nconst ary = parse_to_uint32array(buf)\n\n// Array with token type, start byte offset, end byte offset for each token\n// Uint32Array(21) [\n//   TokenTypes.Key, 1, 5,\n//   TokenTypes.Value, 8, 12,\n//   TokenTypes.Section, 15, 16,\n//   TokenTypes.CommentIndicator, 18, 19,\n//   TokenTypes.CommentValue, 20, 48,\n//   TokenTypes.Key, 49, 60,\n//   TokenTypes.Value, 63, 65\n// ]\n```\n\n## Development\n\nTo get started with local development you will need some Rust tooling.\n\nRustup will install all language specific toolings for Rust, the cargo command installs the WASM-specific helpers.\n\n```\nrustup toolchain install stable\ncargo setup\n```\n\n\n## WASM memory reuse check\n\nFollowing a memory leak report (thanks @onmax), this minimal test checks memory\nreuse on subsequent calls to `parse_to_json` and `parse_to_uint32array`.\n\nBuild a fresh release package and run the Node.js tests:\n\n```sh\nwasm-pack build --release --scope one-ini --target nodejs\nnode --test --test-reporter=tap tests/wasm-memory.cjs\n```\n\nEach parse export gets a fresh WASM instance and the same input containing 128\npairs with index-prefixed keys and values. After 100 warm-up calls, the test checks\nthat another 100 calls do not grow linear memory. Results are discarded. TAP output\nincludes the before/after memory sizes, and memory growth fails the test.\n\nContinued growth flags a potential leak. Stable memory demonstrates reuse for\nthis workload, but cannot exclude every leak. Freed WASM allocations are reusable;\nlinear memory is not expected to shrink. This check measures WASM memory only.\n","publish_time":1792986372939,"_cnpm_publish_time":1792986372939,"dist-tags":{"latest":"0.2.3"}}