From d9c0752bc9b2a0c9aebe462cd12cf5349a63ad85 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Mon, 26 Jan 2026 20:13:16 +0800 Subject: [PATCH 01/12] feat: support bundle and load css in external bundle --- .changeset/thick-needles-rest.md | 7 + .../lynx-bundle-rslib-config/package.json | 5 +- .../webpack/ExternalBundleWebpackPlugin.ts | 46 ++++++- .../src/webpack/css/ast.ts | 15 +++ .../src/webpack/css/cssChunksToMap.ts | 47 +++++++ .../src/webpack/css/debundle.ts | 121 ++++++++++++++++++ .../src/webpack/css/index.ts | 15 +++ .../src/webpack/css/plugins/index.ts | 4 + packages/rspeedy/plugin-react/src/css.ts | 17 +++ .../plugin-react/src/pluginReactLynx.ts | 4 +- .../src/index.ts | 27 +++- pnpm-lock.yaml | 9 ++ 12 files changed, 305 insertions(+), 12 deletions(-) create mode 100644 .changeset/thick-needles-rest.md create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts diff --git a/.changeset/thick-needles-rest.md b/.changeset/thick-needles-rest.md new file mode 100644 index 0000000000..7cf9c6e75a --- /dev/null +++ b/.changeset/thick-needles-rest.md @@ -0,0 +1,7 @@ +--- +"@lynx-js/externals-loading-webpack-plugin": patch +"@lynx-js/lynx-bundle-rslib-config": patch +"@lynx-js/react-rsbuild-plugin": patch +--- + +Support bundle and load css in external bundle diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index 4a8ef33eb7..41eabfc1d5 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -36,14 +36,17 @@ "test": "vitest" }, "dependencies": { + "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.20" + "@lynx-js/tasm": "0.0.20", + "css-tree": "^3.1.0" }, "devDependencies": { "@lynx-js/react": "workspace:*", "@lynx-js/react-rsbuild-plugin": "workspace:*", "@lynx-js/vitest-setup": "workspace:*", "@rslib/core": "^0.19.1", + "@types/css-tree": "^2.3.11", "vitest": "^3.2.4", "webpack": "^5.104.1" }, diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts index 4f1cb11505..cfcc99f5a1 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts @@ -3,6 +3,9 @@ // LICENSE file in the root directory of this source tree. import type { Asset, Compilation, Compiler } from 'webpack' +import { cssChunksToMap } from './css/index.js' +import type { LynxStyleNode } from './css/index.js' + /** * The options for {@link ExternalBundleWebpackPlugin}. * @@ -112,18 +115,49 @@ export class ExternalBundleWebpackPlugin { async #encode(assets: Readonly[]) { const customSections = assets - .filter(({ name }) => name.endsWith('.js')) - .reduce>((prev, cur) => ({ - ...prev, - [cur.name.replace(/\.js$/, '')]: { - content: cur.source.source().toString(), + .reduce< + Record + >( + (prev, cur) => { + switch (cur.info['assetType']) { + case 'javascript': + return ({ + ...prev, + [cur.name.replace(/\.js$/, '')]: { + content: cur.source.source().toString(), + }, + }) + case 'extract-css': + return ({ + ...prev, + [`${cur.name.replace(/\.css$/, '')}:CSS`]: { + 'encoding': 'CSS', + content: { + ruleList: cssChunksToMap( + [cur.source.source().toString()], + [], + true, + ).cssMap[0] ?? [], + }, + }, + }) + default: + return prev + } }, - }), {}) + {}, + ) const compilerOptions: Record = { enableFiberArch: true, // `lynx.fetchBundle` and `lynx.loadScript` require engineVersion >= 3.5 targetSdkVersion: this.options.engineVersion ?? '3.5', + enableCSSInvalidation: true, + enableCSSSelector: true, } const encodeOptions = { diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts new file mode 100644 index 0000000000..01fe042552 --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts @@ -0,0 +1,15 @@ +// 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 * as CSS from '@lynx-js/css-serializer' +import type { Plugin } from '@lynx-js/css-serializer' + +export function cssToAst( + content: string, + plugins: Plugin[], +): [CSS.LynxStyleNode[], CSS.ParserError[]] { + const parsedCSS = CSS.parse(content, { + plugins, + }) + return [parsedCSS.root, parsedCSS.errors] as const +} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts new file mode 100644 index 0000000000..0fd705020c --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts @@ -0,0 +1,47 @@ +// 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 * as CSS from '@lynx-js/css-serializer' + +import { cssToAst } from './ast.js' +import { debundleCSS } from './debundle.js' + +export function cssChunksToMap( + cssChunks: string[], + plugins: CSS.Plugin[], + enableCSSSelector: boolean, +): { + cssMap: Record + cssSource: Record + contentMap: Map +} { + const cssMap = cssChunks + .reduce>((cssMap, css) => { + debundleCSS(css, cssMap, enableCSSSelector) + return cssMap + }, new Map()) + + return { + cssMap: Object.fromEntries( + Array.from(cssMap.entries()).map(([cssId, content]) => { + const [root] = cssToAst(content.join('\n'), plugins) + + root.forEach(rule => { + if (rule.type === 'ImportRule') { + // For example: '/981029' -> '981029' + rule.href = rule.href.replace('/', '') + } + }) + + return [cssId, root] + }), + ), + cssSource: Object.fromEntries( + Array.from(cssMap.keys()).map(cssId => [ + cssId, + `/cssId/${cssId}.css`, + ]), + ), + contentMap: cssMap, + } +} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts new file mode 100644 index 0000000000..3169f1e27b --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts @@ -0,0 +1,121 @@ +// 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 * as cssTree from 'css-tree' + +// `COMMON_CSS` is the global styles that applies to all the elements. +// It should always has `cssId: 0`. +const COMMON_CSS = '/common.css' +const COMMON_CSS_ID = 0 + +export function debundleCSS( + code: string, + css: Map, + enableCSSSelector: boolean, +): void { + const ast = cssTree.parse(code) + + const fileKeyToCSSContent = new Map() + const cssIdToFileKeys = new Map>() + const fileKeyToCSSId = new Map([[COMMON_CSS, COMMON_CSS_ID]]) + + cssTree.walk(ast, { + visit: 'Atrule', + enter(node, item, list) { + if ( + node.type === 'Atrule' && node.prelude + && node.prelude.type === 'AtrulePrelude' // Minify/Format will change `cssId` to `cssid`. + && node.name.toLowerCase() === 'cssId'.toLowerCase() + ) { + // @cssId "842372" "foo.css" {} + const [cssIdNode, fileKeyNode] = node.prelude.children.toArray() + .filter(({ type }) => type !== 'WhiteSpace') + if ( + cssIdNode?.type === 'String' + && fileKeyNode?.type === 'String' + && node.block + ) { + const cssId = Number(cssIdNode.value) + + if (Number.isNaN(cssId)) { + throw new Error( + `Invalid cssId: @cssId "${cssIdNode.value}" "${fileKeyNode.value}"`, + ) + } + + const fileKey = fileKeyNode.value + + let fileKeys = cssIdToFileKeys.get(cssId) + if (typeof fileKeys === 'undefined') { + // Every file should import COMMON_CSS(cssId: 0). + // Otherwise, the global styles cannot be resolved by elements. + fileKeys = new Set([COMMON_CSS]) + cssIdToFileKeys.set(cssId, fileKeys) + } + fileKeys.add(fileKey) + if (!fileKeyToCSSContent.has(fileKey)) { + fileKeyToCSSContent.set( + fileKey, + cssTree.generate({ + type: 'StyleSheet', + children: node.block.children, + }), + ) + } + } + list.remove(item) + } + }, + }) + + // If there are Rules left in the AST(e.g.: some rules that are not in `@file {}`), + // we treat them as global styles. Global styles should be added to COMMON_CSS(cssId: 0). + const commonCss = cssTree.generate(ast) + if (commonCss) { + emplaceCSSStyleSheet(css, COMMON_CSS_ID, commonCss) + } + + // TODO: resolve conflict with scoped cssId + // E.g.: we may generate a cssId hash that is equal to the index of source files. + // + // For each CSS source file, we create a CSSStyleSheet. + // The scoped CSSStyleSheet will use `@import` to reference all the imported CSSStyleSheets. + // + // Note that the `Map.prototype.keys()` returns an iterator in insertion order. + // This will make sure that the stylesheets are created in the same order of CSS. + Array.from(fileKeyToCSSContent.keys()).forEach((fileKey, index) => { + // Starts from 1 + // 0 is the common CSS + index = index + 1 + fileKeyToCSSId.set(fileKey, index) + emplaceCSSStyleSheet(css, index, fileKeyToCSSContent.get(fileKey)) + }) + // TODO: remove /cssId/0.css if not exists in the cssMap + + // For each scoped CSSStyleSheet, we should import the real CSSStyleSheet. + // So that the styles can be resolved with the scoped cssId. + cssIdToFileKeys.forEach((rawFileKeys, cssId) => { + let fileKeys = Array.from(rawFileKeys) + if (enableCSSSelector === false) { + // When enableCSSSelector is false, style rule priority is inversely related to @import order, + // requiring reversed imports to maintain correct priority. + fileKeys = fileKeys.reverse() + } + emplaceCSSStyleSheet( + css, + cssId, + Array.from(fileKeys).map(fileKey => + `@import "${fileKeyToCSSId.get(fileKey)}";` + ).join('\n'), + ) + }) +} + +function emplaceCSSStyleSheet(map: Map, key: K, value: V) { + if (map.has(key)) { + map.get(key)!.push(value) + } else { + map.set(key, [value]) + } +} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts new file mode 100644 index 0000000000..f96bb45a03 --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts @@ -0,0 +1,15 @@ +// 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. +export { csstree, Plugins, parse } from '@lynx-js/css-serializer' +export type { + Plugin, + Declaration, + LynxStyleNode, + // Rules + StyleRule, + FontFaceRule, + ImportRule, + KeyframesRule, +} from '@lynx-js/css-serializer' +export { cssChunksToMap } from './cssChunksToMap.js' diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts new file mode 100644 index 0000000000..688752d4ec --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts @@ -0,0 +1,4 @@ +// 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. +export { Plugins as parserPlugins } from '@lynx-js/css-serializer' diff --git a/packages/rspeedy/plugin-react/src/css.ts b/packages/rspeedy/plugin-react/src/css.ts index 47955e8661..a5ac9777fe 100644 --- a/packages/rspeedy/plugin-react/src/css.ts +++ b/packages/rspeedy/plugin-react/src/css.ts @@ -61,12 +61,14 @@ export function applyCSS( const rule = chain.module.rule(ruleName) removeLightningCSS(rule) + removeIgnoreCSS(rule) // Replace the CssExtractRspackPlugin.loader with ours. // This is for scoped CSS. rule .issuerLayer(LAYERS.BACKGROUND) .use(CHAIN_ID.USE.MINI_CSS_EXTRACT) + .before(CHAIN_ID.USE.CSS) .loader(CssExtractPlugin.loader) .end() @@ -140,6 +142,21 @@ export function applyCSS( rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS) } } + function removeIgnoreCSS(rule: ReturnType) { + if ( + // Rslib has a builtin ignore-css-loader + // We need to remove it and use our own ignore-css-loader + rule.uses.has(CHAIN_ID.USE.IGNORE_CSS) + ) { + rule.uses.delete(CHAIN_ID.USE.IGNORE_CSS) + } + } + + if (!chain.plugins.has(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT)) { + chain + .plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT) + .use(CssExtractPlugin) + } chain .plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT) diff --git a/packages/rspeedy/plugin-react/src/pluginReactLynx.ts b/packages/rspeedy/plugin-react/src/pluginReactLynx.ts index cee200a161..c73b921824 100644 --- a/packages/rspeedy/plugin-react/src/pluginReactLynx.ts +++ b/packages/rspeedy/plugin-react/src/pluginReactLynx.ts @@ -343,9 +343,7 @@ export function pluginReactLynx( }) } - if (!isRslib) { - applyCSS(api, resolvedOptions) - } + applyCSS(api, resolvedOptions) applyEntry(api, resolvedOptions) applyBackgroundOnly(api) applyGenerator(api, resolvedOptions) diff --git a/packages/webpack/externals-loading-webpack-plugin/src/index.ts b/packages/webpack/externals-loading-webpack-plugin/src/index.ts index 782ec78ec7..f5b318c7dd 100644 --- a/packages/webpack/externals-loading-webpack-plugin/src/index.ts +++ b/packages/webpack/externals-loading-webpack-plugin/src/index.ts @@ -299,6 +299,7 @@ export class ExternalsLoadingPlugin { } else { return ''; } + const isMainThreadLayer = layer === 'mainThread'; for ( const [pkgName, external] of Object.entries( externalsLoadingPluginOptions.externals, @@ -323,9 +324,20 @@ function createLoadExternalAsync(handler, sectionPath) { if (response.code === 0) { try { const result = lynx.loadScript(sectionPath, { bundleName: response.url }); + ${ + isMainThreadLayer + ? ` + const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url); + if (styleSheet !== null) { + __AdoptStyleSheet(styleSheet); + __FlushElementTree(); + } + ` + : '' + } resolve(result) } catch (error) { - reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url, { cause: error })) + reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error })) } } else { reject(new Error('Failed to fetch external source ' + response.url + ' . The response is ' + JSON.stringify(response), { cause: response })); @@ -338,9 +350,20 @@ function createLoadExternalSync(handler, sectionPath, timeout) { if (response.code === 0) { try { const result = lynx.loadScript(sectionPath, { bundleName: response.url }); + ${ + isMainThreadLayer + ? ` + const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url); + if (styleSheet !== null) { + __AdoptStyleSheet(styleSheet); + __FlushElementTree(); + } + ` + : '' + } return result } catch (error) { - throw new Error('Failed to load script ' + sectionPath + ' in ' + response.url, { cause: error }) + reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error })) } } else { throw new Error('Failed to fetch external source ' + response.url + ' . The response is ' + JSON.stringify(response), { cause: response }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03fcc944cb..8c7eacdd21 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -636,12 +636,18 @@ importers: packages/rspeedy/lynx-bundle-rslib-config: dependencies: + '@lynx-js/css-serializer': + specifier: workspace:* + version: link:../../tools/css-serializer '@lynx-js/runtime-wrapper-webpack-plugin': specifier: workspace:* version: link:../../webpack/runtime-wrapper-webpack-plugin '@lynx-js/tasm': specifier: 0.0.20 version: 0.0.20 + css-tree: + specifier: ^3.1.0 + version: 3.1.0 devDependencies: '@lynx-js/react': specifier: workspace:* @@ -655,6 +661,9 @@ importers: '@rslib/core': specifier: ^0.19.1 version: 0.19.1(@microsoft/api-extractor@7.55.2(@types/node@24.6.1))(@typescript/native-preview@7.0.0-dev.20251106.1)(typescript@5.9.3) + '@types/css-tree': + specifier: ^2.3.11 + version: 2.3.11 vitest: specifier: ^3.2.4 version: 3.2.4(@types/debug@4.1.12)(@types/node@24.6.1)(@vitest/ui@3.2.4)(jsdom@27.4.0)(sass-embedded@1.90.0)(sass@1.90.0)(terser@5.31.6) From 872c04a74751eebbfa080197eb4400cd42aad5d9 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 4 Feb 2026 14:51:55 +0800 Subject: [PATCH 02/12] test: add test case for external bundle css --- .../test/external-bundle.test.ts | 33 +++++++++++++++++++ .../test/fixtures/css-lib/index.css | 3 ++ .../test/fixtures/css-lib/index.ts | 3 ++ .../src/index.ts | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.css create mode 100644 packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.ts diff --git a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts index e964b14d70..07e5a6bccf 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts @@ -167,6 +167,39 @@ describe('should build external bundle', () => { ) expect(decodedResult['engine-version']).toBe('3.5') }) + + it('should build css into external bundle', async () => { + vi.stubEnv('DEBUG', 'rsbuild,rslib,rspack') + const fixtureDir = path.join(__dirname, './fixtures/css-lib') + const rslibConfig = defineExternalBundleRslibConfig({ + source: { + entry: { + index: path.join(fixtureDir, 'index.ts'), + }, + }, + id: 'css-bundle', + output: { + distPath: { + root: path.join(fixtureDir, 'dist'), + }, + }, + plugins: [pluginReactLynx()], + }) + + await build(rslibConfig) + + const decodedResult = await decodeTemplate( + path.join(fixtureDir, 'dist', 'css-bundle.lynx.bundle'), + ) + + // Check custom-sections for CSS keys + // Note: Sections with 'encoding: CSS' might not appear in custom-sections of the decoded result + // TODO: wait for @lynx-js/tasm to support CSS encoding + expect(Object.keys(decodedResult['custom-sections']).sort()).toEqual([ + 'index', + 'index__main-thread', + ]) + }) }) describe('debug mode artifacts', () => { diff --git a/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.css b/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.css new file mode 100644 index 0000000000..8963f2c513 --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.css @@ -0,0 +1,3 @@ +.container { + color: red; +} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.ts b/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.ts new file mode 100644 index 0000000000..f27ec5542c --- /dev/null +++ b/packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/css-lib/index.ts @@ -0,0 +1,3 @@ +import './index.css' + +export const hello = 'world' diff --git a/packages/webpack/externals-loading-webpack-plugin/src/index.ts b/packages/webpack/externals-loading-webpack-plugin/src/index.ts index f5b318c7dd..86ec7faa08 100644 --- a/packages/webpack/externals-loading-webpack-plugin/src/index.ts +++ b/packages/webpack/externals-loading-webpack-plugin/src/index.ts @@ -363,7 +363,7 @@ function createLoadExternalSync(handler, sectionPath, timeout) { } return result } catch (error) { - reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error })) + throw new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error }) } } else { throw new Error('Failed to fetch external source ' + response.url + ' . The response is ' + JSON.stringify(response), { cause: response }) From 39c3de2154443f365115bb4719c178834ba2944a Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Tue, 24 Feb 2026 16:21:25 +0800 Subject: [PATCH 03/12] feat: upgrade @lynx-js/tasm and remove css import in consumer --- examples/react-externals/src/index.css | 8 ++++++++ examples/react-externals/src/index.tsx | 5 +---- .../rspeedy/lynx-bundle-rslib-config/package.json | 2 +- .../webpack/template-webpack-plugin/package.json | 2 +- pnpm-lock.yaml | 15 ++++++++------- 5 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 examples/react-externals/src/index.css diff --git a/examples/react-externals/src/index.css b/examples/react-externals/src/index.css new file mode 100644 index 0000000000..42b54243cf --- /dev/null +++ b/examples/react-externals/src/index.css @@ -0,0 +1,8 @@ +/* At least a css rule is needed in consumer + * to make sure the css engine is loaded + * so that the css in external bundles can be applied + * + * This is a limitation of Lynx engine + * we can remove this limitation in the future + */ +.dummy {} diff --git a/examples/react-externals/src/index.tsx b/examples/react-externals/src/index.tsx index d0d893b024..5bbf167939 100644 --- a/examples/react-externals/src/index.tsx +++ b/examples/react-externals/src/index.tsx @@ -3,10 +3,7 @@ import { root } from '@lynx-js/react'; import { App } from './App.js'; -// We have to manually import the css now -// TODO: load css from external bundle -// when it is supported in Lynx engine -import './App.css'; +import './index.css'; root.render( , diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index bd4f6a14c6..9f15082f5f 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -38,7 +38,7 @@ "dependencies": { "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.20", + "@lynx-js/tasm": "0.0.24", "css-tree": "^3.1.0" }, "devDependencies": { diff --git a/packages/webpack/template-webpack-plugin/package.json b/packages/webpack/template-webpack-plugin/package.json index 107a8a7433..8bfb49e091 100644 --- a/packages/webpack/template-webpack-plugin/package.json +++ b/packages/webpack/template-webpack-plugin/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@lynx-js/css-serializer": "workspace:*", - "@lynx-js/tasm": "0.0.20", + "@lynx-js/tasm": "0.0.24", "@lynx-js/webpack-runtime-globals": "workspace:^", "@rspack/lite-tapable": "1.1.0", "css-tree": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a2b63b4989..46ae5bc960 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -693,8 +693,8 @@ importers: specifier: workspace:* version: link:../../webpack/runtime-wrapper-webpack-plugin '@lynx-js/tasm': - specifier: 0.0.20 - version: 0.0.20 + specifier: 0.0.24 + version: 0.0.24 css-tree: specifier: ^3.1.0 version: 3.1.0 @@ -1611,8 +1611,8 @@ importers: specifier: workspace:* version: link:../../tools/css-serializer '@lynx-js/tasm': - specifier: 0.0.20 - version: 0.0.20 + specifier: 0.0.24 + version: 0.0.24 '@lynx-js/webpack-runtime-globals': specifier: workspace:^ version: link:../webpack-runtime-globals @@ -3182,8 +3182,8 @@ packages: '@lynx-js/preact-devtools@5.0.1': resolution: {integrity: sha512-ayUU8PJ0TVWABbd5/d/04KI18W9RY4kkaRekBXXbRE/eBkGMZ3lVJ0zOB+B+85B9RUpvEVK2FleqJkS+qBKG6Q==} - '@lynx-js/tasm@0.0.20': - resolution: {integrity: sha512-ezMq43s59jqFuQ1YygpsUuZmGXw4XH+00RsB5RVmkYZuHQxEaLt/ECTOixF+9RixvAyhmxzF2eSURvmNckO9xg==} + '@lynx-js/tasm@0.0.24': + resolution: {integrity: sha512-nf5MChA2r3B6y+xfkXGOymdkFlHOJuScevcfS5sfX9lQNmDkf/3u+/CC7l7mLUCMvJkj0G0KXWXZqqyJmiuk+g==} '@lynx-js/type-config@3.6.0': resolution: {integrity: sha512-XS+Wdbs77iWaVqrs1HKp3LyTLLHbu/AwLwy837BinmyNO28YunkgnOz0dmuzjnGGsbKJB3Alm7RoYrH/PAsVuQ==} @@ -8240,6 +8240,7 @@ packages: engines: {node: '>=0.6.0', teleport: '>=0.2.0'} deprecated: |- You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. + (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) qs@6.13.0: @@ -11712,7 +11713,7 @@ snapshots: errorstacks: 2.4.1 htm: 3.1.1 - '@lynx-js/tasm@0.0.20': {} + '@lynx-js/tasm@0.0.24': {} '@lynx-js/type-config@3.6.0': {} From 7075e4aaf591aef80b3c6fb336ffd14623aa88c5 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Tue, 24 Feb 2026 17:45:46 +0800 Subject: [PATCH 04/12] feat: move `cssChunksToMap` implementation to `@lynx-js/css-serializer` --- .changeset/wet-rockets-taste.md | 6 +++ .../css-serializer}/src/css/ast.ts | 4 +- .../css-serializer}/src/css/cssChunksToMap.ts | 2 +- .../css-serializer}/src/css/debundle.ts | 0 .../css-serializer/src/css}/index.ts | 2 +- packages/tools/css-serializer/src/index.ts | 1 + .../css-serializer}/test/css.test.ts | 9 ++-- .../tools/css-serializer/vitest.config.ts | 2 +- .../etc/template-webpack-plugin.api.md | 48 ++++--------------- .../src/LynxTemplatePlugin.ts | 2 +- .../src/WebEncodePlugin.ts | 2 +- .../template-webpack-plugin/src/css/index.ts | 15 ------ .../template-webpack-plugin/src/index.ts | 11 ++++- .../src/web/genStyleInfo.ts | 3 +- 14 files changed, 40 insertions(+), 67 deletions(-) create mode 100644 .changeset/wet-rockets-taste.md rename packages/{webpack/template-webpack-plugin => tools/css-serializer}/src/css/ast.ts (80%) rename packages/{webpack/template-webpack-plugin => tools/css-serializer}/src/css/cssChunksToMap.ts (96%) rename packages/{webpack/template-webpack-plugin => tools/css-serializer}/src/css/debundle.ts (100%) rename packages/{webpack/template-webpack-plugin/src/css/plugins => tools/css-serializer/src/css}/index.ts (73%) rename packages/{webpack/template-webpack-plugin => tools/css-serializer}/test/css.test.ts (99%) delete mode 100644 packages/webpack/template-webpack-plugin/src/css/index.ts diff --git a/.changeset/wet-rockets-taste.md b/.changeset/wet-rockets-taste.md new file mode 100644 index 0000000000..925f30e801 --- /dev/null +++ b/.changeset/wet-rockets-taste.md @@ -0,0 +1,6 @@ +--- +"@lynx-js/template-webpack-plugin": patch +"@lynx-js/css-serializer": patch +--- + +Move `cssChunksToMap` implementation from `@lynx-js/template-webpack-plugin` to `@lynx-js/css-serializer` for future reuse. diff --git a/packages/webpack/template-webpack-plugin/src/css/ast.ts b/packages/tools/css-serializer/src/css/ast.ts similarity index 80% rename from packages/webpack/template-webpack-plugin/src/css/ast.ts rename to packages/tools/css-serializer/src/css/ast.ts index f6a3ff07e9..e31e4815d3 100644 --- a/packages/webpack/template-webpack-plugin/src/css/ast.ts +++ b/packages/tools/css-serializer/src/css/ast.ts @@ -1,8 +1,8 @@ // 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 * as CSS from '@lynx-js/css-serializer'; -import type { Plugin } from '@lynx-js/css-serializer'; +import * as CSS from '../index.js'; +import type { Plugin } from '../index.js'; export function cssToAst( content: string, diff --git a/packages/webpack/template-webpack-plugin/src/css/cssChunksToMap.ts b/packages/tools/css-serializer/src/css/cssChunksToMap.ts similarity index 96% rename from packages/webpack/template-webpack-plugin/src/css/cssChunksToMap.ts rename to packages/tools/css-serializer/src/css/cssChunksToMap.ts index e2cbfe1cfb..79b9f428a2 100644 --- a/packages/webpack/template-webpack-plugin/src/css/cssChunksToMap.ts +++ b/packages/tools/css-serializer/src/css/cssChunksToMap.ts @@ -1,7 +1,7 @@ // 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 * as CSS from '@lynx-js/css-serializer'; +import type * as CSS from '../index.js'; import { cssToAst } from './ast.js'; import { debundleCSS } from './debundle.js'; diff --git a/packages/webpack/template-webpack-plugin/src/css/debundle.ts b/packages/tools/css-serializer/src/css/debundle.ts similarity index 100% rename from packages/webpack/template-webpack-plugin/src/css/debundle.ts rename to packages/tools/css-serializer/src/css/debundle.ts diff --git a/packages/webpack/template-webpack-plugin/src/css/plugins/index.ts b/packages/tools/css-serializer/src/css/index.ts similarity index 73% rename from packages/webpack/template-webpack-plugin/src/css/plugins/index.ts rename to packages/tools/css-serializer/src/css/index.ts index 11ecec36c8..52b3884773 100644 --- a/packages/webpack/template-webpack-plugin/src/css/plugins/index.ts +++ b/packages/tools/css-serializer/src/css/index.ts @@ -1,4 +1,4 @@ // 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. -export { Plugins as parserPlugins } from '@lynx-js/css-serializer'; +export { cssChunksToMap } from './cssChunksToMap.js'; diff --git a/packages/tools/css-serializer/src/index.ts b/packages/tools/css-serializer/src/index.ts index 46bdb0f90e..cecf59375f 100644 --- a/packages/tools/css-serializer/src/index.ts +++ b/packages/tools/css-serializer/src/index.ts @@ -7,3 +7,4 @@ export * as csstree from 'css-tree'; export * as Plugins from './plugins/index.js'; export type * from './types/index.js'; export { parse } from './parse.js'; +export * from './css/index.js'; diff --git a/packages/webpack/template-webpack-plugin/test/css.test.ts b/packages/tools/css-serializer/test/css.test.ts similarity index 99% rename from packages/webpack/template-webpack-plugin/test/css.test.ts rename to packages/tools/css-serializer/test/css.test.ts index bb3bcb4ed8..60b3457ad1 100644 --- a/packages/webpack/template-webpack-plugin/test/css.test.ts +++ b/packages/tools/css-serializer/test/css.test.ts @@ -3,11 +3,14 @@ // LICENSE file in the root directory of this source tree. import { describe, expect, test } from 'vitest'; -import type { LynxStyleNode } from '@lynx-js/css-serializer'; +import type { LynxStyleNode } from '../src'; -import { cssChunksToMap } from '../src/css/cssChunksToMap.js'; +import { cssChunksToMap, Plugins as parserPlugins } from '../src'; import { debundleCSS } from '../src/css/debundle.js'; -import { CSSPlugins } from '../src/index.js'; + +const CSSPlugins = { + parserPlugins, +}; describe('CSS', () => { describe('cssChunksToMap', () => { diff --git a/packages/tools/css-serializer/vitest.config.ts b/packages/tools/css-serializer/vitest.config.ts index 2eb5f149a2..8b96ba532e 100644 --- a/packages/tools/css-serializer/vitest.config.ts +++ b/packages/tools/css-serializer/vitest.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { - include: ['**/test/*.spec.ts'], + include: ['**/test/*.spec.ts', '**/test/*.test.ts'], name: 'tools/css-serializer', }, }); diff --git a/packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md b/packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md index 1e75f58964..1d2994c9d1 100644 --- a/packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md +++ b/packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md @@ -9,50 +9,20 @@ import { AsyncSeriesBailHook } from '@rspack/lite-tapable'; import { AsyncSeriesWaterfallHook } from '@rspack/lite-tapable'; import type { Compilation } from 'webpack'; import type { Compiler } from 'webpack'; -import type * as CSS_2 from '@lynx-js/css-serializer'; -import { csstree } from '@lynx-js/css-serializer'; -import { Declaration } from '@lynx-js/css-serializer'; -import { FontFaceRule } from '@lynx-js/css-serializer'; -import { ImportRule } from '@lynx-js/css-serializer'; -import { KeyframesRule } from '@lynx-js/css-serializer'; -import { LynxStyleNode } from '@lynx-js/css-serializer'; -import { parse } from '@lynx-js/css-serializer'; -import { Plugin } from '@lynx-js/css-serializer'; +import * as CSS from '@lynx-js/css-serializer'; +import { cssChunksToMap } from '@lynx-js/css-serializer'; import { Plugins } from '@lynx-js/css-serializer'; -import { StyleRule } from '@lynx-js/css-serializer'; import { SyncWaterfallHook } from '@rspack/lite-tapable'; -declare namespace CSS { - export { - csstree, - Plugins, - parse, - Plugin, - Declaration, - LynxStyleNode, - StyleRule, - FontFaceRule, - ImportRule, - KeyframesRule, - cssChunksToMap - } -} +export { CSS } -// Warning: (ae-missing-release-tag) "cssChunksToMap" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "CSSPlugins" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -function cssChunksToMap(cssChunks: string[], plugins: CSS_2.Plugin[], enableCSSSelector: boolean): { - cssMap: Record; - cssSource: Record; - contentMap: Map; +export const CSSPlugins: { + parserPlugins: typeof Plugins; }; -declare namespace CSSPlugins { - export { - Plugins as parserPlugins - } -} - // @public export interface EncodeOptions { // (undocumented) @@ -98,8 +68,8 @@ export interface LynxEncodePluginOptions { export class LynxTemplatePlugin { constructor(options?: LynxTemplatePluginOptions | undefined); apply(compiler: Compiler): void; - static convertCSSChunksToMap(cssChunks: string[], plugins: CSS_2.Plugin[], enableCSSSelector: boolean): { - cssMap: Record; + static convertCSSChunksToMap(cssChunks: string[], plugins: CSS.Plugin[], enableCSSSelector: boolean): { + cssMap: Record; cssSource: Record; }; static defaultOptions: Readonly>; @@ -109,7 +79,7 @@ export class LynxTemplatePlugin { // @public export interface LynxTemplatePluginOptions { chunks?: 'all' | string[]; - cssPlugins: CSS_2.Plugin[]; + cssPlugins: CSS.Plugin[]; customCSSInheritanceList: string[] | undefined; debugInfoOutside: boolean; defaultDisplayLinear: boolean; diff --git a/packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts b/packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts index 5f16bda3ea..574cd61ad4 100644 --- a/packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts +++ b/packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts @@ -20,9 +20,9 @@ import type { } from 'webpack'; import type * as CSS from '@lynx-js/css-serializer'; +import { cssChunksToMap } from '@lynx-js/css-serializer'; import { RuntimeGlobals } from '@lynx-js/webpack-runtime-globals'; -import { cssChunksToMap } from './css/cssChunksToMap.js'; import { createLynxAsyncChunksRuntimeModule } from './LynxAsyncChunksRuntimeModule.js'; export type OriginManifest = Record, From 79a3613debe53454fd5683e9f2b9f8052a931b31 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Tue, 24 Feb 2026 19:37:46 +0800 Subject: [PATCH 05/12] feat: use cssChunksToMap from `@lynx-js/css-serializer` --- .../webpack/ExternalBundleWebpackPlugin.ts | 4 +- .../src/webpack/css/ast.ts | 15 --- .../src/webpack/css/cssChunksToMap.ts | 47 ------- .../src/webpack/css/debundle.ts | 121 ------------------ .../src/webpack/css/index.ts | 15 --- .../src/webpack/css/plugins/index.ts | 4 - 6 files changed, 2 insertions(+), 204 deletions(-) delete mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts delete mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts delete mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts delete mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts delete mode 100644 packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts index cfcc99f5a1..088274bb23 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts @@ -3,8 +3,8 @@ // LICENSE file in the root directory of this source tree. import type { Asset, Compilation, Compiler } from 'webpack' -import { cssChunksToMap } from './css/index.js' -import type { LynxStyleNode } from './css/index.js' +import { cssChunksToMap } from '@lynx-js/css-serializer' +import type { LynxStyleNode } from '@lynx-js/css-serializer' /** * The options for {@link ExternalBundleWebpackPlugin}. diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts deleted file mode 100644 index 01fe042552..0000000000 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/ast.ts +++ /dev/null @@ -1,15 +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 * as CSS from '@lynx-js/css-serializer' -import type { Plugin } from '@lynx-js/css-serializer' - -export function cssToAst( - content: string, - plugins: Plugin[], -): [CSS.LynxStyleNode[], CSS.ParserError[]] { - const parsedCSS = CSS.parse(content, { - plugins, - }) - return [parsedCSS.root, parsedCSS.errors] as const -} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts deleted file mode 100644 index 0fd705020c..0000000000 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/cssChunksToMap.ts +++ /dev/null @@ -1,47 +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 * as CSS from '@lynx-js/css-serializer' - -import { cssToAst } from './ast.js' -import { debundleCSS } from './debundle.js' - -export function cssChunksToMap( - cssChunks: string[], - plugins: CSS.Plugin[], - enableCSSSelector: boolean, -): { - cssMap: Record - cssSource: Record - contentMap: Map -} { - const cssMap = cssChunks - .reduce>((cssMap, css) => { - debundleCSS(css, cssMap, enableCSSSelector) - return cssMap - }, new Map()) - - return { - cssMap: Object.fromEntries( - Array.from(cssMap.entries()).map(([cssId, content]) => { - const [root] = cssToAst(content.join('\n'), plugins) - - root.forEach(rule => { - if (rule.type === 'ImportRule') { - // For example: '/981029' -> '981029' - rule.href = rule.href.replace('/', '') - } - }) - - return [cssId, root] - }), - ), - cssSource: Object.fromEntries( - Array.from(cssMap.keys()).map(cssId => [ - cssId, - `/cssId/${cssId}.css`, - ]), - ), - contentMap: cssMap, - } -} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts deleted file mode 100644 index 3169f1e27b..0000000000 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/debundle.ts +++ /dev/null @@ -1,121 +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 * as cssTree from 'css-tree' - -// `COMMON_CSS` is the global styles that applies to all the elements. -// It should always has `cssId: 0`. -const COMMON_CSS = '/common.css' -const COMMON_CSS_ID = 0 - -export function debundleCSS( - code: string, - css: Map, - enableCSSSelector: boolean, -): void { - const ast = cssTree.parse(code) - - const fileKeyToCSSContent = new Map() - const cssIdToFileKeys = new Map>() - const fileKeyToCSSId = new Map([[COMMON_CSS, COMMON_CSS_ID]]) - - cssTree.walk(ast, { - visit: 'Atrule', - enter(node, item, list) { - if ( - node.type === 'Atrule' && node.prelude - && node.prelude.type === 'AtrulePrelude' // Minify/Format will change `cssId` to `cssid`. - && node.name.toLowerCase() === 'cssId'.toLowerCase() - ) { - // @cssId "842372" "foo.css" {} - const [cssIdNode, fileKeyNode] = node.prelude.children.toArray() - .filter(({ type }) => type !== 'WhiteSpace') - if ( - cssIdNode?.type === 'String' - && fileKeyNode?.type === 'String' - && node.block - ) { - const cssId = Number(cssIdNode.value) - - if (Number.isNaN(cssId)) { - throw new Error( - `Invalid cssId: @cssId "${cssIdNode.value}" "${fileKeyNode.value}"`, - ) - } - - const fileKey = fileKeyNode.value - - let fileKeys = cssIdToFileKeys.get(cssId) - if (typeof fileKeys === 'undefined') { - // Every file should import COMMON_CSS(cssId: 0). - // Otherwise, the global styles cannot be resolved by elements. - fileKeys = new Set([COMMON_CSS]) - cssIdToFileKeys.set(cssId, fileKeys) - } - fileKeys.add(fileKey) - if (!fileKeyToCSSContent.has(fileKey)) { - fileKeyToCSSContent.set( - fileKey, - cssTree.generate({ - type: 'StyleSheet', - children: node.block.children, - }), - ) - } - } - list.remove(item) - } - }, - }) - - // If there are Rules left in the AST(e.g.: some rules that are not in `@file {}`), - // we treat them as global styles. Global styles should be added to COMMON_CSS(cssId: 0). - const commonCss = cssTree.generate(ast) - if (commonCss) { - emplaceCSSStyleSheet(css, COMMON_CSS_ID, commonCss) - } - - // TODO: resolve conflict with scoped cssId - // E.g.: we may generate a cssId hash that is equal to the index of source files. - // - // For each CSS source file, we create a CSSStyleSheet. - // The scoped CSSStyleSheet will use `@import` to reference all the imported CSSStyleSheets. - // - // Note that the `Map.prototype.keys()` returns an iterator in insertion order. - // This will make sure that the stylesheets are created in the same order of CSS. - Array.from(fileKeyToCSSContent.keys()).forEach((fileKey, index) => { - // Starts from 1 - // 0 is the common CSS - index = index + 1 - fileKeyToCSSId.set(fileKey, index) - emplaceCSSStyleSheet(css, index, fileKeyToCSSContent.get(fileKey)) - }) - // TODO: remove /cssId/0.css if not exists in the cssMap - - // For each scoped CSSStyleSheet, we should import the real CSSStyleSheet. - // So that the styles can be resolved with the scoped cssId. - cssIdToFileKeys.forEach((rawFileKeys, cssId) => { - let fileKeys = Array.from(rawFileKeys) - if (enableCSSSelector === false) { - // When enableCSSSelector is false, style rule priority is inversely related to @import order, - // requiring reversed imports to maintain correct priority. - fileKeys = fileKeys.reverse() - } - emplaceCSSStyleSheet( - css, - cssId, - Array.from(fileKeys).map(fileKey => - `@import "${fileKeyToCSSId.get(fileKey)}";` - ).join('\n'), - ) - }) -} - -function emplaceCSSStyleSheet(map: Map, key: K, value: V) { - if (map.has(key)) { - map.get(key)!.push(value) - } else { - map.set(key, [value]) - } -} diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts deleted file mode 100644 index f96bb45a03..0000000000 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/index.ts +++ /dev/null @@ -1,15 +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. -export { csstree, Plugins, parse } from '@lynx-js/css-serializer' -export type { - Plugin, - Declaration, - LynxStyleNode, - // Rules - StyleRule, - FontFaceRule, - ImportRule, - KeyframesRule, -} from '@lynx-js/css-serializer' -export { cssChunksToMap } from './cssChunksToMap.js' diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.ts deleted file mode 100644 index 688752d4ec..0000000000 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/webpack/css/plugins/index.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. -export { Plugins as parserPlugins } from '@lynx-js/css-serializer' From bd1dfa65759a2014cee19811c2a672333a3845cc Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 25 Feb 2026 17:13:06 +0800 Subject: [PATCH 06/12] test: css loading in external bundle --- .../test/external-bundle.test.ts | 3 +-- .../test/helpers/setup-env.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts index 561477795e..2840f2c785 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts @@ -193,10 +193,9 @@ describe('should build external bundle', () => { ) // Check custom-sections for CSS keys - // Note: Sections with 'encoding: CSS' might not appear in custom-sections of the decoded result - // TODO: wait for @lynx-js/tasm to support CSS encoding expect(Object.keys(decodedResult['custom-sections']).sort()).toEqual([ 'index', + 'index:CSS', 'index__main-thread', ]) }) diff --git a/packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js b/packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js index db86d756ef..5eca24f24d 100644 --- a/packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js +++ b/packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js @@ -35,4 +35,14 @@ function __injectGlobals(target) { target.lynxCoreInject = {}; target.lynxCoreInject.tt = {}; + + target.__LoadStyleSheet = () => { + return {}; + }; + target.__AdoptStyleSheet = () => { + // + }; + target.__FlushElementTree = () => { + // + }; } From 3e900feeb141cffec24475548333fd85285e6539 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 25 Feb 2026 18:58:56 +0800 Subject: [PATCH 07/12] chore: upgrade @lynx-js/tasm to 0.0.25 --- .../lynx-bundle-rslib-config/package.json | 2 +- .../template-webpack-plugin/package.json | 2 +- pnpm-lock.yaml | 68 +++++++++---------- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index 9f15082f5f..e06908cd5a 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -38,7 +38,7 @@ "dependencies": { "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.24", + "@lynx-js/tasm": "0.0.25", "css-tree": "^3.1.0" }, "devDependencies": { diff --git a/packages/webpack/template-webpack-plugin/package.json b/packages/webpack/template-webpack-plugin/package.json index 8bfb49e091..dafc0980b7 100644 --- a/packages/webpack/template-webpack-plugin/package.json +++ b/packages/webpack/template-webpack-plugin/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@lynx-js/css-serializer": "workspace:*", - "@lynx-js/tasm": "0.0.24", + "@lynx-js/tasm": "0.0.25", "@lynx-js/webpack-runtime-globals": "workspace:^", "@rspack/lite-tapable": "1.1.0", "css-tree": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8138c3a3e..45a93e0bee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -265,7 +265,7 @@ importers: version: 3.7.0 '@rsbuild/plugin-babel': specifier: 1.1.0 - version: 1.1.0(@rsbuild/core@1.7.3) + version: 1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@types/react': specifier: ^18.3.28 version: 18.3.28 @@ -696,8 +696,8 @@ importers: specifier: workspace:* version: link:../../webpack/runtime-wrapper-webpack-plugin '@lynx-js/tasm': - specifier: 0.0.24 - version: 0.0.24 + specifier: 0.0.25 + version: 0.0.25 css-tree: specifier: ^3.1.0 version: 3.1.0 @@ -932,10 +932,10 @@ importers: version: link:../../web-platform/web-elements '@rsbuild/plugin-less': specifier: 1.6.0 - version: 1.6.0(@rsbuild/core@1.7.3) + version: 1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) commander: specifier: ^13.1.0 version: 13.1.0 @@ -950,7 +950,7 @@ importers: version: 1.1.1 rsbuild-plugin-tailwindcss: specifier: 0.2.4 - version: 0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19) + version: 0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19) rslog: specifier: ^1.3.2 version: 1.3.2 @@ -1614,8 +1614,8 @@ importers: specifier: workspace:* version: link:../../tools/css-serializer '@lynx-js/tasm': - specifier: 0.0.24 - version: 0.0.24 + specifier: 0.0.25 + version: 0.0.25 '@lynx-js/webpack-runtime-globals': specifier: workspace:^ version: link:../webpack-runtime-globals @@ -1770,13 +1770,13 @@ importers: version: 7.32.2(@types/node@24.10.13) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-type-check': specifier: 1.3.3 - version: 1.3.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) + version: 1.3.3(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) '@rsbuild/plugin-typed-css-modules': specifier: 1.2.1 - version: 1.2.1(@rsbuild/core@1.7.3) + version: 1.2.1(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rspress/core': specifier: 2.0.3 version: 2.0.3(@types/react@19.2.14)(core-js@3.48.0) @@ -3185,8 +3185,8 @@ packages: '@lynx-js/preact-devtools@5.0.1': resolution: {integrity: sha512-ayUU8PJ0TVWABbd5/d/04KI18W9RY4kkaRekBXXbRE/eBkGMZ3lVJ0zOB+B+85B9RUpvEVK2FleqJkS+qBKG6Q==} - '@lynx-js/tasm@0.0.24': - resolution: {integrity: sha512-nf5MChA2r3B6y+xfkXGOymdkFlHOJuScevcfS5sfX9lQNmDkf/3u+/CC7l7mLUCMvJkj0G0KXWXZqqyJmiuk+g==} + '@lynx-js/tasm@0.0.25': + resolution: {integrity: sha512-SPJuWs/M+Gltjpogc0wBGKXpRLbte6G9pUiELQnabVJeeFfiL36FquyEcxau2h24r0aGmwlKBJ6Regg824kkRQ==} '@lynx-js/trace-processor@0.0.1': resolution: {integrity: sha512-Zyl74cKi+BDggeXroLQG4frbBuiQ0DB0yH0C3pMkUHWv17abWTdJ2mw/H9Cd1QiIr+aQHn1U2SRtsrbkmWMtJw==} @@ -11723,7 +11723,7 @@ snapshots: errorstacks: 2.4.1 htm: 3.1.1 - '@lynx-js/tasm@0.0.24': {} + '@lynx-js/tasm@0.0.25': {} '@lynx-js/trace-processor@0.0.1': dependencies: @@ -12116,13 +12116,13 @@ snapshots: optionalDependencies: core-js: 3.48.0 - '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: '@babel/core': 7.29.0 '@babel/plugin-proposal-decorators': 7.29.0(@babel/core@7.29.0) '@babel/plugin-transform-class-properties': 7.28.6(@babel/core@7.29.0) '@babel/preset-typescript': 7.28.5(@babel/core@7.29.0) - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) '@types/babel__core': 7.20.5 deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12162,9 +12162,9 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-less@1.6.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-less@1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12185,6 +12185,15 @@ snapshots: reduce-configs: 1.1.1 sass-embedded: 1.97.3 + '@rsbuild/plugin-sass@1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + dependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + deepmerge: 4.3.1 + loader-utils: 2.0.4 + postcss: 8.5.6 + reduce-configs: 1.1.1 + sass-embedded: 1.97.3 + '@rsbuild/plugin-source-build@1.0.4(@rsbuild/core@1.7.3)': dependencies: fast-glob: 3.3.3 @@ -12193,19 +12202,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-type-check@1.3.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': - dependencies: - deepmerge: 4.3.1 - json5: 2.2.3 - reduce-configs: 1.1.1 - ts-checker-rspack-plugin: 1.2.6(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) - optionalDependencies: - '@rsbuild/core': 1.7.3 - transitivePeerDependencies: - - '@rspack/core' - - tslib - - typescript - '@rsbuild/plugin-type-check@1.3.3(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': dependencies: deepmerge: 4.3.1 @@ -12223,6 +12219,10 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 + '@rsbuild/plugin-typed-css-modules@1.2.1(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + optionalDependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + '@rsdoctor/client@1.2.3': {} '@rsdoctor/core@1.2.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(webpack@5.105.2)': @@ -18274,12 +18274,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19): - dependencies: - tailwindcss: 3.4.19 - optionalDependencies: - '@rsbuild/core': 1.7.3 - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19): dependencies: tailwindcss: 3.4.19 From f69be35e2c09be6f190b179573a771ed6469185c Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 25 Feb 2026 18:58:56 +0800 Subject: [PATCH 08/12] chore: upgrade @lynx-js/tasm to 0.0.25 --- .../rspeedy/lynx-bundle-rslib-config/package.json | 2 +- .../webpack/template-webpack-plugin/package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index 9f15082f5f..e06908cd5a 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -38,7 +38,7 @@ "dependencies": { "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.24", + "@lynx-js/tasm": "0.0.25", "css-tree": "^3.1.0" }, "devDependencies": { diff --git a/packages/webpack/template-webpack-plugin/package.json b/packages/webpack/template-webpack-plugin/package.json index 8bfb49e091..dafc0980b7 100644 --- a/packages/webpack/template-webpack-plugin/package.json +++ b/packages/webpack/template-webpack-plugin/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@lynx-js/css-serializer": "workspace:*", - "@lynx-js/tasm": "0.0.24", + "@lynx-js/tasm": "0.0.25", "@lynx-js/webpack-runtime-globals": "workspace:^", "@rspack/lite-tapable": "1.1.0", "css-tree": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8138c3a3e..acadb25ad7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -696,8 +696,8 @@ importers: specifier: workspace:* version: link:../../webpack/runtime-wrapper-webpack-plugin '@lynx-js/tasm': - specifier: 0.0.24 - version: 0.0.24 + specifier: 0.0.25 + version: 0.0.25 css-tree: specifier: ^3.1.0 version: 3.1.0 @@ -1614,8 +1614,8 @@ importers: specifier: workspace:* version: link:../../tools/css-serializer '@lynx-js/tasm': - specifier: 0.0.24 - version: 0.0.24 + specifier: 0.0.25 + version: 0.0.25 '@lynx-js/webpack-runtime-globals': specifier: workspace:^ version: link:../webpack-runtime-globals @@ -3185,8 +3185,8 @@ packages: '@lynx-js/preact-devtools@5.0.1': resolution: {integrity: sha512-ayUU8PJ0TVWABbd5/d/04KI18W9RY4kkaRekBXXbRE/eBkGMZ3lVJ0zOB+B+85B9RUpvEVK2FleqJkS+qBKG6Q==} - '@lynx-js/tasm@0.0.24': - resolution: {integrity: sha512-nf5MChA2r3B6y+xfkXGOymdkFlHOJuScevcfS5sfX9lQNmDkf/3u+/CC7l7mLUCMvJkj0G0KXWXZqqyJmiuk+g==} + '@lynx-js/tasm@0.0.25': + resolution: {integrity: sha512-SPJuWs/M+Gltjpogc0wBGKXpRLbte6G9pUiELQnabVJeeFfiL36FquyEcxau2h24r0aGmwlKBJ6Regg824kkRQ==} '@lynx-js/trace-processor@0.0.1': resolution: {integrity: sha512-Zyl74cKi+BDggeXroLQG4frbBuiQ0DB0yH0C3pMkUHWv17abWTdJ2mw/H9Cd1QiIr+aQHn1U2SRtsrbkmWMtJw==} @@ -11723,7 +11723,7 @@ snapshots: errorstacks: 2.4.1 htm: 3.1.1 - '@lynx-js/tasm@0.0.24': {} + '@lynx-js/tasm@0.0.25': {} '@lynx-js/trace-processor@0.0.1': dependencies: From d6d75a555bae07fafd75ad2b50a1bb512c0b327c Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Mon, 2 Mar 2026 22:08:17 +0800 Subject: [PATCH 09/12] chore: upgrade @lynx-js/tasm to 0.0.26 --- .../lynx-bundle-rslib-config/package.json | 2 +- .../template-webpack-plugin/package.json | 2 +- pnpm-lock.yaml | 68 +++++++++---------- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index e06908cd5a..40e76cb745 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -38,7 +38,7 @@ "dependencies": { "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.25", + "@lynx-js/tasm": "0.0.26", "css-tree": "^3.1.0" }, "devDependencies": { diff --git a/packages/webpack/template-webpack-plugin/package.json b/packages/webpack/template-webpack-plugin/package.json index dafc0980b7..46dc35f406 100644 --- a/packages/webpack/template-webpack-plugin/package.json +++ b/packages/webpack/template-webpack-plugin/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@lynx-js/css-serializer": "workspace:*", - "@lynx-js/tasm": "0.0.25", + "@lynx-js/tasm": "0.0.26", "@lynx-js/webpack-runtime-globals": "workspace:^", "@rspack/lite-tapable": "1.1.0", "css-tree": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index acadb25ad7..ee0a3b42f6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -265,7 +265,7 @@ importers: version: 3.7.0 '@rsbuild/plugin-babel': specifier: 1.1.0 - version: 1.1.0(@rsbuild/core@1.7.3) + version: 1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@types/react': specifier: ^18.3.28 version: 18.3.28 @@ -696,8 +696,8 @@ importers: specifier: workspace:* version: link:../../webpack/runtime-wrapper-webpack-plugin '@lynx-js/tasm': - specifier: 0.0.25 - version: 0.0.25 + specifier: 0.0.26 + version: 0.0.26 css-tree: specifier: ^3.1.0 version: 3.1.0 @@ -932,10 +932,10 @@ importers: version: link:../../web-platform/web-elements '@rsbuild/plugin-less': specifier: 1.6.0 - version: 1.6.0(@rsbuild/core@1.7.3) + version: 1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) commander: specifier: ^13.1.0 version: 13.1.0 @@ -950,7 +950,7 @@ importers: version: 1.1.1 rsbuild-plugin-tailwindcss: specifier: 0.2.4 - version: 0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19) + version: 0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19) rslog: specifier: ^1.3.2 version: 1.3.2 @@ -1614,8 +1614,8 @@ importers: specifier: workspace:* version: link:../../tools/css-serializer '@lynx-js/tasm': - specifier: 0.0.25 - version: 0.0.25 + specifier: 0.0.26 + version: 0.0.26 '@lynx-js/webpack-runtime-globals': specifier: workspace:^ version: link:../webpack-runtime-globals @@ -1770,13 +1770,13 @@ importers: version: 7.32.2(@types/node@24.10.13) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-type-check': specifier: 1.3.3 - version: 1.3.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) + version: 1.3.3(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) '@rsbuild/plugin-typed-css-modules': specifier: 1.2.1 - version: 1.2.1(@rsbuild/core@1.7.3) + version: 1.2.1(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rspress/core': specifier: 2.0.3 version: 2.0.3(@types/react@19.2.14)(core-js@3.48.0) @@ -3185,8 +3185,8 @@ packages: '@lynx-js/preact-devtools@5.0.1': resolution: {integrity: sha512-ayUU8PJ0TVWABbd5/d/04KI18W9RY4kkaRekBXXbRE/eBkGMZ3lVJ0zOB+B+85B9RUpvEVK2FleqJkS+qBKG6Q==} - '@lynx-js/tasm@0.0.25': - resolution: {integrity: sha512-SPJuWs/M+Gltjpogc0wBGKXpRLbte6G9pUiELQnabVJeeFfiL36FquyEcxau2h24r0aGmwlKBJ6Regg824kkRQ==} + '@lynx-js/tasm@0.0.26': + resolution: {integrity: sha512-WmcuTYh/KfdRqriT7+Qg8iwxsCDN4PKbCuXoN35npn23p33grpSNW306DJi9tX7LzP2vDZkOjxulSOknfiB/0Q==} '@lynx-js/trace-processor@0.0.1': resolution: {integrity: sha512-Zyl74cKi+BDggeXroLQG4frbBuiQ0DB0yH0C3pMkUHWv17abWTdJ2mw/H9Cd1QiIr+aQHn1U2SRtsrbkmWMtJw==} @@ -11723,7 +11723,7 @@ snapshots: errorstacks: 2.4.1 htm: 3.1.1 - '@lynx-js/tasm@0.0.25': {} + '@lynx-js/tasm@0.0.26': {} '@lynx-js/trace-processor@0.0.1': dependencies: @@ -12116,13 +12116,13 @@ snapshots: optionalDependencies: core-js: 3.48.0 - '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: '@babel/core': 7.29.0 '@babel/plugin-proposal-decorators': 7.29.0(@babel/core@7.29.0) '@babel/plugin-transform-class-properties': 7.28.6(@babel/core@7.29.0) '@babel/preset-typescript': 7.28.5(@babel/core@7.29.0) - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) '@types/babel__core': 7.20.5 deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12162,9 +12162,9 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-less@1.6.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-less@1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12185,6 +12185,15 @@ snapshots: reduce-configs: 1.1.1 sass-embedded: 1.97.3 + '@rsbuild/plugin-sass@1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + dependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + deepmerge: 4.3.1 + loader-utils: 2.0.4 + postcss: 8.5.6 + reduce-configs: 1.1.1 + sass-embedded: 1.97.3 + '@rsbuild/plugin-source-build@1.0.4(@rsbuild/core@1.7.3)': dependencies: fast-glob: 3.3.3 @@ -12193,19 +12202,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-type-check@1.3.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': - dependencies: - deepmerge: 4.3.1 - json5: 2.2.3 - reduce-configs: 1.1.1 - ts-checker-rspack-plugin: 1.2.6(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) - optionalDependencies: - '@rsbuild/core': 1.7.3 - transitivePeerDependencies: - - '@rspack/core' - - tslib - - typescript - '@rsbuild/plugin-type-check@1.3.3(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': dependencies: deepmerge: 4.3.1 @@ -12223,6 +12219,10 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 + '@rsbuild/plugin-typed-css-modules@1.2.1(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + optionalDependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + '@rsdoctor/client@1.2.3': {} '@rsdoctor/core@1.2.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(webpack@5.105.2)': @@ -18274,12 +18274,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19): - dependencies: - tailwindcss: 3.4.19 - optionalDependencies: - '@rsbuild/core': 1.7.3 - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19): dependencies: tailwindcss: 3.4.19 From c07a9a2d23c0062d20efb6247f0a0a5a2481d2b4 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Tue, 3 Mar 2026 20:42:26 +0800 Subject: [PATCH 10/12] fix: cr of rabbit --- .../lynx-bundle-rslib-config/test/external-bundle.test.ts | 1 - packages/webpack/externals-loading-webpack-plugin/src/index.ts | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts index 2840f2c785..4ee438ba5f 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts @@ -169,7 +169,6 @@ describe('should build external bundle', () => { }) it('should build css into external bundle', async () => { - vi.stubEnv('DEBUG', 'rsbuild,rslib,rspack') const fixtureDir = path.join(__dirname, './fixtures/css-lib') const rslibConfig = defineExternalBundleRslibConfig({ source: { diff --git a/packages/webpack/externals-loading-webpack-plugin/src/index.ts b/packages/webpack/externals-loading-webpack-plugin/src/index.ts index 86ec7faa08..2720873f30 100644 --- a/packages/webpack/externals-loading-webpack-plugin/src/index.ts +++ b/packages/webpack/externals-loading-webpack-plugin/src/index.ts @@ -327,6 +327,7 @@ function createLoadExternalAsync(handler, sectionPath) { ${ isMainThreadLayer ? ` + // TODO: Use configured layer suffix instead of hard-coded __main-thread for CSS section lookup. const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url); if (styleSheet !== null) { __AdoptStyleSheet(styleSheet); @@ -353,6 +354,7 @@ function createLoadExternalSync(handler, sectionPath, timeout) { ${ isMainThreadLayer ? ` + // TODO: Use configured layer suffix instead of hard-coded __main-thread for CSS section lookup. const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url); if (styleSheet !== null) { __AdoptStyleSheet(styleSheet); From 102ab4b3cb1001d58fecfc34e1c06cd335fa2447 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 4 Mar 2026 12:05:33 +0800 Subject: [PATCH 11/12] chore: remove unused deps --- .../lynx-bundle-rslib-config/package.json | 4 +- .../src/index.ts | 6 +- pnpm-lock.yaml | 60 ++++++++----------- 3 files changed, 29 insertions(+), 41 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/package.json b/packages/rspeedy/lynx-bundle-rslib-config/package.json index 40e76cb745..7af0d5b3fe 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/package.json +++ b/packages/rspeedy/lynx-bundle-rslib-config/package.json @@ -38,15 +38,13 @@ "dependencies": { "@lynx-js/css-serializer": "workspace:*", "@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*", - "@lynx-js/tasm": "0.0.26", - "css-tree": "^3.1.0" + "@lynx-js/tasm": "0.0.26" }, "devDependencies": { "@lynx-js/react": "workspace:*", "@lynx-js/react-rsbuild-plugin": "workspace:*", "@lynx-js/vitest-setup": "workspace:*", "@rslib/core": "^0.19.6", - "@types/css-tree": "^2.3.11", "vitest": "^3.2.4", "webpack": "^5.105.2" }, diff --git a/packages/webpack/externals-loading-webpack-plugin/src/index.ts b/packages/webpack/externals-loading-webpack-plugin/src/index.ts index 2720873f30..87d5810fe6 100644 --- a/packages/webpack/externals-loading-webpack-plugin/src/index.ts +++ b/packages/webpack/externals-loading-webpack-plugin/src/index.ts @@ -338,7 +338,8 @@ function createLoadExternalAsync(handler, sectionPath) { } resolve(result) } catch (error) { - reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error })) + console.error(error) + reject(new Error('Failed to load script ' + sectionPath + ' in ' + response.url, { cause: error })) } } else { reject(new Error('Failed to fetch external source ' + response.url + ' . The response is ' + JSON.stringify(response), { cause: response })); @@ -365,7 +366,8 @@ function createLoadExternalSync(handler, sectionPath, timeout) { } return result } catch (error) { - throw new Error('Failed to load script ' + sectionPath + ' in ' + response.url + ': ' + error.message, { cause: error }) + console.error(error) + throw new Error('Failed to load script ' + sectionPath + ' in ' + response.url, { cause: error }) } } else { throw new Error('Failed to fetch external source ' + response.url + ' . The response is ' + JSON.stringify(response), { cause: response }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3061d3c4ab..18fcaf7e55 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -265,7 +265,7 @@ importers: version: 3.7.0 '@rsbuild/plugin-babel': specifier: 1.1.0 - version: 1.1.0(@rsbuild/core@1.7.3) + version: 1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@types/react': specifier: ^18.3.28 version: 18.3.28 @@ -723,9 +723,6 @@ importers: '@lynx-js/tasm': specifier: 0.0.26 version: 0.0.26 - css-tree: - specifier: ^3.1.0 - version: 3.1.0 devDependencies: '@lynx-js/react': specifier: workspace:* @@ -739,9 +736,6 @@ importers: '@rslib/core': specifier: ^0.19.6 version: 0.19.6(@microsoft/api-extractor@7.57.6(@types/node@24.10.13))(@typescript/native-preview@7.0.0-dev.20260212.1)(typescript@5.9.3) - '@types/css-tree': - specifier: ^2.3.11 - version: 2.3.11 vitest: specifier: ^3.2.4 version: 3.2.4(@types/debug@4.1.12)(@types/node@24.10.13)(@vitest/ui@3.2.4)(jsdom@27.4.0)(sass-embedded@1.97.3)(sass@1.97.3)(terser@5.31.6) @@ -957,10 +951,10 @@ importers: version: link:../../web-platform/web-elements '@rsbuild/plugin-less': specifier: 1.6.0 - version: 1.6.0(@rsbuild/core@1.7.3) + version: 1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) commander: specifier: ^13.1.0 version: 13.1.0 @@ -975,7 +969,7 @@ importers: version: 1.1.1 rsbuild-plugin-tailwindcss: specifier: 0.2.4 - version: 0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19) + version: 0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19) rslog: specifier: ^1.3.2 version: 1.3.2 @@ -1801,13 +1795,13 @@ importers: version: 7.33.4(@types/node@24.10.13) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@1.7.3) + version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rsbuild/plugin-type-check': specifier: 1.3.4 - version: 1.3.4(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) + version: 1.3.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) '@rsbuild/plugin-typed-css-modules': specifier: 1.2.2 - version: 1.2.2(@rsbuild/core@1.7.3) + version: 1.2.2(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) '@rspress/core': specifier: 2.0.3 version: 2.0.3(@types/react@19.2.14)(core-js@3.48.0) @@ -12128,13 +12122,13 @@ snapshots: optionalDependencies: core-js: 3.48.0 - '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: '@babel/core': 7.29.0 '@babel/plugin-proposal-decorators': 7.29.0(@babel/core@7.29.0) '@babel/plugin-transform-class-properties': 7.28.6(@babel/core@7.29.0) '@babel/preset-typescript': 7.28.5(@babel/core@7.29.0) - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) '@types/babel__core': 7.20.5 deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12174,9 +12168,9 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-less@1.6.0(@rsbuild/core@1.7.3)': + '@rsbuild/plugin-less@1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': dependencies: - '@rsbuild/core': 1.7.3 + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12197,6 +12191,15 @@ snapshots: reduce-configs: 1.1.1 sass-embedded: 1.97.3 + '@rsbuild/plugin-sass@1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + dependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + deepmerge: 4.3.1 + loader-utils: 2.0.4 + postcss: 8.5.6 + reduce-configs: 1.1.1 + sass-embedded: 1.97.3 + '@rsbuild/plugin-source-build@1.0.4(@rsbuild/core@1.7.3)': dependencies: fast-glob: 3.3.3 @@ -12205,19 +12208,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-type-check@1.3.4(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': - dependencies: - deepmerge: 4.3.1 - json5: 2.2.3 - reduce-configs: 1.1.1 - ts-checker-rspack-plugin: 1.3.0(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) - optionalDependencies: - '@rsbuild/core': 1.7.3 - transitivePeerDependencies: - - '@rspack/core' - - tslib - - typescript - '@rsbuild/plugin-type-check@1.3.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': dependencies: deepmerge: 4.3.1 @@ -12235,6 +12225,10 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 + '@rsbuild/plugin-typed-css-modules@1.2.2(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + optionalDependencies: + '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + '@rsdoctor/client@1.2.3': {} '@rsdoctor/core@1.2.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(webpack@5.105.2)': @@ -18266,12 +18260,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19): - dependencies: - tailwindcss: 3.4.19 - optionalDependencies: - '@rsbuild/core': 1.7.3 - rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19): dependencies: tailwindcss: 3.4.19 From a80ede64f9ceeaf86a78c32142b47a7ad5ad1b71 Mon Sep 17 00:00:00 2001 From: Yiming Li Date: Wed, 4 Mar 2026 12:16:49 +0800 Subject: [PATCH 12/12] feat: use target: 'web' instead modify css loaders --- .../src/externalBundleRslibConfig.ts | 1 + packages/rspeedy/plugin-react/src/css.ts | 17 ------ pnpm-lock.yaml | 54 ++++++++++--------- 3 files changed, 31 insertions(+), 41 deletions(-) diff --git a/packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts b/packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts index c53c963192..f4eb2b9413 100644 --- a/packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts +++ b/packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts @@ -59,6 +59,7 @@ export const defaultExternalBundleLibConfig: LibConfig = { }, }, }, + target: 'web', }, source: { include: [/node_modules/], diff --git a/packages/rspeedy/plugin-react/src/css.ts b/packages/rspeedy/plugin-react/src/css.ts index a5ac9777fe..47955e8661 100644 --- a/packages/rspeedy/plugin-react/src/css.ts +++ b/packages/rspeedy/plugin-react/src/css.ts @@ -61,14 +61,12 @@ export function applyCSS( const rule = chain.module.rule(ruleName) removeLightningCSS(rule) - removeIgnoreCSS(rule) // Replace the CssExtractRspackPlugin.loader with ours. // This is for scoped CSS. rule .issuerLayer(LAYERS.BACKGROUND) .use(CHAIN_ID.USE.MINI_CSS_EXTRACT) - .before(CHAIN_ID.USE.CSS) .loader(CssExtractPlugin.loader) .end() @@ -142,21 +140,6 @@ export function applyCSS( rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS) } } - function removeIgnoreCSS(rule: ReturnType) { - if ( - // Rslib has a builtin ignore-css-loader - // We need to remove it and use our own ignore-css-loader - rule.uses.has(CHAIN_ID.USE.IGNORE_CSS) - ) { - rule.uses.delete(CHAIN_ID.USE.IGNORE_CSS) - } - } - - if (!chain.plugins.has(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT)) { - chain - .plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT) - .use(CssExtractPlugin) - } chain .plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18fcaf7e55..4012928e0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -265,7 +265,7 @@ importers: version: 3.7.0 '@rsbuild/plugin-babel': specifier: 1.1.0 - version: 1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) + version: 1.1.0(@rsbuild/core@1.7.3) '@types/react': specifier: ^18.3.28 version: 18.3.28 @@ -951,10 +951,10 @@ importers: version: link:../../web-platform/web-elements '@rsbuild/plugin-less': specifier: 1.6.0 - version: 1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) + version: 1.6.0(@rsbuild/core@1.7.3) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) + version: 1.5.0(@rsbuild/core@1.7.3) commander: specifier: ^13.1.0 version: 13.1.0 @@ -969,7 +969,7 @@ importers: version: 1.1.1 rsbuild-plugin-tailwindcss: specifier: 0.2.4 - version: 0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19) + version: 0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19) rslog: specifier: ^1.3.2 version: 1.3.2 @@ -1795,13 +1795,13 @@ importers: version: 7.33.4(@types/node@24.10.13) '@rsbuild/plugin-sass': specifier: 1.5.0 - version: 1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) + version: 1.5.0(@rsbuild/core@1.7.3) '@rsbuild/plugin-type-check': specifier: 1.3.4 - version: 1.3.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) + version: 1.3.4(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) '@rsbuild/plugin-typed-css-modules': specifier: 1.2.2 - version: 1.2.2(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0)) + version: 1.2.2(@rsbuild/core@1.7.3) '@rspress/core': specifier: 2.0.3 version: 2.0.3(@types/react@19.2.14)(core-js@3.48.0) @@ -12122,13 +12122,13 @@ snapshots: optionalDependencies: core-js: 3.48.0 - '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + '@rsbuild/plugin-babel@1.1.0(@rsbuild/core@1.7.3)': dependencies: '@babel/core': 7.29.0 '@babel/plugin-proposal-decorators': 7.29.0(@babel/core@7.29.0) '@babel/plugin-transform-class-properties': 7.28.6(@babel/core@7.29.0) '@babel/preset-typescript': 7.28.5(@babel/core@7.29.0) - '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + '@rsbuild/core': 1.7.3 '@types/babel__core': 7.20.5 deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12168,9 +12168,9 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-less@1.6.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': + '@rsbuild/plugin-less@1.6.0(@rsbuild/core@1.7.3)': dependencies: - '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + '@rsbuild/core': 1.7.3 deepmerge: 4.3.1 reduce-configs: 1.1.1 @@ -12191,15 +12191,6 @@ snapshots: reduce-configs: 1.1.1 sass-embedded: 1.97.3 - '@rsbuild/plugin-sass@1.5.0(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': - dependencies: - '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) - deepmerge: 4.3.1 - loader-utils: 2.0.4 - postcss: 8.5.6 - reduce-configs: 1.1.1 - sass-embedded: 1.97.3 - '@rsbuild/plugin-source-build@1.0.4(@rsbuild/core@1.7.3)': dependencies: fast-glob: 3.3.3 @@ -12208,6 +12199,19 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 + '@rsbuild/plugin-type-check@1.3.4(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': + dependencies: + deepmerge: 4.3.1 + json5: 2.2.3 + reduce-configs: 1.1.1 + ts-checker-rspack-plugin: 1.3.0(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3) + optionalDependencies: + '@rsbuild/core': 1.7.3 + transitivePeerDependencies: + - '@rspack/core' + - tslib + - typescript + '@rsbuild/plugin-type-check@1.3.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(@rspack/core@1.7.6(@swc/helpers@0.5.18))(tslib@2.8.1)(typescript@5.9.3)': dependencies: deepmerge: 4.3.1 @@ -12225,10 +12229,6 @@ snapshots: optionalDependencies: '@rsbuild/core': 1.7.3 - '@rsbuild/plugin-typed-css-modules@1.2.2(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))': - optionalDependencies: - '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) - '@rsdoctor/client@1.2.3': {} '@rsdoctor/core@1.2.3(@rsbuild/core@1.7.3)(@rspack/core@1.7.6(@swc/helpers@0.5.18))(webpack@5.105.2)': @@ -18260,6 +18260,12 @@ snapshots: optionalDependencies: '@rsbuild/core': 2.0.0-beta.3(core-js@3.48.0) + rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19): + dependencies: + tailwindcss: 3.4.19 + optionalDependencies: + '@rsbuild/core': 1.7.3 + rsbuild-plugin-tailwindcss@0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19): dependencies: tailwindcss: 3.4.19