mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 04:37:40 +01:00
Simplify node imports
This commit is contained in:
parent
4bafacaec4
commit
a0e6030836
@ -3,8 +3,8 @@
|
||||
// 1. node plugins.js update
|
||||
// 2. node plugins.js install <plugin-git-url>
|
||||
// More operations coming soon.
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { default as git } from 'simple-git';
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Scripts to be done before starting the server for the first time.
|
||||
*/
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as yaml from 'yaml';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import yaml from 'yaml';
|
||||
import _ from 'lodash';
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as fs from 'node:fs';
|
||||
import fs from 'node:fs';
|
||||
import yaml from 'yaml';
|
||||
import storage from 'node-persist';
|
||||
import * as users from './src/users.js';
|
||||
|
15
server.js
15
server.js
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// native node modules
|
||||
import * as fs from 'node:fs';
|
||||
import * as http from 'node:http';
|
||||
import * as https from 'node:https';
|
||||
import * as path from 'node:path';
|
||||
import * as util from 'node:util';
|
||||
import * as net from 'node:net';
|
||||
import * as dns from 'node:dns';
|
||||
import fs from 'node:fs';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import path from 'node:path';
|
||||
import util from 'node:util';
|
||||
import net from 'node:net';
|
||||
import dns from 'node:dns';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// cli/fs related library imports
|
||||
@ -440,7 +440,6 @@ app.use(multerMonkeyPatch);
|
||||
// User data mount
|
||||
app.use('/', userModule.router);
|
||||
// Private endpoints
|
||||
|
||||
app.use('/api/users', usersPrivateRouter);
|
||||
// Admin endpoints
|
||||
app.use('/api/users', usersAdminRouter);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { finished } from 'node:stream/promises';
|
||||
|
||||
import mime from 'mime-types';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as fs from 'node:fs';
|
||||
import fs from 'node:fs';
|
||||
import express from 'express';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { promises as fsPromises } from 'node:fs';
|
||||
import * as readline from 'node:readline';
|
||||
import readline from 'node:readline';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import express from 'express';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as readline from 'node:readline';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import readline from 'node:readline';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import express from 'express';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import express from 'express';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as path from 'node:path';
|
||||
import path from 'node:path';
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
import { sync as writeFileAtomicSync } from 'write-file-atomic';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as util from 'node:util';
|
||||
import util from 'node:util';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as fs from 'node:fs';
|
||||
import fs from 'node:fs';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import { sync as writeFileAtomicSync } from 'write-file-atomic';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import _ from 'lodash';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import mime from 'mime-types';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import fetch from 'node-fetch';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as crypto from 'node:crypto';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
import express from 'express';
|
||||
import writeFileAtomic from 'write-file-atomic';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as fsPromises from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { promises as fsPromises } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import mime from 'mime-types';
|
||||
import express from 'express';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
import express from 'express';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as https from 'node:https';
|
||||
import https from 'node:https';
|
||||
import { createRequire } from 'node:module';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as path from 'node:path';
|
||||
import path from 'node:path';
|
||||
import { promises as fsPromises } from 'node:fs';
|
||||
import * as crypto from 'node:crypto';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
import storage from 'node-persist';
|
||||
import express from 'express';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as crypto from 'node:crypto';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
import storage from 'node-persist';
|
||||
import express from 'express';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import vectra from 'vectra';
|
||||
import express from 'express';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import express from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import ipMatching from 'ip-matching';
|
||||
|
||||
import { getIpFromRequest } from '../express-common.js';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as url from 'node:url';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import url from 'node:url';
|
||||
|
||||
import express from 'express';
|
||||
import { getConfigValue } from './util.js';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as crypto from 'node:crypto';
|
||||
import crypto from 'node:crypto';
|
||||
import polyfill from './polyfill.js';
|
||||
import { getConfigValue } from './util.js';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Native Node Modules
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import crypto from 'node:crypto';
|
||||
import os from 'node:os';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
// Express and other dependencies
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import * as http2 from 'node:http2';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import http2 from 'node:http2';
|
||||
import { Readable } from 'node:stream';
|
||||
import { createRequire } from 'node:module';
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
Loading…
x
Reference in New Issue
Block a user