first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

3
node_modules/ob1/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# ob1
A small library for working with 0- and 1-based offsets in a type-checked way.

29
node_modules/ob1/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "ob1",
"version": "0.83.3",
"description": "A small library for working with 0- and 1-based offsets in a type-checked way.",
"main": "src/ob1.js",
"exports": {
".": "./src/ob1.js",
"./package.json": "./package.json",
"./private/*": "./src/*.js"
},
"repository": {
"type": "git",
"url": "git@github.com:facebook/metro.git"
},
"scripts": {
"prepare-release": "test -d build && rm -rf src.real && mv src src.real && mv build src",
"cleanup-release": "test ! -e build && mv src build && mv src.real src"
},
"keywords": [
"metro"
],
"license": "MIT",
"dependencies": {
"flow-enums-runtime": "^0.0.6"
},
"engines": {
"node": ">=20.19.4"
}
}

41
node_modules/ob1/src/__flowtests__/ob1-flowtest.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _ob = require("../ob1");
const FORTY_TWO_0 = (0, _ob.add0)(42);
const FORTY_TWO_1 = (0, _ob.add1)(42);
var _default = (exports.default = {
testSafeOps() {
(0, _ob.add)(FORTY_TWO_0, FORTY_TWO_0);
(0, _ob.add)(FORTY_TWO_0, FORTY_TWO_1);
(0, _ob.add)(FORTY_TWO_1, FORTY_TWO_0);
(0, _ob.sub)(FORTY_TWO_1, FORTY_TWO_1);
(0, _ob.add)(FORTY_TWO_0, 9000);
(0, _ob.add)(FORTY_TWO_0, 9000);
(0, _ob.add)(FORTY_TWO_1, 9000);
(0, _ob.sub)(FORTY_TWO_1, 9000);
(0, _ob.get0)(FORTY_TWO_0);
(0, _ob.get1)(FORTY_TWO_1);
(0, _ob.neg)(FORTY_TWO_0);
(0, _ob.add1)(FORTY_TWO_0);
(0, _ob.sub1)(FORTY_TWO_1);
(0, _ob.inc)(FORTY_TWO_0);
(0, _ob.inc)(FORTY_TWO_1);
},
testUnsafeOps() {
(0, _ob.add)(FORTY_TWO_1, FORTY_TWO_1);
(0, _ob.sub)(FORTY_TWO_0, FORTY_TWO_1);
FORTY_TWO_0 - 1;
FORTY_TWO_1 - 1;
(0, _ob.get0)(FORTY_TWO_1);
(0, _ob.get1)(FORTY_TWO_0);
(0, _ob.neg)(FORTY_TWO_1);
(0, _ob.add1)(FORTY_TWO_1);
(0, _ob.sub1)(FORTY_TWO_0);
(0, _ob.get0)(42);
(0, _ob.get1)(42);
},
});

View File

@@ -0,0 +1,71 @@
/**
* 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 strict-local
* @format
* @oncall react_native
*/
import type {Number0, Number1} from '../ob1';
import {add, add0, add1, get0, get1, inc, neg, sub, sub1} from '../ob1';
const FORTY_TWO_0 = add0(42);
const FORTY_TWO_1 = add1(42);
export default {
testSafeOps() {
(add(FORTY_TWO_0, FORTY_TWO_0): Number0);
(add(FORTY_TWO_0, FORTY_TWO_1): Number1);
(add(FORTY_TWO_1, FORTY_TWO_0): Number1);
(sub(FORTY_TWO_1, FORTY_TWO_1): Number0);
(add(FORTY_TWO_0, 9000): Number0);
(add(FORTY_TWO_0, 9000): Number0);
(add(FORTY_TWO_1, 9000): Number1);
(sub(FORTY_TWO_1, 9000): Number1);
(get0(FORTY_TWO_0): number);
(get1(FORTY_TWO_1): number);
(neg(FORTY_TWO_0): Number0);
(add1(FORTY_TWO_0): Number1);
(sub1(FORTY_TWO_1): Number0);
(inc(FORTY_TWO_0): Number0);
(inc(FORTY_TWO_1): Number1);
},
testUnsafeOps() {
// $FlowExpectedError[incompatible-type] - adding two 1-based offsets.
add(FORTY_TWO_1, FORTY_TWO_1);
// $FlowExpectedError[incompatible-type] - subtracting 1-based offset from 0-based offset.
sub(FORTY_TWO_0, FORTY_TWO_1);
// $FlowExpectedError[unsafe-arithmetic] - direct computations with offsets are disallowed.
FORTY_TWO_0 - 1;
// $FlowExpectedError[unsafe-arithmetic] - direct computations with offsets are disallowed.
FORTY_TWO_1 - 1;
// $FlowExpectedError[incompatible-type] - extracting a 1-based offset as a 0-based number
get0(FORTY_TWO_1);
// $FlowExpectedError[incompatible-type] - extracting a 0-based offset as a 1-based number
get1(FORTY_TWO_0);
// $FlowExpectedError[incompatible-type] - negating a 1-based offset
neg(FORTY_TWO_1);
// $FlowExpectedError[incompatible-type] - adding 1 to an offset that's already 1-based
add1(FORTY_TWO_1);
// $FlowExpectedError[incompatible-type] - subtracting 1 from an offset that's already 0-based
sub1(FORTY_TWO_0);
// $FlowExpectedError[incompatible-type] - extracting an arbitrary number as a 0-based number
get0(42);
// $FlowExpectedError[incompatible-type] - extracting an arbitrary number as a 1-based number
get1(42);
},
};

