@stryke/capnp 0.11.0 → 0.11.1
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 +154 -44
- package/bin/capnpc.js +152 -42
- package/dist/{chunk-SL27DJSC.cjs → chunk-BNRR6LB3.cjs} +155 -45
- package/dist/{chunk-U6Y2C7CE.js → chunk-COEROLIE.js} +154 -44
- package/dist/{chunk-4G5JV6WG.cjs → chunk-KDRGCBBA.cjs} +4 -4
- package/dist/{chunk-5QODNLKN.js → chunk-SIFFDR2W.js} +1 -1
- 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 +4 -4
- package/schemas/{chunk-A5PAMTED.cjs → chunk-3OPQQYYB.cjs} +1 -10
- package/schemas/{chunk-KDEFD3VP.js → chunk-ZSAA3N73.js} +1 -10
- 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/bin/capnpc.cjs
CHANGED
|
@@ -37,44 +37,58 @@ module.exports = __toCommonJS(capnpc_exports);
|
|
|
37
37
|
var import_console3 = require("@storm-software/config-tools/logger/console");
|
|
38
38
|
var import_utilities = require("@storm-software/config-tools/utilities");
|
|
39
39
|
|
|
40
|
-
// ../
|
|
40
|
+
// ../fs/src/exists.ts
|
|
41
41
|
var import_node_fs = require("fs");
|
|
42
42
|
var import_promises = require("fs/promises");
|
|
43
|
-
|
|
43
|
+
function existsSync(filePath) {
|
|
44
44
|
return (0, import_node_fs.existsSync)(filePath);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
|
+
__name(existsSync, "existsSync");
|
|
46
47
|
|
|
47
48
|
// ../types/src/base.ts
|
|
48
49
|
var EMPTY_STRING = "";
|
|
49
50
|
var $NestedValue = Symbol("NestedValue");
|
|
50
51
|
|
|
51
|
-
// ../path/src/
|
|
52
|
-
var
|
|
52
|
+
// ../path/src/regex.ts
|
|
53
|
+
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
54
|
+
var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
|
|
55
|
+
var UNC_REGEX = /^[/\\]{2}/;
|
|
56
|
+
var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
|
|
57
|
+
var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
|
|
53
58
|
|
|
54
|
-
// ../path/src/
|
|
55
|
-
|
|
59
|
+
// ../path/src/slash.ts
|
|
60
|
+
function slash(path) {
|
|
61
|
+
if (path.startsWith("\\\\?\\")) {
|
|
62
|
+
return path;
|
|
63
|
+
}
|
|
64
|
+
return path.replace(/\\/g, "/");
|
|
65
|
+
}
|
|
66
|
+
__name(slash, "slash");
|
|
67
|
+
|
|
68
|
+
// ../path/src/is-type.ts
|
|
69
|
+
function isAbsolutePath(path) {
|
|
70
|
+
return ABSOLUTE_PATH_REGEX.test(slash(path));
|
|
71
|
+
}
|
|
72
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
73
|
+
function isAbsolute(path) {
|
|
74
|
+
return isAbsolutePath(path);
|
|
75
|
+
}
|
|
76
|
+
__name(isAbsolute, "isAbsolute");
|
|
56
77
|
|
|
57
78
|
// ../path/src/join-paths.ts
|
|
58
|
-
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
59
79
|
function normalizeWindowsPath(input = "") {
|
|
60
80
|
if (!input) {
|
|
61
81
|
return input;
|
|
62
82
|
}
|
|
63
|
-
return input.replace(/\\/g, "/").replace(
|
|
83
|
+
return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
64
84
|
}
|
|
65
85
|
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
66
|
-
|
|
67
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
|
|
68
|
-
var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
|
|
69
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
70
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
71
|
-
}, "isAbsolute");
|
|
72
|
-
var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
86
|
+
function correctPaths(path) {
|
|
73
87
|
if (!path || path.length === 0) {
|
|
74
88
|
return ".";
|
|
75
89
|
}
|
|
76
90
|
path = normalizeWindowsPath(path);
|
|
77
|
-
const isUNCPath = path.match(
|
|
91
|
+
const isUNCPath = path.match(UNC_REGEX);
|
|
78
92
|
const isPathAbsolute = isAbsolute(path);
|
|
79
93
|
const trailingSeparator = path[path.length - 1] === "/";
|
|
80
94
|
path = normalizeString(path, !isPathAbsolute);
|
|
@@ -87,7 +101,7 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
87
101
|
if (trailingSeparator) {
|
|
88
102
|
path += "/";
|
|
89
103
|
}
|
|
90
|
-
if (
|
|
104
|
+
if (DRIVE_LETTER_REGEX.test(path)) {
|
|
91
105
|
path += "/";
|
|
92
106
|
}
|
|
93
107
|
if (isUNCPath) {
|
|
@@ -97,8 +111,9 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
97
111
|
return `//${path}`;
|
|
98
112
|
}
|
|
99
113
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
100
|
-
}
|
|
101
|
-
|
|
114
|
+
}
|
|
115
|
+
__name(correctPaths, "correctPaths");
|
|
116
|
+
function joinPaths(...segments) {
|
|
102
117
|
let path = "";
|
|
103
118
|
for (const seg of segments) {
|
|
104
119
|
if (!seg) {
|
|
@@ -118,7 +133,8 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
118
133
|
}
|
|
119
134
|
}
|
|
120
135
|
return correctPaths(path);
|
|
121
|
-
}
|
|
136
|
+
}
|
|
137
|
+
__name(joinPaths, "joinPaths");
|
|
122
138
|
function normalizeString(path, allowAboveRoot) {
|
|
123
139
|
let res = "";
|
|
124
140
|
let lastSegmentLength = 0;
|
|
@@ -181,18 +197,6 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
181
197
|
}
|
|
182
198
|
__name(normalizeString, "normalizeString");
|
|
183
199
|
|
|
184
|
-
// ../path/src/regex.ts
|
|
185
|
-
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
186
|
-
|
|
187
|
-
// ../path/src/slash.ts
|
|
188
|
-
function slash(path) {
|
|
189
|
-
if (path.startsWith("\\\\?\\")) {
|
|
190
|
-
return path;
|
|
191
|
-
}
|
|
192
|
-
return path.replace(/\\/g, "/");
|
|
193
|
-
}
|
|
194
|
-
__name(slash, "slash");
|
|
195
|
-
|
|
196
200
|
// ../path/src/correct-path.ts
|
|
197
201
|
function normalizeWindowsPath2(input = "") {
|
|
198
202
|
if (!input) {
|
|
@@ -201,9 +205,67 @@ function normalizeWindowsPath2(input = "") {
|
|
|
201
205
|
return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
202
206
|
}
|
|
203
207
|
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
function normalizeString2(path, allowAboveRoot) {
|
|
209
|
+
let res = "";
|
|
210
|
+
let lastSegmentLength = 0;
|
|
211
|
+
let lastSlash = -1;
|
|
212
|
+
let dots = 0;
|
|
213
|
+
let char = null;
|
|
214
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
215
|
+
if (index < path.length) {
|
|
216
|
+
char = path[index];
|
|
217
|
+
} else if (char === "/") {
|
|
218
|
+
break;
|
|
219
|
+
} else {
|
|
220
|
+
char = "/";
|
|
221
|
+
}
|
|
222
|
+
if (char === "/") {
|
|
223
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
224
|
+
} else if (dots === 2) {
|
|
225
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
226
|
+
if (res.length > 2) {
|
|
227
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
228
|
+
if (lastSlashIndex === -1) {
|
|
229
|
+
res = "";
|
|
230
|
+
lastSegmentLength = 0;
|
|
231
|
+
} else {
|
|
232
|
+
res = res.slice(0, lastSlashIndex);
|
|
233
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
234
|
+
}
|
|
235
|
+
lastSlash = index;
|
|
236
|
+
dots = 0;
|
|
237
|
+
continue;
|
|
238
|
+
} else if (res.length > 0) {
|
|
239
|
+
res = "";
|
|
240
|
+
lastSegmentLength = 0;
|
|
241
|
+
lastSlash = index;
|
|
242
|
+
dots = 0;
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (allowAboveRoot) {
|
|
247
|
+
res += res.length > 0 ? "/.." : "..";
|
|
248
|
+
lastSegmentLength = 2;
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
if (res.length > 0) {
|
|
252
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
253
|
+
} else {
|
|
254
|
+
res = path.slice(lastSlash + 1, index);
|
|
255
|
+
}
|
|
256
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
257
|
+
}
|
|
258
|
+
lastSlash = index;
|
|
259
|
+
dots = 0;
|
|
260
|
+
} else if (char === "." && dots !== -1) {
|
|
261
|
+
++dots;
|
|
262
|
+
} else {
|
|
263
|
+
dots = -1;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return res;
|
|
267
|
+
}
|
|
268
|
+
__name(normalizeString2, "normalizeString");
|
|
207
269
|
|
|
208
270
|
// ../path/src/file-path-fns.ts
|
|
209
271
|
function findFileName(filePath, options = {}) {
|
|
@@ -226,8 +288,56 @@ function findFilePath(filePath) {
|
|
|
226
288
|
return result === "/" ? result : result.replace(/\/$/, "");
|
|
227
289
|
}
|
|
228
290
|
__name(findFilePath, "findFilePath");
|
|
291
|
+
function resolve(...paths) {
|
|
292
|
+
paths = paths.map((argument) => normalizeWindowsPath2(argument));
|
|
293
|
+
let resolvedPath = "";
|
|
294
|
+
let resolvedAbsolute = false;
|
|
295
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
296
|
+
const path = index >= 0 ? paths[index] : currentDir();
|
|
297
|
+
if (!path || path.length === 0) {
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
301
|
+
resolvedAbsolute = isAbsolute(path);
|
|
302
|
+
}
|
|
303
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
304
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
305
|
+
return `/${resolvedPath}`;
|
|
306
|
+
}
|
|
307
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
308
|
+
}
|
|
309
|
+
__name(resolve, "resolve");
|
|
310
|
+
function currentDir() {
|
|
311
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
312
|
+
return process.cwd().replace(/\\/g, "/");
|
|
313
|
+
}
|
|
314
|
+
return "/";
|
|
315
|
+
}
|
|
316
|
+
__name(currentDir, "currentDir");
|
|
317
|
+
function relative(from, to) {
|
|
318
|
+
const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
319
|
+
const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
320
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
321
|
+
return _to.join("/");
|
|
322
|
+
}
|
|
323
|
+
const _fromCopy = [
|
|
324
|
+
..._from
|
|
325
|
+
];
|
|
326
|
+
for (const segment of _fromCopy) {
|
|
327
|
+
if (_to[0] !== segment) {
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
_from.shift();
|
|
331
|
+
_to.shift();
|
|
332
|
+
}
|
|
333
|
+
return [
|
|
334
|
+
..._from.map(() => ".."),
|
|
335
|
+
..._to
|
|
336
|
+
].join("/");
|
|
337
|
+
}
|
|
338
|
+
__name(relative, "relative");
|
|
229
339
|
function relativePath(from, to, withEndSlash = false) {
|
|
230
|
-
return
|
|
340
|
+
return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
|
|
231
341
|
}
|
|
232
342
|
__name(relativePath, "relativePath");
|
|
233
343
|
|
|
@@ -7849,7 +7959,7 @@ var isError = /* @__PURE__ */ __name((obj) => {
|
|
|
7849
7959
|
}, "isError");
|
|
7850
7960
|
|
|
7851
7961
|
// ../fs/src/read-file.ts
|
|
7852
|
-
var
|
|
7962
|
+
var import_node_fs2 = require("fs");
|
|
7853
7963
|
var import_promises2 = require("fs/promises");
|
|
7854
7964
|
var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
7855
7965
|
try {
|
|
@@ -7865,12 +7975,12 @@ var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
|
7865
7975
|
}, "readFile");
|
|
7866
7976
|
|
|
7867
7977
|
// ../fs/src/write-file.ts
|
|
7868
|
-
var
|
|
7978
|
+
var import_node_fs4 = require("fs");
|
|
7869
7979
|
var import_promises4 = require("fs/promises");
|
|
7870
7980
|
|
|
7871
7981
|
// ../fs/src/helpers.ts
|
|
7872
7982
|
var import_nanotar = require("nanotar");
|
|
7873
|
-
var
|
|
7983
|
+
var import_node_fs3 = require("fs");
|
|
7874
7984
|
var import_promises3 = require("fs/promises");
|
|
7875
7985
|
|
|
7876
7986
|
// ../fs/src/json.ts
|
|
@@ -7980,8 +8090,8 @@ async function capnpc(options) {
|
|
|
7980
8090
|
process.stdin.on("data", (chunk) => {
|
|
7981
8091
|
chunks.push(chunk);
|
|
7982
8092
|
});
|
|
7983
|
-
await new Promise((
|
|
7984
|
-
process.stdin.on("end",
|
|
8093
|
+
await new Promise((resolve2) => {
|
|
8094
|
+
process.stdin.on("end", resolve2);
|
|
7985
8095
|
});
|
|
7986
8096
|
const reqBuffer = import_node_buffer2.Buffer.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
|
|
7987
8097
|
let i = 0;
|
|
@@ -8001,7 +8111,7 @@ async function capnpc(options) {
|
|
|
8001
8111
|
}
|
|
8002
8112
|
opts.push("-o-");
|
|
8003
8113
|
}
|
|
8004
|
-
dataBuf = await new Promise((
|
|
8114
|
+
dataBuf = await new Promise((resolve2) => {
|
|
8005
8115
|
(0, import_node_child_process.exec)(`capnpc ${opts.join(" ")} ${schemas.join(" ")}`, {
|
|
8006
8116
|
encoding: "buffer"
|
|
8007
8117
|
}, (error, stdout, stderr) => {
|
|
@@ -8011,7 +8121,7 @@ async function capnpc(options) {
|
|
|
8011
8121
|
if (error) {
|
|
8012
8122
|
throw error;
|
|
8013
8123
|
}
|
|
8014
|
-
|
|
8124
|
+
resolve2(stdout);
|
|
8015
8125
|
});
|
|
8016
8126
|
});
|
|
8017
8127
|
}
|
package/bin/capnpc.js
CHANGED
|
@@ -4,46 +4,60 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4
4
|
|
|
5
5
|
// bin/capnpc.ts
|
|
6
6
|
import { writeFatal as writeFatal2, writeInfo, writeSuccess, writeWarning as writeWarning3 } from "@storm-software/config-tools/logger/console";
|
|
7
|
-
import { exitWithError, exitWithSuccess, findWorkspaceRootSafe
|
|
7
|
+
import { exitWithError, exitWithSuccess, findWorkspaceRootSafe, handleProcess } from "@storm-software/config-tools/utilities";
|
|
8
8
|
|
|
9
|
-
// ../
|
|
9
|
+
// ../fs/src/exists.ts
|
|
10
10
|
import { existsSync as existsSyncFs } from "node:fs";
|
|
11
11
|
import { access, constants } from "node:fs/promises";
|
|
12
|
-
|
|
12
|
+
function existsSync(filePath) {
|
|
13
13
|
return existsSyncFs(filePath);
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
__name(existsSync, "existsSync");
|
|
15
16
|
|
|
16
17
|
// ../types/src/base.ts
|
|
17
18
|
var EMPTY_STRING = "";
|
|
18
19
|
var $NestedValue = Symbol("NestedValue");
|
|
19
20
|
|
|
20
|
-
// ../path/src/
|
|
21
|
-
|
|
21
|
+
// ../path/src/regex.ts
|
|
22
|
+
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
23
|
+
var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
|
|
24
|
+
var UNC_REGEX = /^[/\\]{2}/;
|
|
25
|
+
var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
|
|
26
|
+
var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
|
|
27
|
+
|
|
28
|
+
// ../path/src/slash.ts
|
|
29
|
+
function slash(path) {
|
|
30
|
+
if (path.startsWith("\\\\?\\")) {
|
|
31
|
+
return path;
|
|
32
|
+
}
|
|
33
|
+
return path.replace(/\\/g, "/");
|
|
34
|
+
}
|
|
35
|
+
__name(slash, "slash");
|
|
22
36
|
|
|
23
|
-
// ../path/src/is-
|
|
24
|
-
|
|
37
|
+
// ../path/src/is-type.ts
|
|
38
|
+
function isAbsolutePath(path) {
|
|
39
|
+
return ABSOLUTE_PATH_REGEX.test(slash(path));
|
|
40
|
+
}
|
|
41
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
42
|
+
function isAbsolute(path) {
|
|
43
|
+
return isAbsolutePath(path);
|
|
44
|
+
}
|
|
45
|
+
__name(isAbsolute, "isAbsolute");
|
|
25
46
|
|
|
26
47
|
// ../path/src/join-paths.ts
|
|
27
|
-
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
28
48
|
function normalizeWindowsPath(input = "") {
|
|
29
49
|
if (!input) {
|
|
30
50
|
return input;
|
|
31
51
|
}
|
|
32
|
-
return input.replace(/\\/g, "/").replace(
|
|
52
|
+
return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
33
53
|
}
|
|
34
54
|
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
35
|
-
|
|
36
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
|
|
37
|
-
var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
|
|
38
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
39
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
40
|
-
}, "isAbsolute");
|
|
41
|
-
var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
55
|
+
function correctPaths(path) {
|
|
42
56
|
if (!path || path.length === 0) {
|
|
43
57
|
return ".";
|
|
44
58
|
}
|
|
45
59
|
path = normalizeWindowsPath(path);
|
|
46
|
-
const isUNCPath = path.match(
|
|
60
|
+
const isUNCPath = path.match(UNC_REGEX);
|
|
47
61
|
const isPathAbsolute = isAbsolute(path);
|
|
48
62
|
const trailingSeparator = path[path.length - 1] === "/";
|
|
49
63
|
path = normalizeString(path, !isPathAbsolute);
|
|
@@ -56,7 +70,7 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
56
70
|
if (trailingSeparator) {
|
|
57
71
|
path += "/";
|
|
58
72
|
}
|
|
59
|
-
if (
|
|
73
|
+
if (DRIVE_LETTER_REGEX.test(path)) {
|
|
60
74
|
path += "/";
|
|
61
75
|
}
|
|
62
76
|
if (isUNCPath) {
|
|
@@ -66,8 +80,9 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
66
80
|
return `//${path}`;
|
|
67
81
|
}
|
|
68
82
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
69
|
-
}
|
|
70
|
-
|
|
83
|
+
}
|
|
84
|
+
__name(correctPaths, "correctPaths");
|
|
85
|
+
function joinPaths(...segments) {
|
|
71
86
|
let path = "";
|
|
72
87
|
for (const seg of segments) {
|
|
73
88
|
if (!seg) {
|
|
@@ -87,7 +102,8 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
87
102
|
}
|
|
88
103
|
}
|
|
89
104
|
return correctPaths(path);
|
|
90
|
-
}
|
|
105
|
+
}
|
|
106
|
+
__name(joinPaths, "joinPaths");
|
|
91
107
|
function normalizeString(path, allowAboveRoot) {
|
|
92
108
|
let res = "";
|
|
93
109
|
let lastSegmentLength = 0;
|
|
@@ -150,18 +166,6 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
150
166
|
}
|
|
151
167
|
__name(normalizeString, "normalizeString");
|
|
152
168
|
|
|
153
|
-
// ../path/src/regex.ts
|
|
154
|
-
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
155
|
-
|
|
156
|
-
// ../path/src/slash.ts
|
|
157
|
-
function slash(path) {
|
|
158
|
-
if (path.startsWith("\\\\?\\")) {
|
|
159
|
-
return path;
|
|
160
|
-
}
|
|
161
|
-
return path.replace(/\\/g, "/");
|
|
162
|
-
}
|
|
163
|
-
__name(slash, "slash");
|
|
164
|
-
|
|
165
169
|
// ../path/src/correct-path.ts
|
|
166
170
|
function normalizeWindowsPath2(input = "") {
|
|
167
171
|
if (!input) {
|
|
@@ -170,9 +174,67 @@ function normalizeWindowsPath2(input = "") {
|
|
|
170
174
|
return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
171
175
|
}
|
|
172
176
|
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
function normalizeString2(path, allowAboveRoot) {
|
|
178
|
+
let res = "";
|
|
179
|
+
let lastSegmentLength = 0;
|
|
180
|
+
let lastSlash = -1;
|
|
181
|
+
let dots = 0;
|
|
182
|
+
let char = null;
|
|
183
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
184
|
+
if (index < path.length) {
|
|
185
|
+
char = path[index];
|
|
186
|
+
} else if (char === "/") {
|
|
187
|
+
break;
|
|
188
|
+
} else {
|
|
189
|
+
char = "/";
|
|
190
|
+
}
|
|
191
|
+
if (char === "/") {
|
|
192
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
193
|
+
} else if (dots === 2) {
|
|
194
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
195
|
+
if (res.length > 2) {
|
|
196
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
197
|
+
if (lastSlashIndex === -1) {
|
|
198
|
+
res = "";
|
|
199
|
+
lastSegmentLength = 0;
|
|
200
|
+
} else {
|
|
201
|
+
res = res.slice(0, lastSlashIndex);
|
|
202
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
203
|
+
}
|
|
204
|
+
lastSlash = index;
|
|
205
|
+
dots = 0;
|
|
206
|
+
continue;
|
|
207
|
+
} else if (res.length > 0) {
|
|
208
|
+
res = "";
|
|
209
|
+
lastSegmentLength = 0;
|
|
210
|
+
lastSlash = index;
|
|
211
|
+
dots = 0;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (allowAboveRoot) {
|
|
216
|
+
res += res.length > 0 ? "/.." : "..";
|
|
217
|
+
lastSegmentLength = 2;
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
if (res.length > 0) {
|
|
221
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
222
|
+
} else {
|
|
223
|
+
res = path.slice(lastSlash + 1, index);
|
|
224
|
+
}
|
|
225
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
226
|
+
}
|
|
227
|
+
lastSlash = index;
|
|
228
|
+
dots = 0;
|
|
229
|
+
} else if (char === "." && dots !== -1) {
|
|
230
|
+
++dots;
|
|
231
|
+
} else {
|
|
232
|
+
dots = -1;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return res;
|
|
236
|
+
}
|
|
237
|
+
__name(normalizeString2, "normalizeString");
|
|
176
238
|
|
|
177
239
|
// ../path/src/file-path-fns.ts
|
|
178
240
|
function findFileName(filePath, options = {}) {
|
|
@@ -195,6 +257,54 @@ function findFilePath(filePath) {
|
|
|
195
257
|
return result === "/" ? result : result.replace(/\/$/, "");
|
|
196
258
|
}
|
|
197
259
|
__name(findFilePath, "findFilePath");
|
|
260
|
+
function resolve(...paths) {
|
|
261
|
+
paths = paths.map((argument) => normalizeWindowsPath2(argument));
|
|
262
|
+
let resolvedPath = "";
|
|
263
|
+
let resolvedAbsolute = false;
|
|
264
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
265
|
+
const path = index >= 0 ? paths[index] : currentDir();
|
|
266
|
+
if (!path || path.length === 0) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
270
|
+
resolvedAbsolute = isAbsolute(path);
|
|
271
|
+
}
|
|
272
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
273
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
274
|
+
return `/${resolvedPath}`;
|
|
275
|
+
}
|
|
276
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
277
|
+
}
|
|
278
|
+
__name(resolve, "resolve");
|
|
279
|
+
function currentDir() {
|
|
280
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
281
|
+
return process.cwd().replace(/\\/g, "/");
|
|
282
|
+
}
|
|
283
|
+
return "/";
|
|
284
|
+
}
|
|
285
|
+
__name(currentDir, "currentDir");
|
|
286
|
+
function relative(from, to) {
|
|
287
|
+
const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
288
|
+
const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
289
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
290
|
+
return _to.join("/");
|
|
291
|
+
}
|
|
292
|
+
const _fromCopy = [
|
|
293
|
+
..._from
|
|
294
|
+
];
|
|
295
|
+
for (const segment of _fromCopy) {
|
|
296
|
+
if (_to[0] !== segment) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
_from.shift();
|
|
300
|
+
_to.shift();
|
|
301
|
+
}
|
|
302
|
+
return [
|
|
303
|
+
..._from.map(() => ".."),
|
|
304
|
+
..._to
|
|
305
|
+
].join("/");
|
|
306
|
+
}
|
|
307
|
+
__name(relative, "relative");
|
|
198
308
|
function relativePath(from, to, withEndSlash = false) {
|
|
199
309
|
return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
|
|
200
310
|
}
|
|
@@ -7949,8 +8059,8 @@ async function capnpc(options) {
|
|
|
7949
8059
|
process.stdin.on("data", (chunk) => {
|
|
7950
8060
|
chunks.push(chunk);
|
|
7951
8061
|
});
|
|
7952
|
-
await new Promise((
|
|
7953
|
-
process.stdin.on("end",
|
|
8062
|
+
await new Promise((resolve2) => {
|
|
8063
|
+
process.stdin.on("end", resolve2);
|
|
7954
8064
|
});
|
|
7955
8065
|
const reqBuffer = Buffer3.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
|
|
7956
8066
|
let i = 0;
|
|
@@ -7970,7 +8080,7 @@ async function capnpc(options) {
|
|
|
7970
8080
|
}
|
|
7971
8081
|
opts.push("-o-");
|
|
7972
8082
|
}
|
|
7973
|
-
dataBuf = await new Promise((
|
|
8083
|
+
dataBuf = await new Promise((resolve2) => {
|
|
7974
8084
|
exec(`capnpc ${opts.join(" ")} ${schemas.join(" ")}`, {
|
|
7975
8085
|
encoding: "buffer"
|
|
7976
8086
|
}, (error, stdout, stderr) => {
|
|
@@ -7980,7 +8090,7 @@ async function capnpc(options) {
|
|
|
7980
8090
|
if (error) {
|
|
7981
8091
|
throw error;
|
|
7982
8092
|
}
|
|
7983
|
-
|
|
8093
|
+
resolve2(stdout);
|
|
7984
8094
|
});
|
|
7985
8095
|
});
|
|
7986
8096
|
}
|
|
@@ -7998,7 +8108,7 @@ function createProgram() {
|
|
|
7998
8108
|
writeInfo("\u26A1 Running Storm Cap'n Proto Compiler Tools", {
|
|
7999
8109
|
logLevel: "all"
|
|
8000
8110
|
});
|
|
8001
|
-
const root =
|
|
8111
|
+
const root = findWorkspaceRootSafe(process.cwd());
|
|
8002
8112
|
process.env.STORM_WORKSPACE_ROOT ??= root;
|
|
8003
8113
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root;
|
|
8004
8114
|
if (root) {
|