Skip to content

Commit

Permalink
perf: use built-in transformer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Dec 5, 2024
1 parent 70ce1db commit 7f4ba79
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 79 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
"chokidar": "^4.0.1",
"consola": "^3.2.3",
"debug": "^4.3.7",
"oxc-transform": "^0.38.0",
"picocolors": "^1.1.1",
"pkg-types": "^1.2.1",
"rolldown": "nightly",
"rolldown": "0.15.0-snapshot-993c4a1-20241205003858",
"tinyglobby": "^0.2.10",
"unconfig": "^0.6.0",
"unplugin-isolated-decl": "^0.9.3",
Expand All @@ -73,6 +72,7 @@
"eslint": "^9.16.0",
"execa": "^9.5.1",
"fdir": "^6.4.2",
"oxc-transform": "^0.38.0",
"prettier": "^3.4.2",
"tsup": "^8.3.5",
"tsx": "^4.19.2",
Expand Down
112 changes: 56 additions & 56 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions src/features/syntax-lowering.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import process from 'node:process'
import { rolldown, type InputOptions, type OutputOptions } from 'rolldown'
import { transformPlugin } from 'rolldown/experimental'
import { IsolatedDecl } from 'unplugin-isolated-decl'
import { Unused } from 'unplugin-unused'
import { cleanOutDir } from './features/clean'
Expand All @@ -13,7 +14,6 @@ import {
type Options,
type ResolvedOptions,
} from './options'
import { SyntaxLoweringPlugin } from './plugins'
import { debug, logger } from './utils/logger'
import { readPackageJson } from './utils/package'

Expand Down Expand Up @@ -97,7 +97,10 @@ export async function buildSingle(resolved: ResolvedOptions): Promise<
pkg && ExternalPlugin(pkg, resolved.skipNodeModulesBundle),
unused && Unused.rolldown(unused === true ? {} : unused),
dts && IsolatedDecl.rolldown(dts === true ? {} : dts),
target && SyntaxLoweringPlugin(target),
target &&
transformPlugin({
target: typeof target === 'string' ? target : target.join(','),
}),
plugins,
].filter((plugin) => !!plugin),
...resolved.inputOptions,
Expand Down
1 change: 0 additions & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { ExternalPlugin } from './features/external'
export { SyntaxLoweringPlugin } from './features/syntax-lowering'
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"target": "esnext",
"lib": ["es2022"],
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"types": ["node"],
"strict": true,
Expand Down
4 changes: 1 addition & 3 deletions tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from './src'
export default defineConfig({
entry: ['./src/{index,run,plugins}.ts'],
format: 'esm',
target: 'node18',
clean: true,
platform: 'node',
skipNodeModulesBundle: true,
Expand All @@ -14,7 +15,4 @@ export default defineConfig({
onSuccess() {
console.info('🙏 Build succeeded!')
},

// TODO
// target: 'node18',
})

0 comments on commit 7f4ba79

Please sign in to comment.