@power-plant/schema 0.0.28 → 0.0.29
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/dist/index.cjs +8 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.mjs +8 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ let _stryke_hash = require("@stryke/hash");
|
|
|
12
12
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
13
13
|
let _stryke_json = require("@stryke/json");
|
|
14
14
|
let _stryke_path_find = require("@stryke/path/find");
|
|
15
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
15
16
|
let _stryke_resolve_constants = require("@stryke/resolve/constants");
|
|
16
17
|
let _stryke_resolve_load = require("@stryke/resolve/load");
|
|
17
18
|
let _stryke_string_format_list = require("@stryke/string-format/list");
|
|
@@ -561,6 +562,7 @@ async function extractTSType(input, options = {}) {
|
|
|
561
562
|
const exportName = fileReference.export ?? "*";
|
|
562
563
|
const resolvedPath = await (0, _stryke_fs_resolve.resolveSafe)(fileReference.file, { fs: options.fs });
|
|
563
564
|
const filePath = resolvedPath || fileReference.file;
|
|
565
|
+
const tsconfig = options.tsconfig ? (0, _stryke_path_replace.replacePath)(options.tsconfig, options.cwd || process.cwd()) : void 0;
|
|
564
566
|
try {
|
|
565
567
|
return (0, ts_json_schema_generator_dist_factory_generator_js.createGenerator)({
|
|
566
568
|
path: filePath,
|
|
@@ -570,8 +572,12 @@ async function extractTSType(input, options = {}) {
|
|
|
570
572
|
markdownDescription: true,
|
|
571
573
|
fullDescription: true,
|
|
572
574
|
skipTypeCheck: true,
|
|
573
|
-
tsProgram: createProgramFromFileSystem(filePath,
|
|
574
|
-
|
|
575
|
+
tsProgram: createProgramFromFileSystem(filePath, {
|
|
576
|
+
...options,
|
|
577
|
+
tsconfig
|
|
578
|
+
}),
|
|
579
|
+
...options,
|
|
580
|
+
tsconfig
|
|
575
581
|
}).createSchema(exportName);
|
|
576
582
|
} catch (error) {
|
|
577
583
|
throw new Error(`Failed to generate a JSON schema for "${fileReference.file}"${resolvedPath && resolvedPath !== fileReference.file ? ` (resolved: ${resolvedPath})` : ""} using the type "${exportName}". Error: ${error.message}`);
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAwGgB,yBACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBAqHc,6BACd,MAAM,YACN,UAAU,YACV;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAwGgB,yBACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBAqHc,6BACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBCkOc,iBAAiB,QAAQ,aAAa;;;;iBAgMtC,YACd,SAAS,qBACT,OAAO;;;;;;;iBAgDO,kBAAkB,kBAAkB;;;;;;;;iBAoCpC,uBACd,OAAO,qBACN;;;;;;;iBA0Ba,eAAe,OAAO,eAAe;;;;;;;;;iBAsB/B,cACpB,OAAO,oBACP,UAAU,sBACT,QAAQ;;;;;;;;;iBAmCK,cACd,SAAS,qBACT,OAAO,qBACN;;;;;;;;iBA6CmB,cACpB,OAAO,oBACP,UAAS,wBAAwB;EAC/B;EACA;IAED,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmFW,wBAAwB,aAC5C,OAAO,cACP,UAAS,2BAA2B,SACnC,QAAQ,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0Ib,QAAQ,aAC5B,OAAO,aAAa,QACpB,UAAS,2BAA2B,SAC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ist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { murmurhash } from "@stryke/hash";
|
|
|
10
10
|
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
11
11
|
import { isStandardJsonSchema } from "@stryke/json";
|
|
12
12
|
import { findFileExtensionSafe, findFilePath } from "@stryke/path/find";
|
|
13
|
+
import { replacePath } from "@stryke/path/replace";
|
|
13
14
|
import { VALID_OBJECT_SOURCE_EXTENSIONS } from "@stryke/resolve/constants";
|
|
14
15
|
import { loadSafe } from "@stryke/resolve/load";
|
|
15
16
|
import { list } from "@stryke/string-format/list";
|
|
@@ -558,6 +559,7 @@ async function extractTSType(input, options = {}) {
|
|
|
558
559
|
const exportName = fileReference.export ?? "*";
|
|
559
560
|
const resolvedPath = await resolveSafe(fileReference.file, { fs: options.fs });
|
|
560
561
|
const filePath = resolvedPath || fileReference.file;
|
|
562
|
+
const tsconfig = options.tsconfig ? replacePath(options.tsconfig, options.cwd || process.cwd()) : void 0;
|
|
561
563
|
try {
|
|
562
564
|
return createGenerator({
|
|
563
565
|
path: filePath,
|
|
@@ -567,8 +569,12 @@ async function extractTSType(input, options = {}) {
|
|
|
567
569
|
markdownDescription: true,
|
|
568
570
|
fullDescription: true,
|
|
569
571
|
skipTypeCheck: true,
|
|
570
|
-
tsProgram: createProgramFromFileSystem(filePath,
|
|
571
|
-
|
|
572
|
+
tsProgram: createProgramFromFileSystem(filePath, {
|
|
573
|
+
...options,
|
|
574
|
+
tsconfig
|
|
575
|
+
}),
|
|
576
|
+
...options,
|
|
577
|
+
tsconfig
|
|
572
578
|
}).createSchema(exportName);
|
|
573
579
|
} catch (error) {
|
|
574
580
|
throw new Error(`Failed to generate a JSON schema for "${fileReference.file}"${resolvedPath && resolvedPath !== fileReference.file ? ` (resolved: ${resolvedPath})` : ""} using the type "${exportName}". Error: ${error.message}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Power Plant utility package to help managing schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
"untyped": "^1.5.2"
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
145
|
+
"@powerlines/plugin-tsdown": "^0.1.554",
|
|
146
146
|
"@types/node": "^25.9.5",
|
|
147
|
-
"powerlines": "^0.47.
|
|
147
|
+
"powerlines": "^0.47.153",
|
|
148
148
|
"valibot": "^1.4.2",
|
|
149
149
|
"zod": "^4.4.3"
|
|
150
150
|
},
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"zod": { "optional": true }
|
|
158
158
|
},
|
|
159
159
|
"publishConfig": { "access": "public" },
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "1f782a6d68196b61f197e9834bf476e1d77dde54"
|
|
161
161
|
}
|