@stryke/capnp 0.12.80 → 0.12.82
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/bin/capnpc.cjs +74 -24
- package/bin/capnpc.d.cts +6 -0
- package/bin/capnpc.d.cts.map +1 -1
- package/bin/capnpc.d.mts +6 -0
- package/bin/capnpc.d.mts.map +1 -1
- package/bin/capnpc.mjs +75 -25
- package/bin/capnpc.mjs.map +1 -1
- package/dist/{compile-BU-HlLfU.cjs → compile-DI5-92za.cjs} +1 -1
- package/dist/{compile-CJ8KYCju.mjs → compile-OPOvCjdO.mjs} +2 -2
- package/dist/{compile-CJ8KYCju.mjs.map → compile-OPOvCjdO.mjs.map} +1 -1
- package/dist/compile.cjs +2 -2
- package/dist/compile.mjs +2 -2
- package/dist/{helpers-B7k70mjp.cjs → helpers-D3oxyKcQ.cjs} +37 -10
- package/dist/{helpers-DPPIVk-O.mjs → helpers-DN2tMgBs.mjs} +39 -12
- package/dist/{helpers-DPPIVk-O.mjs.map → helpers-DN2tMgBs.mjs.map} +1 -1
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/rpc-helpers.cjs +1 -1
- package/package.json +37 -36
- package/schemas/persistent.cjs +1 -1
- package/schemas/persistent.mjs +1 -1
- package/schemas/rpc-twoparty.cjs +1 -1
- package/schemas/rpc-twoparty.mjs +1 -1
- package/schemas/rpc.cjs +1 -1
- package/schemas/rpc.mjs +1 -1
- package/schemas/schema.cjs +1 -1
- package/schemas/schema.mjs +1 -1
- package/schemas/{src-BvgdYlCi.mjs → src-B-8ZXmr4.mjs} +2 -1
- package/schemas/{src-BvgdYlCi.mjs.map → src-B-8ZXmr4.mjs.map} +1 -1
- package/schemas/{src-C4qUIogl.cjs → src-DsF0a8FH.cjs} +1 -0
package/dist/compile.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('./helpers-
|
|
2
|
-
const require_compile = require('./compile-
|
|
1
|
+
require('./helpers-D3oxyKcQ.cjs');
|
|
2
|
+
const require_compile = require('./compile-DI5-92za.cjs');
|
|
3
3
|
|
|
4
4
|
exports.capnpc = require_compile.capnpc;
|
|
5
5
|
exports.compile = require_compile.compile;
|
package/dist/compile.mjs
CHANGED
|
@@ -28,12 +28,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
30
30
|
let typescript = require("typescript");
|
|
31
|
+
let __stryke_fs = require("@stryke/fs");
|
|
31
32
|
let __stryke_fs_json = require("@stryke/fs/json");
|
|
32
33
|
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
33
34
|
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
34
35
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
35
36
|
|
|
36
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
37
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-DJB7XLHA.js
|
|
37
38
|
var DEFAULT_COLOR_CONFIG = {
|
|
38
39
|
light: {
|
|
39
40
|
background: "#fafafa",
|
|
@@ -2210,7 +2211,7 @@ var require_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2210
2211
|
}));
|
|
2211
2212
|
|
|
2212
2213
|
//#endregion
|
|
2213
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2214
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-HVVJHTFS.js
|
|
2214
2215
|
var import_source = /* @__PURE__ */ __toESM(require_source(), 1);
|
|
2215
2216
|
var chalkDefault = {
|
|
2216
2217
|
hex: (_) => (message) => message,
|
|
@@ -2242,14 +2243,14 @@ var getChalk = () => {
|
|
|
2242
2243
|
};
|
|
2243
2244
|
|
|
2244
2245
|
//#endregion
|
|
2245
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2246
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-G2MK47WL.js
|
|
2246
2247
|
function isUnicodeSupported() {
|
|
2247
2248
|
if (process.platform !== "win32") return process.env.TERM !== "linux";
|
|
2248
2249
|
return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2249
2250
|
}
|
|
2250
2251
|
|
|
2251
2252
|
//#endregion
|
|
2252
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2253
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.js
|
|
2253
2254
|
var LogLevel = {
|
|
2254
2255
|
SILENT: 0,
|
|
2255
2256
|
FATAL: 10,
|
|
@@ -2274,7 +2275,7 @@ var LogLevelLabel = {
|
|
|
2274
2275
|
};
|
|
2275
2276
|
|
|
2276
2277
|
//#endregion
|
|
2277
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2278
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-AITAR5W5.js
|
|
2278
2279
|
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
2279
2280
|
var CONSOLE_ICONS = {
|
|
2280
2281
|
[LogLevelLabel.ERROR]: useIcon("✘", "×"),
|
|
@@ -2288,13 +2289,13 @@ var CONSOLE_ICONS = {
|
|
|
2288
2289
|
};
|
|
2289
2290
|
|
|
2290
2291
|
//#endregion
|
|
2291
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2292
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-CZ4IE2QN.js
|
|
2292
2293
|
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
2293
2294
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
2294
2295
|
};
|
|
2295
2296
|
|
|
2296
2297
|
//#endregion
|
|
2297
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2298
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-K4CDYUQR.js
|
|
2298
2299
|
var getLogLevel = (label) => {
|
|
2299
2300
|
switch (label) {
|
|
2300
2301
|
case "all": return LogLevel.ALL;
|
|
@@ -2310,7 +2311,7 @@ var getLogLevel = (label) => {
|
|
|
2310
2311
|
};
|
|
2311
2312
|
|
|
2312
2313
|
//#endregion
|
|
2313
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2314
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-SPHE3YEH.js
|
|
2314
2315
|
var daysInYear = 365.2425;
|
|
2315
2316
|
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
2316
2317
|
var secondsInDay = 3600 * 24;
|
|
@@ -2877,6 +2878,7 @@ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CON
|
|
|
2877
2878
|
};
|
|
2878
2879
|
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
2879
2880
|
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
2881
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
2880
2882
|
var MAX_DEPTH = 6;
|
|
2881
2883
|
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
2882
2884
|
if (depth > MAX_DEPTH) return "<max depth>";
|
|
@@ -2923,11 +2925,27 @@ function toArray(array) {
|
|
|
2923
2925
|
*/
|
|
2924
2926
|
async function resolveOptions(options) {
|
|
2925
2927
|
const tsconfigPath = options.tsconfigPath ? options.tsconfigPath.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : (0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "tsconfig.json");
|
|
2926
|
-
const schemas =
|
|
2928
|
+
const schemas = [];
|
|
2929
|
+
if (options.schemas) schemas.push(...toArray(options.schemas).filter(Boolean).map((schema) => schema.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot)).map((schema) => schema.includes("*") || schema.endsWith(".capnp") || (0, __stryke_fs_exists.existsSync)(schema) && (0, __stryke_fs_list_files.listSync)((0, __stryke_path_join_paths.joinPaths)(schema, "**/*.capnp")).length > 0 ? schema : (0, __stryke_fs_exists.existsSync)((0, __stryke_path_join_paths.joinPaths)(options.projectRoot, schema)) && (0, __stryke_fs_list_files.listSync)((0, __stryke_path_join_paths.joinPaths)(options.projectRoot, schema, "**/*.capnp")).length > 0 ? (0, __stryke_path_join_paths.joinPaths)(options.projectRoot, schema, "**/*.capnp") : (0, __stryke_fs_exists.existsSync)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, schema)) && (0, __stryke_fs_list_files.listSync)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, schema, "**/*.capnp")).length > 0 ? (0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, schema, "**/*.capnp") : schema));
|
|
2930
|
+
else schemas.push((0, __stryke_fs_exists.existsSync)((0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "schemas/**/*.capnp")) && (0, __stryke_fs_list_files.listSync)((0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "schemas/**/*.capnp")).length > 0 ? (0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "schemas/**/*.capnp") : (0, __stryke_fs_exists.existsSync)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "schemas/**/*.capnp")) && (0, __stryke_fs_list_files.listSync)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "schemas/**/*.capnp")).length > 0 ? (0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "schemas/**/*.capnp") : "schemas/**/*.capnp");
|
|
2927
2931
|
let resolvedTsconfig;
|
|
2928
2932
|
if (options.tsconfig) resolvedTsconfig = options.tsconfig;
|
|
2929
2933
|
else {
|
|
2930
|
-
|
|
2934
|
+
let resolvedTsconfigPath = tsconfigPath;
|
|
2935
|
+
if (!(0, __stryke_fs_exists.existsSync)(resolvedTsconfigPath)) {
|
|
2936
|
+
const found = [
|
|
2937
|
+
(0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "tsconfig.json"),
|
|
2938
|
+
(0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "tsconfig.lib.json"),
|
|
2939
|
+
(0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "tsconfig.app.json"),
|
|
2940
|
+
(0, __stryke_path_join_paths.joinPaths)(options.projectRoot, "tsconfig.capnp.json"),
|
|
2941
|
+
(0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "tsconfig.json"),
|
|
2942
|
+
(0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "tsconfig.lib.json"),
|
|
2943
|
+
(0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "tsconfig.app.json"),
|
|
2944
|
+
(0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, "tsconfig.capnp.json")
|
|
2945
|
+
].find((path) => (0, __stryke_fs_exists.existsSync)(path));
|
|
2946
|
+
if (found) resolvedTsconfigPath = found;
|
|
2947
|
+
}
|
|
2948
|
+
if (!resolvedTsconfigPath || !(0, __stryke_fs_exists.existsSync)(resolvedTsconfigPath)) {
|
|
2931
2949
|
const errorMessage = tsconfigPath ? `✖ The specified TypeScript configuration file "${tsconfigPath}" does not exist. Please provide a valid path.` : "✖ The specified TypeScript configuration file does not exist. Please provide a valid path.";
|
|
2932
2950
|
writeFatal(errorMessage, { logLevel: "all" });
|
|
2933
2951
|
throw new Error(errorMessage);
|
|
@@ -2954,6 +2972,15 @@ async function resolveOptions(options) {
|
|
|
2954
2972
|
return null;
|
|
2955
2973
|
}
|
|
2956
2974
|
const output = options.output ? options.output.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : (0, __stryke_path_join_paths.joinPaths)(options.projectRoot, (0, __stryke_path_file_path_fns.relativePath)(tsconfigPath ? (0, __stryke_path_file_path_fns.findFilePath)(tsconfigPath) : options.projectRoot, (0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, resolvedSchemas[0].endsWith(".capnp") ? (0, __stryke_path_file_path_fns.findFilePath)(resolvedSchemas[0]) : resolvedSchemas[0])));
|
|
2975
|
+
if (!(0, __stryke_fs_exists.existsSync)(output)) {
|
|
2976
|
+
if ((0, __stryke_fs.isFile)(output)) {
|
|
2977
|
+
const errorMessage = `✖ The specified output path "${output}" is a file. Please provide a valid directory path.`;
|
|
2978
|
+
writeFatal(errorMessage, { logLevel: "all" });
|
|
2979
|
+
throw new Error(errorMessage);
|
|
2980
|
+
}
|
|
2981
|
+
writeInfo(`Output directory "${output}" does not exist. It will be created automatically.`, { logLevel: "all" });
|
|
2982
|
+
await (0, __stryke_fs.createDirectory)(output);
|
|
2983
|
+
}
|
|
2957
2984
|
resolvedTsconfig.options.outDir = output;
|
|
2958
2985
|
return {
|
|
2959
2986
|
...options,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { existsSync } from "@stryke/fs/exists";
|
|
3
3
|
import { parseJsonConfigFileContent, sys } from "typescript";
|
|
4
|
+
import { createDirectory, isFile } from "@stryke/fs";
|
|
4
5
|
import { readJsonFile } from "@stryke/fs/json";
|
|
5
|
-
import { listFiles } from "@stryke/fs/list-files";
|
|
6
|
+
import { listFiles, listSync } from "@stryke/fs/list-files";
|
|
6
7
|
import { findFilePath, relativePath } from "@stryke/path/file-path-fns";
|
|
7
8
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
8
9
|
|
|
@@ -35,7 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
36
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
36
37
|
|
|
37
38
|
//#endregion
|
|
38
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
39
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-DJB7XLHA.js
|
|
39
40
|
var DEFAULT_COLOR_CONFIG = {
|
|
40
41
|
light: {
|
|
41
42
|
background: "#fafafa",
|
|
@@ -2212,7 +2213,7 @@ var require_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2212
2213
|
}));
|
|
2213
2214
|
|
|
2214
2215
|
//#endregion
|
|
2215
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2216
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-HVVJHTFS.js
|
|
2216
2217
|
var import_source = /* @__PURE__ */ __toESM(require_source(), 1);
|
|
2217
2218
|
var chalkDefault = {
|
|
2218
2219
|
hex: (_) => (message) => message,
|
|
@@ -2244,14 +2245,14 @@ var getChalk = () => {
|
|
|
2244
2245
|
};
|
|
2245
2246
|
|
|
2246
2247
|
//#endregion
|
|
2247
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2248
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-G2MK47WL.js
|
|
2248
2249
|
function isUnicodeSupported() {
|
|
2249
2250
|
if (process.platform !== "win32") return process.env.TERM !== "linux";
|
|
2250
2251
|
return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2251
2252
|
}
|
|
2252
2253
|
|
|
2253
2254
|
//#endregion
|
|
2254
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2255
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.js
|
|
2255
2256
|
var LogLevel = {
|
|
2256
2257
|
SILENT: 0,
|
|
2257
2258
|
FATAL: 10,
|
|
@@ -2276,7 +2277,7 @@ var LogLevelLabel = {
|
|
|
2276
2277
|
};
|
|
2277
2278
|
|
|
2278
2279
|
//#endregion
|
|
2279
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2280
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-AITAR5W5.js
|
|
2280
2281
|
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
2281
2282
|
var CONSOLE_ICONS = {
|
|
2282
2283
|
[LogLevelLabel.ERROR]: useIcon("✘", "×"),
|
|
@@ -2290,13 +2291,13 @@ var CONSOLE_ICONS = {
|
|
|
2290
2291
|
};
|
|
2291
2292
|
|
|
2292
2293
|
//#endregion
|
|
2293
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2294
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-CZ4IE2QN.js
|
|
2294
2295
|
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
2295
2296
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
2296
2297
|
};
|
|
2297
2298
|
|
|
2298
2299
|
//#endregion
|
|
2299
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2300
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-K4CDYUQR.js
|
|
2300
2301
|
var getLogLevel = (label) => {
|
|
2301
2302
|
switch (label) {
|
|
2302
2303
|
case "all": return LogLevel.ALL;
|
|
@@ -2312,7 +2313,7 @@ var getLogLevel = (label) => {
|
|
|
2312
2313
|
};
|
|
2313
2314
|
|
|
2314
2315
|
//#endregion
|
|
2315
|
-
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.
|
|
2316
|
+
//#region ../../node_modules/.pnpm/@storm-software+config-tools@1.189.22/node_modules/@storm-software/config-tools/dist/chunk-SPHE3YEH.js
|
|
2316
2317
|
var daysInYear = 365.2425;
|
|
2317
2318
|
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
2318
2319
|
var secondsInDay = 3600 * 24;
|
|
@@ -2879,6 +2880,7 @@ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CON
|
|
|
2879
2880
|
};
|
|
2880
2881
|
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
2881
2882
|
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
2883
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
2882
2884
|
var MAX_DEPTH = 6;
|
|
2883
2885
|
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
2884
2886
|
if (depth > MAX_DEPTH) return "<max depth>";
|
|
@@ -2925,11 +2927,27 @@ function toArray(array) {
|
|
|
2925
2927
|
*/
|
|
2926
2928
|
async function resolveOptions(options) {
|
|
2927
2929
|
const tsconfigPath = options.tsconfigPath ? options.tsconfigPath.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : joinPaths(options.projectRoot, "tsconfig.json");
|
|
2928
|
-
const schemas =
|
|
2930
|
+
const schemas = [];
|
|
2931
|
+
if (options.schemas) schemas.push(...toArray(options.schemas).filter(Boolean).map((schema) => schema.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot)).map((schema) => schema.includes("*") || schema.endsWith(".capnp") || existsSync(schema) && listSync(joinPaths(schema, "**/*.capnp")).length > 0 ? schema : existsSync(joinPaths(options.projectRoot, schema)) && listSync(joinPaths(options.projectRoot, schema, "**/*.capnp")).length > 0 ? joinPaths(options.projectRoot, schema, "**/*.capnp") : existsSync(joinPaths(options.workspaceRoot, schema)) && listSync(joinPaths(options.workspaceRoot, schema, "**/*.capnp")).length > 0 ? joinPaths(options.workspaceRoot, schema, "**/*.capnp") : schema));
|
|
2932
|
+
else schemas.push(existsSync(joinPaths(options.projectRoot, "schemas/**/*.capnp")) && listSync(joinPaths(options.projectRoot, "schemas/**/*.capnp")).length > 0 ? joinPaths(options.projectRoot, "schemas/**/*.capnp") : existsSync(joinPaths(options.workspaceRoot, "schemas/**/*.capnp")) && listSync(joinPaths(options.workspaceRoot, "schemas/**/*.capnp")).length > 0 ? joinPaths(options.workspaceRoot, "schemas/**/*.capnp") : "schemas/**/*.capnp");
|
|
2929
2933
|
let resolvedTsconfig;
|
|
2930
2934
|
if (options.tsconfig) resolvedTsconfig = options.tsconfig;
|
|
2931
2935
|
else {
|
|
2932
|
-
|
|
2936
|
+
let resolvedTsconfigPath = tsconfigPath;
|
|
2937
|
+
if (!existsSync(resolvedTsconfigPath)) {
|
|
2938
|
+
const found = [
|
|
2939
|
+
joinPaths(options.projectRoot, "tsconfig.json"),
|
|
2940
|
+
joinPaths(options.projectRoot, "tsconfig.lib.json"),
|
|
2941
|
+
joinPaths(options.projectRoot, "tsconfig.app.json"),
|
|
2942
|
+
joinPaths(options.projectRoot, "tsconfig.capnp.json"),
|
|
2943
|
+
joinPaths(options.workspaceRoot, "tsconfig.json"),
|
|
2944
|
+
joinPaths(options.workspaceRoot, "tsconfig.lib.json"),
|
|
2945
|
+
joinPaths(options.workspaceRoot, "tsconfig.app.json"),
|
|
2946
|
+
joinPaths(options.workspaceRoot, "tsconfig.capnp.json")
|
|
2947
|
+
].find((path) => existsSync(path));
|
|
2948
|
+
if (found) resolvedTsconfigPath = found;
|
|
2949
|
+
}
|
|
2950
|
+
if (!resolvedTsconfigPath || !existsSync(resolvedTsconfigPath)) {
|
|
2933
2951
|
const errorMessage = tsconfigPath ? `✖ The specified TypeScript configuration file "${tsconfigPath}" does not exist. Please provide a valid path.` : "✖ The specified TypeScript configuration file does not exist. Please provide a valid path.";
|
|
2934
2952
|
writeFatal(errorMessage, { logLevel: "all" });
|
|
2935
2953
|
throw new Error(errorMessage);
|
|
@@ -2956,6 +2974,15 @@ async function resolveOptions(options) {
|
|
|
2956
2974
|
return null;
|
|
2957
2975
|
}
|
|
2958
2976
|
const output = options.output ? options.output.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : joinPaths(options.projectRoot, relativePath(tsconfigPath ? findFilePath(tsconfigPath) : options.projectRoot, joinPaths(options.workspaceRoot, resolvedSchemas[0].endsWith(".capnp") ? findFilePath(resolvedSchemas[0]) : resolvedSchemas[0])));
|
|
2977
|
+
if (!existsSync(output)) {
|
|
2978
|
+
if (isFile(output)) {
|
|
2979
|
+
const errorMessage = `✖ The specified output path "${output}" is a file. Please provide a valid directory path.`;
|
|
2980
|
+
writeFatal(errorMessage, { logLevel: "all" });
|
|
2981
|
+
throw new Error(errorMessage);
|
|
2982
|
+
}
|
|
2983
|
+
writeInfo(`Output directory "${output}" does not exist. It will be created automatically.`, { logLevel: "all" });
|
|
2984
|
+
await createDirectory(output);
|
|
2985
|
+
}
|
|
2959
2986
|
resolvedTsconfig.options.outDir = output;
|
|
2960
2987
|
return {
|
|
2961
2988
|
...options,
|
|
@@ -2973,4 +3000,4 @@ async function resolveOptions(options) {
|
|
|
2973
3000
|
|
|
2974
3001
|
//#endregion
|
|
2975
3002
|
export { writeWarning as n, resolveOptions as t };
|
|
2976
|
-
//# sourceMappingURL=helpers-
|
|
3003
|
+
//# sourceMappingURL=helpers-DN2tMgBs.mjs.map
|