{"id":14982021,"url":"https://github.com/gulpjs/vinyl-sourcemap","last_synced_at":"2025-05-08T21:34:59.074Z","repository":{"id":10908232,"uuid":"67447464","full_name":"gulpjs/vinyl-sourcemap","owner":"gulpjs","description":"Add/write sourcemaps to/from Vinyl files.","archived":false,"fork":false,"pushed_at":"2023-04-06T00:43:39.000Z","size":157,"stargazers_count":16,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-27T13:40:09.010Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gulpjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["gulpjs","phated","yocontra"],"tidelift":"npm/gulp","open_collective":"gulpjs"}},"created_at":"2016-09-05T19:57:47.000Z","updated_at":"2025-01-05T11:03:29.000Z","dependencies_parsed_at":"2022-08-07T06:00:50.115Z","dependency_job_id":"b88e1579-39f6-4ed8-b5c5-bce3452d99f8","html_url":"https://github.com/gulpjs/vinyl-sourcemap","commit_stats":{"total_commits":81,"total_committers":8,"mean_commits":10.125,"dds":0.09876543209876543,"last_synced_commit":"03cc1aa2f8020ff4af4f1610d07217eea71efc59"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fvinyl-sourcemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fvinyl-sourcemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fvinyl-sourcemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fvinyl-sourcemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gulpjs","download_url":"https://codeload.github.com/gulpjs/vinyl-sourcemap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252665725,"owners_count":21785141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:04:39.508Z","updated_at":"2025-05-08T21:34:58.973Z","avatar_url":"https://github.com/gulpjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gulpjs","https://github.com/sponsors/phated","https://github.com/sponsors/yocontra","https://tidelift.com/funding/github/npm/gulp","https://opencollective.com/gulpjs"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://gulpjs.com\"\u003e\n    \u003cimg height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# vinyl-sourcemap\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]\n\nAdd/write sourcemaps to/from Vinyl files.\n\n## Usage\n\n```js\nsourcemap.add(file, function (err, updatedFile) {\n  // updatedFile will have a .sourceMap property\n});\n\n// The 2nd argument can be given as a path string\nsourcemap.write(file, './maps', function (err, updatedFile, sourcemapFile) {\n  // sourcemapFile will be a Vinyl file to be written to some location\n  // updatedFile will have the .contents property updated with a sourceMappingURL that resolves to sourcemapFile\n});\n\n// If not defined, the sourcemap is inlined\nsourcemap.write(file, function (err, updatedFile, sourcemapFile) {\n  // sourcemapFile is undefined\n  // updatedFile will have the .contents property updated with a sourceMappingURL that is an inlined sourcemap\n});\n```\n\n## API\n\n### `sourcemap.add(file, callback)`\n\nTakes a [Vinyl][vinyl] `file` object and a `callback` function. It attempts to parse an inline sourcemap or load an external sourcemap for the file. If a valid sourcemap is found, the `sources` \u0026 `sourcesContent` properties are resolved to actual files (if possible) and a fully resolved sourcemap is attached as `file.sourceMap`. If a sourcemap is not found, a stub sourcemap is generated for the file and attached as `file.sourceMap`.\n\nOnce all resolution is complete, the `callback(err, updatedFile)` is called with the `updatedFile`. If an error occurs, it will be passed as `err` and `updatedFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience.\n\nIf the `file` is not a Vinyl object or the contents are streaming, an Error will be passed to the `callback`.\n\nIf the `file` has a `.sourceMap` property or the contents are null, the `callback` will be called immediately without mutation to the file.\n\nAll filesystem operations are optional \u0026 non-fatal so any errors will not be bubbled to the `callback`.\n\n### `sourcemap.write(file, [outputPath,] callback)`\n\nTakes a [Vinyl][vinyl] `file` object, (optionally) an `outputPath` string and a `callback` function.\n\nIf `outputPath` is not passed, an inline sourcemap will be generated from the `file.sourceMap` property and appended to the `file.contents`. Once the inline sourcemap is appended, the `callback(err, updatedFile)` is called with the `updatedFile`. If an error occurs, it will be passed as `err` and `updatedFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience.\n\nIf `outputPath` is passed, a new Vinyl file will be generated using `file.cwd` and `file.base` from the original file, the path to the external sourcemap, and the `file.sourceMap` (as contents). The external location will be appended to the `file.contents` of the original file. Once the new file is created and location appended, the `callback(err, updatedFile, sourcemapFile)` is called with the `updatedFile` and the `sourcemapFile`. If an error occurs, it will be passed as `err` and `updatedFile`/`sourcemapFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience.\n\nIf the `file` is not a Vinyl object or the contents are streaming, an Error will be passed to the `callback`.\n\nIf the `file` doesn't have a `.sourceMap` property or the contents are null, the `callback` will be called immediately without mutation to the file.\n\n## License\n\nMIT\n\n\u003c!-- prettier-ignore-start --\u003e\n[downloads-image]: https://img.shields.io/npm/dm/vinyl-sourcemap.svg?style=flat-square\n[npm-url]: https://npmjs.com/package/vinyl-sourcemap\n[npm-image]: https://img.shields.io/npm/v/vinyl-sourcemap.svg?style=flat-square\n\n[ci-url]: https://github.com/gulpjs/vinyl-sourcemap/actions?query=workflow:dev\n[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/vinyl-sourcemap/dev.yml?branch=master\u0026style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl-sourcemap\n[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl-sourcemap/master.svg?style=flat-square\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[vinyl]: https://github.com/gulpjs/vinyl\n\u003c!-- prettier-ignore-end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Fvinyl-sourcemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgulpjs%2Fvinyl-sourcemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Fvinyl-sourcemap/lists"}