Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raw-loader

Package Overview
Dependencies
Maintainers
10
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raw-loader - npm Package Compare versions

Comparing version 1.0.0-beta.0 to 1.0.0

options.json

14

CHANGELOG.md

@@ -5,4 +5,4 @@ # Change Log

<a name="1.0.0-beta.0"></a>
# 1.0.0-beta.0 (2017-10-02)
<a name="1.0.0"></a>
## 1.0.0 (2018-12-10)

@@ -12,12 +12,12 @@

* escape newline/paragraph separators ([#36](https://github.com/webpack/raw-loader/issues/36)) ([c972c92](https://github.com/webpack/raw-loader/commit/c972c92))
* escape invalid characters ([#43](https://github.com/webpack-contrib/raw-loader/issues/43)) ([83f6541](https://github.com/webpack-contrib/raw-loader/commit/83f6541))
### Features
### Code Refactoring
* schema validation ([#58](https://github.com/webpack-contrib/raw-loader/issues/58)) ([4a6da19](https://github.com/webpack-contrib/raw-loader/commit/4a6da19))
* export as ES2015 Module ([#10](https://github.com/webpack/raw-loader/issues/10)) ([215fba7](https://github.com/webpack/raw-loader/commit/215fba7))
### BREAKING CHANGES
* ES Modules are not compatible with Webpack v1.x
* minimum require `webpack` version is `4`
* minimum require `nodejs` version is `6.9`
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(content) {
this.cacheable && this.cacheable();
this.value = content;
content = JSON.stringify(content)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
return "export default " + content;
}
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}`;
};
{
"name": "raw-loader",
"version": "1.0.0-beta.0",
"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",
"description": "raw loader module for webpack",
"homepage": "https://github.com/webpack-contrib/raw-loader",
"bugs": "https://github.com/webpack-contrib/raw-loader/issues",
"main": "index.js",
"license": "MIT",
"engines": {
"node": ">= 6.9.0"
},
"scripts": {
"release": "standard-version"
"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": {
"standard-version": "^4.2.0"
"@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"
},
"repository": {
"type": "git",
"url": "git@github.com:webpack/raw-loader.git"
"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"
]
}
}

@@ -1,6 +0,1 @@

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![chat][chat]][chat-url]
<div align="center">

@@ -13,20 +8,40 @@ <img width="200" height="200"

</a>
<h1>Raw Loader</h1>
<p>A loader for webpack that lets you import files as a string.</p>
</div>
<h2 align="center">Install</h2>
[![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]
```bash
npm install --save-dev raw-loader
# 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
```
<h2 align="center">Usage</h2>
Then add the loader to your `webpack` config. For example:
Use the loader either via your webpack config, CLI or inline.
**file.js**
### Via webpack config (recommended)
```js
import txt from './file.txt';
```
**webpack.config.js**
```js
// webpack.config.js
module.exports = {

@@ -44,21 +59,14 @@ module: {

**In your application**
```js
import txt from './file.txt';
Or from the command-line:
```console
$ webpack --module-bind 'txt=raw-loader'
```
### CLI
And run `webpack` via your preferred method.
```bash
webpack --module-bind 'txt=raw-loader'
```
## Examples
**In your application**
```js
import txt from 'file.txt';
```
Inline.
### Inline
**In your application**
```js

@@ -68,45 +76,19 @@ import txt from 'raw-loader!./file.txt';

<h2 align="center">Maintainers</h2>
## License
<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
</br>
<a href="https://github.com/bebraw">Juho Vepsäläinen</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
</br>
<a href="https://github.com/d3viant0ne">Joshua Wiens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
</br>
<a href="https://github.com/SpaceK33z">Kees Kluskens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
</br>
<a href="https://github.com/TheLarkInn">Sean Larkin</a>
</td>
</tr>
<tbody>
</table>
#### [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/raw-loader.svg
[deps-url]: https://david-dm.org/webpack/raw-loader
[chat]: https://badges.gitter.im/webpack/webpack.svg
[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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc