mirror of https://github.com/status-im/metro.git
Infer platform from extension
Summary: public Aparently this used to work on 0.11, lets fix it :) Reviewed By: foghina Differential Revision: D2557719 fb-gh-sync-id: dcbca077431c1356c89dfc55b71eecff64c7ad3d
This commit is contained in:
parent
abeaa5bc9b
commit
c5c4dc94b1
|
@ -11,6 +11,7 @@
|
||||||
const Activity = require('../Activity');
|
const Activity = require('../Activity');
|
||||||
const AssetServer = require('../AssetServer');
|
const AssetServer = require('../AssetServer');
|
||||||
const FileWatcher = require('../FileWatcher');
|
const FileWatcher = require('../FileWatcher');
|
||||||
|
const getPlatformExtension = require('../lib/getPlatformExtension');
|
||||||
const Bundler = require('../Bundler');
|
const Bundler = require('../Bundler');
|
||||||
const Promise = require('promise');
|
const Promise = require('promise');
|
||||||
|
|
||||||
|
@ -173,6 +174,10 @@ class Server {
|
||||||
|
|
||||||
buildBundle(options) {
|
buildBundle(options) {
|
||||||
return Promise.resolve().then(() => {
|
return Promise.resolve().then(() => {
|
||||||
|
if (!options.platform) {
|
||||||
|
options.platform = getPlatformExtension(options.entryFile);
|
||||||
|
}
|
||||||
|
|
||||||
const opts = bundleOpts(options);
|
const opts = bundleOpts(options);
|
||||||
return this._bundler.bundle(
|
return this._bundler.bundle(
|
||||||
opts.entryFile,
|
opts.entryFile,
|
||||||
|
@ -191,6 +196,10 @@ class Server {
|
||||||
|
|
||||||
getDependencies(options) {
|
getDependencies(options) {
|
||||||
return Promise.resolve().then(() => {
|
return Promise.resolve().then(() => {
|
||||||
|
if (!options.platform) {
|
||||||
|
options.platform = getPlatformExtension(options.entryFile);
|
||||||
|
}
|
||||||
|
|
||||||
const opts = dependencyOpts(options);
|
const opts = dependencyOpts(options);
|
||||||
return this._bundler.getDependencies(
|
return this._bundler.getDependencies(
|
||||||
opts.entryFile,
|
opts.entryFile,
|
||||||
|
@ -432,6 +441,10 @@ class Server {
|
||||||
const sourceMapUrlObj = _.clone(urlObj);
|
const sourceMapUrlObj = _.clone(urlObj);
|
||||||
sourceMapUrlObj.pathname = pathname.replace(/\.bundle$/, '.map');
|
sourceMapUrlObj.pathname = pathname.replace(/\.bundle$/, '.map');
|
||||||
|
|
||||||
|
// try to get the platform from the url
|
||||||
|
const platform = urlObj.query.platform ||
|
||||||
|
getPlatformExtension(pathname);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sourceMapUrl: url.format(sourceMapUrlObj),
|
sourceMapUrl: url.format(sourceMapUrlObj),
|
||||||
entryFile: entryFile,
|
entryFile: entryFile,
|
||||||
|
@ -443,7 +456,7 @@ class Server {
|
||||||
'inlineSourceMap',
|
'inlineSourceMap',
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
platform: urlObj.query.platform,
|
platform: platform,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue