Skip to content

Commit ca58e0a

Browse files
davidaurelioFacebook Github Bot
authored andcommitted
BREAKING kill deprecated asset support
Summary: This removes support for `require('image!…')`, which has been deprecated for a long time. It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module. Check http://facebook.github.io/react-native/docs/images.html for detailed documentation. Reviewed By: matryoshcow Differential Revision: D4231208 fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
1 parent 0c50a5b commit ca58e0a

27 files changed

Lines changed: 18 additions & 724 deletions

File tree

‎.flowconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ experimental.strict_type_args=true
3333

3434
munge_underscores=true
3535

36-
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
3736
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
3837

3938
suppress_type=$FlowIssue

‎Libraries/Image/GlobalImageStub.js‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎jest-preset.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
]
88
},
99
"moduleNameMapper": {
10-
"^image![a-zA-Z0-9$_-]+$": "GlobalImageStub",
1110
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|png|psd|svg|webp)$": "RelativeImageStub",
1211
"^React$": "<rootDir>node_modules/react"
1312
},

‎local-cli/bundle/buildBundle.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
5151
const options = {
5252
projectRoots: config.getProjectRoots(),
5353
assetExts: defaultAssetExts.concat(assetExts),
54-
assetRoots: config.getAssetRoots(),
5554
blacklistRE: config.getBlacklistRE(),
5655
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
5756
transformModulePath: transformModulePath,

‎local-cli/bundle/saveAssets.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function saveAssets(
3131

3232
const filesToCopy = Object.create(null); // Map src -> dest
3333
assets
34-
.filter(asset => !asset.deprecated)
3534
.forEach(asset =>
3635
asset.scales.forEach((scale, idx) => {
3736
const src = asset.files[idx];

‎local-cli/default.config.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,11 @@ var rnpmConfig = require('./core/config');
2020
* to tweak.
2121
*/
2222
var config = {
23-
getProjectRoots() {
24-
return getRoots();
25-
},
23+
getProjectRoots,
2624

2725
getProjectConfig: rnpmConfig.getProjectConfig,
2826
getDependencyConfig: rnpmConfig.getDependencyConfig,
2927

30-
/**
31-
* Specify where to look for assets that are referenced using
32-
* `image!<image_name>`. Asset directories for images referenced using
33-
* `./<image.extension>` don't require any entry in here.
34-
*/
35-
getAssetRoots() {
36-
return getRoots();
37-
},
38-
3928
/**
4029
* Specify any additional asset extentions to be used by the packager.
4130
* For example, if you want to include a .ttf file, you would return ['ttf']
@@ -62,7 +51,7 @@ var config = {
6251
},
6352
};
6453

65-
function getRoots() {
54+
function getProjectRoots() {
6655
var root = process.env.REACT_NATIVE_APP_ROOT;
6756
if (root) {
6857
return [path.resolve(root)];

‎local-cli/dependencies/dependencies.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function dependencies(argv, config, args, packagerInstance) {
2727

2828
const packageOpts = {
2929
projectRoots: config.getProjectRoots(),
30-
assetRoots: config.getAssetRoots(),
3130
blacklistRE: config.getBlacklistRE(),
3231
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
3332
transformModulePath: transformModulePath,

‎local-cli/server/runServer.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ function getPackagerServer(args, config) {
8787

8888
return ReactPackager.createServer({
8989
assetExts: defaultAssetExts.concat(args.assetExts),
90-
assetRoots: args.assetRoots,
9190
blacklistRE: config.getBlacklistRE(),
9291
cacheVersion: '3',
9392
extraNodeModules: config.extraNodeModules,

‎local-cli/server/server.js‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ module.exports = {
9191
description: 'override the root(s) to be used by the packager',
9292
parse: (val) => val.split(','),
9393
default: (config) => config.getProjectRoots(),
94-
}, {
95-
command: '--assetRoots [list]',
96-
description: 'specify the root directories of app assets',
97-
parse: (val) => val.split(',').map(dir => path.resolve(process.cwd(), dir)),
98-
default: (config) => config.getAssetRoots(),
9994
}, {
10095
command: '--assetExts [list]',
10196
description: 'Specify any additional asset extentions to be used by the packager',

‎local-cli/server/util/attachHMRServer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function attachHMRServer({httpServer, path, packagerServer}) {
4747
// `{path: '/a/b/c.js', deps: ['modA', 'modB', ...]}`
4848
return Promise.all(Object.values(response.dependencies).map(dep => {
4949
return dep.getName().then(depName => {
50-
if (dep.isAsset() || dep.isAsset_DEPRECATED() || dep.isJSON()) {
50+
if (dep.isAsset() || dep.isJSON()) {
5151
return Promise.resolve({path: dep.path, deps: []});
5252
}
5353
return packagerServer.getShallowDependencies({

0 commit comments

Comments
 (0)