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