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
14 changes: 7 additions & 7 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@
}
},
"./worklet-runtime": {
"types": "./worklet-runtime/lib/index.d.ts",
"types": "./runtime/lib/worklet-runtime/index.d.ts",
"default": "./worklet-runtime/dist/main.js"
},
"./worklet-dev-runtime": {
"types": "./worklet-runtime/lib/index.d.ts",
"types": "./runtime/lib/worklet-runtime/index.d.ts",
"default": "./worklet-runtime/dist/dev.js"
},
"./worklet-runtime/bindings": {
"types": "./worklet-runtime/lib/bindings/index.d.ts",
"default": "./worklet-runtime/lib/bindings/index.js"
"types": "./runtime/lib/worklet-runtime/bindings/index.d.ts",
"default": "./runtime/lib/worklet-runtime/bindings/index.js"
},
"./legacy-react-runtime": {
"types": "./runtime/lib/legacy-react-runtime/index.d.ts",
Expand Down Expand Up @@ -143,13 +143,13 @@
"./components/lib/index.d.ts"
],
"worklet-runtime": [
"./worklet-runtime/lib/index.d.ts"
"./runtime/lib/worklet-runtime/index.d.ts"
],
"worklet-dev-runtime": [
"./worklet-runtime/lib/index.d.ts"
"./runtime/lib/worklet-runtime/index.d.ts"
],
"worklet-runtime/bindings": [
"./worklet-runtime/lib/bindings/index.d.ts"
"./runtime/lib/worklet-runtime/bindings/index.d.ts"
],
"legacy-react-runtime": [
"./runtime/lib/legacy-react-runtime/index.d.ts"
Expand Down
6 changes: 3 additions & 3 deletions packages/react/testing-library/src/vitest-global-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
snapshotInstanceManager,
} from '../../runtime/lib/snapshot/index.js';
import { destroyWorklet } from '../../runtime/lib/worklet/destroy.js';
import { initApiEnv } from '../../worklet-runtime/lib/api/lynxApi.js';
import { initEventListeners } from '../../worklet-runtime/lib/listeners.js';
import { initWorklet } from '../../worklet-runtime/lib/workletRuntime.js';
import { initApiEnv } from '../../runtime/lib/worklet-runtime/api/lynxApi.js';
import { initEventListeners } from '../../runtime/lib/worklet-runtime/listeners.js';
import { initWorklet } from '../../runtime/lib/worklet-runtime/workletRuntime.js';

expect.addSnapshotSerializer({
test(val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ describe('runtime-local worklet-runtime source layout', () => {
}
});

test('reads package metadata from built outputs instead of shell sources', () => {
test('keeps the shell package focused on dist-only worklet bundle outputs', () => {
const workletRuntimePackageJson = JSON.parse(
fs.readFileSync(workletRuntimePackageJsonPath, 'utf8'),
);

expect(workletRuntimePackageJson.exports['.']).toEqual({
types: './lib/index.d.ts',
default: './lib/index.js',
default: './dist/main.js',
});
expect(workletRuntimePackageJson.main).toBe('lib/index.js');
expect(workletRuntimePackageJson.module).toBe('lib/index.js');
expect(workletRuntimePackageJson.types).toBe('lib/index.d.ts');
expect(workletRuntimePackageJson.exports['./dev']).toEqual({
default: './dist/dev.js',
});
expect(workletRuntimePackageJson.main).toBe('dist/main.js');
expect(workletRuntimePackageJson.module).toBe('dist/main.js');
expect(
fs.existsSync(path.join(reactPackagesDir, 'worklet-runtime', 'src')),
).toBe(false);
Expand All @@ -57,16 +58,16 @@ describe('runtime-local worklet-runtime source layout', () => {
const reactPackageJson = JSON.parse(fs.readFileSync(reactPackageJsonPath, 'utf8'));

expect(reactPackageJson.exports['./worklet-runtime']).toEqual({
types: './worklet-runtime/lib/index.d.ts',
types: './runtime/lib/worklet-runtime/index.d.ts',
default: './worklet-runtime/dist/main.js',
});
expect(reactPackageJson.exports['./worklet-dev-runtime']).toEqual({
types: './worklet-runtime/lib/index.d.ts',
types: './runtime/lib/worklet-runtime/index.d.ts',
default: './worklet-runtime/dist/dev.js',
});
expect(reactPackageJson.exports['./worklet-runtime/bindings']).toEqual({
types: './worklet-runtime/lib/bindings/index.d.ts',
default: './worklet-runtime/lib/bindings/index.js',
types: './runtime/lib/worklet-runtime/bindings/index.d.ts',
default: './runtime/lib/worklet-runtime/bindings/index.js',
});
});
});
23 changes: 6 additions & 17 deletions packages/react/worklet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,17 @@
"type": "module",
"exports": {
".": {
"types": "./lib/index.d.ts",
Comment thread
Yradex marked this conversation as resolved.
"default": "./lib/index.js"
"default": "./dist/main.js"
},
"./bindings": {
"types": "./lib/bindings/index.d.ts",
"default": "./lib/bindings/index.js"
}
},
"main": "lib/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"typesVersions": {
"*": {
"bindings": [
"./lib/bindings/index.d.ts"
]
"./dev": {
"default": "./dist/dev.js"
}
},
"main": "dist/main.js",
"module": "dist/main.js",
"files": [
"CHANGELOG.md",
"dist",
"lib"
"dist"
],
"scripts": {
"build": "rslib build",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/worklet-runtime/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"noEmit": false,
"outDir": "lib",
"outDir": "../runtime/lib/worklet-runtime",
Comment thread
Yradex marked this conversation as resolved.
"rootDir": "../runtime/src/worklet-runtime",
"stripInternal": true,
"target": "ESNext",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ describe('pluginReactLynx', () => {
"@lynx-js/react/internal$": "<ROOT>/packages/react/runtime/lib/internal.js",
"@lynx-js/react/legacy-react-runtime$": "<ROOT>/packages/react/runtime/lib/legacy-react-runtime/index.js",
"@lynx-js/react/runtime-components$": "<ROOT>/packages/react/components/lib/index.js",
"@lynx-js/react/worklet-runtime/bindings$": "<ROOT>/packages/react/worklet-runtime/lib/bindings/index.js",
"@lynx-js/react/worklet-runtime/bindings$": "<ROOT>/packages/react/runtime/lib/worklet-runtime/bindings/index.js",
"@swc/helpers": "<ROOT>/node_modules/<PNPM_INNER>/@swc/helpers",
"preact$": "<ROOT>/node_modules/<PNPM_INNER>/@lynx-js/internal-preact/dist/preact.mjs",
"preact/compat$": "<ROOT>/node_modules/<PNPM_INNER>/@lynx-js/internal-preact/compat/dist/compat.mjs",
Expand Down
11 changes: 6 additions & 5 deletions packages/rspeedy/plugin-react/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2627,16 +2627,17 @@ describe('Config', () => {
)
})

test('worklet runtime bindings resolve to the shell package build output', () => {
test('worklet runtime bindings resolve to the runtime-owned build output', () => {
const require = createRequire(import.meta.url)

expect(
require.resolve('@lynx-js/react/worklet-runtime/bindings'),
).toContain(
'/packages/react/worklet-runtime/lib/bindings/index.js'.replaceAll(
'/',
path.sep,
),
'/packages/react/runtime/lib/worklet-runtime/bindings/index.js'
.replaceAll(
'/',
path.sep,
),
)
})

Expand Down
Loading