web: core no longer uses webpack, but selfhosted still does
This commit is contained in:
parent
7701ef9c26
commit
8abb8df299
|
@ -1 +0,0 @@
|
|||
module.exports = require("./src");
|
|
@ -4,9 +4,13 @@
|
|||
"description": "Core bindings for Ruffle",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"private": true,
|
||||
"main": "./pkg/index.js",
|
||||
"types": "./pkg/index.d.ts",
|
||||
"files": ["pkg/"],
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"prepare": "webpack",
|
||||
"build": "npm run build:wasm && npm run build:ts",
|
||||
"build:ts": "tsc -d",
|
||||
"build:wasm": "wasm-pack build ../../ --out-dir packages/core/pkg",
|
||||
"test": "mocha -r esm -r ts-node/register test/**.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -20,9 +24,7 @@
|
|||
"mocha": "^8.0.1",
|
||||
"ts-node": "^9.0.0",
|
||||
"typedoc": "^0.19.2",
|
||||
"typescript": "^4.0.5",
|
||||
"webpack": "^5.1.3",
|
||||
"webpack-cli": "^4.0.0"
|
||||
"typescript": "^4.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/source-map": "^0.5.2"
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
import { FLASH_MIMETYPE } from "./ruffle-player.js";
|
||||
|
||||
/**
|
||||
* Detect Flash using a handful of APIs.
|
||||
*
|
||||
* If you run this function after loading `plugin-polyfill`, you will only see
|
||||
* the info we added to the current window, which is wrong. Alternatively, if
|
||||
* you want to error-check your plugin falsification, use this function after
|
||||
* installing the falsification.
|
||||
*
|
||||
* This detect is largely similar to the one used by `swfobject` but with
|
||||
* certain browser detects removed.
|
||||
*
|
||||
* Returns if the browser has Flash and the version we detected.
|
||||
*/
|
||||
export default function detect_flash() {
|
||||
let has_flash = false;
|
||||
let version = [0, 0, 0];
|
||||
|
||||
if (
|
||||
navigator &&
|
||||
navigator.plugins &&
|
||||
navigator.plugins["Shockwave Flash"] &&
|
||||
navigator.plugins["Shockwave Flash"].description
|
||||
) {
|
||||
let description = navigator.plugins["Shockwave Flash"].description;
|
||||
|
||||
if (
|
||||
navigator.mimeTypes &&
|
||||
navigator.mimeTypes[FLASH_MIMETYPE] &&
|
||||
navigator.mimeTypes[FLASH_MIMETYPE].enabledPlugin
|
||||
) {
|
||||
has_flash = true;
|
||||
description = description.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
|
||||
version[0] = parseInt(description.replace(/^(.*)\..*$/, "$1"));
|
||||
version[1] = parseInt(description.replace(/^.*\.(.*)\s.*$/, "$1"));
|
||||
version[2] = /[a-zA-Z]/.test(description)
|
||||
? parseInt(description.replace(/^.*[a-zA-Z]+(.*)$/, "$1"))
|
||||
: 0;
|
||||
}
|
||||
} else if (window && window.ActiveXObject) {
|
||||
try {
|
||||
let activex_flash = new window.ActiveXObject(
|
||||
"ShockwaveFlash.ShockwaveFlash"
|
||||
);
|
||||
if (activex_flash) {
|
||||
let player_version = activex_flash.GetVariable("$version");
|
||||
|
||||
if (player_version) {
|
||||
version = player_version
|
||||
.split(" ")[1]
|
||||
.split(",")
|
||||
.map(parseInt);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
/* Ignore error on non-IE browsers */
|
||||
}
|
||||
}
|
||||
|
||||
return has_flash, version;
|
||||
}
|
|
@ -26,7 +26,7 @@ async function fetch_ruffle() {
|
|||
|
||||
//We currently assume that if we are not executing inside the extension,
|
||||
//then we can use webpack to get Ruffle.
|
||||
const ruffle_module = await import("../../../pkg/ruffle");
|
||||
const ruffle_module = await import("../pkg/ruffle_web");
|
||||
return ruffle_module.Ruffle;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Ruffle } from "../../../pkg/ruffle";
|
||||
import { Ruffle } from "../pkg/ruffle_web";
|
||||
|
||||
import { load_ruffle } from "./load-ruffle";
|
||||
import { ruffle_shadow_template } from "./shadow-template";
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
module.exports = require("ruffle-core");
|
|
@ -21,6 +21,7 @@
|
|||
"devDependencies": {
|
||||
"webpack-cli": "^4.0.0",
|
||||
"webpack-dev-server": "^3.11.0",
|
||||
"@wdio/cli": "^6.1.12"
|
||||
"@wdio/cli": "^6.1.12",
|
||||
"webpack": "^5.1.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,9 +36,6 @@ module.exports = (env, argv) => {
|
|||
syncWebAssembly: true,
|
||||
},
|
||||
devtool: "source-map",
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js", ".wasm"],
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
|
@ -50,13 +47,5 @@ module.exports = (env, argv) => {
|
|||
patterns: [{ from: "LICENSE*" }, { from: "README.md" }],
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: "ts-loader",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -841,7 +841,7 @@ impl AudioBackend for WebAudioBackend {
|
|||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen(module = "/packages/core/src/ruffle-imports.ts")]
|
||||
#[wasm_bindgen(raw_module = "./ruffle-imports.js")]
|
||||
extern "C" {
|
||||
/// Imported JS method to copy data into an `AudioBuffer`.
|
||||
/// We'd prefer to use `AudioBuffer.copyToChannel`, but this isn't supported
|
||||
|
|
Loading…
Reference in New Issue