{"name":"@volar/source-map","version":"2.4.26","license":"MIT","_id":"@volar/source-map@2.4.26","maintainers":[{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"}],"homepage":"https://github.com/volarjs/volar.js#readme","bugs":{"url":"https://github.com/volarjs/volar.js/issues"},"dist":{"shasum":"b89b3663669f4eea448f8ff517b909beee354933","tarball":"http://registry-npm.ywwl.com/@volar/source-map/download/@volar/source-map-2.4.26.tgz","fileCount":11,"integrity":"sha512-JJw0Tt/kSFsIRmgTQF4JSt81AUSI1aEye5Zl65EeZ8H35JHnTvFGmpDOBn5iOxd48fyGE+ZvZBp5FcgAy/1Qhw==","signatures":[{"sig":"MEYCIQDe/FPznqJtr861pe/uY7FiD4tALrA/Gjlt+3S5mBejuQIhANURZgCpQk5uQGbA8oTA+Z2nn4pPKsShMOG9XHeBdiJ+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13793,"size":4273,"noattachment":false,"key":"/@volar/source-map/-/@volar/source-map-2.4.26.tgz"},"types":"./index.d.ts","gitHead":"4a9d25d797d08d9c149bebf0f52ac5e172f4757d","_npmUser":{"name":"johnsoncodehk","email":"johnsoncodehk@gmail.com"},"repository":{"url":"git+https://github.com/volarjs/volar.js.git","type":"git","directory":"packages/source-map"},"_npmVersion":"lerna/4.9.3/node@v24.11.1+arm64 (darwin)","description":"Provides functionality related to source maps.","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/source-map_2.4.26_1764063806168_0.07993493885055569","host":"s3://npm-registry-packages-npm-production"},"readme":"# @volar/source-map\n\nProvides functionality related to source maps.\n\n## API\n\n### This package exports a `SourceMap` class with the following methods:\n\nParams:\n\n- `fallbackToAnyMatch`(default: false): allow the start and end offsets to come from different mappings.\n- `filter?: (data: Data) => boolean)`(default: undefined):  according to mapping: Mapping<MyDataType>.data, filter out offsets that do not meet the custom conditions.\n\nMethods:\n\n- `toSourceRange(generatedStart: number, generatedEnd: number, fallbackToAnyMatch: boolean, filter?: (data: Data) => boolean)`: Returns all source start and end offsets for the given generated start and end offsets.\n\n- `toGeneratedRange(sourceStart: number, sourceEnd: number, fallbackToAnyMatch: boolean, filter?: (data: Data) => boolean) `: Returns all generated start and end offsets for the given source start and end offsets.\n\n- `toSourceLocation(generatedOffset: number, filter?: (data: Data) => boolean)`: Returns all source offsets for a given generated offset.\n\n- `toGeneratedLocation(sourceOffset: number, filter?: (data: Data) => boolean)`: Returns all generated offsets for a given source offset.\n\n## Data Structures\n\n### `Mapping`\n\nThe `Mapping` is a tuple that represents a mapping in the source map. It consists of the following elements:\n\n- `source`: A string representing the source file. This can be `undefined`.\n- `sourceOffsets`: Offsets in the source code.\n- `generatedOffsets`: Offsets in the generated code.\n- `data`: The data associated with this mapping. The type of this data is generic and can be specified when creating a `SourceMap` instance.\n\nHere is an example of a `Mapping`:\n\n```ts\nlet mapping: Mapping<MyDataType> = {\n    source: '.../sourceFile.ts',\n    sourceOffsets: [10],\n    generatedOffsets: [30],\n\tlengths: [10],\n    data: myData,\n};\n```\n\nIn this example, `myData` is of type `MyDataType`, which is the type specified for the SourceMap instance.\n\nRemember to replace `MyDataType` and `myData` with actual types and data that are relevant to your project.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","publish_time":1764063806358,"_cnpm_publish_time":1764063806358,"dist-tags":{"@volar/language-core@2.0.0-alpha.12":"2.0.0-alpha.12","latest":"2.4.31","next":"3.0.0-alpha.0"}}