pnp-webpack-plugin
Advanced tools
Comparing version 1.6.0 to 1.6.1
28
index.js
const path = require(`path`); | ||
const {resolveModuleName} = require(`ts-pnp`); | ||
let pnp; | ||
try { | ||
pnp = require(`pnpapi`); | ||
} catch (error) { | ||
// not in PnP; not a problem | ||
} | ||
function nothing() { | ||
@@ -17,2 +9,4 @@ // ¯\_(ツ)_/¯ | ||
function getModuleLocator(module) { | ||
const pnp = require(`pnpapi`); | ||
const moduleLocation = typeof module === `string` | ||
@@ -34,2 +28,4 @@ ? module | ||
function getDependencyLocator(sourceLocator, name) { | ||
const pnp = require(`pnpapi`); | ||
const {packageDependencies} = pnp.getPackageInformation(sourceLocator); | ||
@@ -45,2 +41,4 @@ const reference = packageDependencies.get(name); | ||
const pnp = require(`pnpapi`); | ||
const sourceInformation = pnp.getPackageInformation(sourceLocator); | ||
@@ -58,2 +56,4 @@ | ||
function makeResolver(sourceLocator, filter) { | ||
const pnp = require(`pnpapi`); | ||
const sourceLocation = getSourceLocation(sourceLocator); | ||
@@ -131,3 +131,3 @@ | ||
module.exports = pnp ? { | ||
module.exports = process.versions.pnp ? { | ||
apply: makeResolver(null), | ||
@@ -138,3 +138,3 @@ } : { | ||
module.exports.makePlugin = (locator, filter) => pnp ? { | ||
module.exports.makePlugin = (locator, filter) => process.versions.pnp ? { | ||
apply: makeResolver(locator, filter), | ||
@@ -145,3 +145,3 @@ } : { | ||
module.exports.moduleLoader = module => pnp ? { | ||
module.exports.moduleLoader = module => process.versions.pnp ? { | ||
apply: makeResolver(getModuleLocator(module)), | ||
@@ -152,4 +152,4 @@ } : { | ||
module.exports.topLevelLoader = pnp ? { | ||
apply: makeResolver(pnp.topLevel), | ||
module.exports.topLevelLoader = process.versions.pnp ? { | ||
apply: makeResolver({name: null, reference: null}), | ||
} : { | ||
@@ -159,3 +159,3 @@ apply: nothing, | ||
module.exports.bind = (filter, module, dependency) => pnp ? { | ||
module.exports.bind = (filter, module, dependency) => process.versions.pnp ? { | ||
apply: makeResolver(dependency ? getDependencyLocator(getModuleLocator(module), dependency) : getModuleLocator(module), filter), | ||
@@ -162,0 +162,0 @@ } : { |
{ | ||
"name": "pnp-webpack-plugin", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "plug'n'play resolver for Webpack", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11880
188
12