chore: prepare repo for types
This commit is contained in:
parent
c4371ed566
commit
7f45f1986d
10 changed files with 719 additions and 87 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@ package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
.DS_Store
|
.DS_Store
|
||||||
lib-dist/
|
lib-dist/
|
||||||
|
/packages/types
|
||||||
19
package.json
19
package.json
|
|
@ -13,14 +13,9 @@
|
||||||
},
|
},
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@shopify/react-native-skia": "^1.3.8",
|
|
||||||
"@swc/core": "^1.7.0",
|
"@swc/core": "^1.7.0",
|
||||||
"@swc/helpers": "^0.5.12",
|
"@swc/helpers": "^0.5.12",
|
||||||
"@types/chroma-js": "~2.4.4",
|
|
||||||
"@types/lodash": "~4.17.7",
|
|
||||||
"@types/node": "^20.14.11",
|
"@types/node": "^20.14.11",
|
||||||
"@types/react": "~18.2.79",
|
|
||||||
"@types/react-native": "~0.72.8",
|
|
||||||
"@types/yargs-parser": "^21.0.3",
|
"@types/yargs-parser": "^21.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
||||||
"@typescript-eslint/parser": "^7.16.1",
|
"@typescript-eslint/parser": "^7.16.1",
|
||||||
|
|
@ -33,16 +28,22 @@
|
||||||
"eslint-plugin-react": "^7.35.0",
|
"eslint-plugin-react": "^7.35.0",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"eslint-plugin-unused-imports": "^3.2.0",
|
"eslint-plugin-unused-imports": "^3.2.0",
|
||||||
"intl-messageformat": "^10.5.14",
|
|
||||||
"moment": "2.22.2",
|
|
||||||
"type-fest": "^4.22.1",
|
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"yargs-parser": "^21.1.1"
|
"yargs-parser": "^21.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-toolkit": "^1.13.1",
|
"es-toolkit": "^1.13.1",
|
||||||
"fuzzysort": "^3.0.2",
|
"fuzzysort": "^3.0.2",
|
||||||
"spitroast": "^1.4.4"
|
"spitroast": "^1.4.4",
|
||||||
|
"@shopify/react-native-skia": "^1.3.8",
|
||||||
|
"@types/chroma-js": "~2.4.4",
|
||||||
|
"@types/lodash": "~4.17.7",
|
||||||
|
"@types/react": "18.2.60",
|
||||||
|
"@types/react-native": "0.72.3",
|
||||||
|
"intl-messageformat": "^10.5.14",
|
||||||
|
"moment": "2.22.2",
|
||||||
|
"react-native-reanimated": "^3.6.2",
|
||||||
|
"type-fest": "^4.22.1"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
|
|
|
||||||
755
pnpm-lock.yaml
generated
755
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
|
|
@ -5,7 +5,7 @@ declare global {
|
||||||
// ReactNative/Hermes globals
|
// ReactNative/Hermes globals
|
||||||
var globalEvalWithSourceUrl: (script: string, sourceURL: string) => any;
|
var globalEvalWithSourceUrl: (script: string, sourceURL: string) => any;
|
||||||
var nativePerformanceNow: typeof performance.now;
|
var nativePerformanceNow: typeof performance.now;
|
||||||
var nativeModuleProxy: Record<string, Record<string, any> | null>;
|
var nativeModuleProxy: Record<string, any>;
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ const {
|
||||||
instead: _instead
|
instead: _instead
|
||||||
} = require("spitroast");
|
} = require("spitroast");
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
export const _patcherDelaySymbol = Symbol.for("bunny.api.patcher.delay");
|
export const _patcherDelaySymbol = Symbol.for("bunny.api.patcher.delay");
|
||||||
|
|
||||||
type Unpatcher = () => boolean;
|
type Unpatcher = () => boolean;
|
||||||
|
|
@ -11,8 +12,8 @@ type DelayCallback = (callback: (target: any) => void) => unknown;
|
||||||
type Thenable = { then: typeof Promise.prototype.then };
|
type Thenable = { then: typeof Promise.prototype.then };
|
||||||
|
|
||||||
interface PatchFn<Callback> {
|
interface PatchFn<Callback> {
|
||||||
(func: string, parent: any, callback: Callback): Unpatcher;
|
(func: string, parent: any, callback: Callback, once?: boolean): Unpatcher;
|
||||||
await(func: string, parent: Promise<unknown>, callback: Callback): Unpatcher;
|
await(func: string, parent: Promise<unknown>, callback: Callback, once?: boolean): Unpatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BeforeFn = PatchFn<(args: any[]) => unknown | unknown[]>;
|
type BeforeFn = PatchFn<(args: any[]) => unknown | unknown[]>;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// eslint-disable-next-line import-alias/import-alias
|
import "../global.d.ts"; // eslint-disable-line import-alias/import-alias
|
||||||
import "../global.d.ts";
|
import "../modules.d.ts"; // eslint-disable-line import-alias/import-alias
|
||||||
|
|
||||||
export * as api from "./api";
|
export * as api from "./api";
|
||||||
export * as debug from "./debug";
|
export * as debug from "./debug";
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export const corePluginInstances = new Map<string, t.PluginInstanceInternal>();
|
||||||
|
|
||||||
export const registeredPlugins = new Map<string, t.BunnyPluginManifest>();
|
export const registeredPlugins = new Map<string, t.BunnyPluginManifest>();
|
||||||
export const pluginInstances = new Map<string, t.PluginInstanceInternal>();
|
export const pluginInstances = new Map<string, t.PluginInstanceInternal>();
|
||||||
export const apiObjects = new Map<string, any>();
|
export const apiObjects = new Map<string, ReturnType<typeof createBunnyPluginAPI>>();
|
||||||
|
|
||||||
export const pluginRepositories = createStorage<t.PluginRepoStorage>("plugins/repositories.json");
|
export const pluginRepositories = createStorage<t.PluginRepoStorage>("plugins/repositories.json");
|
||||||
export const pluginSettings = createStorage<t.PluginSettingsStorage>("plugins/settings.json");
|
export const pluginSettings = createStorage<t.PluginSettingsStorage>("plugins/settings.json");
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import { findExports } from "./finders";
|
||||||
import { metroModules, subscribeModule } from "./modules";
|
import { metroModules, subscribeModule } from "./modules";
|
||||||
import type { FilterFn, LazyModuleContext } from "./types";
|
import type { FilterFn, LazyModuleContext } from "./types";
|
||||||
|
|
||||||
export const _lazyContextSymbol = Symbol.for("bunny.metro.lazyContext");
|
const _lazyContextSymbol = Symbol.for("bunny.metro.lazyContext");
|
||||||
export const _lazyContexts = new WeakMap<any, LazyModuleContext>();
|
const _lazyContexts = new WeakMap<any, LazyModuleContext>();
|
||||||
|
|
||||||
function getIndexedFind<A extends unknown[]>(filter: FilterFn<A>) {
|
function getIndexedFind<A extends unknown[]>(filter: FilterFn<A>) {
|
||||||
const modulesMap = getMetroCache().findIndex[filter.uniq];
|
const modulesMap = getMetroCache().findIndex[filter.uniq];
|
||||||
|
|
|
||||||
2
src/modules.d.ts
vendored
2
src/modules.d.ts
vendored
|
|
@ -6,3 +6,5 @@ declare module "*.png" {
|
||||||
const str: string;
|
const str: string;
|
||||||
export default str;
|
export default str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from "bunny-build-info";
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
// Just to discourage from consuming the module directly
|
// Just to discourage from consuming the module directly
|
||||||
"spitroast": ["./shims/emptyModule"],
|
"spitroast": ["./shims/emptyModule"],
|
||||||
|
|
||||||
|
"bunny-build-info": ["./src/modules.d.ts"],
|
||||||
|
|
||||||
"@core/*": ["./src/core/*"],
|
"@core/*": ["./src/core/*"],
|
||||||
"@lib": ["./src/lib"],
|
"@lib": ["./src/lib"],
|
||||||
"@lib/*": ["./src/lib/*"],
|
"@lib/*": ["./src/lib/*"],
|
||||||
|
|
@ -21,10 +23,14 @@
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"noEmit": true,
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"target": "esnext"
|
"target": "esnext",
|
||||||
|
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"stripInternal": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue