mirror of https://github.com/status-im/metro.git
Pass in the platform options when loading dependencies
Reviewed By: @jingc Differential Revision: D2488262
This commit is contained in:
parent
c74f1e9bc9
commit
2cf80d481b
|
@ -47,9 +47,9 @@ exports.buildBundleFromUrl = function(options, reqUrl) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getDependencies = function(options, main) {
|
exports.getDependencies = function(options, bundleOptions) {
|
||||||
var server = createServer(options);
|
var server = createServer(options);
|
||||||
return server.getDependencies(main)
|
return server.getDependencies(bundleOptions)
|
||||||
.then(function(r) {
|
.then(function(r) {
|
||||||
server.end();
|
server.end();
|
||||||
return r.dependencies;
|
return r.dependencies;
|
||||||
|
|
|
@ -96,6 +96,21 @@ const bundleOpts = declareOpts({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const dependencyOpts = declareOpts({
|
||||||
|
platform: {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
dev: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
entryFile: {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
const opts = validateOpts(options);
|
const opts = validateOpts(options);
|
||||||
|
@ -174,8 +189,15 @@ class Server {
|
||||||
return this.buildBundle(options);
|
return this.buildBundle(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDependencies(main) {
|
getDependencies(options) {
|
||||||
return this._bundler.getDependencies(main);
|
return Promise.resolve().then(() => {
|
||||||
|
const opts = dependencyOpts(options);
|
||||||
|
return this._bundler.getDependencies(
|
||||||
|
opts.entryFile,
|
||||||
|
opts.dev,
|
||||||
|
opts.platform,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_onFileChange(type, filepath, root) {
|
_onFileChange(type, filepath, root) {
|
||||||
|
|
Loading…
Reference in New Issue