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

@yarnpkg/esbuild-plugin-pnp

Package Overview
Dependencies
Maintainers
6
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/esbuild-plugin-pnp - npm Package Compare versions

Comparing version 1.0.0-rc.5 to 1.0.0-rc.6

32

lib/index.js

@@ -8,2 +8,30 @@ "use strict";

const defaultExtensions = [`.tsx`, `.ts`, `.jsx`, `.mjs`, `.cjs`, `.js`, `.css`, `.json`];
// Reference: https://github.com/evanw/esbuild/blob/537195ae84bee1510fac14235906d588084c39cd/pkg/api/api_impl.go#L366-L388
function parseExternals(externals) {
return externals.map(external => {
// ESBuild's validation pass runs before this function is called so there's no need to assert that there's a single wildcard
const wildcardIdx = external.indexOf(`*`);
if (wildcardIdx !== -1)
return { prefix: external.slice(0, wildcardIdx), suffix: external.slice(wildcardIdx + 1) };
return external;
});
}
function isExternal(path, externals) {
for (const external of externals) {
if (typeof external === `object`) {
// Reference: https://github.com/evanw/esbuild/blob/537195ae84bee1510fac14235906d588084c39cd/internal/resolver/resolver.go#L372-L381
if (path.length >= external.prefix.length + external.suffix.length
&& path.startsWith(external.prefix)
&& path.endsWith(external.suffix)) {
return true;
}
}
else {
if (path === external) {
return true;
}
}
}
return false;
}
async function defaultOnLoad(args) {

@@ -47,6 +75,10 @@ return {

setup(build) {
var _a;
const { findPnpApi } = require(`module`);
if (typeof findPnpApi === `undefined`)
return;
const externals = parseExternals((_a = build.initialOptions.external) !== null && _a !== void 0 ? _a : []);
build.onResolve({ filter }, args => {
if (isExternal(args.path, externals))
return { external: true };
// The entry point resolution uses an empty string

@@ -53,0 +85,0 @@ const effectiveImporter = args.importer

4

package.json
{
"name": "@yarnpkg/esbuild-plugin-pnp",
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"license": "BSD-2-Clause",

@@ -13,3 +13,3 @@ "main": "./lib/index.js",

"devDependencies": {
"@yarnpkg/pnp": "3.0.0-rc.5",
"@yarnpkg/pnp": "3.0.0-rc.6",
"esbuild": "npm:esbuild-wasm@^0.11.20"

@@ -16,0 +16,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