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:
Родитель
72c55c525b
Коммит
44af0d3dec
|
@ -18,7 +18,6 @@ module.exports = [
|
||||||
command: 'platform',
|
command: 'platform',
|
||||||
description: 'Either "ios" or "android"',
|
description: 'Either "ios" or "android"',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
|
||||||
}, {
|
}, {
|
||||||
command: 'transformer',
|
command: 'transformer',
|
||||||
description: 'Specify a custom transformer to be used (absolute path)',
|
description: 'Specify a custom transformer to be used (absolute path)',
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче