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

@endo/static-module-record

Package Overview
Dependencies
Maintainers
4
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endo/static-module-record - npm Package Compare versions

Comparing version 0.6.12 to 0.6.13

16

CHANGELOG.md

@@ -6,2 +6,18 @@ # Change Log

### [0.6.13](https://github.com/endojs/endo/compare/@endo/static-module-record@0.6.12...@endo/static-module-record@0.6.13) (2022-02-18)
### Bug Fixes
* Make jsconfigs less brittle ([861ca32](https://github.com/endojs/endo/commit/861ca32a72f0a48410fd93b1cbaaad9139590659))
* Make sure lint:type runs correctly in CI ([a520419](https://github.com/endojs/endo/commit/a52041931e72cb7b7e3e21dde39c099cc9f262b0))
* Unify TS version to ~4.2 ([5fb173c](https://github.com/endojs/endo/commit/5fb173c05c9427dca5adfe66298c004780e8b86c))
### Reverts
* Revert "Revert "fix(static-module-record): minimise source changes with `recast`"" ([ce53158](https://github.com/endojs/endo/commit/ce5315849ffcb71794f3264871b371eb5ae6d00c))
### [0.6.12](https://github.com/endojs/endo/compare/@endo/static-module-record@0.6.11...@endo/static-module-record@0.6.12) (2022-01-31)

@@ -8,0 +24,0 @@

17

package.json
{
"name": "@endo/static-module-record",
"version": "0.6.12",
"version": "0.6.13",
"description": "Shim for the SES StaticModuleRecord and module-to-program transformer",

@@ -32,3 +32,3 @@ "keywords": [

"lint": "yarn lint:types && yarn lint:js",
"lint:types": "tsc --build jsconfig.json",
"lint:types": "tsc -p jsconfig.json",
"lint:js": "eslint .",

@@ -40,8 +40,11 @@ "lint-fix": "eslint --fix .",

"@agoric/babel-standalone": "^7.14.3",
"ses": "^0.15.7"
"@babel/traverse": "^7.10.4",
"@babel/types": "^7.10.4",
"recast": "agoric-labs/recast#Agoric-built",
"ses": "^0.15.8"
},
"devDependencies": {
"@ava/babel": "^1.0.1",
"@endo/eslint-config": "^0.4.2",
"@endo/ses-ava": "^0.2.17",
"@endo/eslint-config": "^0.4.3",
"@endo/ses-ava": "^0.2.18",
"ava": "^3.12.1",

@@ -57,3 +60,3 @@ "babel-eslint": "^10.0.3",

"prettier": "^1.19.1",
"typescript": "^4.2.3"
"typescript": "~4.5.5"
},

@@ -85,3 +88,3 @@ "files": [

},
"gitHead": "96df4cf238b245cc92c78e4af4667f405b8cf4f0"
"gitHead": "9d2f88ab47f546bc59b6b6e7340482209b3cee56"
}

@@ -41,18 +41,2 @@ /* eslint max-lines: 0 */

const prependReplacements = (replacements, node) => {
const lastReplace = replacements[replacements.length - 1];
if (lastReplace) {
lastReplace.trailingComments = node.trailingComments;
node.trailingComments = undefined;
}
replacements.unshift(node);
};
const displayAsExport = node => {
if (node.loc) {
node.loc.prependText = '/*EX*/ ';
}
return node;
};
function makeModulePlugins(options) {

@@ -95,2 +79,16 @@ const {

const rewriteModules = pass => ({ types: t }) => {
const replace = (
src,
node = t.expressionStatement(t.identifier('null')),
) => {
node.loc = src.loc;
node.comments = [...(src.leadingComments || [])];
t.inheritsComments(node, src);
return node;
};
const prependReplacements = (replacements, node) => {
replacements.unshift(node);
};
const allowedHiddens = new WeakSet();

@@ -260,3 +258,3 @@ const rewrittenDecls = new WeakSet();

const isConst = decl.kind === 'const';
const replace = rewriteVars(
const replacements = rewriteVars(
vids,

@@ -269,3 +267,3 @@ isConst,

if (replace.length > 0) {
if (replacements.length > 0) {
switch (decl.type) {

@@ -275,7 +273,7 @@ case 'VariableDeclaration': {

rewrittenDecls.add(decl);
prependReplacements(replace, decl);
prependReplacements(replacements, decl);
break;
}
case 'FunctionDeclaration': {
prependReplacements(replace, decl);
prependReplacements(replacements, decl);
break;

@@ -287,6 +285,4 @@ }

}
path.replaceWithMultiple(replacements);
}
if (replace.length > 0) {
path.replaceWithMultiple(replace);
}
};

@@ -415,3 +411,3 @@

path.replaceWithMultiple([
displayAsExport(decl),
replace(path.node, decl),
t.expressionStatement(t.callExpression(callee, [decl.id])),

@@ -424,3 +420,4 @@ ]);

path.replaceWithMultiple([
displayAsExport(
replace(
path.node,
t.variableDeclaration('const', [

@@ -596,3 +593,3 @@ t.variableDeclarator(

if (doTransform) {
path.replaceWithMultiple(decl ? [displayAsExport(decl)] : []);
path.replaceWithMultiple(decl ? [replace(path.node, decl)] : []);
}

@@ -599,0 +596,0 @@ },

@@ -0,1 +1,5 @@

import * as recastCJS from 'recast';
import traverseCJS from '@babel/traverse';
import typesCJS from '@babel/types';
import * as h from './hidden.js';

@@ -42,2 +46,3 @@ import makeModulePlugins from './babelPlugin.js';

'classPrivateMethods',
'classPrivateProperties',
// 'v8intrinsic', // we really don't want people to rely on platform powers

@@ -52,25 +57,26 @@ 'partialApplication',

const allowAwaitOutsideFunction = false;
babel.transform(code, {
parserOpts: {
allowAwaitOutsideFunction,
plugins: parserPlugins,
const recast = recastCJS.default || recastCJS;
const ast = recast.parse(code, {
parser: {
parse: source =>
babel.transform(source, {
parserOpts: {
allowAwaitOutsideFunction,
tokens: true,
plugins: parserPlugins,
},
plugins: [analyzePlugin],
ast: true,
code: false,
}).ast,
},
generatorOpts: {
retainLines: true,
compact: false,
},
plugins: [analyzePlugin],
ast: false,
code: false,
});
({ code } = babel.transform(code, {
parserOpts: {
allowAwaitOutsideFunction,
plugins: parserPlugins,
},
generatorOpts: {
retainLines: true,
compact: false,
},
plugins: [transformPlugin],
const traverse = traverseCJS.default || traverseCJS;
const types = typesCJS.default || typesCJS;
traverse(ast, transformPlugin({ types }).visitor);
({ code } = recast.print(ast, {
wrapColumn: Infinity,
reuseWhitespace: true,
includeComments: true,
retainLines: true,
}));

@@ -77,0 +83,0 @@

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