Skip to content

Commit 0a74cbd

Browse files
authored
pref: rewrite slow code (#908)
1 parent 3c50532 commit 0a74cbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+468
-624
lines changed

examples/dual-react-dom-lib/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@examples/dual-react-dom-lib",
33
"version": "0.0.0",
44
"license": "MIT",
5+
"sideEffects": false,
56
"exports": {
67
".": {
78
"import": {
@@ -16,6 +17,7 @@
1617
"./package.json": "./package.json"
1718
},
1819
"main": "dist/index.js",
20+
"module": "dist/index.mjs",
1921
"types": "dist/index.d.ts",
2022
"files": [
2123
"dist",
@@ -46,10 +48,8 @@
4648
"peerDependencies": {
4749
"react": "^19.0.0"
4850
},
51+
"packageManager": "[email protected]",
4952
"engines": {
5053
"node": ">=18.18.0"
51-
},
52-
"sideEffects": false,
53-
"module": "dist/index.mjs",
54-
"packageManager": "[email protected]"
54+
}
5555
}

packages/core/docs/functions/isInitializedFromReact.md

Lines changed: 3 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -6,219 +6,22 @@
66

77
# Function: isInitializedFromReact()
88

9-
> **isInitializedFromReact**(`name`, `initialScope`, `settings`): `boolean`
10-
11-
Check if an identifier is initialized from React
9+
> **isInitializedFromReact**(`name`, `initialScope`, `importSource`): `boolean`
1210
1311
## Parameters
1412

1513
### name
1614

1715
`string`
1816

19-
The top-level identifier's name
20-
2117
### initialScope
2218

2319
`Scope`
2420

25-
Initial scope to search for the identifier
26-
27-
### settings
28-
29-
ESLint React settings
30-
31-
#### additionalComponents
32-
33-
`object`[]
34-
35-
An array of user-defined components
36-
37-
**Description**
38-
39-
This is used to inform the ESLint React plugins how to treat these components during checks.
40-
41-
**Example**
42-
43-
```ts
44-
`[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
45-
```
46-
47-
#### additionalHooks
48-
49-
\{ `use`: `string`[]; `useActionState`: `string`[]; `useCallback`: `string`[]; `useContext`: `string`[]; `useDebugValue`: `string`[]; `useDeferredValue`: `string`[]; `useEffect`: `string`[]; `useFormStatus`: `string`[]; `useId`: `string`[]; `useImperativeHandle`: `string`[]; `useInsertionEffect`: `string`[]; `useLayoutEffect`: `string`[]; `useMemo`: `string`[]; `useOptimistic`: `string`[]; `useReducer`: `string`[]; `useRef`: `string`[]; `useState`: `string`[]; `useSyncExternalStore`: `string`[]; `useTransition`: `string`[]; \}
50-
51-
A object of aliases for React built-in hooks.
52-
53-
**Description**
54-
55-
ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
56-
57-
**Example**
58-
59-
```ts
60-
`{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
61-
```
62-
63-
#### additionalHooks.use
64-
65-
`string`[]
66-
67-
#### additionalHooks.useActionState
68-
69-
`string`[]
70-
71-
#### additionalHooks.useCallback
72-
73-
`string`[]
74-
75-
#### additionalHooks.useContext
76-
77-
`string`[]
78-
79-
#### additionalHooks.useDebugValue
80-
81-
`string`[]
82-
83-
#### additionalHooks.useDeferredValue
84-
85-
`string`[]
86-
87-
#### additionalHooks.useEffect
88-
89-
`string`[]
90-
91-
#### additionalHooks.useFormStatus
92-
93-
`string`[]
94-
95-
#### additionalHooks.useId
96-
97-
`string`[]
98-
99-
#### additionalHooks.useImperativeHandle
100-
101-
`string`[]
102-
103-
#### additionalHooks.useInsertionEffect
104-
105-
`string`[]
106-
107-
#### additionalHooks.useLayoutEffect
108-
109-
`string`[]
110-
111-
#### additionalHooks.useMemo
112-
113-
`string`[]
114-
115-
#### additionalHooks.useOptimistic
116-
117-
`string`[]
118-
119-
#### additionalHooks.useReducer
120-
121-
`string`[]
122-
123-
#### additionalHooks.useRef
21+
### importSource
12422

125-
`string`[]
126-
127-
#### additionalHooks.useState
128-
129-
`string`[]
130-
131-
#### additionalHooks.useSyncExternalStore
132-
133-
`string`[]
134-
135-
#### additionalHooks.useTransition
136-
137-
`string`[]
138-
139-
#### importSource
140-
141-
`string`
142-
143-
The source where React is imported from.
144-
145-
**Description**
146-
147-
This allows to specify a custom import location for React when not using the official distribution.
148-
149-
**Default**
150-
151-
`"react"`
152-
153-
**Example**
154-
155-
```ts
156-
`"@pika/react"`
157-
```
158-
159-
#### jsxPragma
160-
161-
`string`
162-
163-
The identifier that’s used for JSX Element creation.
164-
165-
**Default**
166-
167-
`"createElement"`
168-
169-
**Deprecated**
170-
171-
#### jsxPragmaFrag
172-
173-
`string`
174-
175-
The identifier that’s used for JSX fragment elements.
176-
177-
**Description**
178-
179-
This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
180-
181-
**Default**
182-
183-
`"Fragment"`
184-
185-
**Deprecated**
186-
187-
#### polymorphicPropName
188-
189-
`string`
190-
191-
The name of the prop that is used for polymorphic components.
192-
193-
**Description**
194-
195-
This is used to determine the type of the component.
196-
197-
**Example**
198-
199-
```ts
200-
`"as"`
201-
```
202-
203-
#### version
204-
205-
`string`
206-
207-
React version to use, "detect" means auto detect React version from the project’s dependencies.
208-
If `importSource` is specified, an equivalent version of React should be provided here.
209-
210-
**Example**
211-
212-
```ts
213-
`"18.3.1"`
214-
```
215-
216-
**Default**
217-
218-
`"detect"`
23+
`string` = `"react"`
21924

22025
## Returns
22126

22227
`boolean`
223-
224-
Whether the identifier is initialized from React

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"license": "MIT",
1515
"author": "Eva1ent<[email protected]>",
16+
"sideEffects": false,
1617
"exports": {
1718
".": {
1819
"import": {
@@ -27,6 +28,7 @@
2728
"./package.json": "./package.json"
2829
},
2930
"main": "dist/index.js",
31+
"module": "dist/index.mjs",
3032
"types": "dist/index.d.ts",
3133
"files": [
3234
"dist",
@@ -59,7 +61,5 @@
5961
"engines": {
6062
"bun": ">=1.0.15",
6163
"node": ">=18.18.0"
62-
},
63-
"sideEffects": false,
64-
"module": "dist/index.mjs"
64+
}
6565
}

0 commit comments

Comments
 (0)