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

@cara/porter

Package Overview
Dependencies
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cara/porter - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

1

loader.js

@@ -202,2 +202,3 @@ /* eslint-env browser */

if (id.slice(-1) == '/') return id + 'index.js';
id = id.replace(/\.(?:js|jsx|ts|tsx|mjs|cjs)$/, '.js');
return /\.(?:css|js|wasm)$/.test(id) ? id : id + '.js';

@@ -204,0 +205,0 @@ }

4

package.json
{
"name": "@cara/porter",
"description": "A middleware for web modules",
"version": "4.0.2",
"version": "4.0.3",
"main": "src/porter.js",

@@ -43,3 +43,3 @@ "repository": {

"license": "BSD-3-Clause",
"gitHead": "912059582593582e7e7563efe1fbd94162e31b31"
"gitHead": "7a7fd5addf84d047ab496eaa03bcdff303aa5677"
}

@@ -12,3 +12,3 @@ 'use strict';

const extMap = {
'.js': [ '.js', '.jsx', '.ts', '.tsx', '.json' ],
'.js': [ '.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs', '.json' ],
'.wasm': [ '.wasm' ],

@@ -94,3 +94,3 @@ '.css': [ '.css', '.less' ],

this.loaderConfig = loaderConfig;
this.#entries = Array.isArray(entries) && entries.length > 0 ? entries : null;
this.#entries = entries && entries.length > 0 ? [].concat(entries) : null;
this.#loaderCache = {};

@@ -97,0 +97,0 @@

@@ -122,2 +122,29 @@ 'use strict';

/**
* Find deps of code and compare them with existing `this.deps` to see if there's
* new dep to parse. Only the modules of the root packet are checked.
* @param {Object} opts
* @param {string} opts.code
* @returns {Array}
*/
async checkImports({ code, intermediate = false }) {
const { imports = [], dynamicImports = [] } = this;
this.matchImport(code);
if (this.imports) {
for (const dep of this.imports) {
if (!imports.includes(dep)) await this.parseImport(dep);
}
}
// when checking imports introduced by intermediate code, dynamic imports need reset
// import(specifier) -> Promise.resolve(require(specifier))
if (intermediate) {
for (let i = this.imports.length; i >= 0; i--) {
const specifier = this.imports[i];
if (dynamicImports.includes(specifier)) this.imports.splice(i, 1);
}
this.dynamicImports = dynamicImports;
}
}
async minify() {

@@ -124,0 +151,0 @@ if (this.cache && this.cache.minified) return this.cache;

@@ -210,18 +210,9 @@ 'use strict';

*/
async checkImports({ code, intermediate = false }) {
const { imports, dynamicImports = [] } = this;
async checkImports({ code }) {
const { imports } = this;
this.matchImport(code);
for (const dep of this.imports) {
if (!imports.includes(dep)) await this.parseImport(dep);
}
// when checking imports introduced by intermediate code, dynamic imports need reset
// import(specifier) -> Promise.resolve(require(specifier))
if (intermediate) {
for (let i = this.imports.length; i >= 0; i--) {
const specifier = this.imports[i];
if (dynamicImports.includes(specifier)) this.imports.splice(i, 1);
if (this.imports) {
for (const dep of this.imports) {
if (!imports.includes(dep)) await this.parseImport(dep);
}
this.dynamicImports = dynamicImports;
}

@@ -228,0 +219,0 @@ }

@@ -41,2 +41,4 @@ 'use strict';

case '.jsx':
case '.mjs':
case '.cjs':
return new JsModule(opts);

@@ -43,0 +45,0 @@ case '.less':

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