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

@a-la/import

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@a-la/import - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 3 August 2019
### [1.10.0](https://github.com/a-la/import/compare/v1.9.1...v1.10.0)
- [feature] Allow to pass `stdlib` configc.
## 16 May 2019

@@ -2,0 +8,0 @@

12

package.json
{
"name": "@a-la/import",
"version": "1.9.1",
"version": "1.10.0",
"description": "RegExp rules to transpile import statements into require calls (used in ÀLaMode).",

@@ -62,9 +62,9 @@ "main": "build/index.js",

"@a-la/context": "^1.3.0",
"@a-la/fixture-alamode": "1.0.0",
"@a-la/fixture-babel": "1.1.1",
"alamode": "^2.2.0",
"@a-la/fixture-alamode": "1.1.3",
"@a-la/fixture-babel": "1.2.2",
"alamode": "^2.3.6",
"catchment": "^3.3.0",
"documentary": "^1.27.3",
"documentary": "^1.29.0",
"eslint-config-artdeco": "1.0.1",
"restream": "^3.7.1",
"restream": "^3.7.2",
"yarn-s": "1.1.0",

@@ -71,0 +71,0 @@ "zoroaster": "^4.1.1-alpha"

@@ -13,3 +13,5 @@ # @a-la/import

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/0.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/0.svg?sanitize=true">
</a></p>

@@ -30,3 +32,5 @@ ## Table Of Contents

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/1.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/1.svg?sanitize=true">
</a></p>

@@ -41,3 +45,5 @@ ## API

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/2.svg?sanitize=true" width="25"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/2.svg?sanitize=true" width="25">
</a></p>

@@ -80,3 +86,5 @@

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/3.svg?sanitize=true" width="25"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/3.svg?sanitize=true" width="25">
</a></p>

@@ -118,3 +126,5 @@ ### Options

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/4.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/4.svg?sanitize=true">
</a></p>

@@ -151,3 +161,5 @@ ## Output Example

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/5.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/5.svg?sanitize=true">
</a></p>

@@ -206,3 +218,5 @@

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/6.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/6.svg?sanitize=true">
</a></p>

@@ -222,3 +236,5 @@ ## Checklist

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/7.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/7.svg?sanitize=true">
</a></p>

@@ -235,3 +251,4 @@ ## TODO

<a href="https://artd.eco">
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" />
<img width="100" src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png"
alt="Art Deco">
</a>

@@ -242,4 +259,4 @@ </th>

<a href="https://www.technation.sucks" title="Tech Nation Visa">
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif"
alt="Tech Nation Visa" />
<img width="100" src="https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg"
alt="Tech Nation Visa">
</a>

@@ -251,2 +268,4 @@ </th>

<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/-1.svg?sanitize=true"></a></p>
<p align="center"><a href="#table-of-contents">
<img src="/.documentary/section-breaks/-1.svg?sanitize=true">
</a></p>

@@ -0,1 +1,3 @@

import { relative, dirname } from 'path'
export const getRequire = (quotes, src) => {

@@ -2,0 +4,0 @@ return 'r' + `equire(${quotes}${src}${quotes})`

@@ -6,3 +6,3 @@ import {

import fpj from 'fpj'
import { dirname } from 'path'
import { dirname, relative } from 'path'
import { builtinModules } from 'module'

@@ -58,3 +58,16 @@

})
const source = getSource(s, this.config)
const stdlib = getStdlib(this.file, src, this.config)
const source = stdlib || getSource(s, this.config)
if (stdlib) {
if (!namedSeg) {
namedSeg = defSeg.replace(/(\S+)/, '{ $1 }')
defSeg = undefined
defName = undefined
} else if (defSeg) {
namedSeg = namedSeg.replace(/{/, `{ ${defName},`)
namedSeg = defSeg.replace(/\S/g, ' ') + namedSeg
defSeg = undefined
defName = undefined
} // if just named, leave as
}
if (!this.isLocalCache) this.isLocalCache = {}

@@ -71,2 +84,19 @@ if (this.async) {

/**
* @param {string} file Relative path to the current file
* @param {string} src Path to import.
* @param {Object} [config] ÀLaMode configuration.
*/
const getStdlib = (file, src, config = {}) => {
if (!config.import) return null
const { import: { stdlib } } = config
if (stdlib) {
const { packages, path } = stdlib
if (!packages.includes(src)) return src
const rel = relative(dirname(file), path).replace(/.js$/, '')
return rel
}
return null
}
const finish = (namedSeg, fromSeg, defSeg, defName, quotes, source, isLocal) => {

@@ -73,0 +103,0 @@ const { t, ifES } = getDef(defSeg, defName, quotes, source, isLocal)

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