diff --git a/CHANGELOG.md b/CHANGELOG.md index f424a65a..35a5bf9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +- Fixed an issue where using bedrock-auto with rspack bundling resulted in an error. #TINY-13550 + +# 15.1.0 - 2025-12-17 ## Added - Add rspack dev server support. #TINY-12824 diff --git a/Jenkinsfile b/Jenkinsfile index 9769dad7..4f1a5acb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,7 +61,8 @@ timestamps { tinyNpm.withNpmPublishCredentials { // We need to tell git to ignore the changes to .npmrc when publishing exec('git update-index --assume-unchanged .npmrc') - exec('yarn lerna publish from-package --yes --no-git-reset --ignore @ephox/bedrock-sample') + // Re-evaluate whether we still need the `--no-verify-access` flag after upgrading Lerna (TINY-13539) + exec('yarn lerna publish from-package --yes --no-git-reset --ignore @ephox/bedrock-sample --no-verify-access') } } } diff --git a/modules/server/src/main/ts/bedrock/compiler/Compiler.ts b/modules/server/src/main/ts/bedrock/compiler/Compiler.ts index 5fc422a5..837453ac 100644 --- a/modules/server/src/main/ts/bedrock/compiler/Compiler.ts +++ b/modules/server/src/main/ts/bedrock/compiler/Compiler.ts @@ -1,13 +1,26 @@ import * as fs from 'fs'; import * as Webpack from '../compiler/Webpack'; import * as Rspack from '../compiler/Rspack'; +import * as Types from './Types'; export interface Compiler { readonly generate: () => Promise; } -export const compile = (bundler: 'webpack' | 'rspack', tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, files: string[], coverage: string[], polyfills: string[]): Compiler => { - const getCompileFunc = () => { +export const compile = (args: { bundler: Types.Bundler; tsConfigFile: string; scratchDir: string; basedir: string; exitOnCompileError: boolean; files: string[]; coverage: string[]; polyfills: string[]; +}): Compiler => { + const { + bundler, + tsConfigFile, + scratchDir, + basedir, + exitOnCompileError, + files, + coverage, + polyfills + } = args; + + const getCompileFunc = (): Types.CompileFn => { switch (bundler) { case 'rspack': return Rspack.compile; diff --git a/modules/server/src/main/ts/bedrock/compiler/Rspack.ts b/modules/server/src/main/ts/bedrock/compiler/Rspack.ts index 433e910b..a64f61e4 100644 --- a/modules/server/src/main/ts/bedrock/compiler/Rspack.ts +++ b/modules/server/src/main/ts/bedrock/compiler/Rspack.ts @@ -6,7 +6,7 @@ import { ExitCodes } from '../util/ExitCodes'; import * as Imports from './Imports'; import { rspack, RspackOptions } from '@rspack/core'; import { RspackDevServer } from '@rspack/dev-server'; -import { RspackCompileInfo, DevServerServeSettings } from './Types'; +import { RspackCompileInfo, DevServerServeSettings, CompileFn } from './Types'; const getWebPackConfigTs = (tsConfigFile: string, scratchFile: string, dest: string, manualMode: boolean, basedir: string): RspackOptions => { // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -60,6 +60,7 @@ const getWebPackConfigTs = (tsConfigFile: string, scratchFile: string, dest: str options: { jsc: { parser: { syntax: 'typescript', tsx: true }, + target: 'es2022', transform: { react: { runtime: 'automatic', @@ -167,7 +168,7 @@ const getCompileInfo = (tsConfigFile: string, scratchDir: string, basedir: strin return getTsCompileInfo(tsConfigFile, scratchDir, basedir, manualMode); }; -export const compile = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], polyfills: string[]): Promise => { +export const compile: CompileFn = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], _coverage: string[], polyfills: string[]): Promise => { const compileInfo = await getCompileInfo(tsConfigFile, scratchDir, basedir, false); return compileTests(compileInfo, exitOnCompileError, srcFiles, polyfills); }; diff --git a/modules/server/src/main/ts/bedrock/compiler/Types.ts b/modules/server/src/main/ts/bedrock/compiler/Types.ts index 9f86caaa..6352af6d 100644 --- a/modules/server/src/main/ts/bedrock/compiler/Types.ts +++ b/modules/server/src/main/ts/bedrock/compiler/Types.ts @@ -17,3 +17,14 @@ export interface CompileInfo { readonly config: T; } +export type CompileFn = ( + tsConfigFile: string, + scratchDir: string, + basedir: string, + exitOnCompileError: boolean, + srcFiles: string[], + coverage: string[], + polyfills: string[] +) => Promise; + +export type Bundler = 'rspack' | 'webpack'; diff --git a/modules/server/src/main/ts/bedrock/compiler/Webpack.ts b/modules/server/src/main/ts/bedrock/compiler/Webpack.ts index 5782f266..38bfedaf 100644 --- a/modules/server/src/main/ts/bedrock/compiler/Webpack.ts +++ b/modules/server/src/main/ts/bedrock/compiler/Webpack.ts @@ -7,7 +7,7 @@ import * as Serve from '../server/Serve'; import { ExitCodes } from '../util/ExitCodes'; import * as Imports from './Imports'; import { hasTs } from './TsUtils'; -import { WebpackCompileInfo, DevServerServeSettings } from './Types'; +import { WebpackCompileInfo, DevServerServeSettings, CompileFn } from './Types'; const webpackSharedRules = ([] as any[]).concat([ { @@ -258,7 +258,7 @@ const getCompileInfo = (tsConfigFile: string, scratchDir: string, basedir: strin } }; -export const compile = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], coverage: string[], polyfills: string[]): Promise => { +export const compile: CompileFn = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], coverage: string[], polyfills: string[]): Promise => { const compileInfo = await getCompileInfo(tsConfigFile, scratchDir, basedir, false, srcFiles, coverage); return compileTests(compileInfo, exitOnCompileError, srcFiles, polyfills); }; diff --git a/modules/server/src/main/ts/bedrock/server/RunnerRoutes.ts b/modules/server/src/main/ts/bedrock/server/RunnerRoutes.ts index c86f6439..a5b78a74 100644 --- a/modules/server/src/main/ts/bedrock/server/RunnerRoutes.ts +++ b/modules/server/src/main/ts/bedrock/server/RunnerRoutes.ts @@ -6,6 +6,7 @@ import * as Routes from './Routes'; import * as Compiler from '../compiler/Compiler'; import * as FileUtils from '../util/FileUtils'; import * as Arr from '../util/Arr'; +import * as Types from '../compiler/Types'; interface PackageJson { readonly name: string; @@ -17,22 +18,22 @@ interface WorkspaceRoot { folder: string; } -export const generate = async (mode: string, projectdir: string, basedir: string, configFile: string, bundler: 'webpack' | 'rspack', testfiles: string[], chunk: number, +export const generate = async (mode: string, projectdir: string, basedir: string, configFile: string, bundler: Types.Bundler, testfiles: string[], chunk: number, retries: number, singleTimeout: number, stopOnFailure: boolean, basePage: string, coverage: string[], polyfills: string[]): Promise => { const files = testfiles.map((filePath) => { return path.relative(projectdir, filePath); }); - const testGenerator = Compiler.compile( + const testGenerator = Compiler.compile({ bundler, - path.join(projectdir, configFile), - path.join(projectdir, 'scratch'), + tsConfigFile: path.join(projectdir, configFile), + scratchDir: path.join(projectdir, 'scratch'), basedir, - mode === 'auto', + exitOnCompileError: mode === 'auto', files, coverage, polyfills - ); + }); // read the project json file to determine the project name to expose resources as `/project/${name}` const pkjson: PackageJson = FileUtils.readFileAsJson(`${projectdir}/package.json`);