diff --git a/.changeset/better-wombats-sip.md b/.changeset/better-wombats-sip.md new file mode 100644 index 0000000000..853d812bb3 --- /dev/null +++ b/.changeset/better-wombats-sip.md @@ -0,0 +1,3 @@ +--- + +--- diff --git a/package.json b/package.json index a1ef3188ab..645114aaa6 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "lint-staged": "^16.2.7", "sort-package-json": "^3.6.1", "ts-patch": "^3.3.0", - "turbo": "^2.8.10", + "turbo": "^2.9.3", "typescript": "^5.9.3", "typescript-eslint": "^8.56.0", "vitest": "^3.2.4" diff --git a/packages/rspeedy/plugin-react/test/config.test.ts b/packages/rspeedy/plugin-react/test/config.test.ts index 2deefffd84..e24a481da2 100644 --- a/packages/rspeedy/plugin-react/test/config.test.ts +++ b/packages/rspeedy/plugin-react/test/config.test.ts @@ -2029,14 +2029,19 @@ describe('Config', () => { // Production build with typical macro definitions vi.stubEnv('NODE_ENV', 'production') + const entryName = 'defineDCE' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/defineDCE/macros.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/defineDCE/macros.js', import.meta.url) + .pathname, }, }, + output: { + cleanDistPath: false, + }, environments: { lynx: {}, }, @@ -2060,7 +2065,8 @@ describe('Config', () => { const distPath = path.join( rsbuild.context.distPath, - '.rspeedy/main', + '.rspeedy', + entryName, 'main-thread.js', ) @@ -2078,16 +2084,19 @@ describe('Config', () => { vi.stubEnv('NODE_ENV', 'production') + const entryName = 'pure-funcs' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/pure-funcs/basic.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/pure-funcs/basic.js', import.meta.url) + .pathname, }, }, output: { filenameHash: false, + cleanDistPath: false, minify: { js: true, jsOptions: { @@ -2128,12 +2137,14 @@ describe('Config', () => { const mainThreadPath = path.join( rsbuild.context.distPath, - '.rspeedy/main', + '.rspeedy', + entryName, 'main-thread.js', ) const backgroundPath = path.join( rsbuild.context.distPath, - '.rspeedy/main', + '.rspeedy', + entryName, 'background.js', ) diff --git a/packages/rspeedy/plugin-react/test/optimizeBundleSize.test.ts b/packages/rspeedy/plugin-react/test/optimizeBundleSize.test.ts index c3da48b07f..b9e325fb88 100644 --- a/packages/rspeedy/plugin-react/test/optimizeBundleSize.test.ts +++ b/packages/rspeedy/plugin-react/test/optimizeBundleSize.test.ts @@ -10,7 +10,7 @@ import type { RspeedyInstance } from '@lynx-js/rspeedy' import { createStubRspeedy as createRspeedy } from './createRspeedy.js' -async function getCode(rsbuild: RspeedyInstance) { +async function getCode(rsbuild: RspeedyInstance, entryName: string) { try { await rsbuild.build() } catch (_error) { @@ -19,12 +19,14 @@ async function getCode(rsbuild: RspeedyInstance) { const mainThreadPath = path.join( rsbuild.context.distPath, - '.rspeedy/main', + '.rspeedy', + entryName, 'main-thread.js', ) const backgroundPath = path.join( rsbuild.context.distPath, - '.rspeedy/main', + '.rspeedy', + entryName, 'background.js', ) @@ -40,12 +42,14 @@ describe('optimizeBundleSize', () => { test('basic usage', async () => { const { pluginReactLynx } = await import('../src/pluginReactLynx.js') vi.stubEnv('NODE_ENV', 'production') + const entryName = 'optimizeBundleSize-0' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/pure-funcs/basic.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/pure-funcs/basic.js', import.meta.url) + .pathname, }, }, output: { @@ -53,6 +57,7 @@ describe('optimizeBundleSize', () => { minify: { js: true, }, + cleanDistPath: false, }, environments: { lynx: {}, @@ -65,7 +70,7 @@ describe('optimizeBundleSize', () => { const [config] = await rsbuild.initConfigs() expect(config?.optimization?.minimizer).toMatchSnapshot() - const { mainThreadCode, backgroundCode } = await getCode(rsbuild) + const { mainThreadCode, backgroundCode } = await getCode(rsbuild, entryName) expect(mainThreadCode).not.toContain('background-only') expect(mainThreadCode).toContain('main-thread-only') @@ -82,16 +87,19 @@ describe('optimizeBundleSize', () => { const { pluginReactLynx } = await import('../src/pluginReactLynx.js') vi.stubEnv('NODE_ENV', 'production') + const entryName = 'optimizeBundleSize-1' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/pure-funcs/basic.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/pure-funcs/basic.js', import.meta.url) + .pathname, }, }, output: { filenameHash: false, + cleanDistPath: false, minify: { js: true, jsOptions: { @@ -117,7 +125,7 @@ describe('optimizeBundleSize', () => { const [config] = await rsbuild.initConfigs() expect(config?.optimization?.minimizer).toMatchSnapshot() - const { mainThreadCode, backgroundCode } = await getCode(rsbuild) + const { mainThreadCode, backgroundCode } = await getCode(rsbuild, entryName) expect(mainThreadCode).toContain('background-only') expect(mainThreadCode).toContain('main-thread-only') expect(mainThreadCode).not.toContain('default console.info') @@ -132,17 +140,19 @@ describe('optimizeBundleSize', () => { test('optimize main-thread code', async () => { const { pluginReactLynx } = await import('../src/pluginReactLynx.js') vi.stubEnv('NODE_ENV', 'production') - + const entryName = 'optimizeBundleSize-2' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/pure-funcs/basic.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/pure-funcs/basic.js', import.meta.url) + .pathname, }, }, output: { filenameHash: false, + cleanDistPath: false, minify: { js: true, jsOptions: { @@ -165,7 +175,7 @@ describe('optimizeBundleSize', () => { }, }) - const { mainThreadCode, backgroundCode } = await getCode(rsbuild) + const { mainThreadCode, backgroundCode } = await getCode(rsbuild, entryName) expect(mainThreadCode).not.toContain('background-only') expect(mainThreadCode).toContain('main-thread-only') @@ -182,16 +192,19 @@ describe('optimizeBundleSize', () => { const { pluginReactLynx } = await import('../src/pluginReactLynx.js') vi.stubEnv('NODE_ENV', 'production') + const entryName = 'optimizeBundleSize-3' const rsbuild = await createRspeedy({ rspeedyConfig: { source: { entry: { - main: new URL('./fixtures/pure-funcs/basic.js', import.meta.url) - .pathname, + [entryName]: + new URL('./fixtures/pure-funcs/basic.js', import.meta.url) + .pathname, }, }, output: { filenameHash: false, + cleanDistPath: false, minify: { js: true, mainThreadOptions: { @@ -219,7 +232,7 @@ describe('optimizeBundleSize', () => { }, }) - const { mainThreadCode, backgroundCode } = await getCode(rsbuild) + const { mainThreadCode, backgroundCode } = await getCode(rsbuild, entryName) expect(mainThreadCode).not.toContain('background-only') expect(mainThreadCode).toContain('main-thread-only') expect(mainThreadCode).not.toContain('default console.info') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f265a5aca3..d043f1a6f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -144,8 +144,8 @@ importers: specifier: ^3.3.0 version: 3.3.0 turbo: - specifier: ^2.8.10 - version: 2.8.10 + specifier: ^2.9.3 + version: 2.9.3 typescript: specifier: ^5.9.3 version: 5.9.3 @@ -4286,6 +4286,36 @@ packages: '@tsconfig/strictest@2.0.8': resolution: {integrity: sha512-XnQ7vNz5HRN0r88GYf1J9JJjqtZPiHt2woGJOo2dYqyHGGcd6OLGqSlBB6p1j9mpzja6Oe5BoPqWmeDx6X9rLw==} + '@turbo/darwin-64@2.9.3': + resolution: {integrity: sha512-P8foouaP+y/p+hhEGBoZpzMbpVvUMwPjDpcy6wN7EYfvvyISD1USuV27qWkczecihwuPJzQ1lDBuL8ERcavTyg==} + cpu: [x64] + os: [darwin] + + '@turbo/darwin-arm64@2.9.3': + resolution: {integrity: sha512-SIzEkvtNdzdI50FJDaIQ6kQGqgSSdFPcdn0wqmmONN6iGKjy6hsT+EH99GP65FsfV7DLZTh2NmtTIRl2kdoz5Q==} + cpu: [arm64] + os: [darwin] + + '@turbo/linux-64@2.9.3': + resolution: {integrity: sha512-pLRwFmcHHNBvsCySLS6OFabr/07kDT2pxEt/k6eBf/3asiVQZKJ7Rk88AafQx2aYA641qek4RsXvYO3JYpiBug==} + cpu: [x64] + os: [linux] + + '@turbo/linux-arm64@2.9.3': + resolution: {integrity: sha512-gy6ApUroC2Nzv+qjGtE/uPNkhHAFU4c8God+zd5Aiv9L9uBgHlxVJpHT3XWl5xwlJZ2KWuMrlHTaS5kmNB+q1Q==} + cpu: [arm64] + os: [linux] + + '@turbo/windows-64@2.9.3': + resolution: {integrity: sha512-d0YelTX6hAsB7kIEtGB3PzIzSfAg3yDoUlHwuwJc3adBXUsyUIs0YLG+1NNtuhcDOUGnWQeKUoJ2pGWvbpRj7w==} + cpu: [x64] + os: [win32] + + '@turbo/windows-arm64@2.9.3': + resolution: {integrity: sha512-/08CwpKJl3oRY8nOlh2YgilZVJDHsr60XTNxRhuDeuFXONpUZ5X+Nv65izbG/xBew9qxcJFbDX9/sAmAX+ITcQ==} + cpu: [arm64] + os: [win32] + '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} @@ -9627,38 +9657,8 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - turbo-darwin-64@2.8.10: - resolution: {integrity: sha512-A03fXh+B7S8mL3PbdhTd+0UsaGrhfyPkODvzBDpKRY7bbeac4MDFpJ7I+Slf2oSkCEeSvHKR7Z4U71uKRUfX7g==} - cpu: [x64] - os: [darwin] - - turbo-darwin-arm64@2.8.10: - resolution: {integrity: sha512-sidzowgWL3s5xCHLeqwC9M3s9M0i16W1nuQF3Mc7fPHpZ+YPohvcbVFBB2uoRRHYZg6yBnwD4gyUHKTeXfwtXA==} - cpu: [arm64] - os: [darwin] - - turbo-linux-64@2.8.10: - resolution: {integrity: sha512-YK9vcpL3TVtqonB021XwgaQhY9hJJbKKUhLv16osxV0HkcQASQWUqR56yMge7puh6nxU67rQlTq1b7ksR1T3KA==} - cpu: [x64] - os: [linux] - - turbo-linux-arm64@2.8.10: - resolution: {integrity: sha512-3+j2tL0sG95iBJTm+6J8/45JsETQABPqtFyYjVjBbi6eVGdtNTiBmHNKrbvXRlQ3ZbUG75bKLaSSDHSEEN+btQ==} - cpu: [arm64] - os: [linux] - - turbo-windows-64@2.8.10: - resolution: {integrity: sha512-hdeF5qmVY/NFgiucf8FW0CWJWtyT2QPm5mIsX0W1DXAVzqKVXGq+Zf+dg4EUngAFKjDzoBeN6ec2Fhajwfztkw==} - cpu: [x64] - os: [win32] - - turbo-windows-arm64@2.8.10: - resolution: {integrity: sha512-QGdr/Q8LWmj+ITMkSvfiz2glf0d7JG0oXVzGL3jxkGqiBI1zXFj20oqVY0qWi+112LO9SVrYdpHS0E/oGFrMbQ==} - cpu: [arm64] - os: [win32] - - turbo@2.8.10: - resolution: {integrity: sha512-OxbzDES66+x7nnKGg2MwBA1ypVsZoDTLHpeaP4giyiHSixbsiTaMyeJqbEyvBdp5Cm28fc+8GG6RdQtic0ijwQ==} + turbo@2.9.3: + resolution: {integrity: sha512-J/VUvsGRykPb9R8Kh8dHVBOqioDexLk9BhLCU/ZybRR+HN9UR3cURdazFvNgMDt9zPP8TF6K73Z+tplfmi0PqQ==} hasBin: true type-check@0.4.0: @@ -12806,6 +12806,24 @@ snapshots: '@tsconfig/strictest@2.0.8': {} + '@turbo/darwin-64@2.9.3': + optional: true + + '@turbo/darwin-arm64@2.9.3': + optional: true + + '@turbo/linux-64@2.9.3': + optional: true + + '@turbo/linux-arm64@2.9.3': + optional: true + + '@turbo/windows-64@2.9.3': + optional: true + + '@turbo/windows-arm64@2.9.3': + optional: true + '@tybys/wasm-util@0.10.1': dependencies: tslib: 2.8.1 @@ -19008,32 +19026,14 @@ snapshots: tslib@2.8.1: {} - turbo-darwin-64@2.8.10: - optional: true - - turbo-darwin-arm64@2.8.10: - optional: true - - turbo-linux-64@2.8.10: - optional: true - - turbo-linux-arm64@2.8.10: - optional: true - - turbo-windows-64@2.8.10: - optional: true - - turbo-windows-arm64@2.8.10: - optional: true - - turbo@2.8.10: + turbo@2.9.3: optionalDependencies: - turbo-darwin-64: 2.8.10 - turbo-darwin-arm64: 2.8.10 - turbo-linux-64: 2.8.10 - turbo-linux-arm64: 2.8.10 - turbo-windows-64: 2.8.10 - turbo-windows-arm64: 2.8.10 + '@turbo/darwin-64': 2.9.3 + '@turbo/darwin-arm64': 2.9.3 + '@turbo/linux-64': 2.9.3 + '@turbo/linux-arm64': 2.9.3 + '@turbo/windows-64': 2.9.3 + '@turbo/windows-arm64': 2.9.3 type-check@0.4.0: dependencies: