package/package.json 000644 0000004451 3560116604 011552 0 ustar 00 000000 000000 { "name": "raw-loader", "version": "1.0.0", "description": "A loader for webpack that allows importing files as a String", "license": "MIT", "repository": "webpack-contrib/raw-loader", "author": "Tobias Koppers @sokra", "homepage": "https://github.com/webpack-contrib/raw-loader", "bugs": "https://github.com/webpack-contrib/raw-loader/issues", "main": "index.js", "engines": { "node": ">= 6.9.0" }, "scripts": { "lint": "eslint --cache 'index.js' test", "release": "standard-version", "security": "npm audit", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --collectCoverageFrom='index.js' --coverage", "ci:lint": "npm run lint && npm run security", "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", "ci:test": "npm run test -- --runInBand", "ci:coverage": "npm run test:coverage -- --runInBand", "defaults": "webpack-defaults" }, "files": [ "index.js", "options.json" ], "peerDependencies": { "webpack": "^4.3.0" }, "dependencies": { "loader-utils": "^1.1.0", "schema-utils": "^1.0.0" }, "devDependencies": { "@babel/cli": "^7.1.5", "@babel/core": "^7.1.6", "@babel/polyfill": "^7.0.0", "@babel/preset-env": "^7.1.6", "@commitlint/cli": "^7.1.6", "@commitlint/config-conventional": "^7.1.2", "@webpack-contrib/eslint-config-webpack": "^3.0.0", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^23.6.0", "cross-env": "^5.2.0", "del": "^3.0.0", "del-cli": "^1.1.0", "eslint": "^5.10.0", "eslint-plugin-import": "^2.14.0", "eslint-plugin-prettier": "^3.0.0", "husky": "^1.2.0", "jest": "^23.6.0", "lint-staged": "^8.1.0", "memory-fs": "^0.4.1", "prettier": "^1.11.1", "standard-version": "^4.3.0", "webpack": "^4.3.0", "webpack-defaults": "^2.1.1" }, "babel": { "presets": [ [ "@babel/preset-env", { "targets": { "node": "6.9.0" }, "useBuiltIns": "usage" } ] ] }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "*.js": [ "eslint --fix", "git add" ] }, "commitlint": { "extends": [ "@commitlint/config-conventional" ] } } package/CHANGELOG.md 000644 0000001275 3560116604 011076 0 ustar 00 000000 000000 # Change Log All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ## 1.0.0 (2018-12-10) ### Bug Fixes * escape invalid characters ([#43](https://github.com/webpack-contrib/raw-loader/issues/43)) ([83f6541](https://github.com/webpack-contrib/raw-loader/commit/83f6541)) ### Features * schema validation ([#58](https://github.com/webpack-contrib/raw-loader/issues/58)) ([4a6da19](https://github.com/webpack-contrib/raw-loader/commit/4a6da19)) ### BREAKING CHANGES * minimum require `webpack` version is `4` * minimum require `nodejs` version is `6.9` package/index.js 000644 0000001020 3560116604 010716 0 ustar 00 000000 000000 /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ const { getOptions } = require('loader-utils'); const validateOptions = require('schema-utils'); const schema = require('./options'); module.exports = function rawLoader(source) { const options = getOptions(this) || {}; validateOptions(schema, options, 'Raw Loader'); const json = JSON.stringify(source) .replace(/\u2028/g, '\\u2028') .replace(/\u2029/g, '\\u2029'); return `module.exports = ${json}`; }; package/LICENSE 000644 0000002057 3560116604 010271 0 ustar 00 000000 000000 Copyright JS Foundation and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. package/options.json 000644 0000000114 3560116604 011642 0 ustar 00 000000 000000 { "additionalProperties": false, "properties": {}, "type": "object" } package/README.md 000644 0000004156 3560116604 010545 0 ustar 00 000000 000000
[![npm][npm]][npm-url] [![node][node]][node-url] [![deps][deps]][deps-url] [![tests][tests]][tests-url] [![coverage][cover]][cover-url] [![chat][chat]][chat-url] [![size][size]][size-url] # raw-loader A loader for webpack that allows importing files as a String. ## Requirements This module requires a minimum of Node v6.9.0 and Webpack v4.0.0. ## Getting Started To begin, you'll need to install `raw-loader`: ```console $ npm install raw-loader --save-dev ``` Then add the loader to your `webpack` config. For example: **file.js** ```js import txt from './file.txt'; ``` **webpack.config.js** ```js // webpack.config.js module.exports = { module: { rules: [ { test: /\.txt$/, use: 'raw-loader' } ] } } ``` Or from the command-line: ```console $ webpack --module-bind 'txt=raw-loader' ``` And run `webpack` via your preferred method. ## Examples Inline. ```js import txt from 'raw-loader!./file.txt'; ``` ## License #### [MIT](./LICENSE) [npm]: https://img.shields.io/npm/v/raw-loader.svg [npm-url]: https://npmjs.com/package/raw-loader [node]: https://img.shields.io/node/v/raw-loader.svg [node-url]: https://nodejs.org [deps]: https://david-dm.org/webpack-contrib/raw-loader.svg [deps-url]: https://david-dm.org/webpack-contrib/raw-loader [tests]: https://img.shields.io/circleci/project/github/webpack-contrib/raw-loader.svg [tests-url]: https://circleci.com/gh/webpack-contrib/raw-loader [cover]: https://codecov.io/gh/webpack-contrib/raw-loader/branch/master/graph/badge.svg [cover-url]: https://codecov.io/gh/webpack-contrib/raw-loader [chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg [chat-url]: https://gitter.im/webpack/webpack [size]: https://packagephobia.now.sh/badge?p=raw-loader [size-url]: https://packagephobia.now.sh/result?p=raw-loader