@endo/static-module-record
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -6,2 +6,11 @@ # Change Log | ||
### [0.6.1](https://github.com/endojs/endo/compare/@endo/static-module-record@0.6.0...@endo/static-module-record@0.6.1) (2021-08-13) | ||
### Bug Fixes | ||
* **static-module-record:** Do not duplicate comments ([#863](https://github.com/endojs/endo/issues/863)) ([85136e3](https://github.com/endojs/endo/commit/85136e314ecbe238a82e86c47be1757ef2887dd2)) | ||
## [0.6.0](https://github.com/endojs/endo/compare/@endo/static-module-record@0.5.4...@endo/static-module-record@0.6.0) (2021-07-22) | ||
@@ -8,0 +17,0 @@ |
{ | ||
"name": "@endo/static-module-record", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Shim for the SES StaticModuleRecord and module-to-program transformer", | ||
@@ -42,4 +42,4 @@ "keywords": [ | ||
"@ava/babel": "^1.0.1", | ||
"@endo/eslint-config": "^0.3.12", | ||
"@endo/ses-ava": "^0.2.5", | ||
"@endo/eslint-config": "^0.3.13", | ||
"@endo/ses-ava": "^0.2.6", | ||
"ava": "^3.12.1", | ||
@@ -55,3 +55,3 @@ "babel-eslint": "^10.0.3", | ||
"prettier": "^1.19.1", | ||
"ses": "^0.14.0", | ||
"ses": "^0.14.1", | ||
"typescript": "^4.0.5" | ||
@@ -83,3 +83,3 @@ }, | ||
}, | ||
"gitHead": "2e9673128014d82f238e845c9285ba7005c30900" | ||
"gitHead": "9d8ad5a2dff0cdb8fc7ce4daa119b3aa31a44fa4" | ||
} |
@@ -173,3 +173,3 @@ /* eslint max-lines: 0 */ | ||
t.memberExpression(hLiveId, t.identifier(name)), | ||
[id], | ||
[t.identifier(id.name)], | ||
), | ||
@@ -184,3 +184,3 @@ ), | ||
t.variableDeclaration('let', [ | ||
t.variableDeclarator(t.identifier(name), id), | ||
t.variableDeclarator(t.identifier(name), t.identifier(id.name)), | ||
]), | ||
@@ -205,3 +205,7 @@ ); | ||
t.expressionStatement( | ||
t.assignmentExpression('=', t.identifier(name), id), | ||
t.assignmentExpression( | ||
'=', | ||
t.identifier(name), | ||
t.identifier(id.name), | ||
), | ||
), | ||
@@ -215,3 +219,6 @@ ); | ||
t.expressionStatement( | ||
t.callExpression(t.memberExpression(hOnceId, id), [id]), | ||
t.callExpression( | ||
t.memberExpression(hOnceId, t.identifier(id.name)), | ||
[t.identifier(id.name)], | ||
), | ||
), | ||
@@ -588,6 +595,8 @@ ); | ||
const rewriters = [rewriteModules(0), rewriteModules(1)]; | ||
return rewriters; | ||
return { | ||
analyzePlugin: rewriteModules(0), | ||
transformPlugin: rewriteModules(1), | ||
}; | ||
} | ||
export default makeModulePlugins; |
@@ -7,3 +7,3 @@ import * as h from './hidden.js'; | ||
const makeTransformSource = babel => | ||
function transformSource(source, sourceOptions = {}) { | ||
function transformSource(code, sourceOptions = {}) { | ||
// Transform the script/expression source for import expressions. | ||
@@ -48,7 +48,9 @@ const parserPlugins = []; | ||
// console.log(`transforming`, sourceOptions, source); | ||
const modulePlugins = makeModulePlugins(sourceOptions); | ||
const output = babel.transform(source, { | ||
// console.log(`transforming`, sourceOptions, code); | ||
const { analyzePlugin, transformPlugin } = makeModulePlugins(sourceOptions); | ||
// TODO top-level-await https://github.com/endojs/endo/issues/306 | ||
const allowAwaitOutsideFunction = false; | ||
babel.transform(code, { | ||
parserOpts: { | ||
// allowAwaitOutsideFunction: true, | ||
allowAwaitOutsideFunction, | ||
plugins: parserPlugins, | ||
@@ -59,24 +61,16 @@ }, | ||
}, | ||
plugins: [modulePlugins[0]], | ||
ast: true, | ||
code: modulePlugins.length === 1, | ||
plugins: [analyzePlugin], | ||
ast: false, | ||
code: false, | ||
}); | ||
let { ast, code } = output; | ||
for (let i = 1; i < modulePlugins.length - 1; i += 1) { | ||
const middleOut = babel.transformFromAst(ast, source, { | ||
plugins: [modulePlugins[i]], | ||
ast: true, | ||
code: false, | ||
}); | ||
ast = middleOut.ast; | ||
} | ||
if (modulePlugins.length > 1) { | ||
const finalOut = babel.transformFromAst(ast, source, { | ||
generatorOpts: { | ||
retainLines: true, | ||
}, | ||
plugins: [modulePlugins[modulePlugins.length - 1]], | ||
}); | ||
code = finalOut.code; | ||
} | ||
({ code } = babel.transform(code, { | ||
parserOpts: { | ||
allowAwaitOutsideFunction, | ||
plugins: parserPlugins, | ||
}, | ||
generatorOpts: { | ||
retainLines: true, | ||
}, | ||
plugins: [transformPlugin], | ||
})); | ||
@@ -83,0 +77,0 @@ // console.log(`transformed to`, output.code); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48450
869