diff --git a/enums.py b/enums.py index 03152072..4cd2a64d 100644 --- a/enums.py +++ b/enums.py @@ -224,9 +224,7 @@ for name, values in sorted(ENUMS.items()): # write out javascript file with open(root + "/javascript/sources/YGEnums.js", "w") as f: f.write(get_license("js")) - f.write("// @flow\n") - f.write("// @format\n") - f.write("const CONSTANTS = {\n") + f.write("module.exports = {\n") items = sorted(ENUMS.items()) for name, values in items: f.write(" %s_COUNT: %s,\n" % (to_java_upper(name), len(values))) @@ -248,12 +246,32 @@ with open(root + "/javascript/sources/YGEnums.js", "w") as f: f.write("\n") f.write("};\n") +with open(root + "/javascript/sources/YGEnums.d.ts", "w") as f: + f.write(get_license("js")) + for name, values in sorted(ENUMS.items()): - f.write("export type Yoga${} =\n".format(name)) + base = 0 + for value in values: + if isinstance(value, tuple): + f.write( + "export const %s_%s: %d;\n" + % (to_java_upper(name), to_java_upper(value[0]), value[1]) + ) + base = value[1] + 1 + else: + f.write( + "export const %s_%s: %d;\n" % (to_java_upper(name), to_java_upper(value), base) + ) + base += 1 + + f.write("\n") + + for name, values in sorted(ENUMS.items()): + f.write("export type {} =\n".format(name)) for value in values: unpackedValue = value[0] if isinstance(value, tuple) else value f.write( - " | typeof CONSTANTS.{}_{}".format( + " | typeof {}_{}".format( to_java_upper(name), to_java_upper(unpackedValue) ) ) @@ -263,4 +281,3 @@ with open(root + "/javascript/sources/YGEnums.js", "w") as f: f.write("\n") f.write("\n") - f.write("module.exports = CONSTANTS;\n") diff --git a/javascript/.babelrc.js b/javascript/.babelrc.js index 88e0db11..6a57844c 100644 --- a/javascript/.babelrc.js +++ b/javascript/.babelrc.js @@ -11,7 +11,4 @@ module.exports = { "presets": [ ["@babel/preset-env", {"targets": "defaults"}] ], - "plugins": [ - "@babel/plugin-transform-flow-strip-types" - ] }; diff --git a/javascript/package.json b/javascript/package.json index a291941a..db90ae73 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -27,9 +27,9 @@ ], "scripts": { "build": "yarn build:native && yarn build:js", - "build:native": "yarn build:project && cmake --build build", - "build:project": "which ninja && emcmake cmake -S . -B build -G Ninja || emcmake cmake -S . -B build", - "build:js": "babel sources --source-maps --out-dir dist && flow-copy-source sources dist", + "build:native": "yarn build:native-project && cmake --build build", + "build:native-project": "which ninja && emcmake cmake -S . -B build -G Ninja || emcmake cmake -S . -B build", + "build:js": "babel sources --source-maps --out-dir dist && cp -r sources/*.d.ts dist", "test": "yarn test:asmjs && yarn test:asmjs-sync && yarn test:wasm && yarn test:wasm-sync", "test:asmjs": "jest", "test:asmjs-sync": "SYNC=1 jest", @@ -40,9 +40,7 @@ "devDependencies": { "@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", "jest": "^29.3.1" } } diff --git a/javascript/sources/YGEnums.d.ts b/javascript/sources/YGEnums.d.ts new file mode 100644 index 00000000..1230c1c7 --- /dev/null +++ b/javascript/sources/YGEnums.d.ts @@ -0,0 +1,190 @@ +/** + * 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. + */ + +// @generated by enums.py + +export const ALIGN_AUTO: 0; +export const ALIGN_FLEX_START: 1; +export const ALIGN_CENTER: 2; +export const ALIGN_FLEX_END: 3; +export const ALIGN_STRETCH: 4; +export const ALIGN_BASELINE: 5; +export const ALIGN_SPACE_BETWEEN: 6; +export const ALIGN_SPACE_AROUND: 7; + +export const DIMENSION_WIDTH: 0; +export const DIMENSION_HEIGHT: 1; + +export const DIRECTION_INHERIT: 0; +export const DIRECTION_LTR: 1; +export const DIRECTION_RTL: 2; + +export const DISPLAY_FLEX: 0; +export const DISPLAY_NONE: 1; + +export const EDGE_LEFT: 0; +export const EDGE_TOP: 1; +export const EDGE_RIGHT: 2; +export const EDGE_BOTTOM: 3; +export const EDGE_START: 4; +export const EDGE_END: 5; +export const EDGE_HORIZONTAL: 6; +export const EDGE_VERTICAL: 7; +export const EDGE_ALL: 8; + +export const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0; + +export const FLEX_DIRECTION_COLUMN: 0; +export const FLEX_DIRECTION_COLUMN_REVERSE: 1; +export const FLEX_DIRECTION_ROW: 2; +export const FLEX_DIRECTION_ROW_REVERSE: 3; + +export const GUTTER_COLUMN: 0; +export const GUTTER_ROW: 1; +export const GUTTER_ALL: 2; + +export const JUSTIFY_FLEX_START: 0; +export const JUSTIFY_CENTER: 1; +export const JUSTIFY_FLEX_END: 2; +export const JUSTIFY_SPACE_BETWEEN: 3; +export const JUSTIFY_SPACE_AROUND: 4; +export const JUSTIFY_SPACE_EVENLY: 5; + +export const LOG_LEVEL_ERROR: 0; +export const LOG_LEVEL_WARN: 1; +export const LOG_LEVEL_INFO: 2; +export const LOG_LEVEL_DEBUG: 3; +export const LOG_LEVEL_VERBOSE: 4; +export const LOG_LEVEL_FATAL: 5; + +export const MEASURE_MODE_UNDEFINED: 0; +export const MEASURE_MODE_EXACTLY: 1; +export const MEASURE_MODE_AT_MOST: 2; + +export const NODE_TYPE_DEFAULT: 0; +export const NODE_TYPE_TEXT: 1; + +export const OVERFLOW_VISIBLE: 0; +export const OVERFLOW_HIDDEN: 1; +export const OVERFLOW_SCROLL: 2; + +export const POSITION_TYPE_STATIC: 0; +export const POSITION_TYPE_RELATIVE: 1; +export const POSITION_TYPE_ABSOLUTE: 2; + +export const PRINT_OPTIONS_LAYOUT: 1; +export const PRINT_OPTIONS_STYLE: 2; +export const PRINT_OPTIONS_CHILDREN: 4; + +export const UNIT_UNDEFINED: 0; +export const UNIT_POINT: 1; +export const UNIT_PERCENT: 2; +export const UNIT_AUTO: 3; + +export const WRAP_NO_WRAP: 0; +export const WRAP_WRAP: 1; +export const WRAP_WRAP_REVERSE: 2; + +export type Align = + | typeof ALIGN_AUTO + | typeof ALIGN_FLEX_START + | typeof ALIGN_CENTER + | typeof ALIGN_FLEX_END + | typeof ALIGN_STRETCH + | typeof ALIGN_BASELINE + | typeof ALIGN_SPACE_BETWEEN + | typeof ALIGN_SPACE_AROUND; + +export type Dimension = + | typeof DIMENSION_WIDTH + | typeof DIMENSION_HEIGHT; + +export type Direction = + | typeof DIRECTION_INHERIT + | typeof DIRECTION_LTR + | typeof DIRECTION_RTL; + +export type Display = + | typeof DISPLAY_FLEX + | typeof DISPLAY_NONE; + +export type Edge = + | typeof EDGE_LEFT + | typeof EDGE_TOP + | typeof EDGE_RIGHT + | typeof EDGE_BOTTOM + | typeof EDGE_START + | typeof EDGE_END + | typeof EDGE_HORIZONTAL + | typeof EDGE_VERTICAL + | typeof EDGE_ALL; + +export type ExperimentalFeature = + | typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; + +export type FlexDirection = + | typeof FLEX_DIRECTION_COLUMN + | typeof FLEX_DIRECTION_COLUMN_REVERSE + | typeof FLEX_DIRECTION_ROW + | typeof FLEX_DIRECTION_ROW_REVERSE; + +export type Gutter = + | typeof GUTTER_COLUMN + | typeof GUTTER_ROW + | typeof GUTTER_ALL; + +export type Justify = + | typeof JUSTIFY_FLEX_START + | typeof JUSTIFY_CENTER + | typeof JUSTIFY_FLEX_END + | typeof JUSTIFY_SPACE_BETWEEN + | typeof JUSTIFY_SPACE_AROUND + | typeof JUSTIFY_SPACE_EVENLY; + +export type LogLevel = + | typeof LOG_LEVEL_ERROR + | typeof LOG_LEVEL_WARN + | typeof LOG_LEVEL_INFO + | typeof LOG_LEVEL_DEBUG + | typeof LOG_LEVEL_VERBOSE + | typeof LOG_LEVEL_FATAL; + +export type MeasureMode = + | typeof MEASURE_MODE_UNDEFINED + | typeof MEASURE_MODE_EXACTLY + | typeof MEASURE_MODE_AT_MOST; + +export type NodeType = + | typeof NODE_TYPE_DEFAULT + | typeof NODE_TYPE_TEXT; + +export type Overflow = + | typeof OVERFLOW_VISIBLE + | typeof OVERFLOW_HIDDEN + | typeof OVERFLOW_SCROLL; + +export type PositionType = + | typeof POSITION_TYPE_STATIC + | typeof POSITION_TYPE_RELATIVE + | typeof POSITION_TYPE_ABSOLUTE; + +export type PrintOptions = + | typeof PRINT_OPTIONS_LAYOUT + | typeof PRINT_OPTIONS_STYLE + | typeof PRINT_OPTIONS_CHILDREN; + +export type Unit = + | typeof UNIT_UNDEFINED + | typeof UNIT_POINT + | typeof UNIT_PERCENT + | typeof UNIT_AUTO; + +export type Wrap = + | typeof WRAP_NO_WRAP + | typeof WRAP_WRAP + | typeof WRAP_WRAP_REVERSE; + diff --git a/javascript/sources/YGEnums.js b/javascript/sources/YGEnums.js index 96905ce4..6d7df977 100644 --- a/javascript/sources/YGEnums.js +++ b/javascript/sources/YGEnums.js @@ -7,9 +7,7 @@ // @generated by enums.py -// @flow -// @format -const CONSTANTS = { +module.exports = { ALIGN_COUNT: 8, ALIGN_AUTO: 0, ALIGN_FLEX_START: 1, @@ -109,103 +107,3 @@ const CONSTANTS = { WRAP_WRAP: 1, WRAP_WRAP_REVERSE: 2, }; -export type Yoga$Align = - | typeof CONSTANTS.ALIGN_AUTO - | typeof CONSTANTS.ALIGN_FLEX_START - | typeof CONSTANTS.ALIGN_CENTER - | typeof CONSTANTS.ALIGN_FLEX_END - | typeof CONSTANTS.ALIGN_STRETCH - | typeof CONSTANTS.ALIGN_BASELINE - | typeof CONSTANTS.ALIGN_SPACE_BETWEEN - | typeof CONSTANTS.ALIGN_SPACE_AROUND; - -export type Yoga$Dimension = - | typeof CONSTANTS.DIMENSION_WIDTH - | typeof CONSTANTS.DIMENSION_HEIGHT; - -export type Yoga$Direction = - | typeof CONSTANTS.DIRECTION_INHERIT - | typeof CONSTANTS.DIRECTION_LTR - | typeof CONSTANTS.DIRECTION_RTL; - -export type Yoga$Display = - | typeof CONSTANTS.DISPLAY_FLEX - | typeof CONSTANTS.DISPLAY_NONE; - -export type Yoga$Edge = - | typeof CONSTANTS.EDGE_LEFT - | typeof CONSTANTS.EDGE_TOP - | typeof CONSTANTS.EDGE_RIGHT - | typeof CONSTANTS.EDGE_BOTTOM - | typeof CONSTANTS.EDGE_START - | typeof CONSTANTS.EDGE_END - | typeof CONSTANTS.EDGE_HORIZONTAL - | typeof CONSTANTS.EDGE_VERTICAL - | typeof CONSTANTS.EDGE_ALL; - -export type Yoga$ExperimentalFeature = - | typeof CONSTANTS.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; - -export type Yoga$FlexDirection = - | typeof CONSTANTS.FLEX_DIRECTION_COLUMN - | typeof CONSTANTS.FLEX_DIRECTION_COLUMN_REVERSE - | typeof CONSTANTS.FLEX_DIRECTION_ROW - | typeof CONSTANTS.FLEX_DIRECTION_ROW_REVERSE; - -export type Yoga$Gutter = - | typeof CONSTANTS.GUTTER_COLUMN - | typeof CONSTANTS.GUTTER_ROW - | typeof CONSTANTS.GUTTER_ALL; - -export type Yoga$Justify = - | typeof CONSTANTS.JUSTIFY_FLEX_START - | typeof CONSTANTS.JUSTIFY_CENTER - | typeof CONSTANTS.JUSTIFY_FLEX_END - | typeof CONSTANTS.JUSTIFY_SPACE_BETWEEN - | typeof CONSTANTS.JUSTIFY_SPACE_AROUND - | typeof CONSTANTS.JUSTIFY_SPACE_EVENLY; - -export type Yoga$LogLevel = - | typeof CONSTANTS.LOG_LEVEL_ERROR - | typeof CONSTANTS.LOG_LEVEL_WARN - | typeof CONSTANTS.LOG_LEVEL_INFO - | typeof CONSTANTS.LOG_LEVEL_DEBUG - | typeof CONSTANTS.LOG_LEVEL_VERBOSE - | typeof CONSTANTS.LOG_LEVEL_FATAL; - -export type Yoga$MeasureMode = - | typeof CONSTANTS.MEASURE_MODE_UNDEFINED - | typeof CONSTANTS.MEASURE_MODE_EXACTLY - | typeof CONSTANTS.MEASURE_MODE_AT_MOST; - -export type Yoga$NodeType = - | typeof CONSTANTS.NODE_TYPE_DEFAULT - | typeof CONSTANTS.NODE_TYPE_TEXT; - -export type Yoga$Overflow = - | typeof CONSTANTS.OVERFLOW_VISIBLE - | typeof CONSTANTS.OVERFLOW_HIDDEN - | typeof CONSTANTS.OVERFLOW_SCROLL; - -export type Yoga$PositionType = - | typeof CONSTANTS.POSITION_TYPE_STATIC - | typeof CONSTANTS.POSITION_TYPE_RELATIVE - | typeof CONSTANTS.POSITION_TYPE_ABSOLUTE; - -export type Yoga$PrintOptions = - | typeof CONSTANTS.PRINT_OPTIONS_LAYOUT - | typeof CONSTANTS.PRINT_OPTIONS_STYLE - | typeof CONSTANTS.PRINT_OPTIONS_CHILDREN; - -export type Yoga$Unit = - | typeof CONSTANTS.UNIT_UNDEFINED - | typeof CONSTANTS.UNIT_POINT - | typeof CONSTANTS.UNIT_PERCENT - | typeof CONSTANTS.UNIT_AUTO; - -export type Yoga$Wrap = - | typeof CONSTANTS.WRAP_NO_WRAP - | typeof CONSTANTS.WRAP_WRAP - | typeof CONSTANTS.WRAP_WRAP_REVERSE; - -module.exports = CONSTANTS; diff --git a/javascript/sources/entry.js b/javascript/sources/entry.js deleted file mode 100644 index 0b9a3545..00000000 --- a/javascript/sources/entry.js +++ /dev/null @@ -1,379 +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 CONSTANTS = require('./YGEnums'); -import type { - Yoga$Edge, - Yoga$Wrap, - Yoga$Align, - Yoga$FlexDirection, - Yoga$Gutter, - Yoga$Direction, - Yoga$PositionType, - Yoga$Overflow, - Yoga$Justify, - Yoga$Display, - Yoga$ExperimentalFeature, -} from './YGEnums'; - -class Layout { - left: number; - right: number; - top: number; - bottom: number; - width: number; - height: number; - - constructor(left, right, top, bottom, width, height) { - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - this.width = width; - this.height = height; - } - - fromJS(expose) { - expose( - this.left, - this.right, - this.top, - this.bottom, - this.width, - this.height, - ); - } - - toString() { - return ``; - } -} - -class Size { - static fromJS({width, height}) { - return new Size(width, height); - } - - width: number; - height: number; - - constructor(width, height) { - this.width = width; - this.height = height; - } - - fromJS(expose) { - expose(this.width, this.height); - } - - toString() { - return ``; - } -} - -class Value { - unit: number; - value: number; - - constructor(unit, value) { - this.unit = unit; - this.value = value; - } - - fromJS(expose) { - expose(this.unit, this.value); - } - - toString() { - switch (this.unit) { - case CONSTANTS.UNIT_POINT: - return String(this.value); - case CONSTANTS.UNIT_PERCENT: - return `${this.value}%`; - case CONSTANTS.UNIT_AUTO: - return 'auto'; - default: { - return `${this.value}?`; - } - } - } - - valueOf() { - return this.value; - } -} - -export type Yoga$Config = { - isExperimentalFeatureEnabled(feature: Yoga$ExperimentalFeature): boolean, - setExperimentalFeatureEnabled( - feature: Yoga$ExperimentalFeature, - enabled: boolean, - ): void, - setPointScaleFactor(factor: number): void, -}; - -export type Yoga$Node = { - calculateLayout( - width?: number, - height?: number, - direction?: Yoga$Direction, - ): void, - copyStyle(node: Yoga$Node): void, - free(): void, - freeRecursive(): void, - getAlignContent(): Yoga$Align, - getAlignItems(): Yoga$Align, - getAlignSelf(): Yoga$Align, - getAspectRatio(): number, - getBorder(edge: Yoga$Edge): number, - getChild(index: number): Yoga$Node, - getChildCount(): number, - getComputedBorder(edge: Yoga$Edge): number, - getComputedBottom(): number, - getComputedHeight(): number, - getComputedLayout(): Layout, - getComputedLeft(): number, - getComputedMargin(edge: Yoga$Edge): number, - getComputedPadding(edge: Yoga$Edge): number, - getComputedRight(): number, - getComputedTop(): number, - getComputedWidth(): number, - getDisplay(): Yoga$Display, - getFlexBasis(): number, - getFlexDirection(): Yoga$FlexDirection, - getFlexGrow(): number, - getFlexShrink(): number, - getFlexWrap(): Yoga$Wrap, - getHeight(): Value, - getJustifyContent(): Yoga$Justify, - getGap(gutter: Yoga$Gutter): Value, - getMargin(edge: Yoga$Edge): Value, - getMaxHeight(): Value, - getMaxWidth(): Value, - getMinHeight(): Value, - getMinWidth(): Value, - getOverflow(): Yoga$Overflow, - getPadding(edge: Yoga$Edge): Value, - getParent(): ?Yoga$Node, - getPosition(edge: Yoga$Edge): Value, - getPositionType(): Yoga$PositionType, - getWidth(): Value, - insertChild(child: Yoga$Node, index: number): void, - isDirty(): boolean, - markDirty(): void, - removeChild(child: Yoga$Node): void, - reset(): void, - setAlignContent(alignContent: Yoga$Align): void, - setAlignItems(alignItems: Yoga$Align): void, - setAlignSelf(alignSelf: Yoga$Align): void, - setAspectRatio(aspectRatio: number): void, - setBorder(edge: Yoga$Edge, borderWidth: number): void, - setDisplay(display: Yoga$Display): void, - setFlex(flex: number): void, - setFlexBasis(flexBasis: number | string): void, - setFlexBasisPercent(flexBasis: number): void, - setFlexBasisAuto(): void, - setFlexDirection(flexDirection: Yoga$FlexDirection): void, - setFlexGrow(flexGrow: number): void, - setFlexShrink(flexShrink: number): void, - setFlexWrap(flexWrap: Yoga$Wrap): void, - setHeight(height: number | string): void, - setHeightAuto(): void, - setHeightPercent(height: number): void, - setJustifyContent(justifyContent: Yoga$Justify): void, - setGap(gutter: Yoga$Gutter, gapLength: number): Value, - setMargin(edge: Yoga$Edge, margin: number): void, - setMarginAuto(edge: Yoga$Edge): void, - setMarginPercent(edge: Yoga$Edge, margin: number): void, - setMaxHeight(maxHeight: number | string): void, - setMaxHeightPercent(maxHeight: number): void, - setMaxWidth(maxWidth: number | string): void, - setMaxWidthPercent(maxWidth: number): void, - setMeasureFunc(measureFunc: ?Function): void, - setMinHeight(minHeight: number | string): void, - setMinHeightPercent(minHeight: number): void, - setMinWidth(minWidth: number | string): void, - setMinWidthPercent(minWidth: number): void, - setOverflow(overflow: Yoga$Overflow): void, - setPadding(edge: Yoga$Edge, padding: number | string): void, - setPaddingPercent(edge: Yoga$Edge, padding: number): void, - setPosition(edge: Yoga$Edge, position: number | string): void, - setPositionPercent(edge: Yoga$Edge, position: number): void, - setPositionType(positionType: Yoga$PositionType): void, - setWidth(width: number | string): void, - setWidthAuto(): void, - setWidthPercent(width: number): void, - unsetMeasureFun(): void, -}; - -type YogaConstructor = { - initialize: () => Promise; -} - -type Yoga = { - Config: { - create(): Yoga$Config, - destroy(config: Yoga$Config): any, - }, - Node: { - create(): Yoga$Node, - createDefault(): Yoga$Node, - createWithConfig(config: Yoga$Config): Yoga$Node, - destroy(node: Yoga$Node): any, - }, - Layout: Layout, - Size: Size, - Value: Value, - getInstanceCount(): number, - ...typeof CONSTANTS, -}; - -module.exports = function wrapLib(lib: any): Yoga { - function patch(prototype, name, fn) { - let original = prototype[name]; - - prototype[name] = function(...args) { - return fn.call(this, original, ...args); - }; - } - - for (let fnName of [ - 'setPosition', - 'setMargin', - 'setFlexBasis', - 'setWidth', - 'setHeight', - 'setMinWidth', - 'setMinHeight', - 'setMaxWidth', - 'setMaxHeight', - 'setPadding', - ]) { - let methods = { - [CONSTANTS.UNIT_POINT]: lib.Node.prototype[fnName], - [CONSTANTS.UNIT_PERCENT]: lib.Node.prototype[`${fnName}Percent`], - [CONSTANTS.UNIT_AUTO]: lib.Node.prototype[`${fnName}Auto`], - }; - - patch(lib.Node.prototype, fnName, function(original, ...args) { - // We patch all these functions to add support for the following calls: - // .setWidth(100) / .setWidth("100%") / .setWidth(.getWidth()) / .setWidth("auto") - - let value = args.pop(); - let unit, asNumber; - - if (value === 'auto') { - unit = CONSTANTS.UNIT_AUTO; - asNumber = undefined; - } else if (value instanceof Value) { - unit = value.unit; - asNumber = value.valueOf(); - } else { - unit = - typeof value === 'string' && value.endsWith('%') - ? CONSTANTS.UNIT_PERCENT - : CONSTANTS.UNIT_POINT; - asNumber = parseFloat(value); - if (!Number.isNaN(value) && Number.isNaN(asNumber)) { - throw new Error(`Invalid value ${value} for ${fnName}`); - } - } - - if (!methods[unit]) - throw new Error( - `Failed to execute "${fnName}": Unsupported unit '${value}'`, - ); - - if (asNumber !== undefined) { - return methods[unit].call(this, ...args, asNumber); - } else { - return methods[unit].call(this, ...args); - } - }); - } - - function wrapMeasureFunction(measureFunction) { - return lib.MeasureCallback.implement({ measure: measureFunction }) - } - - patch(lib.Node.prototype, 'setMeasureFunc', function (original, measureFunc) { - original.call(this, wrapMeasureFunction(measureFunc)) - }) - - function wrapDirtiedFunc(dirtiedFunction) { - return lib.DirtiedCallback.implement({ dirtied: dirtiedFunction }) - } - - patch(lib.Node.prototype, 'setDirtiedFunc', function (original, dirtiedFunc) { - original.call(this, wrapDirtiedFunc(dirtiedFunc)) - }) - - patch(lib.Config.prototype, 'free', function() { - // Since we handle the memory allocation ourselves (via lib.Config.create), - // we also need to handle the deallocation - lib.Config.destroy(this); - }); - - patch(lib.Node, 'create', function(_, config) { - // We decide the constructor we want to call depending on the parameters - return config - ? lib.Node.createWithConfig(config) - : lib.Node.createDefault(); - }); - - patch(lib.Node.prototype, 'free', function() { - // Since we handle the memory allocation ourselves (via lib.Node.create), - // we also need to handle the deallocation - lib.Node.destroy(this); - }); - - patch(lib.Node.prototype, 'freeRecursive', function() { - for (let t = 0, T = this.getChildCount(); t < T; ++t) { - this.getChild(0).freeRecursive(); - } - this.free(); - }); - - patch(lib.Node.prototype, 'setMeasureFunc', function(original, measureFunc) { - // This patch is just a convenience patch, since it helps write more - // idiomatic source code (such as .setMeasureFunc(null)) - // We also automatically convert the return value of the measureFunc - // to a Size object, so that we can return anything that has .width and - // .height properties - if (measureFunc) { - return original.call(this, (...args) => - Size.fromJS(measureFunc(...args)), - ); - } else { - return this.unsetMeasureFunc(); - } - }); - - patch(lib.Node.prototype, 'calculateLayout', function( - original, - width = NaN, - height = NaN, - direction = CONSTANTS.DIRECTION_LTR, - ) { - // Just a small patch to add support for the function default parameters - return original.call(this, width, height, direction); - }); - - return { - Config: lib.Config, - Node: lib.Node, - Layout: Layout, - Size: Size, - Value: Value, - ...CONSTANTS, - }; -}; diff --git a/javascript/sources/index.asmjs.js b/javascript/sources/index.asmjs.js index ce3710cd..ca89851c 100644 --- a/javascript/sources/index.asmjs.js +++ b/javascript/sources/index.asmjs.js @@ -4,18 +4,13 @@ * 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 wrapLib = require('./entry'); +const wrapAsm = require('./wrapAsm'); const loadYoga = require('./asmjs-async'); module.exports = { - load: () => { - return loadYoga().then(wrapLib); - } + load: () => loadYoga().then(wrapAsm), + ...require('./YGEnums'), } - -export type * from './YGEnums.js'; -export type * from './entry'; diff --git a/javascript/sources/index.d.ts b/javascript/sources/index.d.ts new file mode 100644 index 00000000..7340238a --- /dev/null +++ b/javascript/sources/index.d.ts @@ -0,0 +1,15 @@ +/** + * 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 + */ + +import type {Yoga} from './wrapAsm'; + +export * from './YGEnums'; +export * from './wrapAsm'; + +export function load(): Promise; diff --git a/javascript/sources/index.wasm.js b/javascript/sources/index.wasm.js index d218d310..e64d3985 100644 --- a/javascript/sources/index.wasm.js +++ b/javascript/sources/index.wasm.js @@ -4,18 +4,13 @@ * 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 wrapLib = require('./entry'); +const wrapAsm = require('./wrapAsm'); const loadYoga = require('./wasm-async'); module.exports = { -load: () => { - return loadYoga().then(wrapLib); + load: () => loadYoga().then(wrapAsm), + ...require('./YGEnums'), } -} - -export type * from './YGEnums.js'; -export type * from './entry'; diff --git a/javascript/sources/sync.asmjs.js b/javascript/sources/sync.asmjs.js index b967e046..2e769414 100644 --- a/javascript/sources/sync.asmjs.js +++ b/javascript/sources/sync.asmjs.js @@ -4,14 +4,10 @@ * 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 wrapLib = require('./entry'); +const wrapAsm = require('./wrapAsm'); const loadYoga = require('./asmjs-sync'); -module.exports = wrapLib(loadYoga()); - -export type * from './YGEnums.js'; -export type * from './entry'; +module.exports = wrapAsm(loadYoga()); diff --git a/javascript/sources/sync.d.ts b/javascript/sources/sync.d.ts new file mode 100644 index 00000000..350f9492 --- /dev/null +++ b/javascript/sources/sync.d.ts @@ -0,0 +1,16 @@ +/** + * 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 + */ + + import type {Yoga} from './wrapAsm'; + + export * from './YGEnums'; + export * from './wrapAsm'; + + declare const yoga: Yoga; + export default yoga; diff --git a/javascript/sources/sync.wasm.js b/javascript/sources/sync.wasm.js index 196d7a08..393c6d31 100644 --- a/javascript/sources/sync.wasm.js +++ b/javascript/sources/sync.wasm.js @@ -4,14 +4,10 @@ * 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 wrapLib = require('./entry'); +const wrapAsm = require('./wrapAsm'); const loadYoga = require('./wasm-sync'); -module.exports = wrapLib(loadYoga()); - -export type * from './YGEnums.js'; -export type * from './entry'; +module.exports = wrapAsm(loadYoga()); diff --git a/javascript/sources/wrapAsm.d.ts b/javascript/sources/wrapAsm.d.ts new file mode 100644 index 00000000..0e67d5b4 --- /dev/null +++ b/javascript/sources/wrapAsm.d.ts @@ -0,0 +1,168 @@ +/** + * 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 + */ + + import type { + Edge, + Wrap, + Align, + FlexDirection, + Gutter, + Direction, + PositionType, + Overflow, + Justify, + Display, + ExperimentalFeature, +} from './YGEnums'; + +import type * as YGEnums from './YGEnums'; + +type Layout = { + left: number; + right: number; + top: number; + bottom: number; + width: number; + height: number; +} + +type Size = { + width: number; + height: number; +} + +type Value = { + unit: number; + value: number; +} + +export type Config = { + isExperimentalFeatureEnabled(feature: ExperimentalFeature): boolean, + setExperimentalFeatureEnabled( + feature: ExperimentalFeature, + enabled: boolean, + ): void, + setPointScaleFactor(factor: number): void, +}; + +export type MeasureFunction = ( + width: number, + widthMode: number, + height: number, + heightMode: number) => Size; + +export type Node = { + calculateLayout( + width?: number, + height?: number, + direction?: Direction, + ): void, + copyStyle(node: Node): void, + free(): void, + freeRecursive(): void, + getAlignContent(): Align, + getAlignItems(): Align, + getAlignSelf(): Align, + getAspectRatio(): number, + getBorder(edge: Edge): number, + getChild(index: number): Node, + getChildCount(): number, + getComputedBorder(edge: Edge): number, + getComputedBottom(): number, + getComputedHeight(): number, + getComputedLayout(): Layout, + getComputedLeft(): number, + getComputedMargin(edge: Edge): number, + getComputedPadding(edge: Edge): number, + getComputedRight(): number, + getComputedTop(): number, + getComputedWidth(): number, + getDisplay(): Display, + getFlexBasis(): number, + getFlexDirection(): FlexDirection, + getFlexGrow(): number, + getFlexShrink(): number, + getFlexWrap(): Wrap, + getHeight(): Value, + getJustifyContent(): Justify, + getGap(gutter: Gutter): Value, + getMargin(edge: Edge): Value, + getMaxHeight(): Value, + getMaxWidth(): Value, + getMinHeight(): Value, + getMinWidth(): Value, + getOverflow(): Overflow, + getPadding(edge: Edge): Value, + getParent(): Node | null, + getPosition(edge: Edge): Value, + getPositionType(): PositionType, + getWidth(): Value, + insertChild(child: Node, index: number): void, + isDirty(): boolean, + markDirty(): void, + removeChild(child: Node): void, + reset(): void, + setAlignContent(alignContent: Align): void, + setAlignItems(alignItems: Align): void, + setAlignSelf(alignSelf: Align): void, + setAspectRatio(aspectRatio: number): void, + setBorder(edge: Edge, borderWidth: number): void, + setDisplay(display: Display): void, + setFlex(flex: number): void, + setFlexBasis(flexBasis: number | string): void, + setFlexBasisPercent(flexBasis: number): void, + setFlexBasisAuto(): void, + setFlexDirection(flexDirection: FlexDirection): void, + setFlexGrow(flexGrow: number): void, + setFlexShrink(flexShrink: number): void, + setFlexWrap(flexWrap: Wrap): void, + setHeight(height: number | string): void, + setHeightAuto(): void, + setHeightPercent(height: number): void, + setJustifyContent(justifyContent: Justify): void, + setGap(gutter: Gutter, gapLength: number): Value, + setMargin(edge: Edge, margin: number): void, + setMarginAuto(edge: Edge): void, + setMarginPercent(edge: Edge, margin: number): void, + setMaxHeight(maxHeight: number | string): void, + setMaxHeightPercent(maxHeight: number): void, + setMaxWidth(maxWidth: number | string): void, + setMaxWidthPercent(maxWidth: number): void, + setMeasureFunc(measureFunc: MeasureFunction | null): void, + setMinHeight(minHeight: number | string): void, + setMinHeightPercent(minHeight: number): void, + setMinWidth(minWidth: number | string): void, + setMinWidthPercent(minWidth: number): void, + setOverflow(overflow: Overflow): void, + setPadding(edge: Edge, padding: number | string): void, + setPaddingPercent(edge: Edge, padding: number): void, + setPosition(edge: Edge, position: number | string): void, + setPositionPercent(edge: Edge, position: number): void, + setPositionType(positionType: PositionType): void, + setWidth(width: number | string): void, + setWidthAuto(): void, + setWidthPercent(width: number): void, + unsetMeasureFun(): void, +}; + +export type Yoga = { + Config: { + create(): Config, + destroy(config: Config): any, + }, + Node: { + create(): Node, + createDefault(): Node, + createWithConfig(config: Config): Node, + destroy(node: Node): any, + }, +} & typeof YGEnums; + +declare const wrapAsm: () => Yoga; +export default wrapAsm; diff --git a/javascript/sources/wrapAsm.js b/javascript/sources/wrapAsm.js new file mode 100644 index 00000000..263578b9 --- /dev/null +++ b/javascript/sources/wrapAsm.js @@ -0,0 +1,145 @@ +/** + * 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 + */ + +const CONSTANTS = require('./YGEnums'); + +module.exports = (lib) => { + function patch(prototype, name, fn) { + let original = prototype[name]; + + prototype[name] = function(...args) { + return fn.call(this, original, ...args); + }; + } + + for (let fnName of [ + 'setPosition', + 'setMargin', + 'setFlexBasis', + 'setWidth', + 'setHeight', + 'setMinWidth', + 'setMinHeight', + 'setMaxWidth', + 'setMaxHeight', + 'setPadding', + ]) { + let methods = { + [CONSTANTS.UNIT_POINT]: lib.Node.prototype[fnName], + [CONSTANTS.UNIT_PERCENT]: lib.Node.prototype[`${fnName}Percent`], + [CONSTANTS.UNIT_AUTO]: lib.Node.prototype[`${fnName}Auto`], + }; + + patch(lib.Node.prototype, fnName, function(original, ...args) { + // We patch all these functions to add support for the following calls: + // .setWidth(100) / .setWidth("100%") / .setWidth(.getWidth()) / .setWidth("auto") + + let value = args.pop(); + let unit, asNumber; + + if (value === 'auto') { + unit = CONSTANTS.UNIT_AUTO; + asNumber = undefined; + } else if (typeof value === 'object') { + unit = value.unit; + asNumber = value.valueOf(); + } else { + unit = + typeof value === 'string' && value.endsWith('%') + ? CONSTANTS.UNIT_PERCENT + : CONSTANTS.UNIT_POINT; + asNumber = parseFloat(value); + if (!Number.isNaN(value) && Number.isNaN(asNumber)) { + throw new Error(`Invalid value ${value} for ${fnName}`); + } + } + + if (!methods[unit]) + throw new Error( + `Failed to execute "${fnName}": Unsupported unit '${value}'`, + ); + + if (asNumber !== undefined) { + return methods[unit].call(this, ...args, asNumber); + } else { + return methods[unit].call(this, ...args); + } + }); + } + + function wrapMeasureFunction(measureFunction) { + return lib.MeasureCallback.implement({ measure: measureFunction }) + } + + patch(lib.Node.prototype, 'setMeasureFunc', function (original, measureFunc) { + original.call(this, wrapMeasureFunction(measureFunc)) + }) + + function wrapDirtiedFunc(dirtiedFunction) { + return lib.DirtiedCallback.implement({ dirtied: dirtiedFunction }) + } + + patch(lib.Node.prototype, 'setDirtiedFunc', function (original, dirtiedFunc) { + original.call(this, wrapDirtiedFunc(dirtiedFunc)) + }) + + patch(lib.Config.prototype, 'free', function() { + // Since we handle the memory allocation ourselves (via lib.Config.create), + // we also need to handle the deallocation + lib.Config.destroy(this); + }); + + patch(lib.Node, 'create', function(_, config) { + // We decide the constructor we want to call depending on the parameters + return config + ? lib.Node.createWithConfig(config) + : lib.Node.createDefault(); + }); + + patch(lib.Node.prototype, 'free', function() { + // Since we handle the memory allocation ourselves (via lib.Node.create), + // we also need to handle the deallocation + lib.Node.destroy(this); + }); + + patch(lib.Node.prototype, 'freeRecursive', function() { + for (let t = 0, T = this.getChildCount(); t < T; ++t) { + this.getChild(0).freeRecursive(); + } + this.free(); + }); + + patch(lib.Node.prototype, 'setMeasureFunc', function(original, measureFunc) { + // This patch is just a convenience patch, since it helps write more + // idiomatic source code (such as .setMeasureFunc(null)) + if (measureFunc) { + return original.call(this, (...args) => + measureFunc(...args), + ); + } else { + return this.unsetMeasureFunc(); + } + }); + + patch(lib.Node.prototype, 'calculateLayout', function( + original, + width = NaN, + height = NaN, + direction = CONSTANTS.DIRECTION_LTR, + ) { + // Just a small patch to add support for the function default parameters + return original.call(this, width, height, direction); + }); + + return { + Config: lib.Config, + Node: lib.Node, + ...CONSTANTS, + }; +}; diff --git a/javascript/yarn.lock b/javascript/yarn.lock index e994255b..9f02eac8 100644 --- a/javascript/yarn.lock +++ b/javascript/yarn.lock @@ -472,13 +472,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-flow@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.18.6.tgz#774d825256f2379d06139be0c723c4dd444f3ca1" - integrity sha512-LUbR+KNTBWCUAqRG9ex5Gnzu2IOkt8jRJbHHXFT9q+L9zm7M/QQbEqXyw1n1pohYvOyWC8CjeyjrSaIwiYjK7A== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-import-assertions@^7.20.0": version "7.20.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz#bb50e0d4bea0957235390641209394e87bdb9cc4" @@ -653,14 +646,6 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-flow-strip-types@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.19.0.tgz#e9e8606633287488216028719638cbbb2f2dde8f" - integrity sha512-sgeMlNaQVbCSpgLSKP4ZZKfsJVnFnNQlUSk6gPYzR/q7tzCgQF2t8RBKAP6cKJeZdveei7Q7Jm527xepI8lNLg== - dependencies: - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/plugin-syntax-flow" "^7.18.6" - "@babel/plugin-transform-for-of@^7.18.8": version "7.18.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" @@ -1515,7 +1500,7 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@^5.0.0, camelcase@^5.3.1: +camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -1552,7 +1537,7 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -chokidar@^3.0.0, chokidar@^3.4.0: +chokidar@^3.4.0: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -1577,15 +1562,6 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== -cliui@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" - integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^6.2.0" - cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -1672,11 +1648,6 @@ debug@^4.1.0, debug@^4.1.1: dependencies: ms "2.1.2" -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== - dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -1802,26 +1773,6 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -flow-copy-source@^2.0.7: - version "2.0.9" - resolved "https://registry.yarnpkg.com/flow-copy-source/-/flow-copy-source-2.0.9.tgz#0c94ad842f2ae544d5a6b8ae720cee0b8678d742" - integrity sha512-7zX/oHSIHe8YRGiA9QIcC4SW6KF667ikdmiDfbST15up1Ona8dn7Xy0PmSrfw6ceBWDww8sRKlCLKsztStpYkQ== - dependencies: - chokidar "^3.0.0" - fs-extra "^8.1.0" - glob "^7.0.0" - kefir "^3.7.3" - yargs "^15.0.1" - -fs-extra@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" - integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" @@ -1847,7 +1798,7 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.1, get-caller-file@^2.0.5: +get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -1869,7 +1820,7 @@ glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: +glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -1886,7 +1837,7 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.9: +graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== @@ -2436,18 +2387,6 @@ json5@^2.2.1: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.2.tgz#64471c5bdcc564c18f7c1d4df2e2297f2457c5ab" integrity sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ== -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== - optionalDependencies: - graceful-fs "^4.1.6" - -kefir@^3.7.3: - version "3.8.8" - resolved "https://registry.yarnpkg.com/kefir/-/kefir-3.8.8.tgz#235932ddfbed422acebf5d7cba503035e9ea05c5" - integrity sha512-xWga7QCZsR2Wjy2vNL3Kq/irT+IwxwItEWycRRlT5yhqHZK2fmEhziP+LzcJBWSTAMranGKtGTQ6lFpyJS3+jA== - kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -2747,11 +2686,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -2795,11 +2729,6 @@ semver@^7.3.5: dependencies: lru-cache "^6.0.0" -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -2981,11 +2910,6 @@ unicode-property-aliases-ecmascript@^2.0.0: resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd" integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w== -universalify@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== - update-browserslist-db@^1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" @@ -3010,11 +2934,6 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -3022,15 +2941,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -3053,11 +2963,6 @@ write-file-atomic@^4.0.1: imurmurhash "^0.1.4" signal-exit "^3.0.7" -y18n@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" - integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== - y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" @@ -3073,36 +2978,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@^18.1.2: - version "18.1.3" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" - integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^15.0.1: - version "15.4.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" - integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== - dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.2" - yargs@^17.3.1: version "17.6.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541"