Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rolldown as package bundler #129

Merged
merged 3 commits into from
Jan 18, 2025
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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/test/debug.mjs",
"program": "${workspaceFolder}/test/debug.js",
"runtimeArgs": ["--inspect", "--expose-gc"]
}
]
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.mjs → eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import tseslint from 'typescript-eslint'

export default [
{
ignores: ['**/dist/*', '**/build/*', '**/rollup.config.mjs', '**/utils/*', 'eslint.config.mjs'],
ignores: ['**/dist/*', '**/build/*', '**/rolldown.config.ts', '**/utils/*', 'eslint.config.js'],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
{
files: ['test/**/*.mjs', 'bench/**/*.js'],
files: ['test/**/*.js', 'bench/**/*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
Expand Down
552 changes: 176 additions & 376 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "wasmoon",
"version": "1.16.0",
"description": "A real lua VM with JS bindings made with webassembly",
"main": "dist/index.js",
"main": "./dist/index.js",
"type": "module",
"scripts": {
"build:wasm:dev": "./build.sh dev",
"build:wasm": "./build.sh",
"build:wasm:docker:dev": "docker run --rm -v $(pwd):/wasmoon emscripten/emsdk /wasmoon/build.sh dev",
"build:wasm:docker": "docker run --rm -v $(pwd):/wasmoon emscripten/emsdk /wasmoon/build.sh",
"start": "rollup -c -w",
"test": "mocha --parallel --require ./test/boot.mjs test/*.test.mjs",
"luatests": "node --experimental-import-meta-resolve test/luatests.mjs",
"build": "rollup -c && tsc -d --emitDeclarationOnly --rootDir src --declarationDir dist",
"start": "rolldown -w -c",
"test": "mocha --parallel --require ./test/boot.js test/*.test.js",
"luatests": "node --experimental-import-meta-resolve test/luatests.js",
"build": "rolldown -c && tsc -d --emitDeclarationOnly --rootDir src --declarationDir dist",
"clean": "rm -rf dist build",
"lint": "prettier --write . && eslint . --fix --cache",
"lint:nofix": "eslint ."
Expand Down Expand Up @@ -41,7 +42,6 @@
],
"devDependencies": {
"@eslint/js": "9.17.0",
"@rollup/plugin-typescript": "12.1.2",
"@types/node": "22.10.2",
"@typescript-eslint/parser": "8.18.2",
"chai": "5.1.2",
Expand All @@ -54,7 +54,7 @@
"jest-mock": "29.7.0",
"mocha": "11.0.1",
"prettier": "3.4.2",
"rollup": "4.29.1",
"rolldown": "1.0.0-beta.1-commit.7c52c94",
"rollup-plugin-copy": "3.5.0",
"tslib": "2.8.1",
"typescript": "5.7.2",
Expand Down
13 changes: 5 additions & 8 deletions rollup.config.mjs → rolldown.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import typescript from '@rollup/plugin-typescript'
import copy from 'rollup-plugin-copy'
import pkg from './package.json' with { type: 'json' }

Expand All @@ -8,10 +7,13 @@ export default {
input: './src/index.ts',
output: {
file: 'dist/index.js',
format: 'umd',
name: 'wasmoon',
format: 'esm',
sourcemap: !production,
},
define: {
// Webpack workaround: https://github.com/webpack/webpack/issues/16878
'import.meta': 'Object(import.meta)',
},
plugins: [
{
name: 'package-version',
Expand All @@ -26,11 +28,6 @@ export default {
}
},
},
typescript({
sourceMap: !production,
outputToFilesystem: true,
removeComments: true
}),
copy({
targets: [{ src: 'build/glue.wasm', dest: 'dist' }],
}),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/debug.mjs → test/debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEngine } from './utils.mjs'
import { getEngine } from './utils.js'

// This file was created as a sandbox to test and debug on vscode
const engine = await getEngine()
Expand Down
2 changes: 1 addition & 1 deletion test/engine.test.mjs → test/engine.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter } from 'events'
import { LuaLibraries, LuaReturn, LuaThread, LuaType, decorate, decorateProxy, decorateUserdata } from '../dist/index.js'
import { expect } from 'chai'
import { getEngine, getFactory } from './utils.mjs'
import { getEngine, getFactory } from './utils.js'
import { setTimeout } from 'node:timers/promises'
import jestMock from 'jest-mock'

Expand Down
2 changes: 1 addition & 1 deletion test/filesystem.test.mjs → test/filesystem.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai'
import { getEngine, getFactory } from './utils.mjs'
import { getEngine, getFactory } from './utils.js'

describe('Filesystem', () => {
it('mount a file and require inside lua should succeed', async () => {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/promises.test.mjs → test/promises.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai'
import { getEngine, tick } from './utils.mjs'
import { getEngine, tick } from './utils.js'
import jestMock from 'jest-mock'

describe('Promises', () => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"resolveJsonModule": true,

},
"include": ["src/**/*", "test/**/*", "bench/**/*", "eslint.config.mjs"],
"include": ["src/**/*", "test/**/*", "bench/**/*", "eslint.config.js"],
"exclude": ["node_modules"]
}
Loading