Skip to content

Commit

Permalink
fix: Made sure users still get typings whenever they import a file fr…
Browse files Browse the repository at this point in the history
…om `dist/`
  • Loading branch information
Michael-F-Bryan committed Dec 14, 2023
1 parent 297e822 commit 956d404
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
File renamed without changes.
10 changes: 4 additions & 6 deletions lib_bundled.ts → WasmerSDKBundled.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
export * from "./lib";
// @ts-ignore
import { init as load, InitInput, InitOutput, ThreadPoolWorker } from "./lib";
export * from "./WasmerSDK";
import { init as load, InitInput, InitOutput } from "./WasmerSDK";
// @ts-ignore
import wasm_bytes from "./pkg/wasmer_js_bg.wasm";


/**
* Initialize the underlying WebAssembly module.
* Initialize the underlying WebAssembly module, defaulting to an embedded
* copy of the `*.wasm` file.
*/

export const init = async (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput> => {
if (!module_or_path) {
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "dist/WasmerSDK.cjs",
"module": "dist/WasmerSDK.js",
"unpkg": "dist/WasmerSDK.umd.js",
"types": "dist/lib.d.ts",
"types": "dist/WasmerSDK.d.ts",
"keywords": [
"webassembly",
"wasm",
Expand Down
10 changes: 5 additions & 5 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const banner = `/*!
* @license ${pkg.license}
*/`;

const makeConfig = (env = "development", input = "lib.ts", name = LIBRARY_NAME, plugins = []) => {
const makeConfig = (env = "development", input, name, plugins = []) => {
const config = {
input: input,
input,
external: EXTERNAL,
output: [
{
Expand Down Expand Up @@ -73,10 +73,10 @@ const makeConfig = (env = "development", input = "lib.ts", name = LIBRARY_NAME,
};

export default commandLineArgs => {
let env = commandLineArgs.environment === "BUILD:production" ? "production": null;
let env = commandLineArgs.environment === "BUILD:production" ? "production" : null;
const configs = [
makeConfig(env, "lib.ts"),
makeConfig(env, "lib_bundled.ts", `${LIBRARY_NAME}Bundled`, [wasm({
makeConfig(env, "WasmerSDK.ts", LIBRARY_NAME),
makeConfig(env, "WasmerSDKBundled.ts", `${LIBRARY_NAME}Bundled`, [wasm({
maxFileSize: 10 * 1024 * 1024,
})]),
{
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
"pkg",
"lib.ts",
"lib_bundled.ts"
"WasmerSDK.ts",
"WasmerSDKBundled.ts"
],
"exclude": [
"dist"
Expand Down

0 comments on commit 956d404

Please sign in to comment.