Skip to content

Commit

Permalink
Closes #545
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Mar 11, 2024
1 parent 0d6582f commit b11a93e
Show file tree
Hide file tree
Showing 19 changed files with 1,062 additions and 1,394 deletions.
1 change: 0 additions & 1 deletion crates/rolldown_binding/.gitignore

This file was deleted.

File renamed without changes.
311 changes: 0 additions & 311 deletions crates/rolldown_binding/index.js

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -8,7 +8,6 @@
"node": ">=18.18.0"
},
"workspaces": [
"crates/rolldown_binding",
"crates/rolldown_binding_wasm",
"packages/**",
"web/**",
Expand Down
2 changes: 2 additions & 0 deletions packages/node/.gitignore
@@ -0,0 +1,2 @@
# Binariy files generated by NAPI-RS
*.node
17 changes: 16 additions & 1 deletion packages/node/build.config.ts
@@ -1,12 +1,27 @@
// build.config.ts
import { defineBuildConfig } from 'unbuild'
import nodeFs from 'node:fs'
import nodePath from 'node:path'
import { globSync } from 'glob'

export default defineBuildConfig({
entries: ['./src/index'],
clean: true,
declaration: true, // generate .d.ts files
externals: ['@rolldown/node-binding', 'rollup'],
externals: [/rolldown-binding\..*\.node/],
rollup: {
emitCJS: true,
cjsBridge: true,
},
hooks: {
'build:done'(ctx) {
const binaryFiles = globSync('./src/rolldown.*.node', { absolute: true })
// Move the binary file to dist
binaryFiles.forEach((file) => {
const fileName = nodePath.basename(file)
console.log('Copying', file, 'to ./dist')
nodeFs.copyFileSync(file, `./dist/${fileName}`)
})
}
}
})

0 comments on commit b11a93e

Please sign in to comment.