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.1.0 to 0.2.0-pre.20191021.1

4

CHANGELOG.md
# parcel-plugin-externals Changelog
## 0.2.0
- Allow `externals` definition via object (#1)
## 0.1.0
- Initial release

2

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

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

# parcel-plugin-externals
[![Build Status](https://florianrappl.visualstudio.com/parcel-plugin-externals/_apis/build/status/FlorianRappl.parcel-plugin-externals?branchName=master)](https://florianrappl.visualstudio.com/parcel-plugin-externals/_build/latest?definitionId=12&branchName=master)
[![Build Status](https://florianrappl.visualstudio.com/parcel-plugin-externals/_apis/build/status/FlorianRappl.parcel-plugin-externals?branchName=master)](https://florianrappl.visualstudio.com/parcel-plugin-externals/_build/latest?definitionId=14&branchName=master)
[![npm](https://img.shields.io/npm/v/parcel-plugin-externals.svg)](https://www.npmjs.com/package/parcel-plugin-externals)

@@ -34,2 +34,14 @@ [![GitHub tag](https://img.shields.io/github/tag/FlorianRappl/parcel-plugin-externals.svg)](https://github.com/FlorianRappl/parcel-plugin-externals/releases)

{
"externals": {
"react": "React"
}
}
```
Here we tell the plugin to alias the `react` module with `React`. In this case we reference a global variable `React`, which obviously must exist.
The object syntax is a shorthand for combining the keys and values for a replacement expression. The snippet above is acutally equalivant to:
```json
{
"externals": [

@@ -41,3 +53,3 @@ "react => React"

Here we tell the plugin to alias the `react` module with `React`. In this case we reference a global variable `React`, which obviously must exist. Expressions could be more complex:
Expressions could be more complex:

@@ -64,3 +76,3 @@ ```json

**Important**: This is an early version of the plugin. Please give feedback, especially regarding configuration and syntax. The idea is to keep the plugin simple and the options straight and to the point.
**Important**: This is an early version of the plugin. Please give feedback [on GitHub](https://github.com/FlorianRappl/parcel-plugin-externals/issues), especially regarding configuration and syntax. The idea is to keep the plugin simple and the options straight and to the point.

@@ -67,0 +79,0 @@ ## Changelog

@@ -86,3 +86,16 @@ const { readFileSync, existsSync } = require("fs");

const plain = Object.keys(data.peerDependencies || {});
return (data.externals || []).concat(plain);
const externals = data.externals || [];
if (Array.isArray(externals)) {
return externals.concat(plain);
} else if (typeof externals === "object") {
return Object.keys(externals)
.map(name => `${name} => ${externals[name]}`)
.concat(plain);
}
console.warn(
`"externals" seem to be of wrong type. Expected <Array | object> but found <${typeof externals}>`
);
return plain;
} catch (ex) {

@@ -89,0 +102,0 @@ console.error(ex);

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