@agoric/transform-bang
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -8,14 +8,23 @@ 'use strict'; | ||
// Promise.resolve(...).get/put/post/delete | ||
const parseFunc = | ||
(ss.sourceType === 'expression' && parser.parseExpression) || parser.parse; | ||
const ast = (parseFunc || parser)(ss.src, { | ||
const source = ss.src; | ||
const parseFunc = parser.parse; | ||
const ast = (parseFunc || parser)(source, { | ||
plugins: ['infixBang'], | ||
}); | ||
// Create the source from the ast. | ||
const output = generate(ast, {}, ss.src); | ||
// console.log(`have src`, output.code); | ||
const output = generate(ast, {}, source); | ||
// Work around Babel appending semicolons. | ||
const maybeSource = output.code; | ||
const actualSource = | ||
ss.sourceType === 'expression' && | ||
maybeSource.endsWith(';') && | ||
!source.endsWith(';') | ||
? maybeSource.slice(0, -1) | ||
: maybeSource; | ||
return { | ||
...ss, | ||
ast, | ||
src: output.code, | ||
src: actualSource, | ||
}; | ||
@@ -22,0 +31,0 @@ }, |
@@ -6,14 +6,23 @@ function makeBangTransformer(parser, generate) { | ||
// Promise.resolve(...).get/put/post/delete | ||
const parseFunc = | ||
(ss.sourceType === 'expression' && parser.parseExpression) || parser.parse; | ||
const ast = (parseFunc || parser)(ss.src, { | ||
const source = ss.src; | ||
const parseFunc = parser.parse; | ||
const ast = (parseFunc || parser)(source, { | ||
plugins: ['infixBang'], | ||
}); | ||
// Create the source from the ast. | ||
const output = generate(ast, {}, ss.src); | ||
// console.log(`have src`, output.code); | ||
const output = generate(ast, {}, source); | ||
// Work around Babel appending semicolons. | ||
const maybeSource = output.code; | ||
const actualSource = | ||
ss.sourceType === 'expression' && | ||
maybeSource.endsWith(';') && | ||
!source.endsWith(';') | ||
? maybeSource.slice(0, -1) | ||
: maybeSource; | ||
return { | ||
...ss, | ||
ast, | ||
src: output.code, | ||
src: actualSource, | ||
}; | ||
@@ -20,0 +29,0 @@ }, |
@@ -12,14 +12,23 @@ (function (global, factory) { | ||
// Promise.resolve(...).get/put/post/delete | ||
const parseFunc = | ||
(ss.sourceType === 'expression' && parser.parseExpression) || parser.parse; | ||
const ast = (parseFunc || parser)(ss.src, { | ||
const source = ss.src; | ||
const parseFunc = parser.parse; | ||
const ast = (parseFunc || parser)(source, { | ||
plugins: ['infixBang'], | ||
}); | ||
// Create the source from the ast. | ||
const output = generate(ast, {}, ss.src); | ||
// console.log(`have src`, output.code); | ||
const output = generate(ast, {}, source); | ||
// Work around Babel appending semicolons. | ||
const maybeSource = output.code; | ||
const actualSource = | ||
ss.sourceType === 'expression' && | ||
maybeSource.endsWith(';') && | ||
!source.endsWith(';') | ||
? maybeSource.slice(0, -1) | ||
: maybeSource; | ||
return { | ||
...ss, | ||
ast, | ||
src: output.code, | ||
src: actualSource, | ||
}; | ||
@@ -26,0 +35,0 @@ }, |
{ | ||
"name": "@agoric/transform-bang", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "transform-bang", | ||
@@ -5,0 +5,0 @@ "main": "dist/transform-bang.cjs.js", |
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
16164
97