@aurelia/http-server
Advanced tools
Comparing version 2.1.0-dev.202401061915 to 2.1.0-dev.202401281151
@@ -6,2 +6,9 @@ # Change Log | ||
<a name="2.0.0-beta.10"></a> | ||
# 2.0.0-beta.10 (2024-01-26) | ||
### Refactorings: | ||
* **enums:** string literal types in favour of const enums (#1870) ([e21e0c9](https://github.com/aurelia/aurelia/commit/e21e0c9)) | ||
<a name="2.0.0-beta.9"></a> | ||
@@ -8,0 +15,0 @@ # 2.0.0-beta.9 (2023-12-12) |
@@ -10,7 +10,3 @@ /// <reference types="node" /> | ||
import { QualifiedHeaderValues } from './http-utils'; | ||
export declare const enum HttpContextState { | ||
head = 1, | ||
body = 2, | ||
end = 3 | ||
} | ||
export type HttpContextState = 'head' | 'body' | 'end'; | ||
export interface IHttpContext extends HttpContext { | ||
@@ -17,0 +13,0 @@ } |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import { Http2ServerRequest, IncomingHttpHeaders as IncomingHttp2Headers } from 'http2'; | ||
export declare const enum HTTPStatusCode { | ||
export declare enum HTTPStatusCode { | ||
SwitchingProtocols = 101, | ||
@@ -23,16 +23,4 @@ OK = 200, | ||
} | ||
export declare const enum ContentType { | ||
unknown = "", | ||
json = "application/json; charset=utf-8", | ||
javascript = "application/javascript; charset=utf-8", | ||
plain = "text/plain; charset=utf-8", | ||
html = "text/html; charset=utf-8", | ||
css = "text/css; charset=utf-8" | ||
} | ||
export declare const enum ContentEncoding { | ||
identity = "identity", | ||
br = "br", | ||
gzip = "gzip", | ||
compress = "compress" | ||
} | ||
export type ContentType = '' | 'application/json; charset=utf-8' | 'application/javascript; charset=utf-8' | 'text/plain; charset=utf-8' | 'text/html; charset=utf-8' | 'text/css; charset=utf-8'; | ||
export type ContentEncoding = 'identity' | 'br' | 'gzip' | 'compress'; | ||
export declare class HTTPError extends Error { | ||
@@ -39,0 +27,0 @@ readonly statusCode: number; |
export { FileServer, } from './request-handlers/file-server'; | ||
export { HttpServerConfiguration as RuntimeNodeConfiguration, } from './configuration'; | ||
export { HttpContextState, HttpContext, IHttpContext, } from './http-context'; | ||
export { type HttpContextState, HttpContext, IHttpContext, } from './http-context'; | ||
export { HttpServer, } from './http-server'; | ||
export { HTTPStatusCode, ContentType, HTTPError, readBuffer, getContentType, } from './http-utils'; | ||
export { Encoding, IHttpServer, IHttpServerOptions, IRequestHandler, LogLevel, } from './interfaces'; | ||
export { HTTPStatusCode, type ContentType, HTTPError, readBuffer, getContentType, } from './http-utils'; | ||
export { IHttpServer, IHttpServerOptions, IRequestHandler, LogLevel, } from './interfaces'; | ||
export { joinPath, resolvePath, normalizePath, } from './path-utils'; | ||
export { HttpServerOptions, } from './server-options'; | ||
//# sourceMappingURL=index.d.ts.map |
import { IHttpContext } from './http-context'; | ||
export declare const enum Encoding { | ||
utf8 = "utf8" | ||
} | ||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'none'; | ||
@@ -6,0 +3,0 @@ export interface IHttpServerOptions { |
{ | ||
"name": "@aurelia/http-server", | ||
"version": "2.1.0-dev.202401061915", | ||
"version": "2.1.0-dev.202401281151", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -51,6 +51,6 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.1.0-dev.202401061915", | ||
"@aurelia/metadata": "2.1.0-dev.202401061915", | ||
"@aurelia/platform": "2.1.0-dev.202401061915", | ||
"@aurelia/runtime": "2.1.0-dev.202401061915" | ||
"@aurelia/kernel": "2.1.0-dev.202401281151", | ||
"@aurelia/metadata": "2.1.0-dev.202401281151", | ||
"@aurelia/platform": "2.1.0-dev.202401281151", | ||
"@aurelia/runtime": "2.1.0-dev.202401281151" | ||
}, | ||
@@ -57,0 +57,0 @@ "devDependencies": { |
@@ -0,3 +1,3 @@ | ||
import { ConsoleSink, IContainer, IPlatform, LoggerConfiguration, Registration } from '@aurelia/kernel'; | ||
import { Platform } from '@aurelia/platform'; | ||
import { ColorOptions, ConsoleSink, IContainer, IPlatform, LoggerConfiguration, Registration } from '@aurelia/kernel'; | ||
import { Http2Server, HttpServer } from './http-server'; | ||
@@ -22,3 +22,3 @@ import { IHttp2FileServer, IHttpServer, IHttpServerOptions, IRequestHandler } from './interfaces'; | ||
Registration.singleton(IHttp2FileServer, Http2FileServer), | ||
LoggerConfiguration.create({ sinks: [ConsoleSink], level: opts.level, colorOptions: ColorOptions.colors }), | ||
LoggerConfiguration.create({ sinks: [ConsoleSink], level: opts.level, colorOptions: 'colors' }), | ||
Registration.instance(IPlatform, new Platform(globalThis)), | ||
@@ -25,0 +25,0 @@ ); |
@@ -7,7 +7,3 @@ import { IContainer } from '@aurelia/kernel'; | ||
export const enum HttpContextState { | ||
head = 1, | ||
body = 2, | ||
end = 3, | ||
} | ||
export type HttpContextState = 'head' | 'body' | 'end'; | ||
@@ -18,3 +14,3 @@ export interface IHttpContext extends HttpContext { } | ||
public readonly container: IContainer; | ||
public state: HttpContextState = HttpContextState.head; | ||
public state: HttpContextState = 'head'; | ||
private readonly parsedHeaders: Record<string, QualifiedHeaderValues> = Object.create(null); | ||
@@ -21,0 +17,0 @@ private readonly _requestUrl: $url.UrlWithStringQuery; |
import { IncomingMessage, IncomingHttpHeaders } from 'http'; | ||
import { Http2ServerRequest, IncomingHttpHeaders as IncomingHttp2Headers, constants } from 'http2'; | ||
export const enum HTTPStatusCode { | ||
export enum HTTPStatusCode { | ||
SwitchingProtocols = 101, | ||
@@ -25,18 +25,13 @@ | ||
export const enum ContentType { | ||
unknown = '', | ||
json = 'application/json; charset=utf-8', | ||
javascript = 'application/javascript; charset=utf-8', | ||
plain = 'text/plain; charset=utf-8', | ||
html = 'text/html; charset=utf-8', | ||
css = 'text/css; charset=utf-8', | ||
} | ||
export type ContentType = | ||
/* unknown */ '' | ||
/* json */ | 'application/json; charset=utf-8' | ||
/* javascript */ | 'application/javascript; charset=utf-8' | ||
/* plain */ | 'text/plain; charset=utf-8' | ||
/* html */ | 'text/html; charset=utf-8' | ||
/* css */ | 'text/css; charset=utf-8' | ||
; | ||
export const enum ContentEncoding { | ||
identity = 'identity', | ||
br = 'br', | ||
gzip = 'gzip', | ||
compress = 'compress', | ||
// deflate = 'deflate', // Need to deal with this later. No known fixed file extension for deflate | ||
} | ||
export type ContentEncoding = 'identity' | 'br' | 'gzip' | 'compress'; | ||
// | 'deflate' // Need to deal with this later. No known fixed file extension for deflate | ||
@@ -77,10 +72,10 @@ export class HTTPError extends Error { | ||
switch (path.slice(i)) { | ||
case '.js': return ContentType.javascript; | ||
case '.css': return ContentType.css; | ||
case '.json': return ContentType.json; | ||
case '.html': return ContentType.html; | ||
case '.js': return 'application/javascript; charset=utf-8'; | ||
case '.css': return 'text/css; charset=utf-8'; | ||
case '.json': return 'application/json; charset=utf-8'; | ||
case '.html': return 'text/html; charset=utf-8'; | ||
} | ||
} | ||
return ContentType.plain; | ||
return 'text/plain; charset=utf-8'; | ||
} | ||
@@ -92,9 +87,9 @@ | ||
switch (path.slice(i)) { | ||
case '.br': return ContentEncoding.br; | ||
case '.gz': return ContentEncoding.gzip; | ||
case '.lzw': return ContentEncoding.compress; | ||
case '.br': return 'br'; | ||
case '.gz': return 'gzip'; | ||
case '.lzw': return 'compress'; | ||
} | ||
} | ||
return ContentEncoding.identity; | ||
return 'identity'; | ||
} | ||
@@ -101,0 +96,0 @@ |
@@ -8,3 +8,3 @@ export { | ||
export { | ||
HttpContextState, | ||
type HttpContextState, | ||
HttpContext, | ||
@@ -18,3 +18,3 @@ IHttpContext, | ||
HTTPStatusCode, | ||
ContentType, | ||
type ContentType, | ||
HTTPError, | ||
@@ -25,3 +25,2 @@ readBuffer, | ||
export { | ||
Encoding, | ||
IHttpServer, | ||
@@ -28,0 +27,0 @@ IHttpServerOptions, |
import { DI, LogLevel as $LogLevel } from '@aurelia/kernel'; | ||
import { IHttpContext } from './http-context'; | ||
export const enum Encoding { | ||
utf8 = 'utf8', | ||
} | ||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'none'; | ||
@@ -9,0 +5,0 @@ export interface IHttpServerOptions { |
@@ -7,3 +7,3 @@ import { statSync, openSync, readdirSync } from 'fs'; | ||
import { IRequestHandler, IHttpServerOptions, IHttp2FileServer } from '../interfaces'; | ||
import { IHttpContext, HttpContextState } from '../http-context'; | ||
import { IHttpContext } from '../http-context'; | ||
import { getContentType, HTTPStatusCode, getContentEncoding, ContentEncoding } from '../http-utils'; | ||
@@ -100,3 +100,3 @@ import { readFile, isReadable, exists } from '../file-utils'; | ||
context.state = HttpContextState.end; | ||
context.state = 'end'; | ||
} | ||
@@ -158,3 +158,3 @@ | ||
context.state = HttpContextState.end; | ||
context.state = 'end'; | ||
} | ||
@@ -161,0 +161,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4
480011
3829
+ Added@aurelia/kernel@2.1.0-dev.202401281151(transitive)
+ Added@aurelia/metadata@2.1.0-dev.202401281151(transitive)
+ Added@aurelia/platform@2.1.0-dev.202401281151(transitive)
+ Added@aurelia/runtime@2.1.0-dev.202401281151(transitive)
- Removed@aurelia/kernel@2.1.0-dev.202401061915(transitive)
- Removed@aurelia/metadata@2.1.0-dev.202401061915(transitive)
- Removed@aurelia/platform@2.1.0-dev.202401061915(transitive)
- Removed@aurelia/runtime@2.1.0-dev.202401061915(transitive)