Update bundled runtime

This commit is contained in:
Fabio Massaioli 2025-02-25 03:32:30 +01:00
commit 7b2c04dcb2
7 changed files with 1409 additions and 600 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,3 @@
node_modules
.task
.task
*.tsbuildinfo

View file

@ -11,25 +11,29 @@ tasks:
cmds:
- npm install
check:
dir: desktop/@wailsio/runtime
deps:
- install-deps
cmds:
- npm run check
test:
dir: desktop/@wailsio/runtime
deps:
- install-deps
cmds:
- npx vitest run
update:
dir: desktop/@wailsio/runtime
cmds:
- npx npm-check-updates -u
- npm test
build:debug:
internal: true
cmds:
- npx esbuild@latest desktop/@wailsio/runtime/src/index.js --inject:desktop/compiled/main.js --format=esm --bundle --tree-shaking=true --sourcemap=inline --outfile=../assetserver/bundledassets/runtime.debug.js --define:DEBUG=true
- npx esbuild@latest desktop/@wailsio/runtime/src/index.ts --inject:desktop/compiled/main.js --format=esm --target=es2015 --bundle --ignore-annotations --tree-shaking=true --sourcemap=inline --outfile=../assetserver/bundledassets/runtime.debug.js --define:DEBUG=true
build:production:
internal: true
cmds:
- npx esbuild@latest desktop/@wailsio/runtime/src/index.js --inject:desktop/compiled/main.js --format=esm --bundle --tree-shaking=true --minify --outfile=../assetserver/bundledassets/runtime.js --define:DEBUG=false --drop:console
- npx esbuild@latest desktop/@wailsio/runtime/src/index.ts --inject:desktop/compiled/main.js --format=esm --target=es2015 --bundle --ignore-annotations --tree-shaking=true --minify --outfile=../assetserver/bundledassets/runtime.js --define:DEBUG=false --drop:console
build:all:
internal: true

View file

@ -1,8 +1,10 @@
# README
The `main.js` file in this directory is the entrypoint for the `runtime.js` file that may be
The `index.js` file in the `compiled` directory is the entrypoint for the `runtime.js` file that may be
loaded at runtime. This will add `window.wails` and `window._wails` to the global scope.
NOTE: It is preferable to use the `@wailsio/runtime` package to use the runtime.
After updating any files in this directory, you must run `wails3 task build:runtime` to regenerate the compiled JS.
⚠️ Do not rebuild the runtime manually after updating TS code:
the CI pipeline will take care of this.
PRs that touch build artifacts will be blocked from merging.

View file

@ -11,8 +11,8 @@ The electron alternative for Go
import * as Runtime from "../@wailsio/runtime/src";
// NOTE: the following methods MUST be imported explicitly because of how esbuild injection works
import {Enable as EnableWML} from "../@wailsio/runtime/src/wml";
import {debugLog} from "../@wailsio/runtime/src/utils";
import { Enable as EnableWML } from "../@wailsio/runtime/src/wml";
import { debugLog } from "../@wailsio/runtime/src/utils";
window.wails = Runtime;
EnableWML();

View file

@ -1,7 +0,0 @@
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
environment: 'happy-dom',
},
})