mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Run prettier
This commit is contained in:
parent
4c06a38d46
commit
fb14ae9a00
6 changed files with 33 additions and 29 deletions
|
|
@ -14,5 +14,5 @@ module.exports = {
|
|||
transform: {
|
||||
"^.+\\.(js|ts|tsx)$": "babel-jest",
|
||||
},
|
||||
testPathIgnorePatterns: ["/node_modules/", "/experiments/"]
|
||||
testPathIgnorePatterns: ["/node_modules/", "/experiments/"],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe("can call messageBox with hello World", () => {
|
|||
VERSIONS.WINAMP_3_BETA,
|
||||
VERSIONS.WINAMP_3_FULL,
|
||||
VERSIONS.WINAMP_5_02,
|
||||
VERSIONS.WINAMP_5_66
|
||||
VERSIONS.WINAMP_5_66,
|
||||
];
|
||||
versions.forEach(version => {
|
||||
test(`with bytecode compiled by ${version}`, () => {
|
||||
|
|
@ -57,7 +57,7 @@ describe("can use basic operators", () => {
|
|||
VERSIONS.WINAMP_3_BETA,
|
||||
VERSIONS.WINAMP_3_FULL,
|
||||
VERSIONS.WINAMP_5_02,
|
||||
VERSIONS.WINAMP_5_66
|
||||
VERSIONS.WINAMP_5_66,
|
||||
];
|
||||
|
||||
// The basicTest.m file that jberg prepared follows a convention for what a
|
||||
|
|
@ -134,14 +134,16 @@ describe("can use basic operators", () => {
|
|||
"#f || #t",
|
||||
"!(#f || #f)",
|
||||
"#t || ++n (doesn't short circuit)",
|
||||
"!(#f && ++ n) (doesn\'t short circuit)"
|
||||
"!(#f && ++ n) (doesn't short circuit)",
|
||||
].map(successOutputFromMessage)
|
||||
);
|
||||
});
|
||||
|
||||
test(`with simple functions test bytecode compiled by ${version}`, async () => {
|
||||
try {
|
||||
await runFile(`./reference/maki_compiler/${version}/simpleFunctions.maki`);
|
||||
await runFile(
|
||||
`./reference/maki_compiler/${version}/simpleFunctions.maki`
|
||||
);
|
||||
} catch (e) {
|
||||
// Uncomment this next line to find the next bug to work on.
|
||||
console.error(e);
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ async function main(paths) {
|
|||
});
|
||||
});
|
||||
console.log({
|
||||
totalFunctionCount: Object.keys(functionCounts).length
|
||||
totalFunctionCount: Object.keys(functionCounts).length,
|
||||
// functionCounts
|
||||
});
|
||||
}
|
||||
|
||||
const paths = [
|
||||
"/Volumes/Mobile Backup/skins/skins/dump/Stylish/micro/micro.wal",
|
||||
"/Volumes/Mobile Backup/skins/skins/random/Winamp Skins/Skins/WTF/Almin_Agic_Skin.wal"
|
||||
"/Volumes/Mobile Backup/skins/skins/random/Winamp Skins/Skins/WTF/Almin_Agic_Skin.wal",
|
||||
];
|
||||
|
||||
main(paths);
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ async function main(skinPath) {
|
|||
zip.file(/\.maki$/i).map(async file => {
|
||||
return {
|
||||
name: file.name,
|
||||
buffer: await file.async("nodebuffer")
|
||||
buffer: await file.async("nodebuffer"),
|
||||
};
|
||||
})
|
||||
);
|
||||
return {
|
||||
path: walPath,
|
||||
makis
|
||||
makis,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const Variable = require("./variable");
|
||||
|
||||
function coerceTypes (var1, var2, val1, val2) {
|
||||
if (var2.type === 'INT') {
|
||||
if (var1.type === 'FLOAT' || var1.type === 'DOUBLE') {
|
||||
function coerceTypes(var1, var2, val1, val2) {
|
||||
if (var2.type === "INT") {
|
||||
if (var1.type === "FLOAT" || var1.type === "DOUBLE") {
|
||||
return Math.floor(val1);
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +154,9 @@ async function interpret(start, program, stack, { logger = null }) {
|
|||
}
|
||||
const offset = command.arguments[0].offset;
|
||||
const nextCommandIndex = offsetToCommand[offset];
|
||||
const value = await interpret(nextCommandIndex, program, stack, { logger });
|
||||
const value = await interpret(nextCommandIndex, program, stack, {
|
||||
logger,
|
||||
});
|
||||
stack.push(value);
|
||||
break;
|
||||
}
|
||||
|
|
@ -248,7 +250,7 @@ async function interpret(start, program, stack, { logger = null }) {
|
|||
const b = stack.pop();
|
||||
const aValue = a instanceof Variable ? a.getValue() : a;
|
||||
let bValue = b instanceof Variable ? b.getValue() : b;
|
||||
if (b.type === 'FLOAT' || b.type === 'DOUBLE') {
|
||||
if (b.type === "FLOAT" || b.type === "DOUBLE") {
|
||||
bValue = Math.floor(bValue);
|
||||
}
|
||||
stack.push(bValue % aValue);
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
window.location.hostname === "localhost" ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
window.location.hostname === "[::1]" ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
|
|
@ -21,7 +21,7 @@ const isLocalhost = Boolean(
|
|||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
|
|
@ -31,7 +31,7 @@ export function register(config) {
|
|||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
window.addEventListener("load", () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
|
|
@ -42,8 +42,8 @@ export function register(config) {
|
|||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
"This web app is being served cache-first by a service " +
|
||||
"worker. To learn more, visit https://bit.ly/CRA-PWA"
|
||||
);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -64,14 +64,14 @@ function registerValidSW(swUrl, config) {
|
|||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (installingWorker.state === "installed") {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
"New content is available and will be used when all " +
|
||||
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
|
|
@ -82,7 +82,7 @@ function registerValidSW(swUrl, config) {
|
|||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
console.log("Content is cached for offline use.");
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
|
|
@ -94,7 +94,7 @@ function registerValidSW(swUrl, config) {
|
|||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
console.error("Error during service worker registration:", error);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -103,10 +103,10 @@ function checkValidServiceWorker(swUrl, config) {
|
|||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
(contentType != null && contentType.indexOf("javascript") === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
|
|
@ -121,13 +121,13 @@ function checkValidServiceWorker(swUrl, config) {
|
|||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
"No internet connection found. App is running in offline mode."
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue