mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: public The reverted change doesn’t play nice with inline requires, let’s revert it for now. I will bring it back after fixing it or adapting inline requires Reviewed By: martinbigio Differential Revision: D2854771 fb-gh-sync-id: 32fdbf8ad51240a9075b26502decb6328eed4b29
52 lines
906 B
JavaScript
52 lines
906 B
JavaScript
'use strict';
|
|
|
|
const Module = require('./Module');
|
|
const Promise = require('promise');
|
|
const getAssetDataFromName = require('./lib/getAssetDataFromName');
|
|
|
|
class AssetModule extends Module {
|
|
constructor(...args) {
|
|
super(...args);
|
|
const { resolution, name, type } = getAssetDataFromName(this.path);
|
|
this.resolution = resolution;
|
|
this._name = name;
|
|
this._type = type;
|
|
}
|
|
|
|
isHaste() {
|
|
return Promise.resolve(false);
|
|
}
|
|
|
|
getDependencies() {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
getAsyncDependencies() {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
read() {
|
|
return Promise.resolve({});
|
|
}
|
|
|
|
getName() {
|
|
return super.getName().then(
|
|
id => id.replace(/\/[^\/]+$/, `/${this._name}.${this._type}`)
|
|
);
|
|
}
|
|
|
|
hash() {
|
|
return `AssetModule : ${this.path}`;
|
|
}
|
|
|
|
isJSON() {
|
|
return false;
|
|
}
|
|
|
|
isAsset() {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
module.exports = AssetModule;
|