{"_id":"@ciolabs/html-preserve-comment-whitespace","_rev":"4-2b3867f3c49f91bef46913dc4bd8ad3d","name":"@ciolabs/html-preserve-comment-whitespace","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.0":{"name":"@ciolabs/html-preserve-comment-whitespace","version":"0.0.0","author":{"name":"Customer.io","email":"win@customer.io"},"license":"MIT","_id":"@ciolabs/html-preserve-comment-whitespace@0.0.0","maintainers":[{"name":"ami-ci","email":"engineering@customer.io"}],"homepage":"https://github.com/customerio/ciolabs/tree/main/packages/html-preserve-comment-whitespace#readme","bugs":{"url":"https://github.com/customerio/ciolabs/issues"},"dist":{"shasum":"4a56145a86aafe4efcb35eaf392b6801d25d0ffe","tarball":"https://registry.npmjs.org/@ciolabs/html-preserve-comment-whitespace/-/html-preserve-comment-whitespace-0.0.0.tgz","fileCount":9,"integrity":"sha512-os3gNjfBgOXfAHbLgpI/1bbib47qh/sAL/usxuLq9ctQKZ63tgknsJfHQrxZ1pk9mkcTkA4trOwHzr43yyG/fw==","signatures":[{"sig":"MEUCIQD7s3Cve5k9QFD9dSsBzit5DzsTRbWafzIMR34qkf0vlAIgGfH6BAdKvKEVF/S1THQYy1KldbHSkkko+6oG8iWDxIM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29882},"main":"./dist/index.js","_from":"file:ciolabs-html-preserve-comment-whitespace-0.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"ami-ci","email":"engineering@customer.io"},"_resolved":"/tmp/38cb1d61b4f52a5047a37c8c19987f73/ciolabs-html-preserve-comment-whitespace-0.0.0.tgz","_integrity":"sha512-os3gNjfBgOXfAHbLgpI/1bbib47qh/sAL/usxuLq9ctQKZ63tgknsJfHQrxZ1pk9mkcTkA4trOwHzr43yyG/fw==","repository":{"url":"git+https://github.com/customerio/ciolabs.git","type":"git","directory":"packages/html-preserve-comment-whitespace"},"_npmVersion":"10.8.2","description":"Preserves the presence or lack thereof of whitespace surrounding HTML comments","directories":{},"_nodeVersion":"18.20.8","dependencies":{"magic-string":"^0.30.8"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-preserve-comment-whitespace_0.0.0_1758215070455_0.2767059775857299","host":"s3://npm-registry-packages-npm-production"}},"0.0.1":{"name":"@ciolabs/html-preserve-comment-whitespace","version":"0.0.1","author":{"name":"Customer.io","email":"win@customer.io"},"license":"Apache-2.0 WITH Commons-Clause","_id":"@ciolabs/html-preserve-comment-whitespace@0.0.1","maintainers":[{"name":"ami-ci","email":"engineering@customer.io"}],"homepage":"https://github.com/customerio/ciolabs/tree/main/packages/html-preserve-comment-whitespace#readme","bugs":{"url":"https://github.com/customerio/ciolabs/issues"},"dist":{"shasum":"83165a98822feeeb183b240f37a851d368831669","tarball":"https://registry.npmjs.org/@ciolabs/html-preserve-comment-whitespace/-/html-preserve-comment-whitespace-0.0.1.tgz","fileCount":9,"integrity":"sha512-+plBdQ346hrUzVrp/lPNifkc7fJO+QvOLePDIHslGp2oduO9h56R6DFtFI/1HHVeaLXjgSgmGso5689x3NVGCg==","signatures":[{"sig":"MEYCIQCW8GLvdDCMQwsjcTqGJeDxr8C40bwExkN+RhNy60VDAgIhAPPYCmYUzU8MiQElQ8Rwbyflgrop5KKLct+N8HXKzqhn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30439},"main":"./dist/index.js","_from":"file:ciolabs-html-preserve-comment-whitespace-0.0.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"ami-ci","email":"engineering@customer.io"},"_resolved":"/tmp/408ef9684d45c403c1b646255b343a34/ciolabs-html-preserve-comment-whitespace-0.0.1.tgz","_integrity":"sha512-+plBdQ346hrUzVrp/lPNifkc7fJO+QvOLePDIHslGp2oduO9h56R6DFtFI/1HHVeaLXjgSgmGso5689x3NVGCg==","repository":{"url":"git+https://github.com/customerio/ciolabs.git","type":"git","directory":"packages/html-preserve-comment-whitespace"},"_npmVersion":"10.8.2","description":"Preserves the presence or lack thereof of whitespace surrounding HTML comments","directories":{},"_nodeVersion":"18.20.8","dependencies":{"magic-string":"^0.30.8"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-preserve-comment-whitespace_0.0.1_1758233183223_0.540476417062961","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@ciolabs/html-preserve-comment-whitespace","version":"0.0.2","author":{"name":"Customer.io","email":"win@customer.io"},"license":"Apache-2.0 WITH Commons-Clause","_id":"@ciolabs/html-preserve-comment-whitespace@0.0.2","maintainers":[{"name":"ami-ci","email":"engineering@customer.io"}],"homepage":"https://github.com/customerio/ciolabs/tree/main/packages/html-preserve-comment-whitespace#readme","bugs":{"url":"https://github.com/customerio/ciolabs/issues"},"dist":{"shasum":"10c1b207ad018cd52944de4e1d23cf602ada0eb8","tarball":"https://registry.npmjs.org/@ciolabs/html-preserve-comment-whitespace/-/html-preserve-comment-whitespace-0.0.2.tgz","fileCount":9,"integrity":"sha512-MWh4TXST1LY+dA2P4YBAssX7A1QMjTr7cki2TA3DGxUPkDETlqvF2tWsoGT6/+oEcpwNMsKNPBBBcgpRfXNp4Q==","signatures":[{"sig":"MEUCIF4Z+JZM6vQ0ac/Qh6DZmP6Bu58g+xFuKnKvW5+ZfZsNAiEA+oY9pe6kmtHHqmeAVmI30ynuuQjbiofePxDqEwiWoZ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ciolabs%2fhtml-preserve-comment-whitespace@0.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29722},"main":"./dist/index.js","_from":"file:ciolabs-html-preserve-comment-whitespace-0.0.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:cc110463-ce4f-4695-be11-e16f6e915eae"}},"_resolved":"/tmp/e6130eb9a60ff967138a3f9aee8ae66c/ciolabs-html-preserve-comment-whitespace-0.0.2.tgz","_integrity":"sha512-MWh4TXST1LY+dA2P4YBAssX7A1QMjTr7cki2TA3DGxUPkDETlqvF2tWsoGT6/+oEcpwNMsKNPBBBcgpRfXNp4Q==","repository":{"url":"git+https://github.com/customerio/ciolabs.git","type":"git","directory":"packages/html-preserve-comment-whitespace"},"_npmVersion":"11.10.0","description":"Preserves the presence or lack thereof of whitespace surrounding HTML comments","directories":{},"_nodeVersion":"20.20.0","dependencies":{"ranges-apply":"^7.0.16"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-preserve-comment-whitespace_0.0.2_1771524962006_0.4416831600378863","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@ciolabs/html-preserve-comment-whitespace","version":"0.0.3","description":"Preserves the presence or lack thereof of whitespace surrounding HTML comments","author":{"name":"Customer.io","email":"win@customer.io"},"license":"Apache-2.0 WITH Commons-Clause","repository":{"type":"git","url":"git+https://github.com/customerio/ciolabs.git","directory":"packages/html-preserve-comment-whitespace"},"homepage":"https://github.com/customerio/ciolabs/tree/main/packages/html-preserve-comment-whitespace#readme","publishConfig":{"access":"public"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"dependencies":{"ranges-apply":"^7.0.16"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","test":"vitest run"},"_id":"@ciolabs/html-preserve-comment-whitespace@0.0.3","bugs":{"url":"https://github.com/customerio/ciolabs/issues"},"_integrity":"sha512-NWoViGT3zGmU3ixxJwhO8d0Jv7qCqRbpse6gGvAolyaCvTGSTJ1K73xFGKmWhtvqJqVqE7FDROalmEsyx0kMCw==","_resolved":"/tmp/4f54b31dc5434899c5fc8fc0f388e1a7/ciolabs-html-preserve-comment-whitespace-0.0.3.tgz","_from":"file:ciolabs-html-preserve-comment-whitespace-0.0.3.tgz","_nodeVersion":"20.20.0","_npmVersion":"11.10.0","dist":{"integrity":"sha512-NWoViGT3zGmU3ixxJwhO8d0Jv7qCqRbpse6gGvAolyaCvTGSTJ1K73xFGKmWhtvqJqVqE7FDROalmEsyx0kMCw==","shasum":"369f2afa7b23f0cb5b664f0ba0bbcc926ee61c69","tarball":"https://registry.npmjs.org/@ciolabs/html-preserve-comment-whitespace/-/html-preserve-comment-whitespace-0.0.3.tgz","fileCount":9,"unpackedSize":70550,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ciolabs%2fhtml-preserve-comment-whitespace@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICMLg61WdUXr9qrbNc4tbcDO8sMr2iea6Y0Rx2fCDG7oAiBz6hUisO6+70TY+UU4LyXNqUHD54mz+hbK+S2yVeLA0g=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:cc110463-ce4f-4695-be11-e16f6e915eae"}},"directories":{},"maintainers":[{"name":"ami-ci","email":"engineering@customer.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/html-preserve-comment-whitespace_0.0.3_1771534353054_0.07025882814828432"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-18T17:04:30.375Z","modified":"2026-02-19T20:52:33.488Z","0.0.0":"2025-09-18T17:04:30.656Z","0.0.1":"2025-09-18T22:06:23.413Z","0.0.2":"2026-02-19T18:16:02.150Z","0.0.3":"2026-02-19T20:52:33.226Z"},"bugs":{"url":"https://github.com/customerio/ciolabs/issues"},"author":{"name":"Customer.io","email":"win@customer.io"},"license":"Apache-2.0 WITH Commons-Clause","homepage":"https://github.com/customerio/ciolabs/tree/main/packages/html-preserve-comment-whitespace#readme","repository":{"type":"git","url":"git+https://github.com/customerio/ciolabs.git","directory":"packages/html-preserve-comment-whitespace"},"description":"Preserves the presence or lack thereof of whitespace surrounding HTML comments","maintainers":[{"name":"ami-ci","email":"engineering@customer.io"}],"readme":"# @ciolabs/preserve-comment-whitespace\n\n> Preserves the presence or lack thereof of whitespace surrounding HTML comments.\n\nHTML formatters don't always properly handle HTML comments. This package attempts to properly maintain the whitespace around the HTML comments.\n\nSome known issues:\n\n- https://github.com/beautify-web/js-beautify/issues/1301\n- https://github.com/beautify-web/js-beautify/issues/1823\n\n## Install\n\n```\nnpm install @ciolabs/preserve-comment-whitespace\n```\n\n## Usage\n\n```js\nimport { preserve, restore } from '@ciolabs/preserve-comment-whitespace';\nimport beautify from 'js-beautify';\n\nconst html = `<div><div><!-- my html comment --></div></div>`;\n\nconst comments = preserve(html);\nconst formatted = beautify.html(html);\n//=> <div>\\n    <div>\\n        <!-- my html comment -->\\n    </div>\\n</div>\nconst formattedAndRestored = restore(formatted, comments);\n//=> <div>\\n    <div><!-- my html comment --></div>\\n</div>\n```\n\n## API\n\n### preserve(html)\n\nReturns an Array containing the objects describing the HTML comments.\n\n### restore(html, comments, options)\n\nReturns a string where the whitespace around the HTML comments is restored.\n\n**Note:** the processing between `preserve` and `restore` should not add or remove any comments. If the number of comments given don't match the number of comments found in the given HTML, `restore` will return the given string, unprocessed.\n\n#### html\n\n> `string` | required\n\nString of HTML after any formatting that would have affected the whitespace.\n\n#### comments\n\n> `CommentData[]` | defaults to `[]`\n\nThe Array returned from `preserve`.\n\n#### options\n\n> `RestoreOptions` | defaults to `{ restoreInline: true }`\n\nConfiguration for how to restore the comment whitespace.\n\nAccept `restoreInline`. If `true`, comments that were originally inline (i.e. not on their own lines) will be restored to be inline. Otherwise, it will accept the new line placement.\n\n## Types\n\n### CommentData\n\n```typescript\ninterface CommentData {\n  leadingWhitespace: string;\n  trailingWhitespace: string;\n  hasLeadingWhitespace: boolean;\n  hasTrailingWhitespace: boolean;\n}\n```\n\n### RestoreOptions\n\n```typescript\ninterface RestoreOptions {\n  restoreInline: boolean;\n}\n```\n","readmeFilename":"README.md"}