@stryke/capnp 0.3.0 → 0.4.0
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 +1179 -0
- package/bin/capnpc.js +1146 -0
- package/dist/chunk-LY3GWW4E.js +977 -0
- package/dist/chunk-ORA4UQMU.cjs +1 -0
- package/dist/chunk-OULCUN6I.js +0 -0
- package/dist/chunk-PV3OG5H3.cjs +977 -0
- package/dist/chunk-SHUYVCID.js +6 -0
- package/dist/chunk-USNT2KNT.cjs +6 -0
- package/dist/compile.cjs +7 -0
- package/dist/compile.js +7 -0
- package/dist/index.cjs +8 -0
- package/dist/index.js +8 -0
- package/dist/rpc.cjs +103 -0
- package/dist/rpc.d.cts +42 -0
- package/dist/rpc.d.ts +42 -0
- package/dist/rpc.js +103 -0
- package/dist/types.cjs +1 -0
- package/dist/types.js +1 -0
- package/package.json +19 -2
- package/dist/bin/capnpc.cjs +0 -11269
- package/dist/bin/capnpc.d.cts +0 -6
- package/dist/bin/capnpc.d.ts +0 -6
- package/dist/bin/capnpc.js +0 -11266
- package/dist/chunk-E5KOPL7Q.cjs +0 -6
- package/dist/chunk-EK5N4FAF.js +0 -55
- package/dist/chunk-IWTVA3JL.cjs +0 -104
- package/dist/chunk-QKE2ND5U.js +0 -104
- package/dist/chunk-TE2KW23K.cjs +0 -55
- package/dist/chunk-UQ2KKHLM.js +0 -6
- package/dist/src/compile.cjs +0 -7
- package/dist/src/compile.js +0 -7
- package/dist/src/index.cjs +0 -13
- package/dist/src/index.js +0 -13
- package/dist/src/types.cjs +0 -2
- package/dist/src/types.js +0 -2
- /package/dist/{src/compile.d.cts → compile.d.cts} +0 -0
- /package/dist/{src/compile.d.ts → compile.d.ts} +0 -0
- /package/dist/{src/index.d.cts → index.d.cts} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/types.d.cts → types.d.cts} +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
package/dist/chunk-E5KOPL7Q.cjs
DELETED
package/dist/chunk-EK5N4FAF.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
-
};
|
|
17
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
-
};
|
|
20
|
-
var __export = (target, all) => {
|
|
21
|
-
for (var name in all)
|
|
22
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
-
};
|
|
24
|
-
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
for (let key of __getOwnPropNames(from))
|
|
27
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
-
}
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
|
|
41
|
-
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__@swc+core@1.11.9_@swc+_19c55e6731afe9a981cc7f7992b35303/node_modules/tsup/assets/esm_shims.js
|
|
42
|
-
var init_esm_shims = __esm({
|
|
43
|
-
"../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__@swc+core@1.11.9_@swc+_19c55e6731afe9a981cc7f7992b35303/node_modules/tsup/assets/esm_shims.js"() {
|
|
44
|
-
"use strict";
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
__name,
|
|
50
|
-
__require,
|
|
51
|
-
__commonJS,
|
|
52
|
-
__export,
|
|
53
|
-
__toESM,
|
|
54
|
-
init_esm_shims
|
|
55
|
-
};
|
package/dist/chunk-IWTVA3JL.cjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkTE2KW23Kcjs = require('./chunk-TE2KW23K.cjs');
|
|
5
|
-
|
|
6
|
-
// src/compile.ts
|
|
7
|
-
_chunkTE2KW23Kcjs.init_cjs_shims.call(void 0, );
|
|
8
|
-
var _helpers = require('@stryke/fs/helpers');
|
|
9
|
-
var _writefile = require('@stryke/fs/write-file');
|
|
10
|
-
var _filepathfns = require('@stryke/path/file-path-fns');
|
|
11
|
-
var _joinpaths = require('@stryke/path/join-paths');
|
|
12
|
-
var _compiler = require('capnp-es/compiler');
|
|
13
|
-
var _buffer = require('buffer');
|
|
14
|
-
var _child_process = require('child_process');
|
|
15
|
-
var _fs = require('fs');
|
|
16
|
-
async function readStdin() {
|
|
17
|
-
if (process.stdin.isTTY) {
|
|
18
|
-
return _buffer.Buffer.alloc(0);
|
|
19
|
-
}
|
|
20
|
-
const chunks = [];
|
|
21
|
-
process.stdin.on("data", (chunk) => {
|
|
22
|
-
chunks.push(chunk);
|
|
23
|
-
});
|
|
24
|
-
await new Promise((resolve) => {
|
|
25
|
-
process.stdin.on("end", resolve);
|
|
26
|
-
});
|
|
27
|
-
const reqBuffer = _buffer.Buffer.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
|
|
28
|
-
let i = 0;
|
|
29
|
-
for (const chunk of chunks) {
|
|
30
|
-
chunk.copy(reqBuffer, i);
|
|
31
|
-
i += chunk.byteLength;
|
|
32
|
-
}
|
|
33
|
-
return reqBuffer;
|
|
34
|
-
}
|
|
35
|
-
_chunkTE2KW23Kcjs.__name.call(void 0, readStdin, "readStdin");
|
|
36
|
-
async function capnpc(options) {
|
|
37
|
-
try {
|
|
38
|
-
const { outputPath, tsconfig, sourcePath = [] } = options;
|
|
39
|
-
let dataBuf = await readStdin();
|
|
40
|
-
if (dataBuf.byteLength === 0) {
|
|
41
|
-
const opts = [];
|
|
42
|
-
if (outputPath) {
|
|
43
|
-
opts.push(`-o-:${outputPath}`);
|
|
44
|
-
} else {
|
|
45
|
-
opts.push("-o-");
|
|
46
|
-
}
|
|
47
|
-
dataBuf = await new Promise((resolve) => {
|
|
48
|
-
_child_process.exec.call(void 0, `capnpc ${opts.join(" ")} ${sourcePath.join(" ")}`, {
|
|
49
|
-
encoding: "buffer"
|
|
50
|
-
}, (error, stdout, stderr) => {
|
|
51
|
-
if (stderr.length > 0) {
|
|
52
|
-
process.stderr.write(stderr);
|
|
53
|
-
}
|
|
54
|
-
if (error) {
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
resolve(stdout);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const result = await _compiler.compileAll.call(void 0, dataBuf, {
|
|
62
|
-
ts: _nullishCoalesce(options.ts, () => ( true)),
|
|
63
|
-
js: _nullishCoalesce(options.js, () => ( false)),
|
|
64
|
-
dts: _nullishCoalesce(options.dts, () => ( true)),
|
|
65
|
-
tsconfig: _optionalChain([tsconfig, 'optionalAccess', _ => _.options])
|
|
66
|
-
});
|
|
67
|
-
for (const [fileName, content] of result.files) {
|
|
68
|
-
let filePath = fileName;
|
|
69
|
-
if (!_fs.existsSync.call(void 0, _filepathfns.findFilePath.call(void 0, filePath))) {
|
|
70
|
-
const fullPath = `/${filePath}`;
|
|
71
|
-
if (_fs.existsSync.call(void 0, _filepathfns.findFilePath.call(void 0, fullPath))) {
|
|
72
|
-
filePath = fullPath;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (outputPath) {
|
|
76
|
-
filePath = _joinpaths.joinPaths.call(void 0, outputPath, fileName);
|
|
77
|
-
}
|
|
78
|
-
if (!_fs.existsSync.call(void 0, _filepathfns.findFilePath.call(void 0, filePath))) {
|
|
79
|
-
await _helpers.createDirectory.call(void 0, _filepathfns.findFilePath.call(void 0, filePath));
|
|
80
|
-
}
|
|
81
|
-
await _writefile.writeFile.call(void 0,
|
|
82
|
-
filePath,
|
|
83
|
-
// https://github.com/microsoft/TypeScript/issues/54632
|
|
84
|
-
content.replace(/^\s+/gm, (match) => " ".repeat(match.length / 2))
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
if (error instanceof Error) {
|
|
90
|
-
console.error(`Error: ${error.message}`);
|
|
91
|
-
if (error.stack) {
|
|
92
|
-
console.error(error.stack);
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
console.error("An unknown error occurred:", error);
|
|
96
|
-
}
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
_chunkTE2KW23Kcjs.__name.call(void 0, capnpc, "capnpc");
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
exports.capnpc = capnpc;
|
package/dist/chunk-QKE2ND5U.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name,
|
|
3
|
-
init_esm_shims
|
|
4
|
-
} from "./chunk-EK5N4FAF.js";
|
|
5
|
-
|
|
6
|
-
// src/compile.ts
|
|
7
|
-
init_esm_shims();
|
|
8
|
-
import { createDirectory } from "@stryke/fs/helpers";
|
|
9
|
-
import { writeFile } from "@stryke/fs/write-file";
|
|
10
|
-
import { findFilePath } from "@stryke/path/file-path-fns";
|
|
11
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
12
|
-
import { compileAll } from "capnp-es/compiler";
|
|
13
|
-
import { Buffer } from "node:buffer";
|
|
14
|
-
import { exec } from "node:child_process";
|
|
15
|
-
import { existsSync } from "node:fs";
|
|
16
|
-
async function readStdin() {
|
|
17
|
-
if (process.stdin.isTTY) {
|
|
18
|
-
return Buffer.alloc(0);
|
|
19
|
-
}
|
|
20
|
-
const chunks = [];
|
|
21
|
-
process.stdin.on("data", (chunk) => {
|
|
22
|
-
chunks.push(chunk);
|
|
23
|
-
});
|
|
24
|
-
await new Promise((resolve) => {
|
|
25
|
-
process.stdin.on("end", resolve);
|
|
26
|
-
});
|
|
27
|
-
const reqBuffer = Buffer.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
|
|
28
|
-
let i = 0;
|
|
29
|
-
for (const chunk of chunks) {
|
|
30
|
-
chunk.copy(reqBuffer, i);
|
|
31
|
-
i += chunk.byteLength;
|
|
32
|
-
}
|
|
33
|
-
return reqBuffer;
|
|
34
|
-
}
|
|
35
|
-
__name(readStdin, "readStdin");
|
|
36
|
-
async function capnpc(options) {
|
|
37
|
-
try {
|
|
38
|
-
const { outputPath, tsconfig, sourcePath = [] } = options;
|
|
39
|
-
let dataBuf = await readStdin();
|
|
40
|
-
if (dataBuf.byteLength === 0) {
|
|
41
|
-
const opts = [];
|
|
42
|
-
if (outputPath) {
|
|
43
|
-
opts.push(`-o-:${outputPath}`);
|
|
44
|
-
} else {
|
|
45
|
-
opts.push("-o-");
|
|
46
|
-
}
|
|
47
|
-
dataBuf = await new Promise((resolve) => {
|
|
48
|
-
exec(`capnpc ${opts.join(" ")} ${sourcePath.join(" ")}`, {
|
|
49
|
-
encoding: "buffer"
|
|
50
|
-
}, (error, stdout, stderr) => {
|
|
51
|
-
if (stderr.length > 0) {
|
|
52
|
-
process.stderr.write(stderr);
|
|
53
|
-
}
|
|
54
|
-
if (error) {
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
resolve(stdout);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const result = await compileAll(dataBuf, {
|
|
62
|
-
ts: options.ts ?? true,
|
|
63
|
-
js: options.js ?? false,
|
|
64
|
-
dts: options.dts ?? true,
|
|
65
|
-
tsconfig: tsconfig?.options
|
|
66
|
-
});
|
|
67
|
-
for (const [fileName, content] of result.files) {
|
|
68
|
-
let filePath = fileName;
|
|
69
|
-
if (!existsSync(findFilePath(filePath))) {
|
|
70
|
-
const fullPath = `/${filePath}`;
|
|
71
|
-
if (existsSync(findFilePath(fullPath))) {
|
|
72
|
-
filePath = fullPath;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (outputPath) {
|
|
76
|
-
filePath = joinPaths(outputPath, fileName);
|
|
77
|
-
}
|
|
78
|
-
if (!existsSync(findFilePath(filePath))) {
|
|
79
|
-
await createDirectory(findFilePath(filePath));
|
|
80
|
-
}
|
|
81
|
-
await writeFile(
|
|
82
|
-
filePath,
|
|
83
|
-
// https://github.com/microsoft/TypeScript/issues/54632
|
|
84
|
-
content.replace(/^\s+/gm, (match) => " ".repeat(match.length / 2))
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
if (error instanceof Error) {
|
|
90
|
-
console.error(`Error: ${error.message}`);
|
|
91
|
-
if (error.stack) {
|
|
92
|
-
console.error(error.stack);
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
console.error("An unknown error occurred:", error);
|
|
96
|
-
}
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
__name(capnpc, "capnpc");
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
capnpc
|
|
104
|
-
};
|
package/dist/chunk-TE2KW23K.cjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
-
};
|
|
17
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
-
};
|
|
20
|
-
var __export = (target, all) => {
|
|
21
|
-
for (var name in all)
|
|
22
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
-
};
|
|
24
|
-
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
for (let key of __getOwnPropNames(from))
|
|
27
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
-
}
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
|
|
41
|
-
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__@swc+core@1.11.9_@swc+_19c55e6731afe9a981cc7f7992b35303/node_modules/tsup/assets/cjs_shims.js
|
|
42
|
-
var init_cjs_shims = __esm({
|
|
43
|
-
"../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__@swc+core@1.11.9_@swc+_19c55e6731afe9a981cc7f7992b35303/node_modules/tsup/assets/cjs_shims.js"() {
|
|
44
|
-
"use strict";
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exports.__name = __name; exports.__require = __require; exports.__commonJS = __commonJS; exports.__export = __export; exports.__toESM = __toESM; exports.init_cjs_shims = init_cjs_shims;
|
package/dist/chunk-UQ2KKHLM.js
DELETED
package/dist/src/compile.cjs
DELETED
package/dist/src/compile.js
DELETED
package/dist/src/index.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkIWTVA3JLcjs = require('../chunk-IWTVA3JL.cjs');
|
|
4
|
-
require('../chunk-E5KOPL7Q.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkTE2KW23Kcjs = require('../chunk-TE2KW23K.cjs');
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
_chunkTE2KW23Kcjs.init_cjs_shims.call(void 0, );
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.capnpc = _chunkIWTVA3JLcjs.capnpc;
|
package/dist/src/index.js
DELETED
package/dist/src/types.cjs
DELETED
package/dist/src/types.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|