@valbuild/init 0.63.5 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main/dist/valbuild-init-main.cjs.d.ts +2 -2
- package/main/dist/valbuild-init-main.cjs.dev.js +53 -65
- package/main/dist/valbuild-init-main.cjs.prod.js +53 -65
- package/main/dist/valbuild-init-main.esm.js +53 -65
- package/package.json +1 -1
- package/src/codemods/transformNextAppRouterValProvider.ts +7 -7
- package/src/codemods.test.ts +1 -1
- package/src/init.ts +46 -46
- package/src/logger.ts +1 -1
- package/src/main.ts +3 -3
- package/src/templates.ts +12 -8
- package/main/dist/valbuild-init-main.cjs.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/main";
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
export * from "../../dist/declarations/src/main.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtaW5pdC1tYWluLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL21haW4uZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -128,7 +128,7 @@ function _regeneratorRuntime() {
|
|
|
128
128
|
function makeInvokeMethod(e, r, n) {
|
|
129
129
|
var o = h;
|
|
130
130
|
return function (i, a) {
|
|
131
|
-
if (o === f) throw
|
|
131
|
+
if (o === f) throw Error("Generator is already running");
|
|
132
132
|
if (o === s) {
|
|
133
133
|
if ("throw" === i) throw a;
|
|
134
134
|
return {
|
|
@@ -270,7 +270,7 @@ function _regeneratorRuntime() {
|
|
|
270
270
|
} else if (c) {
|
|
271
271
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
272
272
|
} else {
|
|
273
|
-
if (!u) throw
|
|
273
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
274
274
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -310,7 +310,7 @@ function _regeneratorRuntime() {
|
|
|
310
310
|
return o;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
throw
|
|
313
|
+
throw Error("illegal catch attempt");
|
|
314
314
|
},
|
|
315
315
|
delegateYield: function (e, r, n) {
|
|
316
316
|
return this.delegate = {
|
|
@@ -332,39 +332,34 @@ function _typeof(o) {
|
|
|
332
332
|
}, _typeof(o);
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
function asyncGeneratorStep(
|
|
335
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
336
336
|
try {
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
} catch (
|
|
340
|
-
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
if (info.done) {
|
|
344
|
-
resolve(value);
|
|
345
|
-
} else {
|
|
346
|
-
Promise.resolve(value).then(_next, _throw);
|
|
337
|
+
var i = n[a](c),
|
|
338
|
+
u = i.value;
|
|
339
|
+
} catch (n) {
|
|
340
|
+
return void e(n);
|
|
347
341
|
}
|
|
342
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
348
343
|
}
|
|
349
|
-
function _asyncToGenerator(
|
|
344
|
+
function _asyncToGenerator(n) {
|
|
350
345
|
return function () {
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
return new Promise(function (
|
|
354
|
-
var
|
|
355
|
-
function _next(
|
|
356
|
-
asyncGeneratorStep(
|
|
346
|
+
var t = this,
|
|
347
|
+
e = arguments;
|
|
348
|
+
return new Promise(function (r, o) {
|
|
349
|
+
var a = n.apply(t, e);
|
|
350
|
+
function _next(n) {
|
|
351
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
357
352
|
}
|
|
358
|
-
function _throw(
|
|
359
|
-
asyncGeneratorStep(
|
|
353
|
+
function _throw(n) {
|
|
354
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
360
355
|
}
|
|
361
|
-
_next(
|
|
356
|
+
_next(void 0);
|
|
362
357
|
});
|
|
363
358
|
};
|
|
364
359
|
}
|
|
365
360
|
|
|
366
|
-
function _arrayWithHoles(
|
|
367
|
-
if (Array.isArray(
|
|
361
|
+
function _arrayWithHoles(r) {
|
|
362
|
+
if (Array.isArray(r)) return r;
|
|
368
363
|
}
|
|
369
364
|
|
|
370
365
|
function _iterableToArrayLimit(r, l) {
|
|
@@ -395,30 +390,29 @@ function _iterableToArrayLimit(r, l) {
|
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
392
|
|
|
398
|
-
function _arrayLikeToArray(
|
|
399
|
-
|
|
400
|
-
for (var
|
|
401
|
-
return
|
|
393
|
+
function _arrayLikeToArray(r, a) {
|
|
394
|
+
(null == a || a > r.length) && (a = r.length);
|
|
395
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
396
|
+
return n;
|
|
402
397
|
}
|
|
403
398
|
|
|
404
|
-
function _unsupportedIterableToArray(
|
|
405
|
-
if (
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
399
|
+
function _unsupportedIterableToArray(r, a) {
|
|
400
|
+
if (r) {
|
|
401
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
402
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
403
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
404
|
+
}
|
|
411
405
|
}
|
|
412
406
|
|
|
413
407
|
function _nonIterableRest() {
|
|
414
408
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
415
409
|
}
|
|
416
410
|
|
|
417
|
-
function _slicedToArray(
|
|
418
|
-
return _arrayWithHoles(
|
|
411
|
+
function _slicedToArray(r, e) {
|
|
412
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
419
413
|
}
|
|
420
414
|
|
|
421
|
-
function
|
|
415
|
+
function _toPrimitive(t, r) {
|
|
422
416
|
if ("object" != typeof t || !t) return t;
|
|
423
417
|
var e = t[Symbol.toPrimitive];
|
|
424
418
|
if (void 0 !== e) {
|
|
@@ -429,24 +423,18 @@ function toPrimitive(t, r) {
|
|
|
429
423
|
return ("string" === r ? String : Number)(t);
|
|
430
424
|
}
|
|
431
425
|
|
|
432
|
-
function
|
|
433
|
-
var i =
|
|
434
|
-
return "symbol" == typeof i ? i :
|
|
426
|
+
function _toPropertyKey(t) {
|
|
427
|
+
var i = _toPrimitive(t, "string");
|
|
428
|
+
return "symbol" == typeof i ? i : i + "";
|
|
435
429
|
}
|
|
436
430
|
|
|
437
|
-
function _defineProperty(
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
writable: true
|
|
445
|
-
});
|
|
446
|
-
} else {
|
|
447
|
-
obj[key] = value;
|
|
448
|
-
}
|
|
449
|
-
return obj;
|
|
431
|
+
function _defineProperty(e, r, t) {
|
|
432
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
433
|
+
value: t,
|
|
434
|
+
enumerable: !0,
|
|
435
|
+
configurable: !0,
|
|
436
|
+
writable: !0
|
|
437
|
+
}) : e[r] = t, e;
|
|
450
438
|
}
|
|
451
439
|
|
|
452
440
|
function ownKeys(e, r) {
|
|
@@ -516,7 +504,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
516
504
|
|
|
517
505
|
var packageJson = {
|
|
518
506
|
name: "@valbuild/init",
|
|
519
|
-
version: "0.
|
|
507
|
+
version: "0.65.0",
|
|
520
508
|
description: "Initialize a new val.build project",
|
|
521
509
|
exports: {
|
|
522
510
|
"./main": {
|
|
@@ -569,8 +557,8 @@ var packageJson = {
|
|
|
569
557
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
570
558
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
571
559
|
};
|
|
572
|
-
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
573
|
-
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
560
|
+
var VAL_RSC = function VAL_RSC(configImportPath, valModulesImportPath) {
|
|
561
|
+
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport valModules from \"").concat(valModulesImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, valModules, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
574
562
|
};
|
|
575
563
|
var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
576
564
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
@@ -620,7 +608,7 @@ function init() {
|
|
|
620
608
|
return _init.apply(this, arguments);
|
|
621
609
|
}
|
|
622
610
|
function _init() {
|
|
623
|
-
_init = _asyncToGenerator(
|
|
611
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
624
612
|
var root,
|
|
625
613
|
_ref,
|
|
626
614
|
defaultAnswers,
|
|
@@ -678,7 +666,7 @@ function walk(dir) {
|
|
|
678
666
|
}, []);
|
|
679
667
|
}
|
|
680
668
|
var analyze = /*#__PURE__*/function () {
|
|
681
|
-
var _ref2 = _asyncToGenerator(
|
|
669
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
|
|
682
670
|
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, _semver$minVersion3, _minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
683
671
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
684
672
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -834,7 +822,7 @@ function plan(_x3) {
|
|
|
834
822
|
return _plan.apply(this, arguments);
|
|
835
823
|
}
|
|
836
824
|
function _plan() {
|
|
837
|
-
_plan = _asyncToGenerator(
|
|
825
|
+
_plan = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(analysis) {
|
|
838
826
|
var defaultAnswers,
|
|
839
827
|
plan,
|
|
840
828
|
answer,
|
|
@@ -1337,7 +1325,7 @@ function _plan() {
|
|
|
1337
1325
|
if (_answer6) {
|
|
1338
1326
|
plan.createValRsc = {
|
|
1339
1327
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1340
|
-
source: VAL_RSC(valUtilsImportPath)
|
|
1328
|
+
source: VAL_RSC(valUtilsImportPath, valModulesServerImport)
|
|
1341
1329
|
};
|
|
1342
1330
|
} else {
|
|
1343
1331
|
plan.createValRsc = false;
|
|
@@ -1621,7 +1609,7 @@ function execute(_x4) {
|
|
|
1621
1609
|
return _execute.apply(this, arguments);
|
|
1622
1610
|
}
|
|
1623
1611
|
function _execute() {
|
|
1624
|
-
_execute = _asyncToGenerator(
|
|
1612
|
+
_execute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(plan) {
|
|
1625
1613
|
var _i, _Object$entries, _Object$entries$_i, key, maybeFileOp;
|
|
1626
1614
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1627
1615
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1693,7 +1681,7 @@ function main() {
|
|
|
1693
1681
|
return _main.apply(this, arguments);
|
|
1694
1682
|
}
|
|
1695
1683
|
function _main() {
|
|
1696
|
-
_main = _asyncToGenerator(
|
|
1684
|
+
_main = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1697
1685
|
var _meow, flags;
|
|
1698
1686
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1699
1687
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -128,7 +128,7 @@ function _regeneratorRuntime() {
|
|
|
128
128
|
function makeInvokeMethod(e, r, n) {
|
|
129
129
|
var o = h;
|
|
130
130
|
return function (i, a) {
|
|
131
|
-
if (o === f) throw
|
|
131
|
+
if (o === f) throw Error("Generator is already running");
|
|
132
132
|
if (o === s) {
|
|
133
133
|
if ("throw" === i) throw a;
|
|
134
134
|
return {
|
|
@@ -270,7 +270,7 @@ function _regeneratorRuntime() {
|
|
|
270
270
|
} else if (c) {
|
|
271
271
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
272
272
|
} else {
|
|
273
|
-
if (!u) throw
|
|
273
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
274
274
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -310,7 +310,7 @@ function _regeneratorRuntime() {
|
|
|
310
310
|
return o;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
throw
|
|
313
|
+
throw Error("illegal catch attempt");
|
|
314
314
|
},
|
|
315
315
|
delegateYield: function (e, r, n) {
|
|
316
316
|
return this.delegate = {
|
|
@@ -332,39 +332,34 @@ function _typeof(o) {
|
|
|
332
332
|
}, _typeof(o);
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
function asyncGeneratorStep(
|
|
335
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
336
336
|
try {
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
} catch (
|
|
340
|
-
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
if (info.done) {
|
|
344
|
-
resolve(value);
|
|
345
|
-
} else {
|
|
346
|
-
Promise.resolve(value).then(_next, _throw);
|
|
337
|
+
var i = n[a](c),
|
|
338
|
+
u = i.value;
|
|
339
|
+
} catch (n) {
|
|
340
|
+
return void e(n);
|
|
347
341
|
}
|
|
342
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
348
343
|
}
|
|
349
|
-
function _asyncToGenerator(
|
|
344
|
+
function _asyncToGenerator(n) {
|
|
350
345
|
return function () {
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
return new Promise(function (
|
|
354
|
-
var
|
|
355
|
-
function _next(
|
|
356
|
-
asyncGeneratorStep(
|
|
346
|
+
var t = this,
|
|
347
|
+
e = arguments;
|
|
348
|
+
return new Promise(function (r, o) {
|
|
349
|
+
var a = n.apply(t, e);
|
|
350
|
+
function _next(n) {
|
|
351
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
357
352
|
}
|
|
358
|
-
function _throw(
|
|
359
|
-
asyncGeneratorStep(
|
|
353
|
+
function _throw(n) {
|
|
354
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
360
355
|
}
|
|
361
|
-
_next(
|
|
356
|
+
_next(void 0);
|
|
362
357
|
});
|
|
363
358
|
};
|
|
364
359
|
}
|
|
365
360
|
|
|
366
|
-
function _arrayWithHoles(
|
|
367
|
-
if (Array.isArray(
|
|
361
|
+
function _arrayWithHoles(r) {
|
|
362
|
+
if (Array.isArray(r)) return r;
|
|
368
363
|
}
|
|
369
364
|
|
|
370
365
|
function _iterableToArrayLimit(r, l) {
|
|
@@ -395,30 +390,29 @@ function _iterableToArrayLimit(r, l) {
|
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
392
|
|
|
398
|
-
function _arrayLikeToArray(
|
|
399
|
-
|
|
400
|
-
for (var
|
|
401
|
-
return
|
|
393
|
+
function _arrayLikeToArray(r, a) {
|
|
394
|
+
(null == a || a > r.length) && (a = r.length);
|
|
395
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
396
|
+
return n;
|
|
402
397
|
}
|
|
403
398
|
|
|
404
|
-
function _unsupportedIterableToArray(
|
|
405
|
-
if (
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
399
|
+
function _unsupportedIterableToArray(r, a) {
|
|
400
|
+
if (r) {
|
|
401
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
402
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
403
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
404
|
+
}
|
|
411
405
|
}
|
|
412
406
|
|
|
413
407
|
function _nonIterableRest() {
|
|
414
408
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
415
409
|
}
|
|
416
410
|
|
|
417
|
-
function _slicedToArray(
|
|
418
|
-
return _arrayWithHoles(
|
|
411
|
+
function _slicedToArray(r, e) {
|
|
412
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
419
413
|
}
|
|
420
414
|
|
|
421
|
-
function
|
|
415
|
+
function _toPrimitive(t, r) {
|
|
422
416
|
if ("object" != typeof t || !t) return t;
|
|
423
417
|
var e = t[Symbol.toPrimitive];
|
|
424
418
|
if (void 0 !== e) {
|
|
@@ -429,24 +423,18 @@ function toPrimitive(t, r) {
|
|
|
429
423
|
return ("string" === r ? String : Number)(t);
|
|
430
424
|
}
|
|
431
425
|
|
|
432
|
-
function
|
|
433
|
-
var i =
|
|
434
|
-
return "symbol" == typeof i ? i :
|
|
426
|
+
function _toPropertyKey(t) {
|
|
427
|
+
var i = _toPrimitive(t, "string");
|
|
428
|
+
return "symbol" == typeof i ? i : i + "";
|
|
435
429
|
}
|
|
436
430
|
|
|
437
|
-
function _defineProperty(
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
writable: true
|
|
445
|
-
});
|
|
446
|
-
} else {
|
|
447
|
-
obj[key] = value;
|
|
448
|
-
}
|
|
449
|
-
return obj;
|
|
431
|
+
function _defineProperty(e, r, t) {
|
|
432
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
433
|
+
value: t,
|
|
434
|
+
enumerable: !0,
|
|
435
|
+
configurable: !0,
|
|
436
|
+
writable: !0
|
|
437
|
+
}) : e[r] = t, e;
|
|
450
438
|
}
|
|
451
439
|
|
|
452
440
|
function ownKeys(e, r) {
|
|
@@ -516,7 +504,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
516
504
|
|
|
517
505
|
var packageJson = {
|
|
518
506
|
name: "@valbuild/init",
|
|
519
|
-
version: "0.
|
|
507
|
+
version: "0.65.0",
|
|
520
508
|
description: "Initialize a new val.build project",
|
|
521
509
|
exports: {
|
|
522
510
|
"./main": {
|
|
@@ -569,8 +557,8 @@ var packageJson = {
|
|
|
569
557
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
570
558
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
571
559
|
};
|
|
572
|
-
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
573
|
-
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
560
|
+
var VAL_RSC = function VAL_RSC(configImportPath, valModulesImportPath) {
|
|
561
|
+
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport valModules from \"").concat(valModulesImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, valModules, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
574
562
|
};
|
|
575
563
|
var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
576
564
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
@@ -620,7 +608,7 @@ function init() {
|
|
|
620
608
|
return _init.apply(this, arguments);
|
|
621
609
|
}
|
|
622
610
|
function _init() {
|
|
623
|
-
_init = _asyncToGenerator(
|
|
611
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
624
612
|
var root,
|
|
625
613
|
_ref,
|
|
626
614
|
defaultAnswers,
|
|
@@ -678,7 +666,7 @@ function walk(dir) {
|
|
|
678
666
|
}, []);
|
|
679
667
|
}
|
|
680
668
|
var analyze = /*#__PURE__*/function () {
|
|
681
|
-
var _ref2 = _asyncToGenerator(
|
|
669
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
|
|
682
670
|
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, _semver$minVersion3, _minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
683
671
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
684
672
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -834,7 +822,7 @@ function plan(_x3) {
|
|
|
834
822
|
return _plan.apply(this, arguments);
|
|
835
823
|
}
|
|
836
824
|
function _plan() {
|
|
837
|
-
_plan = _asyncToGenerator(
|
|
825
|
+
_plan = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(analysis) {
|
|
838
826
|
var defaultAnswers,
|
|
839
827
|
plan,
|
|
840
828
|
answer,
|
|
@@ -1337,7 +1325,7 @@ function _plan() {
|
|
|
1337
1325
|
if (_answer6) {
|
|
1338
1326
|
plan.createValRsc = {
|
|
1339
1327
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1340
|
-
source: VAL_RSC(valUtilsImportPath)
|
|
1328
|
+
source: VAL_RSC(valUtilsImportPath, valModulesServerImport)
|
|
1341
1329
|
};
|
|
1342
1330
|
} else {
|
|
1343
1331
|
plan.createValRsc = false;
|
|
@@ -1621,7 +1609,7 @@ function execute(_x4) {
|
|
|
1621
1609
|
return _execute.apply(this, arguments);
|
|
1622
1610
|
}
|
|
1623
1611
|
function _execute() {
|
|
1624
|
-
_execute = _asyncToGenerator(
|
|
1612
|
+
_execute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(plan) {
|
|
1625
1613
|
var _i, _Object$entries, _Object$entries$_i, key, maybeFileOp;
|
|
1626
1614
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1627
1615
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1693,7 +1681,7 @@ function main() {
|
|
|
1693
1681
|
return _main.apply(this, arguments);
|
|
1694
1682
|
}
|
|
1695
1683
|
function _main() {
|
|
1696
|
-
_main = _asyncToGenerator(
|
|
1684
|
+
_main = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1697
1685
|
var _meow, flags;
|
|
1698
1686
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1699
1687
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -116,7 +116,7 @@ function _regeneratorRuntime() {
|
|
|
116
116
|
function makeInvokeMethod(e, r, n) {
|
|
117
117
|
var o = h;
|
|
118
118
|
return function (i, a) {
|
|
119
|
-
if (o === f) throw
|
|
119
|
+
if (o === f) throw Error("Generator is already running");
|
|
120
120
|
if (o === s) {
|
|
121
121
|
if ("throw" === i) throw a;
|
|
122
122
|
return {
|
|
@@ -258,7 +258,7 @@ function _regeneratorRuntime() {
|
|
|
258
258
|
} else if (c) {
|
|
259
259
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
260
260
|
} else {
|
|
261
|
-
if (!u) throw
|
|
261
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
262
262
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -298,7 +298,7 @@ function _regeneratorRuntime() {
|
|
|
298
298
|
return o;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
throw
|
|
301
|
+
throw Error("illegal catch attempt");
|
|
302
302
|
},
|
|
303
303
|
delegateYield: function (e, r, n) {
|
|
304
304
|
return this.delegate = {
|
|
@@ -320,39 +320,34 @@ function _typeof(o) {
|
|
|
320
320
|
}, _typeof(o);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
function asyncGeneratorStep(
|
|
323
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
324
324
|
try {
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
} catch (
|
|
328
|
-
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (info.done) {
|
|
332
|
-
resolve(value);
|
|
333
|
-
} else {
|
|
334
|
-
Promise.resolve(value).then(_next, _throw);
|
|
325
|
+
var i = n[a](c),
|
|
326
|
+
u = i.value;
|
|
327
|
+
} catch (n) {
|
|
328
|
+
return void e(n);
|
|
335
329
|
}
|
|
330
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
336
331
|
}
|
|
337
|
-
function _asyncToGenerator(
|
|
332
|
+
function _asyncToGenerator(n) {
|
|
338
333
|
return function () {
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
return new Promise(function (
|
|
342
|
-
var
|
|
343
|
-
function _next(
|
|
344
|
-
asyncGeneratorStep(
|
|
334
|
+
var t = this,
|
|
335
|
+
e = arguments;
|
|
336
|
+
return new Promise(function (r, o) {
|
|
337
|
+
var a = n.apply(t, e);
|
|
338
|
+
function _next(n) {
|
|
339
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
345
340
|
}
|
|
346
|
-
function _throw(
|
|
347
|
-
asyncGeneratorStep(
|
|
341
|
+
function _throw(n) {
|
|
342
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
348
343
|
}
|
|
349
|
-
_next(
|
|
344
|
+
_next(void 0);
|
|
350
345
|
});
|
|
351
346
|
};
|
|
352
347
|
}
|
|
353
348
|
|
|
354
|
-
function _arrayWithHoles(
|
|
355
|
-
if (Array.isArray(
|
|
349
|
+
function _arrayWithHoles(r) {
|
|
350
|
+
if (Array.isArray(r)) return r;
|
|
356
351
|
}
|
|
357
352
|
|
|
358
353
|
function _iterableToArrayLimit(r, l) {
|
|
@@ -383,30 +378,29 @@ function _iterableToArrayLimit(r, l) {
|
|
|
383
378
|
}
|
|
384
379
|
}
|
|
385
380
|
|
|
386
|
-
function _arrayLikeToArray(
|
|
387
|
-
|
|
388
|
-
for (var
|
|
389
|
-
return
|
|
381
|
+
function _arrayLikeToArray(r, a) {
|
|
382
|
+
(null == a || a > r.length) && (a = r.length);
|
|
383
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
384
|
+
return n;
|
|
390
385
|
}
|
|
391
386
|
|
|
392
|
-
function _unsupportedIterableToArray(
|
|
393
|
-
if (
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
387
|
+
function _unsupportedIterableToArray(r, a) {
|
|
388
|
+
if (r) {
|
|
389
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
390
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
391
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
392
|
+
}
|
|
399
393
|
}
|
|
400
394
|
|
|
401
395
|
function _nonIterableRest() {
|
|
402
396
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
403
397
|
}
|
|
404
398
|
|
|
405
|
-
function _slicedToArray(
|
|
406
|
-
return _arrayWithHoles(
|
|
399
|
+
function _slicedToArray(r, e) {
|
|
400
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
407
401
|
}
|
|
408
402
|
|
|
409
|
-
function
|
|
403
|
+
function _toPrimitive(t, r) {
|
|
410
404
|
if ("object" != typeof t || !t) return t;
|
|
411
405
|
var e = t[Symbol.toPrimitive];
|
|
412
406
|
if (void 0 !== e) {
|
|
@@ -417,24 +411,18 @@ function toPrimitive(t, r) {
|
|
|
417
411
|
return ("string" === r ? String : Number)(t);
|
|
418
412
|
}
|
|
419
413
|
|
|
420
|
-
function
|
|
421
|
-
var i =
|
|
422
|
-
return "symbol" == typeof i ? i :
|
|
414
|
+
function _toPropertyKey(t) {
|
|
415
|
+
var i = _toPrimitive(t, "string");
|
|
416
|
+
return "symbol" == typeof i ? i : i + "";
|
|
423
417
|
}
|
|
424
418
|
|
|
425
|
-
function _defineProperty(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
writable: true
|
|
433
|
-
});
|
|
434
|
-
} else {
|
|
435
|
-
obj[key] = value;
|
|
436
|
-
}
|
|
437
|
-
return obj;
|
|
419
|
+
function _defineProperty(e, r, t) {
|
|
420
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
421
|
+
value: t,
|
|
422
|
+
enumerable: !0,
|
|
423
|
+
configurable: !0,
|
|
424
|
+
writable: !0
|
|
425
|
+
}) : e[r] = t, e;
|
|
438
426
|
}
|
|
439
427
|
|
|
440
428
|
function ownKeys(e, r) {
|
|
@@ -504,7 +492,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
504
492
|
|
|
505
493
|
var packageJson = {
|
|
506
494
|
name: "@valbuild/init",
|
|
507
|
-
version: "0.
|
|
495
|
+
version: "0.65.0",
|
|
508
496
|
description: "Initialize a new val.build project",
|
|
509
497
|
exports: {
|
|
510
498
|
"./main": {
|
|
@@ -557,8 +545,8 @@ var packageJson = {
|
|
|
557
545
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
558
546
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
559
547
|
};
|
|
560
|
-
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
561
|
-
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
548
|
+
var VAL_RSC = function VAL_RSC(configImportPath, valModulesImportPath) {
|
|
549
|
+
return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport valModules from \"").concat(valModulesImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, valModules, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
|
|
562
550
|
};
|
|
563
551
|
var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
564
552
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
@@ -608,7 +596,7 @@ function init() {
|
|
|
608
596
|
return _init.apply(this, arguments);
|
|
609
597
|
}
|
|
610
598
|
function _init() {
|
|
611
|
-
_init = _asyncToGenerator(
|
|
599
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
612
600
|
var root,
|
|
613
601
|
_ref,
|
|
614
602
|
defaultAnswers,
|
|
@@ -666,7 +654,7 @@ function walk(dir) {
|
|
|
666
654
|
}, []);
|
|
667
655
|
}
|
|
668
656
|
var analyze = /*#__PURE__*/function () {
|
|
669
|
-
var _ref2 = _asyncToGenerator(
|
|
657
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
|
|
670
658
|
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, _semver$minVersion3, _minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
671
659
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
672
660
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -822,7 +810,7 @@ function plan(_x3) {
|
|
|
822
810
|
return _plan.apply(this, arguments);
|
|
823
811
|
}
|
|
824
812
|
function _plan() {
|
|
825
|
-
_plan = _asyncToGenerator(
|
|
813
|
+
_plan = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(analysis) {
|
|
826
814
|
var defaultAnswers,
|
|
827
815
|
plan,
|
|
828
816
|
answer,
|
|
@@ -1325,7 +1313,7 @@ function _plan() {
|
|
|
1325
1313
|
if (_answer6) {
|
|
1326
1314
|
plan.createValRsc = {
|
|
1327
1315
|
path: path.join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1328
|
-
source: VAL_RSC(valUtilsImportPath)
|
|
1316
|
+
source: VAL_RSC(valUtilsImportPath, valModulesServerImport)
|
|
1329
1317
|
};
|
|
1330
1318
|
} else {
|
|
1331
1319
|
plan.createValRsc = false;
|
|
@@ -1609,7 +1597,7 @@ function execute(_x4) {
|
|
|
1609
1597
|
return _execute.apply(this, arguments);
|
|
1610
1598
|
}
|
|
1611
1599
|
function _execute() {
|
|
1612
|
-
_execute = _asyncToGenerator(
|
|
1600
|
+
_execute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(plan) {
|
|
1613
1601
|
var _i, _Object$entries, _Object$entries$_i, key, maybeFileOp;
|
|
1614
1602
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1615
1603
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1681,7 +1669,7 @@ function main() {
|
|
|
1681
1669
|
return _main.apply(this, arguments);
|
|
1682
1670
|
}
|
|
1683
1671
|
function _main() {
|
|
1684
|
-
_main = _asyncToGenerator(
|
|
1672
|
+
_main = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1685
1673
|
var _meow, flags;
|
|
1686
1674
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1687
1675
|
while (1) switch (_context.prev = _context.next) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import j from "jscodeshift";
|
|
|
3
3
|
export function transformNextAppRouterValProvider(
|
|
4
4
|
fileInfo: j.FileInfo,
|
|
5
5
|
api: j.API,
|
|
6
|
-
options: j.Options
|
|
6
|
+
options: j.Options,
|
|
7
7
|
) {
|
|
8
8
|
if (!options.configImportPath) {
|
|
9
9
|
throw new Error("configImportPath is required");
|
|
@@ -15,14 +15,14 @@ export function transformNextAppRouterValProvider(
|
|
|
15
15
|
.insertBefore(
|
|
16
16
|
j.importDeclaration(
|
|
17
17
|
[j.importSpecifier(j.identifier("ValProvider"))],
|
|
18
|
-
j.literal("@valbuild/next")
|
|
19
|
-
)
|
|
18
|
+
j.literal("@valbuild/next"),
|
|
19
|
+
),
|
|
20
20
|
)
|
|
21
21
|
.insertBefore(
|
|
22
22
|
j.importDeclaration(
|
|
23
23
|
[j.importSpecifier(j.identifier("config"))],
|
|
24
|
-
j.literal(options.configImportPath)
|
|
25
|
-
)
|
|
24
|
+
j.literal(options.configImportPath),
|
|
25
|
+
),
|
|
26
26
|
);
|
|
27
27
|
root
|
|
28
28
|
.findJSXElements("body")
|
|
@@ -66,8 +66,8 @@ export function transformNextAppRouterValProvider(
|
|
|
66
66
|
},
|
|
67
67
|
type: "JSXClosingElement",
|
|
68
68
|
},
|
|
69
|
-
[j.jsxExpressionContainer(j.identifier("children"))]
|
|
70
|
-
)
|
|
69
|
+
[j.jsxExpressionContainer(j.identifier("children"))],
|
|
70
|
+
),
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/codemods.test.ts
CHANGED
package/src/init.ts
CHANGED
|
@@ -26,14 +26,14 @@ const MIN_NEXT_VERSION = "13.4.0";
|
|
|
26
26
|
let maxResetLength = 0;
|
|
27
27
|
export async function init(
|
|
28
28
|
root: string = process.cwd(),
|
|
29
|
-
{ yes: defaultAnswers }: { yes?: boolean } = {}
|
|
29
|
+
{ yes: defaultAnswers }: { yes?: boolean } = {},
|
|
30
30
|
) {
|
|
31
31
|
logger.info(
|
|
32
32
|
"Initializing " +
|
|
33
33
|
chalk.bgBlack.hex("#37cd99")("Val") +
|
|
34
34
|
' in "' +
|
|
35
35
|
root +
|
|
36
|
-
'"...\n'
|
|
36
|
+
'"...\n',
|
|
37
37
|
);
|
|
38
38
|
process.stdout.write("Analyzing project...");
|
|
39
39
|
const analysis = await analyze(path.resolve(root), walk(path.resolve(root)));
|
|
@@ -126,7 +126,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
126
126
|
}
|
|
127
127
|
const analysis: Analysis = { root };
|
|
128
128
|
const packageJsonPath = files.find(
|
|
129
|
-
(file) => file === [root, "package.json"].join(sep)
|
|
129
|
+
(file) => file === [root, "package.json"].join(sep),
|
|
130
130
|
);
|
|
131
131
|
analysis.packageJsonDir = packageJsonPath && path.dirname(packageJsonPath);
|
|
132
132
|
|
|
@@ -148,7 +148,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
148
148
|
analysis.valNextVersion = packageJson.dependencies["@valbuild/next"];
|
|
149
149
|
} catch (err) {
|
|
150
150
|
throw new Error(
|
|
151
|
-
`Failed to parse package.json in file: ${packageJsonPath}
|
|
151
|
+
`Failed to parse package.json in file: ${packageJsonPath}`,
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -158,7 +158,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
158
158
|
if (minNextVersion) {
|
|
159
159
|
analysis.nextVersionIsSatisfied = semver.satisfies(
|
|
160
160
|
minNextVersion,
|
|
161
|
-
">=" + MIN_NEXT_VERSION
|
|
161
|
+
">=" + MIN_NEXT_VERSION,
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -167,7 +167,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
167
167
|
if (minValVersion) {
|
|
168
168
|
analysis.valNextVersionIsSatisfied = semver.satisfies(
|
|
169
169
|
minValVersion,
|
|
170
|
-
">=" + MIN_VAL_VERSION
|
|
170
|
+
">=" + MIN_VAL_VERSION,
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -176,7 +176,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
176
176
|
if (minValVersion) {
|
|
177
177
|
analysis.valCoreVersionIsSatisfied = semver.satisfies(
|
|
178
178
|
minValVersion,
|
|
179
|
-
">=" + MIN_VAL_VERSION
|
|
179
|
+
">=" + MIN_VAL_VERSION,
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -187,7 +187,7 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
187
187
|
if (analysis.eslintRcJsText) {
|
|
188
188
|
// TODO: Evaluate and extract config?
|
|
189
189
|
analysis.isValEslintRulesConfigured = analysis.eslintRcJsText.includes(
|
|
190
|
-
"plugin:@valbuild/recommended"
|
|
190
|
+
"plugin:@valbuild/recommended",
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -197,12 +197,12 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
197
197
|
if (analysis.eslintRcJsonPath) {
|
|
198
198
|
analysis.eslintRcJsonText = fs.readFileSync(
|
|
199
199
|
analysis.eslintRcJsonPath,
|
|
200
|
-
"utf8"
|
|
200
|
+
"utf8",
|
|
201
201
|
);
|
|
202
202
|
if (analysis.eslintRcJsonText) {
|
|
203
203
|
// TODO: Parse properly
|
|
204
204
|
analysis.isValEslintRulesConfigured = analysis.eslintRcJsonText.includes(
|
|
205
|
-
"plugin:@valbuild/recommended"
|
|
205
|
+
"plugin:@valbuild/recommended",
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -295,7 +295,7 @@ type Plan = Partial<{
|
|
|
295
295
|
|
|
296
296
|
async function plan(
|
|
297
297
|
analysis: Readonly<Analysis>,
|
|
298
|
-
defaultAnswers: boolean = false
|
|
298
|
+
defaultAnswers: boolean = false,
|
|
299
299
|
): Promise<Plan> {
|
|
300
300
|
const plan: Plan = { root: analysis.root };
|
|
301
301
|
|
|
@@ -329,7 +329,7 @@ async function plan(
|
|
|
329
329
|
} else {
|
|
330
330
|
if (!analysis.valCoreVersionIsSatisfied) {
|
|
331
331
|
logger.warn(
|
|
332
|
-
` This init script expects @valbuild/core >= ${MIN_VAL_VERSION}. Found: ${analysis.valCoreVersion}
|
|
332
|
+
` This init script expects @valbuild/core >= ${MIN_VAL_VERSION}. Found: ${analysis.valCoreVersion}`,
|
|
333
333
|
);
|
|
334
334
|
const answer = !defaultAnswers
|
|
335
335
|
? await confirm({
|
|
@@ -339,14 +339,14 @@ async function plan(
|
|
|
339
339
|
: false;
|
|
340
340
|
if (!answer) {
|
|
341
341
|
logger.error(
|
|
342
|
-
`Aborted: @valbuild/core version is not satisfied.\n\nInstall the @valbuild/core@${MIN_VAL_VERSION} package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/core@${MIN_VAL_VERSION}\n
|
|
342
|
+
`Aborted: @valbuild/core version is not satisfied.\n\nInstall the @valbuild/core@${MIN_VAL_VERSION} package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/core@${MIN_VAL_VERSION}\n`,
|
|
343
343
|
);
|
|
344
344
|
return { abort: true };
|
|
345
345
|
}
|
|
346
346
|
} else {
|
|
347
347
|
logger.info(
|
|
348
348
|
` Val version: found ${analysis.valCoreVersion} >= ${MIN_VAL_VERSION}`,
|
|
349
|
-
{ isGood: true }
|
|
349
|
+
{ isGood: true },
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
@@ -356,7 +356,7 @@ async function plan(
|
|
|
356
356
|
} else {
|
|
357
357
|
if (!analysis.valNextVersionIsSatisfied) {
|
|
358
358
|
logger.warn(
|
|
359
|
-
` This init script expects @valbuild/next >= ${MIN_VAL_VERSION}. Found: ${analysis.valNextVersion}
|
|
359
|
+
` This init script expects @valbuild/next >= ${MIN_VAL_VERSION}. Found: ${analysis.valNextVersion}`,
|
|
360
360
|
);
|
|
361
361
|
const answer = !defaultAnswers
|
|
362
362
|
? await confirm({
|
|
@@ -366,26 +366,26 @@ async function plan(
|
|
|
366
366
|
: false;
|
|
367
367
|
if (!answer) {
|
|
368
368
|
logger.error(
|
|
369
|
-
`Aborted: @valbuild/next version is not satisfied.\n\nInstall the @valbuild/next@${MIN_VAL_VERSION} package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/next@${MIN_VAL_VERSION}\n
|
|
369
|
+
`Aborted: @valbuild/next version is not satisfied.\n\nInstall the @valbuild/next@${MIN_VAL_VERSION} package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/next@${MIN_VAL_VERSION}\n`,
|
|
370
370
|
);
|
|
371
371
|
return { abort: true };
|
|
372
372
|
}
|
|
373
373
|
} else {
|
|
374
374
|
logger.info(
|
|
375
375
|
` Val version: found ${analysis.valNextVersion} >= ${MIN_VAL_VERSION}`,
|
|
376
|
-
{ isGood: true }
|
|
376
|
+
{ isGood: true },
|
|
377
377
|
);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
if (!analysis.nextVersionIsSatisfied) {
|
|
381
381
|
logger.error(
|
|
382
|
-
`Val requires Next.js >= ${MIN_NEXT_VERSION}. Found: ${analysis.nextVersion}
|
|
382
|
+
`Val requires Next.js >= ${MIN_NEXT_VERSION}. Found: ${analysis.nextVersion}`,
|
|
383
383
|
);
|
|
384
384
|
return { abort: true };
|
|
385
385
|
} else {
|
|
386
386
|
logger.info(
|
|
387
387
|
` Next.js version: found ${analysis.nextVersion} >= ${MIN_NEXT_VERSION}`,
|
|
388
|
-
{ isGood: true }
|
|
388
|
+
{ isGood: true },
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
391
|
if (analysis.isTypeScript) {
|
|
@@ -426,7 +426,7 @@ async function plan(
|
|
|
426
426
|
: false;
|
|
427
427
|
if (!answer) {
|
|
428
428
|
logger.error(
|
|
429
|
-
"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"
|
|
429
|
+
"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",
|
|
430
430
|
);
|
|
431
431
|
return { abort: true };
|
|
432
432
|
}
|
|
@@ -445,7 +445,7 @@ async function plan(
|
|
|
445
445
|
" Git state: clean (only package.json / lock files modified)",
|
|
446
446
|
{
|
|
447
447
|
isGood: true,
|
|
448
|
-
}
|
|
448
|
+
},
|
|
449
449
|
);
|
|
450
450
|
} else {
|
|
451
451
|
logger.info(" Git state: clean", { isGood: true });
|
|
@@ -474,11 +474,11 @@ async function plan(
|
|
|
474
474
|
// New required files:
|
|
475
475
|
const valConfigPath = path.join(
|
|
476
476
|
analysis.root,
|
|
477
|
-
analysis.isTypeScript ? "val.config.ts" : "val.config.js"
|
|
477
|
+
analysis.isTypeScript ? "val.config.ts" : "val.config.js",
|
|
478
478
|
);
|
|
479
479
|
if (fs.existsSync(valConfigPath)) {
|
|
480
480
|
logger.error(
|
|
481
|
-
`Aborted: a Val config file: ${valConfigPath} already exists
|
|
481
|
+
`Aborted: a Val config file: ${valConfigPath} already exists.`,
|
|
482
482
|
);
|
|
483
483
|
return { abort: true };
|
|
484
484
|
}
|
|
@@ -499,7 +499,7 @@ async function plan(
|
|
|
499
499
|
const exampleDir = path.join(analysis.srcDir, "examples", "val");
|
|
500
500
|
const examplePath = path.join(
|
|
501
501
|
exampleDir,
|
|
502
|
-
"example.val." + (analysis.isJavaScript ? "js" : "ts")
|
|
502
|
+
"example.val." + (analysis.isJavaScript ? "js" : "ts"),
|
|
503
503
|
);
|
|
504
504
|
const exampleImport = path
|
|
505
505
|
.relative(exampleDir, valConfigPath)
|
|
@@ -507,12 +507,12 @@ async function plan(
|
|
|
507
507
|
.replace(".ts", "");
|
|
508
508
|
if (!analysis.packageJsonDir) {
|
|
509
509
|
throw Error(
|
|
510
|
-
"Could not detect package.json directory! This is a Val bug."
|
|
510
|
+
"Could not detect package.json directory! This is a Val bug.",
|
|
511
511
|
);
|
|
512
512
|
}
|
|
513
513
|
const exampleModuleFilePath = `/${path.relative(
|
|
514
514
|
analysis.packageJsonDir,
|
|
515
|
-
examplePath
|
|
515
|
+
examplePath,
|
|
516
516
|
)}`;
|
|
517
517
|
|
|
518
518
|
plan.includeExample = {
|
|
@@ -520,7 +520,7 @@ async function plan(
|
|
|
520
520
|
source: BASIC_EXAMPLE(
|
|
521
521
|
exampleModuleFilePath,
|
|
522
522
|
exampleImport,
|
|
523
|
-
!!analysis.isJavaScript
|
|
523
|
+
!!analysis.isJavaScript,
|
|
524
524
|
),
|
|
525
525
|
};
|
|
526
526
|
}
|
|
@@ -555,7 +555,7 @@ async function plan(
|
|
|
555
555
|
.replace(".ts", "");
|
|
556
556
|
const valServerPath = path.join(
|
|
557
557
|
valUtilsDir,
|
|
558
|
-
analysis.isTypeScript ? "val.server.ts" : "val.server.js"
|
|
558
|
+
analysis.isTypeScript ? "val.server.ts" : "val.server.js",
|
|
559
559
|
);
|
|
560
560
|
plan.createValServer = {
|
|
561
561
|
path: valServerPath,
|
|
@@ -571,7 +571,7 @@ async function plan(
|
|
|
571
571
|
"(val)",
|
|
572
572
|
"val",
|
|
573
573
|
"[[...val]]",
|
|
574
|
-
analysis.isTypeScript ? "page.tsx" : "page.jsx"
|
|
574
|
+
analysis.isTypeScript ? "page.tsx" : "page.jsx",
|
|
575
575
|
);
|
|
576
576
|
const valPageImportPath = path
|
|
577
577
|
.relative(path.dirname(valAppPagePath), valConfigPath)
|
|
@@ -588,7 +588,7 @@ async function plan(
|
|
|
588
588
|
"api",
|
|
589
589
|
"val",
|
|
590
590
|
"[[...val]]",
|
|
591
|
-
analysis.isTypeScript ? "route.ts" : "route.js"
|
|
591
|
+
analysis.isTypeScript ? "route.ts" : "route.js",
|
|
592
592
|
);
|
|
593
593
|
const valRouterImportPath = path
|
|
594
594
|
.relative(path.dirname(valRouterPath), valServerPath)
|
|
@@ -612,7 +612,7 @@ async function plan(
|
|
|
612
612
|
plan.createValClient = {
|
|
613
613
|
path: path.join(
|
|
614
614
|
valUtilsDir,
|
|
615
|
-
analysis.isTypeScript ? "val.client.ts" : "val.client.js"
|
|
615
|
+
analysis.isTypeScript ? "val.client.ts" : "val.client.js",
|
|
616
616
|
),
|
|
617
617
|
source: VAL_CLIENT(valUtilsImportPath),
|
|
618
618
|
};
|
|
@@ -631,9 +631,9 @@ async function plan(
|
|
|
631
631
|
plan.createValRsc = {
|
|
632
632
|
path: path.join(
|
|
633
633
|
valUtilsDir,
|
|
634
|
-
analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"
|
|
634
|
+
analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js",
|
|
635
635
|
),
|
|
636
|
-
source: VAL_RSC(valUtilsImportPath),
|
|
636
|
+
source: VAL_RSC(valUtilsImportPath, valModulesServerImport),
|
|
637
637
|
};
|
|
638
638
|
} else {
|
|
639
639
|
plan.createValRsc = false;
|
|
@@ -666,7 +666,7 @@ async function plan(
|
|
|
666
666
|
.relative(path.dirname(analysis.appRouterLayoutPath), valConfigPath)
|
|
667
667
|
.replace(".js", "")
|
|
668
668
|
.replace(".ts", ""),
|
|
669
|
-
}
|
|
669
|
+
},
|
|
670
670
|
);
|
|
671
671
|
|
|
672
672
|
const diff = diffLines(analysis.appRouterLayoutFile, res, {});
|
|
@@ -717,7 +717,7 @@ async function plan(
|
|
|
717
717
|
} else {
|
|
718
718
|
if (analysis.eslintRcJsPath) {
|
|
719
719
|
logger.warn(
|
|
720
|
-
'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'
|
|
720
|
+
'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',
|
|
721
721
|
);
|
|
722
722
|
} else if (analysis.eslintRcJsonPath) {
|
|
723
723
|
const answer = !defaultAnswers
|
|
@@ -730,12 +730,12 @@ async function plan(
|
|
|
730
730
|
if (answer) {
|
|
731
731
|
const currentEslintRc = fs.readFileSync(
|
|
732
732
|
analysis.eslintRcJsonPath,
|
|
733
|
-
"utf-8"
|
|
733
|
+
"utf-8",
|
|
734
734
|
);
|
|
735
735
|
const parsedEslint = JSON.parse(currentEslintRc);
|
|
736
736
|
if (typeof parsedEslint !== "object") {
|
|
737
737
|
logger.error(
|
|
738
|
-
`Could not patch eslint: ${analysis.eslintRcJsonPath} was not an object
|
|
738
|
+
`Could not patch eslint: ${analysis.eslintRcJsonPath} was not an object`,
|
|
739
739
|
);
|
|
740
740
|
return { abort: true };
|
|
741
741
|
}
|
|
@@ -798,7 +798,7 @@ async function plan(
|
|
|
798
798
|
logger.warn(
|
|
799
799
|
`Failed to parse VS Code extensions.json found here: ${settingsPath}.${
|
|
800
800
|
err instanceof Error ? `Parse error: ${err.message}` : ""
|
|
801
|
-
}
|
|
801
|
+
}`,
|
|
802
802
|
);
|
|
803
803
|
return {
|
|
804
804
|
abort: true,
|
|
@@ -816,7 +816,7 @@ async function plan(
|
|
|
816
816
|
currentSettings = {
|
|
817
817
|
...currentSettings,
|
|
818
818
|
recommendations: (currentRecommendations || []).concat(
|
|
819
|
-
valBuildIntelliSense
|
|
819
|
+
valBuildIntelliSense,
|
|
820
820
|
),
|
|
821
821
|
};
|
|
822
822
|
}
|
|
@@ -865,12 +865,12 @@ Val was successfully initialized!
|
|
|
865
865
|
`https://app.val.build/orgs/new${
|
|
866
866
|
plan.gitRemote
|
|
867
867
|
? `?org=${encodeURIComponent(
|
|
868
|
-
plan.gitRemote.owner
|
|
868
|
+
plan.gitRemote.owner,
|
|
869
869
|
)}&owner=${encodeURIComponent(
|
|
870
|
-
plan.gitRemote.owner
|
|
870
|
+
plan.gitRemote.owner,
|
|
871
871
|
)}&repo=${encodeURIComponent(plan.gitRemote.repo)}`
|
|
872
872
|
: ""
|
|
873
|
-
}
|
|
873
|
+
}`,
|
|
874
874
|
)}
|
|
875
875
|
|
|
876
876
|
`);
|
|
@@ -879,7 +879,7 @@ Val was successfully initialized!
|
|
|
879
879
|
function writeFile(
|
|
880
880
|
fileOp: FileOp | undefined,
|
|
881
881
|
rootDir: string,
|
|
882
|
-
isUpdate: boolean
|
|
882
|
+
isUpdate: boolean,
|
|
883
883
|
) {
|
|
884
884
|
if (fileOp) {
|
|
885
885
|
fs.mkdirSync(path.dirname(fileOp.path), { recursive: true });
|
|
@@ -887,9 +887,9 @@ function writeFile(
|
|
|
887
887
|
logger.info(
|
|
888
888
|
` ${isUpdate ? "Patched" : "Created"} file: ${fileOp.path.replace(
|
|
889
889
|
rootDir,
|
|
890
|
-
""
|
|
890
|
+
"",
|
|
891
891
|
)}`,
|
|
892
|
-
{ isGood: true }
|
|
892
|
+
{ isGood: true },
|
|
893
893
|
);
|
|
894
894
|
}
|
|
895
895
|
}
|
|
@@ -907,7 +907,7 @@ function getGitStatusIsClean(gitStatus: StatusResult): Analysis["isGitClean"] {
|
|
|
907
907
|
path === "yarn.lock" ||
|
|
908
908
|
path === "pnpm-lock.yaml"
|
|
909
909
|
)
|
|
910
|
-
)
|
|
910
|
+
),
|
|
911
911
|
);
|
|
912
912
|
if (filteredFiles.length === 0) {
|
|
913
913
|
if (gitStatus.files.length !== 0) {
|
package/src/logger.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function warn(message: string) {
|
|
|
10
10
|
|
|
11
11
|
export function info(
|
|
12
12
|
message: string,
|
|
13
|
-
opts: { isCodeSnippet?: true; isGood?: true } = {}
|
|
13
|
+
opts: { isCodeSnippet?: true; isGood?: true } = {},
|
|
14
14
|
) {
|
|
15
15
|
if (opts.isCodeSnippet) {
|
|
16
16
|
console.log(chalk.cyanBright("$ > ") + chalk.cyan(message));
|
package/src/main.ts
CHANGED
|
@@ -27,7 +27,7 @@ async function main() {
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
hardRejection: false,
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
await init(flags.root, { yes: flags.yes });
|
|
@@ -42,8 +42,8 @@ void main().catch((err) => {
|
|
|
42
42
|
err instanceof Error
|
|
43
43
|
? err.message + "\n" + err.stack
|
|
44
44
|
: typeof err === "object"
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
? JSON.stringify(err, null, 2)
|
|
46
|
+
: err,
|
|
47
47
|
);
|
|
48
48
|
process.exitCode = 1;
|
|
49
49
|
});
|
package/src/templates.ts
CHANGED
|
@@ -7,12 +7,16 @@ const { useValStega: useVal } = initValClient(config);
|
|
|
7
7
|
export { useVal };
|
|
8
8
|
`;
|
|
9
9
|
|
|
10
|
-
export const VAL_RSC = (
|
|
10
|
+
export const VAL_RSC = (
|
|
11
|
+
configImportPath: string,
|
|
12
|
+
valModulesImportPath: string,
|
|
13
|
+
) => `import "server-only";
|
|
11
14
|
import { initValRsc } from "@valbuild/next/rsc";
|
|
12
15
|
import { config } from "${configImportPath}";
|
|
16
|
+
import valModules from "${valModulesImportPath}";
|
|
13
17
|
import { cookies, draftMode, headers } from "next/headers";
|
|
14
18
|
|
|
15
|
-
const { fetchValStega: fetchVal } = initValRsc(config, {
|
|
19
|
+
const { fetchValStega: fetchVal } = initValRsc(config, valModules, {
|
|
16
20
|
draftMode,
|
|
17
21
|
headers,
|
|
18
22
|
cookies,
|
|
@@ -23,7 +27,7 @@ export { fetchVal };
|
|
|
23
27
|
|
|
24
28
|
export const VAL_SERVER = (
|
|
25
29
|
configImportPath: string,
|
|
26
|
-
valModulesImportPath: string
|
|
30
|
+
valModulesImportPath: string,
|
|
27
31
|
) => `import "server-only";
|
|
28
32
|
import { initValServer } from "@valbuild/next/server";
|
|
29
33
|
import { config } from "${configImportPath}";
|
|
@@ -50,7 +54,7 @@ type ValConfig = {
|
|
|
50
54
|
};
|
|
51
55
|
export const VAL_CONFIG = (
|
|
52
56
|
isTypeScript: boolean,
|
|
53
|
-
options: ValConfig
|
|
57
|
+
options: ValConfig,
|
|
54
58
|
) => `import { initVal } from "@valbuild/next";
|
|
55
59
|
|
|
56
60
|
const { s, c, val, config } = initVal(${JSON.stringify(options, null, 2)});
|
|
@@ -60,7 +64,7 @@ export { s, c, val, config };
|
|
|
60
64
|
`;
|
|
61
65
|
|
|
62
66
|
export const VAL_API_ROUTER = (
|
|
63
|
-
valServerPath: string
|
|
67
|
+
valServerPath: string,
|
|
64
68
|
) => `import { valNextAppRouter } from "${valServerPath}";
|
|
65
69
|
|
|
66
70
|
export const GET = valNextAppRouter;
|
|
@@ -72,7 +76,7 @@ export const HEAD = valNextAppRouter;
|
|
|
72
76
|
`;
|
|
73
77
|
|
|
74
78
|
export const VAL_APP_PAGE = (
|
|
75
|
-
configImportPath: string
|
|
79
|
+
configImportPath: string,
|
|
76
80
|
) => `import { ValApp } from "@valbuild/next";
|
|
77
81
|
import { config } from "${configImportPath}";
|
|
78
82
|
|
|
@@ -83,7 +87,7 @@ export default function Val() {
|
|
|
83
87
|
|
|
84
88
|
export const VAL_MODULES = (
|
|
85
89
|
configImportPath: string,
|
|
86
|
-
exampleModuleImport?: string
|
|
90
|
+
exampleModuleImport?: string,
|
|
87
91
|
) => `import { modules } from "@valbuild/next";
|
|
88
92
|
import { config } from "./${configImportPath}";
|
|
89
93
|
|
|
@@ -101,7 +105,7 @@ export default modules(config, [
|
|
|
101
105
|
export const BASIC_EXAMPLE = (
|
|
102
106
|
moduleFilePath: string,
|
|
103
107
|
configImportPath: string,
|
|
104
|
-
isJavaScript: boolean
|
|
108
|
+
isJavaScript: boolean,
|
|
105
109
|
) => `${isJavaScript ? "// @ts-check\n" : ""}/**
|
|
106
110
|
* Val example file - generated by @valbuild/init
|
|
107
111
|
**/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valbuild-init-main.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/main.d.ts"],"names":[],"mappings":"AAAA"}
|