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

@agoric/bundle-source

Package Overview
Dependencies
Maintainers
5
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/bundle-source - npm Package Compare versions

Comparing version 1.2.5-dev.0 to 1.3.0

8

CHANGELOG.md

@@ -6,10 +6,14 @@ # Change Log

## [1.2.5-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/bundle-source@1.2.4...@agoric/bundle-source@1.2.5-dev.0) (2021-03-26)
# [1.3.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/bundle-source@1.2.4...@agoric/bundle-source@1.3.0) (2021-04-06)
**Note:** Version bump only for package @agoric/bundle-source
### Features
* **bundle-source:** Apply evasive transforms to Endo archives ([#2768](https://github.com/Agoric/agoric-sdk/issues/2768)) ([e15cee8](https://github.com/Agoric/agoric-sdk/commit/e15cee88cf1f74e2debd4426dbc22a99b88fb1d6))
* **bundle-source:** Specific ModuleFormat type ([#2767](https://github.com/Agoric/agoric-sdk/issues/2767)) ([6fe2ff7](https://github.com/Agoric/agoric-sdk/commit/6fe2ff7d535ef5749f4e9bf7056b5e7dab897a61))
## [1.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/bundle-source@1.2.3...@agoric/bundle-source@1.2.4) (2021-03-24)

@@ -16,0 +20,0 @@

{
"name": "@agoric/bundle-source",
"version": "1.2.5-dev.0",
"version": "1.3.0",
"description": "Create source bundles from ES Modules",

@@ -20,3 +20,3 @@ "parsers": {

"devDependencies": {
"@agoric/install-ses": "^0.5.5-dev.0",
"@agoric/install-ses": "^0.5.5",
"ava": "^3.12.1",

@@ -26,9 +26,9 @@ "nyc": "^15.1.0"

"dependencies": {
"@agoric/acorn-eventual-send": "^2.1.5-dev.0",
"@agoric/acorn-eventual-send": "^2.1.5",
"@agoric/babel-parser": "^7.6.4",
"@agoric/base64": "^0.1.5-dev.0",
"@agoric/compartment-mapper": "^0.2.3",
"@agoric/transform-eventual-send": "^1.4.5-dev.0",
"@agoric/compartment-mapper": "^0.2.4",
"@agoric/transform-eventual-send": "^1.4.5",
"@babel/generator": "^7.6.4",
"@babel/traverse": "^7.8.3",
"@endo/base64": "^0.1.0",
"@rollup/plugin-commonjs": "~11.0.2",

@@ -39,3 +39,3 @@ "@rollup/plugin-node-resolve": "^7.1.1",

"rollup": "^1.32.0",
"ses": "^0.12.3",
"ses": "^0.12.6",
"source-map": "^0.7.3"

@@ -78,3 +78,3 @@ },

},
"gitHead": "3600ed30e30d2b26512fe8fd8e73d9f13ab0d125"
"gitHead": "fda787c49e9e3a80c3b2c3b0e620da0208ca7a3e"
}

@@ -12,3 +12,3 @@ /* global process */

import { makeArchive } from '@agoric/compartment-mapper';
import { encodeBase64 } from '@agoric/base64';
import { encodeBase64 } from '@endo/base64';

@@ -27,2 +27,4 @@ import { SourceMapConsumer } from 'source-map';

const textEncoder = new TextEncoder();
const textDecoder = new TextDecoder();
const read = async location => fs.promises.readFile(new URL(location).pathname);

@@ -97,6 +99,10 @@

enter(p) {
const { loc, leadingComments, trailingComments } = p.node;
if (p.node.comments) {
p.node.comments = [];
}
const {
loc,
comments,
leadingComments,
innerComments,
trailingComments,
} = p.node;
(comments || []).forEach(node => rewriteComment(node, unmapLoc));
// Rewrite all comments.

@@ -107,2 +113,3 @@ (leadingComments || []).forEach(node => rewriteComment(node, unmapLoc));

}
(innerComments || []).forEach(node => rewriteComment(node, unmapLoc));
// If not a comment, and we are unmapping the source maps,

@@ -118,3 +125,6 @@ // then do it for this location.

async function transformSource(code, { sourceMap, useLocationUnmap }) {
async function transformSource(
code,
{ sourceMap, useLocationUnmap, sourceType } = {},
) {
// Parse the rolled-up chunk with Babel.

@@ -124,2 +134,3 @@ // We are prepared for different module systems.

plugins: ['bigInt'],
sourceType,
});

@@ -157,3 +168,14 @@

const entry = new URL(startFilename, base).toString();
const bytes = await makeArchive(read, entry);
const bytes = await makeArchive(read, entry, {
moduleTransforms: {
async mjs(sourceBytes) {
const source = textDecoder.decode(sourceBytes);
const { code: object } = await transformSource(source, {
sourceType: 'module',
});
const objectBytes = textEncoder.encode(object);
return { bytes: objectBytes, parser: 'mjs' };
},
},
});
const endoZipBase64 = encodeBase64(bytes);

@@ -160,0 +182,0 @@ return { endoZipBase64, moduleFormat };

/**
* @typedef {'getExport' | 'nestedEvaluate' | 'endoZipBase64'} ModuleFormat
*/
/**
* @callback BundleSource
* @param {string} startFilename - the filepath to start the bundling from
* @param {string=} moduleFormat
* @param {ModuleFormat=} moduleFormat
* @param {Object=} powers
*/
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