{"name":"@jscpd/tokenizer","version":"4.1.0","author":{"name":"Andrey Kucherenko","email":"kucherenko.andrey@gmail.com"},"license":"MIT","_id":"@jscpd/tokenizer@4.1.0","maintainers":[{"name":"apk","email":"kucherenko.andrey@gmail.com"}],"homepage":"https://github.com/kucherenko/jscpd#readme","bugs":{"url":"https://github.com/kucherenko/jscpd/issues"},"dist":{"shasum":"8315906b9dd8c77549bafb3d4a208a3aa26de636","tarball":"http://registry-npm.ywwl.com/@jscpd/tokenizer/download/@jscpd/tokenizer-4.1.0.tgz","fileCount":9,"integrity":"sha512-eYQun9bMOcSj14C7uH3QDkkQqIogRem+UqFYLuyt6UqJ+PrXJJkoa+gRTICqyY/xH73HsXy0BPNhGMsi3wTMGg==","signatures":[{"sig":"MEQCIDtncAkcRrosWJPaGYzxC27IyFoyy0SGu9X4pwgjLH1PAiA7b4eXljrOFdA3oUAQrrx4dc4GfuxSEW7QHXsOj2RUfA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":118142,"size":23984,"noattachment":false,"key":"/@jscpd/tokenizer/-/@jscpd/tokenizer-4.1.0.tgz"},"main":"dist/index.js","_from":"file:jscpd-tokenizer-4.1.0.tgz","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./README.md":"./README.md"},"gitHead":"beaae8ee77d5c7f41d2a0c65187887bd0dc87148","scripts":{"dev":"nodemon","test":"vitest run","build":"tsup-node --dts","cleanup":"rimraf ./dist .turbo","test:dev":"vitest","typecheck":"tsc"},"typings":"dist/index.d.mts","_npmUser":{"name":"apk","email":"kucherenko.andrey@gmail.com"},"_resolved":"/private/var/folders/rh/82vm3q314snd3ymwr5n577_00000gp/T/99f66f764590ffa92ffcf83dac1a10d4/jscpd-tokenizer-4.1.0.tgz","_integrity":"sha512-eYQun9bMOcSj14C7uH3QDkkQqIogRem+UqFYLuyt6UqJ+PrXJJkoa+gRTICqyY/xH73HsXy0BPNhGMsi3wTMGg==","repository":{"url":"git+ssh://git@github.com/kucherenko/jscpd.git","type":"git"},"_npmVersion":"11.11.0","description":"tokenizer of source code for jscpd","directories":{"lib":"src","test":"__tests__"},"_nodeVersion":"25.8.1","dependencies":{"prismjs":"^1.30.0","@jscpd/core":"4.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","vitest":"^2.0.5","nodemon":"^3.1.4","typescript":"^5.5.4","@types/node":"^22.5.2","@types/prismjs":"^1.26.6","@jscpd/tsconfig":"5.1.0"},"_npmOperationalInternal":{"tmp":"tmp/tokenizer_4.1.0_1778351019518_0.7973354324457846","host":"s3://npm-registry-packages-npm-production"},"readme":"# `@jscpd/tokenizer`\n\n> Tokenizer package for [@jscpd](https://github.com/kucherenko/jscpd) — converts source code into a list of tokens for duplicate detection.\n\nSupports **223 programming languages and formats** via a self-contained [reprism](https://github.com/tannerlinsley/reprism)-based grammar engine. Grammars are loaded lazily for fast startup, with O(n) hot paths for high-throughput scanning.\n\nSpecial tokenization modes handle multi-language files:\n\n- **Vue SFC** (`.vue`) — `<template>`, `<script>`, and `<style>` blocks each tokenized by their own language\n- **Svelte** (`.svelte`) — per-block tokenization for HTML, JS, and CSS sections\n- **Astro** (`.astro`) — frontmatter and template blocks tokenized independently\n- **Markdown** (`.md`) — fenced code blocks tokenized by the declared language\n\nThis enables cross-format clone detection: a `<script lang=\"ts\">` block in a `.vue` file can match a plain `.ts` file.\n\n## Installation\n\n```bash\nnpm install @jscpd/tokenizer --save\n```\n\n## Usage\n\n```typescript\nimport { IOptions, ITokensMap } from '@jscpd/core';\nimport { Tokenizer } from '@jscpd/tokenizer';\n\nconst tokenizer = new Tokenizer();\nconst options: IOptions = {};\n\nconst maps: ITokensMap[] = tokenizer.generateMaps('source_id', 'let a = \"11\"', 'javascript', options);\n```\n\n## Supported formats\n\nThe full list of 223 supported formats is available in [FORMATS.md](../../FORMATS.md) at the repository root, or at runtime:\n\n```bash\njscpd --list\n```\n\n\n## License\n\n[MIT](LICENSE) © Andrey Kucherenko\n","publish_time":1778351019666,"_cnpm_publish_time":1778351019666,"dist-tags":{"canary":"3.3.0-alpha.8","latest":"4.2.6","rc":"4.0.0"}}