Skip to content

Commit 33ba5aa

Browse files
committed
Rename lib files
1 parent 3bd10ff commit 33ba5aa

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

R/onload.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ ctx <- NULL
55
ctx <<- V8::v8()
66
wd <- setwd(system.file('js', package = 'toml'))
77
on.exit(setwd(wd))
8-
blob <- readBin('index_bg.wasm', raw(), 1e6)
8+
blob <- readBin('tomlr.wasm', raw(), file.info('tomlr.wasm')$size)
99
ctx$assign('bytes', blob)
1010
ctx$eval('var module = new WebAssembly.Module(bytes);')
11-
ctx$source('toml-edit-js.min.js')
11+
ctx$source('tomlr.js')
1212
ctx$eval('load_toml_edit_module(module)', await = TRUE)
1313
}

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"text-decoding": "^1.0.0"
1313
},
1414
"scripts": {
15-
"build": "esbuild toml-edit-js.js --minify --bundle --platform=neutral --format=iife --outfile=../inst/js/toml-edit-js.min.js && cp node_modules/@rainbowatcher/toml-edit-js/index_bg.wasm ../inst/js/index_bg.wasm"
15+
"build": "esbuild toml-edit-js.js --minify --bundle --platform=neutral --format=iife --outfile=../inst/js/tomlr.js && cp node_modules/@rainbowatcher/toml-edit-js/index_bg.wasm ../inst/js/tomlr.wasm"
1616
}
1717
}

js/rtoml.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
async function load_toml_edit_module(module){
2+
var td = await import('text-decoding/build/index');
3+
global.TextDecoder = td.TextDecoder;
4+
global.TextEncoder = td.TextEncoder;
5+
global.toml_edit = await import("@rainbowatcher/toml-edit-js/index");
6+
await toml_edit.initSync({module});
7+
}
8+
globalThis.load_toml_edit_module = load_toml_edit_module;

0 commit comments

Comments
 (0)