@zenofolio/hyper-decor 1.0.74 → 1.0.75
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/README.md +1 -1
- package/dist/common/bootstrap.js +6 -1
- package/dist/lib/server/decorators/HyperController.js +2 -14
- package/package.json +2 -1
- package/scripts/clean.js +1 -1
- package/vitest.config.mjs +30 -31
package/README.md
CHANGED
package/dist/common/bootstrap.js
CHANGED
|
@@ -27,7 +27,12 @@ function createApplication(application) {
|
|
|
27
27
|
throw new Error("Application must be decorated with @HyperApp");
|
|
28
28
|
}
|
|
29
29
|
const logger = metadata.logger || console.log;
|
|
30
|
-
const logWrapper = (space, msg) =>
|
|
30
|
+
const logWrapper = (space, msg) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if ((_a = metadata.logs) === null || _a === void 0 ? void 0 : _a[space]) {
|
|
33
|
+
logger(`[${space.toUpperCase()}] ${msg}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
31
36
|
const appServer = yield (0, prepare_helper_1.prepareApplication)(metadata, application, logWrapper);
|
|
32
37
|
const appInstance = tsyringe_1.container.resolve(application);
|
|
33
38
|
const appProxy = new Proxy(appInstance, {
|
|
@@ -8,20 +8,8 @@ const metadata_1 = require("./metadata");
|
|
|
8
8
|
*/
|
|
9
9
|
function HyperController(options) {
|
|
10
10
|
return (Target) => {
|
|
11
|
-
var _a;
|
|
12
11
|
const isString = typeof options === "string";
|
|
13
|
-
const data = {
|
|
14
|
-
|
|
15
|
-
path: isString ? options : (_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : "/",
|
|
16
|
-
};
|
|
17
|
-
if (!isString && options) {
|
|
18
|
-
if (options.roles)
|
|
19
|
-
data.roles = options.roles;
|
|
20
|
-
if (options.scopes)
|
|
21
|
-
data.scopes = options.scopes;
|
|
22
|
-
if (options.imports)
|
|
23
|
-
data.imports = options.imports;
|
|
24
|
-
}
|
|
25
|
-
metadata_1.HyperMeta.set(Target, undefined, data);
|
|
12
|
+
const data = isString ? { path: options } : (options !== null && options !== void 0 ? options : {});
|
|
13
|
+
metadata_1.HyperMeta.set(Target, undefined, Object.assign({ type: "controller" }, data));
|
|
26
14
|
};
|
|
27
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenofolio/hyper-decor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"description": "Project core with utilities and features",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "zenozaga",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"vitest": "^4.0.18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@zenofolio/hyper-decor": "file:",
|
|
36
37
|
"core-decorators": "^0.20.0",
|
|
37
38
|
"eventemitter3": "^5.0.4",
|
|
38
39
|
"file-type": "^19.5.0",
|
package/scripts/clean.js
CHANGED
package/vitest.config.mjs
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import swc from 'unplugin-swc';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
globals: true,
|
|
7
|
-
environment: 'node',
|
|
8
|
-
include: ['tests/**/*.{test,spec}.ts'],
|
|
9
|
-
poolOptions: {
|
|
10
|
-
threads: {
|
|
11
|
-
singleThread: true,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import swc from 'unplugin-swc';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
globals: true,
|
|
7
|
+
environment: 'node',
|
|
8
|
+
include: ['tests/**/*.{test,spec}.ts'],
|
|
9
|
+
poolOptions: {
|
|
10
|
+
threads: {
|
|
11
|
+
singleThread: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
swc.vite({
|
|
17
|
+
jsc: {
|
|
18
|
+
parser: {
|
|
19
|
+
syntax: 'typescript',
|
|
20
|
+
decorators: true,
|
|
21
|
+
dynamicImport: true,
|
|
22
|
+
},
|
|
23
|
+
transform: {
|
|
24
|
+
legacyDecorator: true,
|
|
25
|
+
decoratorMetadata: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
});
|