Skip to content

fix(web): decodeCssInJs will not throw an error#1120

Merged
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:fix/decode-css-warn
Jun 20, 2025
Merged

fix(web): decodeCssInJs will not throw an error#1120
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:fix/decode-css-warn

Conversation

@Sherry-hue
Copy link
Collaborator

@Sherry-hue Sherry-hue commented Jun 20, 2025

Summary

fix: decodeCssInJs will not throw error.

Before this pr, decoding css will be strictly executed according to cssInfo, and an error will be thrown if data that does not meet the requirements is encountered. Now it is changed to console.warn, which will not block rendering.

Checklist

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

@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2025

🦋 Changeset detected

Latest commit: e271970

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

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

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

@codspeed-hq
Copy link

codspeed-hq bot commented Jun 20, 2025

CodSpeed Performance Report

Merging #1120 will not alter performance

Comparing Sherry-hue:fix/decode-css-warn (e271970) with main (6137fba)

Summary

✅ 8 untouched benchmarks

@Sherry-hue Sherry-hue enabled auto-merge June 20, 2025 08:47
@Sherry-hue Sherry-hue added this pull request to the merge queue Jun 20, 2025
@relativeci
Copy link

relativeci bot commented Jun 20, 2025

Web Explorer

#1846 Bundle Size — 257.82KiB (~+0.01%).

e271970(current) vs 6137fba main#1838(baseline)

Bundle metrics  Change 3 changes
                 Current
#1846
     Baseline
#1838
No change  Initial JS 140.05KiB 140.05KiB
No change  Initial CSS 31.82KiB 31.82KiB
Change  Cache Invalidation 10.8% 0%
No change  Chunks 4 4
No change  Assets 4 4
Change  Modules 205(-0.49%) 206
No change  Duplicate Modules 15 15
Change  Duplicate Code 3.41%(+0.29%) 3.4%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#1846
     Baseline
#1838
Regression  JS 226KiB (~+0.01%) 226KiB
No change  CSS 31.82KiB 31.82KiB

Bundle analysis reportBranch Sherry-hue:fix/decode-css-warnProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jun 20, 2025

React Example

#1857 Bundle Size — 233.47KiB (0%).

e271970(current) vs 6137fba main#1849(baseline)

Bundle metrics  no changes
                 Current
#1857
     Baseline
#1849
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 0% 37.34%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 145 145
No change  Duplicate Modules 56 56
No change  Duplicate Code 45.66% 45.66%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#1857
     Baseline
#1849
No change  IMG 145.76KiB 145.76KiB
No change  Other 87.71KiB 87.71KiB

Bundle analysis reportBranch Sherry-hue:fix/decode-css-warnProject dashboard


Generated by RelativeCIDocumentationReport issue

Merged via the queue into lynx-family:main with commit 1861cbe Jun 20, 2025
43 checks passed
@Sherry-hue Sherry-hue deleted the fix/decode-css-warn branch June 20, 2025 09:48
colinaaa pushed a commit that referenced this pull request Jun 20, 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/react@0.110.0

### Minor Changes

