better production build
This commit is contained in:
26
ic10emu/Cargo.lock
generated
26
ic10emu/Cargo.lock
generated
@@ -130,9 +130,9 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
@@ -305,9 +305,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.3"
|
||||
version = "1.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -328,9 +328,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
@@ -355,7 +355,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -384,7 +384,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -400,9 +400,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.53"
|
||||
version = "2.0.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
|
||||
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -426,7 +426,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -502,7 +502,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -524,7 +524,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,6 @@ pub struct Device {
|
||||
pub reagents: HashMap<ReagentMode, HashMap<i32, f64>>,
|
||||
pub ic: Option<u16>,
|
||||
pub connections: [Connection; 8],
|
||||
pub prefab_hash: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
@@ -158,7 +157,6 @@ impl Device {
|
||||
reagents: HashMap::new(),
|
||||
ic: None,
|
||||
connections: [Connection::default(); 8],
|
||||
prefab_hash: None,
|
||||
};
|
||||
device.connections[0] = Connection::CableNetwork(None);
|
||||
device
|
||||
@@ -188,7 +186,6 @@ impl Device {
|
||||
value: -128473777.0,
|
||||
},
|
||||
);
|
||||
device.prefab_hash = Some(-128473777);
|
||||
device
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from pprint import pprint
|
||||
from collections import defaultdict
|
||||
import re
|
||||
import json
|
||||
|
||||
|
||||
def extract_logicable():
|
||||
logicable = []
|
||||
pedia = {}
|
||||
with Path("./StationpediaFull.json").open("r") as f:
|
||||
with Path("./Stationpedia.json").open("r") as f:
|
||||
pedia.update(json.load(f))
|
||||
for page in pedia["pages"]:
|
||||
if page["LogicInsert"] or page["LogicSlotInsert"]:
|
||||
@@ -13,18 +17,112 @@ def extract_logicable():
|
||||
# print(f"{len(logicable)} of {len(pedia["pages"])} are logicable")
|
||||
return logicable
|
||||
|
||||
|
||||
def extract_all():
|
||||
items = []
|
||||
items = {}
|
||||
pedia = {}
|
||||
with Path("./StationpediaFull.json").open("r") as f:
|
||||
linkPat = re.compile(r"<link=\w+><color=[\w#]+>(.+?)</color></link>")
|
||||
with Path("./Stationpedia.json").open("r") as f:
|
||||
pedia.update(json.load(f))
|
||||
for page in pedia["pages"]:
|
||||
items.append(page)
|
||||
return items
|
||||
item = defaultdict(list)
|
||||
match page:
|
||||
case {
|
||||
"Key": _,
|
||||
"Title": _,
|
||||
"Description": desc,
|
||||
"PrefabName": name,
|
||||
"PrefabHash": hash,
|
||||
"SlotInserts": slots,
|
||||
"LogicInsert": logic,
|
||||
"LogicSlotInsert": slotlogic,
|
||||
"ModeInsert": modes,
|
||||
"ConnectionInsert": connections,
|
||||
}:
|
||||
item["name"] = name
|
||||
item["hash"] = hash
|
||||
item["desc"] = re.sub(linkPat, r"\1", desc)
|
||||
match slots:
|
||||
case []:
|
||||
item["slots"] = None
|
||||
case _:
|
||||
item["slots"] = [{}] * len(slots)
|
||||
for slot in slots:
|
||||
item["slots"][int(slot["SlotIndex"])] = {
|
||||
"name": slot["SlotName"],
|
||||
"type": slot["SlotType"],
|
||||
}
|
||||
|
||||
match logic:
|
||||
case []:
|
||||
item["logic"] = None
|
||||
case _:
|
||||
item["logic"] = {}
|
||||
for lat in logic:
|
||||
item["logic"][re.sub(linkPat, r"\1", lat["LogicName"])] = (
|
||||
lat["LogicAccessTypes"]
|
||||
)
|
||||
|
||||
match slotlogic:
|
||||
case []:
|
||||
item["slotlogic"] = None
|
||||
case _:
|
||||
item["slotlogic"] = {}
|
||||
for slt in slotlogic:
|
||||
item["slotlogic"][
|
||||
re.sub(linkPat, r"\1", slt["LogicName"])
|
||||
] = [int(s) for s in slt["LogicAccessTypes"].split(", ")]
|
||||
|
||||
match modes:
|
||||
case []:
|
||||
item["modes"] = None
|
||||
case _:
|
||||
item["modes"] = {}
|
||||
for mode in modes:
|
||||
item["modes"][int(mode["LogicAccessTypes"])] = mode[
|
||||
"LogicName"
|
||||
]
|
||||
|
||||
match connections:
|
||||
case []:
|
||||
item["conn"] = None
|
||||
case _:
|
||||
item["conn"] = {}
|
||||
for conn in connections:
|
||||
item["conn"][int(conn["LogicAccessTypes"])] = conn[
|
||||
"LogicName"
|
||||
]
|
||||
|
||||
case _:
|
||||
print(f"NON-CONFORMING: ")
|
||||
pprint(page)
|
||||
return
|
||||
|
||||
items[name] = item
|
||||
|
||||
logicable = [item["name"] for item in items.values() if item["logic"] is not None]
|
||||
slotlogicable = [
|
||||
item["name"] for item in items.values() if item["slotlogic"] is not None
|
||||
]
|
||||
devices = [
|
||||
item["name"]
|
||||
for item in items.values()
|
||||
if item["logic"] is not None and item["conn"] is not None
|
||||
]
|
||||
|
||||
with open("database.json", "w") as f:
|
||||
json.encoder
|
||||
json.dump(
|
||||
{
|
||||
"logic_enabeled": logicable,
|
||||
"slot_logic_enabeled": slotlogicable,
|
||||
"devices": devices,
|
||||
"items": items,
|
||||
},
|
||||
f,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
extract_logicable()
|
||||
# extract_logicable()
|
||||
extract_all()
|
||||
|
||||
@@ -66,11 +66,6 @@ impl DeviceRef {
|
||||
serde_wasm_bindgen::to_value(&self.device.borrow().connections).unwrap()
|
||||
}
|
||||
|
||||
#[wasm_bindgen(getter, js_name = "prefabHash")]
|
||||
pub fn prefab_hash(&self) -> Option<i32> {
|
||||
self.device.borrow().prefab_hash
|
||||
}
|
||||
|
||||
#[wasm_bindgen(getter, js_name = "ip")]
|
||||
pub fn ic_ip(&self) -> Option<u32> {
|
||||
self.device
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "an IC10 emulator for IC10 mips from Stationeers",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "webpack --config webpack.config.js",
|
||||
"build": "webpack --config webpack.config.prod.js",
|
||||
"start": "webpack-dev-server"
|
||||
},
|
||||
"repository": {
|
||||
@@ -30,6 +30,12 @@
|
||||
"css-loader": "^6.10.0",
|
||||
"hello-wasm-pack": "^0.1.0",
|
||||
"html-webpack-plugin": "^5.6.0",
|
||||
"image-minimizer-webpack-plugin": "^4.0.0",
|
||||
"imagemin": "^8.0.1",
|
||||
"imagemin-gifsicle": "^7.0.0",
|
||||
"imagemin-jpegtran": "^7.0.0",
|
||||
"imagemin-optipng": "^8.0.0",
|
||||
"imagemin-svgo": "^10.0.1",
|
||||
"mini-css-extract-plugin": "^2.8.1",
|
||||
"postcss-loader": "^8.1.1",
|
||||
"sass": "^1.72.0",
|
||||
|
||||
1909
www/pnpm-lock.yaml
generated
1909
www/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -154,7 +154,7 @@
|
||||
|
||||
<!-- <div class="flex-grow w-100"> </div> -->
|
||||
<ul class="nav navbar-nav navbar-right flex-row d-sm-none d-none d-md-flex">
|
||||
<p class="navbar-text mt-auto mb-auto align-self-center" style="">Official Stationeers:</p>
|
||||
<p class="navbar-text mt-auto mb-auto align-self-center">Official Stationeers:</p>
|
||||
<li role="presentation" class="">
|
||||
<a href="https://store.steampowered.com/app/544550/Stationeers/">
|
||||
<i class="fa-brands fa-steam fa-w-16"></i>
|
||||
@@ -190,7 +190,7 @@
|
||||
<div class="d-flex flex-column flex-shrink-1">
|
||||
<div id="virtualMachine">
|
||||
<div id="vmActiveIC" class="container ">
|
||||
<div class="ms-1 pb-2 row border border-secondary rounded bg-secondary bg-opacity-10">
|
||||
<div class="ms-1 me-2 pb-2 row border border-secondary rounded bg-secondary bg-opacity-10">
|
||||
<div class="mt-2 col">
|
||||
<div id="vmControls" class="btn-group-vertical btn-group-sm " role="group" aria-label="Virtual Machine Controls">
|
||||
<button id="vmControlRun" type="button" class="btn btn-primary">Run</button>
|
||||
|
||||
@@ -17,6 +17,7 @@ module.exports = {
|
||||
hot: true
|
||||
},
|
||||
mode: "development",
|
||||
devtool: "eval-source-map",
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({ patterns: ['img/*.png', 'img/*/*.png'] }),
|
||||
new HtmlWebpackPlugin({ template: './src/index.html' }),
|
||||
@@ -29,6 +30,10 @@ module.exports = {
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|svg|gif)$/,
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.(scss)$/,
|
||||
use: [{
|
||||
@@ -45,7 +50,7 @@ module.exports = {
|
||||
// if you use postcss 7.x skip the key
|
||||
postcssOptions: {
|
||||
// postcss plugins, can be exported to postcss.config.js
|
||||
plugins: function() {
|
||||
plugins: function () {
|
||||
return [
|
||||
require('autoprefixer')
|
||||
];
|
||||
@@ -63,7 +68,7 @@ module.exports = {
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
fallback: {
|
||||
fallback: {
|
||||
"crypto": require.resolve("crypto-browserify"),
|
||||
"buffer": require.resolve("buffer"),
|
||||
"stream": require.resolve("stream-browserify"),
|
||||
|
||||
127
www/webpack.config.prod.js
Normal file
127
www/webpack.config.prod.js
Normal file
@@ -0,0 +1,127 @@
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const miniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: "./src/js/main.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "main.js",
|
||||
},
|
||||
devServer: {
|
||||
static: path.resolve(__dirname, 'dist'),
|
||||
port: 8080,
|
||||
hot: true
|
||||
},
|
||||
mode: "production",
|
||||
devtool: "source-map",
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({ patterns: ['img/*.png', 'img/*/*.png'] }),
|
||||
new HtmlWebpackPlugin({ template: './src/index.html' }),
|
||||
new miniCssExtractPlugin()
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|svg|gif)$/,
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.(scss)$/,
|
||||
use: [{
|
||||
// inject CSS to page
|
||||
loader: miniCssExtractPlugin.loader
|
||||
}, {
|
||||
// translates CSS into CommonJS modules
|
||||
loader: 'css-loader'
|
||||
}, {
|
||||
// Run postcss actions
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
// `postcssOptions` is needed for postcss 8.x;
|
||||
// if you use postcss 7.x skip the key
|
||||
postcssOptions: {
|
||||
// postcss plugins, can be exported to postcss.config.js
|
||||
plugins: function () {
|
||||
return [
|
||||
require('autoprefixer')
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// compiles Sass to CSS
|
||||
loader: 'sass-loader'
|
||||
}],
|
||||
// parser: {
|
||||
// javascript : { importMeta: false }
|
||||
// }
|
||||
},],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
fallback: {
|
||||
"crypto": require.resolve("crypto-browserify"),
|
||||
"buffer": require.resolve("buffer"),
|
||||
"stream": require.resolve("stream-browserify"),
|
||||
"vm": require.resolve("vm-browserify"),
|
||||
},
|
||||
},
|
||||
experiments: {
|
||||
asyncWebAssembly: true,
|
||||
syncWebAssembly: true,
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new ImageMinimizerPlugin({
|
||||
minimizer: {
|
||||
implementation: ImageMinimizerPlugin.imageminMinify,
|
||||
options: {
|
||||
// Lossless optimization with custom option
|
||||
// Feel free to experiment with options for better result for you
|
||||
plugins: [
|
||||
["gifsicle", { interlaced: true }],
|
||||
["jpegtran", { progressive: true }],
|
||||
["optipng", { optimizationLevel: 5 }],
|
||||
// Svgo configuration here https://github.com/svg/svgo#configuration
|
||||
[
|
||||
"svgo",
|
||||
{
|
||||
plugins: [
|
||||
{
|
||||
name: "preset-default",
|
||||
params: {
|
||||
overrides: {
|
||||
removeViewBox: false,
|
||||
addAttributesToSVGElement: {
|
||||
params: {
|
||||
attributes: [
|
||||
{ xmlns: "http://www.w3.org/2000/svg" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
]
|
||||
}
|
||||
// output: {
|
||||
// filename: 'bundle.js',
|
||||
// path: path.resolve(__dirname, 'dist'),
|
||||
// },
|
||||
};
|
||||
Reference in New Issue
Block a user