hermes-transform 0.6.0 → 0.7.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-transform",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Tools built on top of Hermes-ESTree to enable codebase transformation",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -11,8 +11,9 @@
11
11
  "dependencies": {
12
12
  "@babel/code-frame": "^7.16.0",
13
13
  "esquery": "^1.4.0",
14
- "hermes-eslint": "0.6.0",
15
- "hermes-estree": "0.6.0"
14
+ "flow-enums-runtime": "^0.0.6",
15
+ "hermes-eslint": "0.7.0",
16
+ "hermes-estree": "0.7.0"
16
17
  },
17
18
  "peerDependencies": {
18
19
  "prettier": "^2.4.1"
@@ -1,49 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- import type {Comment, ESNode} from 'hermes-estree';
12
- import type {DetachedNode} from '../../detachedNode';
13
- import type {MutationContext} from '../MutationContext';
14
-
15
- import {addLeadingComment, cloneComment} from '../comments/comments';
16
-
17
- export type AddLeadingCommentsMutation = $ReadOnly<{
18
- type: 'addLeadingComments',
19
- comments: $ReadOnlyArray<Comment>,
20
- node: ESNode | DetachedNode<ESNode>,
21
- }>;
22
-
23
- export function createAddLeadingCommentsMutation(
24
- node: AddLeadingCommentsMutation['node'],
25
- comments: AddLeadingCommentsMutation['comments'],
26
- ): ?AddLeadingCommentsMutation {
27
- if (comments.length === 0) {
28
- return null;
29
- }
30
-
31
- return {
32
- type: 'addLeadingComments',
33
- comments,
34
- node,
35
- };
36
- }
37
-
38
- export function performAddLeadingCommentsMutation(
39
- mutationContext: MutationContext,
40
- mutation: AddLeadingCommentsMutation,
41
- ): null {
42
- for (const originalComment of mutation.comments) {
43
- const comment = cloneComment(originalComment);
44
- mutationContext.appendCommentToSource(comment);
45
- addLeadingComment(mutation.node, comment);
46
- }
47
-
48
- return null;
49
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createAddTrailingCommentsMutation = createAddTrailingCommentsMutation;
7
- exports.performAddTrailingCommentsMutation = performAddTrailingCommentsMutation;
8
-
9
- var _comments = require("../comments/comments");
10
-
11
- /**
12
- * Copyright (c) Meta Platforms, Inc. and affiliates.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- *
17
- *
18
- * @format
19
- */
20
- function createAddTrailingCommentsMutation(node, comments) {
21
- if (comments.length === 0) {
22
- return null;
23
- }
24
-
25
- return {
26
- type: 'addTrailingComments',
27
- comments,
28
- node
29
- };
30
- }
31
-
32
- function performAddTrailingCommentsMutation(mutationContext, mutation) {
33
- for (const originalComment of mutation.comments) {
34
- const comment = (0, _comments.cloneComment)(originalComment);
35
- mutationContext.appendCommentToSource(comment);
36
- (0, _comments.addTrailingComment)(mutation.node, comment);
37
- }
38
-
39
- return null;
40
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- import type {Comment, ESNode} from 'hermes-estree';
12
- import type {DetachedNode} from '../../detachedNode';
13
- import type {MutationContext} from '../MutationContext';
14
-
15
- import {addTrailingComment, cloneComment} from '../comments/comments';
16
-
17
- export type AddTrailingCommentsMutation = $ReadOnly<{
18
- type: 'addTrailingComments',
19
- comments: $ReadOnlyArray<Comment>,
20
- node: ESNode | DetachedNode<ESNode>,
21
- }>;
22
-
23
- export function createAddTrailingCommentsMutation(
24
- node: AddTrailingCommentsMutation['node'],
25
- comments: AddTrailingCommentsMutation['comments'],
26
- ): ?AddTrailingCommentsMutation {
27
- if (comments.length === 0) {
28
- return null;
29
- }
30
-
31
- return {
32
- type: 'addTrailingComments',
33
- comments,
34
- node,
35
- };
36
- }
37
-
38
- export function performAddTrailingCommentsMutation(
39
- mutationContext: MutationContext,
40
- mutation: AddTrailingCommentsMutation,
41
- ): null {
42
- for (const originalComment of mutation.comments) {
43
- const comment = cloneComment(originalComment);
44
- mutationContext.appendCommentToSource(comment);
45
- addTrailingComment(mutation.node, comment);
46
- }
47
-
48
- return null;
49
- }