{"name":"insert-module-globals","version":"7.2.1","description":"insert implicit module globals into a module-deps stream","main":"index.js","bin":{"insert-module-globals":"bin/cmd.js"},"dependencies":{"JSONStream":"^1.0.3","acorn-node":"^1.5.2","combine-source-map":"^0.8.0","concat-stream":"^1.6.1","is-buffer":"^1.1.0","path-is-absolute":"^1.0.1","process":"~0.11.0","through2":"^2.0.0","undeclared-identifiers":"^1.1.2","xtend":"^4.0.0"},"devDependencies":{"browser-pack":"^6.0.0","buffer":"^4.9.1","convert-source-map":"~1.1.0","module-deps":"^4.0.2","nanobench":"^2.1.1","tape":"^4.2.0","timers-browserify":"^1.4.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/browserify/insert-module-globals.git"},"homepage":"https://github.com/browserify/insert-module-globals","keywords":["__filename","__dirname","global","process","module-deps","browser-pack","browserify"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"e164c77d6c1deb3633f396f352ffaa2dd16591b3","bugs":{"url":"https://github.com/browserify/insert-module-globals/issues"},"_id":"insert-module-globals@7.2.1","_nodeVersion":"14.13.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==","shasum":"d5e33185181a4e1f33b15f7bf100ee91890d5cb3","tarball":"http://registry-npm.ywwl.com/insert-module-globals/download/insert-module-globals-7.2.1.tgz","fileCount":45,"unpackedSize":33633,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfgEPmCRA9TVsSAnZWagAAptkP/3/y0/O/Xa1inuTjd6mX\nxL5zu/F8kSeYI1Wrr9Aepp8ZDkSme5cOx9oMU/zzqzzd63swGfvLRgAtaI6N\nnNjqbBTpwDIWUS6+12xi7sCjJ305QPe4L2xg8wGymniMQ9VrpqRgPZUEUVip\n4FxCL0DBmTkj0eFGeJyig/bKKlsMCIfvxqRjTJc89f7+coqwbhHHYT+Muu3H\ntoumb9cOam/TKkW1VOpotWPCROEy2REg5pBCQR698PdDO/7M4brVrZo4BEy9\nn32LgjcFCLNI1I8TaRKTg5LPzOQPRty4KOA/3kEfpBeGTtsiinubygOYxfk0\nPi8HmSrl6y2bzfAN2+Lncbe3hRkTa+enR+H5HIaYbSE9xo203PgQKblZS3xI\nsUdOtPrxxopUcRAUAnEodWogz/eT5TRz5Eez/1iTBEHJ8JfJcC5a2MtNCjhb\nfzS0TMk+53tlqKyO2Q/vHYJXeEbJz9FqxuXEwNxn14nUtiZhruKqDMt89Tdx\nWv9CjsVMn99pfkFkgbRlKwoTl03iyeZlP/9+ac5kjyEfhPBeBjE/bh2GbY/q\nbvertGNeVntgCsbm5jo51GV8WbGFmNRb0ZjZPyrcdGUzhJ7e3G2sl38b+hTp\nW5LH7c1JMO87jV4VzhiHPX5DwMNcghipN1Y+dMQkvKV/GyK5rt20YfOH47LP\n9fHr\r\n=FEDU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCV/+IOx2UVim0m4/S5+ztn+rwd5uWbED38AoDwlxpUOwIhAJjIJyYswB05mFU0fGQwfx5c41EokciZ+dPnaFIYVlE0"}],"size":9742,"noattachment":false,"key":"/insert-module-globals/-/insert-module-globals-7.2.1.tgz"},"maintainers":[{"name":"lukechilds","email":"lukechilds123@gmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"},{"name":"substack","email":"substack@gmail.com"},{"name":"feross","email":"feross@feross.org"},{"name":"gkatsev","email":"me@gkatsev.com"},{"name":"zertosh","email":"zertosh@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"maxogden","email":"max@maxogden.com"},{"name":"dominictarr","email":"dominic.tarr@gmail.com"},{"name":"thlorenz","email":"thlorenz10@gmail.com"},{"name":"terinjokes","email":"terinjokes@gmail.com"},{"name":"jmm","email":"npm-public@jessemccarthy.net"},{"name":"mellowmelon","email":"palmermebane@gmail.com"},{"name":"ashaffer88","email":"darawk@gmail.com"},{"name":"balupton","email":"b@lupton.cc"},{"name":"cwmma","email":"calvin.metcalf@gmail.com"},{"name":"jprichardson","email":"jprichardson@gmail.com"},{"name":"indutny","email":"fedor@indutny.com"},{"name":"jryans","email":"jryans@gmail.com"},{"name":"sethvincent","email":"sethvincent@gmail.com"},{"name":"yoshuawuyts","email":"yoshuawuyts@gmail.com"},{"name":"ungoldman","email":"ungoldman@gmail.com"},{"name":"ahdinosaur","email":"michael.williams@enspiral.com"},{"name":"elnounch","email":"contact@elnounch.net"},{"name":"parshap","email":"parshap+npm@gmail.com"},{"name":"yerkopalma","email":"yerko.palma@usach.cl"},{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"leichtgewicht","email":"martin.heidegger@gmail.com"},{"name":"garann","email":"garann@gmail.com"},{"name":"bret","email":"bcomnes@gmail.com"},{"name":"anandthakker","email":"vestibule@anandthakker.net"},{"name":"mattdesl","email":"dave.des@gmail.com"},{"name":"hughsk","email":"hughskennedy@gmail.com"},{"name":"fpereira1","email":"pereira.filype@gmail.com"},{"name":"goto-bus-stop","email":"renee@kooi.me"},{"name":"bpostlethwaite","email":"post.ben.here@gmail.com"},{"name":"emilbayes","email":"github@tixz.dk"},{"name":"stevemao","email":"maochenyan@gmail.com"},{"name":"pkrumins","email":"peteris.krumins@gmail.com"},{"name":"tehshrike","email":"me@JoshDuff.com"}],"_npmUser":{"name":"goto-bus-stop","email":"renee@kooi.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/insert-module-globals_7.2.1_1602241509757_0.6194225072435611"},"_hasShrinkwrap":false,"readme":"# insert-module-globals\n\ninsert implicit module globals\n(`__filename`, `__dirname`, `process`, `global`, `setImmediate`, `clearImmediate` and `Buffer`)\nas a browserify-style transform\n\n[![build status](https://secure.travis-ci.org/browserify/insert-module-globals.png)](http://travis-ci.org/browserify/insert-module-globals)\n\n# example\n\n``` js\nvar mdeps = require('module-deps');\nvar bpack = require('browser-pack');\nvar insert = require('insert-module-globals');\nfunction inserter (file) {\n    return insert(file, { basedir: __dirname + '/files' });\n}\n\nvar files = [ __dirname + '/files/main.js' ];\nmdeps(files, { transform: inserter })\n    .pipe(bpack({ raw: true }))\n    .pipe(process.stdout)\n;\n```\n\n```\n$ node example/insert.js | node\nin main.js: {\"__filename\":\"/main.js\",\"__dirname\":\"/\"}\nin foo/index.js: {\"__filename\":\"/foo/index.js\",\"__dirname\":\"/foo\"}\n```\n\nor use the command-line scripts:\n\n```\n$ module-deps main.js | insert-module-globals | browser-pack | node\nin main.js: {\"__filename\":\"/main.js\",\"__dirname\":\"/\"}\nin foo/index.js: {\"__filename\":\"/foo/index.js\",\"__dirname\":\"/foo\"}\n```\n\nor use insert-module-globals as a transform:\n\n```\n$ module-deps main.js --transform insert-module-globals | browser-pack | node\nin main.js: {\"__filename\":\"/main.js\",\"__dirname\":\"/\"}\nin foo/index.js: {\"__filename\":\"/foo/index.js\",\"__dirname\":\"/foo\"}\n```\n\n# methods\n\n``` js\nvar insertGlobals = require('insert-module-globals')\n```\n\n## var inserter = insertGlobals(file, opts)\n\nReturn a transform stream `inserter` for the filename `file` that will accept a\njavascript file as input and will output the file with a closure around the\ncontents as necessary to define extra builtins.\n\nWhen `opts.always` is true, wrap every file with all the global variables\nwithout parsing. This is handy because parsing the scope can take a long time,\nso you can prioritize fast builds over saving bytes in the final output. When\n`opts.always` is truthy but not true, avoid parsing but perform a quick test to\ndetermine if wrapping should be skipped.\n\nUse `opts.vars` to override the default inserted variables, or set\n`opts.vars[name]` to `undefined` to not insert a variable which would otherwise\nbe inserted.\n\n`opts.vars` properties with a `.` in their name will be executed instead of the\nparent object if ONLY that property is used. For example, `\"Buffer.isBuffer\"`\nwill mask `\"Buffer\"` only when there is a `Buffer.isBuffer()` call in a file and\nno other references to `Buffer`.\n\nIf `opts.debug` is true, an inline source map will be generated to compensate\nfor the extra lines.\n\n# events\n\n## inserter.on('global', function (name) {})\n\nWhen a global is detected, the inserter stream emits a `'global'` event.\n\n# usage\n\n```\nusage: insert-module-globals {basedir}\n```\n\n# install\n\nWith [npm](https://npmjs.org), to get the library do:\n\n```\nnpm install insert-module-globals\n```\n\nand to get the bin script do:\n\n```\nnpm install -g insert-module-globals\n```\n\n# insert custom globals.\n\n`insert-module-globals` can also insert arbitary globals into files.\nPass in an object of functions as the `vars` option.\n\n``` js\nvar vars = {\n    process: function (file, basedir) {\n        return {\n            id: \"path/to/custom_process.js\",\n            source: customProcessContent\n        }\n    },\n    Buffer: function (file, basedir) {\n        return {\n            id: 'path/to/custom_buffer.js',\n            source: customProcessContent,\n            //suffix is optional\n            //it's used to extract the value from the module.\n            //it becomes: require(...).Buffer in this case.\n            suffix: '.Buffer'\n        }\n    },\n    Math: function () {\n        //if you return a string,\n        //it's simply set as the value.\n        return '{}'\n        //^ any attempt to use Math[x] will throw!\n    }\n}\n\nfunction inserter (file) {\n    return insert(file, { vars: vars });\n}\nmdeps(files, { transform: inserter })\n    .pipe(bpack({ raw: true }))\n    .pipe(process.stdout)\n```\n\n\n# license\n\nMIT\n","publish_time":1602241509855,"_cnpm_publish_time":1602241509855,"dist-tags":{"latest":"7.2.1"}}