luak-express 2.1.0 → 2.1.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Luak Express Framework v2.0.0 🚀
1
+ # Luak Express Framework v2.1.1 🚀
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.0.0)
5
+ ## ✨ Fitur Utama (v2.1.1)
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,8 @@ d('Ini hanyalah log premium');
71
71
  └── package.json
72
72
  ```
73
73
 
74
- ## ⬆️ Update v2.0.0
74
+ ## ⬆️ Update v2.1.1
75
+ * CLI Auto-Scaffolding: Script `dev` dan `test` otomatis ditambahkan saat `init`.
75
76
  * Centralized Versioning di `Application.js`.
76
77
  * Pemindahan Error Handler ke `src/Foundation/Exceptions/Handler.js`.
77
78
  * Premium UI overhaul untuk halaman 404 dan 500.
package/bin/luak CHANGED
@@ -50,14 +50,11 @@ function initProject() {
50
50
  const src = path.join(packageDir, file);
51
51
  const dest = path.join(targetDir, file);
52
52
 
53
- // Handle .gitignore specifically if needed to avoid npm publishing issues
54
- // For now direct copy
55
53
  if (fs.existsSync(src)) {
56
- fs.copyFileSync(src, dest);
54
+ copyFile(src, dest);
57
55
  console.log(`Created: ${file}`);
58
56
  } else if (file === '.env.example' && fs.existsSync(path.join(packageDir, '.env'))) {
59
- // Fallback to .env if .env.example doesn't exist in source but we want to provide one
60
- fs.copyFileSync(path.join(packageDir, '.env'), dest);
57
+ copyFile(path.join(packageDir, '.env'), dest);
61
58
  console.log(`Created: ${file}`);
62
59
  }
63
60
  });
@@ -124,7 +121,43 @@ function copyRecursiveSync(src, dest) {
124
121
  fs.readdirSync(src).forEach(childItemName => {
125
122
  copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
126
123
  });
124
+ } else {
125
+ copyFile(src, dest);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Copy a file and apply transformation if it's a text file
131
+ */
132
+ function copyFile(src, dest) {
133
+ const extension = path.extname(src);
134
+ const basename = path.basename(src);
135
+ const textFiles = ['.js', '.ejs', '.json', '.example', '.md', '.log'];
136
+
137
+ // Check if it's a text file or a hidden config file (like .env)
138
+ if (textFiles.includes(extension) || basename.startsWith('.')) {
139
+ let content = fs.readFileSync(src, 'utf8');
140
+ content = transformContent(content);
141
+ fs.writeFileSync(dest, content);
127
142
  } else {
128
143
  fs.copyFileSync(src, dest);
129
144
  }
130
145
  }
146
+
147
+ /**
148
+ * Transform template content to use package name instead of relative paths
149
+ */
150
+ function transformContent(content) {
151
+ // 1. Replace relative src/index imports with the package name
152
+ // Matches: require('./src/index'), require('../src/index'), etc.
153
+ content = content.replace(/require\(['"](\.\/|\.\.\/)+src\/index(\.js)?['"]\)/g, "require('luak-express')");
154
+
155
+ // 2. Replace other relative src imports with package-based src paths
156
+ // Matches: require('./src/Support/helpers') -> require('luak-express/src/Support/helpers')
157
+ content = content.replace(/require\(['"](\.\/|\.\.\/)+src\/(.*?)['"]\)/g, "require('luak-express/src/$2')");
158
+
159
+ // 3. Handle JSDoc imports or other text-based references
160
+ content = content.replace(/import\(['"](\.\/|\.\.\/)+src\/(.*?)['"]\)/g, "import('luak-express/src/$2')");
161
+
162
+ return content;
163
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luak-express",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Premium Node.js Framework based on Express with Laravel-like features and elegant debugging.",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -11,7 +11,7 @@ class Application {
11
11
  */
12
12
  constructor(basePath) {
13
13
  this.basePath = basePath;
14
- this.VERSION = '2.1.0';
14
+ this.VERSION = '2.1.2';
15
15
  this.bindings = new Map();
16
16
  this.instances = new Map();
17
17
  this.providers = [];