Skip to content
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
18 changes: 0 additions & 18 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
);
6 changes: 3 additions & 3 deletions packages/react/worklet-runtime/__test__/api/element.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/worklet-runtime/__test__/observers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/worklet-runtime/__test__/profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/worklet-runtime/__test__/workletRef.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
10 changes: 5 additions & 5 deletions packages/react/worklet-runtime/__test__/workletRuntime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 6 additions & 7 deletions packages/react/worklet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -27,8 +27,7 @@
"files": [
"CHANGELOG.md",
"dist",
"lib",
"src"
"lib"
],
"scripts": {
"build": "rslib build",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/worklet-runtime/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
__DEV__: 'true',
},
entry: {
dev: './src/index.ts',
dev: '../runtime/src/worklet-runtime/index.ts',
},
},
output: {
Expand All @@ -33,7 +33,7 @@ export default defineConfig({
__DEV__: 'false',
},
entry: {
main: './src/index.ts',
main: '../runtime/src/worklet-runtime/index.ts',
},
},
output: {
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/api/element.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/api/lynxApi.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/bindings/bindings.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/bindings/events.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/bindings/index.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/bindings/observers.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/bindings/types.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/delayWorkletEvent.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/eomImpl.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/eventPropagation.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/global.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/hydrate.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/index.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/listeners.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/worklet-runtime/src/runOnMainThread.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/react/worklet-runtime/src/types/dev.d.ts

This file was deleted.

Loading
Loading