@lynx-js/react 0.108.1 → 0.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.json +2 -2
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/jsx-dev-runtime/index.d.ts +13 -7
- package/runtime/jsx-runtime/index.d.ts +17 -7
- package/runtime/lib/gesture/processGesture.d.ts +2 -2
- package/runtime/lib/gesture/processGesture.js +14 -7
- package/runtime/lib/gesture/processGesture.js.map +1 -1
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js +2 -2
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/gesture.d.ts +1 -1
- package/runtime/lib/snapshot/gesture.js +4 -3
- package/runtime/lib/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/workletEvent.d.ts +1 -1
- package/runtime/lib/snapshot/workletEvent.js +3 -2
- package/runtime/lib/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/workletRef.js +4 -4
- package/runtime/lib/snapshot/workletRef.js.map +1 -1
- package/runtime/lib/snapshot.d.ts +1 -0
- package/runtime/lib/snapshot.js +5 -4
- package/runtime/lib/snapshot.js.map +1 -1
- package/runtime/lib/worklet/runOnBackground.js +21 -12
- package/runtime/lib/worklet/runOnBackground.js.map +1 -1
- package/runtime/src/gesture/processGesture.ts +23 -15
- package/runtime/src/lifecycle/patch/snapshotPatchApply.ts +8 -2
- package/runtime/src/snapshot/gesture.ts +6 -4
- package/runtime/src/snapshot/workletEvent.ts +3 -2
- package/runtime/src/snapshot/workletRef.ts +5 -5
- package/runtime/src/snapshot.ts +6 -4
- package/runtime/src/worklet/runOnBackground.ts +37 -15
- package/testing-library/dist/vitest-global-setup.js +7 -0
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +443 -14
- package/types/react.d.ts +1 -1
- package/worklet-runtime/dist/dev.js +137 -49
- package/worklet-runtime/dist/dev.js.map +4 -4
- package/worklet-runtime/dist/main.js +137 -49
- package/worklet-runtime/dist/main.js.map +4 -4
- package/worklet-runtime/lib/api/element.d.ts +3 -3
- package/worklet-runtime/lib/api/element.js +3 -3
- package/worklet-runtime/lib/api/element.js.map +1 -1
- package/worklet-runtime/lib/api/lepusQuerySelector.js +1 -3
- package/worklet-runtime/lib/api/lepusQuerySelector.js.map +1 -1
- package/worklet-runtime/lib/api/lynxApi.js +10 -10
- package/worklet-runtime/lib/api/lynxApi.js.map +1 -1
- package/worklet-runtime/lib/bindings/bindings.d.ts +1 -1
- package/worklet-runtime/lib/bindings/bindings.js +20 -7
- package/worklet-runtime/lib/bindings/bindings.js.map +1 -1
- package/worklet-runtime/lib/bindings/events.d.ts +4 -1
- package/worklet-runtime/lib/bindings/events.js.map +1 -1
- package/worklet-runtime/lib/bindings/index.d.ts +1 -1
- package/worklet-runtime/lib/bindings/index.js +1 -1
- package/worklet-runtime/lib/bindings/index.js.map +1 -1
- package/worklet-runtime/lib/bindings/loadRuntime.js +0 -2
- package/worklet-runtime/lib/bindings/loadRuntime.js.map +1 -1
- package/worklet-runtime/lib/bindings/types.d.ts +8 -2
- package/worklet-runtime/lib/delayRunOnBackground.d.ts +12 -0
- package/worklet-runtime/lib/delayRunOnBackground.js +23 -0
- package/worklet-runtime/lib/delayRunOnBackground.js.map +1 -0
- package/worklet-runtime/lib/delayWorkletEvent.js +2 -2
- package/worklet-runtime/lib/delayWorkletEvent.js.map +1 -1
- package/worklet-runtime/lib/global.d.ts +6 -3
- package/worklet-runtime/lib/hydrate.d.ts +11 -0
- package/worklet-runtime/lib/hydrate.js +86 -0
- package/worklet-runtime/lib/hydrate.js.map +1 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.js +2 -2
- package/worklet-runtime/lib/jsFunctionLifecycle.js.map +1 -1
- package/worklet-runtime/lib/listeners.js.map +1 -1
- package/worklet-runtime/lib/utils/profile.d.ts +1 -1
- package/worklet-runtime/lib/utils/version.js +1 -1
- package/worklet-runtime/lib/workletRef.d.ts +6 -3
- package/worklet-runtime/lib/workletRef.js +33 -6
- package/worklet-runtime/lib/workletRef.js.map +1 -1
- package/worklet-runtime/lib/workletRuntime.js +13 -18
- package/worklet-runtime/lib/workletRuntime.js.map +1 -1
- package/worklet-runtime/lib/ctxTrace.d.ts +0 -8
- package/worklet-runtime/lib/ctxTrace.js +0 -13
- package/worklet-runtime/lib/ctxTrace.js.map +0 -1
package/transform/index.d.ts
CHANGED
|
@@ -45,41 +45,314 @@ export interface PartialLocation {
|
|
|
45
45
|
suggestion?: string
|
|
46
46
|
}
|
|
47
47
|
export interface DarkModeConfig {
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
* Theme expression to be used for dark mode
|
|
51
|
+
*/
|
|
49
52
|
themeExpr: string
|
|
50
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* {@inheritdoc CompatVisitorConfig.addComponentElement}
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
51
58
|
export interface AddComponentElementConfig {
|
|
52
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
* Whether to only add component element during compilation
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
*
|
|
65
|
+
* Note that this only take effects on `Component` imported from {@link CompatVisitorConfig.oldRuntimePkg}.
|
|
66
|
+
*
|
|
67
|
+
* ```js
|
|
68
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
69
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
70
|
+
*
|
|
71
|
+
* export default defineConfig({
|
|
72
|
+
* plugins: [
|
|
73
|
+
* pluginReactLynx({
|
|
74
|
+
* compat: {
|
|
75
|
+
* addComponentElement: { compilerOnly: true }
|
|
76
|
+
* },
|
|
77
|
+
* })
|
|
78
|
+
* ],
|
|
79
|
+
* })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
53
82
|
compilerOnly: boolean
|
|
54
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* {@inheritdoc PluginReactLynxOptions.compat}
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
55
88
|
export interface CompatVisitorConfig {
|
|
56
89
|
/** @internal */
|
|
57
90
|
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
58
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* @public
|
|
93
|
+
* Specifies the list of component package names that need compatibility processing
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* Default value: `['@lynx-js/react-components']`
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
*
|
|
100
|
+
* ```js
|
|
101
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
102
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
103
|
+
*
|
|
104
|
+
* export default defineConfig({
|
|
105
|
+
* plugins: [
|
|
106
|
+
* pluginReactLynx({
|
|
107
|
+
* compat: {
|
|
108
|
+
* componentsPkg: ['@my-org/components', '@legacy/ui-kit']
|
|
109
|
+
* },
|
|
110
|
+
* })
|
|
111
|
+
* ],
|
|
112
|
+
* })
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
59
115
|
componentsPkg: Array<string>
|
|
60
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* @public
|
|
118
|
+
* Specifies the list of old runtime package names that need compatibility processing
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* Default value: `['@lynx-js/react-runtime']`
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
*
|
|
125
|
+
* ```js
|
|
126
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
127
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
128
|
+
*
|
|
129
|
+
* export default defineConfig({
|
|
130
|
+
* plugins: [
|
|
131
|
+
* pluginReactLynx({
|
|
132
|
+
* compat: {
|
|
133
|
+
* oldRuntimePkg: ['@my-org/runtime', '@legacy/runtime']
|
|
134
|
+
* },
|
|
135
|
+
* })
|
|
136
|
+
* ],
|
|
137
|
+
* })
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
61
140
|
oldRuntimePkg: Array<string>
|
|
62
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* @public
|
|
143
|
+
* Specifies the new runtime package name
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Default value: `'@lynx-js/react'`
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
*
|
|
150
|
+
* ```js
|
|
151
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
152
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
153
|
+
*
|
|
154
|
+
* export default defineConfig({
|
|
155
|
+
* plugins: [
|
|
156
|
+
* pluginReactLynx({
|
|
157
|
+
* compat: {
|
|
158
|
+
* newRuntimePkg: '@my-org/react'
|
|
159
|
+
* },
|
|
160
|
+
* })
|
|
161
|
+
* ],
|
|
162
|
+
* })
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
63
165
|
newRuntimePkg: string
|
|
64
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* @public
|
|
168
|
+
* Specifies additional component attributes list, these attributes will be passed to the wrapped `<view>` instead of the component.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* This only takes effect when {@link CompatVisitorConfig.addComponentElement} is enabled.
|
|
172
|
+
*
|
|
173
|
+
* Default value: `[]`
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
*
|
|
177
|
+
* ```js
|
|
178
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
179
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
180
|
+
*
|
|
181
|
+
* export default defineConfig({
|
|
182
|
+
* plugins: [
|
|
183
|
+
* pluginReactLynx({
|
|
184
|
+
* compat: {
|
|
185
|
+
* additionalComponentAttributes: ['custom-attr', 'data-special']
|
|
186
|
+
* },
|
|
187
|
+
* })
|
|
188
|
+
* ],
|
|
189
|
+
* })
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
65
192
|
additionalComponentAttributes: Array<string>
|
|
66
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* @public
|
|
195
|
+
* Controls whether to add wrapper elements for components
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* Default value: `false`
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
*
|
|
202
|
+
* Add a `<view>` wrapper element for all components during runtime.
|
|
203
|
+
*
|
|
204
|
+
* ```js
|
|
205
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
206
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
207
|
+
*
|
|
208
|
+
* export default defineConfig({
|
|
209
|
+
* plugins: [
|
|
210
|
+
* pluginReactLynx({
|
|
211
|
+
* compat: {
|
|
212
|
+
* addComponentElement: true
|
|
213
|
+
* },
|
|
214
|
+
* })
|
|
215
|
+
* ],
|
|
216
|
+
* })
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
*
|
|
221
|
+
* Only add component element during compilation.
|
|
222
|
+
* Note that this only take effects on `Component` imported from {@link CompatVisitorConfig.oldRuntimePkg}.
|
|
223
|
+
*
|
|
224
|
+
* ```js
|
|
225
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
226
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
227
|
+
*
|
|
228
|
+
* export default defineConfig({
|
|
229
|
+
* plugins: [
|
|
230
|
+
* pluginReactLynx({
|
|
231
|
+
* compat: {
|
|
232
|
+
* addComponentElement: { compilerOnly: true }
|
|
233
|
+
* },
|
|
234
|
+
* })
|
|
235
|
+
* ],
|
|
236
|
+
* })
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
67
239
|
addComponentElement: boolean | AddComponentElementConfig
|
|
68
240
|
/**
|
|
69
241
|
* @public
|
|
242
|
+
* Whether to simplify constructor calls like ReactLynx 2
|
|
243
|
+
*
|
|
70
244
|
* @deprecated
|
|
245
|
+
* Using `simplifyCtorLikeReactLynx2` is not recommended as it introduces implicit behaviors that can:
|
|
246
|
+
*
|
|
247
|
+
* - Make code harder to understand and maintain
|
|
248
|
+
*
|
|
249
|
+
* - Create hidden dependencies between components
|
|
250
|
+
*
|
|
251
|
+
* - Complicate debugging and testing processes
|
|
252
|
+
*
|
|
253
|
+
* Instead, use `background-only` on class methods for explicit and maintainable behavior
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* Default value: `false`
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
*
|
|
260
|
+
* ```js
|
|
261
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
262
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
263
|
+
*
|
|
264
|
+
* export default defineConfig({
|
|
265
|
+
* plugins: [
|
|
266
|
+
* pluginReactLynx({
|
|
267
|
+
* compat: {
|
|
268
|
+
* simplifyCtorLikeReactLynx2: true
|
|
269
|
+
* },
|
|
270
|
+
* })
|
|
271
|
+
* ],
|
|
272
|
+
* })
|
|
273
|
+
* ```
|
|
71
274
|
*/
|
|
72
275
|
simplifyCtorLikeReactLynx2: boolean
|
|
73
276
|
/**
|
|
74
277
|
* @public
|
|
75
|
-
*
|
|
278
|
+
* Regular expression used to remove component attributes
|
|
279
|
+
*
|
|
280
|
+
* @deprecated It's recommended to use `background-only`.
|
|
281
|
+
*
|
|
282
|
+
* If your code depends on this switch, when distributing it to other projects through npm packages or other means, you'll also need to enable this switch. This will lead to the proliferation of switches, which is not conducive to code reuse between different projects.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Default value: `None`
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
*
|
|
289
|
+
* ```js
|
|
290
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
291
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
292
|
+
*
|
|
293
|
+
* export default defineConfig({
|
|
294
|
+
* plugins: [
|
|
295
|
+
* pluginReactLynx({
|
|
296
|
+
* compat: {
|
|
297
|
+
* removeComponentAttrRegex: '^data-test-'
|
|
298
|
+
* },
|
|
299
|
+
* })
|
|
300
|
+
* ],
|
|
301
|
+
* })
|
|
302
|
+
* ```
|
|
76
303
|
*/
|
|
77
304
|
removeComponentAttrRegex?: string
|
|
78
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* @public
|
|
307
|
+
* Whether to disable deprecated warnings
|
|
308
|
+
*
|
|
309
|
+
* @remarks
|
|
310
|
+
* Default value: `false`
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
*
|
|
314
|
+
* Disable all the `DEPRECATED:` warnings.
|
|
315
|
+
*
|
|
316
|
+
* ```js
|
|
317
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
318
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
319
|
+
*
|
|
320
|
+
* export default defineConfig({
|
|
321
|
+
* plugins: [
|
|
322
|
+
* pluginReactLynx({
|
|
323
|
+
* compat: {
|
|
324
|
+
* disableDeprecatedWarning: true
|
|
325
|
+
* },
|
|
326
|
+
* })
|
|
327
|
+
* ],
|
|
328
|
+
* })
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
79
331
|
disableDeprecatedWarning: boolean
|
|
80
332
|
/**
|
|
81
333
|
* @public
|
|
82
334
|
* @deprecated
|
|
335
|
+
* Dark mode configuration
|
|
336
|
+
*
|
|
337
|
+
* @remarks
|
|
338
|
+
* Default value: `None`
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
*
|
|
342
|
+
* ```js
|
|
343
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
344
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
345
|
+
*
|
|
346
|
+
* export default defineConfig({
|
|
347
|
+
* plugins: [
|
|
348
|
+
* pluginReactLynx({
|
|
349
|
+
* compat: {
|
|
350
|
+
* darkMode: true
|
|
351
|
+
* },
|
|
352
|
+
* })
|
|
353
|
+
* ],
|
|
354
|
+
* })
|
|
355
|
+
* ```
|
|
83
356
|
*/
|
|
84
357
|
darkMode?: boolean | DarkModeConfig
|
|
85
358
|
}
|
|
@@ -89,8 +362,57 @@ export interface CssScopeVisitorConfig {
|
|
|
89
362
|
/** @public */
|
|
90
363
|
filename: string
|
|
91
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* {@inheritdoc PluginReactLynxOptions.defineDCE}
|
|
367
|
+
* @public
|
|
368
|
+
*/
|
|
92
369
|
export interface DefineDceVisitorConfig {
|
|
93
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* @public
|
|
372
|
+
* Replaces variables in your code with other values or expressions at compile time.
|
|
373
|
+
*
|
|
374
|
+
* @remarks
|
|
375
|
+
* Caveat: differences between `source.define`
|
|
376
|
+
*
|
|
377
|
+
* `defineDCE` happens before transforming `background-only` directives.
|
|
378
|
+
* So it's useful for eliminating code that is only used in the background from main-thread.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
*
|
|
382
|
+
* ```js
|
|
383
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
384
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
385
|
+
*
|
|
386
|
+
* export default defineConfig({
|
|
387
|
+
* plugins: [
|
|
388
|
+
* pluginReactLynx({
|
|
389
|
+
* defineDCE: {
|
|
390
|
+
* define: {
|
|
391
|
+
* __FOO__: 'false',
|
|
392
|
+
* 'process.env.PLATFORM': '"lynx"',
|
|
393
|
+
* },
|
|
394
|
+
* },
|
|
395
|
+
* })
|
|
396
|
+
* ],
|
|
397
|
+
* })
|
|
398
|
+
* ```
|
|
399
|
+
*
|
|
400
|
+
* Then, `__FOO__` and `process.env.PLATFORM` could be used in source code.
|
|
401
|
+
*
|
|
402
|
+
* ```
|
|
403
|
+
* if (process.env.PLATFORM === 'lynx') {
|
|
404
|
+
* console.log('lynx')
|
|
405
|
+
* }
|
|
406
|
+
*
|
|
407
|
+
* function FooOrBar() {
|
|
408
|
+
* if (__FOO__) {
|
|
409
|
+
* return <text>foo</text>
|
|
410
|
+
* } else {
|
|
411
|
+
* return <text>bar</text>
|
|
412
|
+
* }
|
|
413
|
+
* }
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
94
416
|
define: Record<string, string>
|
|
95
417
|
}
|
|
96
418
|
export interface DirectiveDceVisitorConfig {
|
|
@@ -103,8 +425,35 @@ export interface DynamicImportVisitorConfig {
|
|
|
103
425
|
/** @internal */
|
|
104
426
|
layer: string
|
|
105
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* {@inheritdoc PluginReactLynxOptions.extractStr}
|
|
430
|
+
* @public
|
|
431
|
+
*/
|
|
106
432
|
export interface ExtractStrConfig {
|
|
107
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* @public
|
|
435
|
+
* The minimum length of string literals to be extracted.
|
|
436
|
+
*
|
|
437
|
+
* @remarks
|
|
438
|
+
* Default value: `20`.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
*
|
|
442
|
+
* ```js
|
|
443
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
444
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
445
|
+
*
|
|
446
|
+
* export default defineConfig({
|
|
447
|
+
* plugins: [
|
|
448
|
+
* pluginReactLynx({
|
|
449
|
+
* extractStr: {
|
|
450
|
+
* strLength: 10,
|
|
451
|
+
* },
|
|
452
|
+
* })
|
|
453
|
+
* ],
|
|
454
|
+
* })
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
108
457
|
strLength: number
|
|
109
458
|
/** @internal */
|
|
110
459
|
extractedStrArr?: Array<string>
|
|
@@ -115,18 +464,98 @@ export interface InjectVisitorConfig {
|
|
|
115
464
|
export interface RefreshVisitorConfig {
|
|
116
465
|
library?: Array<string>
|
|
117
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* {@inheritdoc PluginReactLynxOptions.shake}
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
118
471
|
export interface ShakeVisitorConfig {
|
|
119
|
-
/**
|
|
472
|
+
/**
|
|
473
|
+
* Package names to identify runtime imports that need to be processed
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```js
|
|
477
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
478
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
479
|
+
*
|
|
480
|
+
* export default defineConfig({
|
|
481
|
+
* plugins: [
|
|
482
|
+
* pluginReactLynx({
|
|
483
|
+
* shake: {
|
|
484
|
+
* pkgName: ['@lynx-js/react-runtime']
|
|
485
|
+
* }
|
|
486
|
+
* })
|
|
487
|
+
* ]
|
|
488
|
+
* })
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* @remarks
|
|
492
|
+
* Default value: `['@lynx-js/react-runtime']`
|
|
493
|
+
* The provided values will be merged with the default values instead of replacing them.
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
120
496
|
pkgName: Array<string>
|
|
121
|
-
/**
|
|
497
|
+
/**
|
|
498
|
+
* Properties that should be retained in the component class
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```js
|
|
502
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
503
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
504
|
+
*
|
|
505
|
+
* export default defineConfig({
|
|
506
|
+
* plugins: [
|
|
507
|
+
* pluginReactLynx({
|
|
508
|
+
* shake: {
|
|
509
|
+
* retainProp: ['myCustomMethod']
|
|
510
|
+
* }
|
|
511
|
+
* })
|
|
512
|
+
* ]
|
|
513
|
+
* })
|
|
514
|
+
* ```
|
|
515
|
+
*
|
|
516
|
+
* @remarks
|
|
517
|
+
* Default value: `['constructor', 'render', 'getDerivedStateFromProps', 'state', 'defaultDataProcessor', 'dataProcessors', 'contextType', 'defaultProps']`
|
|
518
|
+
* The provided values will be merged with the default values instead of replacing them.
|
|
519
|
+
*
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
122
522
|
retainProp: Array<string>
|
|
123
|
-
/**
|
|
523
|
+
/**
|
|
524
|
+
* Function names whose parameters should be removed during transformation
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```js
|
|
528
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
529
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
530
|
+
*
|
|
531
|
+
* export default defineConfig({
|
|
532
|
+
* plugins: [
|
|
533
|
+
* pluginReactLynx({
|
|
534
|
+
* shake: {
|
|
535
|
+
* removeCallParams: ['useMyCustomEffect']
|
|
536
|
+
* }
|
|
537
|
+
* })
|
|
538
|
+
* ]
|
|
539
|
+
* })
|
|
540
|
+
* ```
|
|
541
|
+
*
|
|
542
|
+
* @remarks
|
|
543
|
+
* Default value: `['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']`
|
|
544
|
+
* The provided values will be merged with the default values instead of replacing them.
|
|
545
|
+
*
|
|
546
|
+
* @public
|
|
547
|
+
*/
|
|
124
548
|
removeCallParams: Array<string>
|
|
125
549
|
}
|
|
550
|
+
/** @internal */
|
|
126
551
|
export interface JsxTransformerConfig {
|
|
552
|
+
/** @internal */
|
|
127
553
|
preserveJsx: boolean
|
|
554
|
+
/** @internal */
|
|
128
555
|
runtimePkg: string
|
|
556
|
+
/** @internal */
|
|
129
557
|
jsxImportSource?: string
|
|
558
|
+
/** @internal */
|
|
130
559
|
filename: string
|
|
131
560
|
/** @internal */
|
|
132
561
|
target: 'LEPUS' | 'JS' | 'MIXED'
|