@valbuild/init 0.87.3 → 0.87.4

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.
@@ -8,306 +8,114 @@ import j from 'jscodeshift';
8
8
  import { diffLines } from 'diff';
9
9
  import semver from 'semver';
10
10
 
11
- function _regeneratorRuntime() {
12
- _regeneratorRuntime = function () {
13
- return e;
14
- };
15
- var t,
16
- e = {},
17
- r = Object.prototype,
18
- n = r.hasOwnProperty,
19
- o = Object.defineProperty || function (t, e, r) {
20
- t[e] = r.value;
21
- },
22
- i = "function" == typeof Symbol ? Symbol : {},
23
- a = i.iterator || "@@iterator",
24
- c = i.asyncIterator || "@@asyncIterator",
25
- u = i.toStringTag || "@@toStringTag";
26
- function define(t, e, r) {
27
- return Object.defineProperty(t, e, {
28
- value: r,
29
- enumerable: !0,
30
- configurable: !0,
31
- writable: !0
32
- }), t[e];
33
- }
11
+ function _regeneratorDefine(e, r, n, t) {
12
+ var i = Object.defineProperty;
34
13
  try {
35
- define({}, "");
36
- } catch (t) {
37
- define = function (t, e, r) {
38
- return t[e] = r;
39
- };
14
+ i({}, "", {});
15
+ } catch (e) {
16
+ i = 0;
40
17
  }
41
- function wrap(t, e, r, n) {
42
- var i = e && e.prototype instanceof Generator ? e : Generator,
43
- a = Object.create(i.prototype),
44
- c = new Context(n || []);
45
- return o(a, "_invoke", {
46
- value: makeInvokeMethod(t, r, c)
47
- }), a;
48
- }
49
- function tryCatch(t, e, r) {
50
- try {
51
- return {
52
- type: "normal",
53
- arg: t.call(e, r)
54
- };
55
- } catch (t) {
56
- return {
57
- type: "throw",
58
- arg: t
59
- };
60
- }
61
- }
62
- e.wrap = wrap;
63
- var h = "suspendedStart",
64
- l = "suspendedYield",
65
- f = "executing",
66
- s = "completed",
67
- y = {};
68
- function Generator() {}
69
- function GeneratorFunction() {}
70
- function GeneratorFunctionPrototype() {}
71
- var p = {};
72
- define(p, a, function () {
73
- return this;
74
- });
75
- var d = Object.getPrototypeOf,
76
- v = d && d(d(values([])));
77
- v && v !== r && n.call(v, a) && (p = v);
78
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
79
- function defineIteratorMethods(t) {
80
- ["next", "throw", "return"].forEach(function (e) {
81
- define(t, e, function (t) {
82
- return this._invoke(e, t);
18
+ _regeneratorDefine = function (e, r, n, t) {
19
+ function o(r, n) {
20
+ _regeneratorDefine(e, r, function (e) {
21
+ return this._invoke(r, n, e);
83
22
  });
84
- });
85
- }
86
- function AsyncIterator(t, e) {
87
- function invoke(r, o, i, a) {
88
- var c = tryCatch(t[r], t, o);
89
- if ("throw" !== c.type) {
90
- var u = c.arg,
91
- h = u.value;
92
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
93
- invoke("next", t, i, a);
94
- }, function (t) {
95
- invoke("throw", t, i, a);
96
- }) : e.resolve(h).then(function (t) {
97
- u.value = t, i(u);
98
- }, function (t) {
99
- return invoke("throw", t, i, a);
100
- });
101
- }
102
- a(c.arg);
103
23
  }
104
- var r;
105
- o(this, "_invoke", {
106
- value: function (t, n) {
107
- function callInvokeWithMethodAndArg() {
108
- return new e(function (e, r) {
109
- invoke(t, n, e, r);
110
- });
24
+ r ? i ? i(e, r, {
25
+ value: n,
26
+ enumerable: !t,
27
+ configurable: !t,
28
+ writable: !t
29
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
30
+ }, _regeneratorDefine(e, r, n, t);
31
+ }
32
+
33
+ function _regenerator() {
34
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
35
+ var e,
36
+ t,
37
+ r = "function" == typeof Symbol ? Symbol : {},
38
+ n = r.iterator || "@@iterator",
39
+ o = r.toStringTag || "@@toStringTag";
40
+ function i(r, n, o, i) {
41
+ var c = n && n.prototype instanceof Generator ? n : Generator,
42
+ u = Object.create(c.prototype);
43
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
44
+ var i,
45
+ c,
46
+ u,
47
+ f = 0,
48
+ p = o || [],
49
+ y = !1,
50
+ G = {
51
+ p: 0,
52
+ n: 0,
53
+ v: e,
54
+ a: d,
55
+ f: d.bind(e, 4),
56
+ d: function (t, r) {
57
+ return i = t, c = 0, u = e, G.n = r, a;
58
+ }
59
+ };
60
+ function d(r, n) {
61
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
62
+ var o,
63
+ i = p[t],
64
+ d = G.p,
65
+ l = i[2];
66
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
111
67
  }
112
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
68
+ if (o || r > 1) return a;
69
+ throw y = !0, n;
113
70
  }
114
- });
115
- }
116
- function makeInvokeMethod(e, r, n) {
117
- var o = h;
118
- return function (i, a) {
119
- if (o === f) throw Error("Generator is already running");
120
- if (o === s) {
121
- if ("throw" === i) throw a;
71
+ return function (o, p, l) {
72
+ if (f > 1) throw TypeError("Generator is already running");
73
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
74
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
75
+ try {
76
+ if (f = 2, i) {
77
+ if (c || (o = "next"), t = i[o]) {
78
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
79
+ if (!t.done) return t;
80
+ u = t.value, c < 2 && (c = 0);
81
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
82
+ i = e;
83
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
84
+ } catch (t) {
85
+ i = e, c = 1, u = t;
86
+ } finally {
87
+ f = 1;
88
+ }
89
+ }
122
90
  return {
123
91
  value: t,
124
- done: !0
92
+ done: y
125
93
  };
126
- }
127
- for (n.method = i, n.arg = a;;) {
128
- var c = n.delegate;
129
- if (c) {
130
- var u = maybeInvokeDelegate(c, n);
131
- if (u) {
132
- if (u === y) continue;
133
- return u;
134
- }
135
- }
136
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
137
- if (o === h) throw o = s, n.arg;
138
- n.dispatchException(n.arg);
139
- } else "return" === n.method && n.abrupt("return", n.arg);
140
- o = f;
141
- var p = tryCatch(e, r, n);
142
- if ("normal" === p.type) {
143
- if (o = n.done ? s : l, p.arg === y) continue;
144
- return {
145
- value: p.arg,
146
- done: n.done
147
- };
148
- }
149
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
150
- }
151
- };
152
- }
153
- function maybeInvokeDelegate(e, r) {
154
- var n = r.method,
155
- o = e.iterator[n];
156
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
157
- var i = tryCatch(o, e.iterator, r.arg);
158
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
159
- var a = i.arg;
160
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
161
- }
162
- function pushTryEntry(t) {
163
- var e = {
164
- tryLoc: t[0]
165
- };
166
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
167
- }
168
- function resetTryEntry(t) {
169
- var e = t.completion || {};
170
- e.type = "normal", delete e.arg, t.completion = e;
171
- }
172
- function Context(t) {
173
- this.tryEntries = [{
174
- tryLoc: "root"
175
- }], t.forEach(pushTryEntry, this), this.reset(!0);
94
+ };
95
+ }(r, o, i), !0), u;
176
96
  }
177
- function values(e) {
178
- if (e || "" === e) {
179
- var r = e[a];
180
- if (r) return r.call(e);
181
- if ("function" == typeof e.next) return e;
182
- if (!isNaN(e.length)) {
183
- var o = -1,
184
- i = function next() {
185
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
186
- return next.value = t, next.done = !0, next;
187
- };
188
- return i.next = i;
189
- }
190
- }
191
- throw new TypeError(typeof e + " is not iterable");
97
+ var a = {};
98
+ function Generator() {}
99
+ function GeneratorFunction() {}
100
+ function GeneratorFunctionPrototype() {}
101
+ t = Object.getPrototypeOf;
102
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
103
+ return this;
104
+ }), t),
105
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
106
+ function f(e) {
107
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
192
108
  }
193
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
194
- value: GeneratorFunctionPrototype,
195
- configurable: !0
196
- }), o(GeneratorFunctionPrototype, "constructor", {
197
- value: GeneratorFunction,
198
- configurable: !0
199
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
200
- var e = "function" == typeof t && t.constructor;
201
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
202
- }, e.mark = function (t) {
203
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
204
- }, e.awrap = function (t) {
205
- return {
206
- __await: t
207
- };
208
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
109
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
209
110
  return this;
210
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
211
- void 0 === i && (i = Promise);
212
- var a = new AsyncIterator(wrap(t, r, n, o), i);
213
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
214
- return t.done ? t.value : a.next();
215
- });
216
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
217
- return this;
218
- }), define(g, "toString", function () {
111
+ }), _regeneratorDefine(u, "toString", function () {
219
112
  return "[object Generator]";
220
- }), e.keys = function (t) {
221
- var e = Object(t),
222
- r = [];
223
- for (var n in e) r.push(n);
224
- return r.reverse(), function next() {
225
- for (; r.length;) {
226
- var t = r.pop();
227
- if (t in e) return next.value = t, next.done = !1, next;
228
- }
229
- return next.done = !0, next;
113
+ }), (_regenerator = function () {
114
+ return {
115
+ w: i,
116
+ m: f
230
117
  };
231
- }, e.values = values, Context.prototype = {
232
- constructor: Context,
233
- reset: function (e) {
234
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
235
- },
236
- stop: function () {
237
- this.done = !0;
238
- var t = this.tryEntries[0].completion;
239
- if ("throw" === t.type) throw t.arg;
240
- return this.rval;
241
- },
242
- dispatchException: function (e) {
243
- if (this.done) throw e;
244
- var r = this;
245
- function handle(n, o) {
246
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
247
- }
248
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
249
- var i = this.tryEntries[o],
250
- a = i.completion;
251
- if ("root" === i.tryLoc) return handle("end");
252
- if (i.tryLoc <= this.prev) {
253
- var c = n.call(i, "catchLoc"),
254
- u = n.call(i, "finallyLoc");
255
- if (c && u) {
256
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
257
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
258
- } else if (c) {
259
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
260
- } else {
261
- if (!u) throw Error("try statement without catch or finally");
262
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
263
- }
264
- }
265
- }
266
- },
267
- abrupt: function (t, e) {
268
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
269
- var o = this.tryEntries[r];
270
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
271
- var i = o;
272
- break;
273
- }
274
- }
275
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
276
- var a = i ? i.completion : {};
277
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
278
- },
279
- complete: function (t, e) {
280
- if ("throw" === t.type) throw t.arg;
281
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
282
- },
283
- finish: function (t) {
284
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
285
- var r = this.tryEntries[e];
286
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
287
- }
288
- },
289
- catch: function (t) {
290
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
291
- var r = this.tryEntries[e];
292
- if (r.tryLoc === t) {
293
- var n = r.completion;
294
- if ("throw" === n.type) {
295
- var o = n.arg;
296
- resetTryEntry(r);
297
- }
298
- return o;
299
- }
300
- }
301
- throw Error("illegal catch attempt");
302
- },
303
- delegateYield: function (e, r, n) {
304
- return this.delegate = {
305
- iterator: values(e),
306
- resultName: r,
307
- nextLoc: n
308
- }, "next" === this.method && (this.arg = t), y;
309
- }
310
- }, e;
118
+ })();
311
119
  }
