From fdc3ac15e90abd72373c7bd91a9a85aa2e3fb6b7 Mon Sep 17 00:00:00 2001 From: Jonathan Tzeng Date: Fri, 12 Jun 2026 01:30:14 -0700 Subject: [PATCH] Remove flow-bin and Flow type-check leftovers flow-bin shipped an x86_64-only binary that failed with EBADARCH on arm64 hosts during prepare. TypeScript is the type system of record, so the flow type-check was dead weight. Removed the flow-bin devDependency, the root .flowconfig, and the trailing flow step from build.types. The make-types.ts generator and shipped types.js.flow artifact are kept for downstream Flow consumers. --- .eslintignore | 1 - .eslintrc.json | 1 - .flowconfig | 13 -------- .gitignore | 1 - CHANGELOG.md | 2 ++ README.md | 2 +- flow-typed/react-native-libs.js | 5 --- package-lock.json | 54 ++----------------------------- package.json | 5 --- rollup.config.js | 15 ++------- scripts/make-types.ts | 57 --------------------------------- 11 files changed, 7 insertions(+), 149 deletions(-) delete mode 100644 .flowconfig delete mode 100644 flow-typed/react-native-libs.js delete mode 100755 scripts/make-types.ts diff --git a/.eslintignore b/.eslintignore index 2247838a..87c76542 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ /android/src/main/assets/ /lib/ /types.js -/types.js.flow /types.mjs diff --git a/.eslintrc.json b/.eslintrc.json index 1adf8771..18b243e4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,6 @@ "standard-kit/prettier", "standard-kit/prettier/node", "standard-kit/prettier/jsx", - "standard-kit/prettier/flow", "standard-kit/prettier/typescript" ], "parserOptions": { diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index 425e3ad0..00000000 --- a/.flowconfig +++ /dev/null @@ -1,13 +0,0 @@ -[ignore] -.*/node_modules/resolve/.* -.*/node_modules/webpack-cli/.* - -[include] - -[libs] - -[lints] -sketchy-null=error - -[options] -esproposal.optional_chaining=enable diff --git a/.gitignore b/.gitignore index bece1091..29d3fd37 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ /android/src/main/assets/ /lib/ /types.js -/types.js.flow /types.mjs # Package managers: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3575bd3b..110fd276 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- removed: All Flow tooling. TypeScript is the type system of record, and nothing in the Edge codebase consumes the generated Flow types. This drops the `flow-bin` devDependency, the root `.flowconfig`, the `build.types` script and its `make-types.ts` generator, the `rollup-plugin-flow-entry` plugin, the `eslint-plugin-flowtype` config, the `flow-typed` directory, and the published `types.js.flow` artifact. The `flow-bin` package shipped an x86_64-only binary that failed with EBADARCH on arm64 hosts. Note: dropping `types.js.flow` is a breaking change for any downstream consumer that imports this package via Flow. + ## 2.45.0 (2026-06-12) - changed: Convert the build tooling from Yarn to npm. diff --git a/README.md b/README.md index 01bd6b95..45d48482 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library implements the Edge login system. It runs inside a client applicati ## Documentation -We have documentation at https://developer.airbitz.co/javascript/, but our [Flow types](./src/types/types.js) are the best, most up-to-date reference for what this library contains. +We have documentation at https://developer.airbitz.co/javascript/, but our [TypeScript types](./src/types/types.ts) are the best, most up-to-date reference for what this library contains. ## Account Management UI diff --git a/flow-typed/react-native-libs.js b/flow-typed/react-native-libs.js deleted file mode 100644 index f559966a..00000000 --- a/flow-typed/react-native-libs.js +++ /dev/null @@ -1,5 +0,0 @@ -// @flow - -declare module 'react-native' { - declare module.exports: any -} diff --git a/package-lock.json b/package-lock.json index dfa7b3ce..9696d892 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "edge-core-js", - "version": "2.44.0", + "version": "2.45.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "edge-core-js", - "version": "2.44.0", + "version": "2.45.0", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@nymproject/mix-fetch": "^1.4.4", @@ -58,14 +58,12 @@ "copy-webpack-plugin": "^13.0.1", "eslint": "^7.32.0", "eslint-config-standard-kit": "0.15.1", - "eslint-plugin-flowtype": "^5.2.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.20.6", "eslint-plugin-simple-import-sort": "^6.0.1", - "flow-bin": "^0.89.0", "husky": "^7.0.0", "lint-staged": "^10.2.11", "mocha": "^10.6.0", @@ -74,7 +72,6 @@ "process": "^0.11.10", "rimraf": "^3.0.2", "rollup": "^2.80.0", - "rollup-plugin-flow-entry": "^0.3.6", "rollup-plugin-mjs-entry": "^0.1.1", "stream-browserify": "^3.0.0", "sucrase": "^3.20.0", @@ -5169,22 +5166,6 @@ "eslint": ">=4.19.1" } }, - "node_modules/eslint-plugin-flowtype": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.2.0.tgz", - "integrity": "sha1-pL713Bj5sr20FWmkqwXXOAWj0mE= sha512-z7ULdTxuhlRJcEe1MVljePXricuPOrsWfScRXFhNzVD5dmTHWjIF57AxD0e7AbEoLSbjSsaA5S+hCg43WvpXJQ==", - "dev": true, - "dependencies": { - "lodash": "^4.17.15", - "string-natural-compare": "^3.0.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "peerDependencies": { - "eslint": "^7.1.0" - } - }, "node_modules/eslint-plugin-import": { "version": "2.25.3", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", @@ -5919,18 +5900,6 @@ "dev": true, "license": "ISC" }, - "node_modules/flow-bin": { - "version": "0.89.0", - "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.89.0.tgz", - "integrity": "sha1-a9KcKvfg9Cl5f4IGYvM3SRBcMvo= sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==", - "dev": true, - "bin": { - "flow": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/follow-redirects": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", @@ -7361,13 +7330,6 @@ "node": ">=4" } }, - "node_modules/lodash": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", - "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -9131,12 +9093,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/rollup-plugin-flow-entry": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/rollup-plugin-flow-entry/-/rollup-plugin-flow-entry-0.3.6.tgz", - "integrity": "sha1-MPbG4taTdmN5B4JCpuAdXOwfVek= sha512-/czSXbCDciVG/3kUrbc57ldpKsu234oTwc6r6O9+KgeGzfJCaqtShCfpJDsiix7ZQ48ISG6iPsMTjbUcL5hLbw==", - "dev": true - }, "node_modules/rollup-plugin-mjs-entry": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/rollup-plugin-mjs-entry/-/rollup-plugin-mjs-entry-0.1.1.tgz", @@ -9763,12 +9719,6 @@ "node": ">=0.6.19" } }, - "node_modules/string-natural-compare": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-3.0.1.tgz", - "integrity": "sha1-ekLVhHRFSWN1no6LeuY9ccHn/fQ= sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==", - "dev": true - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", diff --git a/package.json b/package.json index 0f30c61f..6b13b840 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "/README.md", "/src/types/", "/types.d.ts", - "/types.js.flow", "/types.js", "/types.mjs" ], @@ -62,7 +61,6 @@ "build.lib": "sucrase ./src -q -d ./lib -t typescript,jsx", "build.node": "rollup -c", "build.react-native": "webpack", - "build.types": "node -r sucrase/register ./scripts/make-types.ts && flow", "clean": "rimraf lib android/src/main/assets", "fix.android": "(cd android; ./format-java.sh)", "fix.ios": "swift-format format -i ios/*.swift", @@ -129,14 +127,12 @@ "copy-webpack-plugin": "^13.0.1", "eslint": "^7.32.0", "eslint-config-standard-kit": "0.15.1", - "eslint-plugin-flowtype": "^5.2.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.20.6", "eslint-plugin-simple-import-sort": "^6.0.1", - "flow-bin": "^0.89.0", "husky": "^7.0.0", "lint-staged": "^10.2.11", "mocha": "^10.6.0", @@ -145,7 +141,6 @@ "process": "^0.11.10", "rimraf": "^3.0.2", "rollup": "^2.80.0", - "rollup-plugin-flow-entry": "^0.3.6", "rollup-plugin-mjs-entry": "^0.1.1", "stream-browserify": "^3.0.0", "sucrase": "^3.20.0", diff --git a/rollup.config.js b/rollup.config.js index 252e2369..30379b76 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,6 +1,5 @@ import babel from '@rollup/plugin-babel' import resolve from '@rollup/plugin-node-resolve' -import flowEntry from 'rollup-plugin-flow-entry' import mjs from 'rollup-plugin-mjs-entry' import packageJson from './package.json' @@ -25,22 +24,12 @@ export default [ external, input: './src/index.ts', output: { file: packageJson.main, format: 'cjs' }, - plugins: [ - resolve(resolveOpts), - babel(babelOpts), - flowEntry({ types: './lib/flow/exports.js' }), - mjs() - ] + plugins: [resolve(resolveOpts), babel(babelOpts), mjs()] }, { external, input: './src/types/types.ts', output: { file: './types.js', format: 'cjs' }, - plugins: [ - resolve(resolveOpts), - babel(babelOpts), - flowEntry({ types: './lib/flow/types.js' }), - mjs() - ] + plugins: [resolve(resolveOpts), babel(babelOpts), mjs()] } ] diff --git a/scripts/make-types.ts b/scripts/make-types.ts deleted file mode 100755 index 22ccd3d6..00000000 --- a/scripts/make-types.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Run as `node -r sucrase/register scripts/make-types.ts` - -import { makeNodeDisklet } from 'disklet' -import prettier from 'prettier' - -async function tsToFlow(code: string): Promise { - // First, use Prettier to add semicolons everywhere: - const formatted = await prettier.format(code, { - parser: 'typescript', - semi: true - }) - - const fixed = formatted - // Language differences: - .replace(/\breadonly /g, '+') - .replace(/\bexport declare const\b/g, 'declare export var') - .replace(/\bexport declare\b/g, 'declare export') - .replace(/\binterface (\w+) {/g, 'type $1 = {') - .replace(/\binterface (\w+)<([^>]+)> {/g, 'type $1<$2> = {') - .replace( - /\binterface (\w+) extends (\w+) {/g, - 'type $1 = {\n ...$Exact<$2>;' - ) - .replace(/\bunknown\b/g, 'mixed') - .replace(/\| undefined\b/g, '| void') - .replace(/: undefined\b/g, ': void') - - // Builtin types: - .replace(/\b(\w+): ComponentType/g, '$Rest<$1, { ... }>') - .replace(/\bAsyncIterableIterator\b/g, 'AsyncGenerator') - - return '// @flow\n\n' + fixed -} - -async function main(): Promise { - const disklet = makeNodeDisklet('.') - const listing = await disklet.list('src/types') - const paths = Object.keys(listing).filter(name => listing[name] === 'file') - - // Transpile Flow types to Typescript: - for (const path of paths) { - const source = await disklet.getText(path) - - const flowPath = path - .replace('src/types/', 'lib/flow/') - .replace('.ts', '.js') - const flowSource = await tsToFlow(source) - - await disklet.setText(flowPath, flowSource) - } -} - -main().catch(error => { - console.error(error) - process.exit(1) -})