2023-05-04 08:11:04 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = async () => {
|
2023-05-09 15:35:42 -07:00
|
|
|
if (process.env['SYNC'] === '1' && process.env['WASM'] === '1') {
|
2023-05-09 22:21:01 -07:00
|
|
|
globalThis.Yoga = require('yoga-layout/wasm-sync').default;
|
2023-05-09 15:35:42 -07:00
|
|
|
} else if (process.env['SYNC'] === '1') {
|
2023-05-09 22:21:01 -07:00
|
|
|
globalThis.Yoga = require('yoga-layout/asmjs-sync').default;
|
2023-05-09 15:35:42 -07:00
|
|
|
} else if (process.env['WASM'] === '1') {
|
2023-05-09 22:21:01 -07:00
|
|
|
globalThis.Yoga = await require('yoga-layout/wasm-async').loadYoga();
|
2023-05-04 08:11:04 -07:00
|
|
|
} else {
|
2023-05-09 22:21:01 -07:00
|
|
|
globalThis.Yoga = await require('yoga-layout/asmjs-async').loadYoga();
|
2023-05-04 08:11:04 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-05-09 15:35:42 -07:00
|
|
|
Object.defineProperty(globalThis, 'YGBENCHMARK', {
|
2023-05-04 08:11:04 -07:00
|
|
|
get: () => globalThis.test,
|
|
|
|
});
|