New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@artdeco/pirates

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artdeco/pirates

[fork] Properly Hijack Require In ES6 For Google Closure Compiler.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@artdeco/pirates

npm version

@artdeco/pirates is a fork of Properly Hijack Require In ES6 For Google Closure Compiler.

yarn add @artdeco/pirates

Table Of Contents

API

The package is available by importing its default function:

import addHook from '@artdeco/pirates'

addHook(
  hook: function,
  conf?: Config,
): function

Add a require hook. Returns a function that allows to revert the hook.

_pirates.Config: Options for the program.

NameTypeDescriptionDefault
exts(string | !Array<string>)The extension or extensions to hook. Should start with ...js
matcher(path: string) => booleanA matcher function, will be called with path to a file. Should return truthy if the file should be hooked, falsy otherwise.-
ignoreNodeModulesbooleanAuto-ignore node_modules. Independent of any matcher.false
import addHook from '@artdeco/pirates'
import { relative } from 'path'

addHook((code, filename) => {
  const rel = relative('', filename)
  return `console.log('hooked source code from %s:', '${rel}')
  ${code}`
})

require('./source')
hooked source code from example/source.js:
hello world

Original Author: Ari Porad

Art Deco © Art Deco 2019 Tech Nation Visa Tech Nation Visa Sucks

Keywords

pirates

FAQs

Package last updated on 24 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts