Fix: estimates geo v2

This commit is contained in:
Arsen
2026-02-04 00:11:19 +05:00
commit 3f0086f88e
22567 changed files with 4348823 additions and 0 deletions

22
backend/node_modules/ts-node-dev/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 20142015 Felix Gnass
Copyright (c) 2015 Daniel Gasienica
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

90
backend/node_modules/ts-node-dev/README.md generated vendored Executable file
View File

@@ -0,0 +1,90 @@
# ts-node-dev
> Tweaked version of [node-dev](https://github.com/fgnass/node-dev) that uses [ts-node](https://github.com/TypeStrong/ts-node) under the hood.
It restarts target node process when any of required files changes (as standard `node-dev`) but shares [Typescript](https://github.com/Microsoft/TypeScript/) compilation process between restarts. This significantly increases speed of restarting comparing to `node-dev -r ts-node/register ...`, `nodemon -x ts-node ...` variations because there is no need to instantiate `ts-node` compilation each time.
## Install
![npm (scoped)](https://img.shields.io/npm/v/ts-node-dev.svg?maxAge=86400) [![Build Status](https://travis-ci.com/wclr/ts-node-dev.svg?branch=master)](https://travis-ci.com/wclr/ts-node-dev)
```
yarn add ts-node-dev --dev
```
```
npm i ts-node-dev --save-dev
```
## Usage
```
ts-node-dev [node-dev|ts-node flags] [ts-node-dev flags] [node cli flags] [--] [script] [script arguments]
```
So you just combine [node-dev](https://github.com/fgnass/node-dev) and [ts-node](https://github.com/TypeStrong/ts-node) options (see docs of those packages):
```
ts-node-dev --respawn --transpile-only server.ts
```
There is also short alias `tsnd` for running `ts-node-dev`:
```
tsnd --respawn server.ts
```
Look up flags and options can be used [in ts-node's docs](https://github.com/TypeStrong/ts-node#cli-and-programmatic-options).
**Also there are additional options specific to `ts-node-dev`:**
* `--ignore-watch` - (default: []) - files/folders to be [ignored by `node-dev`](https://github.com/fgnass/node-dev#ignore-paths). **But this behaviour is enhanced:** it also supports regular expression in the ignore strings and will check absolute paths of required files for match.
* `--deps` - Also watch `node_modules`; by default watching is turned off
* `--debug` - Some additional [DEBUG] output
* `--quiet` - Silent [INFO] messages
* `--interval` - Polling interval (ms) - DOESN'T WORK CURRENTLY
* `--debounce` - Debounce file change events (ms, non-polling mode)
* `--clear` (`--cls`) - Will clear screen on restart
* `--watch` - Explicitly add arbitrary files or folders to watch and restart on change (list separated by commas, [chokidar](https://github.com/paulmillr/chokidar) patterns)
* `--exit-child` - Adds 'SIGTERM' exit handler in a child process.
* `--rs` - Allow to restart with "rs" line entered in stdio, disabled by default.
* `--notify` - to display desktop-notifications (Notifications are only displayed if `node-notifier` is installed).
* `--cache-directory` - tmp dir which is used to keep the compiled sources (by default os tmp directory is used)
If you need to detect that you are running with `ts-node-dev`, check if `process.env.TS_NODE_DEV` is set.
**Points of notice:**
- If you want desktop-notifications you should install `node-notifier` package and use `--notify` flag.
- Especially for large code bases always consider running with `--transpile-only` flag which is normal for dev workflow and will speed up things greatly. Note, that `ts-node-dev` will not put watch handlers on TS files that contain only types/interfaces (used only for type checking) - this is current limitation by design.
- `--ignore-watch` will NOT affect files ignored by TS compilation. Use `--ignore` option (or `TS_NODE_IGNORE` env variable) to pass **RegExp strings** for filtering files that should not be compiled, by default `/node_modules/` are ignored.
- Unknown flags (`node` cli flags are considered to be so) are treated like string value flags by default. The right solution to avoid ambiguity is to separate script name from option flags with `--`, for example:
```
ts-node-dev --inspect -- my-script.ts
```
- The good thing is that `ts-node-dev` watches used `tsconfig.json` file, and will reinitialize compilation on its change, but you have to restart the process manually when you update used version of `typescript` or make any other changes that may effect compilation results.
## Issues
If you have an issue, please create one. But, before:
- try to check if there exits alike issues.
- try to run your code with just [ts-node](https://github.com/TypeStrong/ts-node)
- try to run your code with `--files` option enabled ([see ts-node docs](https://github.com/TypeStrong/ts-node#help-my-types-are-missing))
- try to run it with `--debug` flag and see the output
- try to make create repro example
## Versioning
Currently versioning is not stable and it is still treated as pre-release. You might expect some options API changes. If you want to avoid unexpected problems it is recommended to fixate the installed version and update only in case of issues, you may consult [CHANGELOG](CHANGELOG.md) for updates.
## License
MIT.

BIN
backend/node_modules/ts-node-dev/icons/node_error.png generated vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
backend/node_modules/ts-node-dev/icons/node_info.png generated vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

136
backend/node_modules/ts-node-dev/lib/bin.js generated vendored Executable file
View File

@@ -0,0 +1,136 @@
#!/usr/bin/env node
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var _1 = require(".");
var minimist_1 = __importDefault(require("minimist"));
var nodeArgs = [];
var unknown = [];
var devArgs = process.argv.slice(2, 100);
var tsNodeFlags = {
boolean: [
'scope',
'emit',
'files',
'pretty',
'transpile-only',
'prefer-ts-exts',
'prefer-ts',
'log-error',
'skip-project',
'skip-ignore',
'compiler-host',
'script-mode',
],
string: [
'compiler',
'project',
'ignore',
'ignore-diagnostics',
'compiler-options',
'scopeDir',
'transpiler'
],
};
var tsNodeAlias = {
'transpile-only': 'T',
'compiler-host': 'H',
ignore: 'I',
'ignore-diagnostics': 'D',
'compiler-options': 'O',
compiler: 'C',
project: 'P',
'script-mode': 's',
};
var devFlags = {
boolean: [
'deps',
'all-deps',
'dedupe',
'fork',
'exec-check',
'debug',
'poll',
'respawn',
'notify',
'tree-kill',
'clear',
'cls',
'exit-child',
'error-recompile',
'quiet',
'rs',
],
string: [
'dir',
'deps-level',
'compile-timeout',
'ignore-watch',
'interval',
'debounce',
'watch',
'cache-directory',
],
};
var opts = minimist_1.default(devArgs, {
stopEarly: true,
boolean: __spreadArrays(devFlags.boolean, tsNodeFlags.boolean),
string: __spreadArrays(devFlags.string, tsNodeFlags.string),
alias: __assign(__assign({}, tsNodeAlias), { 'prefer-ts-exts': 'prefer-ts' }),
default: {
fork: true,
},
unknown: function (arg) {
unknown.push(arg);
return true;
},
});
var script = opts._[0];
var scriptArgs = opts._.slice(1);
opts.priorNodeArgs = [];
unknown.forEach(function (arg) {
if (arg === script || nodeArgs.indexOf(arg) >= 0)
return;
var argName = arg.replace(/^-+/, '');
// fix this
var argOpts = opts[argName];
var argValues = Array.isArray(argOpts) ? argOpts : [argOpts];
argValues.forEach(function (argValue) {
if ((arg === '-r' || arg === '--require') && argValue === 'esm') {
opts.priorNodeArgs.push(arg, argValue);
return false;
}
nodeArgs.push(arg);
if (typeof argValue === 'string') {
nodeArgs.push(argValue);
}
});
});
if (!script) {
// eslint-disable-next-line no-console
console.log('ts-node-dev: no script to run provided');
// eslint-disable-next-line no-console
console.log('Usage: ts-node-dev [options] script [arguments]\n');
process.exit(1);
}
_1.runDev(script, scriptArgs, nodeArgs, opts);

59
backend/node_modules/ts-node-dev/lib/cfg.js generated vendored Executable file
View File

@@ -0,0 +1,59 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCfg = void 0;
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
function read(dir) {
var f = path_1.default.resolve(dir, '.node-dev.json');
return fs_1.default.existsSync(f) ? JSON.parse(fs_1.default.readFileSync(f, 'utf-8')) : null;
}
function resolvePath(unresolvedPath) {
return path_1.default.resolve(process.cwd(), unresolvedPath);
}
exports.makeCfg = function (main, opts) {
var dir = main ? path_1.default.dirname(main) : '.';
var userDir = process.env.HOME || process.env.USERPROFILE;
var c = read(dir) || read(process.cwd()) || (userDir && read(userDir)) || {};
c.deps = parseInt(opts['deps-level'] || '') || 0;
if (typeof c.depsLevel === 'number')
c.deps = c.depsLevel;
if (opts) {
// Overwrite with CLI opts ...
if (opts['deps'] || opts['all-deps'])
c.deps = -1;
if (opts.dedupe)
c.dedupe = true;
if (opts.respawn)
c.respawn = true;
if (opts.notify === false)
c.notify = false;
if (opts.clear || opts.cls)
c.clear = true;
c.fork = opts.fork;
}
var ignoreWatchItems = opts['ignore-watch']
? []
.concat(opts['ignore-watch'])
.map(function (_) { return _.trim(); })
: [];
var ignoreWatch = ignoreWatchItems.concat(c.ignore || []);
opts.debug && console.log('Ignore watch:', ignoreWatch);
var ignore = ignoreWatch.concat(ignoreWatch.map(resolvePath));
return {
vm: c.vm !== false,
fork: c.fork !== false,
notify: c.notify !== false,
deps: c.deps,
timestamp: c.timestamp || (c.timestamp !== false && 'HH:MM:ss'),
clear: !!c.clear,
dedupe: !!c.dedupe,
ignore: ignore,
respawn: c.respawn || false,
debug: !!opts.debug,
quiet: !!opts.quiet,
extensions: c.extensions,
};
};

16
backend/node_modules/ts-node-dev/lib/check-file-exists.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = __importDefault(require("fs"));
var filePath = process.argv[2];
var handler = function (stat) {
if (stat && stat.birthtime.getTime() > 0) {
process.exit(0);
}
};
fs_1.default.watchFile(filePath, { interval: 100 }, handler);
fs_1.default.stat(filePath, function (err, stat) {
handler(stat);
});

140
backend/node_modules/ts-node-dev/lib/child-require-hook.js generated vendored Executable file
View File

@@ -0,0 +1,140 @@
"use strict";
var fs = require('fs');
var getCompiledPath = require('./get-compiled-path').getCompiledPath;
var sep = require('path').sep;
var join = require('path').join;
var extname = require('path').extname;
var execSync = require('child_process').execSync;
var Module = require('module');
var compilationId = '';
var timeThreshold = 0;
var allowJs = false;
var compiledDir = '';
var preferTs = false;
var ignore = [/node_modules/];
var readyFile = '';
var execCheck = false;
var exitChild = false;
var sourceMapSupportPath = '';
var libPath = '';
var checkFileScript = join(__dirname, 'check-file-exists.js');
var waitForFile = function (fileName) {
var start = new Date().getTime();
while (true) {
var exists = execCheck
? execSync(['node', checkFileScript, '"' + fileName + '"'].join(' '), {
stdio: 'inherit',
}) || true
: fs.existsSync(fileName);
if (exists) {
return;
}
var passed = new Date().getTime() - start;
if (timeThreshold && passed > timeThreshold) {
throw new Error('Could not require ' + fileName);
}
}
};
var sendFsCompileRequest = function (fileName, compiledPath) {
var compileRequestFile = [compiledDir, compilationId + '.req'].join(sep);
fs.writeFileSync(compileRequestFile, [fileName, compiledPath].join('\n'));
};
var compile = function (code, fileName) {
var compiledPath = getCompiledPath(code, fileName, compiledDir);
if (process.send) {
try {
process.send({
compile: fileName,
compiledPath: compiledPath,
});
}
catch (e) {
console.warn('Error while sending compile request via process.send');
sendFsCompileRequest(fileName, compiledPath);
}
}
else {
sendFsCompileRequest(fileName, compiledPath);
}
waitForFile(compiledPath + '.done');
var compiled = fs.readFileSync(compiledPath, 'utf-8');
return compiled;
};
function registerExtensions(extensions) {
extensions.forEach(function (ext) {
var old = require.extensions[ext] || require.extensions['.js'];
require.extensions[ext] = function (m, fileName) {
var _compile = m._compile;
m._compile = function (code, fileName) {
return _compile.call(this, compile(code, fileName), fileName);
};
return old(m, fileName);
};
});
if (preferTs) {
var reorderRequireExtension_1 = function (ext) {
var old = require.extensions[ext];
delete require.extensions[ext];
require.extensions[ext] = old;
};
var order = ['.ts', '.tsx'].concat(Object.keys(require.extensions).filter(function (_) { return _ !== '.ts' && _ !== '.tsx'; }));
order.forEach(function (ext) {
reorderRequireExtension_1(ext);
});
}
}
function isFileInNodeModules(fileName) {
return fileName.indexOf(sep + 'node_modules' + sep) >= 0;
}
function registerJsExtension() {
var old = require.extensions['.js'];
// handling preferTs probably redundant after reordering
if (allowJs) {
require.extensions['.jsx'] = require.extensions['.js'] = function (m, fileName) {
if (fileName.indexOf(libPath) === 0) {
return old(m, fileName);
}
var tsCode = undefined;
var tsFileName = '';
var _compile = m._compile;
var isIgnored = ignore &&
ignore.reduce(function (res, ignore) {
return res || ignore.test(fileName);
}, false);
var ext = extname(fileName);
if (tsCode !== undefined || (allowJs && !isIgnored && ext == '.js')) {
m._compile = function (code, fileName) {
if (tsCode !== undefined) {
code = tsCode;
fileName = tsFileName;
}
return _compile.call(this, compile(code, fileName), fileName);
};
}
return old(m, fileName);
};
}
}
var sourceMapRequire = Module.createRequire
? Module.createRequire(sourceMapSupportPath)
: require;
sourceMapRequire(sourceMapSupportPath).install({
hookRequire: true,
});
registerJsExtension();
registerExtensions(['.ts', '.tsx']);
if (readyFile) {
var time = new Date().getTime();
while (!fs.existsSync(readyFile)) {
if (new Date().getTime() - time > 5000) {
throw new Error('Waiting ts-node-dev ready file failed');
}
}
}
if (exitChild) {
process.on('SIGTERM', function () {
console.log('Child got SIGTERM, exiting.');
process.exit();
});
}
module.exports.registerExtensions = registerExtensions;

290
backend/node_modules/ts-node-dev/lib/compiler.js generated vendored Executable file
View File

@@ -0,0 +1,290 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCompiler = void 0;
var tsNode = __importStar(require("ts-node"));
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
var os_1 = __importDefault(require("os"));
var mkdirp_1 = __importDefault(require("mkdirp"));
var rimraf_1 = __importDefault(require("rimraf"));
var tsconfig_1 = require("tsconfig");
var get_compiled_path_1 = require("./get-compiled-path");
var get_cwd_1 = require("./get-cwd");
var fixPath = function (p) { return p.replace(/\\/g, '/').replace(/\$/g, '$$$$'); };
var sourceMapSupportPath = require.resolve('source-map-support');
var compileExtensions = ['.ts', '.tsx'];
var cwd = process.cwd();
var compilationInstanceStamp = Math.random().toString().slice(2);
var originalJsHandler = require.extensions['.js'];
var parse = function (value) {
return typeof value === 'string' ? JSON.parse(value) : undefined;
};
function split(value) {
return typeof value === 'string'
? value.split(/ *, */g).filter(function (v) { return v !== ''; })
: undefined;
}
exports.makeCompiler = function (options, _a) {
var log = _a.log, restart = _a.restart;
var _errorCompileTimeout;
var allowJs = false;
var project = options['project'];
var tsConfigPath = tsconfig_1.resolveSync(cwd, typeof project === 'string' ? project : undefined) || '';
var compiledPathsHash = {};
var tmpDir = options['cache-directory']
? path_1.default.resolve(options['cache-directory'])
: fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), '.ts-node'));
var writeChildHookFile = function (options) {
var compileTimeout = parseInt(options['compile-timeout']);
var getIgnoreVal = function (ignore) {
var ignoreVal = !ignore || ignore === 'false'
? 'false'
: '[' +
ignore
.split(/,/)
.map(function (i) { return i.trim(); })
.map(function (ignore) { return 'new RegExp("' + ignore + '")'; })
.join(', ') +
']';
return ignoreVal;
};
var varDecl = function (name, value) { return "var " + name + " = '" + value + "'"; };
var replacements = [
compileTimeout ? ['10000', compileTimeout.toString()] : null,
allowJs ? ['allowJs = false', 'allowJs = true'] : null,
options['prefer-ts-exts']
? ['preferTs = false', 'preferTs = true']
: null,
options['exec-check'] ? ['execCheck = false', 'execCheck = true'] : null,
options['exit-child'] ? ['exitChild = false', 'exitChild = true'] : null,
options['ignore'] !== undefined
? [
'var ignore = [/node_modules/]',
'var ignore = ' + getIgnoreVal(options['ignore']),
]
: null,
[
varDecl('compilationId', ''),
varDecl('compilationId', getCompilationId()),
],
[varDecl('compiledDir', ''), varDecl('compiledDir', getCompiledDir())],
[
'./get-compiled-path',
fixPath(path_1.default.join(__dirname, 'get-compiled-path')),
],
[
varDecl('readyFile', ''),
varDecl('readyFile', getCompilerReadyFilePath()),
],
[
varDecl('sourceMapSupportPath', ''),
varDecl('sourceMapSupportPath', fixPath(sourceMapSupportPath)),
],
[
varDecl('libPath', ''),
varDecl('libPath', __dirname.replace(/\\/g, '\\\\')),
],
['__dirname', '"' + fixPath(__dirname) + '"'],
]
.filter(function (_) { return !!_; })
.map(function (_) { return _; });
var fileText = fs_1.default.readFileSync(path_1.default.join(__dirname, 'child-require-hook.js'), 'utf-8');
var fileData = replacements.reduce(function (text, _a) {
var what = _a[0], to = _a[1];
return text.replace(what, to);
}, fileText);
fs_1.default.writeFileSync(getChildHookPath(), fileData);
};
var init = function () {
registerTsNode();
/* clean up compiled on each new init*/
rimraf_1.default.sync(getCompiledDir());
createCompiledDir();
// check if `allowJs` compiler option enable
// (.js handler was changed while ts-node registration)
allowJs = require.extensions['.js'] !== originalJsHandler;
if (allowJs) {
compileExtensions.push('.js', '.jsx');
}
writeChildHookFile(options);
};
var getCompilationId = function () {
return compilationInstanceStamp;
};
var createCompiledDir = function () {
var compiledDir = getCompiledDir();
if (!fs_1.default.existsSync(compiledDir)) {
mkdirp_1.default.sync(getCompiledDir());
}
};
var getCompiledDir = function () {
return path_1.default.join(tmpDir, 'compiled').replace(/\\/g, '/');
};
var getCompileReqFilePath = function () {
return path_1.default.join(getCompiledDir(), getCompilationId() + '.req');
};
var getCompilerReadyFilePath = function () {
return path_1.default
.join(os_1.default.tmpdir(), 'ts-node-dev-ready-' + compilationInstanceStamp)
.replace(/\\/g, '/');
};
var getChildHookPath = function () {
return path_1.default
.join(os_1.default.tmpdir(), 'ts-node-dev-hook-' + compilationInstanceStamp + '.js')
.replace(/\\/g, '/');
};
var writeReadyFile = function () {
fs_1.default.writeFileSync(getCompilerReadyFilePath(), '');
};
var clearErrorCompile = function () {
clearTimeout(_errorCompileTimeout);
};
var registerTsNode = function () {
Object.keys(compiledPathsHash).forEach(function (key) {
delete compiledPathsHash[key];
});
['.js', '.jsx', '.ts', '.tsx'].forEach(function (ext) {
require.extensions[ext] = originalJsHandler;
});
var scriptPath = options._.length
? path_1.default.resolve(cwd, options._[0])
: undefined;
tsNode.register({
// --dir does not work (it gives a boolean only) so we only check for script-mode
dir: get_cwd_1.getCwd(options['dir'], options['script-mode'], scriptPath),
scope: options['scope'],
scopeDir: options['scopeDir'],
emit: options['emit'],
files: options['files'],
pretty: options['pretty'],
transpileOnly: options['transpile-only'],
ignore: options['ignore'] ? split(options['ignore']) : undefined,
preferTsExts: options['prefer-ts-exts'],
logError: options['log-error'],
project: options['project'],
skipProject: options['skip-project'],
transpiler: options['transpiler'],
skipIgnore: options['skip-ignore'],
compiler: options['compiler'],
compilerHost: options['compiler-host'],
ignoreDiagnostics: options['ignore-diagnostics']
? split(options['ignore-diagnostics'])
: undefined,
compilerOptions: parse(options['compiler-options']),
});
};
var compiler = {
tsConfigPath: tsConfigPath,
init: init,
getCompileReqFilePath: getCompileReqFilePath,
getChildHookPath: getChildHookPath,
writeReadyFile: writeReadyFile,
clearErrorCompile: clearErrorCompile,
compileChanged: function (fileName) {
var ext = path_1.default.extname(fileName);
if (compileExtensions.indexOf(ext) < 0)
return;
try {
var code = fs_1.default.readFileSync(fileName, 'utf-8');
compiler.compile({
code: code,
compile: fileName,
compiledPath: get_compiled_path_1.getCompiledPath(code, fileName, getCompiledDir()),
});
}
catch (e) {
console.error(e);
}
},
compile: function (params) {
var fileName = params.compile;
var code = fs_1.default.readFileSync(fileName, 'utf-8');
var compiledPath = params.compiledPath;
// Prevent occasional duplicate compilation requests
if (compiledPathsHash[compiledPath]) {
return;
}
compiledPathsHash[compiledPath] = true;
function writeCompiled(code, fileName) {
fs_1.default.writeFile(compiledPath, code, function (err) {
err && log.error(err);
fs_1.default.writeFile(compiledPath + '.done', '', function (err) {
err && log.error(err);
});
});
}
if (fs_1.default.existsSync(compiledPath)) {
return;
}
var starTime = new Date().getTime();
var m = {
_compile: writeCompiled,
};
var _compile = function () {
var ext = path_1.default.extname(fileName);
var extHandler = require.extensions[ext];
extHandler(m, fileName);
log.debug(fileName, 'compiled in', new Date().getTime() - starTime, 'ms');
};
try {
_compile();
}
catch (e) {
console.error('Compilation error in', fileName);
var errorCode = 'throw ' +
'new Error(' +
JSON.stringify(e.message) +
')' +
';';
writeCompiled(errorCode);
// reinitialize ts-node compilation to clean up state after error
// without timeout in causes cases error not be printed out
setTimeout(function () {
registerTsNode();
}, 0);
if (!options['error-recompile']) {
return;
}
var timeoutMs_1 = parseInt(process.env.TS_NODE_DEV_ERROR_RECOMPILE_TIMEOUT || '0') ||
5000;
var errorHandler_1 = function () {
clearTimeout(_errorCompileTimeout);
_errorCompileTimeout = setTimeout(function () {
try {
_compile();
restart(fileName);
}
catch (e) {
registerTsNode();
errorHandler_1();
}
}, timeoutMs_1);
};
errorHandler_1();
}
},
};
return compiler;
};

2
backend/node_modules/ts-node-dev/lib/dedupe.js generated vendored Executable file
View File

@@ -0,0 +1,2 @@
"use strict";
require('dynamic-dedupe').activate();

18
backend/node_modules/ts-node-dev/lib/get-compiled-path.js generated vendored Executable file
View File

@@ -0,0 +1,18 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCompiledPath = void 0;
var crypto_1 = __importDefault(require("crypto"));
var path_1 = __importDefault(require("path"));
var cwd = process.cwd();
exports.getCompiledPath = function (code, fileName, compiledDir) {
var hash = crypto_1.default
.createHash('sha256')
.update(fileName + code, 'utf8')
.digest('hex');
fileName = path_1.default.relative(cwd, fileName);
var hashed = fileName.replace(/[^\w]/g, '_') + '_' + hash + '.js';
return path_1.default.join(compiledDir, hashed);
};

49
backend/node_modules/ts-node-dev/lib/get-cwd.js generated vendored Executable file
View File

@@ -0,0 +1,49 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCwd = void 0;
var path_1 = __importDefault(require("path"));
var hasOwnProperty = function (object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
};
exports.getCwd = function (dir, scriptMode, scriptPath) {
if (scriptMode) {
if (!scriptPath) {
console.error('Script mode must be used with a script name, e.g. `ts-node-dev -s <script.ts>`');
process.exit();
}
if (dir) {
console.error('Script mode cannot be combined with `--dir`');
process.exit();
}
// Use node's own resolution behavior to ensure we follow symlinks.
// scriptPath may omit file extension or point to a directory with or without package.json.
// This happens before we are registered, so we tell node's resolver to consider ts, tsx, and jsx files.
// In extremely rare cases, is is technically possible to resolve the wrong directory,
// because we do not yet know preferTsExts, jsx, nor allowJs.
// See also, justification why this will not happen in real-world situations:
// https://github.com/TypeStrong/ts-node/pull/1009#issuecomment-613017081
var exts = ['.js', '.jsx', '.ts', '.tsx'];
var extsTemporarilyInstalled = [];
for (var _i = 0, exts_1 = exts; _i < exts_1.length; _i++) {
var ext = exts_1[_i];
if (!hasOwnProperty(require.extensions, ext)) {
// tslint:disable-line
extsTemporarilyInstalled.push(ext);
require.extensions[ext] = function () { }; // tslint:disable-line
}
}
try {
return path_1.default.dirname(require.resolve(scriptPath));
}
finally {
for (var _a = 0, extsTemporarilyInstalled_1 = extsTemporarilyInstalled; _a < extsTemporarilyInstalled_1.length; _a++) {
var ext = extsTemporarilyInstalled_1[_a];
delete require.extensions[ext]; // tslint:disable-line
}
}
}
return dir;
};

68
backend/node_modules/ts-node-dev/lib/hook.js generated vendored Executable file
View File

@@ -0,0 +1,68 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeHook = void 0;
var vm_1 = __importDefault(require("vm"));
exports.makeHook = function (cfg, wrapper, callback) {
// Hook into Node's `require(...)`
updateHooks();
// Patch the vm module to watch files executed via one of these methods:
if (cfg.vm) {
patch(vm_1.default, 'createScript', 1);
patch(vm_1.default, 'runInThisContext', 1);
patch(vm_1.default, 'runInNewContext', 2);
patch(vm_1.default, 'runInContext', 2);
}
/**
* Patch the specified method to watch the file at the given argument
* index.
*/
function patch(obj, method, optionsArgIndex) {
var orig = obj[method];
if (!orig)
return;
obj[method] = function () {
var opts = arguments[optionsArgIndex];
var file = null;
if (opts) {
file = typeof opts == 'string' ? opts : opts.filename;
}
if (file)
callback(file);
return orig.apply(this, arguments);
};
}
/**
* (Re-)install hooks for all registered file extensions.
*/
function updateHooks() {
Object.keys(require.extensions).forEach(function (ext) {
var fn = require.extensions[ext];
if (typeof fn === 'function' && fn.name !== 'nodeDevHook') {
require.extensions[ext] = createHook(fn);
}
});
}
/**
* Returns a function that can be put into `require.extensions` in order to
* invoke the callback when a module is required for the first time.
*/
function createHook(handler) {
return function nodeDevHook(module, filename) {
if (module.parent === wrapper) {
// If the main module is required conceal the wrapper
module.id = '.';
module.parent = null;
process.mainModule = module;
}
if (!module.loaded)
callback(module.filename);
// Invoke the original handler
handler(module, filename);
// Make sure the module did not hijack the handler
updateHooks();
};
}
};

286
backend/node_modules/ts-node-dev/lib/index.js generated vendored Executable file
View File

@@ -0,0 +1,286 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runDev = void 0;
var child_process_1 = require("child_process");
var chokidar_1 = __importDefault(require("chokidar"));
var fs_1 = __importDefault(require("fs"));
var readline_1 = __importDefault(require("readline"));
var kill = require('tree-kill');
var ipc = __importStar(require("./ipc"));
var resolveMain_1 = require("./resolveMain");
var compiler_1 = require("./compiler");
var cfg_1 = require("./cfg");
var notify_1 = require("./notify");
var log_1 = require("./log");
var version = require('../package.json').version;
var tsNodeVersion = require('ts-node').VERSION;
var tsVersion = require('typescript').version;
exports.runDev = function (script, scriptArgs, nodeArgs, opts) {
if (typeof script !== 'string' || script.length === 0) {
throw new TypeError('`script` must be a string');
}
if (!Array.isArray(scriptArgs)) {
throw new TypeError('`scriptArgs` must be an array');
}
if (!Array.isArray(nodeArgs)) {
throw new TypeError('`nodeArgs` must be an array');
}
// The child_process
var child;
var wrapper = resolveMain_1.resolveMain(__dirname + '/wrap.js');
var main = resolveMain_1.resolveMain(script);
var cfg = cfg_1.makeCfg(main, opts);
var log = log_1.makeLog(cfg);
var notify = notify_1.makeNotify(cfg, log);
// Run ./dedupe.js as preload script
if (cfg.dedupe)
process.env.NODE_DEV_PRELOAD = __dirname + '/dedupe';
function initWatcher() {
var watcher = chokidar_1.default.watch([], {
usePolling: opts.poll,
interval: parseInt(opts.interval) || undefined,
});
watcher.on('change', restart);
watcher.on('fallback', function (limit) {
log.warn('node-dev ran out of file handles after watching %s files.', limit);
log.warn('Falling back to polling which uses more CPU.');
log.info('Run ulimit -n 10000 to increase the file descriptor limit.');
if (cfg.deps)
log.info('... or add `--no-deps` to use less file handles.');
});
return watcher;
}
var watcher = initWatcher();
var starting = false;
// Read for "rs" from command line
if (opts.rs !== false) {
var rl = readline_1.default.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
rl.on('line', function (line) {
if (line.trim() === 'rs') {
restart('', true);
}
});
}
log.info('ts-node-dev ver. ' +
version +
' (using ts-node ver. ' +
tsNodeVersion +
', typescript ver. ' +
tsVersion +
')');
/**
* Run the wrapped script.
*/
var compileReqWatcher;
function start() {
if (cfg.clear)
process.stdout.write('\u001bc');
for (var _i = 0, _a = (opts.watch || '').split(','); _i < _a.length; _i++) {
var watched = _a[_i];
if (watched)
watcher.add(watched);
}
var cmd = nodeArgs.concat(wrapper, script, scriptArgs);
var childHookPath = compiler.getChildHookPath();
cmd = (opts.priorNodeArgs || []).concat(['-r', childHookPath]).concat(cmd);
log.debug('Starting child process %s', cmd.join(' '));
child = child_process_1.fork(cmd[0], cmd.slice(1), {
cwd: process.cwd(),
env: process.env,
});
starting = false;
if (compileReqWatcher) {
compileReqWatcher.close();
}
compileReqWatcher = chokidar_1.default.watch([], {
usePolling: opts.poll,
interval: parseInt(opts.interval) || undefined,
});
var currentCompilePath;
fs_1.default.writeFileSync(compiler.getCompileReqFilePath(), '');
compileReqWatcher.add(compiler.getCompileReqFilePath());
compileReqWatcher.on('change', function (file) {
fs_1.default.readFile(file, 'utf-8', function (err, data) {
if (err) {
log.error('Error reading compile request file', err);
return;
}
var split = data.split('\n');
var compile = split[0];
var compiledPath = split[1];
if (currentCompilePath == compiledPath)
return;
currentCompilePath = compiledPath;
if (compiledPath) {
compiler.compile({
compile: compile,
compiledPath: compiledPath,
});
}
});
});
child.on('message', function (message) {
if (!message.compiledPath ||
currentCompilePath === message.compiledPath) {
return;
}
currentCompilePath = message.compiledPath;
compiler.compile(message);
});
child.on('exit', function (code) {
log.debug('Child exited with code %s', code);
if (!child)
return;
if (!child.respawn)
process.exit(code || 0);
child = undefined;
});
if (cfg.respawn) {
child.respawn = true;
}
if (compiler.tsConfigPath) {
watcher.add(compiler.tsConfigPath);
}
// Listen for `required` messages and watch the required file.
ipc.on(child, 'required', function (m) {
var required = m.required;
var isIgnored = cfg.ignore.some(isPrefixOf(required)) ||
cfg.ignore.some(isRegExpMatch(required));
if (!isIgnored && (cfg.deps === -1 || getLevel(required) <= cfg.deps)) {
log.debug(required, 'added to watcher');
watcher.add(required);
}
});
// Upon errors, display a notification and tell the child to exit.
ipc.on(child, 'error', function (m) {
log.debug('Child error');
notify(m.error, m.message, 'error');
stop(m.willTerminate);
});
compiler.writeReadyFile();
}
var killChild = function () {
if (!child)
return;
log.debug('Sending SIGTERM kill to child pid', child.pid);
if (opts['tree-kill']) {
log.debug('Using tree-kill');
kill(child.pid);
}
else {
child.kill('SIGTERM');
}
};
function stop(willTerminate) {
if (!child || child.stopping) {
return;
}
child.stopping = true;
child.respawn = true;
if (child.connected === undefined || child.connected === true) {
log.debug('Disconnecting from child');
child.disconnect();
if (!willTerminate) {
killChild();
}
}
}
function restart(file, isManualRestart) {
if (file === compiler.tsConfigPath) {
notify('Reinitializing TS compilation', '');
compiler.init();
}
compiler.clearErrorCompile();
if (isManualRestart === true) {
notify('Restarting', 'manual restart from user');
}
else {
notify('Restarting', file + ' has been modified');
}
compiler.compileChanged(file);
if (starting) {
log.debug('Already starting');
return;
}
log.debug('Removing all watchers from files');
//watcher.removeAll()ya
watcher.close();
watcher = initWatcher();
starting = true;
if (child) {
log.debug('Child is still running, restart upon exit');
child.on('exit', start);
stop();
}
else {
log.debug('Child is already stopped, probably due to a previous error');
start();
}
}
// Relay SIGTERM
process.on('SIGTERM', function () {
log.debug('Process got SIGTERM');
killChild();
process.exit(0);
});
var compiler = compiler_1.makeCompiler(opts, {
restart: restart,
log: log,
});
compiler.init();
start();
};
/**
* Returns the nesting-level of the given module.
* Will return 0 for modules from the main package or linked modules,
* a positive integer otherwise.
*/
function getLevel(mod) {
var p = getPrefix(mod);
return p.split('node_modules').length - 1;
}
/**
* Returns the path up to the last occurence of `node_modules` or an
* empty string if the path does not contain a node_modules dir.
*/
function getPrefix(mod) {
var n = 'node_modules';
var i = mod.lastIndexOf(n);
return ~i ? mod.slice(0, i + n.length) : '';
}
function isPrefixOf(value) {
return function (prefix) {
return value.indexOf(prefix) === 0;
};
}
function isRegExpMatch(value) {
return function (regExp) {
return new RegExp(regExp).test(value);
};
}

35
backend/node_modules/ts-node-dev/lib/ipc.js generated vendored Executable file
View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.relay = exports.on = exports.send = void 0;
/**
* Checks if the given message is an internal node-dev message.
*/
function isNodeDevMessage(m) {
return m.cmd === 'NODE_DEV';
}
/**
* Sends a message to the given process.
*/
exports.send = function (m, dest) {
if (dest === void 0) { dest = process; }
m.cmd = 'NODE_DEV';
if (dest.send)
dest.send(m);
};
exports.on = function (proc, type, cb) {
function handleMessage(m) {
if (isNodeDevMessage(m) && type in m)
cb(m);
}
proc.on('internalMessage', handleMessage);
proc.on('message', handleMessage);
};
exports.relay = function (src, dest) {
if (dest === void 0) { dest = process; }
function relayMessage(m) {
if (isNodeDevMessage(m))
dest.send(m);
}
src.on('internalMessage', relayMessage);
src.on('message', relayMessage);
};

50
backend/node_modules/ts-node-dev/lib/log.js generated vendored Executable file
View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeLog = void 0;
var util = require('util');
var colors = {
info: '36',
error: '31;1',
warn: '33',
debug: '90',
};
var formatDate = function (date) {
return [date.getHours(), date.getMinutes(), date.getSeconds()]
.map(function (n) { return n.toString().padStart(2, '0'); })
.join(':');
};
/**
* Logs a message to the console. The level is displayed in ANSI colors,
* either bright red in case of an error or green otherwise.
*/
exports.makeLog = function (cfg) {
function log(msg, level) {
if (cfg.quiet && level === 'info')
return;
if (cfg.timestamp)
msg = color(formatDate(new Date()), '30;1') + ' ' + msg;
var c = colors[level.toLowerCase()] || '32';
console.log('[' + color(level.toUpperCase(), c) + '] ' + msg);
}
function color(s, c) {
if (process.stdout.isTTY) {
return '\x1B[' + c + 'm' + s + '\x1B[0m';
}
return s;
}
log.debug = function () {
if (!cfg.debug)
return;
log(util.format.apply(util, arguments), 'debug');
};
log.info = function () {
log(util.format.apply(util, arguments), 'info');
};
log.warn = function () {
log(util.format.apply(util, arguments), 'warn');
};
log.error = function () {
log(util.format.apply(util, arguments), 'error');
};
return log;
};

33
backend/node_modules/ts-node-dev/lib/notify.js generated vendored Executable file
View File

@@ -0,0 +1,33 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeNotify = void 0;
var path_1 = __importDefault(require("path"));
var notifier = null;
try {
notifier = require('node-notifier');
}
catch (error) {
notifier = null;
}
function icon(level) {
return path_1.default.resolve(__dirname, '../icons/node_' + level + '.png');
}
/**
* Displays a desktop notification and writes a message to the console.
*/
exports.makeNotify = function (cfg, log) {
return function (title, msg, level) {
level = level || 'info';
log([title, msg].filter(function (_) { return _; }).join(': '), level);
if (notifier !== null && cfg.notify) {
notifier.notify({
title: title || 'node.js',
icon: icon(level),
message: msg,
});
}
};
};

33
backend/node_modules/ts-node-dev/lib/resolveMain.js generated vendored Executable file
View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveMain = void 0;
var resolve = require('resolve');
function resolveRequest(req) {
// The `resolve` package is prebuilt through ncc, which prevents
// PnP from being able to inject itself into it. To circumvent
// this, we simply use PnP directly when available.
if (process.versions.pnp) {
var resolveRequest_1 = require("pnpapi").resolveRequest;
return resolveRequest_1(req, process.cwd() + '/');
}
else {
var opts = {
basedir: process.cwd(),
paths: [process.cwd()],
};
return resolve.sync(req, opts);
}
}
exports.resolveMain = function (main) {
try {
return resolveRequest(main + '.ts');
}
catch (e) {
try {
return resolveRequest(main + '/index.ts');
}
catch (e) {
return resolveRequest(main);
}
}
};

104
backend/node_modules/ts-node-dev/lib/wrap.js generated vendored Executable file
View File

@@ -0,0 +1,104 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var childProcess = require('child_process');
var child_process_1 = require("child_process");
var resolve = require('resolve').sync;
var hook_1 = require("./hook");
var ipc = __importStar(require("./ipc"));
var resolveMain_1 = require("./resolveMain");
var cfg_1 = require("./cfg");
// const Module = require('module')
// Remove wrap.js from the argv array
process.argv.splice(1, 1);
// Resolve the location of the main script relative to cwd
var main = resolveMain_1.resolveMain(process.argv[1]);
var cfg = cfg_1.makeCfg(main, {});
if (process.env.TS_NODE_DEV === undefined) {
process.env.TS_NODE_DEV = 'true';
}
if (process.env.NODE_DEV_PRELOAD) {
require(process.env.NODE_DEV_PRELOAD);
}
// Listen SIGTERM and exit unless there is another listener
process.on('SIGTERM', function () {
if (process.listeners('SIGTERM').length === 1)
process.exit(0);
});
if (cfg.fork) {
var oldFork_1 = child_process_1.fork;
// Overwrite child_process.fork() so that we can hook into forked processes
// too. We also need to relay messages about required files to the parent.
var newFork = function (modulePath, args, options) {
var child = oldFork_1(__filename, [modulePath].concat(args), options);
ipc.relay(child);
return child;
};
childProcess.fork = newFork;
}
// const lastRequired = null
// const origRequire = Module.prototype.require
// Module.prototype.require = function (requirePath) {
// lastRequired = { path: requirePath, filename: this.filename }
// return origRequire.apply(this, arguments)
// }
// Error handler that displays a notification and logs the stack to stderr:
var caught = false;
process.on('uncaughtException', function (err) {
// NB: err can be null
// Handle exception only once
if (caught)
return;
caught = true;
// If there's a custom uncaughtException handler expect it to terminate
// the process.
var hasCustomHandler = process.listeners('uncaughtException').length > 1;
var isTsError = err && err.message && /TypeScript/.test(err.message);
if (!hasCustomHandler && !isTsError) {
console.error((err && err.stack) || err);
}
ipc.send({
error: isTsError ? '' : (err && err.name) || 'Error',
// lastRequired: lastRequired,
message: err ? err.message : '',
code: err && err.code,
willTerminate: hasCustomHandler,
});
});
// Hook into require() and notify the parent process about required files
hook_1.makeHook(cfg, module, function (file) {
ipc.send({ required: file });
});
// Check if a module is registered for this extension
// const ext = path.extname(main).slice(1)
// const mod = cfg.extensions[ext]
// // Support extensions where 'require' returns a function that accepts options
// if (typeof mod == 'object' && mod.name) {
// const fn = require(resolve(mod.name, { basedir: path.dirname(main) }))
// if (typeof fn == 'function' && mod.options) {
// // require returned a function, call it with options
// fn(mod.options)
// }
// } else if (typeof mod == 'string') {
// require(resolve(mod, { basedir: path.dirname(main) }))
// }
// Execute the wrapped script
require(main);

16
backend/node_modules/ts-node-dev/node_modules/.bin/mkdirp generated vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
else
exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
fi

View File

@@ -0,0 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
} else {
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
} else {
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

View File

@@ -0,0 +1,15 @@
# Changers Lorgs!
## 1.0
Full rewrite. Essentially a brand new module.
- Return a promise instead of taking a callback.
- Use native `fs.mkdir(path, { recursive: true })` when available.
- Drop support for outdated Node.js versions. (Technically still works on
Node.js v8, but only 10 and above are officially supported.)
## 0.x
Original and most widely used recursive directory creation implementation
in JavaScript, dating back to 2010.

21
backend/node_modules/ts-node-dev/node_modules/mkdirp/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,21 @@
Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
This project is free software released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,68 @@
#!/usr/bin/env node
const usage = () => `
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Create each supplied directory including any necessary parent directories
that don't yet exist.
If the directory already exists, do nothing.
OPTIONS are:
-m<mode> If a directory needs to be created, set the mode as an octal
--mode=<mode> permission string.
-v --version Print the mkdirp version number
-h --help Print this helpful banner
-p --print Print the first directories created for each path provided
--manual Use manual implementation, even if native is available
`
const dirs = []
const opts = {}
let print = false
let dashdash = false
let manual = false
for (const arg of process.argv.slice(2)) {
if (dashdash)
dirs.push(arg)
else if (arg === '--')
dashdash = true
else if (arg === '--manual')
manual = true
else if (/^-h/.test(arg) || /^--help/.test(arg)) {
console.log(usage())
process.exit(0)
} else if (arg === '-v' || arg === '--version') {
console.log(require('../package.json').version)
process.exit(0)
} else if (arg === '-p' || arg === '--print') {
print = true
} else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
if (isNaN(mode)) {
console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
process.exit(1)
}
opts.mode = mode
} else
dirs.push(arg)
}
const mkdirp = require('../')
const impl = manual ? mkdirp.manual : mkdirp
if (dirs.length === 0)
console.error(usage())
Promise.all(dirs.map(dir => impl(dir, opts)))
.then(made => print ? made.forEach(m => m && console.log(m)) : null)
.catch(er => {
console.error(er.message)
if (er.code)
console.error(' code: ' + er.code)
process.exit(1)
})

View File

@@ -0,0 +1,31 @@
const optsArg = require('./lib/opts-arg.js')
const pathArg = require('./lib/path-arg.js')
const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
const {useNative, useNativeSync} = require('./lib/use-native.js')
const mkdirp = (path, opts) => {
path = pathArg(path)
opts = optsArg(opts)
return useNative(opts)
? mkdirpNative(path, opts)
: mkdirpManual(path, opts)
}
const mkdirpSync = (path, opts) => {
path = pathArg(path)
opts = optsArg(opts)
return useNativeSync(opts)
? mkdirpNativeSync(path, opts)
: mkdirpManualSync(path, opts)
}
mkdirp.sync = mkdirpSync
mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
module.exports = mkdirp

View File

@@ -0,0 +1,29 @@
const {dirname} = require('path')
const findMade = (opts, parent, path = undefined) => {
// we never want the 'made' return value to be a root directory
if (path === parent)
return Promise.resolve()
return opts.statAsync(parent).then(
st => st.isDirectory() ? path : undefined, // will fail later
er => er.code === 'ENOENT'
? findMade(opts, dirname(parent), parent)
: undefined
)
}
const findMadeSync = (opts, parent, path = undefined) => {
if (path === parent)
return undefined
try {
return opts.statSync(parent).isDirectory() ? path : undefined
} catch (er) {
return er.code === 'ENOENT'
? findMadeSync(opts, dirname(parent), parent)
: undefined
}
}
module.exports = {findMade, findMadeSync}

View File

@@ -0,0 +1,64 @@
const {dirname} = require('path')
const mkdirpManual = (path, opts, made) => {
opts.recursive = false
const parent = dirname(path)
if (parent === path) {
return opts.mkdirAsync(path, opts).catch(er => {
// swallowed by recursive implementation on posix systems
// any other error is a failure
if (er.code !== 'EISDIR')
throw er
})
}
return opts.mkdirAsync(path, opts).then(() => made || path, er => {
if (er.code === 'ENOENT')
return mkdirpManual(parent, opts)
.then(made => mkdirpManual(path, opts, made))
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
throw er
return opts.statAsync(path).then(st => {
if (st.isDirectory())
return made
else
throw er
}, () => { throw er })
})
}
const mkdirpManualSync = (path, opts, made) => {
const parent = dirname(path)
opts.recursive = false
if (parent === path) {
try {
return opts.mkdirSync(path, opts)
} catch (er) {
// swallowed by recursive implementation on posix systems
// any other error is a failure
if (er.code !== 'EISDIR')
throw er
else
return
}
}
try {
opts.mkdirSync(path, opts)
return made || path
} catch (er) {
if (er.code === 'ENOENT')
return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
if (er.code !== 'EEXIST' && er.code !== 'EROFS')
throw er
try {
if (!opts.statSync(path).isDirectory())
throw er
} catch (_) {
throw er
}
}
}
module.exports = {mkdirpManual, mkdirpManualSync}

View File

@@ -0,0 +1,39 @@
const {dirname} = require('path')
const {findMade, findMadeSync} = require('./find-made.js')
const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
const mkdirpNative = (path, opts) => {
opts.recursive = true
const parent = dirname(path)
if (parent === path)
return opts.mkdirAsync(path, opts)
return findMade(opts, path).then(made =>
opts.mkdirAsync(path, opts).then(() => made)
.catch(er => {
if (er.code === 'ENOENT')
return mkdirpManual(path, opts)
else
throw er
}))
}
const mkdirpNativeSync = (path, opts) => {
opts.recursive = true
const parent = dirname(path)
if (parent === path)
return opts.mkdirSync(path, opts)
const made = findMadeSync(opts, path)
try {
opts.mkdirSync(path, opts)
return made
} catch (er) {
if (er.code === 'ENOENT')
return mkdirpManualSync(path, opts)
else
throw er
}
}
module.exports = {mkdirpNative, mkdirpNativeSync}

View File

@@ -0,0 +1,23 @@
const { promisify } = require('util')
const fs = require('fs')
const optsArg = opts => {
if (!opts)
opts = { mode: 0o777, fs }
else if (typeof opts === 'object')
opts = { mode: 0o777, fs, ...opts }
else if (typeof opts === 'number')
opts = { mode: opts, fs }
else if (typeof opts === 'string')
opts = { mode: parseInt(opts, 8), fs }
else
throw new TypeError('invalid options argument')
opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
opts.mkdirAsync = promisify(opts.mkdir)
opts.stat = opts.stat || opts.fs.stat || fs.stat
opts.statAsync = promisify(opts.stat)
opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
return opts
}
module.exports = optsArg

View File

@@ -0,0 +1,29 @@
const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
const { resolve, parse } = require('path')
const pathArg = path => {
if (/\0/.test(path)) {
// simulate same failure that node raises
throw Object.assign(
new TypeError('path must be a string without null bytes'),
{
path,
code: 'ERR_INVALID_ARG_VALUE',
}
)
}
path = resolve(path)
if (platform === 'win32') {
const badWinChars = /[*|"<>?:]/
const {root} = parse(path)
if (badWinChars.test(path.substr(root.length))) {
throw Object.assign(new Error('Illegal characters in path.'), {
path,
code: 'EINVAL',
})
}
}
return path
}
module.exports = pathArg

View File

@@ -0,0 +1,10 @@
const fs = require('fs')
const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
const versArr = version.replace(/^v/, '').split('.')
const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
module.exports = {useNative, useNativeSync}

View File

@@ -0,0 +1,44 @@
{
"name": "mkdirp",
"description": "Recursively mkdir, like `mkdir -p`",
"version": "1.0.4",
"main": "index.js",
"keywords": [
"mkdir",
"directory",
"make dir",
"make",
"dir",
"recursive",
"native"
],
"repository": {
"type": "git",
"url": "https://github.com/isaacs/node-mkdirp.git"
},
"scripts": {
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags"
},
"tap": {
"check-coverage": true,
"coverage-map": "map.js"
},
"devDependencies": {
"require-inject": "^1.4.4",
"tap": "^14.10.7"
},
"bin": "bin/cmd.js",
"license": "MIT",
"engines": {
"node": ">=10"
},
"files": [
"bin",
"lib",
"index.js"
]
}

View File

@@ -0,0 +1,266 @@
# mkdirp
Like `mkdir -p`, but in Node.js!
Now with a modern API and no\* bugs!
<small>\* may contain some bugs</small>
# example
## pow.js
```js
const mkdirp = require('mkdirp')
// return value is a Promise resolving to the first directory created
mkdirp('/tmp/foo/bar/baz').then(made =>
console.log(`made directories, starting with ${made}`))
```
Output (where `/tmp/foo` already exists)
```
made directories, starting with /tmp/foo/bar
```
Or, if you don't have time to wait around for promises:
```js
const mkdirp = require('mkdirp')
// return value is the first directory created
const made = mkdirp.sync('/tmp/foo/bar/baz')
console.log(`made directories, starting with ${made}`)
```
And now /tmp/foo/bar/baz exists, huzzah!
# methods
```js
const mkdirp = require('mkdirp')
```
## mkdirp(dir, [opts]) -> Promise<String | undefined>
Create a new directory and any necessary subdirectories at `dir` with octal
permission string `opts.mode`. If `opts` is a string or number, it will be
treated as the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0o777 &
(~process.umask())`.
Promise resolves to first directory `made` that had to be created, or
`undefined` if everything already exists. Promise rejects if any errors
are encountered. Note that, in the case of promise rejection, some
directories _may_ have been created, as recursive directory creation is not
an atomic operation.
You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
and `opts.fs.stat(path, cb)`.
You can also override just one or the other of `mkdir` and `stat` by
passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
only overrides one of these.
## mkdirp.sync(dir, opts) -> String|null
Synchronously create a new directory and any necessary subdirectories at
`dir` with octal permission string `opts.mode`. If `opts` is a string or
number, it will be treated as the `opts.mode`.
If `opts.mode` isn't specified, it defaults to `0o777 &
(~process.umask())`.
Returns the first directory that had to be created, or undefined if
everything already exists.
You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
and `opts.fs.statSync(path)`.
You can also override just one or the other of `mkdirSync` and `statSync`
by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
option that only overrides one of these.
## mkdirp.manual, mkdirp.manualSync
Use the manual implementation (not the native one). This is the default
when the native implementation is not available or the stat/mkdir
implementation is overridden.
## mkdirp.native, mkdirp.nativeSync
Use the native implementation (not the manual one). This is the default
when the native implementation is available and stat/mkdir are not
overridden.
# implementation
On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
overridden by an option.
## native implementation
- If the path is a root directory, then pass it to the underlying
implementation and return the result/error. (In this case, it'll either
succeed or fail, but we aren't actually creating any dirs.)
- Walk up the path statting each directory, to find the first path that
will be created, `made`.
- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
- If error, raise it to the caller.
- Return `made`.
## manual implementation
- Call underlying `fs.mkdir` implementation, with `recursive: false`
- If error:
- If path is a root directory, raise to the caller and do not handle it
- If ENOENT, mkdirp parent dir, store result as `made`
- stat(path)
- If error, raise original `mkdir` error
- If directory, return `made`
- Else, raise original `mkdir` error
- else
- return `undefined` if a root dir, or `made` if set, or `path`
## windows vs unix caveat
On Windows file systems, attempts to create a root directory (ie, a drive
letter or root UNC path) will fail. If the root directory exists, then it
will fail with `EPERM`. If the root directory does not exist, then it will
fail with `ENOENT`.
On posix file systems, attempts to create a root directory (in recursive
mode) will succeed silently, as it is treated like just another directory
that already exists. (In non-recursive mode, of course, it fails with
`EEXIST`.)
In order to preserve this system-specific behavior (and because it's not as
if we can create the parent of a root directory anyway), attempts to create
a root directory are passed directly to the `fs` implementation, and any
errors encountered are not handled.
## native error caveat
The native implementation (as of at least Node.js v13.4.0) does not provide
appropriate errors in some cases (see
[nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
In order to work around this issue, the native implementation will fall
back to the manual implementation if an `ENOENT` error is encountered.
# choosing a recursive mkdir implementation
There are a few to choose from! Use the one that suits your needs best :D
## use `fs.mkdir(path, {recursive: true}, cb)` if:
- You wish to optimize performance even at the expense of other factors.
- You don't need to know the first dir created.
- You are ok with getting `ENOENT` as the error when some other problem is
the actual cause.
- You can limit your platforms to Node.js v10.12 and above.
- You're ok with using callbacks instead of promises.
- You don't need/want a CLI.
- You don't need to override the `fs` methods in use.
## use this module (mkdirp 1.x) if:
- You need to know the first directory that was created.
- You wish to use the native implementation if available, but fall back
when it's not.
- You prefer promise-returning APIs to callback-taking APIs.
- You want more useful error messages than the native recursive mkdir
provides (at least as of Node.js v13.4), and are ok with re-trying on
`ENOENT` to achieve this.
- You need (or at least, are ok with) a CLI.
- You need to override the `fs` methods in use.
## use [`make-dir`](http://npm.im/make-dir) if:
- You do not need to know the first dir created (and wish to save a few
`stat` calls when using the native implementation for this reason).
- You wish to use the native implementation if available, but fall back
when it's not.
- You prefer promise-returning APIs to callback-taking APIs.
- You are ok with occasionally getting `ENOENT` errors for failures that
are actually related to something other than a missing file system entry.
- You don't need/want a CLI.
- You need to override the `fs` methods in use.
## use mkdirp 0.x if:
- You need to know the first directory that was created.
- You need (or at least, are ok with) a CLI.
- You need to override the `fs` methods in use.
- You're ok with using callbacks instead of promises.
- You are not running on Windows, where the root-level ENOENT errors can
lead to infinite regress.
- You think vinyl just sounds warmer and richer for some weird reason.
- You are supporting truly ancient Node.js versions, before even the advent
of a `Promise` language primitive. (Please don't. You deserve better.)
# cli
This package also ships with a `mkdirp` command.
```
$ mkdirp -h
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
Create each supplied directory including any necessary parent directories
that don't yet exist.
If the directory already exists, do nothing.
OPTIONS are:
-m<mode> If a directory needs to be created, set the mode as an octal
--mode=<mode> permission string.
-v --version Print the mkdirp version number
-h --help Print this helpful banner
-p --print Print the first directories created for each path provided
--manual Use manual implementation, even if native is available
```
# install
With [npm](http://npmjs.org) do:
```
npm install mkdirp
```
to get the library locally, or
```
npm install -g mkdirp
```
to get the command everywhere, or
```
npx mkdirp ...
```
to run the command without installing it globally.
# platform support
This module works on node v8, but only v10 and above are officially
supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
the past, as of this writing.
# license
MIT

101
backend/node_modules/ts-node-dev/package.json generated vendored Executable file
View File

@@ -0,0 +1,101 @@
{
"name": "ts-node-dev",
"version": "2.0.0",
"description": "Compiles your TS app and restarts when files are modified.",
"keywords": [
"restart",
"reload",
"supervisor",
"monitor",
"watch"
],
"repository": {
"type": "git",
"url": "http://github.com/whitecolor/ts-node-dev.git"
},
"license": "MIT",
"bin": {
"ts-node-dev": "lib/bin.js",
"tsnd": "lib/bin.js"
},
"main": "lib",
"files": [
"icons",
"lib"
],
"prettier": {
"singleQuote": true,
"semi": false
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"ts-node-dev": "node ./lib/bin",
"build": "tsc -p tsconfig.build.json",
"release": "np",
"test": "yarn build && ts-node -T node_modules/mocha/bin/mocha test/*.test.ts",
"test-dev": "yarn ts-node-dev -T --respawn --deps --watch lib node_modules/mocha/bin/mocha test/*.test.ts --output",
"test-docker": "docker-compose up",
"ci": "yarn test",
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
"manual": "yarn ts-node test/manual/run.ts"
},
"dependencies": {
"chokidar": "^3.5.1",
"dynamic-dedupe": "^0.3.0",
"minimist": "^1.2.6",
"mkdirp": "^1.0.4",
"resolve": "^1.0.0",
"rimraf": "^2.6.1",
"source-map-support": "^0.5.12",
"tree-kill": "^1.2.2",
"ts-node": "^10.4.0",
"tsconfig": "^7.0.0"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/chokidar": "^2.1.3",
"@types/fs-extra": "^9.0.1",
"@types/minimist": "^1.2.0",
"@types/mkdirp": "^1.0.1",
"@types/mocha": "github:whitecolor/mocha-types",
"@types/node": "^14.6.0",
"@types/rimraf": "^3.0.0",
"@types/tape": "^4.13.0",
"@types/touch": "^3.1.1",
"@types/ts-nameof": "^4.2.1",
"@whitecolor/eslint-config": "^1.0.0",
"chai": "^4.2.0",
"chalk": "^4.1.0",
"coffee-script": "^1.8.0",
"eslint": "^7.7.0",
"esm": "^3.2.22",
"fs-extra": "^9.0.1",
"mocha": "^8.1.1",
"np": "^7.6.1",
"tap": "^5.2.0",
"tape": "^5.0.1",
"touch": "^1.0.0",
"ts-nameof": "^5.0.0",
"tsconfig-paths": "^3.3.1",
"ttypescript": "^1.5.10",
"typescript": "^3.9.5"
},
"peerDependencies": {
"node-notifier": "*",
"typescript": "*"
},
"peerDependenciesMeta": {
"node-notifier": {
"optional": true
}
},
"np": {
"yarn": false,
"cleanup": false
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
}
}