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

pnp-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pnp-webpack-plugin - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

30

index.js

@@ -29,2 +29,9 @@ const path = require(`path`);

function getDependencyLocator(sourceLocator, name) {
const {packageDependencies} = pnp.getPackageInformation(sourceLocator);
const reference = packageDependencies.get(name);
return {name, reference};
}
function getSourceLocation(sourceLocator) {

@@ -45,7 +52,7 @@ if (!sourceLocator)

function makeResolver(sourceLocator) {
function makeResolver(sourceLocator, filter) {
const sourceLocation = getSourceLocation(sourceLocator);
return resolver => {
const MAYBE_BUILTIN = /^[^\/]$/;
const BACKWARD_PATH = /^\.\.([\\\/]|$)/;

@@ -66,3 +73,3 @@ const resolvedHook = resolver.ensureHook(`resolve`);

let request = requestContext.request;
let issuer = sourceLocation || requestContext.context.issuer;
let issuer = requestContext.context.issuer;

@@ -77,6 +84,15 @@ // When using require.context, issuer seems to be false (cf https://github.com/webpack/webpack-dev-server/blob/d0725c98fb752d8c0b1e8c9067e526e22b5f5134/client-src/default/index.js#L94)

console.log([request, issuer, filter]);
if (filter) {
const relative = path.relative(filter, issuer);
if (path.isAbsolute(relative) || BACKWARD_PATH.test(relative)) {
return callback(null);
}
}
let resolutionIssuer = sourceLocation || issuer;
let resolution;
try {
resolution = pnp.resolveToUnqualified(request, issuer, {considerBuiltins: false});
resolution = pnp.resolveToUnqualified(request, resolutionIssuer, {considerBuiltins: false});
} catch (error) {

@@ -117,4 +133,10 @@ return callback(error);

module.exports.bind = (filter, module, dependency) => pnp ? {
apply: makeResolver(getDependencyLocator(getModuleLocator(module), dependency), filter),
} : {
apply: nothing,
};
module.exports.tsLoaderOptions = (options = {}) => pnp ? Object.assign({}, options, {
resolveModuleName: require('ts-pnp').resolveModuleName,
}) : options;

2

package.json
{
"name": "pnp-webpack-plugin",
"version": "1.2.1",
"version": "1.3.0",
"description": "plug'n'play resolver for Webpack",

@@ -5,0 +5,0 @@ "license": "MIT",

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