Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
}
Expand Down
17 changes: 15 additions & 2 deletions modules/server/src/main/ts/bedrock/compiler/Compiler.ts
Original file line number Diff line number Diff line change
@@ -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<Buffer | string>;
}

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[];
Copy link
Member

Choose a reason for hiding this comment

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

There are ways to test development bedrock builds with real development processes, remind me next year and I'd be happy to discuss 👍

It would be nice to catch these things before we publish a release.

}): Compiler => {
const {
bundler,
tsConfigFile,
scratchDir,
basedir,
exitOnCompileError,
files,
coverage,
polyfills
} = args;

const getCompileFunc = (): Types.CompileFn => {
switch (bundler) {
case 'rspack':
return Rspack.compile;
Expand Down
5 changes: 3 additions & 2 deletions modules/server/src/main/ts/bedrock/compiler/Rspack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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<string> => {
export const compile: CompileFn = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], _coverage: string[], polyfills: string[]): Promise<string> => {
const compileInfo = await getCompileInfo(tsConfigFile, scratchDir, basedir, false);
return compileTests(compileInfo, exitOnCompileError, srcFiles, polyfills);
};
Expand Down
11 changes: 11 additions & 0 deletions modules/server/src/main/ts/bedrock/compiler/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ export interface CompileInfo<T> {
readonly config: T;
}

export type CompileFn = (
tsConfigFile: string,
scratchDir: string,
basedir: string,
exitOnCompileError: boolean,
srcFiles: string[],
coverage: string[],
polyfills: string[]
) => Promise<string>;

export type Bundler = 'rspack' | 'webpack';
4 changes: 2 additions & 2 deletions modules/server/src/main/ts/bedrock/compiler/Webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
{
Expand Down Expand Up @@ -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<string> => {
export const compile: CompileFn = async (tsConfigFile: string, scratchDir: string, basedir: string, exitOnCompileError: boolean, srcFiles: string[], coverage: string[], polyfills: string[]): Promise<string> => {
const compileInfo = await getCompileInfo(tsConfigFile, scratchDir, basedir, false, srcFiles, coverage);
return compileTests(compileInfo, exitOnCompileError, srcFiles, polyfills);
};
Expand Down
13 changes: 7 additions & 6 deletions modules/server/src/main/ts/bedrock/server/RunnerRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Routes.Runner> => {
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`);
Expand Down
Loading