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

exoform

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exoform

Transform CommonJS to asynchronous content-addressed modules.

  • 1.2.0
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Exoform

Exoform takes a module defined in CommonJS style, and recursively transforms it, and its dependencies into asynchronous content-addressed require calls.

This gives you the whole program, and its dependencies, in a content-addressable manner, that you could later require from other programs.

Example

Input: test/req/one.js

var a = require('./two.js')
var b = require('./two.js').blorp
var c = require('./two.js').blorp()

var x = { y: { z: {} } }
x.y.z.two = require('./two.js')

console.log(x.y.z.two.blorp())
console.log(a.blorp())
console.log(b())
console.log(c)
exoform test/req/one.js | ipfs cat

Output:

var __meta
if (typeof arguments !== 'undefined') {
  __meta = arguments[0]
} else {
  __meta = {
    exoform: require('exoform'),
    define: function () {},
    refs: [] } }
var exoform = __meta.exoform
var exports = __meta.mod
var module = { exports: exports }
'use strict';

__meta.exoform.require(__meta.refs, 'QmTg6MAGCTxnqpT6v6A1u7fDip5piterr5cJydzWbhCgX7', function (a) {
__meta.exoform.require(__meta.refs, 'QmTg6MAGCTxnqpT6v6A1u7fDip5piterr5cJydzWbhCgX7', function (b) {
b = b.blorp
__meta.exoform.require(__meta.refs, 'QmTg6MAGCTxnqpT6v6A1u7fDip5piterr5cJydzWbhCgX7', function (c) {
c = c.blorp()

var x = { y: { z: {} } };
__meta.exoform.require(__meta.refs, 'QmTg6MAGCTxnqpT6v6A1u7fDip5piterr5cJydzWbhCgX7', function (two) {
x.y.z.two = two;

console.log(x.y.z.two.blorp());
console.log(a.blorp());
console.log(b());
console.log(c);
__meta.define(module.exports)
})})})})

The dependency loaded (test/req/two.js):

ipfs cat QmTg6MAGCTxnqpT6v6A1u7fDip5piterr5cJydzWbhCgX7

outputs:

var __meta
if (typeof arguments !== 'undefined') {
  __meta = arguments[0]
} else {
  __meta = {
    exoform: require('exoform'),
    define: function () {},
    refs: [] } }
var exoform = __meta.exoform
var exports = __meta.mod
var module = { exports: exports }
'use strict';

__meta.exoform.require(__meta.refs,'QmcJu1cijCd31EgkydhVthdepc8mtABHPjk4HuEtZLiWE7', function (three) {

module.exports = { blorp: function blorp() {
    return 'testblorp ' + three('extra');
  } };
__meta.define(module.exports)
})

Todo

Extended support for the browserify ecosystem and browser ports of node modules

FAQs

Package last updated on 17 Dec 2015

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

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