{"id":22423274,"url":"https://github.com/prantlf/gulp-sourcemaps-identity","last_synced_at":"2025-03-27T05:40:33.518Z","repository":{"id":54464124,"uuid":"522318081","full_name":"prantlf/gulp-sourcemaps-identity","owner":"prantlf","description":"Gulp plugin for adding identity mappings to source maps with no mappings, handling JavaScript sources.","archived":false,"fork":false,"pushed_at":"2022-08-07T20:55:28.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T03:35:52.003Z","etag":null,"topics":["gulp-plugin","gulpplugin","identity","source-maps","sourcemaps"],"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/prantlf.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}},"created_at":"2022-08-07T20:31:51.000Z","updated_at":"2023-03-19T18:45:49.000Z","dependencies_parsed_at":"2022-08-13T16:30:32.417Z","dependency_job_id":null,"html_url":"https://github.com/prantlf/gulp-sourcemaps-identity","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgulp-sourcemaps-identity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgulp-sourcemaps-identity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgulp-sourcemaps-identity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgulp-sourcemaps-identity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/gulp-sourcemaps-identity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245025436,"owners_count":20549064,"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":["gulp-plugin","gulpplugin","identity","source-maps","sourcemaps"],"created_at":"2024-12-05T18:09:51.997Z","updated_at":"2025-03-27T05:40:33.498Z","avatar_url":"https://github.com/prantlf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-sourcemaps-identity\n\n[![Latest version](https://img.shields.io/npm/v/gulp-sourcemaps-identity)\n ![Dependency status](https://img.shields.io/librariesio/release/npm/gulp-sourcemaps-identity)\n](https://www.npmjs.com/package/gulp-sourcemaps-identity)\n[![Code coverage](https://codecov.io/gh/prantlf/gulp-jsonlint/branch/master/graph/badge.svg)](https://codecov.io/gh/prantlf/gulp-sourcemaps-identity)\n\n\u003e [Gulp] plugin for adding identity mappings to source maps with no mappings, handling JavaScript sources.\n\nSome gulp plugins may have troubles processing a source, which was just read from a file and not generated by a transpiler. The source map mappings will be empty in such case. This plugin will replace the empty string with mappings pointing every token to its original location. It will ensure *identity mappings*, but only *if no mappings have been included* and only *for JavaScript sources*.\n\n## Usage\n\nFirst, install `gulp-sourcemaps-identity` as a development dependency:\n\n```sh\nnpm i -D gulp-sourcemaps-identity\n```\n\nThen, add it to your `gulpfile.js`:\n\n```js\nimport gulp from 'gulp'\nimport sourcemaps from 'gulp-sourcemaps'\nimport { ensureMappings } from 'gulp-sourcemaps-identity'\n\ngulp\n  .src('src/**/*.js')\n  .pipe(sourcemaps.init())\n  .pipe(ensureMappings())\n  .pipe(sourcemaps.write('../dist', {\n    includeContent: false,\n    sourceRoot: '../dist'\n  }))\n  .pipe(gulp.dest('dist'))\n```\n\n## API\n\n### ensureMappings(options)\n\nOptions may be passed as properties in an object to the `jsonlint` function. The following are their defaults:\n\n```js\nensureMappings({\n  filter: undefined,\n  verbose: false\n})\n```\n\n* `filter`: when set to a function, if the function returns `true`, the file and its source map will be processed, otherwise they will be skipped\n* `verbose`: when set to `true`, status of each processed file will be printed on the console, otherwise only warnings and errors will be printed\n\n```js\n// if sources include various types, process only scripts\nfilter(file) {\n  return file.relative.endsWith('.js')\n}\n```\n\n## Contributing\n\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.\n\n## License\n\nCopyright (C) 2022 Ferdinand Prantl\n\nLicensed under the [MIT License].\n\n[MIT License]: http://en.wikipedia.org/wiki/MIT_License\n[Gulp]: http://gulpjs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgulp-sourcemaps-identity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Fgulp-sourcemaps-identity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgulp-sourcemaps-identity/lists"}