Skip to content

Commit 41cdc03

Browse files
robhoganfacebook-github-bot
authored andcommitted
Inline SourceLocation, obviate missing "@types/babel__code-frame" dependency
Summary: Remove a dependency on the TypeScript types for `babel/code-frame` by inlining the definition we need. This also tightens it up (this is an output type, so that's non-breaking) to match the (enforced) Flow type, which is much more strict: https://github.com/facebook/metro/blob/v0.76.1/flow-typed/babel.js.flow#L33-L36 For reference, the Babel type previously imported was this: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a785fc80eb9e588cdef1e4c008225e167a8d925f/types/babel__code-frame/index.d.ts#L7-L10 Changelog: ``` * **[Types]** Remove dependency on `types/babel__code-frame` ``` Reviewed By: huntie Differential Revision: D44928583 fbshipit-source-id: 7b50e111d2f62da0a7d0bc6365923fc33bf99e50
1 parent 9846a9c commit 41cdc03

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

packages/metro/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
},
6464
"devDependencies": {
6565
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
66-
"@types/babel__code-frame": "^7.0.3",
6766
"@types/ws": "^8.5.4",
6867
"babel-jest": "^29.2.1",
6968
"dedent": "^0.7.0",

packages/metro/types/DeltaBundler/types.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @oncall react_native
99
*/
1010

11-
import type {SourceLocation} from '@babel/code-frame';
1211
import type {JsTransformOptions} from 'metro-transform-worker';
1312
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
1413
import type {RequireContext} from '../lib/contextModule';
@@ -55,7 +54,10 @@ export interface TransformResultDependency {
5554
*/
5655
readonly isOptional?: boolean;
5756

58-
readonly locs: ReadonlyArray<SourceLocation>;
57+
readonly locs: ReadonlyArray<{
58+
readonly start: {readonly line: number; readonly column: number};
59+
readonly end: {readonly line: number; readonly column: number};
60+
}>;
5961

6062
/** Context for requiring a collection of modules. */
6163
readonly contextParams?: RequireContextParams;

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,11 +1177,6 @@
11771177
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.1.tgz#a6ca6a9a0ff366af433f42f5f0e124794ff6b8f1"
11781178
integrity sha512-FTgBI767POY/lKNDNbIzgAX6miIDBs6NTCbdlDb8TrWovHsSvaVIZDlTqym29C6UqhzwcJx4CYr+AlrMywA0cA==
11791179

1180-
"@types/babel__code-frame@^7.0.3":
1181-
version "7.0.3"
1182-
resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz#eda94e1b7c9326700a4b69c485ebbc9498a0b63f"
1183-
integrity sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw==
1184-
11851180
"@types/babel__core@^7.1.14":
11861181
version "7.1.19"
11871182
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460"

0 commit comments

Comments
 (0)