{"_id":"babel-plugin-file-loader","_rev":"4-f8c79080921998ad953f8909010dbe72","name":"babel-plugin-file-loader","description":"Like file-loader for webpack, but for Babel. Works with SSE apps.","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"babel-plugin-file-loader","version":"1.0.0","description":"Like file-loader for webpack, but for Babel. Works with SSE apps.","main":"lib/index.js","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir lib","clean":"rimraf lib coverage .nyc_output","coverage":"cross-env NODE_ENV=test nyc report --reporter=lcov","coveralls":"cross-env NODE_ENV=test nyc report --reporter=text-lcov | coveralls","lint":"eslint --ext js src test/**/*.spec.*","test":"cross-env NODE_ENV=test npm run test:run","test:run":"nyc --reporter=text-summary mocha 'test/**/*.spec.js'","test:watch":"npm run test -- -- --watch"},"repository":{"type":"git","url":"git+https://github.com/sheerun/babel-plugin-file-loader.git"},"keywords":["nextjs","babel","import","loader","static","images","cdn","sse","isomorphic"],"author":{"name":"Adam Stankiewicz","email":"sheerun@sher.pl"},"license":"MIT","bugs":{"url":"https://github.com/sheerun/babel-plugin-file-loader/issues"},"homepage":"https://github.com/sheerun/babel-plugin-file-loader#readme","devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^8.0.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.0","coveralls":"^2.13.1","cross-env":"^5.0.0","eslint":"^4.1.0","mocha":"^3.4.2","nyc":"^11.0.2","rimraf":"^2.6.2"},"dependencies":{"big.js":"^5.0.3","fs-extra":"^4.0.2"},"gitHead":"927dff362cafdc390b6684117f4081666ba7dd15","_id":"babel-plugin-file-loader@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"sheerun","email":"sheerun@sher.pl"},"dist":{"integrity":"sha512-ndSkCQH+K+ISJdEA6EAd59haGBQUD9n/5EwOMw90oF35Hsd7/2q45cSAIhGGMdefxT8LB9U9UNOmDfI3AfKFqQ==","shasum":"f50bab610deae3e4154fe7c4fd10e4eb3b19b17c","tarball":"https://registry.npmjs.org/babel-plugin-file-loader/-/babel-plugin-file-loader-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/Nke6VoznmC1Cls5PTfYSb1K4JYYgFcpDIK8rlgz/RgIhAKDXqHAgIF3C/xvOtG9jvgOcMPUprRVQcbOaSafY+O3h"}]},"maintainers":[{"name":"sheerun","email":"sheerun@sher.pl"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-file-loader-1.0.0.tgz_1512076723456_0.7340688444674015"},"directories":{}},"1.1.0":{"name":"babel-plugin-file-loader","version":"1.1.0","description":"Like file-loader for webpack, but for Babel. Works with SSE apps.","main":"lib/index.js","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir lib","clean":"rimraf lib coverage .nyc_output","coverage":"cross-env NODE_ENV=test nyc report --reporter=lcov","coveralls":"cross-env NODE_ENV=test nyc report --reporter=text-lcov | coveralls","lint":"eslint --ext js src test/**/*.spec.*","test":"cross-env NODE_ENV=test npm run test:run","test:run":"nyc --reporter=text-summary mocha 'test/**/*.spec.js'","test:watch":"npm run test -- -- --watch"},"repository":{"type":"git","url":"git+https://github.com/sheerun/babel-plugin-file-loader.git"},"keywords":["nextjs","babel","import","loader","static","images","cdn","sse","isomorphic"],"author":{"name":"Adam Stankiewicz","email":"sheerun@sher.pl"},"license":"MIT","bugs":{"url":"https://github.com/sheerun/babel-plugin-file-loader/issues"},"homepage":"https://github.com/sheerun/babel-plugin-file-loader#readme","devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^8.0.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.0","coveralls":"^2.13.1","cross-env":"^5.0.0","eslint":"^4.1.0","mocha":"^3.4.2","nyc":"^11.0.2","rimraf":"^2.6.2"},"dependencies":{"big.js":"^5.0.3","fs-extra":"^4.0.2","mime":"^2.0.3"},"gitHead":"2c9af5ea1716becb9fcc1a93eedf9e530f73a954","_id":"babel-plugin-file-loader@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"sheerun","email":"sheerun@sher.pl"},"dist":{"integrity":"sha512-+2z2tvmMsY1OyKCkY4xv+BNybHbuWxn5On/uu6qFaL+vwZnKlSSrkdK2ZMKyH/Qi8x8jwrKOvRXAjbAiWH1KNg==","shasum":"92a37061d92dac1acaced9ec4e1d96c088fdffa3","tarball":"https://registry.npmjs.org/babel-plugin-file-loader/-/babel-plugin-file-loader-1.1.0.tgz","fileCount":9,"unpackedSize":53886,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbp3u+CRA9TVsSAnZWagAAdPMP/0n8C1bCtu3kmE3dVTrs\nYAmOLHDAnO3Pmb9VYpAvmTETMlEKHUtFroWsc56ZEPAXuYQX3qEAs3YOfdJp\nR0dyHVKz2/83m6ZVLjjUKC3iRUsLha4+wEA7hbQzh/KnWo6WBZERP/C1gcFE\nsoF15MgYR7CJML3q3NS6OVkfbW2HFZ+hgr6insyF5UZ++M1YsTUDq34OY+Vp\n3mIqgBBTdrrV1Y2LKFHbdpU/DOKgLBgZ5Zc0Gx1mK5kzD0fOdGzdzFD0lam2\noz6feknxdny3ZKqXp2psGTjcl5m/tskHQv5fRGRBngZlw7BVdPbwyiEqa37h\nMEWjZwOKWhHHjBiVwy9nK84HaZM5JRMWa8I4K/3GgiQMuLua7Ti//dZS4Pip\nXt7QxuLy06few057MeEdgwP68UmIxW8ZgGy+mWgZo/PX6bl2lSDUbrqXebkS\nVTNkxmYt1zRMIjpb7tsnY06aoyKu3e15jJRzea+9dfEP8+yq5jdt9hCxs1fC\ndJ0TPK+JEqdwVxqM0p8h/wgFcrJLpq/nmjKM8Y/O4CKXVAvmecdGRhVoBI5v\nIsoNzuKaMgmavZvV9Lqc8pSCq3wtUQkcgfED5OjWQYngwEDgdDtCcJuwylwR\nZgKtVCSw1jJeEIfb/an6k7qf5oaxunD3/UL78X1Abf/nEzLHcBDugRF0YleR\nKlhl\r\n=/5VO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKRjk00He7I+ROQlW7alCLNO1VIkD2oUvZc9KX3OEPLwIhAJ76QyFd4n7xAo2QDYF3CekegK5T0CwJvS4JqSKQCg6C"}]},"maintainers":[{"name":"sheerun","email":"sheerun@sher.pl"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-file-loader_1.1.0_1537702845268_0.6302568724318052"},"_hasShrinkwrap":false},"1.1.1":{"name":"babel-plugin-file-loader","version":"1.1.1","description":"Like file-loader for webpack, but for Babel. Works with SSE apps.","main":"lib/index.js","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir lib","clean":"rimraf lib coverage .nyc_output","coverage":"cross-env NODE_ENV=test nyc report --reporter=lcov","coveralls":"cross-env NODE_ENV=test nyc report --reporter=text-lcov | coveralls","lint":"eslint --ext js src test/**/*.spec.*","test":"cross-env NODE_ENV=test npm run test:run","test:run":"nyc --reporter=text-summary mocha 'test/**/*.spec.js'","test:watch":"npm run test -- -- --watch"},"repository":{"type":"git","url":"git+https://github.com/sheerun/babel-plugin-file-loader.git"},"keywords":["nextjs","babel","import","loader","static","images","cdn","sse","isomorphic"],"author":{"name":"Adam Stankiewicz","email":"sheerun@sher.pl"},"license":"MIT","bugs":{"url":"https://github.com/sheerun/babel-plugin-file-loader/issues"},"homepage":"https://github.com/sheerun/babel-plugin-file-loader#readme","devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^8.0.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.0","coveralls":"^2.13.1","cross-env":"^5.0.0","eslint":"^4.1.0","mocha":"^3.4.2","nyc":"^11.0.2","rimraf":"^2.6.2"},"dependencies":{"big.js":"^5.0.3","fs-extra":"^4.0.2","mime":"^2.0.3"},"gitHead":"2c9af5ea1716becb9fcc1a93eedf9e530f73a954","_id":"babel-plugin-file-loader@1.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"sheerun","email":"sheerun@sher.pl"},"dist":{"integrity":"sha512-ORBZGJHxXv2Pd+lFsVqu4gwraBTTo32ue17MzdbWduT65k3rws9AlVWWmgDP59nFLJCfVkEcLLIbuR2C4lKVjw==","shasum":"22c6fdd5829ac4653d92cf5bd4d8bc87521523f2","tarball":"https://registry.npmjs.org/babel-plugin-file-loader/-/babel-plugin-file-loader-1.1.1.tgz","fileCount":9,"unpackedSize":54237,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxj3mCRA9TVsSAnZWagAAL98P/2HSYuNvoc8h8naxn1Ta\nMMPsMCYuNfJutNWXGJk/dsxY340jTfoCB8YcWLB0Ki2rT13C/NnxL3O5ue6F\nb9B4+V1i0jbldcJ8Rycui7+lfe2nI3T0RSJXMdL/D6tMPfcsm9tqdI0dwO0f\nvZyRkBdesxrQ5MZMz+ejHGALOHBeZ6V2sAuouZnijB5LMNDBIe8Z1PybgHMh\nKT3CD5lX2W3GSeoEPiBZTq94letFYfDf7DIfPEWsvoLrccNMEUNuguB8cx2r\nRzu33BbNRGRp4jBgmgWuFuKLmduZR4i1V1kndMFzyS9Vrnd73fa2eqQ2F99L\nieWDGr2GYrku66JLMqxT2KBXiFR3yncbQB0kQPedb52a0tMm3L0Rl3TUotG1\n4tNH8O6eqJEu1CB68pwB4QF5pRNLkD0M2D0BrP67lgqFAbVN7/bQMoLKgeKQ\n3aQbIsExhRoqTT5VkL2o0TdbWV/+EZNO8McbfGEupBaTb44wKGSY4+u8aTy3\nPGgP+tQyJiBBZ1OCUZBJAoik3P2J0YWm/i0Qx+BMw/lRLkLMBOy2/i4Ri7th\nKwNp8IPNbhcAH4BsXalRuYwBokc1v/cn8dJ9ZAvU0GZay5xGG9yfatpSQwhu\nUNzTYT3pcjauYGMTC0R8cXSTvg5ZpYvm8RVwMLxqYLRxWEfGUlCAxjwTn5A0\n0IKf\r\n=QvZv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzOqSHmS2KlOXGAN7Nn28wpj5D3vaNXo1E7c+u4KfiPAIhAKYE19Z8jfdzccICgxqyQNAnaiIWH/5WlUDbhdjhsvs2"}]},"maintainers":[{"name":"sheerun","email":"sheerun@sher.pl"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-file-loader_1.1.1_1539718629693_0.4593434371025569"},"_hasShrinkwrap":false},"2.0.0":{"name":"babel-plugin-file-loader","version":"2.0.0","description":"Like file-loader for webpack, but for Babel. Works with SSE apps.","author":{"name":"Adam Stankiewicz","email":"sheerun@sher.pl"},"repository":{"type":"git","url":"https://github.com/sheerun/babel-plugin-file-loader.git"},"license":"MIT","keywords":["nextjs","babel","import","loader","static","images","cdn","sse","isomorphic"],"main":"src/index.js","scripts":{"test":"modern test","lint":"modern lint","format":"modern format","precommit":"modern precommit"},"devDependencies":{"@babel/core":"^7.6.2","@babel/preset-react":"^7.0.0","modern-node":"^2.5.1","rimraf":"^3.0.0"},"dependencies":{"big.js":"^5.2.2","fs-extra":"^8.1.0","mime":"^2.4.4"},"licenseText":"MIT License\n\nCopyright (c) Adam Stankiewicz\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"babel-plugin-file-loader@2.0.0","dist":{"shasum":"e9f7ecbd0f1131483f6f06a2a4cbc1574c00534f","integrity":"sha512-MgonWXyl/VAMjMCU4YA3m0Zk95jdwLoQ/n8YM+M/CYKNtEfj9nk+bhgLbWKkUY2D9PzjQO8sx93QkOCMAAvn8Q==","tarball":"https://registry.npmjs.org/babel-plugin-file-loader/-/babel-plugin-file-loader-2.0.0.tgz","fileCount":7,"unpackedSize":11694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlMrBCRA9TVsSAnZWagAA2QoP/jCwiPNFb2bHybmO8Viy\nmaakj625yGlOSNX4wGAttbbMZmmnRj3BwlhqBwBIo+hgeizD8JzXRK4bI91J\npj6oGnJrD/gf3fvEdqJaPFR/HqxKsS1O4QHG1OQbvRZ4ibm888hIq0rU24V9\nq/UpeV4+Zxv86OOCKe07HDG7pg4Eg5M2+8uBDuBpzpSO7mNuP1u4YDQooGBJ\n7Jg7PBmuov+mdyN5BCvPSk5EP8R4IzwJiF7PtdDt96GadgTDBGe5r1YRrcox\nqJ6qNCXoeBKXvnXWYeAh7vk1GhEEcJTgtChwrgJnZ7SeDUYkczC9BZtuTnRu\n6PHWQNTFbTJxzCUzvuE1DHupi+Iqku2Y1l0lTNt3yFguQ8QfxWj2RUPzXa88\n4JVNzrN3GgXv3ReYtyb4A693uHgafZ/a6vJQxuDR77ZEGqc6FRhdkG5+h0cu\nOkp/Mp42tiFueVmhQydczZJBddywAhQ3AdtYQMgE4SFtMBbfkeV5l9hXuNSU\n+Ll0dg+qp6CqrEJ18YMQ/xJUEWRySTXUFMvmD0g5yEShOV1irDIGdpSWJNOd\nn0upb2s62Xg1mBLcsR7ibRV8sG8sDYmDIQysg7JvMDJYfku1blonR5NrahnF\nqu5fQyXy1Or28xma4HlIGQUQ5fcC6RA98f53MEuL1kyievYINvfs36qQhVyY\nYBG5\r\n=rfxD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAnRYCGTkTYSiADWbNM2YxCLGMSD3AUVc4Uu99HERE7gAiAfeRNqwW7AYpaSAyfL2OO681zWZz+b61oKHITiUxBA7w=="}]},"maintainers":[{"name":"sheerun","email":"sheerun@sher.pl"}],"_npmUser":{"name":"sheerun","email":"sheerun@sher.pl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-file-loader_2.0.0_1570032321052_0.5614363651883085"},"_hasShrinkwrap":false}},"readme":"# babel-plugin-file-loader [![CI](https://img.shields.io/travis/sheerun/babel-plugin-file-loader/master.svg)](https://travis-ci.org/sheerun/babel-plugin-file-loader) [![Modern Node](https://img.shields.io/badge/modern-node-9BB48F.svg)](https://github.com/sheerun/modern-node)\n\nWorks the same as Webpack's [file-loader](https://github.com/webpack-contrib/file-loader/), but on server side. With 95% test coverage!\n\n## Installation\n\n```\nyarn add babel-plugin-file-loader\n```\n\nOr if you like npm:\n\n```\nnpm install babel-plugin-file-loader --save\n```\n\nThen put following \"file-loader\" as plugin in .babelrc:\n\n```json\n{\n  \"plugins\": [\"file-loader\"]\n}\n```\n\nThis is equivalent to following default configuration:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"file-loader\",\n      {\n        \"name\": \"[hash].[ext]\",\n        \"extensions\": [\"png\", \"jpg\", \"jpeg\", \"gif\", \"svg\"],\n        \"publicPath\": \"/public\",\n        \"outputPath\": \"/public\",\n        \"context\": \"\",\n        \"limit\": 0\n      }\n    ]\n  ]\n}\n```\n\n## How it works\n\nMore or less as follows:\n\n1. Processes only `import` and `require` that reference files ending with one of `\"extensions\"`\n2. Calculates actual `$name` of resource by substituting placeholders in `\"name\"`\n3. Copies resource into `$ROOT/$outputPath/$name` where `$ROOT` is `.babelrc` location.\n4. Replaces `import` and `require` in code with `\"$publicPath/$name\"` string\n\n## Example usage\n\n```js\nimport img from './file.png'\nconst img2 = require('./file.svg')\n```\n\nPuts `0dcbbaa7013869e351f.png` and `8d3fe267fe578005541.svg` in the `/public` and replaces code with:\n\n```\nconst img = \"/public/0dcbbaa7013869e351f.png\"\nconst img2 = \"/public/8d3fe267fe578005541.svg\"\n```\n\nFor real-life example go to [examples](https://github.com/sheerun/babel-plugin-file-loader/tree/master/examples).\n\n## Options\n\n### outputPath\n\nTells where to put static files. By default it's `\"/public\"`.\n\nThis path is relative to the root of project. Setting value `null` prevents the plugin to copy the file.\n\n### publicPath\n\nTells what prefix to output in the source. By default it's `\"/public\"` as well but it can be even full url, like so: `\"http://cdn.example.com/foobar/\"`\n\nIn this case the resulting code is:\n\n```\nconst img = \"http://cdn.example.com/foobar/0dcbbaa7013869e351f.png\"\n```\n\n### name\n\nThe default is `[hash].[ext]` where:\n\n|     Name     |    Type    |     Default     | Description                                        |\n| :----------: | :--------: | :-------------: | :------------------------------------------------- |\n| **`[ext]`**  | `{String}` | `file.extname`  | The extension of the resource                      |\n| **`[name]`** | `{String}` | `file.basename` | The basename of the resource                       |\n| **`[path]`** | `{String}` | `file.dirname`  | The path of the resource relative to the `context` |\n| **`[hash]`** | `{String}` |      `md5`      | The hash of the content, see below for more info   |\n\nThe full format `[hash]` is: `[<hashType>:hash:<digestType>:<length>]`, where:\n\n|       Name       |    Type    | Default  | Description                                                                           |\n| :--------------: | :--------: | :------: | :------------------------------------------------------------------------------------ |\n|  **`hashType`**  | `{String}` |  `md5`   | `sha1`, `md5`, `sha256`, `sha512`                                                     |\n| **`digestType`** | `{String}` | `base64` | `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64` |\n|   **`length`**   | `{Number}` |  `128`   | The length in chars                                                                   |\n\nFor example: `[md5:hash:base58:8]` or `[hash:base36]`.\n\n### extensions\n\nList of extension file-loader should look for in imports. All other imports are ignored.\n\n### context\n\nPath to directory relative to `.babelrc` where application source resides. By default `\"\"`, but can be e.g. `\"/src\"`.\n\n### limit\n\nValue in byte to determine if the content is base64 inlined. In that case, the file is not copy to `outputPath`. It replicates [url-loader](https://github.com/webpack-contrib/url-loader) webpack loader behaviour.\n\nDefault is 0 which means nothing is inlined.\n\n## Contributing\n\nYes, please!\n\n## License\n\nMIT\n","maintainers":[{"name":"sheerun","email":"sheerun@sher.pl"}],"time":{"modified":"2022-04-11T16:38:36.562Z","created":"2017-11-30T21:18:44.622Z","1.0.0":"2017-11-30T21:18:44.622Z","1.1.0":"2018-09-23T11:40:45.439Z","1.1.1":"2018-10-16T19:37:09.837Z","2.0.0":"2019-10-02T16:05:21.195Z"},"keywords":["nextjs","babel","import","loader","static","images","cdn","sse","isomorphic"],"repository":{"type":"git","url":"https://github.com/sheerun/babel-plugin-file-loader.git"},"author":{"name":"Adam Stankiewicz","email":"sheerun@sher.pl"},"license":"MIT","readmeFilename":"README.md"}