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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"typescript": "^4.7.4"
},
"engines": {
"node": "^20.19.0 || >=22.12.0",
"pnpm": "^10.0.0"
"node": ">=20",
"pnpm": ">=10"
}
}
1 change: 1 addition & 0 deletions packages/babel-preset-rsmax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@babel/helper-plugin-utils": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@babel/traverse": "^7.11.0",
"@babel/types": "^7.11.0",
"@rsmax/build-store": "workspace:*",
Expand Down
8 changes: 8 additions & 0 deletions packages/babel-preset-rsmax/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as lifecycle from './plugins/lifecycle';

interface PresetOption {
react?: boolean | { [key: string]: any };
typescript?: boolean | { [key: string]: any };
decorators?: any;
'class-properties'?: any;
'throw-if-namespace'?: boolean;
Expand All @@ -14,6 +15,7 @@ function preset(api: any, presetOption: PresetOption) {
api.assertVersion(7);

const react = typeof presetOption.react === 'undefined' ? true : presetOption.react;
const typescript = typeof presetOption.typescript === 'undefined' ? true : presetOption.typescript;
const throwIfNamespace =
typeof presetOption['throw-if-namespace'] === 'undefined' ? false : presetOption['throw-if-namespace'];
const targets =
Expand All @@ -29,6 +31,12 @@ function preset(api: any, presetOption: PresetOption) {
presets.push([require.resolve('@babel/preset-react'), reactOpts]);
}

if (typescript) {
const defaultTsOpt = { isTSX: true, allExtensions: true };
const tsOpts = typeof typescript === 'boolean' ? defaultTsOpt : Object.assign(defaultTsOpt, typescript);
presets.push([require.resolve('@babel/preset-typescript'), tsOpts]);
}

return {
presets,
plugins: [],
Expand Down
1 change: 1 addition & 0 deletions packages/rsmax-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"dependencies": {
"@babel/core": "^7.7.4",
"@babel/parser": "^7.7.4",
"@babel/preset-typescript": "^7.24.7",
"@babel/traverse": "^7.7.4",
"@babel/types": "^7.7.4",
"@rsdoctor/cli": "^1.5.0",
Expand Down
Loading
Loading