diff --git a/packages/metro-source-map/src/source-map.js b/packages/metro-source-map/src/source-map.js index eb0e2623..352b9078 100644 --- a/packages/metro-source-map/src/source-map.js +++ b/packages/metro-source-map/src/source-map.js @@ -17,9 +17,6 @@ const SourceMap = require('source-map'); import type {BabelSourceMap} from 'babel-core'; import type {BabelSourceMapSegment} from 'babel-generator'; -import type {RawMapping as UnknownSourceMapMappingType} from 'source-map'; - -export type UnknownSourceMapMappingTypes = Array; type GeneratedCodeMapping = [number, number]; type SourceMapping = [number, number, number, number]; diff --git a/packages/metro/src/Bundler/index.js b/packages/metro/src/Bundler/index.js index 622a2148..4b7c56ef 100644 --- a/packages/metro/src/Bundler/index.js +++ b/packages/metro/src/Bundler/index.js @@ -34,7 +34,7 @@ import type {Reporter} from '../lib/reporting'; import type {HasteImpl} from '../node-haste/Module'; import type {BabelSourceMap} from 'babel-core'; import type { - UnknownSourceMapMappingTypes, + MetroSourceMapSegmentTuple, MetroSourceMap as SourceMap, } from 'metro-source-map'; @@ -255,8 +255,8 @@ class Bundler { async minifyModule( path: string, code: string, - map: UnknownSourceMapMappingTypes, - ): Promise<{code: string, map: UnknownSourceMapMappingTypes}> { + map: Array, + ): Promise<{code: string, map: Array}> { const sourceMap = fromRawMappings([{code, source: code, map, path}]).toMap( undefined, {}, diff --git a/packages/metro/src/DeltaBundler/DeltaTransformer.js b/packages/metro/src/DeltaBundler/DeltaTransformer.js index 020a6527..5e30ee5f 100644 --- a/packages/metro/src/DeltaBundler/DeltaTransformer.js +++ b/packages/metro/src/DeltaBundler/DeltaTransformer.js @@ -30,7 +30,7 @@ import type DependencyGraph from '../node-haste/DependencyGraph'; import type Module from '../node-haste/Module'; import type {Options as BundleOptions, MainOptions} from './'; import type {DependencyEdges} from './traverseDependencies'; -import type {UnknownSourceMapMappingTypes} from 'metro-source-map'; +import type {MetroSourceMapSegmentTuple} from 'metro-source-map'; export type DeltaEntryType = | 'asset' @@ -42,7 +42,7 @@ export type DeltaEntryType = export type DeltaEntry = {| +code: string, +id: number, - +map: UnknownSourceMapMappingTypes, + +map: Array, +name: string, +path: string, +source: string, @@ -530,7 +530,7 @@ class DeltaTransformer extends EventEmitter { ): Promise<{ +code: string, +dependencies: Array, - +map: UnknownSourceMapMappingTypes, + +map: Array, +source: string, }> { return await module.read( diff --git a/packages/metro/src/JSTransformer/worker/index.js b/packages/metro/src/JSTransformer/worker/index.js index d2e657a7..aacffcc5 100644 --- a/packages/metro/src/JSTransformer/worker/index.js +++ b/packages/metro/src/JSTransformer/worker/index.js @@ -28,7 +28,7 @@ const {toSegmentTuple} = require('metro-source-map'); import type {LogEntry} from 'metro-core/src/Logger'; import type {BabelSourceMap} from 'babel-core'; -import type {UnknownSourceMapMappingTypes} from 'metro-source-map'; +import type {MetroSourceMapSegmentTuple} from 'metro-source-map'; import type {LocalPath} from '../../node-haste/lib/toLocalPath'; import type {ResultWithMap} from './minify'; import type {Ast, Plugins as BabelPlugins} from 'babel-core'; @@ -36,7 +36,7 @@ import type {Ast, Plugins as BabelPlugins} from 'babel-core'; export type TransformedCode = { code: string, dependencies: $ReadOnlyArray, - map: UnknownSourceMapMappingTypes, + map: Array, }; export type TransformArgs = {| diff --git a/packages/metro/src/lib/TransformCaching.js b/packages/metro/src/lib/TransformCaching.js index ab349acd..54672caa 100644 --- a/packages/metro/src/lib/TransformCaching.js +++ b/packages/metro/src/lib/TransformCaching.js @@ -24,7 +24,7 @@ const writeFileAtomicSync = require('write-file-atomic').sync; import type {Options as WorkerOptions} from '../JSTransformer/worker'; import type {Reporter} from './reporting'; import type {LocalPath} from '../node-haste/lib/toLocalPath'; -import type {UnknownSourceMapMappingTypes} from 'metro-source-map'; +import type {MetroSourceMapSegmentTuple} from 'metro-source-map'; type CacheFilePaths = {transformedCode: string, metadata: string}; export type GetTransformCacheKey = (options: {}) => string; @@ -34,7 +34,7 @@ const CACHE_SUB_DIR = 'cache'; export type CachedResult = { code: string, dependencies: $ReadOnlyArray, - map: UnknownSourceMapMappingTypes, + map: Array, }; export type TransformCacheResult = ?CachedResult; @@ -324,7 +324,7 @@ function readMetadataFileSync( cachedResultHash: string, cachedSourceHash: string, dependencies: Array, - sourceMap: UnknownSourceMapMappingTypes, + sourceMap: Array, } { const metadataStr = fs.readFileSync(metadataFilePath, 'utf8'); const metadata = tryParseJSON(metadataStr); diff --git a/packages/metro/src/node-haste/Module.js b/packages/metro/src/node-haste/Module.js index b4c5c3a8..c276d712 100644 --- a/packages/metro/src/node-haste/Module.js +++ b/packages/metro/src/node-haste/Module.js @@ -35,12 +35,12 @@ import type {Reporter} from '../lib/reporting'; import type DependencyGraphHelpers from './DependencyGraph/DependencyGraphHelpers'; import type ModuleCache from './ModuleCache'; import type {LocalPath} from './lib/toLocalPath'; -import type {UnknownSourceMapMappingTypes} from 'metro-source-map'; +import type {MetroSourceMapSegmentTuple} from 'metro-source-map'; export type ReadResult = { +code: string, +dependencies: $ReadOnlyArray, - +map: UnknownSourceMapMappingTypes, + +map: Array, +source: string, };