Skip to content

Commit

Permalink
fix: replace codependency with custom requirePeer function
Browse files Browse the repository at this point in the history
fixes #32
  • Loading branch information
KaelWD committed Dec 2, 2018
1 parent 16bdf24 commit 14f66ff
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 60 deletions.
3 changes: 1 addition & 2 deletions lib/loader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const path = require('path')
const loaderUtils = require('loader-utils')
const compiler = require('vue-template-compiler')
const requirePeer = require('codependency').register(module, { strictCheck: false })

const vuetifyMatcher = require('./matcher')
const { camelize, capitalize, hyphenate } = require('./util')
const { camelize, capitalize, hyphenate, requirePeer } = require('./util')
const installComponentsPath = require.resolve('./runtime/installComponents')

module.exports = async function (content, sourceMap) {
Expand Down
12 changes: 11 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ const hyphenate = str => {
return str.replace(hyphenateRE, '-$1').toLowerCase()
}

function requirePeer (name) {
try {
return require(name)
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') throw e
throw new Error(`Module "${name}" required by "vuetify-loader" not found.`)
}
}

module.exports = {
camelize,
capitalize,
hyphenate
hyphenate,
requirePeer
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"homepage": "git+https://github.com/vuetifyjs/vuetify-loader#readme",
"dependencies": {
"codependency": "^2.1.0",
"loader-utils": "^1.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion progressive-loader/loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const loaderUtils = require('loader-utils')
const requirePeer = require('codependency').register(module, { strictCheck: false })
const { requirePeer } = require('../lib/util')

module.exports = function loader(contentBuffer) {
this.cacheable && this.cacheable()
Expand Down
56 changes: 1 addition & 55 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,6 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=

array-parallel@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/array-parallel/-/array-parallel-0.1.3.tgz#8f785308926ed5aa478c47e64d1b334b6c0c947d"
integrity sha1-j3hTCJJu1apHjEfmTRszS2wMlH0=

array-series@~0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/array-series/-/array-series-0.1.5.tgz#df5d37bfc5c2ef0755e2aa4f92feae7d4b5a972f"
integrity sha1-3103v8XC7wdV4qpPkv6ufUtaly8=

array-unique@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
Expand Down Expand Up @@ -523,13 +513,6 @@ code-point-at@^1.0.0:
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=

codependency@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/codependency/-/codependency-2.1.0.tgz#597d01ccc6b2704ab8d7a12af5d27ac9b4e27e8a"
integrity sha512-JIdmYkE8Z6jwH1OUf4a5H5jk9YShPQkaYPUAiN+ktyChmPP77LGbeKrxWGPqdCnpTmt0hRIn8TXBVu01U3HDhg==
dependencies:
semver "^5.3.0"

collection-visit@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"
Expand Down Expand Up @@ -638,14 +621,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

cross-spawn@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
integrity sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=
dependencies:
lru-cache "^4.0.1"
which "^1.2.9"

crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
Expand Down Expand Up @@ -685,13 +660,6 @@ debug@^2.1.2, debug@^2.2.0, debug@^2.3.3:
dependencies:
ms "2.0.0"

debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"

decode-uri-component@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
Expand Down Expand Up @@ -1015,16 +983,6 @@ glob@^7.0.5, glob@^7.1.2:
once "^1.3.0"
path-is-absolute "^1.0.0"

gm@^1.23.1:
version "1.23.1"
resolved "https://registry.yarnpkg.com/gm/-/gm-1.23.1.tgz#2edeeb958084d0f8ea7988e5d995b1c7dfc14777"
integrity sha1-Lt7rlYCE0PjqeYjl2ZWxx9/BR3c=
dependencies:
array-parallel "~0.1.3"
array-series "~0.1.5"
cross-spawn "^4.0.0"
debug "^3.1.0"

graceful-fs@^4.1.11, graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
Expand Down Expand Up @@ -1283,11 +1241,6 @@ [email protected], isarray@^1.0.0, isarray@~1.0.0:
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=

isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=

isobject@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
Expand Down Expand Up @@ -1366,7 +1319,7 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lru-cache@^4.0.1, lru-cache@^4.1.1:
lru-cache@^4.1.1:
version "4.1.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c"
integrity sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==
Expand Down Expand Up @@ -2469,13 +2422,6 @@ webpack@^4.20.2:
watchpack "^1.5.0"
webpack-sources "^1.3.0"

which@^1.2.9:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
dependencies:
isexe "^2.0.0"

wide-align@^1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"
Expand Down

0 comments on commit 14f66ff

Please sign in to comment.