@warlock.js/core 3.0.4 → 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 -5
- package/cjs/builder/config-types-generator.js.map +1 -1
- package/cjs/config/typed-config.d.ts +1 -1
- package/cjs/config/typed-config.d.ts.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 -6
- package/esm/builder/config-types-generator.js.map +1 -1
- package/esm/config/typed-config.d.ts +1 -1
- package/esm/config/typed-config.d.ts.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" {
|
|
@@ -45,12 +65,11 @@ ${configKeys.map(key => ` ${key}: true;`).join("\n")}
|
|
|
45
65
|
interface ConfigTypeMap extends UserConfigTypeMap {}
|
|
46
66
|
}
|
|
47
67
|
`;
|
|
48
|
-
// Ensure .warlock directory exists
|
|
49
|
-
await fs.ensureDirectoryAsync(paths.warlockPath());
|
|
50
68
|
// Write type augmentation file
|
|
51
69
|
const outputPath = paths.warlockPath("config-augmentation.d.ts");
|
|
52
70
|
await fs.putFileAsync(outputPath, typeDefinition);
|
|
53
|
-
|
|
71
|
+
// Check if tsconfig.json includes .warlock/**/*.d.ts
|
|
72
|
+
await checkTsConfigIncludes();
|
|
54
73
|
return configKeys;
|
|
55
74
|
}
|
|
56
75
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-generator.js","sources":["../../src/builder/config-types-generator.ts"],"sourcesContent":[null],"names":["rootPath","
|
|
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,qBAAqB,GAAA;IAClC,IAAI;AACF,QAAA,MAAM,YAAY,GAAGA,cAAQ,CAAC,eAAe,CAAC,CAAC;AAC/C,QAAA,MAAM,eAAe,GAAG,MAAMC,eAAY,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,GAAGD,cAAQ,CAAC,YAAY,CAAC,CAAC;AACzC,QAAA,MAAM,WAAW,GAAG,MAAME,cAAS,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,GAAGC,qBAAI,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,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"}
|
|
@@ -7,7 +7,7 @@ export interface ConfigKeysRegistry {
|
|
|
7
7
|
/**
|
|
8
8
|
* Config keys type - derived from registry or fallback to string
|
|
9
9
|
*/
|
|
10
|
-
export type ConfigKeys = keyof ConfigKeysRegistry extends never ? string : keyof ConfigKeysRegistry;
|
|
10
|
+
export type ConfigKeys = [keyof ConfigKeysRegistry] extends [never] ? string : keyof ConfigKeysRegistry;
|
|
11
11
|
/**
|
|
12
12
|
* Config type mapping interface
|
|
13
13
|
* Users can augment this to add return types for specific config keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-config.d.ts","sourceRoot":"","sources":["../../src/config/typed-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;CAElC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,kBAAkB,SAAS,KAAK,
|
|
1
|
+
{"version":3,"file":"typed-config.d.ts","sourceRoot":"","sources":["../../src/config/typed-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;CAElC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,GAC/D,MAAM,GACN,MAAM,kBAAkB,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;CAE7B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM;iDAGA,GAAG;6CAKqB,GAAG,GAAG,IAAI;aAI1C,UAAU,GAAG,OAAO;WAKtB,OAAO,MAAM,EAAE,GAAG,CAAC;CAI3B,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -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 {
|
|
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" {
|
|
@@ -45,12 +65,11 @@ ${configKeys.map(key => ` ${key}: true;`).join("\n")}
|
|
|
45
65
|
interface ConfigTypeMap extends UserConfigTypeMap {}
|
|
46
66
|
}
|
|
47
67
|
`;
|
|
48
|
-
// Ensure .warlock directory exists
|
|
49
|
-
await ensureDirectoryAsync(warlockPath());
|
|
50
68
|
// Write type augmentation file
|
|
51
69
|
const outputPath = warlockPath("config-augmentation.d.ts");
|
|
52
70
|
await putFileAsync(outputPath, typeDefinition);
|
|
53
|
-
|
|
71
|
+
// Check if tsconfig.json includes .warlock/**/*.d.ts
|
|
72
|
+
await checkTsConfigIncludes();
|
|
54
73
|
return configKeys;
|
|
55
74
|
}
|
|
56
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"}
|
|
@@ -7,7 +7,7 @@ export interface ConfigKeysRegistry {
|
|
|
7
7
|
/**
|
|
8
8
|
* Config keys type - derived from registry or fallback to string
|
|
9
9
|
*/
|
|
10
|
-
export type ConfigKeys = keyof ConfigKeysRegistry extends never ? string : keyof ConfigKeysRegistry;
|
|
10
|
+
export type ConfigKeys = [keyof ConfigKeysRegistry] extends [never] ? string : keyof ConfigKeysRegistry;
|
|
11
11
|
/**
|
|
12
12
|
* Config type mapping interface
|
|
13
13
|
* Users can augment this to add return types for specific config keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-config.d.ts","sourceRoot":"","sources":["../../src/config/typed-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;CAElC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,kBAAkB,SAAS,KAAK,
|
|
1
|
+
{"version":3,"file":"typed-config.d.ts","sourceRoot":"","sources":["../../src/config/typed-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;CAElC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,GAC/D,MAAM,GACN,MAAM,kBAAkB,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;CAE7B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM;iDAGA,GAAG;6CAKqB,GAAG,GAAG,IAAI;aAI1C,UAAU,GAAG,OAAO;WAKtB,OAAO,MAAM,EAAE,GAAG,CAAC;CAI3B,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
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",
|