@warlock.js/core 3.0.5 → 3.0.6
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/cjs/builder/config-types-generator.d.ts +0 -4
- package/cjs/builder/config-types-generator.d.ts.map +1 -1
- package/cjs/builder/config-types-generator.js +24 -2
- package/cjs/builder/config-types-generator.js.map +1 -1
- package/esm/builder/config-types-generator.d.ts +0 -4
- package/esm/builder/config-types-generator.d.ts.map +1 -1
- package/esm/builder/config-types-generator.js +25 -3
- package/esm/builder/config-types-generator.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-generator.d.ts","sourceRoot":"","sources":["../../src/builder/config-types-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-types-generator.d.ts","sourceRoot":"","sources":["../../src/builder/config-types-generator.ts"],"names":[],"mappings":"AAmCA,wBAAsB,mBAAmB,sBA8DxC"}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
'use strict';var fs=require('@mongez/fs'),path=require('path'),glob=require('../utils/glob.js'),paths=require('../utils/paths.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var path__default=/*#__PURE__*/_interopDefault(path);/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Check if tsconfig.json includes .warlock types
|
|
3
|
+
* If not, log a warning to help the user
|
|
4
4
|
*/
|
|
5
|
+
async function checkTsConfigIncludes() {
|
|
6
|
+
try {
|
|
7
|
+
const tsconfigPath = paths.rootPath("tsconfig.json");
|
|
8
|
+
const tsconfigContent = await fs.getFileAsync(tsconfigPath);
|
|
9
|
+
if (!tsconfigContent)
|
|
10
|
+
return;
|
|
11
|
+
// Check if .warlock types are in the include array
|
|
12
|
+
const warlockPattern = ".warlock/**/*.d.ts";
|
|
13
|
+
const hasWarlockTypes = tsconfigContent.includes(`"${warlockPattern}"`) ||
|
|
14
|
+
tsconfigContent.includes(`'${warlockPattern}'`);
|
|
15
|
+
if (!hasWarlockTypes) {
|
|
16
|
+
console.warn(`⚠️ [config types] Add "${warlockPattern}" to tsconfig.json "include" array for config autocomplete`);
|
|
17
|
+
console.info(`ℹ️ [config types] Example: "include": ["src", "${warlockPattern}"]`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Silently fail - tsconfig.json might not exist or be malformed
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
async function generateConfigTypes() {
|
|
6
25
|
try {
|
|
7
26
|
// Find all config files in src/config/
|
|
@@ -27,6 +46,7 @@ async function generateConfigTypes() {
|
|
|
27
46
|
* Type mappings are defined in src/config/config-types.ts (you can edit that file!)
|
|
28
47
|
*/
|
|
29
48
|
|
|
49
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
30
50
|
import type { ConfigTypeMap as UserConfigTypeMap } from "../src/config/config-types";
|
|
31
51
|
|
|
32
52
|
declare module "@warlock.js/core" {
|
|
@@ -48,6 +68,8 @@ ${configKeys.map(key => ` ${key}: true;`).join("\n")}
|
|
|
48
68
|
// Write type augmentation file
|
|
49
69
|
const outputPath = paths.warlockPath("config-augmentation.d.ts");
|
|
50
70
|
await fs.putFileAsync(outputPath, typeDefinition);
|
|
71
|
+
// Check if tsconfig.json includes .warlock/**/*.d.ts
|
|
72
|
+
await checkTsConfigIncludes();
|
|
51
73
|
return configKeys;
|
|
52
74
|
}
|
|
53
75
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-generator.js","sources":["../../src/builder/config-types-generator.ts"],"sourcesContent":[null],"names":["rootPath","globFiles","path","warlockPath","putFileAsync"],"mappings":"yPAKA;;;AAGG;
|
|
1
|
+
{"version":3,"file":"config-types-generator.js","sources":["../../src/builder/config-types-generator.ts"],"sourcesContent":[null],"names":["rootPath","getFileAsync","globFiles","path","warlockPath","putFileAsync"],"mappings":"yPAKA;;;AAGG;AACH,eAAe,qBAA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AAc,CAAC;aACxD,IAAI,EAAE,CAAC;;AAGV,QAAA,MAAM,cAAc,GAAG,CAAA;;;;;;;;;;;;;;;;;AAiBzB,EAAA,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAO,IAAA,EAAA,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;;;;;;;;CAStD,CAAC;;AAGE,QAAA,MAAM,UAAU,GAAGC,iBAAW,CAAC,0BAA0B,CAAC,CAAC;AAC3D,QAAA,MAAMC,eAAY,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;;QAG/C,MAAM,qBAAqB,EAAE,CAAC;AAE9B,QAAA,OAAO,UAAU,CAAC;AACnB,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,CACV,qCAAqC,EACrC,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;AACF,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-generator.d.ts","sourceRoot":"","sources":["../../src/builder/config-types-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-types-generator.d.ts","sourceRoot":"","sources":["../../src/builder/config-types-generator.ts"],"names":[],"mappings":"AAmCA,wBAAsB,mBAAmB,sBA8DxC"}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import {putFileAsync}from'@mongez/fs';import path from'path';import {globFiles}from'../utils/glob.js';import {rootPath,warlockPath}from'../utils/paths.js';/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
import {putFileAsync,getFileAsync}from'@mongez/fs';import path from'path';import {globFiles}from'../utils/glob.js';import {rootPath,warlockPath}from'../utils/paths.js';/**
|
|
2
|
+
* Check if tsconfig.json includes .warlock types
|
|
3
|
+
* If not, log a warning to help the user
|
|
4
4
|
*/
|
|
5
|
+
async function checkTsConfigIncludes() {
|
|
6
|
+
try {
|
|
7
|
+
const tsconfigPath = rootPath("tsconfig.json");
|
|
8
|
+
const tsconfigContent = await getFileAsync(tsconfigPath);
|
|
9
|
+
if (!tsconfigContent)
|
|
10
|
+
return;
|
|
11
|
+
// Check if .warlock types are in the include array
|
|
12
|
+
const warlockPattern = ".warlock/**/*.d.ts";
|
|
13
|
+
const hasWarlockTypes = tsconfigContent.includes(`"${warlockPattern}"`) ||
|
|
14
|
+
tsconfigContent.includes(`'${warlockPattern}'`);
|
|
15
|
+
if (!hasWarlockTypes) {
|
|
16
|
+
console.warn(`⚠️ [config types] Add "${warlockPattern}" to tsconfig.json "include" array for config autocomplete`);
|
|
17
|
+
console.info(`ℹ️ [config types] Example: "include": ["src", "${warlockPattern}"]`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Silently fail - tsconfig.json might not exist or be malformed
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
async function generateConfigTypes() {
|
|
6
25
|
try {
|
|
7
26
|
// Find all config files in src/config/
|
|
@@ -27,6 +46,7 @@ async function generateConfigTypes() {
|
|
|
27
46
|
* Type mappings are defined in src/config/config-types.ts (you can edit that file!)
|
|
28
47
|
*/
|
|
29
48
|
|
|
49
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
30
50
|
import type { ConfigTypeMap as UserConfigTypeMap } from "../src/config/config-types";
|
|
31
51
|
|
|
32
52
|
declare module "@warlock.js/core" {
|
|
@@ -48,6 +68,8 @@ ${configKeys.map(key => ` ${key}: true;`).join("\n")}
|
|
|
48
68
|
// Write type augmentation file
|
|
49
69
|
const outputPath = warlockPath("config-augmentation.d.ts");
|
|
50
70
|
await putFileAsync(outputPath, typeDefinition);
|
|
71
|
+
// Check if tsconfig.json includes .warlock/**/*.d.ts
|
|
72
|
+
await checkTsConfigIncludes();
|
|
51
73
|
return configKeys;
|
|
52
74
|
}
|
|
53
75
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-generator.js","sources":["../../src/builder/config-types-generator.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-types-generator.js","sources":["../../src/builder/config-types-generator.ts"],"sourcesContent":[null],"names":[],"mappings":"wKAKA;;;AAGG;AACH,eAAe,qBAAqB,GAAA;IAClC,IAAI;AACF,QAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC/C,QAAA,MAAM,eAAe,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;AAEzD,QAAA,IAAI,CAAC,eAAe;YAAE,OAAO;;QAG7B,MAAM,cAAc,GAAG,oBAAoB,CAAC;QAC5C,MAAM,eAAe,GACnB,eAAe,CAAC,QAAQ,CAAC,CAAA,CAAA,EAAI,cAAc,CAAA,CAAA,CAAG,CAAC;AAC/C,YAAA,eAAe,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAA,CAAA,CAAG,CAAC,CAAC;QAElD,IAAI,CAAC,eAAe,EAAE;AACpB,YAAA,OAAO,CAAC,IAAI,CACV,2BAA2B,cAAc,CAAA,0DAAA,CAA4D,CACtG,CAAC;AACF,YAAA,OAAO,CAAC,IAAI,CACV,mDAAmD,cAAc,CAAA,EAAA,CAAI,CACtE,CAAC;AACH,SAAA;AACF,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;;AAEf,KAAA;AACH,CAAC;AAEM,eAAe,mBAAmB,GAAA;IACvC,IAAI;;AAEF,QAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AACzC,QAAA,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,SAAS,EAAE;AAC7C,YAAA,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AACnC,SAAA,CAAC,CAAC;;QAGH,MAAM,UAAU,GAAG,WAAW;aAC3B,GAAG,CAAC,QAAQ,IAAG;YACd,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;YAEzC,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChD,SAAC,CAAC;AACD,aAAA,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,cAAc,CAAC;aACxD,IAAI,EAAE,CAAC;;AAGV,QAAA,MAAM,cAAc,GAAG,CAAA;;;;;;;;;;;;;;;;;AAiBzB,EAAA,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAO,IAAA,EAAA,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;;;;;;;;CAStD,CAAC;;AAGE,QAAA,MAAM,UAAU,GAAG,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAC3D,QAAA,MAAM,YAAY,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;;QAG/C,MAAM,qBAAqB,EAAE,CAAC;AAE9B,QAAA,OAAO,UAAU,CAAC;AACnB,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,CACV,qCAAqC,EACrC,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;AACF,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warlock.js/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "A robust nodejs framework for building blazing fast applications",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@mongez/fs": "^3.0.5",
|
|
30
30
|
"@mongez/http": "^2.2.10",
|
|
31
31
|
"@mongez/localization": "^3.0.0",
|
|
32
|
-
"@warlock.js/logger": "3.0.
|
|
33
|
-
"@warlock.js/cascade": "3.0.
|
|
32
|
+
"@warlock.js/logger": "3.0.6",
|
|
33
|
+
"@warlock.js/cascade": "3.0.6",
|
|
34
34
|
"@mongez/reinforcements": "^2.3.10",
|
|
35
35
|
"commander": "^12.0.0",
|
|
36
36
|
"@mongez/slug": "^1.0.7",
|