prettier-plugin-hermes-parser
Advanced tools
Comparing version 0.20.1 to 0.21.0
@@ -39,24 +39,2 @@ /** | ||
/** | ||
* Create a prettier plugin config for prettier v3 which adds | ||
* hermes parser support. | ||
*/ | ||
function createPrettierV3HermesPlugin() { | ||
return { | ||
// $FlowExpectedError[unsafe-getters-setters] | ||
get parsers() { | ||
// Lazy require this module as its only available in prettier v3. | ||
const flowPlugin = require('prettier/plugins/flow'); | ||
return { | ||
hermes: { ...flowPlugin.parsers.flow, | ||
parse | ||
} | ||
}; | ||
} | ||
}; | ||
} | ||
/** | ||
* Create a prettier plugin config for prettier v2 which adds | ||
@@ -67,3 +45,3 @@ * hermes parser support and patches in prettier v3 printing logic. | ||
function createPrettierV2HermesPlugin() { | ||
function createPrettierHermesPlugin() { | ||
// Lazy require custom prettier v3 internals | ||
@@ -175,18 +153,2 @@ const { | ||
function getPrettierFlowPlugin() { | ||
const { | ||
version | ||
} = require('prettier'); | ||
if (version.startsWith('3.')) { | ||
return createPrettierV3HermesPlugin(); | ||
} | ||
if (version.startsWith('2.')) { | ||
return createPrettierV2HermesPlugin(); | ||
} | ||
throw new Error(`Unsupported prettier version: ${version}`); | ||
} | ||
module.exports = getPrettierFlowPlugin(); | ||
module.exports = createPrettierHermesPlugin(); |
{ | ||
"name": "prettier-plugin-hermes-parser", | ||
"version": "0.20.1", | ||
"version": "0.21.0", | ||
"description": "Hermes parser plugin for Prettier.", | ||
@@ -12,5 +12,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"hermes-estree": "0.20.1", | ||
"hermes-parser": "0.20.1", | ||
"prettier-plugin-hermes-parser": "0.20.1" | ||
"hermes-estree": "0.21.0", | ||
"hermes-parser": "0.21.0", | ||
"prettier-plugin-hermes-parser": "0.21.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "peerDependencies": { |
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
1045180
26570
+ Addedhermes-estree@0.21.0(transitive)
+ Addedhermes-parser@0.21.0(transitive)
- Removedhermes-estree@0.20.1(transitive)
- Removedhermes-parser@0.20.1(transitive)
Updatedhermes-estree@0.21.0
Updatedhermes-parser@0.21.0