mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 02:31:51 +00:00
Fix shapez exports not being exposed in production
A previous commit has mistakenly changed the behavior of a condition checking for standalone version. Instead of always being true, shapez exports were only exposed if the game was built in development mode.
This commit is contained in:
parent
ddc4513e46
commit
318baaa42d
@ -3,14 +3,13 @@ import { Application } from "../application";
|
|||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { Storage } from "../platform/storage";
|
import { FILE_NOT_FOUND, Storage } from "../platform/storage";
|
||||||
import { FILE_NOT_FOUND } from "../platform/storage";
|
|
||||||
import { Mod } from "./mod";
|
import { Mod } from "./mod";
|
||||||
import { ModInterface } from "./mod_interface";
|
import { ModInterface } from "./mod_interface";
|
||||||
import { MOD_SIGNALS } from "./mod_signals";
|
import { MOD_SIGNALS } from "./mod_signals";
|
||||||
|
|
||||||
import semverValidRange from "semver/ranges/valid";
|
|
||||||
import semverSatisifies from "semver/functions/satisfies";
|
import semverSatisifies from "semver/functions/satisfies";
|
||||||
|
import semverValidRange from "semver/ranges/valid";
|
||||||
|
|
||||||
const LOG = createLogger("mods");
|
const LOG = createLogger("mods");
|
||||||
|
|
||||||
@ -104,19 +103,18 @@ export class ModLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exposeExports() {
|
exposeExports() {
|
||||||
if (G_IS_DEV) {
|
const exports = {};
|
||||||
let exports = {};
|
|
||||||
const modules = import.meta.webpackContext("../", {
|
const modules = import.meta.webpackContext("../", {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
regExp: /\.[jt]s$/,
|
regExp: /\.[jt]sx?$/,
|
||||||
exclude: /\.d\.ts$/,
|
exclude: /\.d\.ts$/,
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(modules.keys()).forEach(key => {
|
Array.from(modules.keys()).forEach(key => {
|
||||||
/** @type {object} */
|
/** @type {object} */
|
||||||
const module = modules(key);
|
const module = modules(key);
|
||||||
for (const member in module) {
|
for (const member in module) {
|
||||||
if (member === "default" || member === "__$S__") {
|
if (member === "default") {
|
||||||
// Setter
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (exports[member]) {
|
if (exports[member]) {
|
||||||
@ -127,16 +125,12 @@ export class ModLoader {
|
|||||||
get() {
|
get() {
|
||||||
return module[member];
|
return module[member];
|
||||||
},
|
},
|
||||||
set(v) {
|
|
||||||
module.__$S__(member, v);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.shapez = exports;
|
window.shapez = exports;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async initMods() {
|
async initMods() {
|
||||||
// Create a storage for reading mod settings
|
// Create a storage for reading mod settings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user