diff --git a/js/package.json b/js/package.json index a4e9ee3..7f02d20 100644 --- a/js/package.json +++ b/js/package.json @@ -16,31 +16,36 @@ }, "scripts": { "dev": "webpack-dev-server --hot --config webpack.base.cjs --env development", - "build:publish": "rimraf dist && yarn build:rust && yarn build:webpack && yarn build:webpack:production", - "build:rust": "rimraf src/buttplug-rs-ffi && cd ../ffi && cross-env RUSTFLAGS=\"--cfg=web_sys_unstable_apis\" wasm-pack build -d../js/src/buttplug-rs-ffi --release -- --features wasm --no-default-features && cd ../js && node scripts/modularize.cjs wasm-pack && rimraf src/buttplug-rs-ffi/.gitignore src/buttplug-rs-ffi/package.json src/buttplug-rs-ffi/README.md", - "build:main": "tsc -p tsconfig.json && copyfiles -u 1 \"src/**/*.js\" dist/module && copyfiles -u 1 \"src/**/*.d.ts\" dist/module && copyfiles -u 1 \"src/**/*.wasm\" dist/module", + "build:publish": "rimraf dist && yarn build:rust && yarn build:main && yarn build:webpack:umd && yarn build:webpack:umd:production && yarn build:webpack:module && yarn build:webpack:module:production", + "build:rust": "rimraf src/buttplug-rs-ffi && cd ../ffi && cross-env RUSTFLAGS=\"--cfg=web_sys_unstable_apis\" wasm-pack build -d ../js/src/buttplug-rs-ffi --release -- --features wasm --no-default-features && cd ../js && node scripts/modularize.cjs wasm-pack && rimraf src/buttplug-rs-ffi/.gitignore src/buttplug-rs-ffi/package.json src/buttplug-rs-ffi/README.md", + "build:main": "tsc -p tsconfig.json && copyfiles -u 1 \"src/**/*.js\" dist/node && copyfiles -u 1 \"src/**/*.d.ts\" dist/node && copyfiles -u 1 \"src/**/*.wasm\" dist/node", "build:proto": "pbjs -t static-module -w es6 -o src/buttplug_ffi.js ../protobuf_schemas/buttplug_rs_ffi.proto && node scripts/modularize.cjs pbjs && pbjs -t static-module ../protobuf_schemas/buttplug_rs_ffi.proto | pbts -o src/buttplug_ffi.d.ts -", - "build:webpack": "yarn build:main && webpack --progress --config webpack.base.cjs --env development", - "build:webpack:production": "webpack --progress --config webpack.base.cjs --env production" + "build:webpack:umd": "webpack --progress --config webpack.base.cjs --env development", + "build:webpack:umd:production": "webpack --progress --config webpack.base.cjs --env production", + "build:webpack:module": "webpack --progress --config webpack.module.cjs --env development", + "build:webpack:module:production": "webpack --progress --config webpack.module.cjs --env production" }, "sideEffects": "false", "type": "module", - "main": "./dist/module/index.js", + "main": "./dist/node/index.js", "exports": { - "node": "./dist/module/index.js", - "browser": "./dist/web/buttplug.min.js" + "types": "./dist/node/index.d.ts", + "node": "./dist/node/index.js", + "import": "./dist/module/buttplug.min.js", + "browser": "./dist/module/buttplug.min.js" }, "imports": { "#buttplug_rs_ffi_bg": { - "node": "./dist/module/buttplug-rs-ffi/buttplug_rs_ffi_bg_node.js" + "node": "./dist/node/buttplug-rs-ffi/buttplug_rs_ffi_bg_node.js" } }, - "types": "./dist/module/index.d.ts", + "types": "./dist/node/index.d.ts", "dependencies": { "protobufjs": "^6.11.2", "websocket": "^1.0.34" }, "devDependencies": { + "buffer": "^6.0.3", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", "fork-ts-checker-webpack-plugin": "^6.5.0", @@ -51,9 +56,9 @@ "ts-proto": "^1.93.1", "typescript": "^4.5.2", "uglify-js": "^3.14.4", - "webpack": "^4", - "webpack-cli": "^3", - "webpack-dev-server": "^3.11.2", + "webpack": "~5.74.0", + "webpack-cli": "^4", + "webpack-dev-server": "^4.9.3", "webpack-merge": "^5.8.0", "yarn": "^1.22.17" } diff --git a/js/index.html b/js/public/index.html similarity index 90% rename from js/index.html rename to js/public/index.html index c96d520..08b134b 100644 --- a/js/index.html +++ b/js/public/index.html @@ -2,8 +2,8 @@ -