diff --git a/eslint.config.js b/eslint.config.js index 0549ff93fe..4c8b0c9301 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -438,22 +438,4 @@ export default tseslint.config( 'headers/header-format': 'off', }, }, - { - files: [ - 'packages/react/worklet-runtime/src/*.ts', - 'packages/react/worklet-runtime/src/*/*.ts', - 'packages/react/worklet-runtime/src/*/*/*.ts', - ], - languageOptions: { - parserOptions: { - project: './packages/react/worklet-runtime/tsconfig.eslint.json', - projectService: false, - tsconfigRootDir: import.meta.dirname, - }, - }, - rules: { - 'headers/header-format': 'off', - 'import/export': 'off', - }, - }, ); diff --git a/packages/react/worklet-runtime/__test__/api/element.test.js b/packages/react/worklet-runtime/__test__/api/element.test.js index 9151e11eab..ecfb85357e 100644 --- a/packages/react/worklet-runtime/__test__/api/element.test.js +++ b/packages/react/worklet-runtime/__test__/api/element.test.js @@ -3,9 +3,9 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { AnimationOperation } from '../../src/api/animation/animation'; -import { Element, setShouldFlush } from '../../src/api/element'; -import { initWorklet } from '../../src/workletRuntime'; +import { AnimationOperation } from '../../../runtime/src/worklet-runtime/api/animation/animation'; +import { Element, setShouldFlush } from '../../../runtime/src/worklet-runtime/api/element'; +import { initWorklet } from '../../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/delayWorkletEvent.test.js b/packages/react/worklet-runtime/__test__/delayWorkletEvent.test.js index ebb87faeac..9da14bcfd6 100644 --- a/packages/react/worklet-runtime/__test__/delayWorkletEvent.test.js +++ b/packages/react/worklet-runtime/__test__/delayWorkletEvent.test.js @@ -3,9 +3,13 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { clearDelayedWorklets, delayExecUntilJsReady, runDelayedWorklet } from '../src/delayWorkletEvent'; -import { updateWorkletRefInitValueChanges } from '../src/workletRef'; -import { initWorklet } from '../src/workletRuntime'; +import { + clearDelayedWorklets, + delayExecUntilJsReady, + runDelayedWorklet, +} from '../../runtime/src/worklet-runtime/delayWorkletEvent'; +import { updateWorkletRefInitValueChanges } from '../../runtime/src/worklet-runtime/workletRef'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/eventPropagation.test.js b/packages/react/worklet-runtime/__test__/eventPropagation.test.js index 23a6e507ff..91043731e0 100644 --- a/packages/react/worklet-runtime/__test__/eventPropagation.test.js +++ b/packages/react/worklet-runtime/__test__/eventPropagation.test.js @@ -3,9 +3,9 @@ // LICENSE file in the root directory of this source tree. import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { initApiEnv } from '../src/api/lynxApi'; -import { RunWorkletSource } from '../src/bindings/types'; -import { initWorklet } from '../src/workletRuntime'; +import { initApiEnv } from '../../runtime/src/worklet-runtime/api/lynxApi'; +import { RunWorkletSource } from '../../runtime/src/worklet-runtime/bindings/types'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; describe('EventPropagation', () => { const consoleMock = vi.spyOn(console, 'warn').mockImplementation(() => undefined); diff --git a/packages/react/worklet-runtime/__test__/jsFunctionLifecycle.test.js b/packages/react/worklet-runtime/__test__/jsFunctionLifecycle.test.js index d85f0a47f7..fbd1019fa2 100644 --- a/packages/react/worklet-runtime/__test__/jsFunctionLifecycle.test.js +++ b/packages/react/worklet-runtime/__test__/jsFunctionLifecycle.test.js @@ -3,7 +3,7 @@ // LICENSE file in the root directory of this source tree. import { beforeEach, describe, expect, it } from 'vitest'; -import { JsFunctionLifecycleManager } from '../src/jsFunctionLifecycle'; +import { JsFunctionLifecycleManager } from '../../runtime/src/worklet-runtime/jsFunctionLifecycle'; let events = []; beforeEach(() => { diff --git a/packages/react/worklet-runtime/__test__/mainThreadFlushLoopGuard.test.js b/packages/react/worklet-runtime/__test__/mainThreadFlushLoopGuard.test.js index 9415989168..5afb799c7e 100644 --- a/packages/react/worklet-runtime/__test__/mainThreadFlushLoopGuard.test.js +++ b/packages/react/worklet-runtime/__test__/mainThreadFlushLoopGuard.test.js @@ -3,16 +3,16 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { Element, setShouldFlush } from '../src/api/element'; -import { RunWorkletSource } from '../src/bindings/types'; +import { Element, setShouldFlush } from '../../runtime/src/worklet-runtime/api/element'; +import { RunWorkletSource } from '../../runtime/src/worklet-runtime/bindings/types'; import { mainThreadFlushLoopMark, mainThreadFlushLoopOnFlushMicrotask, mainThreadFlushLoopReport, mainThreadFlushLoopReset, -} from '../src/utils/mainThreadFlushLoopGuard'; -import { getFromWorkletRefMap } from '../src/workletRef'; -import { initWorklet } from '../src/workletRuntime'; +} from '../../runtime/src/worklet-runtime/utils/mainThreadFlushLoopGuard'; +import { getFromWorkletRefMap } from '../../runtime/src/worklet-runtime/workletRef'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; describe('MainThread flush loop guard (worklet-runtime only)', () => { beforeEach(() => { diff --git a/packages/react/worklet-runtime/__test__/observers.test.js b/packages/react/worklet-runtime/__test__/observers.test.js index 1bea337d47..8db8682e70 100644 --- a/packages/react/worklet-runtime/__test__/observers.test.js +++ b/packages/react/worklet-runtime/__test__/observers.test.js @@ -3,8 +3,8 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { onWorkletCtxUpdate } from '../src/bindings/observers'; -import { initWorklet } from '../src/workletRuntime'; +import { onWorkletCtxUpdate } from '../../runtime/src/worklet-runtime/bindings/observers'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/profile.test.js b/packages/react/worklet-runtime/__test__/profile.test.js index 1c5945dbd9..a10d84ec2a 100644 --- a/packages/react/worklet-runtime/__test__/profile.test.js +++ b/packages/react/worklet-runtime/__test__/profile.test.js @@ -3,7 +3,7 @@ // LICENSE file in the root directory of this source tree. import { afterEach, describe, expect, it, vi } from 'vitest'; -import { profile } from '../src/utils/profile'; +import { profile } from '../../runtime/src/worklet-runtime/utils/profile'; describe('profile', () => { const originalProfile = console.profile; diff --git a/packages/react/worklet-runtime/__test__/runOnBackground.test.js b/packages/react/worklet-runtime/__test__/runOnBackground.test.js index 4e26f9bede..b5397e8ab1 100644 --- a/packages/react/worklet-runtime/__test__/runOnBackground.test.js +++ b/packages/react/worklet-runtime/__test__/runOnBackground.test.js @@ -3,7 +3,7 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { initWorklet } from '../src/workletRuntime'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/runOnMainThread.test.js b/packages/react/worklet-runtime/__test__/runOnMainThread.test.js index d3402708be..7c7bc3383c 100644 --- a/packages/react/worklet-runtime/__test__/runOnMainThread.test.js +++ b/packages/react/worklet-runtime/__test__/runOnMainThread.test.js @@ -3,8 +3,8 @@ // LICENSE file in the root directory of this source tree. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { runRunOnMainThreadTask } from '../src/runOnMainThread'; -import { initWorklet } from '../src/workletRuntime'; +import { runRunOnMainThreadTask } from '../../runtime/src/worklet-runtime/runOnMainThread'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/runtimeSourceLayout.test.js b/packages/react/worklet-runtime/__test__/runtimeSourceLayout.test.js index 3144543496..2efc7c2036 100644 --- a/packages/react/worklet-runtime/__test__/runtimeSourceLayout.test.js +++ b/packages/react/worklet-runtime/__test__/runtimeSourceLayout.test.js @@ -10,7 +10,11 @@ import { describe, expect, test } from 'vitest'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const reactPackagesDir = path.resolve(__dirname, '..', '..'); const reactPackageJsonPath = path.join(reactPackagesDir, 'package.json'); -const shellPackageDir = path.join(reactPackagesDir, 'worklet-runtime'); +const workletRuntimePackageJsonPath = path.join( + reactPackagesDir, + 'worklet-runtime', + 'package.json', +); const runtimeWorkletRuntimeDir = path.join( reactPackagesDir, 'runtime', @@ -32,19 +36,21 @@ describe('runtime-local worklet-runtime source layout', () => { } }); - test('keeps the worklet-runtime shell sources as thin re-export entrypoints', () => { - expect( - fs.readFileSync(path.join(shellPackageDir, 'src', 'index.ts'), 'utf8'), - ).toContain('export * from \'../../runtime/src/worklet-runtime/index.js\';'); + test('reads package metadata from built outputs instead of shell sources', () => { + const workletRuntimePackageJson = JSON.parse( + fs.readFileSync(workletRuntimePackageJsonPath, 'utf8'), + ); + expect(workletRuntimePackageJson.exports['.']).toEqual({ + types: './lib/index.d.ts', + default: './lib/index.js', + }); + expect(workletRuntimePackageJson.main).toBe('lib/index.js'); + expect(workletRuntimePackageJson.module).toBe('lib/index.js'); + expect(workletRuntimePackageJson.types).toBe('lib/index.d.ts'); expect( - fs.readFileSync( - path.join(shellPackageDir, 'src', 'bindings', 'index.ts'), - 'utf8', - ), - ).toContain( - 'export * from \'../../../runtime/src/worklet-runtime/bindings/index.js\';', - ); + fs.existsSync(path.join(reactPackagesDir, 'worklet-runtime', 'src')), + ).toBe(false); }); test('preserves the public worklet-runtime export targets on @lynx-js/react', () => { diff --git a/packages/react/worklet-runtime/__test__/workletRef.test.js b/packages/react/worklet-runtime/__test__/workletRef.test.js index 27edcb871e..a123f1a4f6 100644 --- a/packages/react/worklet-runtime/__test__/workletRef.test.js +++ b/packages/react/worklet-runtime/__test__/workletRef.test.js @@ -7,8 +7,8 @@ import { getFromWorkletRefMap, removeValueFromWorkletRefMap, updateWorkletRefInitValueChanges, -} from '../src/workletRef'; -import { initWorklet } from '../src/workletRuntime'; +} from '../../runtime/src/worklet-runtime/workletRef'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; beforeEach(() => { globalThis.SystemInfo = { diff --git a/packages/react/worklet-runtime/__test__/workletRuntime.test.js b/packages/react/worklet-runtime/__test__/workletRuntime.test.js index d61a1e7007..386f0b4f79 100644 --- a/packages/react/worklet-runtime/__test__/workletRuntime.test.js +++ b/packages/react/worklet-runtime/__test__/workletRuntime.test.js @@ -3,11 +3,11 @@ // LICENSE file in the root directory of this source tree. import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { Element } from '../src/api/element'; -import { initApiEnv } from '../src/api/lynxApi'; -import { RunWorkletSource } from '../src/bindings/types'; -import { updateWorkletRefInitValueChanges } from '../src/workletRef'; -import { initWorklet } from '../src/workletRuntime'; +import { Element } from '../../runtime/src/worklet-runtime/api/element'; +import { initApiEnv } from '../../runtime/src/worklet-runtime/api/lynxApi'; +import { RunWorkletSource } from '../../runtime/src/worklet-runtime/bindings/types'; +import { updateWorkletRefInitValueChanges } from '../../runtime/src/worklet-runtime/workletRef'; +import { initWorklet } from '../../runtime/src/worklet-runtime/workletRuntime'; describe('Worklet', () => { const consoleMock = vi.spyOn(console, 'warn').mockImplementation(() => undefined); diff --git a/packages/react/worklet-runtime/package.json b/packages/react/worklet-runtime/package.json index 0533192e8f..4bb07cba29 100644 --- a/packages/react/worklet-runtime/package.json +++ b/packages/react/worklet-runtime/package.json @@ -6,17 +6,17 @@ "type": "module", "exports": { ".": { - "types": "./src/index.ts", - "default": "./src/index.ts" + "types": "./lib/index.d.ts", + "default": "./lib/index.js" }, "./bindings": { "types": "./lib/bindings/index.d.ts", "default": "./lib/bindings/index.js" } }, - "main": "src/index.ts", - "module": "src/index.ts", - "types": "src/index.ts", + "main": "lib/index.js", + "module": "lib/index.js", + "types": "lib/index.d.ts", "typesVersions": { "*": { "bindings": [ @@ -27,8 +27,7 @@ "files": [ "CHANGELOG.md", "dist", - "lib", - "src" + "lib" ], "scripts": { "build": "rslib build", diff --git a/packages/react/worklet-runtime/rslib.config.ts b/packages/react/worklet-runtime/rslib.config.ts index ec21261213..4fe4496a4d 100644 --- a/packages/react/worklet-runtime/rslib.config.ts +++ b/packages/react/worklet-runtime/rslib.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ __DEV__: 'true', }, entry: { - dev: './src/index.ts', + dev: '../runtime/src/worklet-runtime/index.ts', }, }, output: { @@ -33,7 +33,7 @@ export default defineConfig({ __DEV__: 'false', }, entry: { - main: './src/index.ts', + main: '../runtime/src/worklet-runtime/index.ts', }, }, output: { diff --git a/packages/react/worklet-runtime/src/api/animation/animation.ts b/packages/react/worklet-runtime/src/api/animation/animation.ts deleted file mode 100644 index f324f9d01e..0000000000 --- a/packages/react/worklet-runtime/src/api/animation/animation.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../../runtime/src/worklet-runtime/api/animation/animation.js'; diff --git a/packages/react/worklet-runtime/src/api/animation/effect.ts b/packages/react/worklet-runtime/src/api/animation/effect.ts deleted file mode 100644 index b3b9f75c9c..0000000000 --- a/packages/react/worklet-runtime/src/api/animation/effect.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../../runtime/src/worklet-runtime/api/animation/effect.js'; diff --git a/packages/react/worklet-runtime/src/api/element.ts b/packages/react/worklet-runtime/src/api/element.ts deleted file mode 100644 index bd26ec1265..0000000000 --- a/packages/react/worklet-runtime/src/api/element.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/api/element.js'; diff --git a/packages/react/worklet-runtime/src/api/lepusQuerySelector.ts b/packages/react/worklet-runtime/src/api/lepusQuerySelector.ts deleted file mode 100644 index 0cb363da3a..0000000000 --- a/packages/react/worklet-runtime/src/api/lepusQuerySelector.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/api/lepusQuerySelector.js'; diff --git a/packages/react/worklet-runtime/src/api/lynxApi.ts b/packages/react/worklet-runtime/src/api/lynxApi.ts deleted file mode 100644 index 2eeab6bbe5..0000000000 --- a/packages/react/worklet-runtime/src/api/lynxApi.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/api/lynxApi.js'; diff --git a/packages/react/worklet-runtime/src/bindings/bindings.ts b/packages/react/worklet-runtime/src/bindings/bindings.ts deleted file mode 100644 index 611773e0cc..0000000000 --- a/packages/react/worklet-runtime/src/bindings/bindings.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/bindings.js'; diff --git a/packages/react/worklet-runtime/src/bindings/events.ts b/packages/react/worklet-runtime/src/bindings/events.ts deleted file mode 100644 index 212188d3b8..0000000000 --- a/packages/react/worklet-runtime/src/bindings/events.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/events.js'; diff --git a/packages/react/worklet-runtime/src/bindings/index.ts b/packages/react/worklet-runtime/src/bindings/index.ts deleted file mode 100644 index 8607b96c9e..0000000000 --- a/packages/react/worklet-runtime/src/bindings/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/index.js'; diff --git a/packages/react/worklet-runtime/src/bindings/loadRuntime.ts b/packages/react/worklet-runtime/src/bindings/loadRuntime.ts deleted file mode 100644 index ce9c453057..0000000000 --- a/packages/react/worklet-runtime/src/bindings/loadRuntime.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/loadRuntime.js'; diff --git a/packages/react/worklet-runtime/src/bindings/observers.ts b/packages/react/worklet-runtime/src/bindings/observers.ts deleted file mode 100644 index 8bc9e03cc9..0000000000 --- a/packages/react/worklet-runtime/src/bindings/observers.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/observers.js'; diff --git a/packages/react/worklet-runtime/src/bindings/types.ts b/packages/react/worklet-runtime/src/bindings/types.ts deleted file mode 100644 index c21f1e6e17..0000000000 --- a/packages/react/worklet-runtime/src/bindings/types.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/bindings/types.js'; diff --git a/packages/react/worklet-runtime/src/delayRunOnBackground.ts b/packages/react/worklet-runtime/src/delayRunOnBackground.ts deleted file mode 100644 index e52a19e1b3..0000000000 --- a/packages/react/worklet-runtime/src/delayRunOnBackground.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/delayRunOnBackground.js'; diff --git a/packages/react/worklet-runtime/src/delayWorkletEvent.ts b/packages/react/worklet-runtime/src/delayWorkletEvent.ts deleted file mode 100644 index 04dee19639..0000000000 --- a/packages/react/worklet-runtime/src/delayWorkletEvent.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/delayWorkletEvent.js'; diff --git a/packages/react/worklet-runtime/src/eomImpl.ts b/packages/react/worklet-runtime/src/eomImpl.ts deleted file mode 100644 index c997990592..0000000000 --- a/packages/react/worklet-runtime/src/eomImpl.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/eomImpl.js'; diff --git a/packages/react/worklet-runtime/src/eventPropagation.ts b/packages/react/worklet-runtime/src/eventPropagation.ts deleted file mode 100644 index 03e57ab9ad..0000000000 --- a/packages/react/worklet-runtime/src/eventPropagation.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/eventPropagation.js'; diff --git a/packages/react/worklet-runtime/src/global.ts b/packages/react/worklet-runtime/src/global.ts deleted file mode 100644 index c7a3b6402c..0000000000 --- a/packages/react/worklet-runtime/src/global.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/global.js'; diff --git a/packages/react/worklet-runtime/src/hydrate.ts b/packages/react/worklet-runtime/src/hydrate.ts deleted file mode 100644 index 847c54f320..0000000000 --- a/packages/react/worklet-runtime/src/hydrate.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/hydrate.js'; diff --git a/packages/react/worklet-runtime/src/index.ts b/packages/react/worklet-runtime/src/index.ts deleted file mode 100644 index 6019c7b2e3..0000000000 --- a/packages/react/worklet-runtime/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/index.js'; diff --git a/packages/react/worklet-runtime/src/jsFunctionLifecycle.ts b/packages/react/worklet-runtime/src/jsFunctionLifecycle.ts deleted file mode 100644 index 97dd04549f..0000000000 --- a/packages/react/worklet-runtime/src/jsFunctionLifecycle.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/jsFunctionLifecycle.js'; diff --git a/packages/react/worklet-runtime/src/listeners.ts b/packages/react/worklet-runtime/src/listeners.ts deleted file mode 100644 index ea41ab3211..0000000000 --- a/packages/react/worklet-runtime/src/listeners.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/listeners.js'; diff --git a/packages/react/worklet-runtime/src/runOnMainThread.ts b/packages/react/worklet-runtime/src/runOnMainThread.ts deleted file mode 100644 index b8554fec84..0000000000 --- a/packages/react/worklet-runtime/src/runOnMainThread.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/runOnMainThread.js'; diff --git a/packages/react/worklet-runtime/src/types/dev.d.ts b/packages/react/worklet-runtime/src/types/dev.d.ts deleted file mode 100644 index 8f8bd5e107..0000000000 --- a/packages/react/worklet-runtime/src/types/dev.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2024 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -declare let __DEV__; diff --git a/packages/react/worklet-runtime/src/types/elementApi.d.ts b/packages/react/worklet-runtime/src/types/elementApi.d.ts deleted file mode 100644 index e8b59c419c..0000000000 --- a/packages/react/worklet-runtime/src/types/elementApi.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2024 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -declare class ElementNode {} - -declare function __AddInlineStyle( - e: ElementNode, - key: number | string, - value: string, -): void; - -declare function __FlushElementTree(element?: ElementNode): void; - -declare function __GetAttributeByName(e: ElementNode, name: string): undefined | string; - -declare function __GetAttributeNames(e: ElementNode): string[]; - -declare function __GetPageElement(): ElementNode; - -declare function __GetComputedStyleByKey(e: ElementNode, key: string): string; - -declare function __InvokeUIMethod( - e: ElementNode, - method: string, - params: Record, - callback: (res: { code: number; data: unknown }) => void, -): ElementNode[]; - -declare function __LoadLepusChunk( - name: string, - cfg: { chunkType: number; dynamicComponentEntry?: string | undefined }, -): boolean; - -declare function __QuerySelector( - e: ElementNode, - cssSelector: string, - params: { - onlyCurrentComponent?: boolean; - }, -): ElementNode | undefined; - -declare function __QuerySelectorAll( - e: ElementNode, - cssSelector: string, - params: { - onlyCurrentComponent?: boolean; - }, -): ElementNode[]; - -declare function __SetAttribute(e: ElementNode, key: string, value: unknown): void; - -/** - * Animation operation types for ElementAnimate function - */ -declare enum AnimationOperation { - START = 0, // Start a new animation - PLAY = 1, // Play/resume a paused animation - PAUSE = 2, // Pause an existing animation - CANCEL = 3, // Cancel an animation -} - -/** - * Animation timing options configuration - */ -interface AnimationTimingOptions { - name?: string; // Animation name (optional, auto-generated if not provided) - duration?: number | string; // Animation duration - delay?: number | string; // Animation delay - iterationCount?: number | string; // Number of iterations (can be 'infinite') - fillMode?: string; // Animation fill mode - timingFunction?: string; // Animation timing function - direction?: string; // Animation direction -} - -/** - * Keyframe definition for animation - */ -type Keyframe = Record; - -/** - * ElementAnimate function - controls animations on DOM elements - * @param element - The DOM element to animate (FiberElement reference) - * @param args - Animation configuration array - * @returns undefined - */ -declare function __ElementAnimate( - element: ElementNode, - args: [ - operation: AnimationOperation, // Animation operation type - name: string, // Animation name - keyframes: Keyframe[], // Array of keyframes - options?: AnimationTimingOptions, // Timing and configuration options - ] | [ - operation: AnimationOperation.PAUSE | AnimationOperation.PLAY | AnimationOperation.CANCEL, - name: string, // Animation name to pause/play - ], -): void; diff --git a/packages/react/worklet-runtime/src/types/runtimeProxy.d.ts b/packages/react/worklet-runtime/src/types/runtimeProxy.d.ts deleted file mode 100644 index 1c53e8e339..0000000000 --- a/packages/react/worklet-runtime/src/types/runtimeProxy.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2024 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. - -import type { LynxApi } from '@lynx-js/types'; - -export interface Event { - type: string; - data: unknown; - origin?: string; -} - -export class RuntimeProxy { - dispatchEvent(event: RuntimeProxy.Event): void; - - postMessage(message: unknown); - - addEventListener(type: string, callback: (event: RuntimeProxy.Event) => void); - - removeEventListener( - type: string, - callback: (event: RuntimeProxy.Event) => void, - ); - - onTriggerEvent(callback: (event: RuntimeProxy.Event) => void); -} - -declare module '@lynx-js/types' { - interface Lynx extends LynxApi { - getJSContext(): RuntimeProxy; - } -} diff --git a/packages/react/worklet-runtime/src/types/systeminfo.d.ts b/packages/react/worklet-runtime/src/types/systeminfo.d.ts deleted file mode 100644 index 58feeb4d28..0000000000 --- a/packages/react/worklet-runtime/src/types/systeminfo.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2024 The Lynx Authors. All rights reserved. -// Licensed under the Apache License Version 2.0 that can be found in the -// LICENSE file in the root directory of this source tree. -interface ISystemInfo { - osVersion: string; - pixelHeight: number; - pixelRatio: number; - pixelWidth: number; - platform: string; - theme: object; - /** - * The version of the Lynx SDK. - * @since Lynx 2.4 - * @example '2.4', '2.10' - */ - lynxSdkVersion?: string; -} - -declare let SystemInfo: ISystemInfo; diff --git a/packages/react/worklet-runtime/src/utils/mainThreadFlushLoopGuard.ts b/packages/react/worklet-runtime/src/utils/mainThreadFlushLoopGuard.ts deleted file mode 100644 index 5ac1790ba3..0000000000 --- a/packages/react/worklet-runtime/src/utils/mainThreadFlushLoopGuard.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/utils/mainThreadFlushLoopGuard.js'; diff --git a/packages/react/worklet-runtime/src/utils/profile.ts b/packages/react/worklet-runtime/src/utils/profile.ts deleted file mode 100644 index e5de22d7e7..0000000000 --- a/packages/react/worklet-runtime/src/utils/profile.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/utils/profile.js'; diff --git a/packages/react/worklet-runtime/src/utils/version.ts b/packages/react/worklet-runtime/src/utils/version.ts deleted file mode 100644 index 2149cada14..0000000000 --- a/packages/react/worklet-runtime/src/utils/version.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../runtime/src/worklet-runtime/utils/version.js'; diff --git a/packages/react/worklet-runtime/src/workletRef.ts b/packages/react/worklet-runtime/src/workletRef.ts deleted file mode 100644 index 190f4a61d0..0000000000 --- a/packages/react/worklet-runtime/src/workletRef.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/workletRef.js'; diff --git a/packages/react/worklet-runtime/src/workletRuntime.ts b/packages/react/worklet-runtime/src/workletRuntime.ts deleted file mode 100644 index 2e9c834ac0..0000000000 --- a/packages/react/worklet-runtime/src/workletRuntime.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../runtime/src/worklet-runtime/workletRuntime.js'; diff --git a/packages/react/worklet-runtime/tsconfig.eslint.json b/packages/react/worklet-runtime/tsconfig.eslint.json deleted file mode 100644 index 78b07e580a..0000000000 --- a/packages/react/worklet-runtime/tsconfig.eslint.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "noEmit": true, - "target": "ESNext", - "lib": ["es2021"], - "module": "Node16", - "moduleResolution": "Node16", - "resolveJsonModule": true - }, - "include": ["src/**/*", "../runtime/src/worklet-runtime/**/*"] -} diff --git a/packages/react/worklet-runtime/turbo.json b/packages/react/worklet-runtime/turbo.json index 7be8b860da..2c119d4795 100644 --- a/packages/react/worklet-runtime/turbo.json +++ b/packages/react/worklet-runtime/turbo.json @@ -6,7 +6,6 @@ "dependsOn": [], "inputs": [ "../runtime/src/worklet-runtime/**", - "src/**", "rslib.config.ts" ], "outputs": [ diff --git a/packages/react/worklet-runtime/vitest.config.ts b/packages/react/worklet-runtime/vitest.config.ts index fa44e73ebf..d2b89d7160 100644 --- a/packages/react/worklet-runtime/vitest.config.ts +++ b/packages/react/worklet-runtime/vitest.config.ts @@ -13,7 +13,6 @@ const config: ViteUserConfig = defineConfig({ exclude: [ 'dist/**', 'lib/**', - 'src/**', 'rslib.config.ts', '../runtime/src/worklet-runtime/api/lepusQuerySelector.ts', '../runtime/src/worklet-runtime/api/lynxApi.ts',