From 1fcceb0c5ff21e14e8b6490b7ec79cf6c86c20e0 Mon Sep 17 00:00:00 2001 From: androidtrunkagent Date: Tue, 2 Aug 2016 10:13:13 -0700 Subject: [PATCH] Add support for passing in additional assetExts to packager fbshipit-source-id: 42e508e37d960fbeb905a2ea8cb4741dba5c67fc --- defaultAssetExts.js | 16 ++++++++++++++++ react-packager/src/Server/index.js | 10 +++------- rn-cli.config.js | 6 +++++- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 defaultAssetExts.js diff --git a/defaultAssetExts.js b/defaultAssetExts.js new file mode 100644 index 00000000..0d53ace6 --- /dev/null +++ b/defaultAssetExts.js @@ -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 +]; diff --git a/react-packager/src/Server/index.js b/react-packager/src/Server/index.js index faf17b62..751c3891 100644 --- a/react-packager/src/Server/index.js +++ b/react-packager/src/Server/index.js @@ -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', diff --git a/rn-cli.config.js b/rn-cli.config.js index 1c32238a..72a785ef 100644 --- a/rn-cli.config.js +++ b/rn-cli.config.js @@ -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); },