Make sourcemap flow types non-nullable

Reviewed By: mjesun

Differential Revision: D6185460

fbshipit-source-id: c33bac5f0e70c142d6238043ce8c2996f1d1ee50
This commit is contained in:
Rafael Oleza 2017-10-31 10:17:34 -07:00 committed by Facebook Github Bot
parent 437a6a3f27
commit 775867445a
3 changed files with 11 additions and 11 deletions

View File

@ -37,7 +37,7 @@ export type DeltaEntryType =
export type DeltaEntry = {|
+code: string,
+id: number,
+map: ?CompactRawMappings,
+map: CompactRawMappings,
+name: string,
+path: string,
+source: string,
@ -284,7 +284,7 @@ class DeltaTransformer extends EventEmitter {
{
code,
id: moduleId,
map: null,
map: [],
name,
source: code,
path,
@ -301,7 +301,7 @@ class DeltaTransformer extends EventEmitter {
append.set(id, {
code,
id,
map: null,
map: [],
name: 'sourcemap.js',
path: '/sourcemap.js',
source: code,
@ -417,7 +417,7 @@ class DeltaTransformer extends EventEmitter {
): Promise<{
+code: string,
+dependencyOffsets: ?Array<number>,
+map: ?CompactRawMappings,
+map: CompactRawMappings,
+source: string,
}> {
if (module.isAsset()) {
@ -430,7 +430,7 @@ class DeltaTransformer extends EventEmitter {
return {
code: asset.code,
dependencyOffsets: asset.meta.dependencyOffsets,
map: undefined,
map: [],
source: '',
};
}

View File

@ -28,7 +28,7 @@ import type {
type ResultWithMap = {
code: string,
map: ?MappingsMap,
map: MappingsMap,
};
function noSourceMap(code: string): string {
@ -55,14 +55,14 @@ function withSourceMap(
function withRawMappings(
code: string,
map: ?RawMappings,
map: RawMappings,
filename: string,
): {code: string, map: ?CompactRawMappings} {
): {code: string, map: CompactRawMappings} {
const result = withSourceMap(code, map, filename);
return {
code: result.code,
map: result.map ? toRawMappings(result.map).map(compactMapping) : undefined,
map: toRawMappings(result.map).map(compactMapping),
};
}

View File

@ -230,10 +230,10 @@ class Resolver {
dependencyPairs: Map<string, string>,
dependencyOffsets: Array<number>,
name: string,
map: ?CompactRawMappings,
map: CompactRawMappings,
code: string,
dev?: boolean,
}): {code: string, map: ?CompactRawMappings} {
}): {code: string, map: CompactRawMappings} {
if (module.isJSON()) {
code = `module.exports = ${code}`;
}