@donezone/cli 0.1.48 → 0.1.49

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.
Binary file
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ var require_constants = __commonJS((exports, module) => {
34
34
  var path = __require("path");
35
35
  var WIN_SLASH = "\\\\/";
36
36
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
37
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
37
38
  var DOT_LITERAL = "\\.";
38
39
  var PLUS_LITERAL = "\\+";
39
40
  var QMARK_LITERAL = "\\?";
@@ -81,6 +82,7 @@ var require_constants = __commonJS((exports, module) => {
81
82
  END_ANCHOR: `(?:[${WIN_SLASH}]|\$)`
82
83
  };
83
84
  var POSIX_REGEX_SOURCE = {
85
+ __proto__: null,
84
86
  alnum: "a-zA-Z0-9",
85
87
  alpha: "a-zA-Z",
86
88
  ascii: "\\x00-\\x7F",
@@ -97,6 +99,7 @@ var require_constants = __commonJS((exports, module) => {
97
99
  xdigit: "A-Fa-f0-9"
98
100
  };
99
101
  module.exports = {
102
+ DEFAULT_MAX_EXTGLOB_RECURSION,
100
103
  MAX_LENGTH: 1024 * 64,
101
104
  POSIX_REGEX_SOURCE,
102
105
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
@@ -106,6 +109,7 @@ var require_constants = __commonJS((exports, module) => {
106
109
  REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
107
110
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
108
111
  REPLACEMENTS: {
112
+ __proto__: null,
109
113
  "***": "*",
110
114
  "**/**": "**",
111
115
  "**/**/**": "**"
@@ -571,6 +575,213 @@ var require_parse = __commonJS((exports, module) => {
571
575
  var syntaxError = (type, char) => {
572
576
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
573
577
  };
578
+ var splitTopLevel = (input) => {
579
+ const parts = [];
580
+ let bracket = 0;
581
+ let paren = 0;
582
+ let quote = 0;
583
+ let value = "";
584
+ let escaped = false;
585
+ for (const ch of input) {
586
+ if (escaped === true) {
587
+ value += ch;
588
+ escaped = false;
589
+ continue;
590
+ }
591
+ if (ch === "\\") {
592
+ value += ch;
593
+ escaped = true;
594
+ continue;
595
+ }
596
+ if (ch === '"') {
597
+ quote = quote === 1 ? 0 : 1;
598
+ value += ch;
599
+ continue;
600
+ }
601
+ if (quote === 0) {
602
+ if (ch === "[") {
603
+ bracket++;
604
+ } else if (ch === "]" && bracket > 0) {
605
+ bracket--;
606
+ } else if (bracket === 0) {
607
+ if (ch === "(") {
608
+ paren++;
609
+ } else if (ch === ")" && paren > 0) {
610
+ paren--;
611
+ } else if (ch === "|" && paren === 0) {
612
+ parts.push(value);
613
+ value = "";
614
+ continue;
615
+ }
616
+ }
617
+ }
618
+ value += ch;
619
+ }
620
+ parts.push(value);
621
+ return parts;
622
+ };
623
+ var isPlainBranch = (branch) => {
624
+ let escaped = false;
625
+ for (const ch of branch) {
626
+ if (escaped === true) {
627
+ escaped = false;
628
+ continue;
629
+ }
630
+ if (ch === "\\") {
631
+ escaped = true;
632
+ continue;
633
+ }
634
+ if (/[?*+@!()[\]{}]/.test(ch)) {
635
+ return false;
636
+ }
637
+ }
638
+ return true;
639
+ };
640
+ var normalizeSimpleBranch = (branch) => {
641
+ let value = branch.trim();
642
+ let changed = true;
643
+ while (changed === true) {
644
+ changed = false;
645
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
646
+ value = value.slice(2, -1);
647
+ changed = true;
648
+ }
649
+ }
650
+ if (!isPlainBranch(value)) {
651
+ return;
652
+ }
653
+ return value.replace(/\\(.)/g, "$1");
654
+ };
655
+ var hasRepeatedCharPrefixOverlap = (branches) => {
656
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
657
+ for (let i = 0;i < values.length; i++) {
658
+ for (let j = i + 1;j < values.length; j++) {
659
+ const a = values[i];
660
+ const b = values[j];
661
+ const char = a[0];
662
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
663
+ continue;
664
+ }
665
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
666
+ return true;
667
+ }
668
+ }
669
+ }
670
+ return false;
671
+ };
672
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
673
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
674
+ return;
675
+ }
676
+ let bracket = 0;
677
+ let paren = 0;
678
+ let quote = 0;
679
+ let escaped = false;
680
+ for (let i = 1;i < pattern.length; i++) {
681
+ const ch = pattern[i];
682
+ if (escaped === true) {
683
+ escaped = false;
684
+ continue;
685
+ }
686
+ if (ch === "\\") {
687
+ escaped = true;
688
+ continue;
689
+ }
690
+ if (ch === '"') {
691
+ quote = quote === 1 ? 0 : 1;
692
+ continue;
693
+ }
694
+ if (quote === 1) {
695
+ continue;
696
+ }
697
+ if (ch === "[") {
698
+ bracket++;
699
+ continue;
700
+ }
701
+ if (ch === "]" && bracket > 0) {
702
+ bracket--;
703
+ continue;
704
+ }
705
+ if (bracket > 0) {
706
+ continue;
707
+ }
708
+ if (ch === "(") {
709
+ paren++;
710
+ continue;
711
+ }
712
+ if (ch === ")") {
713
+ paren--;
714
+ if (paren === 0) {
715
+ if (requireEnd === true && i !== pattern.length - 1) {
716
+ return;
717
+ }
718
+ return {
719
+ type: pattern[0],
720
+ body: pattern.slice(2, i),
721
+ end: i
722
+ };
723
+ }
724
+ }
725
+ }
726
+ };
727
+ var getStarExtglobSequenceOutput = (pattern) => {
728
+ let index = 0;
729
+ const chars = [];
730
+ while (index < pattern.length) {
731
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
732
+ if (!match || match.type !== "*") {
733
+ return;
734
+ }
735
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
736
+ if (branches.length !== 1) {
737
+ return;
738
+ }
739
+ const branch = normalizeSimpleBranch(branches[0]);
740
+ if (!branch || branch.length !== 1) {
741
+ return;
742
+ }
743
+ chars.push(branch);
744
+ index += match.end + 1;
745
+ }
746
+ if (chars.length < 1) {
747
+ return;
748
+ }
749
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
750
+ return `${source}*`;
751
+ };
752
+ var repeatedExtglobRecursion = (pattern) => {
753
+ let depth = 0;
754
+ let value = pattern.trim();
755
+ let match = parseRepeatedExtglob(value);
756
+ while (match) {
757
+ depth++;
758
+ value = match.body.trim();
759
+ match = parseRepeatedExtglob(value);
760
+ }
761
+ return depth;
762
+ };
763
+ var analyzeRepeatedExtglob = (body, options) => {
764
+ if (options.maxExtglobRecursion === false) {
765
+ return { risky: false };
766
+ }
767
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
768
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
769
+ if (branches.length > 1) {
770
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
771
+ return { risky: true };
772
+ }
773
+ }
774
+ for (const branch of branches) {
775
+ const safeOutput = getStarExtglobSequenceOutput(branch);
776
+ if (safeOutput) {
777
+ return { risky: true, safeOutput };
778
+ }
779
+ if (repeatedExtglobRecursion(branch) > max) {
780
+ return { risky: true };
781
+ }
782
+ }
783
+ return { risky: false };
784
+ };
574
785
  var parse = (input, options) => {
575
786
  if (typeof input !== "string") {
576
787
  throw new TypeError("Expected a string");
@@ -703,6 +914,8 @@ var require_parse = __commonJS((exports, module) => {
703
914
  token.prev = prev;
704
915
  token.parens = state.parens;
705
916
  token.output = state.output;
917
+ token.startIndex = state.index;
918
+ token.tokensIndex = tokens.length;
706
919
  const output = (opts.capture ? "(" : "") + token.open;
707
920
  increment("parens");
708
921
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -710,6 +923,26 @@ var require_parse = __commonJS((exports, module) => {
710
923
  extglobs.push(token);
711
924
  };
712
925
  const extglobClose = (token) => {
926
+ const literal = input.slice(token.startIndex, state.index + 1);
927
+ const body = input.slice(token.startIndex + 2, state.index);
928
+ const analysis = analyzeRepeatedExtglob(body, opts);
929
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
930
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
931
+ const open = tokens[token.tokensIndex];
932
+ open.type = "text";
933
+ open.value = literal;
934
+ open.output = safeOutput || utils.escapeRegex(literal);
935
+ for (let i = token.tokensIndex + 1;i < tokens.length; i++) {
936
+ tokens[i].value = "";
937
+ tokens[i].output = "";
938
+ delete tokens[i].suffix;
939
+ }
940
+ state.output = token.output + open.output;
941
+ state.backtrack = true;
942
+ push({ type: "paren", extglob: true, value, output: "" });
943
+ decrement("parens");
944
+ return;
945
+ }
713
946
  let output = token.close + (opts.capture ? ")" : "");
714
947
  let rest;
715
948
  if (token.type === "negate") {
@@ -28864,7 +29097,7 @@ class DoneLocalChain {
28864
29097
  buildEnv(address, override) {
28865
29098
  const block = {
28866
29099
  height: this.blockHeight,
28867
- time: this.blockTime.toString(),
29100
+ time: (BigInt(this.blockTime) * 1000000000n).toString(),
28868
29101
  chain_id: this.chainId
28869
29102
  };
28870
29103
  if (override?.block) {
@@ -43545,7 +43778,7 @@ var sharedRouteSchemas = {
43545
43778
  };
43546
43779
  // ../done-http-local/src/server.ts
43547
43780
  async function createDoneHttpLocalServer(config, chain) {
43548
- const runtime = chain ?? loadChainWithArtifacts();
43781
+ const runtime = chain ?? new DoneLocalChain;
43549
43782
  if (config.scriptPath) {
43550
43783
  await deployJsContract({
43551
43784
  chain: runtime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donezone/cli",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "doneZoneVersion": "0.1.41",
5
5
  "doneClientVersion": "0.1.41",
6
6
  "private": false,