{"id":17922578,"url":"https://github.com/rreverser/gulp-wrap-js","last_synced_at":"2025-08-04T09:32:42.091Z","repository":{"id":22024818,"uuid":"25351001","full_name":"RReverser/gulp-wrap-js","owner":"RReverser","description":"Gulp plugin for templating JavaScript code with source maps support.","archived":false,"fork":false,"pushed_at":"2020-09-03T01:17:35.000Z","size":214,"stargazers_count":20,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-13T22:26:24.957Z","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/RReverser.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-17T09:48:16.000Z","updated_at":"2023-08-25T09:38:56.000Z","dependencies_parsed_at":"2022-08-18T13:42:25.741Z","dependency_job_id":null,"html_url":"https://github.com/RReverser/gulp-wrap-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RReverser/gulp-wrap-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fgulp-wrap-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fgulp-wrap-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fgulp-wrap-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fgulp-wrap-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RReverser","download_url":"https://codeload.github.com/RReverser/gulp-wrap-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fgulp-wrap-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268675515,"owners_count":24288285,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-28T20:39:50.919Z","updated_at":"2025-08-04T09:32:41.965Z","avatar_url":"https://github.com/RReverser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-wrap-js\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]  [![Dependency Status][depstat-image]][depstat-url]\n\nWhen using classic templating solutions (like Lo-Dash / Underscore templates / own regexps / etc.) for wrapping JavaScript code, you're manipulating code as strings under the hood, and so losing any inner structure and location information. Such approach is used in [gulp-wrap](https://github.com/adamayres/gulp-wrap), [gulp-wrap-amd](https://github.com/phated/gulp-wrap-amd), [gulp-wrap-umd](https://github.com/phated/gulp-wrap-umd) and that's why source maps are not currently supported in any of them.\n\nIn opposite, this plugin is based on AST templating [estemplate](https://github.com/RReverser/estemplate) library, and allows to wrap your JavaScript code into given template (UMD / AMD / whatever) with preserved locations for source maps generation.\n\nCheck out [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) for detailed instructions on working with source maps enabled plugins in Gulp.\n\n## Usage\n\nFirst, install `gulp-wrap-js` as a development dependency:\n\n```shell\nnpm install --save-dev gulp-wrap-js\n```\n\nThen, add it to your `gulpfile.js`:\n\n```javascript\nvar sourcemaps = require('gulp-sourcemaps');\nvar wrapJS = require(\"gulp-wrap-js\");\n\ngulp.src(\"./src/*.js\")\n    .pipe(sourcemaps.init())\n        .pipe(wrapJS('define(function () {%= body %})'))\n    .pipe(sourcemaps.write())\n    .pipe(gulp.dest(\"./dist\"));\n```\n\n## API\n\n### wrapJS(template, format)\n\n#### template\nType: `String`  \n**Required**\n\nTemplate you wish to wrap your code with. Check out [estemplate docs](https://github.com/RReverser/estemplate#estemplatetmplstring-options-data) for all the possible substitution markers.\n\nNote that in `gulp-wrap-js` you have only `body` array of statements passed to template as data.\n\n#### format\nType: `Object`\nDefault: `escodegen.FORMAT_DEFAULTS`\n\n[escodegen](https://github.com/Constellation/escodegen/wiki/API) output `format` options.\n\n## License\n\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n\n[npm-url]: https://npmjs.org/package/gulp-wrap-js\n[npm-image]: https://badge.fury.io/js/gulp-wrap-js.png\n\n[travis-url]: http://travis-ci.org/RReverser/gulp-wrap-js\n[travis-image]: https://secure.travis-ci.org/RReverser/gulp-wrap-js.png?branch=master\n\n[depstat-url]: https://david-dm.org/RReverser/gulp-wrap-js\n[depstat-image]: https://david-dm.org/RReverser/gulp-wrap-js.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreverser%2Fgulp-wrap-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frreverser%2Fgulp-wrap-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreverser%2Fgulp-wrap-js/lists"}