@nattyjs/express 0.0.1-beta.33 → 0.0.1-beta.34

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/dist/index.cjs CHANGED
@@ -5,29 +5,12 @@ const cors = require('cors');
5
5
  const compression = require('compression');
6
6
  const core = require('@nattyjs/core');
7
7
  const common = require('@nattyjs/common');
8
- const chokidar = require('chokidar');
9
- const fs = require('fs');
10
- const path = require('path');
11
8
 
12
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
13
10
 
14
- function _interopNamespaceCompat(e) {
15
- if (e && typeof e === 'object' && 'default' in e) return e;
16
- const n = Object.create(null);
17
- if (e) {
18
- for (const k in e) {
19
- n[k] = e[k];
20
- }
21
- }
22
- n.default = e;
23
- return n;
24
- }
25
-
26
11
  const express__default = /*#__PURE__*/_interopDefaultCompat(express);
27
12
  const cors__default = /*#__PURE__*/_interopDefaultCompat(cors);
28
13
  const compression__default = /*#__PURE__*/_interopDefaultCompat(compression);
29
- const chokidar__default = /*#__PURE__*/_interopDefaultCompat(chokidar);
30
- const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
31
14
 
32
15
  async function getRequestBodyInfo(request) {
33
16
  const contentType = request.headers["content-type"];
@@ -96,27 +79,6 @@ function requestHandler(config) {
96
79
  };
97
80
  }
98
81
 
99
- function watchDirectoryPath() {
100
- const packageJson = fs.readFileSync("./package.json", "utf-8");
101
- const json = JSON.parse(packageJson);
102
- const directoryPath = path__namespace.dirname(json.main);
103
- return directoryPath;
104
- }
105
-
106
- function changeDetection(onAddOrChange) {
107
- const watcher = chokidar__default.watch(watchDirectoryPath(), {
108
- ignored: (file, stats) => stats?.isFile() && !file.endsWith(".js"),
109
- ignoreInitial: true,
110
- awaitWriteFinish: {
111
- stabilityThreshold: 50,
112
- pollInterval: 10
113
- }
114
- });
115
- for (const type of ["add", "change"]) {
116
- watcher.on(type, async () => onAddOrChange());
117
- }
118
- }
119
-
120
82
  const app = express__default();
121
83
  const ExpressModule = {
122
84
  init(config) {
@@ -127,9 +89,8 @@ const ExpressModule = {
127
89
  app.all("*", requestHandler(config));
128
90
  if (config.autoGeneratePort == true || config.autoGeneratePort == void 0)
129
91
  common.getPort().then((port) => {
130
- const server = app.listen(port, () => {
92
+ app.listen(port, () => {
131
93
  console.log(`[NATTYJS]:Server is running on port ${port}`);
132
- changeDetection(() => server.close());
133
94
  });
134
95
  });
135
96
  return app;
package/dist/index.mjs CHANGED
@@ -3,9 +3,6 @@ import cors from 'cors';
3
3
  import compression from 'compression';
4
4
  import { HttpHandler, HttpContext } from '@nattyjs/core';
5
5
  import { GET, FrameworkType, getPort } from '@nattyjs/common';
6
- import chokidar from 'chokidar';
7
- import { readFileSync } from 'fs';
8
- import * as path from 'path';
9
6
 
10
7
  async function getRequestBodyInfo(request) {
11
8
  const contentType = request.headers["content-type"];
@@ -74,27 +71,6 @@ function requestHandler(config) {
74
71
  };
75
72
  }
76
73
 
77
- function watchDirectoryPath() {
78
- const packageJson = readFileSync("./package.json", "utf-8");
79
- const json = JSON.parse(packageJson);
80
- const directoryPath = path.dirname(json.main);
81
- return directoryPath;
82
- }
83
-
84
- function changeDetection(onAddOrChange) {
85
- const watcher = chokidar.watch(watchDirectoryPath(), {
86
- ignored: (file, stats) => stats?.isFile() && !file.endsWith(".js"),
87
- ignoreInitial: true,
88
- awaitWriteFinish: {
89
- stabilityThreshold: 50,
90
- pollInterval: 10
91
- }
92
- });
93
- for (const type of ["add", "change"]) {
94
- watcher.on(type, async () => onAddOrChange());
95
- }
96
- }
97
-
98
74
  const app = express();
99
75
  const ExpressModule = {
100
76
  init(config) {
@@ -105,9 +81,8 @@ const ExpressModule = {
105
81
  app.all("*", requestHandler(config));
106
82
  if (config.autoGeneratePort == true || config.autoGeneratePort == void 0)
107
83
  getPort().then((port) => {
108
- const server = app.listen(port, () => {
84
+ app.listen(port, () => {
109
85
  console.log(`[NATTYJS]:Server is running on port ${port}`);
110
- changeDetection(() => server.close());
111
86
  });
112
87
  });
113
88
  return app;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattyjs/express",
3
- "version": "0.0.1-beta.33",
3
+ "version": "0.0.1-beta.34",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "ajayojha <ojhaajay@outlook.com>",
@@ -19,9 +19,9 @@
19
19
  "chokidar": "4.0.3",
20
20
  "cors": "2.8.5",
21
21
  "compression": "1.7.4",
22
- "@nattyjs/core": "0.0.1-beta.33",
23
- "@nattyjs/common": "0.0.1-beta.33",
24
- "@nattyjs/types": "0.0.1-beta.33"
22
+ "@nattyjs/core": "0.0.1-beta.34",
23
+ "@nattyjs/common": "0.0.1-beta.34",
24
+ "@nattyjs/types": "0.0.1-beta.34"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "20.3.1",