- Fixed closure variable capture issue in effect hooks to prevent stale
values and ensured proper execution order between refs, effects, and
event handlers.
([#770](#770))

    **Breaking Changes**:

- The execution timing of `ref`, `useEffect()` callback,
`componentDidMount`, `componentDidUpdate`, `componentWillUnmount` and
the callback of `setState` have been moved forward. These effects will
now execute before hydration is complete, rather than waiting for the
main thread update to complete.
- For components inside `<list />`, `ref` callbacks will now be
triggered during background thread rendering, regardless of component
visibility. If your code depends on component visibility timing, use
`main-thread:ref` instead of regular `ref`.

### Patch Changes

- Fixed two memory leaks:
([#1071](#1071))

1. When JSX is rendered on the main thread and removed, FiberElement can
still be referenced by `__root.__jsx` through `props.children`;

2. When the SnapshotInstance tree is removed from the root node, its
child nodes form a cycle reference because the `__previousSibling` and
`__nextSibling` properties point to each other, thus causing a
FiberElement leak.

- Optimize the error message when snapshots cannot be found in the main
thread. ([#1083](#1083))

- Fix a problem causing `MainThreadRef`s to not be updated correctly
during hydration when they are set to `main-thread:ref`s.
([#1001](#1001))

- Add snapshot id report when throwing `snapshotPatchApply failed: ctx
not found` error.
([#1107](#1107))

- Fix a bug in ReactLynx Testing Library that rendered snapshot of
inline style was normalized incorrectly (eg. `flex:1` was normalized to
`flex: 1 1 0%;` incorrectly).
([#1040](#1040))

## @lynx-js/web-core@0.14.0

### Minor Changes

- refactor: the default thread-strategy will be all on ui
([#1105](#1105))

    **This is a breaking change!!!**

### Patch Changes

- feat: add `_SetSourceMapRelease(errInfo)` MTS API.
([#1118](#1118))

You can get `errInfo.release` through `e.detail.release` in the error
event callback of lynx-view.

The `_SetSourceMapRelease` function is not complete yet, because it is
currently limited by the Web platform and some functions and some props
such as `err.stack` do not need to be supported for the time being.

- feat: add `_I18nResourceTranslation` api in mts &&
`init-i18n-resources` attr, `i18nResourceMissed` event of lynx-view.
([#1065](#1065))

`init-i18n-resource` is the complete set of i18nResources that need to
be maintained on the container side. Note: You need to pass this value
when lynx-view is initialized.

You can use `_I18nResourceTranslation` in MTS to get the corresponding
i18nResource from `init-i18n-resources`. If it is undefined, the
`i18nResourceMissed` event will be dispatched.

    ```js
    // ui thread
    lynxView.initI18nResources = [
      {
        options: {
          locale: "en",
          channel: "1",
          fallback_url: "",
        },
        resource: {
          hello: "hello",
          lynx: "lynx web platform1",
        },
      },
    ];
    lynxView.addEventListener("i18nResourceMissed", (e) => {
      console.log(e);
    });

    // mts
    _I18nResourceTranslation({
      locale: "en",
      channel: "1",
      fallback_url: "",
    });
    ```

- fix: lynx-view `updateGlobalProps` method will also update
globalProps, so `reload()` will use the latest updated globalProps.
([#1119](#1119))

- feat: supports `lynx.getI18nResource()` and `onI18nResourceReady`
event in bts.
([#1088](#1088))

- `lynx.getI18nResource()` can be used to get i18nResource in bts, it
has two data sources:
        -   the result of `_I18nResourceTranslation()`
- lynx-view `updateI18nResources(data: InitI18nResources, options:
I18nResourceTranslationOptions)`, it will be matched to the correct
i8nResource as a result of `lynx.getI18nResource()`
- `onI18nResourceReady` event can be used to listen
`_I18nResourceTranslation` and lynx-view `updateI18nResources`
execution.

- refactor: make the opcode be a plain array
([#1051](#1051))

    \#1042

- feat: The error event return value detail of lynx-view adds
`sourceMap` value, the type is as follows:
([#1058](#1058))

        CustomEvent<{
          error: Error;
          sourceMap: {
            offset: {
              line: number;
              col: number;
            };
          };
        }>;

This is because web-core adds wrapper at runtime, which causes the stack
offset to be different. Now you can calculate the real offset based on
it.

- feat: add `updateI18nResources` method of lynx-view.
([#1085](#1085))

Now you can use `updateI18nResources` to update i18nResources, and then
use \_I18nResourceTranslation() to get the updated result.

- fix: --lynx-color will be removed, and if color contains `gradient` it
will be processed as transparent.
([#1069](#1069))

- Updated dependencies
\[[`42ed2e3`](42ed2e3),
[`25a04c9`](25a04c9),
[`0dbb8b1`](0dbb8b1),
[`f99de1e`](f99de1e),
[`873a285`](873a285),
[`afacb2c`](afacb2c),
[`1861cbe`](1861cbe)]:
    -   @lynx-js/web-worker-runtime@0.14.0
    -   @lynx-js/web-mainthread-apis@0.14.0
    -   @lynx-js/web-constants@0.14.0
    -   @lynx-js/offscreen-document@0.1.2
    -   @lynx-js/web-worker-rpc@0.14.0

## @lynx-js/css-extract-webpack-plugin@0.6.0

### Minor Changes

- Fix CSS HMR crash issues by using the same encode options with the
main template.
([#1033](#1033))

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

### Minor Changes

- Remove `EncodeCSSOptions` and `encodeCSS` to ensure consistent
encoding options are used across CSS HMR updates and the main template.
([#1033](#1033))

### Patch Changes

- Avoid generating lazy bundles when there are no chunk name.
([#1090](#1090))

    E.g.: using `import.meta.webpackContext`.

## create-rspeedy@0.9.10

### Patch Changes

- Enable TypeScript check in templates.
([#1093](#1093))

- Fix a bug in ReactLynx Testing Library that rendered snapshot of
inline style was normalized incorrectly (eg. `flex:1` was normalized to
`flex: 1 1 0%;` incorrectly).
([#1040](#1040))

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

### Patch Changes

- Support `@lynx-js/react` v0.110.0.
([#770](#770))

- Updated dependencies
\[[`f84a1cc`](f84a1cc),
[`0d151db`](0d151db),
[`0d151db`](0d151db),
[`51676ed`](51676ed),
[`0d151db`](0d151db),
[`a43ae05`](a43ae05),
[`0a0ef40`](0a0ef40),
[`9b61210`](9b61210)]:
    -   @lynx-js/react-alias-rsbuild-plugin@0.10.4
    -   @lynx-js/react-webpack-plugin@0.6.16
    -   @lynx-js/css-extract-webpack-plugin@0.6.0
    -   @lynx-js/template-webpack-plugin@0.8.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.3
    -   @lynx-js/use-sync-external-store@1.5.0

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

### Patch Changes

- Replace `enhanced-resolve` with `unrs-resolver`
([#936](#936))

## @lynx-js/testing-environment@0.1.1

### Patch Changes

- Fix `getJSContext` or `getCoreContext` is not a function.
([#1122](#1122))

## @lynx-js/tailwind-preset@0.0.4

### Patch Changes

- Avoid publishing test files.
([#1125](#1125))

## @lynx-js/offscreen-document@0.1.2

### Patch Changes

- refactor: make the opcode be a plain array
([#1051](#1051))

    \#1042

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

### Patch Changes

- feat: add `_SetSourceMapRelease(errInfo)` MTS API.
([#1118](#1118))

You can get `errInfo.release` through `e.detail.release` in the error
event callback of lynx-view.

The `_SetSourceMapRelease` function is not complete yet, because it is
currently limited by the Web platform and some functions and some props
such as `err.stack` do not need to be supported for the time being.

- feat: add `_I18nResourceTranslation` api in mts &&
`init-i18n-resources` attr, `i18nResourceMissed` event of lynx-view.
([#1065](#1065))

`init-i18n-resource` is the complete set of i18nResources that need to
be maintained on the container side. Note: You need to pass this value
when lynx-view is initialized.

You can use `_I18nResourceTranslation` in MTS to get the corresponding
i18nResource from `init-i18n-resources`. If it is undefined, the
`i18nResourceMissed` event will be dispatched.

    ```js
    // ui thread
    lynxView.initI18nResources = [
      {
        options: {
          locale: "en",
          channel: "1",
          fallback_url: "",
        },
        resource: {
          hello: "hello",
          lynx: "lynx web platform1",
        },
      },
    ];
    lynxView.addEventListener("i18nResourceMissed", (e) => {
      console.log(e);
    });

    // mts
    _I18nResourceTranslation({
      locale: "en",
      channel: "1",
      fallback_url: "",
    });
    ```

- feat: supports `lynx.getI18nResource()` and `onI18nResourceReady`
event in bts.
([#1088](#1088))

- `lynx.getI18nResource()` can be used to get i18nResource in bts, it
has two data sources:
        -   the result of `_I18nResourceTranslation()`
- lynx-view `updateI18nResources(data: InitI18nResources, options:
I18nResourceTranslationOptions)`, it will be matched to the correct
i8nResource as a result of `lynx.getI18nResource()`
- `onI18nResourceReady` event can be used to listen
`_I18nResourceTranslation` and lynx-view `updateI18nResources`
execution.

- refactor: make the opcode be a plain array
([#1051](#1051))

    \#1042

- feat: add `updateI18nResources` method of lynx-view.
([#1085](#1085))

Now you can use `updateI18nResources` to update i18nResources, and then
use \_I18nResourceTranslation() to get the updated result.

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

## @lynx-js/web-core-server@0.14.0

### Patch Changes

- feat: add `_SetSourceMapRelease(errInfo)` MTS API.
([#1118](#1118))

You can get `errInfo.release` through `e.detail.release` in the error
event callback of lynx-view.

The `_SetSourceMapRelease` function is not complete yet, because it is
currently limited by the Web platform and some functions and some props
such as `err.stack` do not need to be supported for the time being.

- feat: add `_I18nResourceTranslation` api in mts &&
`init-i18n-resources` attr, `i18nResourceMissed` event of lynx-view.
([#1065](#1065))

`init-i18n-resource` is the complete set of i18nResources that need to
be maintained on the container side. Note: You need to pass this value
when lynx-view is initialized.

You can use `_I18nResourceTranslation` in MTS to get the corresponding
i18nResource from `init-i18n-resources`. If it is undefined, the
`i18nResourceMissed` event will be dispatched.

    ```js
    // ui thread
    lynxView.initI18nResources = [
      {
        options: {
          locale: "en",
          channel: "1",
          fallback_url: "",
        },
        resource: {
          hello: "hello",
          lynx: "lynx web platform1",
        },
      },
    ];
    lynxView.addEventListener("i18nResourceMissed", (e) => {
      console.log(e);
    });

    // mts
    _I18nResourceTranslation({
      locale: "en",
      channel: "1",
      fallback_url: "",
    });
    ```

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

### Patch Changes

- fix: incorrect syntax for x-canvas part
([#1067](#1067))

- feat: x-input && x-textarea add attribute input-filter, which can
filter input value.
([#1037](#1037))

- fix: incorrect top style of x-foldview-slot-ng if the toolbar is
wrapped in lynx-wrapper
([#1101](#1101))

- perf: add loading="lazy" for image element
([#1056](#1056))


<https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading>

- fix: --lynx-color will be removed, and if color contains `gradient` it
will be processed as transparent.
([#1069](#1069))

- Updated dependencies
\[[`62d1078`](62d1078)]:
    -   @lynx-js/web-elements-template@0.7.6

## @lynx-js/web-elements-template@0.7.6

### Patch Changes

- perf: add loading="lazy" for image element
([#1056](#1056))


<https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading>

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

### Patch Changes

- feat: add `_SetSourceMapRelease(errInfo)` MTS API.
([#1118](#1118))

You can get `errInfo.release` through `e.detail.release` in the error
event callback of lynx-view.

The `_SetSourceMapRelease` function is not complete yet, because it is
currently limited by the Web platform and some functions and some props
such as `err.stack` do not need to be supported for the time being.

- feat: add `_I18nResourceTranslation` api in mts &&
`init-i18n-resources` attr, `i18nResourceMissed` event of lynx-view.
([#1065](#1065))

`init-i18n-resource` is the complete set of i18nResources that need to
be maintained on the container side. Note: You need to pass this value
when lynx-view is initialized.

You can use `_I18nResourceTranslation` in MTS to get the corresponding
i18nResource from `init-i18n-resources`. If it is undefined, the
`i18nResourceMissed` event will be dispatched.

    ```js
    // ui thread
    lynxView.initI18nResources = [
      {
        options: {
          locale: "en",
          channel: "1",
          fallback_url: "",
        },
        resource: {
          hello: "hello",
          lynx: "lynx web platform1",
        },
      },
    ];
    lynxView.addEventListener("i18nResourceMissed", (e) => {
      console.log(e);
    });

    // mts
    _I18nResourceTranslation({
      locale: "en",
      channel: "1",
      fallback_url: "",
    });
    ```

- feat: supports `lynx.getI18nResource()` and `onI18nResourceReady`
event in bts.
([#1088](#1088))

- `lynx.getI18nResource()` can be used to get i18nResource in bts, it
has two data sources:
        -   the result of `_I18nResourceTranslation()`
- lynx-view `updateI18nResources(data: InitI18nResources, options:
I18nResourceTranslationOptions)`, it will be matched to the correct
i8nResource as a result of `lynx.getI18nResource()`
- `onI18nResourceReady` event can be used to listen
`_I18nResourceTranslation` and lynx-view `updateI18nResources`
execution.

- feat: add `updateI18nResources` method of lynx-view.
([#1085](#1085))

Now you can use `updateI18nResources` to update i18nResources, and then
use \_I18nResourceTranslation() to get the updated result.

- fix: `decodeCssInJs` will not throw error.
([#1120](#1120))

Before this pr, decoding css will be strictly executed according to
cssInfo, and an error will be thrown if data that does not meet the
requirements is encountered. Now it is changed to console.warn, which
will not block rendering.

- Updated dependencies
\[[`25a04c9`](25a04c9),
[`0dbb8b1`](0dbb8b1),
[`f99de1e`](f99de1e),
[`873a285`](873a285),
[`afacb2c`](afacb2c),
[`7e73450`](7e73450)]:
    -   @lynx-js/web-constants@0.14.0
    -   @lynx-js/web-style-transformer@0.3.1

## @lynx-js/web-platform-rsbuild-plugin@0.1.1

### Patch Changes

- Fix build on Windows
([#1048](#1048))

## @lynx-js/web-style-transformer@0.3.1

### Patch Changes

- fix: --lynx-color will be removed, and if color contains `gradient` it
will be processed as transparent.
([#1069](#1069))

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

### Patch Changes

- fix: The parameter config of loadCard needs to add updateData,
otherwise some event binding will fail when enableJSDataProcessor is
turned on.
([#1077](#1077))

- feat: add `_I18nResourceTranslation` api in mts &&
`init-i18n-resources` attr, `i18nResourceMissed` event of lynx-view.
([#1065](#1065))

`init-i18n-resource` is the complete set of i18nResources that need to
be maintained on the container side. Note: You need to pass this value
when lynx-view is initialized.

You can use `_I18nResourceTranslation` in MTS to get the corresponding
i18nResource from `init-i18n-resources`. If it is undefined, the
`i18nResourceMissed` event will be dispatched.

    ```js
    // ui thread
    lynxView.initI18nResources = [
      {
        options: {
          locale: "en",
          channel: "1",
          fallback_url: "",
        },
        resource: {
          hello: "hello",
          lynx: "lynx web platform1",
        },
      },
    ];
    lynxView.addEventListener("i18nResourceMissed", (e) => {
      console.log(e);
    });

    // mts
    _I18nResourceTranslation({
      locale: "en",
      channel: "1",
      fallback_url: "",
    });
    ```

- feat: supports `lynx.getI18nResource()` and `onI18nResourceReady`
event in bts.
([#1088](#1088))

- `lynx.getI18nResource()` can be used to get i18nResource in bts, it
has two data sources:
        -   the result of `_I18nResourceTranslation()`
- lynx-view `updateI18nResources(data: InitI18nResources, options:
I18nResourceTranslationOptions)`, it will be matched to the correct
i8nResource as a result of `lynx.getI18nResource()`
- `onI18nResourceReady` event can be used to listen
`_I18nResourceTranslation` and lynx-view `updateI18nResources`
execution.

- feat: add `updateI18nResources` method of lynx-view.
([#1085](#1085))

Now you can use `updateI18nResources` to update i18nResources, and then
use \_I18nResourceTranslation() to get the updated result.

- Updated dependencies
\[[`25a04c9`](25a04c9),
[`0dbb8b1`](0dbb8b1),
[`f99de1e`](f99de1e),
[`873a285`](873a285),
[`afacb2c`](afacb2c),
[`1861cbe`](1861cbe)]:
    -   @lynx-js/web-mainthread-apis@0.14.0
    -   @lynx-js/web-constants@0.14.0
    -   @lynx-js/offscreen-document@0.1.2
    -   @lynx-js/web-worker-rpc@0.14.0

## @lynx-js/react-webpack-plugin@0.6.16

### Patch Changes

- Supports `@lynx-js/template-webpack-plugin` 0.8.0.
([#1033](#1033))

- Support `@lynx-js/react` v0.110.0.
([#770](#770))

- Keep snapshot id unchanged on Windows.
([#1050](#1050))

- Fix lazy bundle name on Windows.
([#1060](#1060))

## @lynx-js/rspeedy@0.9.10



## upgrade-rspeedy@0.9.10



## @lynx-js/web-worker-rpc@0.14.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.

2 participants