New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

parcel-plugin-externals

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parcel-plugin-externals - npm Package Compare versions

Comparing version 0.3.0-pre.20191112.1 to 0.3.0-pre.20191130.1

1

CHANGELOG.md

@@ -7,2 +7,3 @@ # parcel-plugin-externals Changelog

- Fixed exception on browser property set to false (#6)
- Added support for referencing modules directly (#7)

@@ -9,0 +10,0 @@ ## 0.2.0

2

package.json
{
"name": "parcel-plugin-externals",
"version": "0.3.0-pre.20191112.1",
"version": "0.3.0-pre.20191130.1",
"description": "A plugin for Parcel to omit declared externals from being included in the emitted bundles.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,7 +5,31 @@ const { readFileSync, existsSync } = require("fs");

function inspect(name) {
let scope = "";
let path = "";
if (name.startsWith("@")) {
scope = name.substr(0, name.indexOf("/"));
name = name.replace(`${scope}/`, "");
}
if (name.indexOf("/") !== -1) {
path = name.substr(name.indexOf("/") + 1);
name = name.replace(`/${path}`, "");
}
return {
scope,
name,
path,
fullName: scope ? `${scope}/${name}` : name
};
}
function resolveModule(rule, targetDir) {
const { name } = splitRule(rule);
const { fullName, path } = inspect(name);
try {
const moduleDefinitionFile = `${name}/package.json`;
const packageName = path ? `${fullName}/${path}` : fullName;
const moduleDefinitionFile = `${fullName}/package.json`;
const moduleDefinition = require(moduleDefinitionFile);

@@ -17,3 +41,3 @@ const replacements = {};

if (typeof moduleDefinition.browser === "string") {
if (!path && typeof moduleDefinition.browser === "string") {
return [

@@ -41,3 +65,3 @@ {

if (typeof moduleDefinition.module === "string") {
if (!path && typeof moduleDefinition.module === "string") {
const modulePath = resolve(moduleRoot, moduleDefinition.module);

@@ -54,3 +78,3 @@ return [

const directPath = require.resolve(name, {
const directPath = require.resolve(packageName, {
paths: [targetDir]

@@ -57,0 +81,0 @@ });

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