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

@architect/hydrate

Package Overview
Dependencies
Maintainers
6
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/hydrate - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

14

changelog.md

@@ -5,2 +5,10 @@ # Architect Hydrate changelog

## [2.2.3] 2022-01-11
### Fixed
- Fix potential false tree shaking errors in ESM files that make use of `require()` (e.g. via `import { createRequire } from 'module'`)
---
## [2.2.2] 2022-01-10

@@ -10,3 +18,3 @@

- Fix false positive treeshaking of `import`s from http(s)
- Fix false positive tree shaking of `import`s from http(s)

@@ -19,3 +27,3 @@ ---

- Fixed treeshaking detection of CJS/ESM when strings `import` and `require` are present in the AST
- Fixed tree shaking detection of CJS/ESM when strings `import` and `require` are present in the AST

@@ -28,3 +36,3 @@ ---

- Added support for Node.js 14 ESM Lambda treeshaking!
- Added support for Node.js 14 ESM Lambda tree shaking!

@@ -31,0 +39,0 @@ ---

{
"name": "@architect/hydrate",
"version": "2.2.2",
"version": "2.2.3",
"description": "Architect dependency hydrator and shared file manager",

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

@@ -18,11 +18,8 @@ let { readFileSync } = require('fs')

// Can't use both module systems in the same file
if (hasRequire && hasImport) throw Error(`Found both 'import' and 'require' statements in ${file}`)
let isESM = !!(hasImport)
let called = []
let query = isESM
? `ImportExpression, ImportDeclaration, ExpressionStatement[expression.type='ImportExpression'], Property[key.name='import']`
: `[callee.name='require']`
let esmQuery = `ImportExpression, ImportDeclaration, ExpressionStatement[expression.type='ImportExpression'], Property[key.name='import']`
let query = `[callee.name='require']`
if (isESM) query = query += ', ' + esmQuery
let imports = esquery.query(ast, query)

@@ -42,5 +39,6 @@

if (isESM) {
if (r.expression) arg = r.expression?.source
else if (r.source) arg = r.source
else if (r.value) arg = r.value?.params?.[0]
if (r.expression) arg = r.expression?.source
else if (r.source) arg = r.source
else if (r.value) arg = r.value?.params?.[0]
else if (r.arguments) arg = r?.arguments?.[0]
}

@@ -47,0 +45,0 @@ else {

@@ -8,3 +8,3 @@ let { join } = require('path')

module.exports = function getDirDeps ({ dir, update, inventory }) {
// Clean everything (except the root) out bebefore we get going jic
// Clean everything (except the root) out before we get going jic
let isRoot = dir === inventory.inv._project.src

@@ -11,0 +11,0 @@ if (!isRoot) {

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