owebjs 1.4.0 → 1.4.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.
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
__name
|
|
3
3
|
} from "../chunk-SHUYVCID.js";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { dirname } from "node:path";
|
|
6
5
|
import { fileURLToPath } from "node:url";
|
|
7
6
|
import { buildRoutePath, buildRouteURL } from './utils.js';
|
|
8
7
|
import { walk } from './walk.js';
|
|
@@ -10,7 +9,7 @@ import { success, warn } from './logger.js';
|
|
|
10
9
|
import { match } from "path-to-regexp";
|
|
11
10
|
import generateFunctionFromTypescript from './generateFunctionFromTypescript.js';
|
|
12
11
|
import { readdirSync } from "node:fs";
|
|
13
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
13
|
let matcherOverrides = {};
|
|
15
14
|
let routeFunctions = {
|
|
16
15
|
get: {},
|
|
@@ -244,7 +243,10 @@ function assignSpecificRoute(oweb, route) {
|
|
|
244
243
|
}
|
|
245
244
|
__name(assignSpecificRoute, "assignSpecificRoute");
|
|
246
245
|
async function loadMatchers(directoryPath) {
|
|
247
|
-
const files = readdirSync(directoryPath)
|
|
246
|
+
const files = readdirSync(directoryPath).filter((f) => [
|
|
247
|
+
".js",
|
|
248
|
+
".ts"
|
|
249
|
+
].includes(path.extname(f)));
|
|
248
250
|
for (const file of files) {
|
|
249
251
|
const filePath = path.join(directoryPath, file).replaceAll("\\", "/");
|
|
250
252
|
const fileName = path.basename(filePath);
|
|
@@ -91,6 +91,9 @@ async function generateFunctionFromTypescript(tsCode, filePath) {
|
|
|
91
91
|
resolvedPathForDist = resolvedPathForDist.substring("src".length + 1);
|
|
92
92
|
}
|
|
93
93
|
let jsPath = resolvedPathForDist.replace(/\.(ts|js|mts|cts)$/, ".js");
|
|
94
|
+
if (!jsPath.endsWith(".js")) {
|
|
95
|
+
jsPath = jsPath + ".js";
|
|
96
|
+
}
|
|
94
97
|
if (jsPath.startsWith("dist")) {
|
|
95
98
|
jsPath = jsPath.slice("dist".length + 1);
|
|
96
99
|
}
|
package/dist/utils/walk.js
CHANGED
package/dist/utils/watcher.js
CHANGED
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
__name
|
|
3
3
|
} from "../chunk-SHUYVCID.js";
|
|
4
4
|
import chokidar from "chokidar";
|
|
5
|
-
import { readFileSync } from "fs";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { extname } from "node:path";
|
|
6
7
|
function watchDirectory(dir, ignoreInitial = true, onUpdate) {
|
|
7
8
|
const watcher = chokidar.watch(dir, {
|
|
8
9
|
ignored: /([/\\]\.)|(node_modules)|(dist)/,
|
|
@@ -14,15 +15,22 @@ function watchDirectory(dir, ignoreInitial = true, onUpdate) {
|
|
|
14
15
|
},
|
|
15
16
|
usePolling: true
|
|
16
17
|
});
|
|
18
|
+
const supportedExtensions = [
|
|
19
|
+
".js",
|
|
20
|
+
".ts"
|
|
21
|
+
];
|
|
17
22
|
watcher.on("add", async (filePath) => {
|
|
23
|
+
if (!supportedExtensions.includes(extname(filePath))) return;
|
|
18
24
|
const content = readFileSync(filePath, "utf-8");
|
|
19
25
|
onUpdate("new-file", filePath, content);
|
|
20
26
|
});
|
|
21
27
|
watcher.on("change", async (filePath) => {
|
|
28
|
+
if (!supportedExtensions.includes(extname(filePath))) return;
|
|
22
29
|
const content = readFileSync(filePath, "utf-8");
|
|
23
30
|
onUpdate("modify-file", filePath, content);
|
|
24
31
|
});
|
|
25
32
|
watcher.on("unlink", (filePath) => {
|
|
33
|
+
if (!supportedExtensions.includes(extname(filePath))) return;
|
|
26
34
|
onUpdate("delete-file", filePath, "");
|
|
27
35
|
});
|
|
28
36
|
}
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "owebjs",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "A flexible and modern web framework built on top of Fastify",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./dist/index.js",
|
|
10
|
-
"default": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
12
|
-
},
|
|
13
|
-
"./dist/plugins": {
|
|
14
|
-
"import": "./dist/plugins/index.js",
|
|
15
|
-
"default": "./dist/plugins/index.js",
|
|
16
|
-
"types": "./dist/plugins/index.d.ts"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"start": "node .",
|
|
21
|
-
"build": "tsup && node scripts/copyBinaries",
|
|
22
|
-
"dev": "tsup && node .",
|
|
23
|
-
"test": "tsup && node scripts/copyBinaries && node test/index.js",
|
|
24
|
-
"format": "prettier --write . --ignore-path .gitignore"
|
|
25
|
-
},
|
|
26
|
-
"homepage": "https://github.com/owebjs/oweb",
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "https://github.com/owebjs/oweb"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [],
|
|
32
|
-
"author": "owebjs",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@babel/core": "^7.28.0",
|
|
36
|
-
"@babel/generator": "^7.28.0",
|
|
37
|
-
"@babel/parser": "^7.28.0",
|
|
38
|
-
"@babel/preset-typescript": "^7.27.1",
|
|
39
|
-
"@babel/traverse": "^7.28.0",
|
|
40
|
-
"@babel/types": "^7.28.2",
|
|
41
|
-
"chalk": "^5.4.1",
|
|
42
|
-
"fastify": "4.23.2",
|
|
43
|
-
"path-to-regexp": "^8.2.0"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@fastify/multipart": "^8.1.0",
|
|
47
|
-
"@swc/core": "^1.3.85",
|
|
48
|
-
"@types/chokidar": "^2.1.3",
|
|
49
|
-
"@types/node": "^24.1.0",
|
|
50
|
-
"chokidar": "^3.5.3",
|
|
51
|
-
"prettier": "^3.0.3",
|
|
52
|
-
"tslib": "^2.6.2",
|
|
53
|
-
"tsup": "^8.5.0",
|
|
54
|
-
"typescript": "^5.2.2",
|
|
55
|
-
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.10.0"
|
|
56
|
-
},
|
|
57
|
-
"type": "module",
|
|
58
|
-
"pnpm": {
|
|
59
|
-
"onlyBuiltDependencies": [
|
|
60
|
-
"esbuild"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "owebjs",
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"description": "A flexible and modern web framework built on top of Fastify",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"default": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./dist/plugins": {
|
|
14
|
+
"import": "./dist/plugins/index.js",
|
|
15
|
+
"default": "./dist/plugins/index.js",
|
|
16
|
+
"types": "./dist/plugins/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "node .",
|
|
21
|
+
"build": "tsup && node scripts/copyBinaries",
|
|
22
|
+
"dev": "tsup && node .",
|
|
23
|
+
"test": "tsup && node scripts/copyBinaries && node test/index.js",
|
|
24
|
+
"format": "prettier --write . --ignore-path .gitignore"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/owebjs/oweb",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/owebjs/oweb"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [],
|
|
32
|
+
"author": "owebjs",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@babel/core": "^7.28.0",
|
|
36
|
+
"@babel/generator": "^7.28.0",
|
|
37
|
+
"@babel/parser": "^7.28.0",
|
|
38
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
39
|
+
"@babel/traverse": "^7.28.0",
|
|
40
|
+
"@babel/types": "^7.28.2",
|
|
41
|
+
"chalk": "^5.4.1",
|
|
42
|
+
"fastify": "4.23.2",
|
|
43
|
+
"path-to-regexp": "^8.2.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@fastify/multipart": "^8.1.0",
|
|
47
|
+
"@swc/core": "^1.3.85",
|
|
48
|
+
"@types/chokidar": "^2.1.3",
|
|
49
|
+
"@types/node": "^24.1.0",
|
|
50
|
+
"chokidar": "^3.5.3",
|
|
51
|
+
"prettier": "^3.0.3",
|
|
52
|
+
"tslib": "^2.6.2",
|
|
53
|
+
"tsup": "^8.5.0",
|
|
54
|
+
"typescript": "^5.2.2",
|
|
55
|
+
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.10.0"
|
|
56
|
+
},
|
|
57
|
+
"type": "module",
|
|
58
|
+
"pnpm": {
|
|
59
|
+
"onlyBuiltDependencies": [
|
|
60
|
+
"esbuild"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|