hermes-transform
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -27,2 +27,4 @@ /** | ||
let cache = 1; | ||
async function print(ast, originalCode, prettierOptions = {}, visitorKeys) { | ||
@@ -79,9 +81,33 @@ // $FlowExpectedError[incompatible-type] This is now safe to access. | ||
{ | ||
var _hermesPlugin$parsers; | ||
const hermesPlugin = require('prettier-plugin-hermes-parser'); | ||
const hermesParser = (_hermesPlugin$parsers = hermesPlugin.parsers) == null ? void 0 : _hermesPlugin$parsers.hermes; | ||
if (hermesParser == null) { | ||
throw new Error('Hermes parser plugin not found'); | ||
} | ||
return prettier.format(originalCode, // $FlowExpectedError[incompatible-exact] - we don't want to create a dependency on the prettier types | ||
{ ...prettierOptions, | ||
parser: 'hermes', | ||
requirePragma: false, | ||
plugins: [// $FlowExpectedError[incompatible-call] Cache value is not expected but needed in this case. | ||
{ | ||
parsers: { | ||
hermes: { ...hermesParser, | ||
// Prettier caches the plugin, by making this key always unique we ensure the new `parse` | ||
// function with the correct AST is always called. | ||
cache: cache++, | ||
parser() { | ||
return program; | ||
} | ||
// Provide the passed AST to prettier | ||
parse() { | ||
return program; | ||
} | ||
} | ||
}, | ||
printers: hermesPlugin.printers | ||
}] | ||
}); | ||
@@ -88,0 +114,0 @@ } |
{ | ||
"name": "hermes-transform", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"description": "Tools built on top of Hermes-ESTree to enable codebase transformation", | ||
@@ -15,5 +15,5 @@ "main": "dist/index.js", | ||
"flow-enums-runtime": "^0.0.6", | ||
"hermes-eslint": "0.12.1", | ||
"hermes-estree": "0.12.1", | ||
"hermes-parser": "0.12.1" | ||
"hermes-eslint": "0.13.0", | ||
"hermes-estree": "0.13.0", | ||
"hermes-parser": "0.13.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
605428
5897
21178
+ Addedhermes-eslint@0.13.0(transitive)
+ Addedhermes-estree@0.13.0(transitive)
+ Addedhermes-parser@0.13.0(transitive)
- Removedhermes-eslint@0.12.1(transitive)
- Removedhermes-estree@0.12.1(transitive)
- Removedhermes-parser@0.12.1(transitive)
Updatedhermes-eslint@0.13.0
Updatedhermes-estree@0.13.0
Updatedhermes-parser@0.13.0