Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
@@ -5,2 +5,8 @@ # Changelog | ||
## [3.0.0-alpha.6][] - 2022-12-24 | ||
- Move `serveStatic` from metacom | ||
- Fix multiple applications for windows | ||
- Use metacom 3.0.0-alpha.5 | ||
## [3.0.0-alpha.5][] - 2022-08-20 | ||
@@ -7,0 +13,0 @@ |
@@ -160,3 +160,3 @@ 'use strict'; | ||
.readFile('.applications', 'utf8') | ||
.then((data) => data.split('\n').filter((s) => s.length !== 0)) | ||
.then((data) => data.split(/[\r\n\s]+/).filter((s) => s.length !== 0)) | ||
.catch(() => [PATH]); | ||
@@ -163,0 +163,0 @@ for (const path of list) { |
@@ -10,2 +10,3 @@ 'use strict'; | ||
const workerData = wt.workerData || { path: process.cwd() }; | ||
const metautil = require('metautil'); | ||
const metavm = require('metavm'); | ||
@@ -242,4 +243,25 @@ const metawatch = require('metawatch'); | ||
} | ||
serveStatic(channel) { | ||
const { req, res } = channel; | ||
if (res.writableEnded) return; | ||
const { url } = req; | ||
const [urlPath, params] = metautil.split(url, '?'); | ||
const folder = urlPath.endsWith('/'); | ||
const filePath = urlPath + (folder ? 'index.html' : ''); | ||
const fileExt = metautil.fileExt(filePath); | ||
const data = this.getStaticFile(filePath); | ||
if (data) { | ||
channel.write(data, 200, fileExt); | ||
return; | ||
} | ||
if (!folder && this.getStaticFile(urlPath + '/index.html')) { | ||
const query = params ? '?' + params : ''; | ||
channel.redirect(urlPath + '/' + query); | ||
return; | ||
} | ||
channel.error(404); | ||
} | ||
} | ||
module.exports = new Application(); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const system = ['util', 'child_process', 'os', 'v8', 'vm']; | ||
const system = ['util', 'buffer', 'child_process', 'os', 'v8', 'vm']; | ||
const tools = ['path', 'url', 'string_decoder', 'querystring', 'assert']; | ||
@@ -12,0 +12,0 @@ const streams = ['stream', 'fs', 'crypto', 'zlib', 'readline']; |
{ | ||
"name": "impress", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -66,17 +66,17 @@ "description": "Enterprise application server for Node.js", | ||
"engines": { | ||
"node": "14 || 16 || 18" | ||
"node": "14 || 16 || 18 || 19" | ||
}, | ||
"dependencies": { | ||
"metacom": "^3.0.0-alpha.4", | ||
"metaconfiguration": "^2.1.8", | ||
"metacom": "^3.0.0-alpha.5", | ||
"metaconfiguration": "^2.1.9", | ||
"metalog": "^3.1.9", | ||
"metaschema": "^2.1.1", | ||
"metautil": "^3.5.23", | ||
"metavm": "^1.2.1", | ||
"metawatch": "^1.0.6" | ||
"metautil": "^3.6.0", | ||
"metavm": "^1.2.2", | ||
"metawatch": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.7.8", | ||
"@types/node": "^18.11.17", | ||
"@types/ws": "^8.5.3", | ||
"eslint": "^8.22.0", | ||
"eslint": "^8.30.0", | ||
"eslint-config-metarhia": "^8.1.0", | ||
@@ -87,5 +87,5 @@ "eslint-config-prettier": "^8.5.0", | ||
"metatests": "^0.8.2", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.7.4" | ||
"prettier": "^2.8.1", | ||
"typescript": "^4.9.4" | ||
} | ||
} |
@@ -5,2 +5,3 @@ import { LogConfig, ScaleConfig, ServerConfig, SessionsConfig } from './config'; | ||
import * as _util from 'util'; | ||
import * as _buffer from 'buffer'; | ||
import * as _cp from 'child_process'; | ||
@@ -66,2 +67,3 @@ import * as _os from 'os'; | ||
const util: typeof _util; | ||
const buffer: typeof _buffer; | ||
const child_process: typeof _cp; | ||
@@ -68,0 +70,0 @@ const childProcess: typeof _cp; |
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
73433
1653
Updatedmetacom@^3.0.0-alpha.5
Updatedmetaconfiguration@^2.1.9
Updatedmetautil@^3.6.0
Updatedmetavm@^1.2.2
Updatedmetawatch@^1.0.7