From 01d7ac6967781154506cd158cbafc38b9023b2d4 Mon Sep 17 00:00:00 2001 From: JP Sugarbroad Date: Sat, 16 Apr 2022 17:29:20 -0700 Subject: [PATCH] make jQuery use explicit --- jest.config.js | 1 - jest.setup.js | 2 -- package.json | 2 +- src/NetscriptFunctions.ts | 1 + src/Terminal/commands/wget.ts | 2 ++ webpack.config.js | 9 --------- 6 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 jest.setup.js diff --git a/jest.config.js b/jest.config.js index 12e22e92d..22f371dcd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,4 @@ module.exports = { - setupFiles: ["./jest.setup.js"], moduleFileExtensions: ["ts", "tsx", "js", "jsx"], transform: { "^.+\\.(js|jsx|ts|tsx)$": "babel-jest", diff --git a/jest.setup.js b/jest.setup.js deleted file mode 100644 index a10911aae..000000000 --- a/jest.setup.js +++ /dev/null @@ -1,2 +0,0 @@ -import "regenerator-runtime/runtime"; -global.$ = require("jquery"); diff --git a/package.json b/package.json index a5778a54b..2ce83ca4c 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@types/acorn": "^4.0.6", "@types/escodegen": "^0.0.7", "@types/file-saver": "^2.0.3", + "@types/jquery": "^3.5.14", "@types/lodash": "^4.14.168", "@types/numeral": "0.0.25", "@types/react": "^17.0.21", @@ -84,7 +85,6 @@ "prettier": "^2.3.2", "raw-loader": "^4.0.2", "react-refresh": "^0.10.0", - "regenerator-runtime": "^0.13.9", "source-map": "^0.7.3", "start-server-and-test": "^1.14.0", "typescript": "^4.2.4", diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index e0e1da770..f662f7543 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1,3 +1,4 @@ +import $ from "jquery"; import { vsprintf, sprintf } from "sprintf-js"; import { getRamCost } from "./Netscript/RamCostGenerator"; diff --git a/src/Terminal/commands/wget.ts b/src/Terminal/commands/wget.ts index 72832c56e..8717ffcc2 100644 --- a/src/Terminal/commands/wget.ts +++ b/src/Terminal/commands/wget.ts @@ -1,3 +1,5 @@ +import $ from "jquery"; + import { ITerminal } from "../ITerminal"; import { IRouter } from "../../ui/Router"; import { IPlayer } from "../../PersonObjects/IPlayer"; diff --git a/webpack.config.js b/webpack.config.js index fa6b96960..5aa0b34e2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -93,15 +93,6 @@ module.exports = (env, argv) => { new webpack.DefinePlugin({ "process.env.NODE_ENV": isDevelopment ? '"development"' : '"production"', }), - // http://stackoverflow.com/questions/29080148/expose-jquery-to-real-window-object-with-webpack - new webpack.ProvidePlugin({ - // Automtically detect jQuery and $ as free var in modules - // and inject the jquery library - // This is required by many jquery plugins - jquery: "jquery", - jQuery: "jquery", - $: "jquery", - }), new HtmlWebpackPlugin(htmlConfig), new MiniCssExtractPlugin({ filename: "[name].css",