@gql.tada/cli-utils 1.9.1 → 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,29 @@
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
+
14
+ ## 1.9.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Bump to `@0no-co/graphqlsp@^1.17.3` to include go-to-definition support
19
+ Submitted by [@kitten](https://github.com/kitten) (See [#569](https://github.com/0no-co/gql.tada/pull/569))
20
+ - ⚠️ Fix teardown of interactive CLI keyhandlers on Node 24 with non-interactive stdin stream
21
+ Submitted by [@kitten](https://github.com/kitten) (See [#566](https://github.com/0no-co/gql.tada/pull/566))
22
+ - Refine how `references` are walked and when they conflict. We should only check references if we haven't yet found a plugin entry, and allow duplicate entries, if their output locations don't conflict
23
+ Submitted by [@kitten](https://github.com/kitten) (See [#568](https://github.com/0no-co/gql.tada/pull/568))
24
+ - Updated dependencies (See [#568](https://github.com/0no-co/gql.tada/pull/568))
25
+ - @gql.tada/internal@1.2.1
26
+
3
27
  ## 1.9.1
4
28
 
5
29
  ### 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();
@@ -2807,12 +2806,17 @@ function initTTY(t = {}) {
2807
2806
  });
2808
2807
  }
2809
2808
  function cleanup() {
2810
- if (t.isTTY) {
2811
- t.setRawMode(!1);
2809
+ try {
2810
+ if (t.isTTY) {
2811
+ t.setRawMode(!1);
2812
+ }
2813
+ t.removeListener("keypress", onKeypress);
2814
+ if ("function" == typeof t.unref) {
2815
+ t.unref();
2816
+ }
2817
+ } catch {} finally {
2818
+ a.complete();
2812
2819
  }
2813
- a.complete();
2814
- t.removeListener("keypress", onKeypress);
2815
- t.unref();
2816
2820
  }
2817
2821
  if (t.isTTY) {
2818
2822
  t.setRawMode(!0);
@@ -2860,16 +2864,16 @@ function initTTY(t = {}) {
2860
2864
  i.write(text(...r));
2861
2865
  }
2862
2866
  },
2863
- start: function start(r) {
2867
+ start: function start(a) {
2864
2868
  var write = r => {
2865
2869
  if (!t.silent) {
2866
2870
  i.write("" + r);
2867
2871
  }
2868
2872
  };
2869
- if (t.disableTTY) {
2870
- return pipe(compose(r), onPush(write), toPromise);
2873
+ if (t.disableTTY || !r) {
2874
+ return pipe(compose(a), onPush(write), toPromise);
2871
2875
  } else {
2872
- return pipe(compose(r), onPush(write), takeUntil(c), toPromise);
2876
+ return pipe(compose(a), onPush(write), takeUntil(c), toPromise);
2873
2877
  }
2874
2878
  },
2875
2879
  mode: function mode(...t) {
@@ -3072,14 +3076,27 @@ async function* run$6(t, r) {
3072
3076
  if (a.length > 1 && (r.output || t.pipeTo)) {
3073
3077
  throw errorMessage$1("Output path was specified, while multiple projects are configured.\n" + hint(`You can only output all projects to their ${code('"tadaOutputLocation"')} options\nwhen multiple projects are set up through ${code('"references"')}.`));
3074
3078
  }
3075
- for (var n of a) {
3079
+ var n = new Set;
3080
+ for (var i of a) {
3081
+ var o = outputDestinations(i);
3082
+ if (o.length && o.every((t => n.has(t)))) {
3083
+ continue;
3084
+ }
3085
+ for (var s of o) {
3086
+ n.add(s);
3087
+ }
3076
3088
  if (a.length > 1) {
3077
- yield projectHeader(n.label);
3089
+ yield projectHeader(i.label);
3078
3090
  }
3079
- yield* runProject$3(t, r, n);
3091
+ yield* runProject$3(t, r, i);
3080
3092
  }
3081
3093
  }
3082
3094
 
3095
+ function outputDestinations(t) {
3096
+ var {pluginConfig: r, projectPath: a} = t;
3097
+ return ("schemas" in r ? r.schemas.map((t => t.tadaOutputLocation)) : [ r.tadaOutputLocation ]).filter((t => !!t)).map((t => u.resolve(a, t)));
3098
+ }
3099
+
3083
3100
  async function* runProject$3(t, a, n) {
3084
3101
  var {pluginConfig: i, projectPath: o} = n;
3085
3102
  var s = r.loadRef(i);
@@ -4123,33 +4140,39 @@ function createCacheContents(t, a, n, i) {
4123
4140
  for (var l of t) {
4124
4141
  s.set(l.argumentKey, l);
4125
4142
  }
4126
- var c = "";
4127
- for (var d of s.values()) {
4128
- if (c) {
4129
- c += "\n";
4130
- }
4131
- if (d.documentHash) {
4132
- c += ` /** @gql.tada/hash ${d.documentHash} */\n`;
4133
- }
4134
- c += ` ${d.argumentKey}:\n ${d.documentType};`;
4135
- }
4136
- var f = "import type { TadaDocumentNode, $tada } from 'gql.tada';\n";
4137
- var p = "string" == typeof n || n && "object" == typeof n && "toString" in n && !("writable" in n);
4138
- var h = new Set;
4139
- for (var g of a) {
4140
- for (var v of g.imports) {
4141
- if (p) {
4142
- var m = n.toString();
4143
- var y = u.dirname(g.absolutePath);
4144
- 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)) {
4145
4164
  continue;
4146
4165
  }
4147
- h.add(v.specifier);
4166
+ v.add(y.specifier);
4148
4167
  }
4149
- f += v.importClause + "\n";
4168
+ p += y.importClause + "\n";
4150
4169
  }
4151
4170
  }
4152
- 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;
4153
4176
  }
4154
4177
 
4155
4178
  class TurboCommand extends Command {