Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,14 @@ Same as above, but with a customizable number of emojis
### `[hash]`

Type: `String`
Default: `md5`
Default: `md4`

Specifies the hash method to use for hashing the file content.

### `[contenthash]`

Type: `String`
Default: `md5`
Default: `md4`

Specifies the hash method to use for hashing the file content.

Expand All @@ -495,10 +495,9 @@ base49, base52, base58, base62, base64, and hex.
#### `hashType`

Type: `String`
Default: `'md5'`
Default: `'md4'`

The type of hash that the has function should use. Valid values include: `md5`,
`sha1`, `sha256`, and `sha512`.
The type of hash that the has function should use. Valid values include: `md4`, `md5`, `sha1`, `sha256`, and `sha512`.

#### `length`

Expand Down
665 changes: 390 additions & 275 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
"webpack": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"loader-utils": "^1.4.0",
"schema-utils": "^2.5.0"
"loader-utils": "^2.0.0",
"schema-utils": "^2.6.5"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^25.1.0",
"commitlint-azure-pipelines-cli": "^1.0.3",
"cross-env": "^7.0.0",
"cross-env": "^7.0.2",
"del": "^5.1.0",
"del-cli": "^3.0.0",
"eslint": "^6.8.0",
Expand All @@ -63,14 +63,14 @@
"husky": "^4.2.3",
"jest": "^25.1.0",
"jest-junit": "^10.0.0",
"lint-staged": "^10.0.7",
"memfs": "^3.1.1",
"lint-staged": "^10.0.8",
"memfs": "^3.1.2",
"memory-fs": "^0.5.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"standard-version": "^7.1.0",
"url-loader": "^3.0.0",
"webpack": "^4.41.6"
"webpack": "^4.42.0"
},
"keywords": [
"webpack"
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import validateOptions from 'schema-utils';
import schema from './options.json';

export default function loader(content) {
const options = loaderUtils.getOptions(this) || {};
const options = loaderUtils.getOptions(this);

validateOptions(schema, options, {
name: 'File Loader',
Expand Down
10 changes: 5 additions & 5 deletions test/__snapshots__/emitFile-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ Array [

exports[`"emitFile" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work with "Boolean" value equal "false": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "true": assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"emitFile" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;

exports[`"emitFile" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work with "Boolean" value equal "true": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;

exports[`"emitFile" option should work without value: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"emitFile" option should work without value: errors 1`] = `Array []`;

exports[`"emitFile" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"emitFile" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"emitFile" option should work without value: warnings 1`] = `Array []`;
6 changes: 3 additions & 3 deletions test/__snapshots__/esModule-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

exports[`"esModule" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;

exports[`"esModule" option should work without value: errors 1`] = `Array []`;

exports[`"esModule" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"esModule" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"esModule" option should work without value: warnings 1`] = `Array []`;
12 changes: 6 additions & 6 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

exports[`loader should work with "ModuleConcatenationPlugin" plugin: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: errors 1`] = `Array []`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should work with "ModuleConcatenationPlugin" plugin: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should work with "ModuleConcatenationPlugin" plugin: warnings 1`] = `Array []`;

exports[`loader should work with "url-loader" when limit is less: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should work with "url-loader" when limit is less: errors 1`] = `Array []`;

exports[`loader should work with "url-loader" when limit is less: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should work with "url-loader" when limit is less: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should work with "url-loader" when limit is less: warnings 1`] = `Array []`;

Expand All @@ -40,13 +40,13 @@ exports[`loader should works with "url-loader" when limit is more: warnings 1`]

exports[`loader should works without options: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`loader should works without options: errors 1`] = `Array []`;

exports[`loader should works without options: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`loader should works without options: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`loader should works without options: warnings 1`] = `Array []`;
6 changes: 3 additions & 3 deletions test/__snapshots__/name-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ exports[`"name" option should work for CDN support query params: warnings 1`] =

exports[`"name" option should work with "Function" value: errors 1`] = `Array []`;

exports[`"name" option should work with "Function" value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.function.png?foo=bar"`;
exports[`"name" option should work with "Function" value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.function.png?foo=bar"`;

exports[`"name" option should work with "Function" value: warnings 1`] = `Array []`;

exports[`"name" option should work with "String" value: errors 1`] = `Array []`;

exports[`"name" option should work with "String" value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.string.png?foo=bar"`;
exports[`"name" option should work with "String" value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.string.png?foo=bar"`;

exports[`"name" option should work with "String" value: warnings 1`] = `Array []`;

exports[`"name" option should work without value: errors 1`] = `Array []`;

exports[`"name" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"name" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"name" option should work without value: warnings 1`] = `Array []`;
36 changes: 18 additions & 18 deletions test/__snapshots__/outputPath-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,40 @@ exports[`"outputPath" option should work with "Function" value and with "name" o

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": result 1`] = `"public_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": result 1`] = `"public_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "Function": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value and with "publicPath" as "String": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value: assets 1`] = `
Array [
"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "Function" value: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "Function" value: result 1`] = `"output_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "Function" value: result 1`] = `"output_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "Function" value: warnings 1`] = `Array []`;

Expand All @@ -67,78 +67,78 @@ exports[`"outputPath" option should work with "String" value and with "name" opt

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": result 1`] = `"public_path_func/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": result 1`] = `"public_path_func/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" as "Function": warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option and without trailing slash: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: result 1`] = `"public_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value and with "publicPath" option: result 1`] = `"public_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value and with "publicPath" option: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value without trailing slash: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value without trailing slash: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value without trailing slash: result 1`] = `"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value without trailing slash: result 1`] = `"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value without trailing slash: warnings 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value: assets 1`] = `
Array [
"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work with "String" value: errors 1`] = `Array []`;

exports[`"outputPath" option should work with "String" value: result 1`] = `"output_path/9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work with "String" value: result 1`] = `"output_path/39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work with "String" value: warnings 1`] = `Array []`;

exports[`"outputPath" option should work without value: assets 1`] = `
Array [
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png",
"39f5c21c1aee6ff21844c6e1d8251d97.png",
"main.bundle.js",
]
`;

exports[`"outputPath" option should work without value: errors 1`] = `Array []`;

exports[`"outputPath" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
exports[`"outputPath" option should work without value: result 1`] = `"39f5c21c1aee6ff21844c6e1d8251d97.png"`;

exports[`"outputPath" option should work without value: warnings 1`] = `Array []`;
Loading