@gql.tada/cli-utils 1.9.2 → 1.9.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @gql.tada/cli-utils
2
2
 
3
+ ## 1.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Emit `turbo` cache entries and imports in a stable sorted order. The cache file's contents now only depend on the set of discovered documents rather than file traversal order, which keeps the output stable across refactors and reduces merge conflicts in committed cache files. Existing cache files will be reordered once when `gql-tada turbo` is next run
8
+ Submitted by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#579](https://github.com/0no-co/gql.tada/pull/579))
9
+ - Prevent non-interactive stdin and Ctrl-D/EOF bytes from terminating CLI commands with exit code 130
10
+ Submitted by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#578](https://github.com/0no-co/gql.tada/pull/578))
11
+ - Updated dependencies (See [#575](https://github.com/0no-co/gql.tada/pull/575))
12
+ - @gql.tada/internal@1.2.2
13
+
3
14
  ## 1.9.2
4
15
 
5
16
  ### Patch Changes
@@ -2769,7 +2769,7 @@ function initTTY(t = {}) {
2769
2769
  i = process.stderr;
2770
2770
  a = process.stdout;
2771
2771
  } else {
2772
- r = i.isTTY;
2772
+ r = r && !!i.isTTY;
2773
2773
  }
2774
2774
  var o = process.argv.includes("--color");
2775
2775
  var s = "FORCE_COLOR" in process.env || !process.env.NO_COLOR && !process.env.CI;
@@ -2791,7 +2791,6 @@ function initTTY(t = {}) {
2791
2791
  function onKeypress(t, n) {
2792
2792
  switch (n.name) {
2793
2793
  case "c":
2794
- case "d":
2795
2794
  case "x":
2796
2795
  if (n.ctrl) {
2797
2796
  return r();
@@ -2865,16 +2864,16 @@ function initTTY(t = {}) {
2865
2864
  i.write(text(...r));
2866
2865
  }
2867
2866
  },
2868
- start: function start(r) {
2867
+ start: function start(a) {
2869
2868
  var write = r => {
2870
2869
  if (!t.silent) {
2871
2870
  i.write("" + r);
2872
2871
  }
2873
2872
  };
2874
- if (t.disableTTY) {
2875
- return pipe(compose(r), onPush(write), toPromise);
2873
+ if (t.disableTTY || !r) {
2874
+ return pipe(compose(a), onPush(write), toPromise);
2876
2875
  } else {
2877
- return pipe(compose(r), onPush(write), takeUntil(c), toPromise);
2876
+ return pipe(compose(a), onPush(write), takeUntil(c), toPromise);
2878
2877
  }
2879
2878
  },
2880
2879
  mode: function mode(...t) {
@@ -4141,33 +4140,39 @@ function createCacheContents(t, a, n, i) {
4141
4140
  for (var l of t) {
4142
4141
  s.set(l.argumentKey, l);
4143
4142
  }
4144
- var c = "";
4145
- for (var d of s.values()) {
4146
- if (c) {
4147
- c += "\n";
4148
- }
4149
- if (d.documentHash) {
4150
- c += ` /** @gql.tada/hash ${d.documentHash} */\n`;
4151
- }
4152
- c += ` ${d.argumentKey}:\n ${d.documentType};`;
4153
- }
4154
- var f = "import type { TadaDocumentNode, $tada } from 'gql.tada';\n";
4155
- var p = "string" == typeof n || n && "object" == typeof n && "toString" in n && !("writable" in n);
4156
- var h = new Set;
4157
- for (var g of a) {
4158
- for (var v of g.imports) {
4159
- if (p) {
4160
- var m = n.toString();
4161
- var y = u.dirname(g.absolutePath);
4162
- if (u.resolve(y, v.specifier) === u.resolve(m) || h.has(v.specifier)) {
4143
+ var c = [ ...s.values() ].sort(((t, r) => compareUtf16(t.argumentKey, r.argumentKey)));
4144
+ var d = "";
4145
+ for (var f of c) {
4146
+ if (d) {
4147
+ d += "\n";
4148
+ }
4149
+ if (f.documentHash) {
4150
+ d += ` /** @gql.tada/hash ${f.documentHash} */\n`;
4151
+ }
4152
+ d += ` ${f.argumentKey}:\n ${f.documentType};`;
4153
+ }
4154
+ var p = "import type { TadaDocumentNode, $tada } from 'gql.tada';\n";
4155
+ var h = "string" == typeof n || n && "object" == typeof n && "toString" in n && !("writable" in n);
4156
+ var g = [ ...a ].sort(((t, r) => compareUtf16(t.absolutePath, r.absolutePath)));
4157
+ var v = new Set;
4158
+ for (var m of g) {
4159
+ for (var y of m.imports) {
4160
+ if (h) {
4161
+ var w = n.toString();
4162
+ var S = u.dirname(m.absolutePath);
4163
+ if (u.resolve(S, y.specifier) === u.resolve(w) || v.has(y.specifier)) {
4163
4164
  continue;
4164
4165
  }
4165
- h.add(v.specifier);
4166
+ v.add(y.specifier);
4166
4167
  }
4167
- f += v.importClause + "\n";
4168
+ p += y.importClause + "\n";
4168
4169
  }
4169
4170
  }
4170
- return o + f + "\ndeclare module 'gql.tada' {\n interface setupCache {\n" + c + "\n }\n}\n";
4171
+ return o + p + "\ndeclare module 'gql.tada' {\n interface setupCache {\n" + d + "\n }\n}\n";
4172
+ }
4173
+
4174
+ function compareUtf16(t, r) {
4175
+ return t < r ? -1 : t > r ? 1 : 0;
4171
4176
  }
4172
4177
 
4173
4178
  class TurboCommand extends Command {