hermes-transform 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
26
 
27
27
  let cache = 1;
28
+ const cacheBase = Math.random();
28
29
 
29
30
  async function print(ast, originalCode, prettierOptions = {}, visitorKeys) {
30
31
  // $FlowExpectedError[incompatible-type] This is now safe to access.
@@ -97,7 +98,7 @@ async function print(ast, originalCode, prettierOptions = {}, visitorKeys) {
97
98
  hermes: { ...hermesParser,
98
99
  // Prettier caches the plugin, by making this key always unique we ensure the new `parse`
99
100
  // function with the correct AST is always called.
100
- cache: cache++,
101
+ cache: `${cacheBase}-${cache++}`,
101
102
 
102
103
  // Provide the passed AST to prettier
103
104
  parse() {
@@ -22,6 +22,7 @@ import {
22
22
  import type {VisitorKeysType} from 'hermes-parser';
23
23
 
24
24
  let cache = 1;
25
+ const cacheBase = Math.random();
25
26
 
26
27
  export async function print(
27
28
  ast: MaybeDetachedNode<Program>,
@@ -103,7 +104,7 @@ export async function print(
103
104
 
104
105
  // Prettier caches the plugin, by making this key always unique we ensure the new `parse`
105
106
  // function with the correct AST is always called.
106
- cache: cache++,
107
+ cache: `${cacheBase}-${cache++}`,
107
108
 
108
109
  // Provide the passed AST to prettier
109
110
  parse() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-transform",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Tools built on top of Hermes-ESTree to enable codebase transformation",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -12,12 +12,13 @@
12
12
  "@babel/code-frame": "^7.16.0",
13
13
  "esquery": "^1.4.0",
14
14
  "flow-enums-runtime": "^0.0.6",
15
- "hermes-eslint": "0.14.0",
16
- "hermes-estree": "0.14.0",
17
- "hermes-parser": "0.14.0"
15
+ "hermes-eslint": "0.15.1",
16
+ "hermes-estree": "0.15.1",
17
+ "hermes-parser": "0.15.1"
18
18
  },
19
19
  "peerDependencies": {
20
- "prettier": "^3.0.0 || ^2.7.1"
20
+ "prettier": "^3.0.0 || ^2.7.1",
21
+ "prettier-plugin-hermes-parser": "0.15.1"
21
22
  },
22
23
  "files": [
23
24
  "dist",