@axah/next-utils
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -1,7 +0,8 @@ | ||
import { readFileSync } from 'fs'; | ||
import { createServer as createHttpServer } from 'node:http'; | ||
import { createServer as createHttpsServer } from 'node:https'; | ||
export default function createServer(_a, app) { | ||
var cert = _a.cert, key = _a.key; | ||
var ssl = null; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs_1 = require("fs"); | ||
const node_http_1 = require("node:http"); | ||
const node_https_1 = require("node:https"); | ||
function createServer({ cert, key }, app) { | ||
let ssl = null; | ||
// read SSL cert & key if available | ||
@@ -11,4 +12,4 @@ if (cert && key) { | ||
ssl = { | ||
cert: readFileSync(cert, 'utf8'), | ||
key: readFileSync(key, 'utf8'), | ||
cert: (0, fs_1.readFileSync)(cert, 'utf8'), | ||
key: (0, fs_1.readFileSync)(key, 'utf8'), | ||
}; | ||
@@ -23,3 +24,3 @@ } | ||
console.log('Creating HTTPS server.'); // eslint-disable-line no-console | ||
return createHttpsServer({ cert: ssl.cert, key: ssl.key }, app); | ||
return (0, node_https_1.createServer)({ cert: ssl.cert, key: ssl.key }, app); | ||
} | ||
@@ -29,3 +30,3 @@ catch (err) { | ||
console.log('Falling back to HTTP server.'); // eslint-disable-line no-console | ||
return createHttpServer(app); | ||
return (0, node_http_1.createServer)(app); | ||
} | ||
@@ -35,4 +36,5 @@ } | ||
console.log('Defaulting to HTTP server.'); // eslint-disable-line no-console | ||
return createHttpServer(app); | ||
return (0, node_http_1.createServer)(app); | ||
} | ||
exports.default = createServer; | ||
//# sourceMappingURL=create-server.js.map |
@@ -1,3 +0,9 @@ | ||
import _createServer from './create-server'; | ||
export { _createServer as createServer }; // eslint-disable-line import/prefer-default-export | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createServer = void 0; | ||
const create_server_1 = __importDefault(require("./create-server")); | ||
exports.createServer = create_server_1.default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@axah/next-utils", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"main": "lib/index.js", | ||
@@ -12,2 +12,3 @@ "license": "UNLICENSED", | ||
"@axah/eslint-config": "^2.2.0", | ||
"@axah/tsconfig": "^1.1.0", | ||
"@changesets/cli": "^2.26.2", | ||
@@ -14,0 +15,0 @@ "@types/node": "^20.5.7", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
55
4689
11
10