Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: unified TS setup #831

Merged
merged 22 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"package.json": "json",
"*.json": "jsonc"
},
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
Expand Down Expand Up @@ -41,5 +43,6 @@
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome"
}
},
"typescript.tsdk": "node_modules/typescript/lib"
}
12 changes: 6 additions & 6 deletions apps/tester-app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ PODS:
- React-logger (= 0.76.3)
- React-perflogger (= 0.76.3)
- React-utils (= 0.76.3)
- ReactNativeHost (0.5.0):
- ReactNativeHost (0.5.2):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1556,7 +1556,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ReactTestApp-DevSupport (4.0.4):
- ReactTestApp-DevSupport (4.0.7):
- React-Core
- React-jsi
- ReactTestApp-Resources (1.0.0-dev)
Expand Down Expand Up @@ -1783,7 +1783,7 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host`)"
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host`)"
- ReactTestApp-DevSupport (from `../node_modules/react-native-test-app`)
- ReactTestApp-Resources (from `..`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
Expand Down Expand Up @@ -1926,7 +1926,7 @@ EXTERNAL SOURCES:
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeHost:
:path: "../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host"
:path: "../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host"
ReactTestApp-DevSupport:
:path: "../node_modules/react-native-test-app"
ReactTestApp-Resources:
Expand Down Expand Up @@ -2005,8 +2005,8 @@ SPEC CHECKSUMS:
React-utils: 2bcaf4f4dfe361344bce2fae428603d518488630
ReactCodegen: ae99a130606068ed40d1d9c0d5f25fda142a0647
ReactCommon: 89c87b343deacc8610b099ac764848f0ce937e3e
ReactNativeHost: a27bb5af1c4d73dd3e80cc7ce295407f414e0e8c
ReactTestApp-DevSupport: aa137b52b223ebecf49fd5569290759a6d0b5590
ReactNativeHost: 40da1d9878e16dd3b647d4c31e5afeb0ed84683d
ReactTestApp-DevSupport: 4aa6f6bc658a2577bcf896c63c411cb375b89d7d
ReactTestApp-Resources: 8d72c3deef156833760694a288ff334af4d427d7
RNCAsyncStorage: 3ad840f7b17b45ca7ebbbb0e80948564a9513315
RNReanimated: 1f9ef2dc2001866fe8da3f3ac78d683252e8872f
Expand Down
2 changes: 1 addition & 1 deletion apps/tester-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"http-server": "^14.1.1",
"react-native-test-app": "^4.0.7",
"terser-webpack-plugin": "^5.3.10",
"typescript": "^5.5.3",
"typescript": "^5.7.2",
"vitest": "^2.0.5",
"webpack": "^5.94.0"
}
Expand Down
12 changes: 6 additions & 6 deletions apps/tester-federation-v2/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ PODS:
- React-logger (= 0.76.3)
- React-perflogger (= 0.76.3)
- React-utils (= 0.76.3)
- ReactNativeHost (0.5.0):
- ReactNativeHost (0.5.2):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1622,7 +1622,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ReactTestApp-DevSupport (4.0.4):
- ReactTestApp-DevSupport (4.0.7):
- React-Core
- React-jsi
- RNScreens (3.35.0):
Expand Down Expand Up @@ -1743,7 +1743,7 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host`)"
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host`)"
- ReactTestApp-DevSupport (from `../node_modules/react-native-test-app`)
- RNScreens (from `../node_modules/react-native-screens`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
Expand Down Expand Up @@ -1885,7 +1885,7 @@ EXTERNAL SOURCES:
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeHost:
:path: "../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host"
:path: "../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host"
ReactTestApp-DevSupport:
:path: "../node_modules/react-native-test-app"
RNScreens:
Expand Down Expand Up @@ -1959,8 +1959,8 @@ SPEC CHECKSUMS:
React-utils: 2bcaf4f4dfe361344bce2fae428603d518488630
ReactCodegen: ae99a130606068ed40d1d9c0d5f25fda142a0647
ReactCommon: 89c87b343deacc8610b099ac764848f0ce937e3e
ReactNativeHost: 3aa90998ab38ddbcfd0075b88d1062d1488cf749
ReactTestApp-DevSupport: aa137b52b223ebecf49fd5569290759a6d0b5590
ReactNativeHost: ac28612b0443705f9aa90563ffb9647f5608613c
ReactTestApp-DevSupport: 4aa6f6bc658a2577bcf896c63c411cb375b89d7d
RNScreens: e389d6a6a66a4f0d3662924ecae803073ccce8ec
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
SwiftyRSA: 8c6dd1ea7db1b8dc4fb517a202f88bb1354bc2c6
Expand Down
2 changes: 1 addition & 1 deletion apps/tester-federation-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"http-server": "^14.1.1",
"react-native-test-app": "^4.0.7",
"terser-webpack-plugin": "^5.3.3",
"typescript": "^5.5.3",
"typescript": "^5.7.2",
"webpack": "^5.91.0"
}
}
12 changes: 6 additions & 6 deletions apps/tester-federation/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ PODS:
- React-logger (= 0.76.3)
- React-perflogger (= 0.76.3)
- React-utils (= 0.76.3)
- ReactNativeHost (0.5.0):
- ReactNativeHost (0.5.2):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1622,7 +1622,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ReactTestApp-DevSupport (4.0.4):
- ReactTestApp-DevSupport (4.0.7):
- React-Core
- React-jsi
- RNCAsyncStorage (1.24.0):
Expand Down Expand Up @@ -1764,7 +1764,7 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host`)"
- "ReactNativeHost (from `../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host`)"
- ReactTestApp-DevSupport (from `../node_modules/react-native-test-app`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNScreens (from `../node_modules/react-native-screens`)
Expand Down Expand Up @@ -1907,7 +1907,7 @@ EXTERNAL SOURCES:
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeHost:
:path: "../../../node_modules/.pnpm/[email protected].4_react[email protected]_@[email protected]_@[email protected]_@_5qr4uzjupfedleyuhhntdk3ovq/node_modules/@rnx-kit/react-native-host"
:path: "../../../node_modules/.pnpm/[email protected].7_react[email protected]_@[email protected]_@[email protected]_@_kcvmkmgigxx2fblhu2xcq3h4qu/node_modules/@rnx-kit/react-native-host"
ReactTestApp-DevSupport:
:path: "../node_modules/react-native-test-app"
RNCAsyncStorage:
Expand Down Expand Up @@ -1983,8 +1983,8 @@ SPEC CHECKSUMS:
React-utils: 2bcaf4f4dfe361344bce2fae428603d518488630
ReactCodegen: ae99a130606068ed40d1d9c0d5f25fda142a0647
ReactCommon: 89c87b343deacc8610b099ac764848f0ce937e3e
ReactNativeHost: 3aa90998ab38ddbcfd0075b88d1062d1488cf749
ReactTestApp-DevSupport: aa137b52b223ebecf49fd5569290759a6d0b5590
ReactNativeHost: ac28612b0443705f9aa90563ffb9647f5608613c
ReactTestApp-DevSupport: 4aa6f6bc658a2577bcf896c63c411cb375b89d7d
RNCAsyncStorage: 3ad840f7b17b45ca7ebbbb0e80948564a9513315
RNScreens: e389d6a6a66a4f0d3662924ecae803073ccce8ec
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Expand Down
2 changes: 1 addition & 1 deletion apps/tester-federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
"globby": "^13.1.2",
"http-server": "^14.1.1",
"react-native-test-app": "^4.0.7",
"typescript": "^5.5.3"
"typescript": "^5.7.2"
}
}
20 changes: 20 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,26 @@
}
},
"overrides": [
{
"include": ["packages/**/*"],
"linter": {
"rules": {
"correctness": {
"useImportExtensions": {
"level": "error",
"options": {
"suggestedExtensions": {
"ts": {
"module": "js",
"component": "js"
}
}
}
}
}
}
}
},
{
"include": ["**/*.d.ts"],
"linter": { "rules": { "style": { "noVar": "off" } } }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"husky": "^9.1.6",
"is-in-ci": "^1.0.0",
"nx": "19.7.3",
"typescript": "^5.5.3"
"typescript": "^5.7.2"
},
"packageManager": "[email protected]"
}
15 changes: 0 additions & 15 deletions packages/dev-server/babel.config.cjs

This file was deleted.

8 changes: 3 additions & 5 deletions packages/dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
".": "./dist/index.js",
"./package.json": "./package.json"
},
"files": ["dist", "docs", "vendor", "CHANGELOG.md"],
"files": ["dist", "static"],
"homepage": "https://github.com/callstack/repack",
"repository": "github:callstack/repack",
"keywords": ["react-native", "repack", "re.pack", "server", "dev-server"],
Expand All @@ -23,9 +23,7 @@
"access": "public"
},
"scripts": {
"build:js": "babel src --out-dir dist --extensions \".js,.cjs,.ts\" --source-maps --ignore \"**/__tests__/**\" --delete-dir-on-start --copy-files",
"build:ts": "tsc --emitDeclarationOnly",
"build": "pnpm run \"/^build:.*/\"",
"build": "tsc -b",
"typecheck": "tsc --noEmit",
"archive": "pnpm build && pnpm pack"
},
Expand All @@ -49,7 +47,7 @@
"@types/node": "18",
"@types/ws": "^8.5.3",
"babel-plugin-add-import-extension": "^1.6.0",
"typescript": "^5.5.3"
"typescript": "^5.7.2"
},
"peerDependencies": {
"@react-native-community/cli-server-api": ">=13.6.4"
Expand Down
16 changes: 8 additions & 8 deletions packages/dev-server/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import middie from '@fastify/middie';
import fastifySensible from '@fastify/sensible';
import { createDevMiddleware } from '@react-native/dev-middleware';
import Fastify from 'fastify';
import apiPlugin from './plugins/api';
import compilerPlugin from './plugins/compiler';
import devtoolsPlugin from './plugins/devtools';
import faviconPlugin from './plugins/favicon';
import multipartPlugin from './plugins/multipart';
import symbolicatePlugin from './plugins/symbolicate';
import wssPlugin from './plugins/wss';
import { Internal, type Server } from './types';
import apiPlugin from './plugins/api/apiPlugin.js';
import compilerPlugin from './plugins/compiler/compilerPlugin.js';
import devtoolsPlugin from './plugins/devtools/devtoolsPlugin.js';
import faviconPlugin from './plugins/favicon/faviconPlugin.js';
import multipartPlugin from './plugins/multipart/multipartPlugin.js';
import symbolicatePlugin from './plugins/symbolicate/sybmolicatePlugin.js';
import wssPlugin from './plugins/wss/wssPlugin.js';
import { Internal, type Server } from './types.js';

/**
* Create instance of development server, powered by Fastify.
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './createServer';
export * from './types';
export * from './createServer.js';
export * from './types.js';
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/api/apiPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FastifyInstance } from 'fastify';
import type { Server } from '../../types';
import type { Server } from '../../types.js';

const paramsSchema = {
type: 'object',
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/api/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './apiPlugin';
export { default } from './apiPlugin.js';
4 changes: 2 additions & 2 deletions packages/dev-server/src/plugins/compiler/compilerPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FastifyInstance } from 'fastify';
import fastifyPlugin from 'fastify-plugin';
import type { Server } from '../../types';
import type { SendProgress } from '../../types';
import type { Server } from '../../types.js';
import type { SendProgress } from '../../types.js';

async function compilerPlugin(
instance: FastifyInstance,
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-server/src/plugins/compiler/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './compilerPlugin';
export * from './types';
export { default } from './compilerPlugin.js';
export * from './types.js';
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/compiler/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SendProgress } from '../../types';
import type { SendProgress } from '../../types.js';

/**
* Delegate with implementation for compiler-specific functions.
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/devtools/devtoolsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '@react-native-community/cli-server-api';
import type { FastifyInstance } from 'fastify';
import fastifyPlugin from 'fastify-plugin';
import type { Server } from '../../types';
import type { Server } from '../../types.js';

async function devtoolsPlugin(
instance: FastifyInstance,
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/devtools/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './devtoolsPlugin';
export { default } from './devtoolsPlugin.js';
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/favicon/faviconPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fastifyPlugin from 'fastify-plugin';

// @ts-ignore
const dirname = path.dirname(fileURLToPath(import.meta.url));
const pathToImgDir = path.join(dirname, '../../img');
const pathToImgDir = path.join(dirname, '../../../static');

async function faviconPlugin(instance: FastifyInstance) {
instance.register(fastifyFavicon, { path: pathToImgDir });
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/favicon/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './faviconPlugin';
export { default } from './faviconPlugin.js';
4 changes: 2 additions & 2 deletions packages/dev-server/src/plugins/multipart/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './multipartPlugin';
export * from './types';
export { default } from './multipartPlugin.js';
export * from './types.js';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IncomingHttpHeaders } from 'node:http';
import { PassThrough } from 'node:stream';
import type { FastifyInstance, FastifyReply } from 'fastify';
import fastifyPlugin from 'fastify-plugin';
import type { MultipartHandler } from './types';
import type { MultipartHandler } from './types.js';

/**
* Implementation is based on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
StackFrame,
SymbolicatorDelegate,
SymbolicatorResults,
} from './types';
} from './types.js';

/**
* Class for transforming stack traces from React Native application with using Source Map.
Expand Down
6 changes: 3 additions & 3 deletions packages/dev-server/src/plugins/symbolicate/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { default } from './sybmolicatePlugin';
export * from './Symbolicator';
export * from './types';
export { default } from './sybmolicatePlugin.js';
export * from './Symbolicator.js';
export * from './types.js';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { FastifyInstance } from 'fastify';
import fastifyPlugin from 'fastify-plugin';
import type { Server } from '../../types';
import { Symbolicator } from './Symbolicator';
import type { ReactNativeStackFrame } from './types';
import type { Server } from '../../types.js';
import { Symbolicator } from './Symbolicator.js';
import type { ReactNativeStackFrame } from './types.js';

async function symbolicatePlugin(
instance: FastifyInstance,
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/plugins/wss/WebSocketRouter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IncomingMessage } from 'node:http';
import type { Socket } from 'node:net';
import type { FastifyInstance } from 'fastify';
import type { WebSocketServerInterface } from './types';
import type { WebSocketServerInterface } from './types.js';

/**
* Class for creating a WebSocket router to forward connections to the
Expand Down
Loading
Loading