cool, now i **have** to fix the master branch. ree

This commit is contained in:
Letter N
2020-07-21 13:39:28 +08:00
parent e27bc2eda3
commit cf51c5aa2a
18 changed files with 165 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Converts a given collection to an array.
*

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Creates a function that returns the result of invoking the given
* functions, where each successive invocation is supplied the return

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
const inception = Date.now();
// Runtime detection

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Limits a number to the range between 'min' and 'max'.
*/

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Helper for conditionally adding/removing classes in React
*

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { compose } from './fp';
/**

View File

@@ -1,5 +1,7 @@
/**
* @file
* This plugin saves overall about 10KB on the final bundle size, so it's
* sort of worth it.
*
* We are using a .cjs extension because:
*
* 1. Webpack CLI only supports CommonJS modules;
@@ -9,8 +11,9 @@
* We need to copy-paste the whole "multiline" function because we can't
* synchronously import an ES module from a CommonJS module.
*
* This plugin saves overall about 10KB on the final bundle size, so it's
* sort of worth it.
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Removes excess whitespace and indentation from the string.
*/

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Returns a function, that, as long as it continues to be invoked, will
* not be triggered. The function will be called after it stops being

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { map, reduce, zipWith } from './collections';
/**

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { setupWebpack, getWebpackConfig } from './webpack.js';
import { reloadByondCache } from './reloader.js';

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
let socket;
const queue = [];
const subscribers = [];

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { createLogger } from 'common/logging.js';
import fs from 'fs';
import { basename } from 'path';

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { createLogger, directLog } from 'common/logging.js';
import http from 'http';
import { inspect } from 'util';

View File

@@ -1,9 +1,16 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { createLogger } from 'common/logging.js';
import fs from 'fs';
import os from 'os';
import { basename } from 'path';
import { promisify } from 'util';
import { resolveGlob, resolvePath } from './util.js';
import { regQuery } from './winreg.js';
const logger = createLogger('reloader');
@@ -40,6 +47,21 @@ export const findCacheRoot = async () => {
return cacheRoot;
}
}
// Query the Windows Registry
if (process.platform === 'win32') {
logger.log('querying windows registry');
let userpath = await regQuery(
'HKCU\\Software\\Dantom\\BYOND',
'userpath');
if (userpath) {
cacheRoot = userpath
.replace(/\\$/, '')
.replace(/\\/g, '/')
+ '/cache';
logger.log(`found cache at '${cacheRoot}'`);
return cacheRoot;
}
}
logger.log('found no cache directories');
};

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import glob from 'glob';
import { resolve as resolvePath } from 'path';
import fs from 'fs';

View File

@@ -1,3 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { createLogger } from 'common/logging.js';
import fs from 'fs';
import { createRequire } from 'module';

View File

@@ -0,0 +1,47 @@
/**
* Tools for dealing with Windows Registry bullshit.
*
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { exec } from 'child_process';
import { createLogger } from 'common/logging.js';
import { promisify } from 'util';
const logger = createLogger('winreg');
export const regQuery = async (path, key) => {
if (process.platform !== 'win32') {
return null;
}
try {
const command = `reg query "${path}" /v ${key}`;
const { stdout } = await promisify(exec)(command);
const keyPattern = ` ${key} `;
const indexOfKey = stdout.indexOf(keyPattern);
if (indexOfKey === -1) {
logger.error('could not find the registry key');
return null;
}
const indexOfEol = stdout.indexOf('\r\n', indexOfKey);
if (indexOfEol === -1) {
logger.error('could not find the end of the line');
return null;
}
const indexOfValue = stdout.indexOf(
' ',
indexOfKey + keyPattern.length);
if (indexOfValue === -1) {
logger.error('could not find the start of the key value');
return null;
}
const value = stdout.substring(indexOfValue + 4, indexOfEol);
return value;
}
catch (err) {
logger.error(err);
return null;
}
};