Kick off metro-core by moving the source-map generator

Reviewed By: rafeca

Differential Revision: D6448594

fbshipit-source-id: 8498ae8ff62e5afc6ae92c56b7c15cdaf8acd3a1
This commit is contained in:
Peter van der Zee 2017-12-07 09:07:17 -08:00 committed by Facebook Github Bot
parent 9e4cfb4c93
commit 636c0ed5c9
19 changed files with 44 additions and 8 deletions

View File

@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
build
src.real
yarn.lock

View File

@ -0,0 +1,5 @@
# Metro
🚇 The source map generator for [Metro](https://facebook.github.io/metro/).
(TODO)

View File

@ -0,0 +1,21 @@
{
"version": "0.23.0",
"name": "metro-source-map",
"description": "🚇 Source map generator for Metro.",
"main": "src/source-map.js",
"repository": {
"type": "git",
"url": "git@github.com:facebook/metro.git"
},
"scripts": {
"prepare-release": "test -d build && rm -rf src.real && mv src src.real && mv build src",
"cleanup-release": "test ! -e build && mv src build && mv src.real src"
},
"dependencies": {
"source-map": "^0.5.6"
},
"devDependencies": {
"babel-core": "^6.24.1",
"babel-generator": "^6.26.0"
}
}

View File

@ -0,0 +1,4 @@
{
"presets": [ "react-native" ],
"plugins": []
}

View File

@ -14,7 +14,7 @@
const B64Builder = require('./B64Builder');
import type {MappingsMap} from '../../lib/SourceMap';
import type {SourceMap as MappingsMap} from 'babel-core';
/**
* Generates a source map from raw mappings.

View File

@ -15,9 +15,10 @@
const Generator = require('./Generator');
const SourceMap = require('source-map');
import type {MappingsMap, RawMappings} from '../../lib/SourceMap';
import type {SourceMap as MappingsMap} from 'babel-core';
import type {RawMapping as BabelRawMapping} from 'babel-generator';
type RawMappings = Array<BabelRawMapping>;
type GeneratedCodeMapping = [number, number];
type SourceMapping = [number, number, number, number];
type SourceMappingWithName = [number, number, number, number, string];

View File

@ -17,8 +17,8 @@ const DeltaPatcher = require('./DeltaPatcher');
const toLocalPath = require('../node-haste/lib/toLocalPath');
const {getAssetData} = require('../Assets');
const {fromRawMappings} = require('../Bundler/source-map');
const {createRamBundleGroups} = require('../Bundler/util');
const {fromRawMappings} = require('metro-source-map');
import type {AssetData} from '../Assets';
import type {MappingsMap} from '../lib/SourceMap';

View File

@ -24,7 +24,7 @@ const minify = require('./minify');
const optimizeDependencies = require('../../ModuleGraph/worker/optimizeDependencies');
const path = require('path');
const {compactMapping} = require('../../Bundler/source-map');
const {compactMapping} = require('metro-source-map');
import type {LogEntry} from '../../Logger/Types';
import type {CompactRawMappings, MappingsMap} from '../../lib/SourceMap';

View File

@ -20,7 +20,7 @@ const {
compactMapping,
fromRawMappings,
toRawMappings,
} = require('../Bundler/source-map');
} = require('metro-source-map');
const pathJoin = require('path').join;
import type Module, {HasteImpl, TransformCode} from '../node-haste/Module';

View File

@ -15,7 +15,7 @@ jest.mock('net', () => ({
createServer: () => ({listen: () => {}}),
}));
const SourceMapGenerator = require('../../../Bundler/source-map/Generator');
const SourceMapGenerator = require('metro-source-map/src/Generator');
const {symbolicate} = require('../worker');
let connection;

View File

@ -19,7 +19,7 @@ const blacklist = require('./blacklist');
const debug = require('debug');
const invariant = require('fbjs/lib/invariant');
const {fromRawMappings, compactMapping} = require('./Bundler/source-map');
const {fromRawMappings, compactMapping} = require('metro-source-map');
import type {ConfigT as MetroConfig} from './Config';
import type Server from './Server';

View File

@ -11,7 +11,6 @@
*/
'use strict';
import type {RawMapping} from '../Bundler/source-map';
import type {
GetTransformOptions,
PostMinifyProcess,
@ -23,6 +22,7 @@ import type {SourceMap} from '../lib/SourceMap';
import type {TransformCache} from '../lib/TransformCaching';
import type {Reporter} from '../lib/reporting';
import type {HasteImpl} from '../node-haste/Module';
import type {RawMapping} from 'metro-source-map';
type BundleType = 'bundle' | 'delta' | 'map' | 'ram' | 'cli' | 'hmr' | 'todo';
type SourceMapOrMappings = SourceMap | Array<RawMapping>;