312
120
 
313
121
  function _typeof(o) {
@@ -492,8 +300,12 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
492
300
 
493
301
  var packageJson = {
494
302
  name: "@valbuild/init",
495
- version: "0.87.3",
303
+ version: "0.87.4",
496
304
  description: "Initialize a new val.build project",
305
+ repository: {
306
+ type: "git",
307
+ url: "https://github.com/valbuild/val.git"
308
+ },
497
309
  exports: {
498
310
  "./main": {
499
311
  module: "./main/dist/valbuild-init-main.esm.js",
@@ -506,7 +318,7 @@ var packageJson = {
506
318
  test: "jest"
507
319
  },
508
320
  bin: {
509
- "@valbuild/init": "./bin.js"
321
+ "valbuild-init": "./bin.js"
510
322
  },
511
323
  dependencies: {
512
324
  "@inquirer/confirm": "^2.0.15",
@@ -607,42 +419,41 @@ function init() {
607
419
  return _init.apply(this, arguments);
608
420
  }
609
421
  function _init() {
610
- _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
422
+ _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
611
423
  var root,
612
424
  _ref,
613
425
  defaultAnswers,
614
426
  analysis,
615
427
  currentPlan,
616
428
  _args2 = arguments;
617
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
618
- while (1) switch (_context2.prev = _context2.next) {
429
+ return _regenerator().w(function (_context2) {
430
+ while (1) switch (_context2.n) {
619
431
  case 0:
620
432
  root = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : process.cwd();
621
433
  _ref = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {}, defaultAnswers = _ref.yes;
622
434
  info("Initializing " + chalk.bgBlack.hex("#37cd99")("Val") + ' in "' + root + '"...\n');
623
435
  process.stdout.write("Analyzing project...");
624
- _context2.next = 6;
436
+ _context2.n = 1;
625
437
  return analyze(path.resolve(root), walk(path.resolve(root)));
626
- case 6:
627
- analysis = _context2.sent;
438
+ case 1:
439
+ analysis = _context2.v;
628
440
  // reset cursor:
629
441
  process.stdout.write("\x1b[0G");
630
442
  info("Analysis:" + " ".repeat(maxResetLength));
631
- _context2.next = 11;
443
+ _context2.n = 2;
632
444
  return plan(analysis, defaultAnswers);
633
- case 11:
634
- currentPlan = _context2.sent;
445
+ case 2:
446
+ currentPlan = _context2.v;
635
447
  if (!currentPlan.abort) {
636
- _context2.next = 14;
448
+ _context2.n = 3;
637
449
  break;
638
450
  }
639
- return _context2.abrupt("return");
640
- case 14:
641
- _context2.next = 16;
451
+ return _context2.a(2);
452
+ case 3:
453
+ _context2.n = 4;
642
454
  return execute(currentPlan);
643
- case 16:
644
- case "end":
645
- return _context2.stop();
455
+ case 4:
456
+ return _context2.a(2);
646
457
  }
647
458
  }, _callee2);
648
459
  }));
@@ -665,17 +476,17 @@ function walk(dir) {
665
476
  }, []);
666
477
  }
667
478
  var analyze = /*#__PURE__*/function () {
668
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
479
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(root, files) {
669
480
  var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, _semver$minVersion3, _minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
670
- return _regeneratorRuntime().wrap(function _callee$(_context) {
671
- while (1) switch (_context.prev = _context.next) {
481
+ return _regenerator().w(function (_context) {
482
+ while (1) switch (_context.p = _context.n) {
672
483
  case 0:
673
484
  if (fs.existsSync(root)) {
674
- _context.next = 2;
485
+ _context.n = 1;
675
486
  break;
676
487
  }
677
- return _context.abrupt("return", {});
678
- case 2:
488
+ return _context.a(2, {});
489
+ case 1:
679
490
  analysis = {
680
491
  root: root
681
492
  };
@@ -684,15 +495,15 @@ var analyze = /*#__PURE__*/function () {
684
495
  });
685
496
  analysis.packageJsonDir = packageJsonPath && path.dirname(packageJsonPath);
686
497
  if (!packageJsonPath) {
687
- _context.next = 22;
498
+ _context.n = 4;
688
499
  break;
689
500
  }
690
501
  packageJsonText = fs.readFileSync(packageJsonPath, "utf8");
691
502
  if (!packageJsonText) {
692
- _context.next = 22;
503
+ _context.n = 4;
693
504
  break;
694
505
  }
695
- _context.prev = 8;
506
+ _context.p = 2;
696
507
  _packageJson = JSON.parse(packageJsonText);
697
508
  analysis.isValCoreInstalled = !!_packageJson.dependencies["@valbuild/core"];
698
509
  analysis.isValNextInstalled = !!_packageJson.dependencies["@valbuild/next"];
@@ -701,13 +512,13 @@ var analyze = /*#__PURE__*/function () {
701
512
  analysis.nextVersion = _packageJson.dependencies["next"];
702
513
  analysis.valCoreVersion = _packageJson.dependencies["@valbuild/core"];
703
514
  analysis.valNextVersion = _packageJson.dependencies["@valbuild/next"];
704
- _context.next = 22;
515
+ _context.n = 4;
705
516
  break;
706
- case 19:
707
- _context.prev = 19;
708
- _context.t0 = _context["catch"](8);
517
+ case 3:
518
+ _context.p = 3;
519
+ _context.v;
709
520
  throw new Error("Failed to parse package.json in file: ".concat(packageJsonPath));
710
- case 22:
521
+ case 4:
711
522
  if (analysis.nextVersion) {
712
523
  minNextVersion = (_semver$minVersion = semver.minVersion(analysis.nextVersion)) === null || _semver$minVersion === void 0 ? void 0 : _semver$minVersion.version;
713
524
  if (minNextVersion) {
@@ -783,16 +594,16 @@ var analyze = /*#__PURE__*/function () {
783
594
  analysis.appRouterPath = path.dirname(appRouterLayoutPath);
784
595
  analysis.srcDir = path.dirname(analysis.appRouterPath);
785
596
  }
786
- _context.prev = 36;
597
+ _context.p = 5;
787
598
  git = simpleGit(root);
788
- _context.next = 40;
599
+ _context.n = 6;
789
600
  return git.status([]);
790
- case 40:
791
- gitStatus = _context.sent;
792
- _context.next = 43;
601
+ case 6:
602
+ gitStatus = _context.v;
603
+ _context.n = 7;
793
604
  return git.remote(["-v"]);
794
- case 43:
795
- gitRemoteOrigin = _context.sent;
605
+ case 7:
606
+ gitRemoteOrigin = _context.v;
796
607
  analysis.hasGit = true;
797
608
  analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
798
609
  analysis.isGitClean = getGitStatusIsClean(gitStatus);
@@ -807,21 +618,18 @@ var analyze = /*#__PURE__*/function () {
807
618
  repo: repo
808
619
  };
809
620
  }
810
- _context.next = 52;
621
+ _context.n = 9;
811
622
  break;
812
- case 50:
813
- _context.prev = 50;
814
- _context.t1 = _context["catch"](36);
815
- case 52:
623
+ case 8:
624
+ _context.p = 8;
625
+ _context.v;
626
+ case 9:
816
627
  gitIgnorePath = path.join(root, ".gitignore");
817
628
  analysis.gitIgnorePath = gitIgnorePath;
818
629
  analysis.gitIgnoreFile = fs.readFileSync(gitIgnorePath, "utf-8");
819
- return _context.abrupt("return", analysis);
820
- case 56:
821
- case "end":
822
- return _context.stop();
630
+ return _context.a(2, analysis);
823
631
  }
824
- }, _callee, null, [[8, 19], [36, 50]]);
632
+ }, _callee, null, [[5, 8], [2, 3]]);
825
633
  }));
826
634
  return function analyze(_x, _x2) {
827
635
  return _ref2.apply(this, arguments);
@@ -831,7 +639,7 @@ function plan(_x3) {
831
639
  return _plan.apply(this, arguments);
832
640
  }
833
641
  function _plan() {
834
- _plan = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(analysis) {
642
+ _plan = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(analysis) {
835
643
  var defaultAnswers,
836
644
  plan,
837
645
  answer,
@@ -872,179 +680,194 @@ function _plan() {
872
680
  _res,
873
681
  _diff,
874
682
  _s,
683
+ _answer0,
684
+ _answer1,
875
685
  _answer10,
876
686
  _answer11,
877
- _answer12,
878
- _answer13,
879
687
  vscodeDir,
880
688
  settingsPath,
881
689
  currentSettings,
882
690
  currentSettingsFile,
883
691
  currentRecommendations,
884
692
  valBuildIntelliSense,
885
- _args3 = arguments;
886
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
887
- while (1) switch (_context3.prev = _context3.next) {
693
+ _args3 = arguments,
694
+ _t3,
695
+ _t4,
696
+ _t5,
697
+ _t6,
698
+ _t7,
699
+ _t8,
700
+ _t9,
701
+ _t0,
702
+ _t1,
703
+ _t10,
704
+ _t11,
705
+ _t12,
706
+ _t13,
707
+ _t14,
708
+ _t15;
709
+ return _regenerator().w(function (_context3) {
710
+ while (1) switch (_context3.p = _context3.n) {
888
711
  case 0:
889
712
  defaultAnswers = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
890
713
  plan = {
891
714
  root: analysis.root
892
715
  };
893
716
  if (!analysis.root) {
894
- _context3.next = 6;
717
+ _context3.n = 1;
895
718
  break;
896
719
  }
897
720
  info(" Root: " + analysis.root, {
898
721
  isGood: true
899
722
  });
900
- _context3.next = 8;
723
+ _context3.n = 2;
901
724
  break;
902
- case 6:
725
+ case 1:
903
726
  error("Failed to find root directory");
904
- return _context3.abrupt("return", {
727
+ return _context3.a(2, {
905
728
  abort: true
906
729
  });
907
- case 8:
730
+ case 2:
908
731
  if (!(!analysis.srcDir || !fs.statSync(analysis.srcDir).isDirectory() || !analysis.isNextInstalled)) {
909
- _context3.next = 11;
732
+ _context3.n = 3;
910
733
  break;
911
734
  }
912
735
  error("Val requires a Next.js project");
913
- return _context3.abrupt("return", {
736
+ return _context3.a(2, {
914
737
  abort: true
915
738
  });
916
- case 11:
739
+ case 3:
917
740
  if (!analysis.srcDir) {
918
- _context3.next = 15;
741
+ _context3.n = 4;
919
742
  break;
920
743
  }
921
744
  info(" Source dir: " + analysis.srcDir, {
922
745
  isGood: true
923
746
  });
924
- _context3.next = 17;
747
+ _context3.n = 5;
925
748
  break;
926
- case 15:
749
+ case 4:
927
750
  error("Failed to determine source directory");
928
- return _context3.abrupt("return", {
751
+ return _context3.a(2, {
929
752
  abort: true
930
753
  });
931
- case 17:
754
+ case 5:
932
755
  if (analysis.isNextInstalled) {
933
- _context3.next = 20;
756
+ _context3.n = 6;
934
757
  break;
935
758
  }
936
759
  error("Val requires a Next.js project");
937
- return _context3.abrupt("return", {
760
+ return _context3.a(2, {
938
761
  abort: true
939
762
  });
940
- case 20:
763
+ case 6:
941
764
  if (analysis.isValCoreInstalled) {
942
- _context3.next = 25;
765
+ _context3.n = 7;
943
766
  break;
944
767
  }
945
768
  error("Install @valbuild/core first");
946
- return _context3.abrupt("return", {
769
+ return _context3.a(2, {
947
770
  abort: true
948
771
  });
949
- case 25:
772
+ case 7:
950
773
  if (analysis.valCoreVersionIsSatisfied) {
951
- _context3.next = 40;
774
+ _context3.n = 12;
952
775
  break;
953
776
  }
954
777
  warn(" This init script expects @valbuild/core >= ".concat(MIN_VAL_VERSION, ". Found: ").concat(analysis.valCoreVersion));
955
778
  if (defaultAnswers) {
956
- _context3.next = 33;
779
+ _context3.n = 9;
957
780
  break;
958
781
  }
959
- _context3.next = 30;
782
+ _context3.n = 8;
960
783
  return confirm({
961
784
  message: "Continue?",
962
785
  "default": false
963
786
  });
964
- case 30:
965
- _context3.t0 = _context3.sent;
966
- _context3.next = 34;
787
+ case 8:
788
+ _t3 = _context3.v;
789
+ _context3.n = 10;
967
790
  break;
968
- case 33:
969
- _context3.t0 = false;
970
- case 34:
971
- answer = _context3.t0;
791
+ case 9:
792
+ _t3 = false;
793
+ case 10:
794
+ answer = _t3;
972
795
  if (answer) {
973
- _context3.next = 38;
796
+ _context3.n = 11;
974
797
  break;
975
798
  }
976
799
  error("Aborted: @valbuild/core version is not satisfied.\n\nInstall the @valbuild/core@".concat(MIN_VAL_VERSION, " package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/core@").concat(MIN_VAL_VERSION, "\n"));
977
- return _context3.abrupt("return", {
800
+ return _context3.a(2, {
978
801
  abort: true
979
802
  });
980
- case 38:
981
- _context3.next = 41;
803
+ case 11:
804
+ _context3.n = 13;
982
805
  break;
983
- case 40:
806
+ case 12:
984
807
  info(" Val version: found ".concat(analysis.valCoreVersion, " >= ").concat(MIN_VAL_VERSION), {
985
808
  isGood: true
986
809
  });
987
- case 41:
810
+ case 13:
988
811
  if (analysis.isValNextInstalled) {
989
- _context3.next = 46;
812
+ _context3.n = 14;
990
813
  break;
991
814
  }
992
815
  error("Install @valbuild/next first");
993
- return _context3.abrupt("return", {
816
+ return _context3.a(2, {
994
817
  abort: true
995
818
  });
996
- case 46:
819
+ case 14:
997
820
  if (analysis.valNextVersionIsSatisfied) {
998
- _context3.next = 61;
821
+ _context3.n = 19;
999
822
  break;
1000
823
  }
1001
824
  warn(" This init script expects @valbuild/next >= ".concat(MIN_VAL_VERSION, ". Found: ").concat(analysis.valNextVersion));
1002
825
  if (defaultAnswers) {
1003
- _context3.next = 54;
826
+ _context3.n = 16;
1004
827
  break;
1005
828
  }
1006
- _context3.next = 51;
829
+ _context3.n = 15;
1007
830
  return confirm({
1008
831
  message: "Continue?",
1009
832
  "default": false
1010
833
  });
1011
- case 51:
1012
- _context3.t1 = _context3.sent;
1013
- _context3.next = 55;
834
+ case 15:
835
+ _t4 = _context3.v;
836
+ _context3.n = 17;
1014
837
  break;
1015
- case 54:
1016
- _context3.t1 = false;
1017
- case 55:
1018
- _answer = _context3.t1;
838
+ case 16:
839
+ _t4 = false;
840
+ case 17:
841
+ _answer = _t4;
1019
842
  if (_answer) {
1020
- _context3.next = 59;
843
+ _context3.n = 18;
1021
844
  break;
1022
845
  }
1023
846
  error("Aborted: @valbuild/next version is not satisfied.\n\nInstall the @valbuild/next@".concat(MIN_VAL_VERSION, " package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/next@").concat(MIN_VAL_VERSION, "\n"));
1024
- return _context3.abrupt("return", {
847
+ return _context3.a(2, {
1025
848
  abort: true
1026
849
  });
1027
- case 59:
1028
- _context3.next = 62;
850
+ case 18:
851
+ _context3.n = 20;
1029
852
  break;
1030
- case 61:
853
+ case 19:
1031
854
  info(" Val version: found ".concat(analysis.valNextVersion, " >= ").concat(MIN_VAL_VERSION), {
1032
855
  isGood: true
1033
856
  });
1034
- case 62:
857
+ case 20:
1035
858
  if (analysis.nextVersionIsSatisfied) {
1036
- _context3.next = 67;
859
+ _context3.n = 21;
1037
860
  break;
1038
861
  }
1039
862
  error("Val requires Next.js >= ".concat(MIN_NEXT_VERSION, ". Found: ").concat(analysis.nextVersion));
1040
- return _context3.abrupt("return", {
863
+ return _context3.a(2, {
1041
864
  abort: true
1042
865
  });
1043
- case 67:
866
+ case 21:
1044
867
  info(" Next.js version: found ".concat(analysis.nextVersion, " >= ").concat(MIN_NEXT_VERSION), {
1045
868
  isGood: true
1046
869
  });
1047
- case 68:
870
+ case 22:
1048
871
  if (analysis.isTypeScript) {
1049
872
  info(" Use: TypeScript", {
1050
873
  isGood: true
@@ -1060,81 +883,81 @@ function _plan() {
1060
883
  }
1061
884
  }
1062
885
  if (!analysis.isTypeScript) {
1063
- _context3.next = 80;
886
+ _context3.n = 25;
1064
887
  break;
1065
888
  }
1066
889
  tsconfigJsonPath = path.join(analysis.root, "tsconfig.json");
1067
890
  if (!fs.statSync(tsconfigJsonPath).isFile()) {
1068
- _context3.next = 76;
891
+ _context3.n = 23;
1069
892
  break;
1070
893
  }
1071
894
  info(" tsconfig.json: found", {
1072
895
  isGood: true
1073
896
  });
1074
- _context3.next = 78;
897
+ _context3.n = 24;
1075
898
  break;
1076
- case 76:
899
+ case 23:
1077
900
  error("tsconfig.json: Failed to find tsconfig.json");
1078
- return _context3.abrupt("return", {
901
+ return _context3.a(2, {
1079
902
  abort: true
1080
903
  });
1081
- case 78:
1082
- _context3.next = 87;
904
+ case 24:
905
+ _context3.n = 27;
1083
906
  break;
1084
- case 80:
907
+ case 25:
1085
908
  jsconfigJsonPath = path.join(analysis.root, "jsconfig.json");
1086
909
  if (!fs.statSync(jsconfigJsonPath).isFile()) {
1087
- _context3.next = 85;
910
+ _context3.n = 26;
1088
911
  break;
1089
912
  }
1090
913
  info(" jsconfig.json: found", {
1091
914
  isGood: true
1092
915
  });
1093
- _context3.next = 87;
916
+ _context3.n = 27;
1094
917
  break;
1095
- case 85:
918
+ case 26:
1096
919
  error(" jsconfig.json: failed to find jsconfig.json");
1097
- return _context3.abrupt("return", {
920
+ return _context3.a(2, {
1098
921
  abort: true
1099
922
  });
1100
- case 87:
923
+ case 27:
1101
924
  if (!(analysis.valEslintVersion === undefined)) {
1102
- _context3.next = 101;
925
+ _context3.n = 32;
1103
926
  break;
1104
927
  }
1105
928
  if (defaultAnswers) {
1106
- _context3.next = 94;
929
+ _context3.n = 29;
1107
930
  break;
1108
931
  }
1109
- _context3.next = 91;
932
+ _context3.n = 28;
1110
933
  return confirm({
1111
934
  message: "The recommended Val eslint plugin (@valbuild/eslint-plugin) is not installed. Continue?",
1112
935
  "default": false
1113
936
  });
1114
- case 91:
1115
- _context3.t2 = _context3.sent;
1116
- _context3.next = 95;
937
+ case 28:
938
+ _t5 = _context3.v;
939
+ _context3.n = 30;
1117
940
  break;
1118
- case 94:
1119
- _context3.t2 = false;
1120
- case 95:
1121
- _answer2 = _context3.t2;
941
+ case 29:
942
+ _t5 = false;
943
+ case 30:
944
+ _answer2 = _t5;
1122
945
  if (_answer2) {
1123
- _context3.next = 99;
946
+ _context3.n = 31;
1124
947
  break;
1125
948
  }
1126
949
  error("Aborted: the Val eslint plugin is not installed.\n\nInstall the @valbuild/eslint-plugin package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/eslint-plugin\n");
1127
- return _context3.abrupt("return", {
950
+ return _context3.a(2, {
1128
951
  abort: true
1129
952
  });
1130
- case 99:
1131
- _context3.next = 102;
953
+ case 31:
954
+ _context3.n = 33;
1132
955
  break;
1133
- case 101:
956
+ case 32:
1134
957
  info(" @valbuild/eslint-plugin: installed", {
1135
958
  isGood: true
1136
959
  });
1137
- case 102:
960
+ case 33:
1138
961
  if (analysis.appRouter) {
1139
962
  info(" Use: App Router", {
1140
963
  isGood: true
@@ -1160,55 +983,55 @@ function _plan() {
1160
983
  warn(" Git state: dirty");
1161
984
  }
1162
985
  if (analysis.isGitClean) {
1163
- _context3.next = 122;
986
+ _context3.n = 39;
1164
987
  break;
1165
988
  }
1166
- case 107:
989
+ case 34:
1167
990
  if (!(plan.ignoreGitDirty === undefined)) {
1168
- _context3.next = 122;
991
+ _context3.n = 39;
1169
992
  break;
1170
993
  }
1171
994
  if (defaultAnswers) {
1172
- _context3.next = 114;
995
+ _context3.n = 36;
1173
996
  break;
1174
997
  }
1175
- _context3.next = 111;
998
+ _context3.n = 35;
1176
999
  return confirm({
1177
1000
  message: "You have uncommitted changes. Continue?",
1178
1001
  "default": false
1179
1002
  });
1180
- case 111:
1181
- _context3.t3 = _context3.sent;
1182
- _context3.next = 115;
1003
+ case 35:
1004
+ _t6 = _context3.v;
1005
+ _context3.n = 37;
1183
1006
  break;
1184
- case 114:
1185
- _context3.t3 = false;
1186
- case 115:
1187
- _answer3 = _context3.t3;
1007
+ case 36:
1008
+ _t6 = false;
1009
+ case 37:
1010
+ _answer3 = _t6;
1188
1011
  plan.ignoreGitDirty = _answer3;
1189
1012
  if (_answer3) {
1190
- _context3.next = 120;
1013
+ _context3.n = 38;
1191
1014
  break;
1192
1015
  }
1193
1016
  error("Aborted: git state dirty");
1194
- return _context3.abrupt("return", {
1017
+ return _context3.a(2, {
1195
1018
  abort: true
1196
1019
  });
1197
- case 120:
1198
- _context3.next = 107;
1020
+ case 38:
1021
+ _context3.n = 34;
1199
1022
  break;
1200
- case 122:
1023
+ case 39:
1201
1024
  // New required files:
1202
1025
  valConfigPath = path.join(analysis.root, analysis.isTypeScript ? "val.config.ts" : "val.config.js");
1203
1026
  if (!fs.existsSync(valConfigPath)) {
1204
- _context3.next = 126;
1027
+ _context3.n = 40;
1205
1028
  break;
1206
1029
  }
1207
1030
  error("Aborted: a Val config file: ".concat(valConfigPath, " already exists."));
1208
- return _context3.abrupt("return", {
1031
+ return _context3.a(2, {
1209
1032
  abort: true
1210
1033
  });
1211
- case 126:
1034
+ case 40:
1212
1035
  plan.createConfigFile = {
1213
1036
  path: valConfigPath,
1214
1037
  source: VAL_CONFIG(!!analysis.isTypeScript, {
@@ -1216,41 +1039,41 @@ function _plan() {
1216
1039
  })
1217
1040
  };
1218
1041
  if (defaultAnswers) {
1219
- _context3.next = 133;
1042
+ _context3.n = 42;
1220
1043
  break;
1221
1044
  }
1222
- _context3.next = 130;
1045
+ _context3.n = 41;
1223
1046
  return confirm({
1224
1047
  message: "Include example Val files?",
1225
1048
  "default": true
1226
1049
  });
1227
- case 130:
1228
- _context3.t4 = _context3.sent;
1229
- _context3.next = 134;
1050
+ case 41:
1051
+ _t7 = _context3.v;
1052
+ _context3.n = 43;
1230
1053
  break;
1231
- case 133:
1232
- _context3.t4 = true;
1233
- case 134:
1234
- _answer4 = _context3.t4;
1054
+ case 42:
1055
+ _t7 = true;
1056
+ case 43:
1057
+ _answer4 = _t7;
1235
1058
  if (!_answer4) {
1236
- _context3.next = 143;
1059
+ _context3.n = 45;
1237
1060
  break;
1238
1061
  }
1239
1062
  exampleDir = path.join(analysis.srcDir, "examples", "val");
1240
1063
  examplePath = path.join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
1241
1064
  exampleImport = path.relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
1242
1065
  if (analysis.packageJsonDir) {
1243
- _context3.next = 141;
1066
+ _context3.n = 44;
1244
1067
  break;
1245
1068
  }
1246
1069
  throw Error("Could not detect package.json directory! This is a Val bug.");
1247
- case 141:
1070
+ case 44:
1248
1071
  _exampleModuleFilePath = "/".concat(path.relative(analysis.packageJsonDir, examplePath));
1249
1072
  plan.includeExample = {
1250
1073
  path: examplePath,
1251
1074
  source: BASIC_EXAMPLE(_exampleModuleFilePath, exampleImport, !!analysis.isJavaScript)
1252
1075
  };
1253
- case 143:
1076
+ case 45:
1254
1077
  valModulesDir = analysis.root;
1255
1078
  valModulesImport = path.relative(valModulesDir, valConfigPath).replace(".js", "").replace(".ts", "");
1256
1079
  exampleModuleFilePath = plan.includeExample ? plan.includeExample.path : undefined;
@@ -1284,28 +1107,28 @@ function _plan() {
1284
1107
  };
1285
1108
 
1286
1109
  // Util files:
1287
- case 160:
1110
+ case 46:
1288
1111
  if (!(plan.createValClient === undefined)) {
1289
- _context3.next = 172;
1112
+ _context3.n = 50;
1290
1113
  break;
1291
1114
  }
1292
1115
  if (defaultAnswers) {
1293
- _context3.next = 167;
1116
+ _context3.n = 48;
1294
1117
  break;
1295
1118
  }
1296
- _context3.next = 164;
1119
+ _context3.n = 47;
1297
1120
  return confirm({
1298
1121
  message: "Setup useVal for Client Components",
1299
1122
  "default": true
1300
1123
  });
1301
- case 164:
1302
- _context3.t5 = _context3.sent;
1303
- _context3.next = 168;
1124
+ case 47:
1125
+ _t8 = _context3.v;
1126
+ _context3.n = 49;
1304
1127
  break;
1305
- case 167:
1306
- _context3.t5 = true;
1307
- case 168:
1308
- _answer5 = _context3.t5;
1128
+ case 48:
1129
+ _t8 = true;
1130
+ case 49:
1131
+ _answer5 = _t8;
1309
1132
  if (_answer5) {
1310
1133
  plan.createValClient = {
1311
1134
  path: path.join(valUtilsDir, analysis.isTypeScript ? "val.client.ts" : "val.client.js"),
@@ -1314,30 +1137,30 @@ function _plan() {
1314
1137
  } else {
1315
1138
  plan.createValClient = false;
1316
1139
  }
1317
- _context3.next = 160;
1140
+ _context3.n = 46;
1318
1141
  break;
1319
- case 172:
1142
+ case 50:
1320
1143
  if (!(plan.createValRsc === undefined)) {
1321
- _context3.next = 184;
1144
+ _context3.n = 54;
1322
1145
  break;
1323
1146
  }
1324
1147
  if (defaultAnswers) {
1325
- _context3.next = 179;
1148
+ _context3.n = 52;
1326
1149
  break;
1327
1150
  }
1328
- _context3.next = 176;
1151
+ _context3.n = 51;
1329
1152
  return confirm({
1330
1153
  message: "Setup fetchVal for React Server Components",
1331
1154
  "default": true
1332
1155
  });
1333
- case 176:
1334
- _context3.t6 = _context3.sent;
1335
- _context3.next = 180;
1156
+ case 51:
1157
+ _t9 = _context3.v;
1158
+ _context3.n = 53;
1336
1159
  break;
1337
- case 179:
1338
- _context3.t6 = true;
1339
- case 180:
1340
- _answer6 = _context3.t6;
1160
+ case 52:
1161
+ _t9 = true;
1162
+ case 53:
1163
+ _answer6 = _t9;
1341
1164
  if (_answer6) {
1342
1165
  plan.createValRsc = {
1343
1166
  path: path.join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
@@ -1346,24 +1169,24 @@ function _plan() {
1346
1169
  } else {
1347
1170
  plan.createValRsc = false;
1348
1171
  }
1349
- _context3.next = 172;
1172
+ _context3.n = 50;
1350
1173
  break;
1351
- case 184:
1174
+ case 54:
1352
1175
  // Patches:
1353
1176
  NO_PATCH_WARNING = "Remember to add the ValProvider in your root app/layout.tsx or pages/_app.tsx file.\n";
1354
1177
  if (!analysis.appRouterLayoutPath) {
1355
- _context3.next = 214;
1178
+ _context3.n = 63;
1356
1179
  break;
1357
1180
  }
1358
1181
  if (analysis.appRouterLayoutFile) {
1359
- _context3.next = 189;
1182
+ _context3.n = 55;
1360
1183
  break;
1361
1184
  }
1362
1185
  error("Failed to read app router layout file");
1363
- return _context3.abrupt("return", {
1186
+ return _context3.a(2, {
1364
1187
  abort: true
1365
1188
  });
1366
- case 189:
1189
+ case 55:
1367
1190
  res = transformNextAppRouterValProvider({
1368
1191
  path: analysis.appRouterLayoutPath,
1369
1192
  source: analysis.appRouterLayoutFile
@@ -1387,43 +1210,43 @@ function _plan() {
1387
1210
  }
1388
1211
  });
1389
1212
  if (defaultAnswers) {
1390
- _context3.next = 199;
1213
+ _context3.n = 57;
1391
1214
  break;
1392
1215
  }
1393
- _context3.next = 196;
1216
+ _context3.n = 56;
1394
1217
  return confirm({
1395
1218
  message: "Automatically patch ".concat(analysis.appRouterLayoutPath, " file?"),
1396
1219
  "default": true
1397
1220
  });
1398
- case 196:
1399
- _context3.t7 = _context3.sent;
1400
- _context3.next = 200;
1221
+ case 56:
1222
+ _t0 = _context3.v;
1223
+ _context3.n = 58;
1401
1224
  break;
1402
- case 199:
1403
- _context3.t7 = true;
1404
- case 200:
1405
- _answer7 = _context3.t7;
1225
+ case 57:
1226
+ _t0 = true;
1227
+ case 58:
1228
+ _answer7 = _t0;
1406
1229
  if (!_answer7) {
1407
- _context3.next = 213;
1230
+ _context3.n = 62;
1408
1231
  break;
1409
1232
  }
1410
1233
  if (defaultAnswers) {
1411
- _context3.next = 208;
1234
+ _context3.n = 60;
1412
1235
  break;
1413
1236
  }
1414
- _context3.next = 205;
1237
+ _context3.n = 59;
1415
1238
  return confirm({
1416
1239
  message: "Do you accept the following patch:\n".concat(s, "\n"),
1417
1240
  "default": true
1418
1241
  });
1419
- case 205:
1420
- _context3.t8 = _context3.sent;
1421
- _context3.next = 209;
1242
+ case 59:
1243
+ _t1 = _context3.v;
1244
+ _context3.n = 61;
1422
1245
  break;
1423
- case 208:
1424
- _context3.t8 = true;
1425
- case 209:
1426
- _answer8 = _context3.t8;
1246
+ case 60:
1247
+ _t1 = true;
1248
+ case 61:
1249
+ _answer8 = _t1;
1427
1250
  if (!_answer8) {
1428
1251
  warn(NO_PATCH_WARNING);
1429
1252
  plan.updateAppLayout = false;
@@ -1433,75 +1256,75 @@ function _plan() {
1433
1256
  source: res
1434
1257
  };
1435
1258
  }
1436
- _context3.next = 214;
1259
+ _context3.n = 63;
1437
1260
  break;
1438
- case 213:
1261
+ case 62:
1439
1262
  warn(NO_PATCH_WARNING);
1440
- case 214:
1263
+ case 63:
1441
1264
  if (analysis.pagesRouter) {
1442
1265
  warn(NO_PATCH_WARNING);
1443
1266
  }
1444
1267
  if (!analysis.valEslintVersion) {
1445
- _context3.next = 279;
1268
+ _context3.n = 84;
1446
1269
  break;
1447
1270
  }
1448
1271
  if (!analysis.isValEslintRulesConfigured) {
1449
- _context3.next = 220;
1272
+ _context3.n = 64;
1450
1273
  break;
1451
1274
  }
1452
1275
  warn(" @valbuild/eslint-plugin rules: already configured");
1453
- _context3.next = 279;
1276
+ _context3.n = 84;
1454
1277
  break;
1455
- case 220:
1278
+ case 64:
1456
1279
  if (!analysis.eslintRcJsPath) {
1457
- _context3.next = 225;
1280
+ _context3.n = 66;
1458
1281
  break;
1459
1282
  }
1460
- _context3.next = 223;
1283
+ _context3.n = 65;
1461
1284
  return confirm({
1462
1285
  message: ' Cannot patch eslint: found .eslintrc.js but can only patch JSON files (at the moment).\nAdd the following to your eslint config:\n\n "extends": ["plugin:@valbuild/recommended"]\n\n',
1463
1286
  "default": true
1464
1287
  });
1465
- case 223:
1466
- _context3.next = 279;
1288
+ case 65:
1289
+ _context3.n = 84;
1467
1290
  break;
1468
- case 225:
1291
+ case 66:
1469
1292
  if (!analysis.eslintRcJsonPath) {
1470
- _context3.next = 246;
1293
+ _context3.n = 72;
1471
1294
  break;
1472
1295
  }
1473
1296
  if (defaultAnswers) {
1474
- _context3.next = 232;
1297
+ _context3.n = 68;
1475
1298
  break;
1476
1299
  }
1477
- _context3.next = 229;
1300
+ _context3.n = 67;
1478
1301
  return confirm({
1479
1302
  message: "Patch eslintrc.json to use the recommended Val eslint rules?",
1480
1303
  "default": true
1481
1304
  });
1482
- case 229:
1483
- _context3.t9 = _context3.sent;
1484
- _context3.next = 233;
1305
+ case 67:
1306
+ _t10 = _context3.v;
1307
+ _context3.n = 69;
1485
1308
  break;
1486
- case 232:
1487
- _context3.t9 = true;
1488
- case 233:
1489
- _answer9 = _context3.t9;
1309
+ case 68:
1310
+ _t10 = true;
1311
+ case 69:
1312
+ _answer9 = _t10;
1490
1313
  if (!_answer9) {
1491
- _context3.next = 244;
1314
+ _context3.n = 71;
1492
1315
  break;
1493
1316
  }
1494
1317
  currentEslintRc = fs.readFileSync(analysis.eslintRcJsonPath, "utf-8");
1495
1318
  parsedEslint = JSON.parse(currentEslintRc);
1496
1319
  if (!(_typeof(parsedEslint) !== "object")) {
1497
- _context3.next = 240;
1320
+ _context3.n = 70;
1498
1321
  break;
1499
1322
  }
1500
1323
  error("Could not patch eslint: ".concat(analysis.eslintRcJsonPath, " was not an object"));
1501
- return _context3.abrupt("return", {
1324
+ return _context3.a(2, {
1502
1325
  abort: true
1503
1326
  });
1504
- case 240:
1327
+ case 70:
1505
1328
  if (typeof parsedEslint["extends"] === "string") {
1506
1329
  parsedEslint["extends"] = [parsedEslint["extends"]];
1507
1330
  }
@@ -1511,16 +1334,16 @@ function _plan() {
1511
1334
  path: analysis.eslintRcJsonPath,
1512
1335
  source: JSON.stringify(parsedEslint, null, 2) + "\n"
1513
1336
  };
1514
- case 244:
1515
- _context3.next = 279;
1337
+ case 71:
1338
+ _context3.n = 84;
1516
1339
  break;
1517
- case 246:
1340
+ case 72:
1518
1341
  if (!analysis.eslintRcMjsPath) {
1519
- _context3.next = 278;
1342
+ _context3.n = 83;
1520
1343
  break;
1521
1344
  }
1522
1345
  if (!analysis.eslintRcMjsText) {
1523
- _context3.next = 275;
1346
+ _context3.n = 81;
1524
1347
  break;
1525
1348
  }
1526
1349
  _res = addEslintPluginToEslintMjs({
@@ -1546,44 +1369,44 @@ function _plan() {
1546
1369
  }
1547
1370
  });
1548
1371
  if (defaultAnswers) {
1549
- _context3.next = 258;
1372
+ _context3.n = 74;
1550
1373
  break;
1551
1374
  }
1552
- _context3.next = 255;
1375
+ _context3.n = 73;
1553
1376
  return confirm({
1554
1377
  message: "Automatically patch ".concat(analysis.eslintRcMjsPath, " file?"),
1555
1378
  "default": true
1556
1379
  });
1557
- case 255:
1558
- _context3.t10 = _context3.sent;
1559
- _context3.next = 259;
1380
+ case 73:
1381
+ _t11 = _context3.v;
1382
+ _context3.n = 75;
1560
1383
  break;
1561
- case 258:
1562
- _context3.t10 = true;
1563
- case 259:
1564
- _answer10 = _context3.t10;
1565
- if (!_answer10) {
1566
- _context3.next = 272;
1384
+ case 74:
1385
+ _t11 = true;
1386
+ case 75:
1387
+ _answer0 = _t11;
1388
+ if (!_answer0) {
1389
+ _context3.n = 79;
1567
1390
  break;
1568
1391
  }
1569
1392
  if (defaultAnswers) {
1570
- _context3.next = 267;
1393
+ _context3.n = 77;
1571
1394
  break;
1572
1395
  }
1573
- _context3.next = 264;
1396
+ _context3.n = 76;
1574
1397
  return confirm({
1575
1398
  message: "Do you accept the following patch:\n".concat(_s, "\n"),
1576
1399
  "default": true
1577
1400
  });
1578
- case 264:
1579
- _context3.t11 = _context3.sent;
1580
- _context3.next = 268;
1401
+ case 76:
1402
+ _t12 = _context3.v;
1403
+ _context3.n = 78;
1581
1404
  break;
1582
- case 267:
1583
- _context3.t11 = true;
1584
- case 268:
1585
- _answer11 = _context3.t11;
1586
- if (!_answer11) {
1405
+ case 77:
1406
+ _t12 = true;
1407
+ case 78:
1408
+ _answer1 = _t12;
1409
+ if (!_answer1) {
1587
1410
  warn(NO_PATCH_WARNING);
1588
1411
  plan.updateEslint = false;
1589
1412
  } else {
@@ -1592,43 +1415,43 @@ function _plan() {
1592
1415
  source: _res
1593
1416
  };
1594
1417
  }
1595
- _context3.next = 273;
1418
+ _context3.n = 80;
1596
1419
  break;
1597
- case 272:
1420
+ case 79:
1598
1421
  warn(NO_PATCH_WARNING);
1599
- case 273:
1600
- _context3.next = 276;
1422
+ case 80:
1423
+ _context3.n = 82;
1601
1424
  break;
1602
- case 275:
1425
+ case 81:
1603
1426
  warn(NO_PATCH_WARNING);
1604
- case 276:
1605
- _context3.next = 279;
1427
+ case 82:
1428
+ _context3.n = 84;
1606
1429
  break;
1607
- case 278:
1430
+ case 83:
1608
1431
  warn("Cannot patch eslint: failed to find eslint config file");
1609
- case 279:
1432
+ case 84:
1610
1433
  if (!analysis.gitIgnorePath) {
1611
- _context3.next = 291;
1434
+ _context3.n = 88;
1612
1435
  break;
1613
1436
  }
1614
1437
  if (defaultAnswers) {
1615
- _context3.next = 286;
1438
+ _context3.n = 86;
1616
1439
  break;
1617
1440
  }
1618
- _context3.next = 283;
1441
+ _context3.n = 85;
1619
1442
  return confirm({
1620
1443
  message: "Append .gitignore entry for Val cache? (recommended)",
1621
1444
  "default": true
1622
1445
  });
1623
- case 283:
1624
- _context3.t12 = _context3.sent;
1625
- _context3.next = 287;
1446
+ case 85:
1447
+ _t13 = _context3.v;
1448
+ _context3.n = 87;
1626
1449
  break;
1627
- case 286:
1628
- _context3.t12 = true;
1629
- case 287:
1630
- _answer12 = _context3.t12;
1631
- if (_answer12) {
1450
+ case 86:
1451
+ _t13 = true;
1452
+ case 87:
1453
+ _answer10 = _t13;
1454
+ if (_answer10) {
1632
1455
  plan.updateGitIgnore = {
1633
1456
  path: analysis.gitIgnorePath,
1634
1457
  source: (analysis.gitIgnoreFile ? "".concat(analysis.gitIgnoreFile, "\n\n") : "") + "# Val local cache\n.val\n"
@@ -1636,59 +1459,59 @@ function _plan() {
1636
1459
  } else {
1637
1460
  plan.updateGitIgnore = false;
1638
1461
  }
1639
- _context3.next = 292;
1462
+ _context3.n = 89;
1640
1463
  break;
1641
- case 291:
1464
+ case 88:
1642
1465
  plan.updateGitIgnore = false;
1643
- case 292:
1466
+ case 89:
1644
1467
  if (defaultAnswers) {
1645
- _context3.next = 298;
1468
+ _context3.n = 91;
1646
1469
  break;
1647
1470
  }
1648
- _context3.next = 295;
1471
+ _context3.n = 90;
1649
1472
  return confirm({
1650
1473
  message: "Add the Val Build IntelliSense to .vscode/extensions.json?",
1651
1474
  "default": true
1652
1475
  });
1653
- case 295:
1654
- _context3.t13 = _context3.sent;
1655
- _context3.next = 299;
1476
+ case 90:
1477
+ _t14 = _context3.v;
1478
+ _context3.n = 92;
1656
1479
  break;
1657
- case 298:
1658
- _context3.t13 = true;
1659
- case 299:
1660
- _answer13 = _context3.t13;
1661
- if (!_answer13) {
1662
- _context3.next = 325;
1480
+ case 91:
1481
+ _t14 = true;
1482
+ case 92:
1483
+ _answer11 = _t14;
1484
+ if (!_answer11) {
1485
+ _context3.n = 99;
1663
1486
  break;
1664
1487
  }
1665
1488
  vscodeDir = path.join(analysis.root, ".vscode");
1666
1489
  settingsPath = path.join(vscodeDir, "extensions.json");
1667
1490
  currentSettings = {};
1668
- _context3.prev = 304;
1491
+ _context3.p = 93;
1669
1492
  currentSettingsFile = fs.readFileSync(settingsPath, "utf-8");
1670
1493
  if (!currentSettingsFile) {
1671
- _context3.next = 315;
1494
+ _context3.n = 96;
1672
1495
  break;
1673
1496
  }
1674
- _context3.prev = 307;
1497
+ _context3.p = 94;
1675
1498
  currentSettings = JSON.parse(currentSettingsFile);
1676
- _context3.next = 315;
1499
+ _context3.n = 96;
1677
1500
  break;
1678
- case 311:
1679
- _context3.prev = 311;
1680
- _context3.t14 = _context3["catch"](307);
1681
- warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.t14 instanceof Error ? "Parse error: ".concat(_context3.t14.message) : ""));
1682
- return _context3.abrupt("return", {
1501
+ case 95:
1502
+ _context3.p = 95;
1503
+ _t15 = _context3.v;
1504
+ warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_t15 instanceof Error ? "Parse error: ".concat(_t15.message) : ""));
1505
+ return _context3.a(2, {
1683
1506
  abort: true
1684
1507
  });
1685
- case 315:
1686
- _context3.next = 319;
1508
+ case 96:
1509
+ _context3.n = 98;
1687
1510
  break;
1688
- case 317:
1689
- _context3.prev = 317;
1690
- _context3.t15 = _context3["catch"](304);
1691
- case 319:
1511
+ case 97:
1512
+ _context3.p = 97;
1513
+ _context3.v;
1514
+ case 98:
1692
1515
  currentRecommendations =
1693
1516
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1694
1517
  currentSettings.recommendations;
@@ -1702,17 +1525,14 @@ function _plan() {
1702
1525
  path: settingsPath,
1703
1526
  source: JSON.stringify(currentSettings, null, 2)
1704
1527
  };
1705
- _context3.next = 326;
1528
+ _context3.n = 100;
1706
1529
  break;
1707
- case 325:
1530
+ case 99:
1708
1531
  plan.updateVSCodeSettings = false;
1709
- case 326:
1710
- return _context3.abrupt("return", plan);
1711
- case 327:
1712
- case "end":
1713
- return _context3.stop();
1532
+ case 100:
1533
+ return _context3.a(2, plan);
1714
1534
  }
1715
- }, _callee3, null, [[304, 317], [307, 311]]);
1535
+ }, _callee3, null, [[94, 95], [93, 97]]);
1716
1536
  }));
1717
1537
  return _plan.apply(this, arguments);
1718
1538
  }
@@ -1720,23 +1540,23 @@ function execute(_x4) {
1720
1540
  return _execute.apply(this, arguments);
1721
1541
  }
1722
1542
  function _execute() {
1723
- _execute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(plan) {
1543
+ _execute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(plan) {
1724
1544
  var _i, _Object$entries, _Object$entries$_i, key, maybeFileOp;
1725
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1726
- while (1) switch (_context4.prev = _context4.next) {
1545
+ return _regenerator().w(function (_context4) {
1546
+ while (1) switch (_context4.n) {
1727
1547
  case 0:
1728
1548
  if (!plan.abort) {
1729
- _context4.next = 2;
1549
+ _context4.n = 1;
1730
1550
  break;
1731
1551
  }
1732
- return _context4.abrupt("return", warn("Aborted"));
1733
- case 2:
1552
+ return _context4.a(2, warn("Aborted"));
1553
+ case 1:
1734
1554
  if (plan.root) {
1735
- _context4.next = 4;
1555
+ _context4.n = 2;
1736
1556
  break;
1737
1557
  }
1738
- return _context4.abrupt("return", error("Failed to find root directory"));
1739
- case 4:
1558
+ return _context4.a(2, error("Failed to find root directory"));
1559
+ case 2:
1740
1560
  info("Executing...");
1741
1561
  for (_i = 0, _Object$entries = Object.entries(plan); _i < _Object$entries.length; _i++) {
1742
1562
  _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], maybeFileOp = _Object$entries$_i[1];
@@ -1745,9 +1565,8 @@ function _execute() {
1745
1565
  }
1746
1566
  }
1747
1567
  info("\n \nVal was successfully initialized!\n\n Start the application:\n\n $ ".concat(chalk.cyan("npm run dev"), "\n\n Open (assumes http://localhost:3000):\n\n ").concat(chalk.bgBlack.hex("#37cd99").underline("http://localhost:3000/val"), "\n\n When you want to enable editor support, connect the project by opening the following link:\n \n ").concat(chalk.bgBlack.hex("#37cd99").underline("https://admin.val.build/connect".concat(plan.gitRemote ? "?github_repo=".concat(encodeURIComponent([plan.gitRemote.repo, plan.gitRemote.owner].join("/")), "&org=").concat(encodeURIComponent(plan.gitRemote.owner), "&project=").concat(encodeURIComponent(plan.gitRemote.repo)) : "")), "\n\n"));
1748
- case 7:
1749
- case "end":
1750
- return _context4.stop();
1568
+ case 3:
1569
+ return _context4.a(2);
1751
1570
  }
1752
1571
  }, _callee4);
1753
1572
  }));
@@ -1792,10 +1611,10 @@ function main() {
1792
1611
  return _main.apply(this, arguments);
1793
1612
  }
1794
1613
  function _main() {
1795
- _main = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1614
+ _main = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1796
1615
  var _meow, flags;
1797
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1798
- while (1) switch (_context.prev = _context.next) {
1616
+ return _regenerator().w(function (_context) {
1617
+ while (1) switch (_context.n) {
1799
1618
  case 0:
1800
1619
  _meow = meow("\n Usage\n $ npx @valbuild/init\n Description\n Initialize Val in a project\n\n Options\n --help Show this message\n --root [root], -r [root] Set project root directory (default process.cwd())\n --yes [yes], -y [yes] Accept all prompts with defaults.\n ", {
1801
1620
  flags: {
@@ -1810,13 +1629,12 @@ function _main() {
1810
1629
  },
1811
1630
  hardRejection: false
1812
1631
  }), flags = _meow.flags;
1813
- _context.next = 3;
1632
+ _context.n = 1;
1814
1633
  return init(flags.root, {
1815
1634
  yes: flags.yes
1816
1635
  });
1817
- case 3:
1818
- case "end":
1819
- return _context.stop();
1636
+ case 1:
1637
+ return _context.a(2);
1820
1638
  }
1821
1639
  }, _callee);
1822
1640
  }));