21
node_modules/ob1/src/ob1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/**
* 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
* @oncall react_native
*/
export declare type Number0 = symbol & {__Number0__: string};
export declare type Number1 = symbol & {__Number1__: string};
export declare function add(a: number, b: number): number;
export declare function sub(a: number, b: number): number;
export declare function get0(x: number): number;
export declare function get1(x: number): number;
export declare function add1(x: Number0 | number): Number1;
export declare function sub1(x: Number1): Number0;
export declare function neg(x: Number0): Number0;
export declare function add0(x: number): Number0;
export declare function inc(x: number): number;

41
node_modules/ob1/src/ob1.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.add = add;
exports.add0 = add0;
exports.add1 = add1;
exports.get0 = get0;
exports.get1 = get1;
exports.inc = inc;
exports.neg = neg;
exports.sub = sub;
exports.sub1 = sub1;
function add(a, b) {
return a + b;
}
function sub(a, b) {
return a - b;
}
function get0(x) {
return x;
}
function get1(x) {
return x;
}
function add1(x) {
return x + 1;
}
function sub1(x) {
return x - 1;
}
function neg(x) {
return -x;
}
function add0(x) {
return x;
}
function inc(x) {
return x + 1;
}

86
node_modules/ob1/src/ob1.js.flow generated vendored Normal file
View File

@@ -0,0 +1,86 @@
/**
* 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 strict-local
* @format
* @oncall react_native
*/
/* eslint-disable no-redeclare */
// A type representing 0-based offsets.
export opaque type Number0 = number;
// A type representing 1-based offsets.
export opaque type Number1 = number;
// Add two offsets or numbers.
declare function add(a: Number1, b: number): Number1;
declare function add(a: number, b: Number1): Number1;
declare function add(a: Number0, b: number): Number0;
declare function add(a: number, b: Number0): Number0;
declare function add(a: Number1, b: Number0): Number1;
declare function add(a: Number0, b: Number1): Number1;
declare function add(a: Number0, b: Number0): Number0;
export function add(a: number, b: number): number {
return a + b;
}
// Subtract a number or 0-based offset from a 1/0-based offset.
declare function sub(a: Number1, b: number): Number1;
declare function sub(a: Number0, b: number): Number0;
declare function sub(a: number, b: Number0): Number0;
declare function sub(a: Number0, b: number): Number0;
declare function sub(a: Number1, b: Number0): Number1;
declare function sub(a: Number0, b: Number0): Number0;
declare function sub(a: Number1, b: Number1): Number0;
export function sub(a: number, b: number): number {
return a - b;
}
// Get the underlying number of a 0-based offset, casting away the opaque type.
declare function get0(x: Number0): number;
declare function get0(x: void | null): void | null;
export function get0(x: number): number {
return x;
}
// Get the underlying number of a 1-based offset, casting away the opaque type.
declare function get1(x: Number1): number;
declare function get1(x: void | null): void | null;
export function get1(x: number): number {
return x;
}
// Add 1 to a 0-based offset, thus converting it to 1-based.
export function add1(x: Number0 | number): Number1 {
return x + 1;
}
// Subtract 1 from a 1-based offset, thus converting it to 0-based.
export function sub1(x: Number1): Number0 {
return x - 1;
}
// Negate a 0-based offset.
export function neg(x: Number0): Number0 {
return -x;
}
// Cast a number to a 0-based offset.
export function add0(x: number): Number0 {
return x;
}
// Increment a 0-based offset.
declare function inc(a: Number0): Number0;
// Increment a 1-based offset.
declare function inc(a: Number1): Number1;
export function inc(x: number): number {
return x + 1;
}