{"id":17472682,"url":"https://github.com/shinnn/inline-source-map-comment","last_synced_at":"2025-04-09T23:00:23.177Z","repository":{"id":21518220,"uuid":"24837360","full_name":"shinnn/inline-source-map-comment","owner":"shinnn","description":"Create an inline source map comment from a source map object or string","archived":false,"fork":false,"pushed_at":"2016-07-16T12:19:43.000Z","size":35,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T00:51:21.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-10-06T07:34:39.000Z","updated_at":"2020-04-19T15:30:33.000Z","dependencies_parsed_at":"2022-08-17T17:25:07.141Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/inline-source-map-comment","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Finline-source-map-comment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Finline-source-map-comment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Finline-source-map-comment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Finline-source-map-comment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/inline-source-map-comment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247721950,"owners_count":20985079,"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-10-18T17:33:40.086Z","updated_at":"2025-04-09T23:00:22.899Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inline-source-map-comment\n\n[![NPM version](https://img.shields.io/npm/v/inline-source-map-comment.svg)](https://www.npmjs.com/package/inline-source-map-comment)\n[![Bower version](https://img.shields.io/bower/v/inline-source-map-comment.svg)](https://github.com/shinnn/inline-source-map-comment/releases)\n[![Build Status](https://travis-ci.org/shinnn/inline-source-map-comment.svg?branch=master)](https://travis-ci.org/shinnn/inline-source-map-comment)\n[![Build status](https://ci.appveyor.com/api/projects/status/57fmdhy41qainu8g?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/inline-source-map-comment)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/inline-source-map-comment.svg?label=cov)](https://coveralls.io/r/shinnn/inline-source-map-comment)\n[![Dependency Status](https://img.shields.io/david/shinnn/inline-source-map-comment.svg?label=deps)](https://david-dm.org/shinnn/inline-source-map-comment)\n[![devDependency Status](https://img.shields.io/david/shinnn/inline-source-map-comment.svg?label=devDeps)](https://david-dm.org/shinnn/inline-source-map-comment#info=devDependencies)\n\nCreate an inline source map comment from a source map object or string\n\n```javascript\nvar inlineSourceMapComment = require('inline-source-map-comment');\n\nvar fixture = {\n  version:3,\n  file: 'output.js.map',\n  sources: ['input.js'],\n  names: [],\n  mappings: 'AAAA'\n};\n\ninlineSourceMapComment(fixture);\n//=\u003e \"//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza ...\"\n```\n\n## Installation\n\n### Package managers\n\n#### [npm](https://www.npmjs.com/)\n\n```sh\nnpm install inline-source-map-comment\n```\n\n#### [bower](http://bower.io/)\n\n```sh\nbower install inline-source-map-comment\n```\n\n#### [Duo](http://duojs.org/)\n\n```javascript\nvar inlineSourceMapComment = require('shinnn/inline-source-map-comment');\n```\n\n### Standalone\n\n[Download the script file directly.](https://raw.githubusercontent.com/shinnn/inline-source-map-comment/master/inline-source-map-comment.js)\n\n## API\n\n### inlineSourceMapComment(*sourceMap* [, *options*])\n\n*sourceMap*: `String` or `Object`  \n*options*: `Object`  \nReturn: `String`\n\nIt returns a line comment of [base64](https://wikipedia.org/wiki/Base64)-encoded [source map](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k).\n\nArgument can be an object of source map or a JSON string.\n\n```javascript\nvar map = '{\"version\":3,\"file\":\"a.js.map\",\"sources\":[\"b.js\"],\"names\":[],\"mappings\":\"AAAA\"}';\n\ninlineSourceMapComment(map);\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI ... \"\n\ninlineSourceMapComment(JSON.parse(map));\n//=\u003e (Same as `inlineSourceMapComment.js(map)`)\n```\n\nIt automatically removes `sourcesContent` property from result. Use [`sourcesContent` option](#optionssourcescontent) if you want to preserve `sourcesContent` property.\n\n```javascript\nvar map = '{\"version\":3,\"file\":\"foo.js.map\",\"sources\":[\"bar.js\"], ...';\nvar one = inlineSourceMapComment(map);\n\nmap.sourcesContent = 'foo';\nvar another inlineSourceMapComment(map);\n\none === another; //=\u003e true\n```\n\n#### options.block\n\nType: `Boolean`  \nDefault: `false`\n\nReturns a block comment instead of a line comment. It can be used for creating CSS source maps.\n\n```javascript\nvar map = '{\"version\":3,\"file\":\"foo.css.map\",\"sources\":[\"bar.js\"], ...';\n\ninlineSourceMapComment(map, {block: true});\n//=\u003e \"/* sourceMappingURL=data:application/json;base64,eyJ2ZXJ ... */\"\n```\n\n#### options.sourcesContent\n\nType: `Boolean`  \nDefault: `false`\n\nPreserves the `sourcesContent` property.\n\n### inlineSourceMapComment.prefix\n\nType: `String`\n\nA common part of a Base64-encoded source map comment.\n\n```javascript\ninlineSourceMapComment.prefix;\n//=\u003e \"# sourceMappingURL=data:application/json;base64,\"\n```\n\n## CLI\n\nYou can use this module as a CLI tool by installing it [globally](https://docs.npmjs.com/files/folders#global-installation).\n\n```sh\nnpm install -g inline-source-map-comment\n```\n\n### Usage\n\n```sh\nUsage1: inline-source-map-comment \u003csource map string\u003e\nUsage2: inline-source-map-comment --in \u003csource map file\u003e\nUsage3: cat \u003csource map file\u003e | inline-source-map-comment\n\nOptions:\n--block, --css,    -b, -c  Print a block comment instead of line comment\n--sources-content, -s      Preserve sourcesContent property\n--in, --input,     -i      Use a JSON file as a source\n--help,            -h      Print usage information\n--version,         -v      Print version\n```\n\n## License\n\nCopyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Finline-source-map-comment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Finline-source-map-comment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Finline-source-map-comment/lists"}