forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Since jest stopped using node-haste a while ago, we are the only client left. This brings back node-haste back to fbsource to allow us to iterate faster. Reviewed By: bestander Differential Revision: D3641341 fbshipit-source-id: a859f8834765723a3515e2cf265581b9dd83997c
- Loading branch information
1 parent
70dc98d
commit 667aaa4
Showing
56 changed files
with
12,085 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
const Module = require('./Module'); | ||
const getAssetDataFromName = require('./lib/getAssetDataFromName'); | ||
|
||
class AssetModule extends Module { | ||
constructor(args, platforms) { | ||
super(args); | ||
const { resolution, name, type } = getAssetDataFromName(this.path, platforms); | ||
this.resolution = resolution; | ||
this._name = name; | ||
this._type = type; | ||
this._dependencies = args.dependencies || []; | ||
} | ||
|
||
isHaste() { | ||
return Promise.resolve(false); | ||
} | ||
|
||
getDependencies() { | ||
return Promise.resolve(this._dependencies); | ||
} | ||
|
||
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; |
45 changes: 45 additions & 0 deletions
45
packager/react-packager/src/node-haste/AssetModule_DEPRECATED.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const Module = require('./Module'); | ||
const getAssetDataFromName = require('./lib/getAssetDataFromName'); | ||
|
||
class AssetModule_DEPRECATED extends Module { | ||
constructor(args, platforms) { | ||
super(args); | ||
const {resolution, name} = getAssetDataFromName(this.path, platforms); | ||
this.resolution = resolution; | ||
this.name = name; | ||
this.platforms = platforms; | ||
} | ||
|
||
isHaste() { | ||
return Promise.resolve(false); | ||
} | ||
|
||
getName() { | ||
return Promise.resolve(`image!${this.name}`); | ||
} | ||
|
||
getDependencies() { | ||
return Promise.resolve([]); | ||
} | ||
|
||
hash() { | ||
return `AssetModule_DEPRECATED : ${this.path}`; | ||
} | ||
|
||
isJSON() { | ||
return false; | ||
} | ||
|
||
isAsset_DEPRECATED() { | ||
return true; | ||
} | ||
|
||
resolution() { | ||
return getAssetDataFromName(this.path, this.platforms).resolution; | ||
} | ||
|
||
} | ||
|
||
module.exports = AssetModule_DEPRECATED; |
20 changes: 20 additions & 0 deletions
20
packager/react-packager/src/node-haste/Cache/__mocks__/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* 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'; | ||
|
||
class Cache { | ||
get(filepath, field, cb) { | ||
return cb(filepath); | ||
} | ||
|
||
invalidate(filepath) { } | ||
end() { } | ||
} | ||
|
||
module.exports = Cache; |
Oops, something went wrong.