Skip to content

feat: upgrade @lynx-js/lynx-core to 0.1.2#465

Merged
PupilTong merged 2 commits intolynx-family:mainfrom
PupilTong:p/hw/0.1.1
Apr 10, 2025
Merged

feat: upgrade @lynx-js/lynx-core to 0.1.2#465
PupilTong merged 2 commits intolynx-family:mainfrom
PupilTong:p/hw/0.1.1

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

refactor some internal logic

  • __OnLifeCycleEvent
  • __OnNativeAppReady

Summary

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2025

🦋 Changeset detected

Latest commit: 0d1dae4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@lynx-js/web-core Minor
@lynx-js/web-constants Minor
@lynx-js/web-mainthread-apis Minor
@lynx-js/web-worker-rpc Minor
@lynx-js/web-worker-runtime Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request upgrades @lynx-js/lynx-core to version 0.1.2 and refactors internal logic related to lifecycle event handling and profiling. The key changes include:

  • Removal of legacy lifecycle event handlers and corresponding endpoints.
  • Addition of new performance API methods (profileStart/profileEnd) as placeholders.
  • Updates in native app initialization and cross-thread context handling.

Reviewed Changes

Copilot reviewed 19 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/crossThreadHandlers/registerOnLifecycleEventHandler.ts Removal of the legacy lifecycle event handler registration code.
packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createPerformanceApis.ts Added profileStart/profileEnd methods using console errors as placeholders.
packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts Removed lifecycle event registration; added lynxCoreInject initialization and invocation of the core context __start method.
packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createBackgroundLynx.ts Introduced LynxCrossThreadContext and updated getCoreContext implementation.
packages/web-platform/web-tests/tests/react/api-onNativeAppReady/index.jsx Removed the obsolete onNativeAppReady test.
packages/web-platform/web-tests/tests/react.spec.ts Removed the api-onNativeAppReady test case.
packages/web-platform/web-mainthread-apis/src/MainThreadRuntime.ts Updated __OnLifecycleEvent signature to a functional form.
packages/web-platform/web-core/src/uiThread/startUIThread.ts Removed references to uiThreadFpReady endpoint and cleaned up code accordingly.
packages/web-platform/web-core/src/uiThread/crossThreadHandlers/registerFlushElementTreeHandler.ts Removed unused commit callback and isFP flag.
packages/web-platform/web-constants/* Removed LynxLifecycleEvent types and added LynxContextEventTarget, with updates in endpoints accordingly.
.changeset/twenty-suits-teach.md Updated changeset to reflect the core upgrade and refactoring changes.
Files not reviewed (4)
  • packages/web-platform/web-core/package.json: Language not supported
  • packages/web-platform/web-explorer/package.json: Language not supported
  • packages/web-platform/web-tests/package.json: Language not supported
  • packages/web-platform/web-worker-runtime/package.json: Language not supported
Comments suppressed due to low confidence (4)

packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createPerformanceApis.ts:45

  • [nitpick] Consider replacing the console.error stub in profileStart with a clear error handling mechanism (e.g., throwing a 'Not Implemented' error) to better indicate that the functionality is pending.
profileStart: () => {

packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createPerformanceApis.ts:48

  • [nitpick] Consider replacing the console.error stub in profileEnd with a clear error handling mechanism (e.g., throwing a 'Not Implemented' error) to clearly signal the unimplemented state.
profileEnd: () => {

packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts:99

  • [nitpick] The property 'lynxCoreInject' is used in a self-assignment pattern; consider renaming it to a more descriptive name or documenting its purpose to clarify its intent.
lynxCoreInject.tt.lynxCoreInject = lynxCoreInject;

packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createNativeApp.ts:136

  • [nitpick] Consider adding a runtime check or reworking the design to avoid the need for a direct type assertion here, ensuring that getCoreContext() returns a valid LynxCrossThreadContext instance.
(tt.lynx.getCoreContext() as LynxCrossThreadContext).__start();

@PupilTong
Copy link
Copy Markdown
Collaborator Author

lynx-family/lynx#619

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
2427 3 2424 72
View the top 3 failed test(s) by shortest run time
react.spec.ts reactlynx3 testsconfigsconfig-splitchunk-single-vendor
Stack Traces | 38.2s run time
react.spec.ts:964:5 config-splitchunk-single-vendor
react.spec.ts reactlynx3 testsconfigsconfig-splitchunk-split-by-module
Stack Traces | 38.9s run time
react.spec.ts:982:5 config-splitchunk-split-by-module
react.spec.ts reactlynx3 testsconfigsconfig-splitchunk-split-by-experience
Stack Traces | 41.1s run time
react.spec.ts:973:5 config-splitchunk-split-by-experience

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@PupilTong PupilTong force-pushed the p/hw/0.1.1 branch 2 times, most recently from 7f12524 to 218d378 Compare April 8, 2025 09:05
@PupilTong PupilTong marked this pull request as ready for review April 8, 2025 09:10
@PupilTong PupilTong self-assigned this Apr 8, 2025
@PupilTong PupilTong moved this to In Progress in Lynx for Web Apr 8, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2025

Bundle Report

Changes will decrease total bundle size by 10.77kB (-1.69%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@lynx-js/web-explorer-web-array-push 310.13kB -10.77kB (-3.35%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: @lynx-js/web-explorer-web-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/js/index.js -474 bytes 144.97kB -0.33%
static/js/async/159.js (New) 84.52kB 84.52kB 100.0% 🚀
static/js/async/748.js (Deleted) -94.81kB 0 bytes -100.0% 🗑️

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 8, 2025

CodSpeed Performance Report

Merging #465 will not alter performance

Comparing PupilTong:p/hw/0.1.1 (0d1dae4) with main (4479f67)

Summary

✅ 1 untouched benchmarks

refactor some internal logic

* __OnLifeCycleEvent
* __OnNativeAppReady
@PupilTong PupilTong added this pull request to the merge queue Apr 9, 2025
@PupilTong PupilTong removed this pull request from the merge queue due to a manual request Apr 9, 2025
@PupilTong PupilTong added this pull request to the merge queue Apr 9, 2025
@PupilTong PupilTong removed this pull request from the merge queue due to a manual request Apr 9, 2025
@PupilTong PupilTong added this pull request to the merge queue Apr 10, 2025
Merged via the queue into lynx-family:main with commit 4f66987 Apr 10, 2025
23 checks passed
@PupilTong PupilTong deleted the p/hw/0.1.1 branch April 10, 2025 10:22
@github-project-automation github-project-automation bot moved this from In Progress to Done in Lynx for Web Apr 10, 2025
colinaaa pushed a commit that referenced this pull request Apr 11, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/web-core@0.11.0

### Minor Changes

- feat: upgrade @lynx-js/lynx-core to 0.1.2
([#465](#465))

    refactor some internal logic

    -   \_\_OnLifeCycleEvent
    -   \_\_OnNativeAppReady

### Patch Changes

- feat: support mts event handler (1/n)
([#495](#495))

now the main-thread:bind handler could be invoked. The params of the
handler will be implemented later.

- feat: allow multi lynx-view to share bts worker
([#520](#520))

Now we allow users to enable so-called "shared-context" feature on the
Web Platform.

Similar to the same feature for Lynx iOS/Android, this feature let multi
lynx cards to share one js context.

The `lynx.getSharedData` and `lynx.setSharedData` are also supported in
this commit.

To enable this feature, set property `lynxGroupId` or attribute
`lynx-group-id` before a lynx-view starts rendering. Those card with
same context id will share one web worker for the bts scripts.

- perf: dispatchLynxViewEventEndpoint is a void call
([#506](#506))

- Updated dependencies
\[[`ea42e62`](ea42e62),
[`a0f5ca4`](a0f5ca4)]:
    -   @lynx-js/web-worker-runtime@0.11.0
    -   @lynx-js/web-constants@0.11.0
    -   @lynx-js/web-worker-rpc@0.11.0

## @lynx-js/react@0.106.4

### Patch Changes

- Disable MTS HMR functionality temporarily to address stability issues.
This is a temporary fix while we work on a more robust solution.
([#512](#512))

## @lynx-js/rspeedy@0.9.1

### Patch Changes

- Bump Rsbuild v1.3.5 with Rspack v1.3.3.
([#467](#467))

## @lynx-js/react-rsbuild-plugin@0.9.6

### Patch Changes

- Updated dependencies
\[[`ea42e62`](ea42e62),
[`12e3afe`](12e3afe)]:
    -   @lynx-js/web-webpack-plugin@0.6.4
    -   @lynx-js/template-webpack-plugin@0.6.9
    -   @lynx-js/react-alias-rsbuild-plugin@0.9.6
    -   @lynx-js/react-refresh-webpack-plugin@0.3.2
    -   @lynx-js/react-webpack-plugin@0.6.10
    -   @lynx-js/css-extract-webpack-plugin@0.5.3

## @lynx-js/web-constants@0.11.0

### Patch Changes

- feat: support mts event handler (1/n)
([#495](#495))

now the main-thread:bind handler could be invoked. The params of the
handler will be implemented later.

- feat: allow multi lynx-view to share bts worker
([#520](#520))

Now we allow users to enable so-called "shared-context" feature on the
Web Platform.

Similar to the same feature for Lynx iOS/Android, this feature let multi
lynx cards to share one js context.

The `lynx.getSharedData` and `lynx.setSharedData` are also supported in
this commit.

To enable this feature, set property `lynxGroupId` or attribute
`lynx-group-id` before a lynx-view starts rendering. Those card with
same context id will share one web worker for the bts scripts.

-   Updated dependencies \[]:
    -   @lynx-js/web-worker-rpc@0.11.0

## @lynx-js/web-elements@0.5.4

### Patch Changes

- chore: bump the output target to es2024
([#518](#518))

- fix: the `\n` character should create a new line
([#522](#522))

    add `white-space-collapse: preserve-breaks` to raw-text

- fix: the `input` event of x-input with number type should have raw
value ([#517](#517))

    For `type:=number` x-input with typed value "2."

    Before this commit: the value is "2"

    After this commit the value is "2."

## @lynx-js/web-explorer@0.0.4

### Patch Changes

- feat: add a touch emulator that allows the explorer to respond to
touch events triggered by mouse events
([#516](#516))

## @lynx-js/web-mainthread-apis@0.11.0

### Patch Changes

- feat: support mts event handler (1/n)
([#495](#495))

now the main-thread:bind handler could be invoked. The params of the
handler will be implemented later.

- Updated dependencies
\[[`ea42e62`](ea42e62),
[`a0f5ca4`](a0f5ca4)]:
    -   @lynx-js/web-constants@0.11.0

## @lynx-js/web-worker-runtime@0.11.0

### Patch Changes

- feat: support mts event handler (1/n)
([#495](#495))

now the main-thread:bind handler could be invoked. The params of the
handler will be implemented later.

- feat: allow multi lynx-view to share bts worker
([#520](#520))

Now we allow users to enable so-called "shared-context" feature on the
Web Platform.

Similar to the same feature for Lynx iOS/Android, this feature let multi
lynx cards to share one js context.

The `lynx.getSharedData` and `lynx.setSharedData` are also supported in
this commit.

To enable this feature, set property `lynxGroupId` or attribute
`lynx-group-id` before a lynx-view starts rendering. Those card with
same context id will share one web worker for the bts scripts.

- Updated dependencies
\[[`ea42e62`](ea42e62),
[`a0f5ca4`](a0f5ca4)]:
    -   @lynx-js/web-mainthread-apis@0.11.0
    -   @lynx-js/web-constants@0.11.0
    -   @lynx-js/web-worker-rpc@0.11.0

## @lynx-js/template-webpack-plugin@0.6.9

### Patch Changes

- Fix incorrect hash of `background.[contenthash].js` in `.lynx.bundle`
files. ([#498](#498))

## @lynx-js/web-webpack-plugin@0.6.4

### Patch Changes

- feat: support mts event handler (1/n)
([#495](#495))

now the main-thread:bind handler could be invoked. The params of the
handler will be implemented later.

## create-rspeedy@0.9.1



## @lynx-js/react-alias-rsbuild-plugin@0.9.6



## upgrade-rspeedy@0.9.1



## @lynx-js/web-worker-rpc@0.11.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants