luak-express 2.1.2 → 2.1.3
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 +3 -3
- package/bin/luak +1 -1
- package/package.json +1 -1
- package/src/Foundation/Application.js +28 -1
- package/src/Support/helpers.js +10 -4
- package/storage/logs/luak.log +3 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Luak Express Framework v2.1.
|
|
1
|
+
# Luak Express Framework v2.1.3 🚀
|
|
2
2
|
|
|
3
3
|
**Luak Express** adalah framework Node.js premium berbasis Express yang dirancang untuk memberikan pengalaman pengembangan (Developer Experience) sekelas Laravel. Dengan fokus pada keindahan desain, kemudahan penggunaan, dan struktur yang solid.
|
|
4
4
|
|
|
5
|
-
## ✨ Fitur Utama (v2.1.
|
|
5
|
+
## ✨ Fitur Utama (v2.1.3)
|
|
6
6
|
|
|
7
7
|
* **Premium Debugging (`dd` & `d`)**: Fungsi "Dump and Die" dengan tampilan HTML mewah, tipografi IBM Plex, dan isolasi konteks menggunakan `AsyncLocalStorage`.
|
|
8
8
|
* **Encapsulated Core Handling**: Exception handler dan view error default (500, 404) kini terisolasi di dalam core framework untuk keamanan maksimal.
|
|
@@ -71,7 +71,7 @@ d('Ini hanyalah log premium');
|
|
|
71
71
|
└── package.json
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
## ⬆️ Update v2.1.
|
|
74
|
+
## ⬆️ Update v2.1.3
|
|
75
75
|
* CLI Auto-Scaffolding: Script `dev` dan `test` otomatis ditambahkan saat `init`.
|
|
76
76
|
* Centralized Versioning di `Application.js`.
|
|
77
77
|
* Pemindahan Error Handler ke `src/Foundation/Exceptions/Handler.js`.
|
package/bin/luak
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,13 @@ const Config = require('./Config');
|
|
|
4
4
|
const Router = require('../Routing/Router');
|
|
5
5
|
|
|
6
6
|
class Application {
|
|
7
|
+
/**
|
|
8
|
+
* The static instance of the application.
|
|
9
|
+
*
|
|
10
|
+
* @type {Application}
|
|
11
|
+
*/
|
|
12
|
+
static instance;
|
|
13
|
+
|
|
7
14
|
/**
|
|
8
15
|
* Create a new application instance.
|
|
9
16
|
*
|
|
@@ -11,12 +18,14 @@ class Application {
|
|
|
11
18
|
*/
|
|
12
19
|
constructor(basePath) {
|
|
13
20
|
this.basePath = basePath;
|
|
14
|
-
this.VERSION = '2.1.
|
|
21
|
+
this.VERSION = '2.1.3';
|
|
15
22
|
this.bindings = new Map();
|
|
16
23
|
this.instances = new Map();
|
|
17
24
|
this.providers = [];
|
|
18
25
|
this.booted = false;
|
|
19
26
|
|
|
27
|
+
Application.setInstance(this);
|
|
28
|
+
|
|
20
29
|
this.bind('app', this);
|
|
21
30
|
this.bind('config', new Config(this.configPath()), true);
|
|
22
31
|
this.bind('router', new Router(this), true);
|
|
@@ -28,6 +37,24 @@ class Application {
|
|
|
28
37
|
global.d = d;
|
|
29
38
|
}
|
|
30
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Set the static instance of the application.
|
|
42
|
+
*
|
|
43
|
+
* @param {Application} instance
|
|
44
|
+
*/
|
|
45
|
+
static setInstance(instance) {
|
|
46
|
+
Application.instance = instance;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the static instance of the application.
|
|
51
|
+
*
|
|
52
|
+
* @returns {Application}
|
|
53
|
+
*/
|
|
54
|
+
static getInstance() {
|
|
55
|
+
return Application.instance;
|
|
56
|
+
}
|
|
57
|
+
|
|
31
58
|
/**
|
|
32
59
|
* Register a binding with the container.
|
|
33
60
|
*
|
package/src/Support/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Application = require('../Foundation/Application');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the available container instance.
|
|
@@ -7,6 +7,12 @@ const appInstance = require('../../bootstrap/app');
|
|
|
7
7
|
* @return {object|any}
|
|
8
8
|
*/
|
|
9
9
|
global.app = (abstract = null) => {
|
|
10
|
+
const appInstance = Application.getInstance();
|
|
11
|
+
|
|
12
|
+
if (!appInstance) {
|
|
13
|
+
throw new Error('Application instance has not been initialized.');
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
if (!abstract) {
|
|
11
17
|
return appInstance;
|
|
12
18
|
}
|
|
@@ -21,7 +27,7 @@ global.app = (abstract = null) => {
|
|
|
21
27
|
* @return {string}
|
|
22
28
|
*/
|
|
23
29
|
global.app_path = (path = '') => {
|
|
24
|
-
return
|
|
30
|
+
return Application.getInstance().path('app' + (path ? '/' + path : ''));
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -31,7 +37,7 @@ global.app_path = (path = '') => {
|
|
|
31
37
|
* @return {string}
|
|
32
38
|
*/
|
|
33
39
|
global.config_path = (path = '') => {
|
|
34
|
-
return
|
|
40
|
+
return Application.getInstance().path('config' + (path ? '/' + path : ''));
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -41,7 +47,7 @@ global.config_path = (path = '') => {
|
|
|
41
47
|
* @return {string}
|
|
42
48
|
*/
|
|
43
49
|
global.base_path = (path = '') => {
|
|
44
|
-
return
|
|
50
|
+
return Application.getInstance().path(path);
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
/**
|
package/storage/logs/luak.log
CHANGED