@stryke/capnp 0.11.0 → 0.11.2
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 +156 -44
- package/bin/capnpc.js +154 -42
- package/dist/{chunk-SL27DJSC.cjs → chunk-EKDPJ4VY.cjs} +157 -45
- package/dist/{chunk-4G5JV6WG.cjs → chunk-HNO4Q6XI.cjs} +4 -4
- package/dist/{chunk-5QODNLKN.js → chunk-KDXI54ZD.js} +1 -1
- package/dist/{chunk-U6Y2C7CE.js → chunk-S7BSMHAH.js} +156 -44
- 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
|
@@ -14,6 +14,14 @@ function toArray(array) {
|
|
|
14
14
|
}
|
|
15
15
|
_chunkUSNT2KNTcjs.__name.call(void 0, toArray, "toArray");
|
|
16
16
|
|
|
17
|
+
// ../fs/src/exists.ts
|
|
18
|
+
var _fs = require('fs');
|
|
19
|
+
var _promises = require('fs/promises');
|
|
20
|
+
function existsSync(filePath) {
|
|
21
|
+
return _fs.existsSync.call(void 0, filePath);
|
|
22
|
+
}
|
|
23
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, existsSync, "existsSync");
|
|
24
|
+
|
|
17
25
|
// ../type-checks/src/get-object-tag.ts
|
|
18
26
|
var getObjectTag = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
|
|
19
27
|
if (value == null) {
|
|
@@ -578,8 +586,8 @@ var isError = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (obj) => {
|
|
|
578
586
|
}, "isError");
|
|
579
587
|
|
|
580
588
|
// ../fs/src/read-file.ts
|
|
581
|
-
|
|
582
|
-
|
|
589
|
+
|
|
590
|
+
|
|
583
591
|
var readFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (filePath) => {
|
|
584
592
|
try {
|
|
585
593
|
if (!filePath) {
|
|
@@ -593,30 +601,55 @@ var readFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (file
|
|
|
593
601
|
}
|
|
594
602
|
}, "readFile");
|
|
595
603
|
|
|
596
|
-
// ../path/src/
|
|
604
|
+
// ../path/src/cwd.ts
|
|
605
|
+
function cwd() {
|
|
606
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
607
|
+
return process.cwd().replace(/\\/g, "/");
|
|
608
|
+
}
|
|
609
|
+
return "/";
|
|
610
|
+
}
|
|
611
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, cwd, "cwd");
|
|
597
612
|
|
|
613
|
+
// ../path/src/regex.ts
|
|
614
|
+
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
615
|
+
var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
|
|
616
|
+
var UNC_REGEX = /^[/\\]{2}/;
|
|
617
|
+
var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
|
|
618
|
+
var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
|
|
619
|
+
|
|
620
|
+
// ../path/src/slash.ts
|
|
621
|
+
function slash(path) {
|
|
622
|
+
if (path.startsWith("\\\\?\\")) {
|
|
623
|
+
return path;
|
|
624
|
+
}
|
|
625
|
+
return path.replace(/\\/g, "/");
|
|
626
|
+
}
|
|
627
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, slash, "slash");
|
|
628
|
+
|
|
629
|
+
// ../path/src/is-type.ts
|
|
630
|
+
function isAbsolutePath(path) {
|
|
631
|
+
return ABSOLUTE_PATH_REGEX.test(slash(path));
|
|
632
|
+
}
|
|
633
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isAbsolutePath, "isAbsolutePath");
|
|
634
|
+
function isAbsolute(path) {
|
|
635
|
+
return isAbsolutePath(path);
|
|
636
|
+
}
|
|
637
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, isAbsolute, "isAbsolute");
|
|
598
638
|
|
|
599
639
|
// ../path/src/join-paths.ts
|
|
600
|
-
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
601
640
|
function normalizeWindowsPath(input = "") {
|
|
602
641
|
if (!input) {
|
|
603
642
|
return input;
|
|
604
643
|
}
|
|
605
|
-
return input.replace(/\\/g, "/").replace(
|
|
644
|
+
return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
606
645
|
}
|
|
607
646
|
_chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath, "normalizeWindowsPath");
|
|
608
|
-
|
|
609
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
|
|
610
|
-
var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
|
|
611
|
-
var isAbsolute = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(p) {
|
|
612
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
613
|
-
}, "isAbsolute");
|
|
614
|
-
var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(path) {
|
|
647
|
+
function correctPaths(path) {
|
|
615
648
|
if (!path || path.length === 0) {
|
|
616
649
|
return ".";
|
|
617
650
|
}
|
|
618
651
|
path = normalizeWindowsPath(path);
|
|
619
|
-
const isUNCPath = path.match(
|
|
652
|
+
const isUNCPath = path.match(UNC_REGEX);
|
|
620
653
|
const isPathAbsolute = isAbsolute(path);
|
|
621
654
|
const trailingSeparator = path[path.length - 1] === "/";
|
|
622
655
|
path = normalizeString(path, !isPathAbsolute);
|
|
@@ -629,7 +662,7 @@ var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, functio
|
|
|
629
662
|
if (trailingSeparator) {
|
|
630
663
|
path += "/";
|
|
631
664
|
}
|
|
632
|
-
if (
|
|
665
|
+
if (DRIVE_LETTER_REGEX.test(path)) {
|
|
633
666
|
path += "/";
|
|
634
667
|
}
|
|
635
668
|
if (isUNCPath) {
|
|
@@ -639,8 +672,9 @@ var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, functio
|
|
|
639
672
|
return `//${path}`;
|
|
640
673
|
}
|
|
641
674
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
642
|
-
}
|
|
643
|
-
|
|
675
|
+
}
|
|
676
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, correctPaths, "correctPaths");
|
|
677
|
+
function joinPaths(...segments) {
|
|
644
678
|
let path = "";
|
|
645
679
|
for (const seg of segments) {
|
|
646
680
|
if (!seg) {
|
|
@@ -660,7 +694,8 @@ var joinPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(.
|
|
|
660
694
|
}
|
|
661
695
|
}
|
|
662
696
|
return correctPaths(path);
|
|
663
|
-
}
|
|
697
|
+
}
|
|
698
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, joinPaths, "joinPaths");
|
|
664
699
|
function normalizeString(path, allowAboveRoot) {
|
|
665
700
|
let res = "";
|
|
666
701
|
let lastSegmentLength = 0;
|
|
@@ -723,18 +758,6 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
723
758
|
}
|
|
724
759
|
_chunkUSNT2KNTcjs.__name.call(void 0, normalizeString, "normalizeString");
|
|
725
760
|
|
|
726
|
-
// ../path/src/regex.ts
|
|
727
|
-
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
728
|
-
|
|
729
|
-
// ../path/src/slash.ts
|
|
730
|
-
function slash(path) {
|
|
731
|
-
if (path.startsWith("\\\\?\\")) {
|
|
732
|
-
return path;
|
|
733
|
-
}
|
|
734
|
-
return path.replace(/\\/g, "/");
|
|
735
|
-
}
|
|
736
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, slash, "slash");
|
|
737
|
-
|
|
738
761
|
// ../path/src/correct-path.ts
|
|
739
762
|
function normalizeWindowsPath2(input = "") {
|
|
740
763
|
if (!input) {
|
|
@@ -743,19 +766,67 @@ function normalizeWindowsPath2(input = "") {
|
|
|
743
766
|
return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
744
767
|
}
|
|
745
768
|
_chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath2, "normalizeWindowsPath");
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
769
|
+
function normalizeString2(path, allowAboveRoot) {
|
|
770
|
+
let res = "";
|
|
771
|
+
let lastSegmentLength = 0;
|
|
772
|
+
let lastSlash = -1;
|
|
773
|
+
let dots = 0;
|
|
774
|
+
let char = null;
|
|
775
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
776
|
+
if (index < path.length) {
|
|
777
|
+
char = path[index];
|
|
778
|
+
} else if (char === "/") {
|
|
779
|
+
break;
|
|
780
|
+
} else {
|
|
781
|
+
char = "/";
|
|
782
|
+
}
|
|
783
|
+
if (char === "/") {
|
|
784
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
785
|
+
} else if (dots === 2) {
|
|
786
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
787
|
+
if (res.length > 2) {
|
|
788
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
789
|
+
if (lastSlashIndex === -1) {
|
|
790
|
+
res = "";
|
|
791
|
+
lastSegmentLength = 0;
|
|
792
|
+
} else {
|
|
793
|
+
res = res.slice(0, lastSlashIndex);
|
|
794
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
795
|
+
}
|
|
796
|
+
lastSlash = index;
|
|
797
|
+
dots = 0;
|
|
798
|
+
continue;
|
|
799
|
+
} else if (res.length > 0) {
|
|
800
|
+
res = "";
|
|
801
|
+
lastSegmentLength = 0;
|
|
802
|
+
lastSlash = index;
|
|
803
|
+
dots = 0;
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
if (allowAboveRoot) {
|
|
808
|
+
res += res.length > 0 ? "/.." : "..";
|
|
809
|
+
lastSegmentLength = 2;
|
|
810
|
+
}
|
|
811
|
+
} else {
|
|
812
|
+
if (res.length > 0) {
|
|
813
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
814
|
+
} else {
|
|
815
|
+
res = path.slice(lastSlash + 1, index);
|
|
816
|
+
}
|
|
817
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
818
|
+
}
|
|
819
|
+
lastSlash = index;
|
|
820
|
+
dots = 0;
|
|
821
|
+
} else if (char === "." && dots !== -1) {
|
|
822
|
+
++dots;
|
|
823
|
+
} else {
|
|
824
|
+
dots = -1;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
return res;
|
|
828
|
+
}
|
|
829
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, normalizeString2, "normalizeString");
|
|
759
830
|
|
|
760
831
|
// ../path/src/file-path-fns.ts
|
|
761
832
|
function findFileName(filePath, options = {}) {
|
|
@@ -778,8 +849,49 @@ function findFilePath(filePath) {
|
|
|
778
849
|
return result === "/" ? result : result.replace(/\/$/, "");
|
|
779
850
|
}
|
|
780
851
|
_chunkUSNT2KNTcjs.__name.call(void 0, findFilePath, "findFilePath");
|
|
852
|
+
function resolve(...paths) {
|
|
853
|
+
paths = paths.map((argument) => normalizeWindowsPath2(argument));
|
|
854
|
+
let resolvedPath = "";
|
|
855
|
+
let resolvedAbsolute = false;
|
|
856
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
857
|
+
const path = index >= 0 ? paths[index] : cwd();
|
|
858
|
+
if (!path || path.length === 0) {
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
862
|
+
resolvedAbsolute = isAbsolute(path);
|
|
863
|
+
}
|
|
864
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
865
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
866
|
+
return `/${resolvedPath}`;
|
|
867
|
+
}
|
|
868
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
869
|
+
}
|
|
870
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, resolve, "resolve");
|
|
871
|
+
function relative(from, to) {
|
|
872
|
+
const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
873
|
+
const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
874
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
875
|
+
return _to.join("/");
|
|
876
|
+
}
|
|
877
|
+
const _fromCopy = [
|
|
878
|
+
..._from
|
|
879
|
+
];
|
|
880
|
+
for (const segment of _fromCopy) {
|
|
881
|
+
if (_to[0] !== segment) {
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
_from.shift();
|
|
885
|
+
_to.shift();
|
|
886
|
+
}
|
|
887
|
+
return [
|
|
888
|
+
..._from.map(() => ".."),
|
|
889
|
+
..._to
|
|
890
|
+
].join("/");
|
|
891
|
+
}
|
|
892
|
+
_chunkUSNT2KNTcjs.__name.call(void 0, relative, "relative");
|
|
781
893
|
function relativePath(from, to, withEndSlash = false) {
|
|
782
|
-
return
|
|
894
|
+
return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
|
|
783
895
|
}
|
|
784
896
|
_chunkUSNT2KNTcjs.__name.call(void 0, relativePath, "relativePath");
|
|
785
897
|
|
|
@@ -840,7 +952,7 @@ async function resolveOptions(options) {
|
|
|
840
952
|
if (options.tsconfig) {
|
|
841
953
|
resolvedTsconfig = options.tsconfig;
|
|
842
954
|
} else {
|
|
843
|
-
if (!tsconfigPath || !
|
|
955
|
+
if (!tsconfigPath || !existsSync(tsconfigPath)) {
|
|
844
956
|
const errorMessage = tsconfigPath ? `\u2716 The specified TypeScript configuration file "${tsconfigPath}" does not exist. Please provide a valid path.` : "\u2716 The specified TypeScript configuration file does not exist. Please provide a valid path.";
|
|
845
957
|
_console.writeFatal.call(void 0, errorMessage, {
|
|
846
958
|
logLevel: "all"
|
|
@@ -893,4 +1005,4 @@ _chunkUSNT2KNTcjs.__name.call(void 0, resolveOptions, "resolveOptions");
|
|
|
893
1005
|
|
|
894
1006
|
|
|
895
1007
|
|
|
896
|
-
exports.existsSync =
|
|
1008
|
+
exports.existsSync = existsSync; exports.resolveOptions = resolveOptions;
|
|
@@ -1,7 +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
|
-
var
|
|
4
|
+
var _chunkEKDPJ4VYcjs = require('./chunk-EKDPJ4VY.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -4053,10 +4053,10 @@ async function capnpc(options) {
|
|
|
4053
4053
|
}
|
|
4054
4054
|
if (dataBuf.byteLength === 0) {
|
|
4055
4055
|
const opts = [];
|
|
4056
|
-
if (output &&
|
|
4056
|
+
if (output && _chunkEKDPJ4VYcjs.existsSync.call(void 0, output)) {
|
|
4057
4057
|
opts.push(`-o-:${output}`);
|
|
4058
4058
|
} else {
|
|
4059
|
-
if (output && !
|
|
4059
|
+
if (output && !_chunkEKDPJ4VYcjs.existsSync.call(void 0, output)) {
|
|
4060
4060
|
_console.writeWarning.call(void 0, `Output directory "${output}" does not exist, will write to schema path...`);
|
|
4061
4061
|
}
|
|
4062
4062
|
opts.push("-o-");
|
|
@@ -4084,7 +4084,7 @@ async function capnpc(options) {
|
|
|
4084
4084
|
}
|
|
4085
4085
|
_chunkUSNT2KNTcjs.__name.call(void 0, capnpc, "capnpc");
|
|
4086
4086
|
async function compile(dataBuf, options) {
|
|
4087
|
-
const resolvedOptions = await
|
|
4087
|
+
const resolvedOptions = await _chunkEKDPJ4VYcjs.resolveOptions.call(void 0, options);
|
|
4088
4088
|
if (!resolvedOptions) {
|
|
4089
4089
|
_console.writeWarning.call(void 0, "\u2716 Unable to resolve Cap'n Proto compiler options - the program will terminate", {
|
|
4090
4090
|
logLevel: "all"
|
|
@@ -14,6 +14,14 @@ function toArray(array) {
|
|
|
14
14
|
}
|
|
15
15
|
__name(toArray, "toArray");
|
|
16
16
|
|
|
17
|
+
// ../fs/src/exists.ts
|
|
18
|
+
import { existsSync as existsSyncFs } from "node:fs";
|
|
19
|
+
import { access, constants } from "node:fs/promises";
|
|
20
|
+
function existsSync(filePath) {
|
|
21
|
+
return existsSyncFs(filePath);
|
|
22
|
+
}
|
|
23
|
+
__name(existsSync, "existsSync");
|
|
24
|
+
|
|
17
25
|
// ../type-checks/src/get-object-tag.ts
|
|
18
26
|
var getObjectTag = /* @__PURE__ */ __name((value) => {
|
|
19
27
|
if (value == null) {
|
|
@@ -578,7 +586,7 @@ var isError = /* @__PURE__ */ __name((obj) => {
|
|
|
578
586
|
}, "isError");
|
|
579
587
|
|
|
580
588
|
// ../fs/src/read-file.ts
|
|
581
|
-
import { existsSync, readFileSync as readFileSyncFs } from "node:fs";
|
|
589
|
+
import { existsSync as existsSync2, readFileSync as readFileSyncFs } from "node:fs";
|
|
582
590
|
import { readFile as readFileFs } from "node:fs/promises";
|
|
583
591
|
var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
584
592
|
try {
|
|
@@ -593,30 +601,55 @@ var readFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
|
593
601
|
}
|
|
594
602
|
}, "readFile");
|
|
595
603
|
|
|
596
|
-
// ../path/src/
|
|
597
|
-
|
|
604
|
+
// ../path/src/cwd.ts
|
|
605
|
+
function cwd() {
|
|
606
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
607
|
+
return process.cwd().replace(/\\/g, "/");
|
|
608
|
+
}
|
|
609
|
+
return "/";
|
|
610
|
+
}
|
|
611
|
+
__name(cwd, "cwd");
|
|
612
|
+
|
|
613
|
+
// ../path/src/regex.ts
|
|
614
|
+
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
615
|
+
var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
|
|
616
|
+
var UNC_REGEX = /^[/\\]{2}/;
|
|
617
|
+
var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
|
|
618
|
+
var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
|
|
619
|
+
|
|
620
|
+
// ../path/src/slash.ts
|
|
621
|
+
function slash(path) {
|
|
622
|
+
if (path.startsWith("\\\\?\\")) {
|
|
623
|
+
return path;
|
|
624
|
+
}
|
|
625
|
+
return path.replace(/\\/g, "/");
|
|
626
|
+
}
|
|
627
|
+
__name(slash, "slash");
|
|
628
|
+
|
|
629
|
+
// ../path/src/is-type.ts
|
|
630
|
+
function isAbsolutePath(path) {
|
|
631
|
+
return ABSOLUTE_PATH_REGEX.test(slash(path));
|
|
632
|
+
}
|
|
633
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
634
|
+
function isAbsolute(path) {
|
|
635
|
+
return isAbsolutePath(path);
|
|
636
|
+
}
|
|
637
|
+
__name(isAbsolute, "isAbsolute");
|
|
598
638
|
|
|
599
639
|
// ../path/src/join-paths.ts
|
|
600
|
-
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
601
640
|
function normalizeWindowsPath(input = "") {
|
|
602
641
|
if (!input) {
|
|
603
642
|
return input;
|
|
604
643
|
}
|
|
605
|
-
return input.replace(/\\/g, "/").replace(
|
|
644
|
+
return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
606
645
|
}
|
|
607
646
|
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
608
|
-
|
|
609
|
-
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
|
|
610
|
-
var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
|
|
611
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
612
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
613
|
-
}, "isAbsolute");
|
|
614
|
-
var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
647
|
+
function correctPaths(path) {
|
|
615
648
|
if (!path || path.length === 0) {
|
|
616
649
|
return ".";
|
|
617
650
|
}
|
|
618
651
|
path = normalizeWindowsPath(path);
|
|
619
|
-
const isUNCPath = path.match(
|
|
652
|
+
const isUNCPath = path.match(UNC_REGEX);
|
|
620
653
|
const isPathAbsolute = isAbsolute(path);
|
|
621
654
|
const trailingSeparator = path[path.length - 1] === "/";
|
|
622
655
|
path = normalizeString(path, !isPathAbsolute);
|
|
@@ -629,7 +662,7 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
629
662
|
if (trailingSeparator) {
|
|
630
663
|
path += "/";
|
|
631
664
|
}
|
|
632
|
-
if (
|
|
665
|
+
if (DRIVE_LETTER_REGEX.test(path)) {
|
|
633
666
|
path += "/";
|
|
634
667
|
}
|
|
635
668
|
if (isUNCPath) {
|
|
@@ -639,8 +672,9 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
639
672
|
return `//${path}`;
|
|
640
673
|
}
|
|
641
674
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
642
|
-
}
|
|
643
|
-
|
|
675
|
+
}
|
|
676
|
+
__name(correctPaths, "correctPaths");
|
|
677
|
+
function joinPaths(...segments) {
|
|
644
678
|
let path = "";
|
|
645
679
|
for (const seg of segments) {
|
|
646
680
|
if (!seg) {
|
|
@@ -660,7 +694,8 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
660
694
|
}
|
|
661
695
|
}
|
|
662
696
|
return correctPaths(path);
|
|
663
|
-
}
|
|
697
|
+
}
|
|
698
|
+
__name(joinPaths, "joinPaths");
|
|
664
699
|
function normalizeString(path, allowAboveRoot) {
|
|
665
700
|
let res = "";
|
|
666
701
|
let lastSegmentLength = 0;
|
|
@@ -723,18 +758,6 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
723
758
|
}
|
|
724
759
|
__name(normalizeString, "normalizeString");
|
|
725
760
|
|
|
726
|
-
// ../path/src/regex.ts
|
|
727
|
-
var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
|
|
728
|
-
|
|
729
|
-
// ../path/src/slash.ts
|
|
730
|
-
function slash(path) {
|
|
731
|
-
if (path.startsWith("\\\\?\\")) {
|
|
732
|
-
return path;
|
|
733
|
-
}
|
|
734
|
-
return path.replace(/\\/g, "/");
|
|
735
|
-
}
|
|
736
|
-
__name(slash, "slash");
|
|
737
|
-
|
|
738
761
|
// ../path/src/correct-path.ts
|
|
739
762
|
function normalizeWindowsPath2(input = "") {
|
|
740
763
|
if (!input) {
|
|
@@ -743,19 +766,67 @@ function normalizeWindowsPath2(input = "") {
|
|
|
743
766
|
return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
|
|
744
767
|
}
|
|
745
768
|
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
769
|
+
function normalizeString2(path, allowAboveRoot) {
|
|
770
|
+
let res = "";
|
|
771
|
+
let lastSegmentLength = 0;
|
|
772
|
+
let lastSlash = -1;
|
|
773
|
+
let dots = 0;
|
|
774
|
+
let char = null;
|
|
775
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
776
|
+
if (index < path.length) {
|
|
777
|
+
char = path[index];
|
|
778
|
+
} else if (char === "/") {
|
|
779
|
+
break;
|
|
780
|
+
} else {
|
|
781
|
+
char = "/";
|
|
782
|
+
}
|
|
783
|
+
if (char === "/") {
|
|
784
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
785
|
+
} else if (dots === 2) {
|
|
786
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
787
|
+
if (res.length > 2) {
|
|
788
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
789
|
+
if (lastSlashIndex === -1) {
|
|
790
|
+
res = "";
|
|
791
|
+
lastSegmentLength = 0;
|
|
792
|
+
} else {
|
|
793
|
+
res = res.slice(0, lastSlashIndex);
|
|
794
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
795
|
+
}
|
|
796
|
+
lastSlash = index;
|
|
797
|
+
dots = 0;
|
|
798
|
+
continue;
|
|
799
|
+
} else if (res.length > 0) {
|
|
800
|
+
res = "";
|
|
801
|
+
lastSegmentLength = 0;
|
|
802
|
+
lastSlash = index;
|
|
803
|
+
dots = 0;
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
if (allowAboveRoot) {
|
|
808
|
+
res += res.length > 0 ? "/.." : "..";
|
|
809
|
+
lastSegmentLength = 2;
|
|
810
|
+
}
|
|
811
|
+
} else {
|
|
812
|
+
if (res.length > 0) {
|
|
813
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
814
|
+
} else {
|
|
815
|
+
res = path.slice(lastSlash + 1, index);
|
|
816
|
+
}
|
|
817
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
818
|
+
}
|
|
819
|
+
lastSlash = index;
|
|
820
|
+
dots = 0;
|
|
821
|
+
} else if (char === "." && dots !== -1) {
|
|
822
|
+
++dots;
|
|
823
|
+
} else {
|
|
824
|
+
dots = -1;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
return res;
|
|
828
|
+
}
|
|
829
|
+
__name(normalizeString2, "normalizeString");
|
|
759
830
|
|
|
760
831
|
// ../path/src/file-path-fns.ts
|
|
761
832
|
function findFileName(filePath, options = {}) {
|
|
@@ -778,6 +849,47 @@ function findFilePath(filePath) {
|
|
|
778
849
|
return result === "/" ? result : result.replace(/\/$/, "");
|
|
779
850
|
}
|
|
780
851
|
__name(findFilePath, "findFilePath");
|
|
852
|
+
function resolve(...paths) {
|
|
853
|
+
paths = paths.map((argument) => normalizeWindowsPath2(argument));
|
|
854
|
+
let resolvedPath = "";
|
|
855
|
+
let resolvedAbsolute = false;
|
|
856
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
857
|
+
const path = index >= 0 ? paths[index] : cwd();
|
|
858
|
+
if (!path || path.length === 0) {
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
862
|
+
resolvedAbsolute = isAbsolute(path);
|
|
863
|
+
}
|
|
864
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
865
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
866
|
+
return `/${resolvedPath}`;
|
|
867
|
+
}
|
|
868
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
869
|
+
}
|
|
870
|
+
__name(resolve, "resolve");
|
|
871
|
+
function relative(from, to) {
|
|
872
|
+
const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
873
|
+
const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
|
|
874
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
875
|
+
return _to.join("/");
|
|
876
|
+
}
|
|
877
|
+
const _fromCopy = [
|
|
878
|
+
..._from
|
|
879
|
+
];
|
|
880
|
+
for (const segment of _fromCopy) {
|
|
881
|
+
if (_to[0] !== segment) {
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
_from.shift();
|
|
885
|
+
_to.shift();
|
|
886
|
+
}
|
|
887
|
+
return [
|
|
888
|
+
..._from.map(() => ".."),
|
|
889
|
+
..._to
|
|
890
|
+
].join("/");
|
|
891
|
+
}
|
|
892
|
+
__name(relative, "relative");
|
|
781
893
|
function relativePath(from, to, withEndSlash = false) {
|
|
782
894
|
return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
|
|
783
895
|
}
|
|
@@ -840,7 +952,7 @@ async function resolveOptions(options) {
|
|
|
840
952
|
if (options.tsconfig) {
|
|
841
953
|
resolvedTsconfig = options.tsconfig;
|
|
842
954
|
} else {
|
|
843
|
-
if (!tsconfigPath || !
|
|
955
|
+
if (!tsconfigPath || !existsSync(tsconfigPath)) {
|
|
844
956
|
const errorMessage = tsconfigPath ? `\u2716 The specified TypeScript configuration file "${tsconfigPath}" does not exist. Please provide a valid path.` : "\u2716 The specified TypeScript configuration file does not exist. Please provide a valid path.";
|
|
845
957
|
writeFatal(errorMessage, {
|
|
846
958
|
logLevel: "all"
|
|
@@ -891,6 +1003,6 @@ async function resolveOptions(options) {
|
|
|
891
1003
|
__name(resolveOptions, "resolveOptions");
|
|
892
1004
|
|
|
893
1005
|
export {
|
|
894
|
-
|
|
1006
|
+
existsSync,
|
|
895
1007
|
resolveOptions
|
|
896
1008
|
};
|
package/dist/compile.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var _chunkHNO4Q6XIcjs = require('./chunk-HNO4Q6XI.cjs');
|
|
5
|
+
require('./chunk-EKDPJ4VY.cjs');
|
|
6
6
|
require('./chunk-KXWOF6H4.cjs');
|
|
7
7
|
require('./chunk-USNT2KNT.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.capnpc =
|
|
11
|
+
exports.capnpc = _chunkHNO4Q6XIcjs.capnpc; exports.compile = _chunkHNO4Q6XIcjs.compile;
|
package/dist/compile.js
CHANGED
package/dist/helpers.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkEKDPJ4VYcjs = require('./chunk-EKDPJ4VY.cjs');
|
|
4
4
|
require('./chunk-USNT2KNT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.resolveOptions =
|
|
7
|
+
exports.resolveOptions = _chunkEKDPJ4VYcjs.resolveOptions;
|