server4test 0.8.6 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const server4test_1 = require("./server4test");
5
- (0, server4test_1.launch)();
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const server4test_1 = require("./server4test");
5
+ (0, server4test_1.launch)();
6
6
  //# sourceMappingURL=launch4test.js.map
@@ -1,65 +1,69 @@
1
- import * as express from 'express';
2
- import * as serveContent from 'serve-content';
3
- declare type RequestDefinition = {
4
- method: 'get' | 'post' | 'put' | 'delete' | 'use';
5
- path: string;
6
- };
7
- export declare const CONFIG_DEFAULT: Server4TestOpts;
8
- export declare type Server4TestOpts = {
9
- port: number;
10
- verbose: boolean;
11
- devel?: boolean;
12
- "base-url": string;
13
- echo: boolean;
14
- "serve-content": serveContent.ServeContentOptions;
15
- "public-dir"?: string | [string];
16
- "server4test-directory": boolean;
17
- "local-file-repo": {
18
- enabled: boolean;
19
- delay: number;
20
- directory: string;
21
- readRequest: RequestDefinition;
22
- writeRequest: RequestDefinition;
23
- deleteRequest: RequestDefinition;
24
- };
25
- };
26
- export declare type Request = express.Request;
27
- export declare type Response = express.Response;
28
- export declare type NextFunction = express.NextFunction;
29
- export declare type ServiceDef = {
30
- path: string;
31
- method?: 'get' | 'post' | 'delete' | 'put' | 'use';
32
- } & ({
33
- html: string;
34
- } | {
35
- middleware: (req: Request, res: Response, next?: NextFunction) => any;
36
- });
37
- export declare class Server4Test {
38
- app: express.Express;
39
- opts: Server4TestOpts;
40
- port: number;
41
- listener: any;
42
- constructor(opts: Partial<Server4TestOpts>);
43
- start(): Promise<void>;
44
- webPackService(webPackOptions: any, webpackDevMiddlewareOptions?: any): any;
45
- localFileRepoMiddleware(fun: (filename: string, params: {
46
- content: string | null | undefined;
47
- }) => Promise<{
48
- content?: string;
49
- timestamp?: number;
50
- }>): (req: Request, res: Response) => Promise<void>;
51
- launchEnsureDirOrDie(): Promise<void>;
52
- fileServices(): {
53
- middleware: (req: Request, res: Response) => Promise<void>;
54
- method: "get" | "post" | "put" | "delete" | "use";
55
- path: string;
56
- }[];
57
- directServices(): Array<ServiceDef>;
58
- closeServer(): Promise<void>;
59
- }
60
- export declare type LaunchOpts = {
61
- serverClass: typeof Server4Test;
62
- server4test: Partial<Server4TestOpts>;
63
- };
64
- export declare function launch(opts?: Partial<LaunchOpts>): Promise<void>;
65
- export {};
1
+ import * as express from 'express';
2
+ import * as serveContent from 'serve-content';
3
+ import * as serveIndex from 'serve-index';
4
+ type RequestDefinition = {
5
+ method: 'get' | 'post' | 'put' | 'delete' | 'use';
6
+ path: string;
7
+ };
8
+ export declare const CONFIG_DEFAULT: Server4TestOpts;
9
+ export declare const CONFIG_SUPER_INSECURE: Server4TestOpts;
10
+ export type Server4TestOpts = {
11
+ port: number;
12
+ verbose: boolean;
13
+ devel?: boolean;
14
+ "base-url": string;
15
+ echo: boolean;
16
+ "serve-content": serveContent.ServeContentOptions;
17
+ "public-dir"?: string | [string];
18
+ "server4test-directory": boolean;
19
+ "local-file-repo": {
20
+ enabled: boolean;
21
+ delay: number;
22
+ directory: string;
23
+ readRequest: RequestDefinition;
24
+ writeRequest: RequestDefinition;
25
+ deleteRequest: RequestDefinition;
26
+ };
27
+ "serve-index": serveIndex.Options;
28
+ };
29
+ export declare type Request = express.Request;
30
+ export declare type Response = express.Response;
31
+ export declare type NextFunction = express.NextFunction;
32
+ export type ServiceDef = {
33
+ path: string;
34
+ method?: 'get' | 'post' | 'delete' | 'put' | 'use';
35
+ } & ({
36
+ html: string;
37
+ } | {
38
+ middleware: (req: Request, res: Response, next?: NextFunction) => any;
39
+ });
40
+ export declare class Server4Test {
41
+ app: express.Express;
42
+ opts: Server4TestOpts;
43
+ port: number;
44
+ listener: any;
45
+ constructor(opts: Partial<Server4TestOpts>);
46
+ start(): Promise<void>;
47
+ webPackService(webPackOptions: any, webpackDevMiddlewareOptions?: any): any;
48
+ localFileRepoMiddleware(fun: (filename: string, params: {
49
+ content: string | null | undefined;
50
+ }) => Promise<{
51
+ content?: string;
52
+ timestamp?: number;
53
+ }>): (req: Request, res: Response) => Promise<void>;
54
+ launchEnsureDirOrDie(): Promise<void>;
55
+ fileServices(): {
56
+ middleware: (req: Request, res: Response) => Promise<void>;
57
+ method: "get" | "post" | "put" | "delete" | "use";
58
+ path: string;
59
+ }[];
60
+ directServices(): Array<ServiceDef>;
61
+ serveIndex4Test(baseUrl: string, path: string): void;
62
+ closeServer(): Promise<void>;
63
+ }
64
+ export type LaunchOpts = {
65
+ serverClass: typeof Server4Test;
66
+ server4test: Partial<Server4TestOpts>;
67
+ };
68
+ export declare function launch(opts?: Partial<LaunchOpts>): Promise<void>;
69
+ export {};
@@ -1,267 +1,308 @@
1
- "use strict";
2
- var __asyncValues = (this && this.__asyncValues) || function (o) {
3
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
4
- var m = o[Symbol.asyncIterator], i;
5
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
6
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.launch = exports.Server4Test = exports.CONFIG_DEFAULT = void 0;
11
- const express = require("express");
12
- const cookieParser = require("cookie-parser");
13
- const MiniTools = require("mini-tools");
14
- const serveContent = require("serve-content");
15
- const serveIndex = require("serve-index");
16
- const best_globals_1 = require("best-globals");
17
- const fs = require("fs-extra");
18
- const fs_1 = require("fs");
19
- const Path = require("path");
20
- const errores = require("errores");
21
- exports.CONFIG_DEFAULT = {
22
- port: 8080,
23
- verbose: true,
24
- "serve-content": {
25
- allowAllExts: false,
26
- allowedExts: ['', 'png', 'jpg', 'jpeg', 'bmp', 'svg', 'gif', 'html', 'css', 'htm', 'js', 'manifest', 'cache', 'md', 'jade', 'styl'],
27
- /*
28
- ".jade":{extOriginal:"jade"},
29
- ".styl":{extOriginal:"styl"},
30
- */
31
- },
32
- "base-url": '',
33
- echo: false,
34
- "server4test-directory": false,
35
- "local-file-repo": {
36
- enabled: false,
37
- delay: 200,
38
- directory: "local-file-repo",
39
- readRequest: {
40
- method: 'get',
41
- path: '/file-read'
42
- },
43
- writeRequest: {
44
- method: 'get',
45
- path: '/file-write'
46
- },
47
- deleteRequest: {
48
- method: 'get',
49
- path: '/file-delete'
50
- }
51
- }
52
- };
53
- serveContent.transformer.jade = (0, best_globals_1.changing)(serveContent.transformer[''], { /*extOriginal:'jade', */ optionName: 'jade-direct' });
54
- serveContent.transformer.styl = (0, best_globals_1.changing)(serveContent.transformer.css, { /*extOriginal:'styl', */ optionName: 'styl-direct' });
55
- class Server4Test {
56
- constructor(opts) {
57
- this.port = 3000;
58
- this.app = express();
59
- this.opts = (0, best_globals_1.changing)(exports.CONFIG_DEFAULT, opts);
60
- this.app.use(cookieParser());
61
- }
62
- async start() {
63
- var server = this;
64
- var baseUrl = this.opts["base-url"];
65
- var optsGenericForFiles = (0, best_globals_1.changing)({
66
- allowedExts: ['', 'js', 'html', 'css', 'jpg', 'jpeg', 'png', 'ico', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2', 'appcache', 'jade', 'styl'],
67
- /*
68
- options:{
69
- "jade-direct":{extOriginal:'jade'},
70
- "styl-direct":{extOriginal:'styl'}
71
- },
72
- */
73
- "jade-direct": { extOriginal: 'jade' },
74
- "styl-direct": { extOriginal: 'styl' }
75
- }, this.opts["serve-content"] || {});
76
- server.port = this.opts.port;
77
- this.directServices().forEach(function (serviceDef) {
78
- var middleware = 'middleware' in serviceDef ? serviceDef.middleware : function (req, res) {
79
- MiniTools.serveText(serviceDef.html, 'html')(req, res);
80
- };
81
- var method = serviceDef.method || 'use';
82
- if (serviceDef.path) {
83
- server.app[method](Path.posix.join(baseUrl, serviceDef.path), middleware);
84
- }
85
- else {
86
- if (method == 'use') {
87
- server.app[method](middleware);
88
- }
89
- server.app[method](Path.posix.join(baseUrl, '/'), middleware);
90
- }
91
- });
92
- var paths = this.opts["public-dir"] == null ? [process.cwd()] : typeof this.opts["public-dir"] === "string" ? [this.opts["public-dir"]] : this.opts["public-dir"];
93
- paths.forEach((path, i) => {
94
- if (this.opts["server4test-directory"] && !i) {
95
- server.app.use(baseUrl + '/', serveIndex(path, { icons: true, view: 'details' }));
96
- }
97
- server.app.use(baseUrl + '/', serveContent(path, optsGenericForFiles));
98
- });
99
- await new Promise(function (resolve, _reject) {
100
- server.listener = server.app.listen(server.port, resolve);
101
- });
102
- }
103
- webPackService(webPackOptions, webpackDevMiddlewareOptions) {
104
- const webpack = require('webpack');
105
- const middleware = require('webpack-dev-middleware');
106
- const compiler = webpack(webPackOptions || {
107
- // webpack options
108
- });
109
- const express = require('express');
110
- const app = express();
111
- return middleware(compiler, webpackDevMiddlewareOptions || {
112
- publicPath: '/dist',
113
- headers: { "X-Custom-Header": "yes" }
114
- // webpack-dev-middleware options
115
- });
116
- }
117
- localFileRepoMiddleware(fun) {
118
- return async (req, res) => {
119
- if (this.opts.verbose) {
120
- console.log(req.method, req.path, req.query);
121
- }
122
- try {
123
- await (0, best_globals_1.sleep)(Math.random() * (this.opts["local-file-repo"].delay || 100));
124
- if (typeof req.query.file !== "string")
125
- throw new Error('lack of filename');
126
- if (req.query.content != null && typeof req.query.content !== "string")
127
- throw new Error('invalid content format');
128
- var filename = Path.join(this.opts["local-file-repo"].directory, req.query.file.replace(/[^-A-Za-z_0-9.@]/g, '_'));
129
- var result = await fun(filename, { content: req.query.content });
130
- var data = Object.assign(Object.assign({}, result), { timestamp: result.timestamp || (await fs.stat(filename)).mtimeMs });
131
- await (0, best_globals_1.sleep)(Math.random() * (this.opts["local-file-repo"].delay || 100));
132
- res.send(JSON.stringify(data));
133
- res.end();
134
- }
135
- catch (err) {
136
- var error = errores.unexpected(err);
137
- console.log(req.path, req.query, error);
138
- res.statusCode = error.code == 'ENOENT' ? 404 : 502;
139
- res.send('server error');
140
- res.end();
141
- }
142
- };
143
- }
144
- async launchEnsureDirOrDie() {
145
- try {
146
- await fs.ensureDir(this.opts["local-file-repo"].directory);
147
- }
148
- catch (err) {
149
- console.log("Can't ensureDir", this.opts["local-file-repo"].directory);
150
- process.exit(1);
151
- }
152
- }
153
- fileServices() {
154
- this.launchEnsureDirOrDie();
155
- return [
156
- Object.assign(Object.assign({}, this.opts["local-file-repo"].readRequest), { middleware: this.localFileRepoMiddleware(async (filename) => {
157
- var content = await fs.readFile(filename, 'utf8');
158
- return { content };
159
- }) }),
160
- Object.assign(Object.assign({}, this.opts["local-file-repo"].writeRequest), { middleware: this.localFileRepoMiddleware(async (filename, { content }) => {
161
- await fs.writeFile(filename, content, 'utf8');
162
- return {};
163
- }) }),
164
- Object.assign(Object.assign({}, this.opts["local-file-repo"].deleteRequest), { middleware: this.localFileRepoMiddleware(async (filename) => {
165
- await fs.remove(filename);
166
- return { timestamp: new Date().getTime() };
167
- }) }),
168
- ];
169
- }
170
- directServices() {
171
- var services = [];
172
- if ((0, fs_1.existsSync)('./webpack.config.js')) {
173
- if (this.opts.verbose) {
174
- console.log('using webpack.config.js');
175
- }
176
- var options = require(Path.resolve('./webpack.config.js'));
177
- services.push({ path: '', middleware: this.webPackService(options) });
178
- }
179
- if (this.opts.echo) {
180
- if (this.opts.verbose) {
181
- console.log('serving echo');
182
- }
183
- services.push({ path: '/echo', method: 'get', middleware: (req, res, next) => {
184
- var result = `<pre>${[
185
- { l: 'query', o: req.query },
186
- { l: 'path', o: req.path },
187
- { l: 'headers', o: req.headers },
188
- { l: 'cookies', o: req.cookies },
189
- { l: 'ip', o: req.ip },
190
- { l: 'ips', o: req.ips },
191
- { l: 'originalUrl', o: req.originalUrl },
192
- { l: 'rawTrailers', o: req.rawTrailers },
193
- { l: 'url', o: req.url },
194
- { l: 'xhr', o: req.xhr },
195
- ].map(({ l, o }) => l + ': ' + JSON.stringify(o, null, ' ')).join('\n\n').replace(/</g, '&lt;')}</pre>`;
196
- res.send(result);
197
- } });
198
- }
199
- if (this.opts["local-file-repo"].enabled) {
200
- services = [...services, ...this.fileServices()];
201
- console.log('services', services);
202
- }
203
- return services;
204
- }
205
- async closeServer() {
206
- var server = this;
207
- await new Promise(function (resolve, reject) {
208
- try {
209
- server.listener.close(function (err) {
210
- if (err) {
211
- reject(err);
212
- }
213
- else {
214
- resolve();
215
- }
216
- });
217
- }
218
- catch (err) {
219
- reject(err);
220
- }
221
- });
222
- }
223
- }
224
- exports.Server4Test = Server4Test;
225
- async function launch(opts) {
226
- var e_1, _a;
227
- var _b, _c, _d, _e, _f;
228
- var config = await MiniTools.readConfig([
229
- {
230
- serverClass: Server4Test,
231
- server4test: exports.CONFIG_DEFAULT
232
- },
233
- (opts || {}),
234
- 'server4test-config',
235
- 'local-config',
236
- ], { whenNotExist: 'ignore' });
237
- var ServerConstructor = config.serverClass;
238
- var server = new ServerConstructor(config.server4test);
239
- server.start();
240
- if (config.server4test.verbose) {
241
- console.log('server4test-config');
242
- console.dir(config, { depth: 6 });
243
- }
244
- console.log('server listening at', 'localhost:' + server.port + ((_b = config.server4test['base-url']) !== null && _b !== void 0 ? _b : ''));
245
- if (!config.server4test['server4test-directory']) {
246
- console.error('server4test-directory is not set to true');
247
- var dir = await fs.opendir('.');
248
- try {
249
- for (var dir_1 = __asyncValues(dir), dir_1_1; dir_1_1 = await dir_1.next(), !dir_1_1.done;) {
250
- const dirent = dir_1_1.value;
251
- var ext = Path.extname(dirent.name);
252
- if (((_c = config.server4test['serve-content']) === null || _c === void 0 ? void 0 : _c.allowAllExts) || ext && ((_e = (_d = config.server4test['serve-content']) === null || _d === void 0 ? void 0 : _d.allowedExts) === null || _e === void 0 ? void 0 : _e.includes(ext))) {
253
- console.log(' localhost:' + server.port + ((_f = config.server4test['base-url']) !== null && _f !== void 0 ? _f : '') + '/' + dirent.name);
254
- }
255
- }
256
- }
257
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
258
- finally {
259
- try {
260
- if (dir_1_1 && !dir_1_1.done && (_a = dir_1.return)) await _a.call(dir_1);
261
- }
262
- finally { if (e_1) throw e_1.error; }
263
- }
264
- }
265
- }
266
- exports.launch = launch;
1
+ "use strict";
2
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
3
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
4
+ var m = o[Symbol.asyncIterator], i;
5
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
6
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Server4Test = exports.CONFIG_SUPER_INSECURE = exports.CONFIG_DEFAULT = void 0;
11
+ exports.launch = launch;
12
+ const express = require("express");
13
+ const cookieParser = require("cookie-parser");
14
+ const MiniTools = require("mini-tools");
15
+ const serveContent = require("serve-content");
16
+ const serveIndex = require("serve-index");
17
+ const best_globals_1 = require("best-globals");
18
+ const fs = require("fs-extra");
19
+ const fs_1 = require("fs");
20
+ const Path = require("path");
21
+ const cast_error_1 = require("cast-error");
22
+ exports.CONFIG_DEFAULT = {
23
+ port: 8080,
24
+ verbose: true,
25
+ "serve-content": {
26
+ allowAllExts: false,
27
+ allowedExts: ['', 'png', 'jpg', 'jpeg', 'bmp', 'svg', 'gif', 'html', 'css', 'htm', 'js', 'manifest', 'cache', 'md', 'jade', 'styl', 'ico',
28
+ /* FONTS: */ 'ttf', 'jfproj', 'pfa', 'woff', 'fnt', 'fot', 'otf', 'odttf', 'fon',
29
+ /* OTHERS */ 'map', 'appcache', 'json', 'webmanifest', 'zip', 'pdf', 'xlsx', 'csv', 'mjs', 'jsx'
30
+ ],
31
+ /*
32
+ ".jade":{extOriginal:"jade"},
33
+ ".styl":{extOriginal:"styl"},
34
+ */
35
+ },
36
+ "base-url": '',
37
+ echo: false,
38
+ "server4test-directory": false,
39
+ "local-file-repo": {
40
+ enabled: false,
41
+ delay: 200,
42
+ directory: "local-file-repo",
43
+ readRequest: {
44
+ method: 'get',
45
+ path: '/file-read'
46
+ },
47
+ writeRequest: {
48
+ method: 'get',
49
+ path: '/file-write'
50
+ },
51
+ deleteRequest: {
52
+ method: 'get',
53
+ path: '/file-delete'
54
+ }
55
+ },
56
+ "serve-index": { icons: true, view: 'details' }
57
+ };
58
+ exports.CONFIG_SUPER_INSECURE = Object.assign(Object.assign({}, exports.CONFIG_DEFAULT), { "serve-content": {
59
+ allowAllExts: true,
60
+ allowedExts: ['', 'png', 'jpg', 'jpeg', 'bmp', 'svg', 'gif', 'html', 'css', 'htm', 'js', 'manifest', 'cache', 'md', 'jade', 'styl'],
61
+ dotfiles: "allow",
62
+ index: ["index.html", "index.htm", "index.js"]
63
+ /*
64
+ ".jade":{extOriginal:"jade"},
65
+ ".styl":{extOriginal:"styl"},
66
+ */
67
+ }, "server4test-directory": true, "local-file-repo": Object.assign(Object.assign({}, exports.CONFIG_DEFAULT["local-file-repo"]), { enabled: true }), "serve-index": Object.assign(Object.assign({}, exports.CONFIG_DEFAULT["serve-index"]), { hidden: true }) });
68
+ serveContent.transformer.jade = (0, best_globals_1.changing)(serveContent.transformer[''], { /*extOriginal:'jade', */ optionName: 'jade-direct' });
69
+ serveContent.transformer.styl = (0, best_globals_1.changing)(serveContent.transformer.css, { /*extOriginal:'styl', */ optionName: 'styl-direct' });
70
+ class Server4Test {
71
+ constructor(opts) {
72
+ this.port = 3000;
73
+ this.app = express();
74
+ this.opts = (0, best_globals_1.changing)(exports.CONFIG_DEFAULT, opts);
75
+ this.app.use(cookieParser());
76
+ }
77
+ async start() {
78
+ var server = this;
79
+ var baseUrl = this.opts["base-url"];
80
+ var optsGenericForFiles = (0, best_globals_1.changing)({
81
+ allowedExts: ['', 'js', 'html', 'css', 'jpg', 'jpeg', 'png', 'ico', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2', 'appcache', 'jade', 'styl'],
82
+ /*
83
+ options:{
84
+ "jade-direct":{extOriginal:'jade'},
85
+ "styl-direct":{extOriginal:'styl'}
86
+ },
87
+ */
88
+ "jade-direct": { extOriginal: 'jade' },
89
+ "styl-direct": { extOriginal: 'styl' }
90
+ }, this.opts["serve-content"] || {});
91
+ server.port = this.opts.port;
92
+ this.directServices().forEach(function (serviceDef) {
93
+ var middleware = 'middleware' in serviceDef ? serviceDef.middleware : function (req, res) {
94
+ MiniTools.serveText(serviceDef.html, 'html')(req, res);
95
+ };
96
+ var method = serviceDef.method || 'use';
97
+ if (serviceDef.path) {
98
+ server.app[method](Path.posix.join(baseUrl, serviceDef.path), middleware);
99
+ }
100
+ else {
101
+ if (method == 'use') {
102
+ server.app[method](middleware);
103
+ }
104
+ server.app[method](Path.posix.join(baseUrl, '/'), middleware);
105
+ }
106
+ });
107
+ var paths = this.opts["public-dir"] == null ? [process.cwd()] : typeof this.opts["public-dir"] === "string" ? [this.opts["public-dir"]] : this.opts["public-dir"];
108
+ paths.forEach((path, i) => {
109
+ if (this.opts["server4test-directory"] && !i) {
110
+ server.serveIndex4Test(baseUrl, path);
111
+ }
112
+ server.app.use(baseUrl + '/', serveContent(path, optsGenericForFiles));
113
+ });
114
+ await new Promise(function (resolve, _reject) {
115
+ server.listener = server.app.listen(server.port, resolve);
116
+ });
117
+ }
118
+ webPackService(webPackOptions, webpackDevMiddlewareOptions) {
119
+ const webpack = require('webpack');
120
+ const middleware = require('webpack-dev-middleware');
121
+ const compiler = webpack(webPackOptions || {
122
+ // webpack options
123
+ });
124
+ // const express = require('express');
125
+ // const app = express();
126
+ return middleware(compiler, webpackDevMiddlewareOptions || {
127
+ publicPath: '/dist',
128
+ headers: { "X-Custom-Header": "yes" }
129
+ // webpack-dev-middleware options
130
+ });
131
+ }
132
+ localFileRepoMiddleware(fun) {
133
+ return async (req, res) => {
134
+ if (this.opts.verbose) {
135
+ console.log(req.method, req.path, req.query);
136
+ }
137
+ try {
138
+ await (0, best_globals_1.sleep)(Math.random() * (this.opts["local-file-repo"].delay || 100));
139
+ if (typeof req.query.file !== "string")
140
+ throw new Error('lack of filename');
141
+ if (req.query.content != null && typeof req.query.content !== "string")
142
+ throw new Error('invalid content format');
143
+ var filename = Path.join(this.opts["local-file-repo"].directory, req.query.file.replace(/[^-A-Za-z_0-9.@]/g, '_'));
144
+ var result = await fun(filename, { content: req.query.content });
145
+ var data = Object.assign(Object.assign({}, result), { timestamp: result.timestamp || (await fs.stat(filename)).mtimeMs });
146
+ await (0, best_globals_1.sleep)(Math.random() * (this.opts["local-file-repo"].delay || 100));
147
+ res.send(JSON.stringify(data));
148
+ res.end();
149
+ }
150
+ catch (err) {
151
+ var error = (0, cast_error_1.unexpected)(err);
152
+ console.log(req.path, req.query, error);
153
+ res.statusCode = error.code == 'ENOENT' ? 404 : 502;
154
+ res.send('server error');
155
+ res.end();
156
+ }
157
+ };
158
+ }
159
+ async launchEnsureDirOrDie() {
160
+ try {
161
+ await fs.ensureDir(this.opts["local-file-repo"].directory);
162
+ }
163
+ catch (err) {
164
+ console.log("Can't ensureDir", this.opts["local-file-repo"].directory);
165
+ process.exit(1);
166
+ }
167
+ }
168
+ fileServices() {
169
+ this.launchEnsureDirOrDie();
170
+ return [
171
+ Object.assign(Object.assign({}, this.opts["local-file-repo"].readRequest), { middleware: this.localFileRepoMiddleware(async (filename) => {
172
+ var content = await fs.readFile(filename, 'utf8');
173
+ return { content };
174
+ }) }),
175
+ Object.assign(Object.assign({}, this.opts["local-file-repo"].writeRequest), { middleware: this.localFileRepoMiddleware(async (filename, { content }) => {
176
+ if (content == null)
177
+ throw new Error("null in content accesing local-file-repo");
178
+ await fs.writeFile(filename, content, 'utf8');
179
+ return {};
180
+ }) }),
181
+ Object.assign(Object.assign({}, this.opts["local-file-repo"].deleteRequest), { middleware: this.localFileRepoMiddleware(async (filename) => {
182
+ await fs.remove(filename);
183
+ return { timestamp: new Date().getTime() };
184
+ }) }),
185
+ ];
186
+ }
187
+ directServices() {
188
+ var services = [];
189
+ if ((0, fs_1.existsSync)('./webpack.config.js')) {
190
+ if (this.opts.verbose) {
191
+ console.log('using webpack.config.js');
192
+ }
193
+ var options = require(Path.resolve('./webpack.config.js'));
194
+ services.push({ path: '', middleware: this.webPackService(options) });
195
+ }
196
+ if (this.opts.echo) {
197
+ if (this.opts.verbose) {
198
+ console.log('serving echo');
199
+ }
200
+ services.push({ path: '/echo', method: 'get', middleware: (req, res, _next) => {
201
+ var result = `<pre>${[
202
+ { l: 'query', o: req.query },
203
+ { l: 'path', o: req.path },
204
+ { l: 'headers', o: req.headers },
205
+ { l: 'cookies', o: req.cookies },
206
+ { l: 'ip', o: req.ip },
207
+ { l: 'ips', o: req.ips },
208
+ { l: 'originalUrl', o: req.originalUrl },
209
+ { l: 'rawTrailers', o: req.rawTrailers },
210
+ { l: 'url', o: req.url },
211
+ { l: 'xhr', o: req.xhr },
212
+ ].map(({ l, o }) => l + ': ' + JSON.stringify(o, null, ' ')).join('\n\n').replace(/</g, '&lt;')}</pre>`;
213
+ res.send(result);
214
+ } });
215
+ }
216
+ if (this.opts["local-file-repo"].enabled) {
217
+ services = [...services, ...this.fileServices()];
218
+ console.log('services', services);
219
+ }
220
+ return services;
221
+ }
222
+ serveIndex4Test(baseUrl, path) {
223
+ var server = this;
224
+ server.app.use(baseUrl + '/', function (req, res, next) {
225
+ var theOrinigalEnd = res.end;
226
+ // @ts-expect-error hacky replace
227
+ res.end = function (chunk, encoding, cb) {
228
+ if (typeof chunk == "string") {
229
+ chunk = chunk
230
+ .replace(/href="\/">~<\/a>/g, 'href="/?dir">~</a>')
231
+ .replace(/( \/ <a href="\/[^/<>"]+)(">)/g, '$1?dir$2')
232
+ .replace(/" class="icon icon-directory"/g, '?dir$&');
233
+ }
234
+ return theOrinigalEnd.call(res, chunk, encoding, cb);
235
+ };
236
+ if (req.query.dir !== undefined) {
237
+ serveIndex(path, server.opts["serve-index"])(req, res, next);
238
+ }
239
+ else {
240
+ next();
241
+ }
242
+ });
243
+ }
244
+ async closeServer() {
245
+ var server = this;
246
+ await new Promise(function (resolve, reject) {
247
+ try {
248
+ server.listener.close(function (err) {
249
+ if (err) {
250
+ reject(err);
251
+ }
252
+ else {
253
+ resolve();
254
+ }
255
+ });
256
+ }
257
+ catch (err) {
258
+ reject(err);
259
+ }
260
+ });
261
+ }
262
+ }
263
+ exports.Server4Test = Server4Test;
264
+ async function launch(opts) {
265
+ var _a, e_1, _b, _c;
266
+ var _d, _e, _f, _g, _h;
267
+ var config = await MiniTools.readConfig([
268
+ {
269
+ serverClass: Server4Test,
270
+ server4test: process.argv.includes('--super-insecure') ? exports.CONFIG_SUPER_INSECURE : exports.CONFIG_DEFAULT
271
+ },
272
+ (opts || {}),
273
+ 'server4test-config',
274
+ 'local-config',
275
+ ], { whenNotExist: 'ignore' });
276
+ var ServerConstructor = config.serverClass;
277
+ var server = new ServerConstructor(config.server4test);
278
+ server.start();
279
+ if (config.server4test.verbose) {
280
+ console.log('server4test-config');
281
+ console.dir(config, { depth: 6 });
282
+ }
283
+ console.log('server listening at', 'http://localhost:' + server.port + ((_d = config.server4test['base-url']) !== null && _d !== void 0 ? _d : '') + '?dir');
284
+ if (!config.server4test['server4test-directory']) {
285
+ console.error('server4test-directory is not set to true');
286
+ console.warn('try', 'server4test --super-insecure');
287
+ var dir = await fs.opendir('.');
288
+ try {
289
+ for (var _j = true, dir_1 = __asyncValues(dir), dir_1_1; dir_1_1 = await dir_1.next(), _a = dir_1_1.done, !_a; _j = true) {
290
+ _c = dir_1_1.value;
291
+ _j = false;
292
+ const dirent = _c;
293
+ var ext = Path.extname(dirent.name);
294
+ if (((_e = config.server4test['serve-content']) === null || _e === void 0 ? void 0 : _e.allowAllExts) || ext && ((_g = (_f = config.server4test['serve-content']) === null || _f === void 0 ? void 0 : _f.allowedExts) === null || _g === void 0 ? void 0 : _g.includes(ext))) {
295
+ console.log(' localhost:' + server.port + ((_h = config.server4test['base-url']) !== null && _h !== void 0 ? _h : '') + '/' + dirent.name);
296
+ }
297
+ }
298
+ }
299
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
300
+ finally {
301
+ try {
302
+ if (!_j && !_a && (_b = dir_1.return)) await _b.call(dir_1);
303
+ }
304
+ finally { if (e_1) throw e_1.error; }
305
+ }
306
+ }
307
+ }
267
308
  //# sourceMappingURL=server4test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server4test.js","sourceRoot":"","sources":["../src/server4test.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,mCAAwC;AACxC,8CAA8C;AAC9C,wCAA2C;AAC3C,8CAA8C;AAC9C,0CAA4C;AAC5C,+CAA6C;AAC7C,+BAAyC;AACzC,2BAAmC;AACnC,6BAAqC;AACrC,mCAAwC;AAM3B,QAAA,cAAc,GAAiB;IACxC,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,eAAe,EAAC;QACZ,YAAY,EAAC,KAAK;QAClB,WAAW,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC;QAClI;;;UAGE;KACL;IACD,UAAU,EAAC,EAAE;IACb,IAAI,EAAC,KAAK;IACV,uBAAuB,EAAC,KAAK;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MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,0CAAE,YAAY,KAAI,GAAG,KAAI,MAAA,MAAA,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,0CAAE,WAAW,0CAAE,QAAQ,CAAC,GAAG,CAAC,CAAA,EAAC,CAAC;oBAC5H,OAAO,CAAC,GAAG,CAAC,cAAc,GAAC,MAAM,CAAC,IAAI,GAAC,CAAC,MAAA,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,mCAAE,EAAE,CAAC,GAAC,GAAG,GAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACjG,CAAC;YACL,CAAC;;;;;;;;;IACL,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "server4test",
3
3
  "description": "server for test",
4
- "version": "0.8.6",
4
+ "version": "0.9.2",
5
5
  "files": [
6
6
  "lib"
7
7
  ],
@@ -20,42 +20,48 @@
20
20
  "server4test": "./lib/launch4test.js"
21
21
  },
22
22
  "dependencies": {
23
- "cookie-parser": "^1.4.6",
24
- "express": "^4.17.2",
25
- "fs-extra": "^10.0.0",
23
+ "cookie-parser": "^1.4.7",
24
+ "express": "^4.21.2",
25
+ "fs-extra": "^11.2.0",
26
26
  "serve-index": "^1.9.1",
27
- "typescript": "^4.5.4",
28
- "webpack": "^5.66.0",
29
- "webpack-dev-middleware": "^5.3.0",
30
- "best-globals": "^1.0.2",
31
- "errores": "^0.0.2",
32
- "mini-tools": "^1.11.2",
33
- "serve-content": "^0.3.17"
27
+ "typescript": "^5.7.2",
28
+ "webpack": "^5.97.1",
29
+ "webpack-dev-middleware": "^7.4.2",
30
+ "best-globals": "^1.1.6",
31
+ "cast-error": "^0.1.1",
32
+ "mini-tools": "^1.13.2",
33
+ "serve-content": "^0.3.20"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/cookie-parser": "^1.4.2",
37
- "@types/express": "^4.17.13",
38
- "@types/fs-extra": "^9.0.13",
39
- "@types/node": "^17.0.8",
40
- "@types/serve-index": "^1.9.1",
41
- "es5-shim": "^4.6.4",
36
+ "@types/cookie-parser": "^1.4.8",
37
+ "@types/express": "^5.0.0",
38
+ "@types/fs-extra": "^11.0.4",
39
+ "@types/mocha": "^10.0.10",
40
+ "@types/node": "^22.10.2",
41
+ "@types/serve-index": "^1.9.4",
42
+ "es5-shim": "^4.6.7",
42
43
  "fetch-ie8": "^1.5.0",
43
- "whatwg-fetch": "^3.6.2",
44
- "require-bro": "^0.3.0",
45
- "types.d.ts": "^0.6.6",
46
- "mixin-patch": "^0.4.0"
44
+ "mocha": "^11.0.1",
45
+ "whatwg-fetch": "^3.6.20",
46
+ "require-bro": "^0.3.1",
47
+ "types.d.ts": "^0.6.22",
48
+ "mixin-patch": "^0.4.1"
47
49
  },
48
50
  "engines": {
49
- "node": ">= 12"
51
+ "node": ">= 20"
50
52
  },
51
53
  "scripts": {
52
- "start": "(mkdir local-file-store || echo 'using local-file-store) && node lib/launch4test.js",
54
+ "start": "(mkdir local-file-store || echo 'using local-file-store') && node lib/launch4test.js",
55
+ "start-super-insecure": "(mkdir local-file-store || echo 'using local-file-store') && node lib/launch4test.js --super-insecure",
53
56
  "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
54
57
  "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
55
- "test": "mocha --report lcovonly -- --reporter spec --check-leaks test/",
58
+ "test": "tsc -p test && mocha --report lcovonly -- --reporter spec --check-leaks local-test/test/",
56
59
  "example": "tsc -p example && node example/local-built/example/example-server.js",
57
- "prepare": "tsc && mixin-patch",
58
- "x-prepare": "(tsc || echo 'prepare with errors')",
60
+ "prepublish": "npm run build",
61
+ "build": "tsc && mixin-patch",
62
+ "preversion": "npm test",
63
+ "version": "npm run build",
64
+ "postversion": "git push && git push --tags",
59
65
  "mixin-patch": "mixin-patch"
60
66
  },
61
67
  "qa-control": {