@adonisjs/http-server 7.0.0-0 → 7.0.0-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.
- package/build/{chunk-XX72ATFY.js → chunk-Z63E3STR.js} +66 -18
- package/build/chunk-Z63E3STR.js.map +1 -0
- package/build/factories/http_context.d.ts +25 -0
- package/build/factories/http_server.d.ts +8 -0
- package/build/factories/main.d.ts +6 -149
- package/build/factories/main.js +2 -1
- package/build/factories/main.js.map +1 -0
- package/build/factories/qs_parser_factory.d.ts +20 -0
- package/build/factories/request.d.ts +29 -0
- package/build/factories/response.d.ts +29 -0
- package/build/factories/router.d.ts +23 -0
- package/build/factories/server_factory.d.ts +29 -0
- package/build/index.d.ts +14 -272
- package/build/index.js +2 -1
- package/build/index.js.map +1 -0
- package/build/src/cookies/client.d.ts +37 -0
- package/build/src/cookies/drivers/encrypted.d.ts +16 -0
- package/build/src/cookies/drivers/plain.d.ts +15 -0
- package/build/src/cookies/drivers/signed.d.ts +16 -0
- package/build/src/cookies/parser.d.ts +37 -0
- package/build/src/cookies/serializer.d.ts +33 -0
- package/build/src/debug.d.ts +3 -0
- package/build/src/define_config.d.ts +9 -0
- package/build/src/define_middleware.d.ts +11 -0
- package/build/src/exception_handler.d.ts +113 -0
- package/build/src/exceptions.d.ts +84 -0
- package/build/src/helpers.d.ts +23 -0
- package/build/src/http_context/local_storage.d.ts +12 -0
- package/build/src/http_context/main.d.ts +58 -0
- package/build/src/qs.d.ts +11 -0
- package/build/src/redirect.d.ts +42 -0
- package/build/src/request.d.ts +565 -0
- package/build/src/response.d.ts +620 -0
- package/build/src/router/brisk.d.ts +42 -0
- package/build/src/router/executor.d.ts +9 -0
- package/build/src/router/factories/use_return_value.d.ts +6 -0
- package/build/src/router/group.d.ts +65 -0
- package/build/src/router/lookup_store/main.d.ts +47 -0
- package/build/src/router/lookup_store/route_finder.d.ts +25 -0
- package/build/src/router/lookup_store/url_builder.d.ts +52 -0
- package/build/src/router/main.d.ts +128 -0
- package/build/src/router/matchers.d.ts +27 -0
- package/build/src/router/parser.d.ts +5 -0
- package/build/src/router/resource.d.ts +66 -0
- package/build/src/router/route.d.ts +92 -0
- package/build/src/router/store.d.ts +66 -0
- package/build/src/server/factories/final_handler.d.ts +10 -0
- package/build/src/server/factories/middleware_handler.d.ts +8 -0
- package/build/src/server/factories/write_response.d.ts +6 -0
- package/build/{main-29eaaee4.d.ts → src/server/main.d.ts} +18 -13
- package/build/src/types/base.d.ts +19 -0
- package/build/src/types/main.d.ts +7 -14
- package/build/src/types/main.js +1 -0
- package/build/src/types/main.js.map +1 -0
- package/build/src/types/middleware.d.ts +35 -0
- package/build/src/types/qs.d.ts +68 -0
- package/build/src/types/request.d.ts +39 -0
- package/build/src/types/response.d.ts +45 -0
- package/build/src/types/route.d.ts +166 -0
- package/build/src/types/server.d.ts +72 -0
- package/package.json +52 -48
- package/build/main-e5b46c83.d.ts +0 -2210
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Logger } from '@adonisjs/logger';
|
|
2
|
+
import type { Request } from '../src/request.js';
|
|
3
|
+
import type { Response } from '../src/response.js';
|
|
4
|
+
import { HttpContext } from '../src/http_context/main.js';
|
|
5
|
+
type FactoryParameters = {
|
|
6
|
+
request: Request;
|
|
7
|
+
response: Response;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* HttpContext factory is used to generate Http context class instances for
|
|
12
|
+
* testing
|
|
13
|
+
*/
|
|
14
|
+
export declare class HttpContextFactory {
|
|
15
|
+
#private;
|
|
16
|
+
/**
|
|
17
|
+
* Merge factory params
|
|
18
|
+
*/
|
|
19
|
+
merge(params: Partial<FactoryParameters>): this;
|
|
20
|
+
/**
|
|
21
|
+
* Create request
|
|
22
|
+
*/
|
|
23
|
+
create(): HttpContext;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -1,149 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { S as Server } from '../main-29eaaee4.js';
|
|
8
|
-
import '@adonisjs/fold';
|
|
9
|
-
import '@poppinss/macroable';
|
|
10
|
-
import 'node:url';
|
|
11
|
-
import 'qs';
|
|
12
|
-
import 'http';
|
|
13
|
-
import 'stream';
|
|
14
|
-
import '@poppinss/middleware';
|
|
15
|
-
import '@poppinss/middleware/types';
|
|
16
|
-
import 'node:stream';
|
|
17
|
-
import 'node:https';
|
|
18
|
-
|
|
19
|
-
type FactoryParameters$4 = {
|
|
20
|
-
request: Request;
|
|
21
|
-
response: Response;
|
|
22
|
-
logger: Logger;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* HttpContext factory is used to generate Http context class instances for
|
|
26
|
-
* testing
|
|
27
|
-
*/
|
|
28
|
-
declare class HttpContextFactory {
|
|
29
|
-
#private;
|
|
30
|
-
/**
|
|
31
|
-
* Merge factory params
|
|
32
|
-
*/
|
|
33
|
-
merge(params: Partial<FactoryParameters$4>): this;
|
|
34
|
-
/**
|
|
35
|
-
* Create request
|
|
36
|
-
*/
|
|
37
|
-
create(): HttpContext;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* QS Parser factory is used to generate the query string
|
|
42
|
-
* parser for testing
|
|
43
|
-
*/
|
|
44
|
-
declare class QsParserFactory {
|
|
45
|
-
#private;
|
|
46
|
-
/**
|
|
47
|
-
* Merge encryption factory options
|
|
48
|
-
*/
|
|
49
|
-
merge(options: Partial<{
|
|
50
|
-
parse: Partial<QSParserConfig['parse']>;
|
|
51
|
-
stringify: Partial<QSParserConfig['stringify']>;
|
|
52
|
-
}>): this;
|
|
53
|
-
/**
|
|
54
|
-
* Create instance of the logger class
|
|
55
|
-
*/
|
|
56
|
-
create(): Qs;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type FactoryParameters$3 = {
|
|
60
|
-
url: string;
|
|
61
|
-
method: string;
|
|
62
|
-
req: IncomingMessage;
|
|
63
|
-
res: ServerResponse;
|
|
64
|
-
encryption: Encryption;
|
|
65
|
-
config: Partial<RequestConfig>;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Request factory is used to generate request class instances for
|
|
69
|
-
* testing
|
|
70
|
-
*/
|
|
71
|
-
declare class RequestFactory {
|
|
72
|
-
#private;
|
|
73
|
-
/**
|
|
74
|
-
* Merge factory params
|
|
75
|
-
*/
|
|
76
|
-
merge(params: Partial<FactoryParameters$3>): this;
|
|
77
|
-
/**
|
|
78
|
-
* Create request
|
|
79
|
-
*/
|
|
80
|
-
create(): Request;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type FactoryParameters$2 = {
|
|
84
|
-
req: IncomingMessage;
|
|
85
|
-
res: ServerResponse;
|
|
86
|
-
encryption: Encryption;
|
|
87
|
-
config: Partial<ResponseConfig>;
|
|
88
|
-
router: Router;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Response factory is used to generate response class instances for
|
|
92
|
-
* testing
|
|
93
|
-
*/
|
|
94
|
-
declare class ResponseFactory {
|
|
95
|
-
#private;
|
|
96
|
-
/**
|
|
97
|
-
* Merge factory params
|
|
98
|
-
*/
|
|
99
|
-
merge(params: Partial<FactoryParameters$2>): this;
|
|
100
|
-
/**
|
|
101
|
-
* Create response class instance
|
|
102
|
-
*/
|
|
103
|
-
create(): Response;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type FactoryParameters$1 = {
|
|
107
|
-
app: Application<any>;
|
|
108
|
-
encryption: Encryption;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Router factory is used to generate router class instances for
|
|
112
|
-
* testing
|
|
113
|
-
*/
|
|
114
|
-
declare class RouterFactory {
|
|
115
|
-
#private;
|
|
116
|
-
/**
|
|
117
|
-
* Merge factory params
|
|
118
|
-
*/
|
|
119
|
-
merge(params: Partial<FactoryParameters$1>): this;
|
|
120
|
-
/**
|
|
121
|
-
* Create router instance
|
|
122
|
-
*/
|
|
123
|
-
create(): Router;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
type FactoryParameters = {
|
|
127
|
-
app: Application<any>;
|
|
128
|
-
logger: Logger;
|
|
129
|
-
encryption: Encryption;
|
|
130
|
-
emitter: Emitter<any>;
|
|
131
|
-
config: Partial<ServerConfig>;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Server factory is used to generate server class instances for
|
|
135
|
-
* testing
|
|
136
|
-
*/
|
|
137
|
-
declare class ServerFactory {
|
|
138
|
-
#private;
|
|
139
|
-
/**
|
|
140
|
-
* Merge factory params
|
|
141
|
-
*/
|
|
142
|
-
merge(params: Partial<FactoryParameters>): this;
|
|
143
|
-
/**
|
|
144
|
-
* Create server instance
|
|
145
|
-
*/
|
|
146
|
-
create(): Server;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { HttpContextFactory, QsParserFactory, RequestFactory, ResponseFactory, RouterFactory, ServerFactory };
|
|
1
|
+
export { HttpContextFactory } from './http_context.js';
|
|
2
|
+
export { QsParserFactory } from './qs_parser_factory.js';
|
|
3
|
+
export { RequestFactory } from './request.js';
|
|
4
|
+
export { ResponseFactory } from './response.js';
|
|
5
|
+
export { RouterFactory } from './router.js';
|
|
6
|
+
export { ServerFactory } from './server_factory.js';
|
package/build/factories/main.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Router,
|
|
7
7
|
Server,
|
|
8
8
|
defineConfig
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-Z63E3STR.js";
|
|
10
10
|
|
|
11
11
|
// factories/http_context.ts
|
|
12
12
|
import { Container } from "@adonisjs/fold";
|
|
@@ -329,3 +329,4 @@ export {
|
|
|
329
329
|
RouterFactory,
|
|
330
330
|
ServerFactory
|
|
331
331
|
};
|
|
332
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../factories/http_context.ts","../../factories/request.ts","../../factories/qs_parser_factory.ts","../../factories/response.ts","../../factories/router.ts","../../factories/server_factory.ts"],"sourcesContent":["/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { Container } from '@adonisjs/fold'\nimport type { Logger } from '@adonisjs/logger'\nimport { LoggerFactory } from '@adonisjs/logger/factories'\n\nimport { RequestFactory } from './request.js'\nimport { ResponseFactory } from './response.js'\nimport type { Request } from '../src/request.js'\nimport type { Response } from '../src/response.js'\nimport { HttpContext } from '../src/http_context/main.js'\n\ntype FactoryParameters = {\n request: Request\n response: Response\n logger: Logger\n}\n\n/**\n * HttpContext factory is used to generate Http context class instances for\n * testing\n */\nexport class HttpContextFactory {\n #parameters: Partial<FactoryParameters> = {}\n\n /**\n * Returns the request class instance\n */\n #createRequest() {\n return this.#parameters.request || new RequestFactory().create()\n }\n\n /**\n * Returns the response class instance\n */\n #createResponse() {\n return this.#parameters.response || new ResponseFactory().create()\n }\n\n /**\n * Returns an instance of the logger class\n */\n #createLogger() {\n return this.#parameters.logger || new LoggerFactory().create()\n }\n\n /**\n * Merge factory params\n */\n merge(params: Partial<FactoryParameters>) {\n Object.assign(this.#parameters, params)\n return this\n }\n\n /**\n * Create request\n */\n create() {\n return new HttpContext(\n this.#createRequest(),\n this.#createResponse(),\n this.#createLogger(),\n new Container().createResolver()\n )\n }\n}\n","/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { Socket } from 'node:net'\nimport proxyAddr from 'proxy-addr'\nimport type { Encryption } from '@adonisjs/encryption'\nimport { IncomingMessage, ServerResponse } from 'node:http'\nimport { EncryptionFactory } from '@adonisjs/encryption/factories'\n\nimport { Request } from '../src/request.js'\nimport { RequestConfig } from '../src/types/request.js'\nimport { QsParserFactory } from './qs_parser_factory.js'\n\ntype FactoryParameters = {\n url: string\n method: string\n req: IncomingMessage\n res: ServerResponse\n encryption: Encryption\n config: Partial<RequestConfig>\n}\n\n/**\n * Request factory is used to generate request class instances for\n * testing\n */\nexport class RequestFactory {\n #parameters: Partial<FactoryParameters> = {}\n\n /**\n * Returns the config for the request class\n */\n #getConfig() {\n return {\n allowMethodSpoofing: false,\n trustProxy: proxyAddr.compile('loopback'),\n subdomainOffset: 2,\n generateRequestId: false,\n ...this.#parameters.config,\n }\n }\n\n /**\n * Returns the HTTP req object\n */\n #createRequest() {\n const req = this.#parameters.req || new IncomingMessage(new Socket())\n if (this.#parameters.url) {\n req.url = this.#parameters.url\n }\n\n if (this.#parameters.method) {\n req.method = this.#parameters.method\n }\n\n return req\n }\n\n /**\n * Returns the HTTP res object\n */\n #createResponse(req: IncomingMessage) {\n return this.#parameters.res || new ServerResponse(req)\n }\n\n /**\n * Returns an instance of the encryptor to encrypt\n * signed URLs\n */\n #createEncryption() {\n return this.#parameters.encryption || new EncryptionFactory().create()\n }\n\n /**\n * Merge factory params\n */\n merge(params: Partial<FactoryParameters>) {\n Object.assign(this.#parameters, params)\n return this\n }\n\n /**\n * Create request\n */\n create() {\n const req = this.#createRequest()\n return new Request(\n req,\n this.#createResponse(req),\n this.#createEncryption(),\n this.#getConfig(),\n new QsParserFactory().create()\n )\n }\n}\n","/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { Qs } from '../src/qs.js'\nimport type { QSParserConfig } from '../src/types/qs.js'\n\n/**\n * QS Parser factory is used to generate the query string\n * parser for testing\n */\nexport class QsParserFactory {\n #options: QSParserConfig = {\n parse: {\n depth: 5,\n parameterLimit: 1000,\n allowSparse: false,\n arrayLimit: 20,\n comma: true,\n },\n stringify: {\n encode: true,\n encodeValuesOnly: false,\n arrayFormat: 'indices',\n skipNulls: false,\n },\n }\n\n /**\n * Merge encryption factory options\n */\n merge(\n options: Partial<{\n parse: Partial<QSParserConfig['parse']>\n stringify: Partial<QSParserConfig['stringify']>\n }>\n ) {\n Object.assign(this.#options.parse, options.parse)\n Object.assign(this.#options.stringify, options.stringify)\n return this\n }\n\n /**\n * Create instance of the logger class\n */\n create() {\n return new Qs(this.#options)\n }\n}\n","/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { Socket } from 'node:net'\nimport type { Encryption } from '@adonisjs/encryption'\nimport { IncomingMessage, ServerResponse } from 'node:http'\nimport { EncryptionFactory } from '@adonisjs/encryption/factories'\n\nimport { RouterFactory } from './router.js'\nimport { Response } from '../src/response.js'\nimport { Router } from '../src/router/main.js'\nimport { ResponseConfig } from '../src/types/response.js'\nimport { QsParserFactory } from './qs_parser_factory.js'\n\ntype FactoryParameters = {\n req: IncomingMessage\n res: ServerResponse\n encryption: Encryption\n config: Partial<ResponseConfig>\n router: Router\n}\n\n/**\n * Response factory is used to generate response class instances for\n * testing\n */\nexport class ResponseFactory {\n #parameters: Partial<FactoryParameters> = {}\n\n /**\n * Returns the config for the request class\n */\n #getConfig() {\n return {\n etag: false,\n jsonpCallbackName: 'callback',\n cookie: {\n maxAge: 90,\n path: '/',\n httpOnly: true,\n sameSite: false,\n secure: false,\n },\n ...this.#parameters.config,\n }\n }\n\n /**\n * Returns the HTTP req object\n */\n #createRequest() {\n return this.#parameters.req || new IncomingMessage(new Socket())\n }\n\n /**\n * Returns an instance of the router\n */\n #createRouter() {\n return this.#parameters.router || new RouterFactory().create()\n }\n\n /**\n * Returns the HTTP res object\n */\n #createResponse(req: IncomingMessage) {\n return this.#parameters.res || new ServerResponse(req)\n }\n\n /**\n * Returns an instance of the encryptor to encrypt\n * signed URLs\n */\n #createEncryption() {\n return this.#parameters.encryption || new EncryptionFactory().create()\n }\n\n /**\n * Merge factory params\n */\n merge(params: Partial<FactoryParameters>) {\n Object.assign(this.#parameters, params)\n return this\n }\n\n /**\n * Create response class instance\n */\n create() {\n const req = this.#createRequest()\n\n return new Response(\n req,\n this.#createResponse(req),\n this.#createEncryption(),\n this.#getConfig(),\n this.#createRouter(),\n new QsParserFactory().create()\n )\n }\n}\n","/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport type { Encryption } from '@adonisjs/encryption'\nimport type { Application } from '@adonisjs/application'\nimport { AppFactory } from '@adonisjs/application/factories'\nimport { EncryptionFactory } from '@adonisjs/encryption/factories'\n\nimport { Router } from '../src/router/main.js'\nimport { QsParserFactory } from './qs_parser_factory.js'\n\ntype FactoryParameters = {\n app: Application<any>\n encryption: Encryption\n}\n\n/**\n * Router factory is used to generate router class instances for\n * testing\n */\nexport class RouterFactory {\n #parameters: Partial<FactoryParameters> = {}\n\n /**\n * Returns an instance of the application class\n */\n #getApp() {\n return (\n this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => {})\n )\n }\n\n /**\n * Returns an instance of the encryptor to encrypt\n * signed URLs\n */\n #createEncryption() {\n return this.#parameters.encryption || new EncryptionFactory().create()\n }\n\n /**\n * Merge factory params\n */\n merge(params: Partial<FactoryParameters>) {\n Object.assign(this.#parameters, params)\n return this\n }\n\n /**\n * Create router instance\n */\n create() {\n return new Router(this.#getApp(), this.#createEncryption(), new QsParserFactory().create())\n }\n}\n","/*\n * @adonisjs/http-server\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { Logger } from '@adonisjs/logger'\nimport { Emitter } from '@adonisjs/events'\nimport type { Encryption } from '@adonisjs/encryption'\nimport type { Application } from '@adonisjs/application'\nimport { AppFactory } from '@adonisjs/application/factories'\nimport { EncryptionFactory } from '@adonisjs/encryption/factories'\n\nimport { Server } from '../src/server/main.js'\nimport { defineConfig } from '../src/define_config.js'\nimport type { ServerConfig } from '../src/types/server.js'\n\ntype FactoryParameters = {\n app: Application<any>\n logger: Logger\n encryption: Encryption\n emitter: Emitter<any>\n config: Partial<ServerConfig>\n}\n\n/**\n * Server factory is used to generate server class instances for\n * testing\n */\nexport class ServerFactory {\n #parameters: Partial<FactoryParameters> = {}\n\n /**\n * Returns the emitter instance\n */\n #getEmitter() {\n return this.#parameters.emitter || new Emitter(this.#getApp())\n }\n\n /**\n * Returns the logger instance\n */\n #getLogger() {\n return this.#parameters.logger || new Logger({ enabled: false })\n }\n\n /**\n * Returns the config for the server class\n */\n #getConfig() {\n return defineConfig(this.#parameters.config || {})\n }\n\n /**\n * Returns an instance of the application class\n */\n #getApp() {\n return (\n this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => {})\n )\n }\n\n /**\n * Returns an instance of the encryptor to encrypt\n * signed URLs\n */\n #createEncryption() {\n return this.#parameters.encryption || new EncryptionFactory().create()\n }\n\n /**\n * Merge factory params\n */\n merge(params: Partial<FactoryParameters>) {\n Object.assign(this.#parameters, params)\n return this\n }\n\n /**\n * Create server instance\n */\n create() {\n return new Server(\n this.#getApp(),\n this.#createEncryption(),\n this.#getEmitter(),\n this.#getLogger(),\n this.#getConfig()\n )\n }\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;;;ACF9B,SAAS,cAAc;AACvB,OAAO,eAAe;AAEtB,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,yBAAyB;;;ACG3B,IAAM,kBAAN,MAAsB;AAAA,EAC3B,WAA2B;AAAA,IACzB,OAAO;AAAA,MACL,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,WAAW;AAAA,IACb;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MACE,SAIA;AACA,WAAO,OAAO,KAAK,SAAS,OAAO,QAAQ,KAAK;AA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AAA,MACrB,KAAK,cAAc;AAAA,MACnB,IAAI,UAAU,EAAE,eAAe;AAAA,IACjC;AAAA,EACF;AACF;;;AK/DA,SAAS,cAAc;AACvB,SAAS,eAAe;AAGxB,SAAS,cAAAC,mBAAkB;AAC3B,SAAS,qBAAAC,0BAAyB;AAkB3B,IAAM,gBAAN,MAAoB;AAAA,EACzB,cAA0C,CAAC;AAAA;AAAA;AAAA;AAAA,EAK3C,cAAc;AACZ,WAAO,KAAK,YAAY,WAAW,IAAI,QAAQ,KAAK,QAAQ,CAAC;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa;AACX,WAAO,KAAK,YAAY,UAAU,IAAI,OAAO,EAAE,SAAS,MAAM,CAAC;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa;AACX,WAAO,aAAa,KAAK,YAAY,UAAU,CAAC,CAAC;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,WACE,KAAK,YAAY,OAAO,IAAIC,YAAW,EAAE,OAAO,IAAI,IAAI,UAAU,YAAY,GAAG,GAAG,MAAM;AAAA,IAAC,CAAC;AAAA,EAEhG;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,oBAAoB;AAClB,WAAO,KAAK,YAAY,cAAc,IAAIC,mBAAkB,EAAE,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAoC;AACxC,WAAO,OAAO,KAAK,aAAa,MAAM;AACtC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS;AACP,WAAO,IAAI;AAAA,MACT,KAAK,QAAQ;AAAA,MACb,KAAK,kBAAkB;AAAA,MACvB,KAAK,YAAY;AAAA,MACjB,KAAK,WAAW;AAAA,MAChB,KAAK,WAAW;AAAA,IAClB;AAAA,EACF;AACF;","names":["Socket","IncomingMessage","ServerResponse","EncryptionFactory","EncryptionFactory","EncryptionFactory","IncomingMessage","Socket","ServerResponse","EncryptionFactory","AppFactory","EncryptionFactory","AppFactory","EncryptionFactory"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Qs } from '../src/qs.js';
|
|
2
|
+
import type { QSParserConfig } from '../src/types/qs.js';
|
|
3
|
+
/**
|
|
4
|
+
* QS Parser factory is used to generate the query string
|
|
5
|
+
* parser for testing
|
|
6
|
+
*/
|
|
7
|
+
export declare class QsParserFactory {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Merge encryption factory options
|
|
11
|
+
*/
|
|
12
|
+
merge(options: Partial<{
|
|
13
|
+
parse: Partial<QSParserConfig['parse']>;
|
|
14
|
+
stringify: Partial<QSParserConfig['stringify']>;
|
|
15
|
+
}>): this;
|
|
16
|
+
/**
|
|
17
|
+
* Create instance of the logger class
|
|
18
|
+
*/
|
|
19
|
+
create(): Qs;
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { Encryption } from '@adonisjs/encryption';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
import { Request } from '../src/request.js';
|
|
5
|
+
import { RequestConfig } from '../src/types/request.js';
|
|
6
|
+
type FactoryParameters = {
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
req: IncomingMessage;
|
|
10
|
+
res: ServerResponse;
|
|
11
|
+
encryption: Encryption;
|
|
12
|
+
config: Partial<RequestConfig>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Request factory is used to generate request class instances for
|
|
16
|
+
* testing
|
|
17
|
+
*/
|
|
18
|
+
export declare class RequestFactory {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Merge factory params
|
|
22
|
+
*/
|
|
23
|
+
merge(params: Partial<FactoryParameters>): this;
|
|
24
|
+
/**
|
|
25
|
+
* Create request
|
|
26
|
+
*/
|
|
27
|
+
create(): Request;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { Encryption } from '@adonisjs/encryption';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
import { Response } from '../src/response.js';
|
|
5
|
+
import { Router } from '../src/router/main.js';
|
|
6
|
+
import { ResponseConfig } from '../src/types/response.js';
|
|
7
|
+
type FactoryParameters = {
|
|
8
|
+
req: IncomingMessage;
|
|
9
|
+
res: ServerResponse;
|
|
10
|
+
encryption: Encryption;
|
|
11
|
+
config: Partial<ResponseConfig>;
|
|
12
|
+
router: Router;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Response factory is used to generate response class instances for
|
|
16
|
+
* testing
|
|
17
|
+
*/
|
|
18
|
+
export declare class ResponseFactory {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Merge factory params
|
|
22
|
+
*/
|
|
23
|
+
merge(params: Partial<FactoryParameters>): this;
|
|
24
|
+
/**
|
|
25
|
+
* Create response class instance
|
|
26
|
+
*/
|
|
27
|
+
create(): Response;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Encryption } from '@adonisjs/encryption';
|
|
2
|
+
import type { Application } from '@adonisjs/application';
|
|
3
|
+
import { Router } from '../src/router/main.js';
|
|
4
|
+
type FactoryParameters = {
|
|
5
|
+
app: Application<any>;
|
|
6
|
+
encryption: Encryption;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Router factory is used to generate router class instances for
|
|
10
|
+
* testing
|
|
11
|
+
*/
|
|
12
|
+
export declare class RouterFactory {
|
|
13
|
+
#private;
|
|
14
|
+
/**
|
|
15
|
+
* Merge factory params
|
|
16
|
+
*/
|
|
17
|
+
merge(params: Partial<FactoryParameters>): this;
|
|
18
|
+
/**
|
|
19
|
+
* Create router instance
|
|
20
|
+
*/
|
|
21
|
+
create(): Router;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Logger } from '@adonisjs/logger';
|
|
2
|
+
import { Emitter } from '@adonisjs/events';
|
|
3
|
+
import type { Encryption } from '@adonisjs/encryption';
|
|
4
|
+
import type { Application } from '@adonisjs/application';
|
|
5
|
+
import { Server } from '../src/server/main.js';
|
|
6
|
+
import type { ServerConfig } from '../src/types/server.js';
|
|
7
|
+
type FactoryParameters = {
|
|
8
|
+
app: Application<any>;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
encryption: Encryption;
|
|
11
|
+
emitter: Emitter<any>;
|
|
12
|
+
config: Partial<ServerConfig>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Server factory is used to generate server class instances for
|
|
16
|
+
* testing
|
|
17
|
+
*/
|
|
18
|
+
export declare class ServerFactory {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Merge factory params
|
|
22
|
+
*/
|
|
23
|
+
merge(params: Partial<FactoryParameters>): this;
|
|
24
|
+
/**
|
|
25
|
+
* Create server instance
|
|
26
|
+
*/
|
|
27
|
+
create(): Server;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -1,272 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import '@poppinss/middleware';
|
|
16
|
-
import '@poppinss/middleware/types';
|
|
17
|
-
import 'node:stream';
|
|
18
|
-
import '@adonisjs/application';
|
|
19
|
-
import '@adonisjs/events';
|
|
20
|
-
import 'node:https';
|
|
21
|
-
|
|
22
|
-
declare const E_ROUTE_NOT_FOUND: new (args: [method: string, url: string], options?: ErrorOptions | undefined) => Exception;
|
|
23
|
-
declare const E_CANNOT_LOOKUP_ROUTE: new (args: [routeIdentifier: string], options?: ErrorOptions | undefined) => Exception;
|
|
24
|
-
declare const E_HTTP_EXCEPTION: {
|
|
25
|
-
new (message?: string | undefined, options?: (ErrorOptions & {
|
|
26
|
-
code?: string | undefined;
|
|
27
|
-
status?: number | undefined;
|
|
28
|
-
}) | undefined): {
|
|
29
|
-
body: any;
|
|
30
|
-
name: string;
|
|
31
|
-
help?: string | undefined;
|
|
32
|
-
code?: string | undefined;
|
|
33
|
-
status: number;
|
|
34
|
-
toString(): string;
|
|
35
|
-
readonly [Symbol.toStringTag]: string;
|
|
36
|
-
message: string;
|
|
37
|
-
stack?: string | undefined;
|
|
38
|
-
cause?: unknown;
|
|
39
|
-
};
|
|
40
|
-
code: string;
|
|
41
|
-
/**
|
|
42
|
-
* This method returns an instance of the exception class
|
|
43
|
-
*/
|
|
44
|
-
invoke(body: any, status: number, code?: string): {
|
|
45
|
-
body: any;
|
|
46
|
-
name: string;
|
|
47
|
-
help?: string | undefined;
|
|
48
|
-
code?: string | undefined;
|
|
49
|
-
status: number;
|
|
50
|
-
toString(): string;
|
|
51
|
-
readonly [Symbol.toStringTag]: string;
|
|
52
|
-
message: string;
|
|
53
|
-
stack?: string | undefined;
|
|
54
|
-
cause?: unknown;
|
|
55
|
-
};
|
|
56
|
-
help?: string | undefined;
|
|
57
|
-
status?: number | undefined;
|
|
58
|
-
message?: string | undefined;
|
|
59
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
60
|
-
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
61
|
-
stackTraceLimit: number;
|
|
62
|
-
};
|
|
63
|
-
declare const E_HTTP_REQUEST_ABORTED: {
|
|
64
|
-
new (message?: string | undefined, options?: (ErrorOptions & {
|
|
65
|
-
code?: string | undefined;
|
|
66
|
-
status?: number | undefined;
|
|
67
|
-
}) | undefined): {
|
|
68
|
-
handle(error: any, ctx: HttpContext): void;
|
|
69
|
-
body: any;
|
|
70
|
-
name: string;
|
|
71
|
-
help?: string | undefined;
|
|
72
|
-
code?: string | undefined;
|
|
73
|
-
status: number;
|
|
74
|
-
toString(): string;
|
|
75
|
-
readonly [Symbol.toStringTag]: string;
|
|
76
|
-
message: string;
|
|
77
|
-
stack?: string | undefined;
|
|
78
|
-
cause?: unknown;
|
|
79
|
-
};
|
|
80
|
-
code: string;
|
|
81
|
-
/**
|
|
82
|
-
* This method returns an instance of the exception class
|
|
83
|
-
*/
|
|
84
|
-
invoke(body: any, status: number, code?: string): {
|
|
85
|
-
body: any;
|
|
86
|
-
name: string;
|
|
87
|
-
help?: string | undefined;
|
|
88
|
-
code?: string | undefined;
|
|
89
|
-
status: number;
|
|
90
|
-
toString(): string;
|
|
91
|
-
readonly [Symbol.toStringTag]: string;
|
|
92
|
-
message: string;
|
|
93
|
-
stack?: string | undefined;
|
|
94
|
-
cause?: unknown;
|
|
95
|
-
};
|
|
96
|
-
help?: string | undefined;
|
|
97
|
-
status?: number | undefined;
|
|
98
|
-
message?: string | undefined;
|
|
99
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
100
|
-
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
101
|
-
stackTraceLimit: number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
declare const exceptions_E_CANNOT_LOOKUP_ROUTE: typeof E_CANNOT_LOOKUP_ROUTE;
|
|
105
|
-
declare const exceptions_E_HTTP_EXCEPTION: typeof E_HTTP_EXCEPTION;
|
|
106
|
-
declare const exceptions_E_HTTP_REQUEST_ABORTED: typeof E_HTTP_REQUEST_ABORTED;
|
|
107
|
-
declare const exceptions_E_ROUTE_NOT_FOUND: typeof E_ROUTE_NOT_FOUND;
|
|
108
|
-
declare namespace exceptions {
|
|
109
|
-
export {
|
|
110
|
-
exceptions_E_CANNOT_LOOKUP_ROUTE as E_CANNOT_LOOKUP_ROUTE,
|
|
111
|
-
exceptions_E_HTTP_EXCEPTION as E_HTTP_EXCEPTION,
|
|
112
|
-
exceptions_E_HTTP_REQUEST_ABORTED as E_HTTP_REQUEST_ABORTED,
|
|
113
|
-
exceptions_E_ROUTE_NOT_FOUND as E_ROUTE_NOT_FOUND,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
type UserDefinedServerConfig = Partial<Omit<ServerConfig, 'trustProxy'> & {
|
|
118
|
-
trustProxy: ((address: string, distance: number) => boolean) | boolean | string;
|
|
119
|
-
}>;
|
|
120
|
-
/**
|
|
121
|
-
* Define configuration for the HTTP server
|
|
122
|
-
*/
|
|
123
|
-
declare function defineConfig(config: UserDefinedServerConfig): ServerConfig;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Cookie client exposes the API to parse/set AdonisJS cookies
|
|
127
|
-
* as a client.
|
|
128
|
-
*/
|
|
129
|
-
declare class CookieClient {
|
|
130
|
-
#private;
|
|
131
|
-
constructor(encryption: Encryption);
|
|
132
|
-
/**
|
|
133
|
-
* Encrypt a key value pair to be sent in the cookie header
|
|
134
|
-
*/
|
|
135
|
-
encrypt(key: string, value: any): string | null;
|
|
136
|
-
/**
|
|
137
|
-
* Sign a key value pair to be sent in the cookie header
|
|
138
|
-
*/
|
|
139
|
-
sign(key: string, value: any): string | null;
|
|
140
|
-
/**
|
|
141
|
-
* Encode a key value pair to be sent in the cookie header
|
|
142
|
-
*/
|
|
143
|
-
encode(_: string, value: any): string | null;
|
|
144
|
-
/**
|
|
145
|
-
* Unsign a signed cookie value
|
|
146
|
-
*/
|
|
147
|
-
unsign(key: string, value: string): any;
|
|
148
|
-
/**
|
|
149
|
-
* Decrypt an encrypted cookie value
|
|
150
|
-
*/
|
|
151
|
-
decrypt(key: string, value: string): any;
|
|
152
|
-
/**
|
|
153
|
-
* Decode an encoded cookie value
|
|
154
|
-
*/
|
|
155
|
-
decode(_: string, value: string): any;
|
|
156
|
-
/**
|
|
157
|
-
* Parse response cookie
|
|
158
|
-
*/
|
|
159
|
-
parse(key: string, value: any): any;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* The base HTTP exception handler one can inherit from to handle
|
|
164
|
-
* HTTP exceptions.
|
|
165
|
-
*
|
|
166
|
-
* The HTTP exception handler has support for
|
|
167
|
-
*
|
|
168
|
-
* - Ability to render exceptions by calling the render method on the exception.
|
|
169
|
-
* - Rendering status pages
|
|
170
|
-
* - Pretty printing errors during development
|
|
171
|
-
* - Transforming errors to JSON or HTML using content negotiation
|
|
172
|
-
* - Reporting errors
|
|
173
|
-
*/
|
|
174
|
-
declare class ExceptionHandler extends Macroable {
|
|
175
|
-
#private;
|
|
176
|
-
/**
|
|
177
|
-
* Whether or not to render debug info. When set to true, the errors
|
|
178
|
-
* will have the complete error stack.
|
|
179
|
-
*/
|
|
180
|
-
protected debug: boolean;
|
|
181
|
-
/**
|
|
182
|
-
* Whether or not to render status pages. When set to true, the unhandled
|
|
183
|
-
* errors with matching status codes will be rendered using a status
|
|
184
|
-
* page.
|
|
185
|
-
*/
|
|
186
|
-
protected renderStatusPages: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* A collection of error status code range and the view to render.
|
|
189
|
-
*/
|
|
190
|
-
protected statusPages: Record<StatusPageRange, StatusPageRenderer>;
|
|
191
|
-
/**
|
|
192
|
-
* Enable/disable errors reporting
|
|
193
|
-
*/
|
|
194
|
-
protected reportErrors: boolean;
|
|
195
|
-
/**
|
|
196
|
-
* An array of exception classes to ignore when
|
|
197
|
-
* reporting an error
|
|
198
|
-
*/
|
|
199
|
-
protected ignoreExceptions: any[];
|
|
200
|
-
/**
|
|
201
|
-
* An array of HTTP status codes to ignore when reporting
|
|
202
|
-
* an error
|
|
203
|
-
*/
|
|
204
|
-
protected ignoreStatuses: number[];
|
|
205
|
-
/**
|
|
206
|
-
* An array of error codes to ignore when reporting
|
|
207
|
-
* an error
|
|
208
|
-
*/
|
|
209
|
-
protected ignoreCodes: string[];
|
|
210
|
-
/**
|
|
211
|
-
* Error reporting context
|
|
212
|
-
*/
|
|
213
|
-
protected context(ctx: HttpContext): any;
|
|
214
|
-
/**
|
|
215
|
-
* Returns the log level for an error based upon the error
|
|
216
|
-
* status code.
|
|
217
|
-
*/
|
|
218
|
-
protected getErrorLogLevel(error: HttpError): Level;
|
|
219
|
-
/**
|
|
220
|
-
* A boolean to control if errors should be rendered with
|
|
221
|
-
* all the available debugging info.
|
|
222
|
-
*/
|
|
223
|
-
protected isDebuggingEnabled(_: HttpContext): boolean;
|
|
224
|
-
/**
|
|
225
|
-
* Returns a boolean by checking if an error should be reported.
|
|
226
|
-
*/
|
|
227
|
-
protected shouldReport(error: HttpError): boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Renders an error to JSON response
|
|
230
|
-
*/
|
|
231
|
-
renderErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
232
|
-
/**
|
|
233
|
-
* Renders an error to JSON API response
|
|
234
|
-
*/
|
|
235
|
-
renderErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
236
|
-
/**
|
|
237
|
-
* Renders an error to HTML response
|
|
238
|
-
*/
|
|
239
|
-
renderErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* Renders the validation error message to a JSON
|
|
242
|
-
* response
|
|
243
|
-
*/
|
|
244
|
-
renderValidationErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
245
|
-
/**
|
|
246
|
-
* Renders the validation error message as per JSON API
|
|
247
|
-
* spec
|
|
248
|
-
*/
|
|
249
|
-
renderValidationErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
250
|
-
/**
|
|
251
|
-
* Renders the validation error as an HTML string
|
|
252
|
-
*/
|
|
253
|
-
renderValidationErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
254
|
-
/**
|
|
255
|
-
* Renders the error to response
|
|
256
|
-
*/
|
|
257
|
-
renderError(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
258
|
-
/**
|
|
259
|
-
* Renders the validation error to response
|
|
260
|
-
*/
|
|
261
|
-
renderValidationError(error: HttpError, ctx: HttpContext): Promise<void>;
|
|
262
|
-
/**
|
|
263
|
-
* Reports an error during an HTTP request
|
|
264
|
-
*/
|
|
265
|
-
report(error: unknown, ctx: HttpContext): Promise<void>;
|
|
266
|
-
/**
|
|
267
|
-
* Handles the error during the HTTP request.
|
|
268
|
-
*/
|
|
269
|
-
handle(error: unknown, ctx: HttpContext): Promise<any>;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export { CookieClient, ExceptionHandler, HttpContext, defineConfig, exceptions as errors };
|
|
1
|
+
export { Request } from './src/request.js';
|
|
2
|
+
export { Response } from './src/response.js';
|
|
3
|
+
export { Redirect } from './src/redirect.js';
|
|
4
|
+
export { Server } from './src/server/main.js';
|
|
5
|
+
export { Router } from './src/router/main.js';
|
|
6
|
+
export { Route } from './src/router/route.js';
|
|
7
|
+
export * as errors from './src/exceptions.js';
|
|
8
|
+
export { BriskRoute } from './src/router/brisk.js';
|
|
9
|
+
export { RouteGroup } from './src/router/group.js';
|
|
10
|
+
export { defineConfig } from './src/define_config.js';
|
|
11
|
+
export { CookieClient } from './src/cookies/client.js';
|
|
12
|
+
export { HttpContext } from './src/http_context/main.js';
|
|
13
|
+
export { RouteResource } from './src/router/resource.js';
|
|
14
|
+
export { ExceptionHandler } from './src/exception_handler.js';
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
defineConfig,
|
|
18
18
|
exceptions_exports,
|
|
19
19
|
parseRange
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-Z63E3STR.js";
|
|
21
21
|
|
|
22
22
|
// src/exception_handler.ts
|
|
23
23
|
import is from "@sindresorhus/is";
|
|
@@ -306,3 +306,4 @@ export {
|
|
|
306
306
|
defineConfig,
|
|
307
307
|
exceptions_exports as errors
|
|
308
308
|
};
|
|
309
|
+
//# sourceMappingURL=index.js.map
|