hermes-estree 0.5.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/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ *
8
+ * @format
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ export type * from './selectors';
14
+ export type * from './types';
15
+
16
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ *
8
+ * @format
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {ESQueryNodeSelectorsWithoutFallback} from './generated/HermesESTreeSelectorTypes';
14
+
15
+ export type ESQueryNodeSelectors = {
16
+ ...ESQueryNodeSelectorsWithoutFallback,
17
+
18
+ // We want to allow consumers to manually type their weird selectors.
19
+ // If we use the \`ESNode\` type here then flow will error on cases like this:
20
+ // 'FunctionDeclaration[id="foo"]'(node: FunctionDeclaration) {...}
21
+ // But this sucks as it means someone would then have to manually do an \`if\`
22
+ // check inside the selector body.
23
+ +[selector: string]: (node: $FlowFixMe) => void,
24
+ };
25
+
26
+ export type {ESQueryNodeSelectorsWithoutFallback} from './generated/HermesESTreeSelectorTypes';
27
+
28
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ *
8
+ * @format
9
+ */
10
+ 'use strict';
11
+ /**
12
+ *
13
+ * IMPORTANT NOTE
14
+ *
15
+ * This file intentionally uses interfaces and `+` for readonly.
16
+ *
17
+ * - `$ReadOnly` is an "evaluated" utility type in flow; meaning that flow does
18
+ * not actually calculate the resulting type until it is used. This creates
19
+ * a copy of the type at each usage site - ballooning memory and processing
20
+ * times.
21
+ * Usually this isn't a problem as a type might only be used one or two times
22
+ * - but in this giant circular-referencing graph that is the AST types, this
23
+ * causes check times for consumers to be awful.
24
+ *
25
+ * Thus instead we manually annotate properties with `+` to avoid the `$ReadOnly` type.
26
+ *
27
+ * - `...Type` spreads do not preserve the readonly-ness of the properties. If
28
+ * we used object literal types then we would have to `$ReadOnly` all spreads
29
+ * (see point 1). On the other hand extending an interface does preserve
30
+ * readonlyness of properties.
31
+ *
32
+ * Thus instead of object literals, we use interfaces.
33
+ *
34
+ *** Please ensure all properties are marked as readonly! ***
35
+ */
36
+
37
+ Object.defineProperty(exports, "__esModule", {
38
+ value: true
39
+ });