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

lavamoat-core

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lavamoat-core - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

4

package.json
{
"name": "lavamoat-core",
"version": "1.1.3",
"version": "2.0.0",
"description": "LavaMoat kernel and utils",

@@ -52,3 +52,3 @@ "main": "src/index.js",

},
"gitHead": "c8fd2a5dea15e236bceebd59296ed56b5f02a9ad"
"gitHead": "308a4822fb7629d5ef1e3758c691fec535d9c501"
}

@@ -5,3 +5,3 @@ (function(){

function createKernel ({ realm, globalRef, debugMode, unsafeEvalWithEndowments, lavamoatConfig, loadModuleData, getRelativeModuleId }) {
function createKernel ({ realm, globalRef, debugMode, unsafeEvalWithEndowments, lavamoatConfig, loadModuleData, getRelativeModuleId, prepareModuleInitializerArgs }) {
// create SES-wrapped LavaMoat kernel

@@ -17,2 +17,3 @@ const makeKernel = realm.evaluate(`(${unsafeCreateKernel})`, { console })

getRelativeModuleId,
prepareModuleInitializerArgs,
})

@@ -33,2 +34,3 @@

getRelativeModuleId,
prepareModuleInitializerArgs,
}) {

@@ -143,24 +145,6 @@ // "templateRequire" calls are inlined in "generatePrelude"

// browserify goop:
// this "modules" interface is exposed to the browserify moduleInitializer
// https://github.com/browserify/browser-pack/blob/cd0bd31f8c110e19a80429019b64e887b1a82b2b/prelude.js#L38
// browserify's browser-resolve uses "arguments[4]" to do direct module initializations
// browserify seems to do this when module references are redirected by the "browser" field
// this proxy shims this behavior
// TODO: would be better to just fix this by removing the indirection (maybe in https://github.com/browserify/module-deps?)
// though here and in the original browser-pack prelude it has a side effect that it is re-instantiated from the original module (no shared closure state)
const directModuleInstantiationInterface = new Proxy({}, {
get (_, targetModuleId) {
const fakeModuleDefinition = [fakeModuleInitializer]
return fakeModuleDefinition
const initializerArgs = prepareModuleInitializerArgs(requireRelativeWithContext, moduleObj, moduleData)
function fakeModuleInitializer () {
const targetModuleExports = requireRelativeWithContext(targetModuleId)
moduleObj.exports = targetModuleExports
}
}
})
// initialize the module with the correct context
moduleInitializer.call(moduleObj.exports, requireRelativeWithContext, moduleObj, moduleObj.exports, null, directModuleInstantiationInterface)
moduleInitializer.apply(moduleObj.exports, initializerArgs)

@@ -293,5 +277,4 @@ // configure membrane defense

//# sourceURL=Lavamoat/core/kernel
}
})()

@@ -7,3 +7,3 @@ // LavaMoat Prelude

function createKernel ({ lavamoatConfig, loadModuleData, getRelativeModuleId }) {
function createKernel ({ lavamoatConfig, loadModuleData, getRelativeModuleId, prepareModuleInitializerArgs }) {
const debugMode = __lavamoatDebugMode__

@@ -34,2 +34,3 @@

getRelativeModuleId,
prepareModuleInitializerArgs,
realm,

@@ -36,0 +37,0 @@ unsafeEvalWithEndowments,

@@ -37,2 +37,3 @@ // LavaMoat Prelude

getRelativeModuleId,
prepareModuleInitializerArgs,
})

@@ -106,2 +107,30 @@

function prepareModuleInitializerArgs (requireRelativeWithContext, moduleObj, moduleData) {
const require = requireRelativeWithContext
const module = moduleObj
const exports = moduleObj.exports
// browserify goop:
// this "modules" interface is exposed to the browserify moduleInitializer
// https://github.com/browserify/browser-pack/blob/cd0bd31f8c110e19a80429019b64e887b1a82b2b/prelude.js#L38
// browserify's browser-resolve uses "arguments[4]" to do direct module initializations
// browserify seems to do this when module references are redirected by the "browser" field
// this proxy shims this behavior
// this is utilized by browserify's dedupe feature
// though in the original browser-pack prelude it has a side effect that it is re-instantiated from the original module (no shared closure state)
const directModuleInstantiationInterface = new Proxy({}, {
get (_, targetModuleId) {
const fakeModuleDefinition = [fakeModuleInitializer]
return fakeModuleDefinition
function fakeModuleInitializer () {
const targetModuleExports = requireRelativeWithContext(targetModuleId)
moduleObj.exports = targetModuleExports
}
}
})
return [require, module, exports, null, directModuleInstantiationInterface]
}
})()
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