@@ -2,15 +2,10 @@ import path from 'node:path';
22import util from 'node:util' ;
33import { loadEnv , type RsbuildEntry } from '@rsbuild/core' ;
44import { loadConfig } from '../config' ;
5- import type {
6- EcmaScriptVersion ,
7- RsbuildConfigOutputTarget ,
8- RslibConfig ,
9- Syntax ,
10- } from '../types' ;
5+ import type { RsbuildConfigOutputTarget , RslibConfig } from '../types' ;
116import { getAbsolutePath } from '../utils/helper' ;
127import { logger } from '../utils/logger' ;
13- import type { CommonOptions } from './commands' ;
8+ import type { BuildOptions , CommonOptions } from './commands' ;
149import { onBeforeRestart } from './restart' ;
1510
1611const getEnvDir = ( cwd : string , envDir ?: string ) => {
@@ -54,36 +49,9 @@ export const parseEntryOption = (
5449 return Object . keys ( parsed ) . length === 0 ? undefined : parsed ;
5550} ;
5651
57- // export const parseSyntaxOption = (syntax?: string): Syntax | undefined => {
58- // if (!syntax) {
59- // return undefined;
60- // }
61-
62- // const trimmed = syntax.trim();
63- // if (!trimmed) {
64- // return undefined;
65- // }
66-
67- // if (trimmed.startsWith('[')) {
68- // try {
69- // const parsed = JSON.parse(trimmed);
70- // if (Array.isArray(parsed)) {
71- // return parsed;
72- // }
73- // } catch (e) {
74- // const reason = e instanceof Error ? e.message : String(e);
75- // throw new Error(
76- // `Failed to parse --syntax option "${trimmed}" as JSON array: ${reason}`,
77- // );
78- // }
79- // }
80-
81- // return trimmed as EcmaScriptVersion;
82- // };
83-
8452export const applyCliOptions = (
8553 config : RslibConfig ,
86- options : CommonOptions ,
54+ options : BuildOptions ,
8755 root : string ,
8856) : void => {
8957 if ( options . root ) config . root = root ;
@@ -101,7 +69,7 @@ export const applyCliOptions = (
10169 lib . source ||= { } ;
10270 lib . source . entry = entry as RsbuildEntry ;
10371 }
104- const syntax = options . syntax as Syntax | undefined ;
72+ const syntax = options . syntax ;
10573 if ( syntax !== undefined ) lib . syntax = syntax ;
10674 if ( options . dts !== undefined ) lib . dts = options . dts ;
10775 if ( options . autoExtension !== undefined )
0 commit comments