@stryke/capnp 0.10.6 → 0.10.8
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 +15 -150
- package/bin/capnpc.js +11 -146
- package/dist/{chunk-GTDJDX77.cjs → chunk-4G5JV6WG.cjs} +6 -24
- package/dist/{chunk-FP42YKAZ.js → chunk-5QODNLKN.js} +6 -24
- package/dist/{chunk-SH2ISQVR.cjs → chunk-SL27DJSC.cjs} +3 -125
- package/dist/{chunk-NKATTHKT.js → chunk-U6Y2C7CE.js} +0 -122
- package/dist/compile.cjs +3 -3
- package/dist/compile.js +2 -2
- package/dist/helpers.cjs +2 -2
- package/dist/helpers.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/schemas/{chunk-YDIMDO2B.js → chunk-KDEFD3VP.js} +12 -12
- package/schemas/persistent.cjs +20 -20
- package/schemas/persistent.js +1 -1
- package/schemas/rpc-twoparty.cjs +32 -32
- package/schemas/rpc-twoparty.js +1 -1
- package/schemas/rpc.cjs +495 -495
- package/schemas/rpc.js +1 -1
- package/schemas/schema.cjs +675 -675
- package/schemas/schema.js +1 -1
- package/schemas/{chunk-Z7HGBQR4.cjs → chunk-A5PAMTED.cjs} +11 -11
package/bin/capnpc.cjs
CHANGED
|
@@ -43,23 +43,6 @@ var import_promises = require("fs/promises");
|
|
|
43
43
|
var existsSync = /* @__PURE__ */ __name((filePath) => {
|
|
44
44
|
return (0, import_node_fs.existsSync)(filePath);
|
|
45
45
|
}, "existsSync");
|
|
46
|
-
var exists = /* @__PURE__ */ __name(async (filePath) => {
|
|
47
|
-
return (0, import_promises.access)(filePath, import_promises.constants.F_OK).then(() => true).catch(() => false);
|
|
48
|
-
}, "exists");
|
|
49
|
-
|
|
50
|
-
// ../fs/src/helpers.ts
|
|
51
|
-
var import_nanotar = require("nanotar");
|
|
52
|
-
var import_node_fs2 = require("fs");
|
|
53
|
-
var import_promises2 = require("fs/promises");
|
|
54
|
-
async function createDirectory(path) {
|
|
55
|
-
if (await exists(path)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
return (0, import_promises2.mkdir)(path, {
|
|
59
|
-
recursive: true
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
__name(createDirectory, "createDirectory");
|
|
63
46
|
|
|
64
47
|
// ../types/src/base.ts
|
|
65
48
|
var EMPTY_STRING = "";
|
|
@@ -69,7 +52,7 @@ var $NestedValue = Symbol("NestedValue");
|
|
|
69
52
|
var import_node_path = require("path");
|
|
70
53
|
|
|
71
54
|
// ../path/src/is-file.ts
|
|
72
|
-
var
|
|
55
|
+
var import_node_fs2 = require("fs");
|
|
73
56
|
|
|
74
57
|
// ../path/src/join-paths.ts
|
|
75
58
|
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
@@ -210,20 +193,6 @@ function slash(path) {
|
|
|
210
193
|
}
|
|
211
194
|
__name(slash, "slash");
|
|
212
195
|
|
|
213
|
-
// ../path/src/is-file.ts
|
|
214
|
-
function isFile(path, additionalPath) {
|
|
215
|
-
return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path) : path, {
|
|
216
|
-
throwIfNoEntry: false
|
|
217
|
-
})?.isFile());
|
|
218
|
-
}
|
|
219
|
-
__name(isFile, "isFile");
|
|
220
|
-
function isDirectory(path, additionalPath) {
|
|
221
|
-
return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path) : path, {
|
|
222
|
-
throwIfNoEntry: false
|
|
223
|
-
})?.isDirectory());
|
|
224
|
-
}
|
|
225
|
-
__name(isDirectory, "isDirectory");
|
|
226
|
-
|
|
227
196
|
// ../path/src/correct-path.ts
|
|
228
197
|
function normalizeWindowsPath2(input = "") {
|
|
229
198
|
if (!input) {
|
|
@@ -236,99 +205,6 @@ __name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
|
236
205
|
// ../path/src/get-workspace-root.ts
|
|
237
206
|
var import_config_tools = require("@storm-software/config-tools");
|
|
238
207
|
|
|
239
|
-
// ../path/src/get-parent-path.ts
|
|
240
|
-
var resolveParentPath = /* @__PURE__ */ __name((path, count = 1) => {
|
|
241
|
-
let parentPath = path.replaceAll(/\/+$/g, "");
|
|
242
|
-
for (let i = 0; i < count; i++) {
|
|
243
|
-
parentPath = joinPaths(parentPath, "..");
|
|
244
|
-
}
|
|
245
|
-
return parentPath;
|
|
246
|
-
}, "resolveParentPath");
|
|
247
|
-
var getParentPath = /* @__PURE__ */ __name((name, cwd, options) => {
|
|
248
|
-
const ignoreCase = options?.ignoreCase ?? true;
|
|
249
|
-
const skipCwd = options?.skipCwd ?? false;
|
|
250
|
-
const targetType = options?.targetType ?? "both";
|
|
251
|
-
let dir = cwd;
|
|
252
|
-
if (skipCwd) {
|
|
253
|
-
dir = resolveParentPath(cwd);
|
|
254
|
-
}
|
|
255
|
-
let names = Array.isArray(name) ? name : [
|
|
256
|
-
name
|
|
257
|
-
];
|
|
258
|
-
if (ignoreCase) {
|
|
259
|
-
names = names.map((name2) => name2.toLowerCase());
|
|
260
|
-
}
|
|
261
|
-
while (true) {
|
|
262
|
-
const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
|
|
263
|
-
if (target) {
|
|
264
|
-
return joinPaths(dir, target);
|
|
265
|
-
}
|
|
266
|
-
const parentDir = resolveParentPath(dir);
|
|
267
|
-
if (parentDir === dir) {
|
|
268
|
-
return void 0;
|
|
269
|
-
}
|
|
270
|
-
dir = parentDir;
|
|
271
|
-
}
|
|
272
|
-
}, "getParentPath");
|
|
273
|
-
|
|
274
|
-
// ../path/src/is-root-dir.ts
|
|
275
|
-
var isSystemRoot = /* @__PURE__ */ __name((dir) => {
|
|
276
|
-
return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
|
|
277
|
-
}, "isSystemRoot");
|
|
278
|
-
|
|
279
|
-
// ../path/src/get-workspace-root.ts
|
|
280
|
-
var WORKSPACE_ROOT_CONTENT = [
|
|
281
|
-
"package-lock.json",
|
|
282
|
-
"yarn.lock",
|
|
283
|
-
"pnpm-lock.yaml",
|
|
284
|
-
"bun.lock",
|
|
285
|
-
"nx.json",
|
|
286
|
-
"knip.json",
|
|
287
|
-
"pnpm-workspace.yaml",
|
|
288
|
-
"LICENSE",
|
|
289
|
-
".all-contributorsrc",
|
|
290
|
-
".whitesource",
|
|
291
|
-
"syncpack.config.js",
|
|
292
|
-
"syncpack.json",
|
|
293
|
-
"socket.yaml",
|
|
294
|
-
"lefthook.yaml",
|
|
295
|
-
".npmrc",
|
|
296
|
-
".log4brains.yml",
|
|
297
|
-
".huskyrc",
|
|
298
|
-
".husky",
|
|
299
|
-
".lintstagedrc",
|
|
300
|
-
".commitlintrc",
|
|
301
|
-
"lefthook.yml",
|
|
302
|
-
".github",
|
|
303
|
-
".nx",
|
|
304
|
-
".vscode",
|
|
305
|
-
"patches"
|
|
306
|
-
];
|
|
307
|
-
function getWorkspaceRoot(dir = process.cwd()) {
|
|
308
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
309
|
-
return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
|
|
310
|
-
}
|
|
311
|
-
const root = (0, import_config_tools.findWorkspaceRootSafe)(dir);
|
|
312
|
-
if (root) {
|
|
313
|
-
return root;
|
|
314
|
-
}
|
|
315
|
-
let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
|
|
316
|
-
if (result) {
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
result = dir;
|
|
320
|
-
while (result && !isSystemRoot(result)) {
|
|
321
|
-
result = getParentPath("storm-workspace.json", result, {
|
|
322
|
-
skipCwd: true
|
|
323
|
-
});
|
|
324
|
-
if (result) {
|
|
325
|
-
return result;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return dir;
|
|
329
|
-
}
|
|
330
|
-
__name(getWorkspaceRoot, "getWorkspaceRoot");
|
|
331
|
-
|
|
332
208
|
// ../path/src/file-path-fns.ts
|
|
333
209
|
function findFileName(filePath, options = {}) {
|
|
334
210
|
const { requireExtension = false, withExtension = true } = options;
|
|
@@ -355,20 +231,6 @@ function relativePath(from, to, withEndSlash = false) {
|
|
|
355
231
|
}
|
|
356
232
|
__name(relativePath, "relativePath");
|
|
357
233
|
|
|
358
|
-
// ../path/src/is-parent-path.ts
|
|
359
|
-
function isParentPath(childPath, parentPath) {
|
|
360
|
-
const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
361
|
-
const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
362
|
-
return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
363
|
-
}
|
|
364
|
-
__name(isParentPath, "isParentPath");
|
|
365
|
-
|
|
366
|
-
// ../path/src/replace.ts
|
|
367
|
-
function replacePath(childPath, parentPath = process.cwd()) {
|
|
368
|
-
return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
|
|
369
|
-
}
|
|
370
|
-
__name(replacePath, "replacePath");
|
|
371
|
-
|
|
372
234
|
// bin/capnpc.ts
|
|
373
235
|
var import_commander = require("commander");
|
|
374
236
|
var import_promises5 = require("fs/promises");
|
|
@@ -7987,14 +7849,14 @@ var isError = /* @__PURE__ */ __name((obj) => {
|
|
|
7987
7849
|
}, "isError");
|
|
7988
7850
|
|
|
7989
7851
|
// ../fs/src/read-file.ts
|
|
7990
|
-
var
|
|
7991
|
-
var
|
|
7992
|
-
var
|
|
7852
|
+
var import_node_fs3 = require("fs");
|
|
7853
|
+
var import_promises2 = require("fs/promises");
|
|
7854
|
+
var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
7993
7855
|
try {
|
|
7994
7856
|
if (!filePath) {
|
|
7995
7857
|
throw new Error("No file path provided to read data");
|
|
7996
7858
|
}
|
|
7997
|
-
return await (0,
|
|
7859
|
+
return await (0, import_promises2.readFile)(filePath, {
|
|
7998
7860
|
encoding: "utf8"
|
|
7999
7861
|
});
|
|
8000
7862
|
} catch {
|
|
@@ -8006,9 +7868,14 @@ var readFile2 = /* @__PURE__ */ __name(async (filePath) => {
|
|
|
8006
7868
|
var import_node_fs5 = require("fs");
|
|
8007
7869
|
var import_promises4 = require("fs/promises");
|
|
8008
7870
|
|
|
7871
|
+
// ../fs/src/helpers.ts
|
|
7872
|
+
var import_nanotar = require("nanotar");
|
|
7873
|
+
var import_node_fs4 = require("fs");
|
|
7874
|
+
var import_promises3 = require("fs/promises");
|
|
7875
|
+
|
|
8009
7876
|
// ../fs/src/json.ts
|
|
8010
7877
|
async function readJsonFile(path, options) {
|
|
8011
|
-
const content = await
|
|
7878
|
+
const content = await readFile(path);
|
|
8012
7879
|
if (options) {
|
|
8013
7880
|
options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
|
|
8014
7881
|
}
|
|
@@ -8126,13 +7993,12 @@ async function capnpc(options) {
|
|
|
8126
7993
|
}
|
|
8127
7994
|
if (dataBuf.byteLength === 0) {
|
|
8128
7995
|
const opts = [];
|
|
8129
|
-
if (output) {
|
|
8130
|
-
if (!existsSync(output)) {
|
|
8131
|
-
(0, import_console2.writeWarning)(`Output directory "${output}" does not exist, it will be created...`);
|
|
8132
|
-
await createDirectory(replacePath(output, getWorkspaceRoot()));
|
|
8133
|
-
}
|
|
7996
|
+
if (output && existsSync(output)) {
|
|
8134
7997
|
opts.push(`-o-:${output}`);
|
|
8135
7998
|
} else {
|
|
7999
|
+
if (output && !existsSync(output)) {
|
|
8000
|
+
(0, import_console2.writeWarning)(`Output directory "${output}" does not exist, will write to schema path...`);
|
|
8001
|
+
}
|
|
8136
8002
|
opts.push("-o-");
|
|
8137
8003
|
}
|
|
8138
8004
|
dataBuf = await new Promise((resolve) => {
|
|
@@ -8237,7 +8103,6 @@ async function compileAction(options) {
|
|
|
8237
8103
|
filePath = joinPaths(options.output, fileName);
|
|
8238
8104
|
if (!existsSync(findFilePath(options.output))) {
|
|
8239
8105
|
(0, import_console3.writeWarning)(`Output directory "${findFilePath(options.output)}" does not exist, it will be created...`);
|
|
8240
|
-
await createDirectory(replacePath(findFilePath(options.output), getWorkspaceRoot()));
|
|
8241
8106
|
}
|
|
8242
8107
|
}
|
|
8243
8108
|
await (0, import_promises5.writeFile)(
|
package/bin/capnpc.js
CHANGED
|
@@ -12,23 +12,6 @@ import { access, constants } from "node:fs/promises";
|
|
|
12
12
|
var existsSync = /* @__PURE__ */ __name((filePath) => {
|
|
13
13
|
return existsSyncFs(filePath);
|
|
14
14
|
}, "existsSync");
|
|
15
|
-
var exists = /* @__PURE__ */ __name(async (filePath) => {
|
|
16
|
-
return access(filePath, constants.F_OK).then(() => true).catch(() => false);
|
|
17
|
-
}, "exists");
|
|
18
|
-
|
|
19
|
-
// ../fs/src/helpers.ts
|
|
20
|
-
import { parseTar, parseTarGzip } from "nanotar";
|
|
21
|
-
import { createWriteStream, mkdirSync, rmSync } from "node:fs";
|
|
22
|
-
import { mkdir, readFile, rm } from "node:fs/promises";
|
|
23
|
-
async function createDirectory(path) {
|
|
24
|
-
if (await exists(path)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
return mkdir(path, {
|
|
28
|
-
recursive: true
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
__name(createDirectory, "createDirectory");
|
|
32
15
|
|
|
33
16
|
// ../types/src/base.ts
|
|
34
17
|
var EMPTY_STRING = "";
|
|
@@ -179,20 +162,6 @@ function slash(path) {
|
|
|
179
162
|
}
|
|
180
163
|
__name(slash, "slash");
|
|
181
164
|
|
|
182
|
-
// ../path/src/is-file.ts
|
|
183
|
-
function isFile(path, additionalPath) {
|
|
184
|
-
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
|
|
185
|
-
throwIfNoEntry: false
|
|
186
|
-
})?.isFile());
|
|
187
|
-
}
|
|
188
|
-
__name(isFile, "isFile");
|
|
189
|
-
function isDirectory(path, additionalPath) {
|
|
190
|
-
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
|
|
191
|
-
throwIfNoEntry: false
|
|
192
|
-
})?.isDirectory());
|
|
193
|
-
}
|
|
194
|
-
__name(isDirectory, "isDirectory");
|
|
195
|
-
|
|
196
165
|
// ../path/src/correct-path.ts
|
|
197
166
|
function normalizeWindowsPath2(input = "") {
|
|
198
167
|
if (!input) {
|
|
@@ -205,99 +174,6 @@ __name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
|
205
174
|
// ../path/src/get-workspace-root.ts
|
|
206
175
|
import { findWorkspaceRootSafe } from "@storm-software/config-tools";
|
|
207
176
|
|
|
208
|
-
// ../path/src/get-parent-path.ts
|
|
209
|
-
var resolveParentPath = /* @__PURE__ */ __name((path, count = 1) => {
|
|
210
|
-
let parentPath = path.replaceAll(/\/+$/g, "");
|
|
211
|
-
for (let i = 0; i < count; i++) {
|
|
212
|
-
parentPath = joinPaths(parentPath, "..");
|
|
213
|
-
}
|
|
214
|
-
return parentPath;
|
|
215
|
-
}, "resolveParentPath");
|
|
216
|
-
var getParentPath = /* @__PURE__ */ __name((name, cwd, options) => {
|
|
217
|
-
const ignoreCase = options?.ignoreCase ?? true;
|
|
218
|
-
const skipCwd = options?.skipCwd ?? false;
|
|
219
|
-
const targetType = options?.targetType ?? "both";
|
|
220
|
-
let dir = cwd;
|
|
221
|
-
if (skipCwd) {
|
|
222
|
-
dir = resolveParentPath(cwd);
|
|
223
|
-
}
|
|
224
|
-
let names = Array.isArray(name) ? name : [
|
|
225
|
-
name
|
|
226
|
-
];
|
|
227
|
-
if (ignoreCase) {
|
|
228
|
-
names = names.map((name2) => name2.toLowerCase());
|
|
229
|
-
}
|
|
230
|
-
while (true) {
|
|
231
|
-
const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
|
|
232
|
-
if (target) {
|
|
233
|
-
return joinPaths(dir, target);
|
|
234
|
-
}
|
|
235
|
-
const parentDir = resolveParentPath(dir);
|
|
236
|
-
if (parentDir === dir) {
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
dir = parentDir;
|
|
240
|
-
}
|
|
241
|
-
}, "getParentPath");
|
|
242
|
-
|
|
243
|
-
// ../path/src/is-root-dir.ts
|
|
244
|
-
var isSystemRoot = /* @__PURE__ */ __name((dir) => {
|
|
245
|
-
return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
|
|
246
|
-
}, "isSystemRoot");
|
|
247
|
-
|
|
248
|
-
// ../path/src/get-workspace-root.ts
|
|
249
|
-
var WORKSPACE_ROOT_CONTENT = [
|
|
250
|
-
"package-lock.json",
|
|
251
|
-
"yarn.lock",
|
|
252
|
-
"pnpm-lock.yaml",
|
|
253
|
-
"bun.lock",
|
|
254
|
-
"nx.json",
|
|
255
|
-
"knip.json",
|
|
256
|
-
"pnpm-workspace.yaml",
|
|
257
|
-
"LICENSE",
|
|
258
|
-
".all-contributorsrc",
|
|
259
|
-
".whitesource",
|
|
260
|
-
"syncpack.config.js",
|
|
261
|
-
"syncpack.json",
|
|
262
|
-
"socket.yaml",
|
|
263
|
-
"lefthook.yaml",
|
|
264
|
-
".npmrc",
|
|
265
|
-
".log4brains.yml",
|
|
266
|
-
".huskyrc",
|
|
267
|
-
".husky",
|
|
268
|
-
".lintstagedrc",
|
|
269
|
-
".commitlintrc",
|
|
270
|
-
"lefthook.yml",
|
|
271
|
-
".github",
|
|
272
|
-
".nx",
|
|
273
|
-
".vscode",
|
|
274
|
-
"patches"
|
|
275
|
-
];
|
|
276
|
-
function getWorkspaceRoot(dir = process.cwd()) {
|
|
277
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
278
|
-
return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
|
|
279
|
-
}
|
|
280
|
-
const root = findWorkspaceRootSafe(dir);
|
|
281
|
-
if (root) {
|
|
282
|
-
return root;
|
|
283
|
-
}
|
|
284
|
-
let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
|
|
285
|
-
if (result) {
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
result = dir;
|
|
289
|
-
while (result && !isSystemRoot(result)) {
|
|
290
|
-
result = getParentPath("storm-workspace.json", result, {
|
|
291
|
-
skipCwd: true
|
|
292
|
-
});
|
|
293
|
-
if (result) {
|
|
294
|
-
return result;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return dir;
|
|
298
|
-
}
|
|
299
|
-
__name(getWorkspaceRoot, "getWorkspaceRoot");
|
|
300
|
-
|
|
301
177
|
// ../path/src/file-path-fns.ts
|
|
302
178
|
function findFileName(filePath, options = {}) {
|
|
303
179
|
const { requireExtension = false, withExtension = true } = options;
|
|
@@ -324,20 +200,6 @@ function relativePath(from, to, withEndSlash = false) {
|
|
|
324
200
|
}
|
|
325
201
|
__name(relativePath, "relativePath");
|
|
326
202
|
|
|
327
|
-
// ../path/src/is-parent-path.ts
|
|
328
|
-
function isParentPath(childPath, parentPath) {
|
|
329
|
-
const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
330
|
-
const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
331
|
-
return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
332
|
-
}
|
|
333
|
-
__name(isParentPath, "isParentPath");
|
|
334
|
-
|
|
335
|
-
// ../path/src/replace.ts
|
|
336
|
-
function replacePath(childPath, parentPath = process.cwd()) {
|
|
337
|
-
return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
|
|
338
|
-
}
|
|
339
|
-
__name(replacePath, "replacePath");
|
|
340
|
-
|
|
341
203
|
// bin/capnpc.ts
|
|
342
204
|
import { Command, Option } from "commander";
|
|
343
205
|
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -7958,7 +7820,7 @@ var isError = /* @__PURE__ */ __name((obj) => {
|
|
|
7958
7820
|
// ../fs/src/read-file.ts
|
|
7959
7821
|
import { existsSync as existsSync2, readFileSync as readFileSyncFs } from "node:fs";
|
|
7960
7822
|
import { readFile as readFileFs } from "node:fs/promises";
|
|
7961
|
-
var
|
|
7823
|
+
var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
7962
7824
|
try {
|
|
7963
7825
|
if (!filePath) {
|
|
7964
7826
|
throw new Error("No file path provided to read data");
|
|
@@ -7975,9 +7837,14 @@ var readFile2 = /* @__PURE__ */ __name(async (filePath) => {
|
|
|
7975
7837
|
import { writeFileSync as writeFileSyncFs } from "node:fs";
|
|
7976
7838
|
import { writeFile as writeFileFs } from "node:fs/promises";
|
|
7977
7839
|
|
|
7840
|
+
// ../fs/src/helpers.ts
|
|
7841
|
+
import { parseTar, parseTarGzip } from "nanotar";
|
|
7842
|
+
import { createWriteStream, mkdirSync, rmSync } from "node:fs";
|
|
7843
|
+
import { mkdir, readFile as readFile2, rm } from "node:fs/promises";
|
|
7844
|
+
|
|
7978
7845
|
// ../fs/src/json.ts
|
|
7979
7846
|
async function readJsonFile(path, options) {
|
|
7980
|
-
const content = await
|
|
7847
|
+
const content = await readFile(path);
|
|
7981
7848
|
if (options) {
|
|
7982
7849
|
options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
|
|
7983
7850
|
}
|
|
@@ -8095,13 +7962,12 @@ async function capnpc(options) {
|
|
|
8095
7962
|
}
|
|
8096
7963
|
if (dataBuf.byteLength === 0) {
|
|
8097
7964
|
const opts = [];
|
|
8098
|
-
if (output) {
|
|
8099
|
-
if (!existsSync(output)) {
|
|
8100
|
-
writeWarning2(`Output directory "${output}" does not exist, it will be created...`);
|
|
8101
|
-
await createDirectory(replacePath(output, getWorkspaceRoot()));
|
|
8102
|
-
}
|
|
7965
|
+
if (output && existsSync(output)) {
|
|
8103
7966
|
opts.push(`-o-:${output}`);
|
|
8104
7967
|
} else {
|
|
7968
|
+
if (output && !existsSync(output)) {
|
|
7969
|
+
writeWarning2(`Output directory "${output}" does not exist, will write to schema path...`);
|
|
7970
|
+
}
|
|
8105
7971
|
opts.push("-o-");
|
|
8106
7972
|
}
|
|
8107
7973
|
dataBuf = await new Promise((resolve) => {
|
|
@@ -8206,7 +8072,6 @@ async function compileAction(options) {
|
|
|
8206
8072
|
filePath = joinPaths(options.output, fileName);
|
|
8207
8073
|
if (!existsSync(findFilePath(options.output))) {
|
|
8208
8074
|
writeWarning3(`Output directory "${findFilePath(options.output)}" does not exist, it will be created...`);
|
|
8209
|
-
await createDirectory(replacePath(findFilePath(options.output), getWorkspaceRoot()));
|
|
8210
8075
|
}
|
|
8211
8076
|
}
|
|
8212
8077
|
await writeFile2(
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28; var _class29; var _class30; var _class31; var _class32; var _class33; var _class34; var _class35; var _class36; var _class37;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkSH2ISQVRcjs = require('./chunk-SH2ISQVR.cjs');
|
|
4
|
+
var _chunkSL27DJSCcjs = require('./chunk-SL27DJSC.cjs');
|
|
8
5
|
|
|
9
6
|
|
|
10
7
|
|
|
@@ -58,20 +55,6 @@ var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
|
58
55
|
// src/compile.ts
|
|
59
56
|
var _console = require('@storm-software/config-tools/logger/console');
|
|
60
57
|
|
|
61
|
-
// ../path/src/is-parent-path.ts
|
|
62
|
-
function isParentPath(childPath, parentPath) {
|
|
63
|
-
const normalizedChild = _chunkSH2ISQVRcjs.slash.call(void 0, childPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
64
|
-
const normalizedParent = _chunkSH2ISQVRcjs.slash.call(void 0, parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
65
|
-
return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
66
|
-
}
|
|
67
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, isParentPath, "isParentPath");
|
|
68
|
-
|
|
69
|
-
// ../path/src/replace.ts
|
|
70
|
-
function replacePath(childPath, parentPath = process.cwd()) {
|
|
71
|
-
return isParentPath(childPath, parentPath) ? _chunkSH2ISQVRcjs.slash.call(void 0, childPath).replace(_chunkSH2ISQVRcjs.slash.call(void 0, parentPath), "").replace(/^\//, "") : childPath;
|
|
72
|
-
}
|
|
73
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, replacePath, "replacePath");
|
|
74
|
-
|
|
75
58
|
// ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
|
|
76
59
|
var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
|
|
77
60
|
|
|
@@ -4070,13 +4053,12 @@ async function capnpc(options) {
|
|
|
4070
4053
|
}
|
|
4071
4054
|
if (dataBuf.byteLength === 0) {
|
|
4072
4055
|
const opts = [];
|
|
4073
|
-
if (output) {
|
|
4074
|
-
if (!_chunkSH2ISQVRcjs.existsSync.call(void 0, output)) {
|
|
4075
|
-
_console.writeWarning.call(void 0, `Output directory "${output}" does not exist, it will be created...`);
|
|
4076
|
-
await _chunkSH2ISQVRcjs.createDirectory.call(void 0, replacePath(output, _chunkSH2ISQVRcjs.getWorkspaceRoot.call(void 0, )));
|
|
4077
|
-
}
|
|
4056
|
+
if (output && _chunkSL27DJSCcjs.existsSync.call(void 0, output)) {
|
|
4078
4057
|
opts.push(`-o-:${output}`);
|
|
4079
4058
|
} else {
|
|
4059
|
+
if (output && !_chunkSL27DJSCcjs.existsSync.call(void 0, output)) {
|
|
4060
|
+
_console.writeWarning.call(void 0, `Output directory "${output}" does not exist, will write to schema path...`);
|
|
4061
|
+
}
|
|
4080
4062
|
opts.push("-o-");
|
|
4081
4063
|
}
|
|
4082
4064
|
dataBuf = await new Promise((resolve) => {
|
|
@@ -4102,7 +4084,7 @@ async function capnpc(options) {
|
|
|
4102
4084
|
}
|
|
4103
4085
|
_chunkUSNT2KNTcjs.__name.call(void 0, capnpc, "capnpc");
|
|
4104
4086
|
async function compile(dataBuf, options) {
|
|
4105
|
-
const resolvedOptions = await
|
|
4087
|
+
const resolvedOptions = await _chunkSL27DJSCcjs.resolveOptions.call(void 0, options);
|
|
4106
4088
|
if (!resolvedOptions) {
|
|
4107
4089
|
_console.writeWarning.call(void 0, "\u2716 Unable to resolve Cap'n Proto compiler options - the program will terminate", {
|
|
4108
4090
|
logLevel: "all"
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createDirectory,
|
|
3
2
|
existsSync,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
slash
|
|
7
|
-
} from "./chunk-NKATTHKT.js";
|
|
3
|
+
resolveOptions
|
|
4
|
+
} from "./chunk-U6Y2C7CE.js";
|
|
8
5
|
import {
|
|
9
6
|
CompositeList,
|
|
10
7
|
Message,
|
|
@@ -58,20 +55,6 @@ import {
|
|
|
58
55
|
// src/compile.ts
|
|
59
56
|
import { writeWarning } from "@storm-software/config-tools/logger/console";
|
|
60
57
|
|
|
61
|
-
// ../path/src/is-parent-path.ts
|
|
62
|
-
function isParentPath(childPath, parentPath) {
|
|
63
|
-
const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
64
|
-
const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
65
|
-
return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
66
|
-
}
|
|
67
|
-
__name(isParentPath, "isParentPath");
|
|
68
|
-
|
|
69
|
-
// ../path/src/replace.ts
|
|
70
|
-
function replacePath(childPath, parentPath = process.cwd()) {
|
|
71
|
-
return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
|
|
72
|
-
}
|
|
73
|
-
__name(replacePath, "replacePath");
|
|
74
|
-
|
|
75
58
|
// ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
|
|
76
59
|
import ts from "typescript";
|
|
77
60
|
|
|
@@ -4070,13 +4053,12 @@ async function capnpc(options) {
|
|
|
4070
4053
|
}
|
|
4071
4054
|
if (dataBuf.byteLength === 0) {
|
|
4072
4055
|
const opts = [];
|
|
4073
|
-
if (output) {
|
|
4074
|
-
if (!existsSync(output)) {
|
|
4075
|
-
writeWarning(`Output directory "${output}" does not exist, it will be created...`);
|
|
4076
|
-
await createDirectory(replacePath(output, getWorkspaceRoot()));
|
|
4077
|
-
}
|
|
4056
|
+
if (output && existsSync(output)) {
|
|
4078
4057
|
opts.push(`-o-:${output}`);
|
|
4079
4058
|
} else {
|
|
4059
|
+
if (output && !existsSync(output)) {
|
|
4060
|
+
writeWarning(`Output directory "${output}" does not exist, will write to schema path...`);
|
|
4061
|
+
}
|
|
4080
4062
|
opts.push("-o-");
|
|
4081
4063
|
}
|
|
4082
4064
|
dataBuf = await new Promise((resolve) => {
|