Add support for passing in additional assetExts to packager

fbshipit-source-id: 42e508e37d960fbeb905a2ea8cb4741dba5c67fc
This commit is contained in:
androidtrunkagent 2016-08-02 10:13:13 -07:00 committed by Facebook Github Bot 6
parent eeda397983
commit 1fcceb0c5f
3 changed files with 24 additions and 8 deletions

16
defaultAssetExts.js Normal file
View File

@ -0,0 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
module.exports = [
'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', // Image formats
'm4v', 'mov', 'mp4', 'mpeg', 'mpg', 'webm', // Video formats
'aac', 'aiff', 'caf', 'm4a', 'mp3', 'wav', // Audio formats
'html', 'pdf', // Document formats
];

View File

@ -17,9 +17,10 @@ const Promise = require('promise');
const SourceMapConsumer = require('source-map').SourceMapConsumer;
const declareOpts = require('../lib/declareOpts');
const defaultAssetExts = require('../../../defaultAssetExts');
const mime = require('mime-types');
const path = require('path');
const url = require('url');
const mime = require('mime-types');
function debounce(fn, delay) {
var timeout;
@ -71,12 +72,7 @@ const validateOpts = declareOpts({
},
assetExts: {
type: 'array',
default: [
'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', // Image formats
'm4v', 'mov', 'mp4', 'mpeg', 'mpg', 'webm', // Video formats
'aac', 'aiff', 'caf', 'm4a', 'mp3', 'wav', // Audio formats
'html', 'pdf', // Document formats
],
default: defaultAssetExts,
},
transformTimeoutInterval: {
type: 'number',

View File

@ -5,7 +5,7 @@
*/
'use strict';
const blacklist = require('./blacklist.js');
const blacklist = require('./blacklist');
const path = require('path');
module.exports = {
@ -17,6 +17,10 @@ module.exports = {
return this._getRoots();
},
getAssetExts() {
return [];
},
getBlacklistRE(platform) {
return blacklist(platform);
},