Update build logic
This commit is contained in:
@@ -33,7 +33,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue:{value:function() {
|
||||
this.push([
|
||||
'var Yoga = Yoga || require("../../dist");',
|
||||
'var Yoga = Yoga || require("../..");',
|
||||
''
|
||||
]);
|
||||
}},
|
||||
|
@@ -1,13 +1,8 @@
|
||||
{
|
||||
"presets": ["stage-3", "es2015"],
|
||||
"presets": [
|
||||
["@babel/preset-env", {"targets": "defaults"}]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-flow-strip-types",
|
||||
[
|
||||
"replace-require",
|
||||
{
|
||||
"fs": "{}",
|
||||
"path": "{}"
|
||||
}
|
||||
]
|
||||
"@babel/plugin-transform-flow-strip-types"
|
||||
]
|
||||
}
|
||||
|
@@ -1,30 +1,66 @@
|
||||
CC=emcc
|
||||
CXX=em++
|
||||
|
||||
all: clean dir asm
|
||||
SOURCES=\
|
||||
sources/yoga/*.cpp \
|
||||
sources/yoga/**/*.cpp \
|
||||
sources/*.cc
|
||||
|
||||
CXXFLAGS=\
|
||||
-Isources \
|
||||
-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
|
||||
-std=c++11 \
|
||||
-g0 \
|
||||
-Os \
|
||||
-flto \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
|
||||
EMCCFLAGS=\
|
||||
--closure 1 \
|
||||
--memory-init-file 0 \
|
||||
--no-entry
|
||||
|
||||
EMCCOPTS=\
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s ASSERTIONS=0 \
|
||||
-s DEFAULT_TO_CXX=1 \
|
||||
-s DYNAMIC_EXECUTION=0 \
|
||||
-s ENVIRONMENT="web,node" \
|
||||
-s EXPORT_NAME="yoga" \
|
||||
-s FETCH_SUPPORT_INDEXEDDB=0 \
|
||||
-s FILESYSTEM=0 \
|
||||
-s MALLOC="emmalloc" \
|
||||
-s MODULARIZE=1 \
|
||||
-s STRICT=1 \
|
||||
-s TEXTDECODER=0 \
|
||||
-s USE_ES6_IMPORT_META=0 \
|
||||
-s WASM_ASYNC_COMPILATION=0
|
||||
|
||||
LDLIBS=\
|
||||
-lembind
|
||||
|
||||
all: clean dir asm wasm
|
||||
|
||||
asm:
|
||||
$(CC) sources/yoga/*.cpp sources/yoga/**/*.cpp sources/*.cc \
|
||||
--bind \
|
||||
-Isources \
|
||||
-g0 \
|
||||
-Os \
|
||||
--closure 1 \
|
||||
--memory-init-file 0 \
|
||||
$(CXX) $(SOURCES) \
|
||||
$(INCLUDE) \
|
||||
$(CXXFLAGS) \
|
||||
$(EMCCFLAGS) \
|
||||
$(LDLIBS) \
|
||||
$(EMCCOPTS) \
|
||||
-s WASM=0 \
|
||||
-s WASM_ASYNC_COMPILATION=0 \
|
||||
-s USE_CLOSURE_COMPILER=1 \
|
||||
-s USE_ES6_IMPORT_META=0 \
|
||||
-s MODULARIZE=1 \
|
||||
-s ASSERTIONS=0 \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s DYNAMIC_EXECUTION=0 \
|
||||
-s TEXTDECODER=0 \
|
||||
-s ENVIRONMENT='web' \
|
||||
-s FILESYSTEM=0 \
|
||||
-s MALLOC="emmalloc" \
|
||||
-s EXPORT_NAME="yoga" \
|
||||
-o dist/asm.js
|
||||
|
||||
wasm:
|
||||
$(CXX) $(SOURCES) \
|
||||
$(INCLUDE) \
|
||||
$(CXXFLAGS) \
|
||||
$(EMCCFLAGS) \
|
||||
$(LDLIBS) \
|
||||
$(EMCCOPTS) \
|
||||
-s WASM=1 \
|
||||
-o dist/wasm.js
|
||||
|
||||
clean:
|
||||
rm -rf dist
|
||||
|
||||
|
@@ -7,24 +7,28 @@
|
||||
"type": "git",
|
||||
"url": "git@github.com:facebook/yoga.git"
|
||||
},
|
||||
"main": "./dist/index",
|
||||
"main": "./dist/index.asm.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"default": "./dist/index.asm.js",
|
||||
"browser": "./dist/index.wasm.js",
|
||||
"node": "./dist/index.wasm.js",
|
||||
"react-native": "./dist/index.asm.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"is-monolithic": "test \"$(basename \"$(pwd)\")\" = javascript",
|
||||
"copy-sources": "! npm -s run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)",
|
||||
"build": "npm run copy-sources && make && npm run build:js",
|
||||
"test": "time mocha --expose-gc -r tests/tools.js tests/Facebook.Yoga/**/*.js",
|
||||
"benchmark": "npm run build && node tests/run-bench $(find tests/Benchmarks -name '*.js')",
|
||||
"build:js": "babel sources --out-dir dist && flow-copy-source sources dist"
|
||||
"build:js": "babel sources --source-maps --out-dir dist && flow-copy-source sources dist"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.24.1",
|
||||
"babel-core": "^6.25.0",
|
||||
"babel-plugin-replace-require": "^0.0.4",
|
||||
"babel-plugin-transform-flow-strip-types": "^6.22.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-3": "^6.24.1",
|
||||
"cross-env": "^4.0.0",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core":"^7.20.7",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.19.0",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"flow-copy-source": "^2.0.7",
|
||||
"mocha": "^3.2.0"
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import type {
|
||||
Yoga$Wrap,
|
||||
Yoga$Align,
|
||||
Yoga$FlexDirection,
|
||||
Yoga$Gap,
|
||||
Yoga$Gutter,
|
||||
Yoga$Direction,
|
||||
Yoga$PositionType,
|
||||
Yoga$Overflow,
|
||||
|
17
javascript/sources/index.asm.js
Normal file
17
javascript/sources/index.asm.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const entry = require('./entry');
|
||||
const yoga = require('./asm');
|
||||
|
||||
module.exports = entry(yoga());
|
||||
|
||||
export type * from './YGEnums.js';
|
||||
export type * from './entry';
|
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const entry = require('./entry');
|
||||
const yoga = require('./asm');
|
||||
|
||||
// $FlowFixMe ret will not be null here
|
||||
module.exports = entry(yoga());
|
||||
|
||||
export type {
|
||||
Yoga$Justify,
|
||||
Yoga$Align,
|
||||
Yoga$FlexDirection,
|
||||
Yoga$Direction,
|
||||
Yoga$Wrap,
|
||||
Yoga$Gutter,
|
||||
Yoga$Edge,
|
||||
Yoga$Display,
|
||||
Yoga$Unit,
|
||||
Yoga$Overflow,
|
||||
Yoga$PositionType,
|
||||
Yoga$ExperimentalFeature,
|
||||
} from './YGEnums.js';
|
||||
|
||||
export type {Yoga$Node, Yoga$Config} from './entry';
|
17
javascript/sources/index.wasm.js
Normal file
17
javascript/sources/index.wasm.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const entry = require('./entry');
|
||||
const yoga = require('./wasm');
|
||||
|
||||
module.exports = entry(yoga());
|
||||
|
||||
export type * from './YGEnums.js';
|
||||
export type * from './entry';
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("absolute_layout_width_height_start_top", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("align_baseline_parent_using_child_in_column_as_reference", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("align_content_flex_start", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("align_items_stretch", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("align_self_center", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("android_news_feed", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("border_no_size", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("border_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("margin_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("padding_start", function () {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("wrap_child", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("dirtied", function() {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("display_none", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("flex_direction_column_no_height", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("flex_basis_flex_grow_column", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("wrap_column", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGGapTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("column_gap_flexible", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("justify_content_row_flex_start", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("margin_start", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("measure_once_single_flexible_child", function () {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("dont_measure_single_grow_shrink_child", function () {
|
||||
var root = Yoga.Node.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("max_width", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("padding_no_size", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("percentage_width_height", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("rounding_flex_basis_flex_grow_row_width_of_100", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
var Yoga = Yoga || require("../../dist");
|
||||
var Yoga = Yoga || require("../..");
|
||||
|
||||
it("nested_overflowing_child", function () {
|
||||
var config = Yoga.Config.create();
|
||||
|
3016
javascript/yarn.lock
3016
javascript/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user