Skip to content

Commit

Permalink
Merge pull request #182 from webpack-contrib/fix/plugins
Browse files Browse the repository at this point in the history
fix: Plugin.install is not a function
  • Loading branch information
jhnns authored Mar 21, 2017
2 parents 13dec00 + f8ae245 commit 16fe264
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 100 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"node": ">=4.3 <5.0.0 || >=5.10"
},
"dependencies": {
"clone-deep": "^0.2.4",
"clone": "^2.1.1",
"loader-utils": "^1.0.2",
"pify": "^2.3.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/getOptions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const loaderUtils = require('loader-utils');
const cloneDeep = require('clone-deep');
const clone = require('clone');
const createWebpackLessPlugin = require('./createWebpackLessPlugin');

/**
Expand All @@ -12,7 +12,7 @@ function getOptions(loaderContext) {
plugins: [],
relativeUrls: true,
compress: Boolean(loaderContext.minimize),
...cloneDeep(loaderUtils.getOptions(loaderContext)),
...clone(loaderUtils.getOptions(loaderContext)),
};

// We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
Expand Down
6 changes: 4 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ test('should generate source maps', async () => {

test('should install plugins', async () => {
let pluginInstalled = false;
const testPlugin = {
// Using prototype inheritance here since Less plugins are usually instances of classes
// See https://github.com/webpack-contrib/less-loader/issues/181#issuecomment-288220113
const testPlugin = Object.create({
install() {
pluginInstalled = true;
},
};
});

await compile('basic', moduleRules.basic({ plugins: [testPlugin] }));

Expand Down
106 changes: 11 additions & 95 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,14 @@ acorn-jsx@^3.0.0:
dependencies:
acorn "^3.0.4"

[email protected]:
[email protected], acorn@^4.0.3, acorn@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a"

acorn@^3.0.4:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"

acorn@^4.0.3, acorn@^4.0.4:
version "4.0.11"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0"

agent-base@2:
version "2.0.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-2.0.1.tgz#bd8f9e86a8eb221fffa07bd14befd55df142815e"
Expand All @@ -58,7 +54,7 @@ ajv-keywords@^1.0.0, ajv-keywords@^1.1.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"

ajv@^4.11.2, ajv@^4.7.0:
ajv@^4.7.0:
version "4.11.5"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd"
dependencies:
Expand Down Expand Up @@ -1087,15 +1083,9 @@ cliui@^3.2.0:
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"

clone-deep@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-0.2.4.tgz#4e73dd09e9fb971cc38670c5dced9c1896481cc6"
dependencies:
for-own "^0.1.3"
is-plain-object "^2.0.1"
kind-of "^3.0.2"
lazy-cache "^1.0.3"
shallow-clone "^0.1.2"
clone@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb"

co@^4.6.0:
version "4.6.0"
Expand Down Expand Up @@ -1131,12 +1121,6 @@ commander@^2.8.1, commander@^2.9.0:
dependencies:
graceful-readlink ">= 1.0.0"

comment-parser@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.4.0.tgz#b274a3c924b6b2e55768f712acd3e3003cb55f57"
dependencies:
readable-stream "^2.0.4"

compare-func@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648"
Expand Down Expand Up @@ -1760,10 +1744,6 @@ escope@^3.6.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint-config-peerigon@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-peerigon/-/eslint-config-peerigon-9.0.0.tgz#f664ffe3ddc5e80a653b488abc14b1b3b7865d20"

eslint-config-webpack@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-config-webpack/-/eslint-config-webpack-1.1.0.tgz#ef50597c4e249c70a3a787c5c16e9f82ed7e92e3"
Expand Down Expand Up @@ -1798,13 +1778,6 @@ eslint-plugin-import@^2.2.0:
minimatch "^3.0.3"
pkg-up "^1.0.0"

eslint-plugin-jsdoc@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-2.4.0.tgz#7c1eaa8e88fab04c807472c17b6ff9a1ac7e564d"
dependencies:
comment-parser "^0.4.0"
lodash "^4.5.1"

eslint@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.17.1.tgz#b80ae12d9c406d858406fccda627afce33ea10ea"
Expand Down Expand Up @@ -1955,15 +1928,6 @@ extglob@^0.3.1:
dependencies:
is-extglob "^1.0.0"

extract-text-webpack-plugin@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.1.0.tgz#69315b885f876dbf96d3819f6a9f1cca7aebf159"
dependencies:
ajv "^4.11.2"
async "^2.1.2"
loader-utils "^1.0.2"
webpack-sources "^0.1.0"

[email protected]:
version "1.0.2"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
Expand Down Expand Up @@ -2045,15 +2009,11 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"

for-in@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"

for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"

for-own@^0.1.3, for-own@^0.1.4:
for-own@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce"
dependencies:
Expand Down Expand Up @@ -2602,12 +2562,6 @@ is-path-inside@^1.0.0:
dependencies:
path-is-inside "^1.0.1"

is-plain-object@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.1.tgz#4d7ca539bc9db9b737b8acb612f2318ef92f294f"
dependencies:
isobject "^1.0.0"

is-posix-bracket@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4"
Expand Down Expand Up @@ -2676,10 +2630,6 @@ isexe@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.1.2.tgz#36f3e22e60750920f5e7241a476a8c6a42275ad0"

isobject@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-1.0.2.tgz#f0f9b8ce92dd540fa0740882e3835a2e022ec78a"

isobject@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
Expand Down Expand Up @@ -3067,12 +3017,6 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.3.6"

kind-of@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5"
dependencies:
is-buffer "^1.0.2"

kind-of@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
Expand All @@ -3091,10 +3035,6 @@ latest-version@^2.0.0:
dependencies:
package-json "^2.0.0"

lazy-cache@^0.2.3:
version "0.2.7"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-0.2.7.tgz#7feddf2dcb6edb77d11ef1d117ab5ffdf0ab1b65"

lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
Expand All @@ -3109,7 +3049,7 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"

less@^2.6.1:
less@^2.3.1:
version "2.7.2"
resolved "https://registry.yarnpkg.com/less/-/less-2.7.2.tgz#368d6cc73e1fb03981183280918743c5dcf9b3df"
optionalDependencies:
Expand Down Expand Up @@ -3324,7 +3264,7 @@ lodash.templatesettings@^4.0.0:
dependencies:
lodash._reinterpolate "~3.0.0"

lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1:
lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

Expand Down Expand Up @@ -3470,13 +3410,6 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

mixin-object@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e"
dependencies:
for-in "^0.1.3"
is-extendable "^0.1.1"

"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
Expand Down Expand Up @@ -3689,10 +3622,6 @@ null-check@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/null-check/-/null-check-1.0.0.tgz#977dffd7176012b9ec30d2a39db5cf72a0439edd"

null-loader@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/null-loader/-/null-loader-0.1.1.tgz#17be9abfcd3ff0e1512f6fc4afcb1f5039378fae"

number-is-nan@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
Expand Down Expand Up @@ -4060,10 +3989,6 @@ randombytes@^2.0.0, randombytes@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.3.tgz#674c99760901c3c4112771a31e521dc349cc09ec"

raw-loader@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"

rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@~1.1.6:
version "1.1.7"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea"
Expand Down Expand Up @@ -4095,7 +4020,7 @@ read-pkg@^1.0.0, read-pkg@^1.1.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"

readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2:
readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.3.tgz#9cf49463985df016c8ae8813097a9293a9b33729"
dependencies:
Expand Down Expand Up @@ -4371,15 +4296,6 @@ sha.js@^2.3.6:
dependencies:
inherits "^2.0.1"

shallow-clone@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-0.1.2.tgz#5909e874ba77106d73ac414cfec1ffca87d97060"
dependencies:
is-extendable "^0.1.1"
kind-of "^2.0.1"
lazy-cache "^0.2.3"
mixin-object "^2.0.1"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
Expand Down Expand Up @@ -4959,14 +4875,14 @@ webpack-merge@^4.0.0:
dependencies:
lodash "^4.17.4"

webpack-sources@^0.1.0, webpack-sources@^0.1.4:
webpack-sources@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.4.tgz#ccc2c817e08e5fa393239412690bb481821393cd"
dependencies:
source-list-map "~0.1.7"
source-map "~0.5.3"

webpack@^2.2.1:
webpack@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.2.1.tgz#7bb1d72ae2087dd1a4af526afec15eed17dda475"
dependencies:
Expand Down

0 comments on commit 16fe264

Please sign in to comment.