@valbuild/next 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/README.md +42 -97
- package/client/dist/valbuild-next-client.cjs.d.ts +2 -2
- package/client/dist/valbuild-next-client.cjs.dev.js +19 -31
- package/client/dist/valbuild-next-client.cjs.prod.js +19 -31
- package/client/dist/valbuild-next-client.esm.js +19 -31
- package/dist/ValApp-50ec1e10.esm.js +53 -0
- package/dist/ValApp-9eefeefd.cjs.js +7 -0
- package/dist/ValApp-9eefeefd.cjs.prod.js +61 -0
- package/dist/ValApp-de156df4.cjs.dev.js +61 -0
- package/dist/ValNextProvider-0b711372.esm.js +430 -0
- package/dist/ValNextProvider-313af7bb.cjs.js +7 -0
- package/dist/ValNextProvider-313af7bb.cjs.prod.js +439 -0
- package/dist/ValNextProvider-abfbfdb5.cjs.dev.js +439 -0
- package/dist/{ValContext-06fe6f7e.cjs.dev.js → ValOverlayContext-55dae3ea.cjs.dev.js} +62 -71
- package/dist/ValOverlayContext-811e9be9.cjs.js +7 -0
- package/dist/{ValContext-12a3eca2.cjs.prod.js → ValOverlayContext-811e9be9.cjs.prod.js} +62 -71
- package/dist/{ValContext-8a8d9183.esm.js → ValOverlayContext-a2fdbce0.esm.js} +59 -69
- package/dist/{asyncToGenerator-0859ab5c.esm.js → asyncToGenerator-5f8c02f3.esm.js} +19 -24
- package/dist/{asyncToGenerator-ba66657c.cjs.dev.js → asyncToGenerator-67a5ff70.cjs.prod.js} +19 -24
- package/dist/{asyncToGenerator-3551d940.cjs.prod.js → asyncToGenerator-6ba61221.cjs.dev.js} +19 -24
- package/dist/declarations/src/ValApp.d.ts +1 -1
- package/dist/declarations/src/ValImage.d.ts +0 -1
- package/dist/declarations/src/ValProvider.d.ts +3 -5
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +38 -2
- package/dist/declarations/src/rsc/initValRsc.d.ts +5 -5
- package/dist/declarations/src/server/initValServer.d.ts +1 -1
- package/dist/{objectSpread2-bb9509e8.cjs.dev.js → objectSpread2-3c87fb4f.cjs.prod.js} +12 -18
- package/dist/{objectSpread2-24e737a6.cjs.prod.js → objectSpread2-792eb2c2.cjs.dev.js} +12 -18
- package/dist/{objectSpread2-439bdcdd.esm.js → objectSpread2-c1340c1c.esm.js} +12 -18
- package/dist/{slicedToArray-c03b6356.cjs.dev.js → slicedToArray-44036a76.cjs.dev.js} +5 -5
- package/dist/{slicedToArray-1ff80c5e.esm.js → slicedToArray-aa291011.esm.js} +5 -5
- package/dist/{slicedToArray-1d91551a.cjs.prod.js → slicedToArray-ce613de6.cjs.prod.js} +5 -5
- package/dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js +17 -0
- package/dist/unsupportedIterableToArray-5baabfdc.esm.js +15 -0
- package/dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js +17 -0
- package/dist/valbuild-next.cjs.d.ts +2 -2
- package/dist/valbuild-next.cjs.dev.js +23 -28
- package/dist/valbuild-next.cjs.prod.js +23 -28
- package/dist/valbuild-next.esm.js +23 -28
- package/package.json +6 -5
- package/rsc/dist/valbuild-next-rsc.cjs.d.ts +2 -2
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +131 -46
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +131 -43
- package/rsc/dist/valbuild-next-rsc.esm.js +133 -48
- package/server/dist/valbuild-next-server.cjs.d.ts +2 -2
- package/server/dist/valbuild-next-server.cjs.dev.js +8 -8
- package/server/dist/valbuild-next-server.cjs.prod.js +8 -8
- package/server/dist/valbuild-next-server.esm.js +8 -8
- package/client/dist/valbuild-next-client.cjs.d.ts.map +0 -1
- package/dist/ValApp-0ec0c7f3.cjs.js +0 -7
- package/dist/ValApp-0ec0c7f3.cjs.prod.js +0 -34
- package/dist/ValApp-61103149.esm.js +0 -26
- package/dist/ValApp-aff60572.cjs.dev.js +0 -34
- package/dist/ValContext-12a3eca2.cjs.js +0 -7
- package/dist/ValNextProvider-5226c452.cjs.js +0 -7
- package/dist/ValNextProvider-5226c452.cjs.prod.js +0 -101
- package/dist/ValNextProvider-ccbea1bd.cjs.dev.js +0 -101
- package/dist/ValNextProvider-d94cd904.esm.js +0 -92
- package/dist/unsupportedIterableToArray-51bb61c2.esm.js +0 -16
- package/dist/unsupportedIterableToArray-9e97e24a.cjs.dev.js +0 -18
- package/dist/unsupportedIterableToArray-afbea1dd.cjs.prod.js +0 -18
- package/dist/valbuild-next.cjs.d.ts.map +0 -1
- package/rsc/dist/valbuild-next-rsc.cjs.d.ts.map +0 -1
- package/server/dist/valbuild-next-server.cjs.d.ts.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
|
-
import { _ as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { _ as _objectSpread2, a as _defineProperty } from '../../dist/objectSpread2-c1340c1c.esm.js';
|
|
3
|
+
import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../../dist/asyncToGenerator-5f8c02f3.esm.js';
|
|
4
|
+
import { SET_RSC, SET_AUTO_TAG_JSX_ENABLED, stegaEncode } from '@valbuild/react/stega';
|
|
5
|
+
import { Internal } from '@valbuild/core';
|
|
6
|
+
import { VAL_SESSION_COOKIE } from '@valbuild/shared/internal';
|
|
7
|
+
import { createValServer } from '@valbuild/server';
|
|
8
|
+
import { V as VERSION } from '../../dist/version-98ec5c7a.esm.js';
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
SET_RSC(true);
|
|
11
|
+
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
8
12
|
return function (selector) {
|
|
9
13
|
var enabled = false;
|
|
10
14
|
try {
|
|
@@ -24,54 +28,84 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, isEn
|
|
|
24
28
|
console.error("Val: could not read headers! fetchVal can only be used server-side. Use useVal on clients.", err);
|
|
25
29
|
headers = null;
|
|
26
30
|
}
|
|
27
|
-
var cookies
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
var cookies = function () {
|
|
32
|
+
try {
|
|
33
|
+
return getCookies();
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error("Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", err);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}();
|
|
34
39
|
var host = headers && getHost(headers);
|
|
35
40
|
if (host && cookies) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var allPatches;
|
|
41
|
+
return valServerPromise.then(/*#__PURE__*/function () {
|
|
42
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(valServer) {
|
|
43
|
+
var _cookies$get, _cookies$get2;
|
|
44
|
+
var patchesRes, allPatches, treeRes, modules;
|
|
40
45
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
46
|
while (1) switch (_context.prev = _context.next) {
|
|
42
47
|
case 0:
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
_context.next = 2;
|
|
49
|
+
return valServer["/patches/~"]["GET"]({
|
|
50
|
+
query: {
|
|
51
|
+
omit_patch: true,
|
|
52
|
+
author: undefined,
|
|
53
|
+
patch_id: undefined,
|
|
54
|
+
module_file_path: undefined
|
|
55
|
+
},
|
|
56
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies$get = cookies.get(VAL_SESSION_COOKIE)) === null || _cookies$get === void 0 ? void 0 : _cookies$get.value)
|
|
57
|
+
});
|
|
58
|
+
case 2:
|
|
59
|
+
patchesRes = _context.sent;
|
|
60
|
+
if (!(patchesRes.status !== 200)) {
|
|
61
|
+
_context.next = 6;
|
|
45
62
|
break;
|
|
46
63
|
}
|
|
47
|
-
console.error("Val: could not fetch patches", patchesRes.
|
|
48
|
-
throw Error(JSON.stringify(patchesRes.
|
|
49
|
-
case
|
|
50
|
-
allPatches = Object.keys(patchesRes.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
console.error("Val: could not fetch patches", patchesRes.json);
|
|
65
|
+
throw Error(JSON.stringify(patchesRes.json, null, 2));
|
|
66
|
+
case 6:
|
|
67
|
+
allPatches = Object.keys(patchesRes.json.patches);
|
|
68
|
+
_context.next = 9;
|
|
69
|
+
return valServer["/sources"]["PUT"]({
|
|
70
|
+
path: "/",
|
|
71
|
+
query: {
|
|
72
|
+
validate_sources: true,
|
|
73
|
+
validate_all: false,
|
|
74
|
+
validate_binary_files: false
|
|
75
|
+
},
|
|
76
|
+
body: {
|
|
77
|
+
patchIds: allPatches
|
|
78
|
+
},
|
|
79
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies$get2 = cookies.get(VAL_SESSION_COOKIE)) === null || _cookies$get2 === void 0 ? void 0 : _cookies$get2.value)
|
|
80
|
+
});
|
|
81
|
+
case 9:
|
|
82
|
+
treeRes = _context.sent;
|
|
83
|
+
if (!(treeRes.status === 200)) {
|
|
84
|
+
_context.next = 15;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
modules = treeRes.json.modules;
|
|
88
|
+
return _context.abrupt("return", stegaEncode(selector, {
|
|
89
|
+
disabled: !enabled,
|
|
90
|
+
getModule: function getModule(path) {
|
|
91
|
+
var module = modules[path];
|
|
92
|
+
if (module) {
|
|
93
|
+
return module.source;
|
|
71
94
|
}
|
|
72
95
|
}
|
|
73
96
|
}));
|
|
74
|
-
case
|
|
97
|
+
case 15:
|
|
98
|
+
if (!(treeRes.status === 401)) {
|
|
99
|
+
_context.next = 19;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
103
|
+
_context.next = 21;
|
|
104
|
+
break;
|
|
105
|
+
case 19:
|
|
106
|
+
console.error("Val: could not fetch modules", treeRes.json);
|
|
107
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
108
|
+
case 21:
|
|
75
109
|
case "end":
|
|
76
110
|
return _context.stop();
|
|
77
111
|
}
|
|
@@ -82,9 +116,6 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, isEn
|
|
|
82
116
|
};
|
|
83
117
|
}())["catch"](function (err) {
|
|
84
118
|
console.error("Val: failed while fetching modules", err);
|
|
85
|
-
if (process.env.NODE_ENV === "development") {
|
|
86
|
-
throw Error("Val: Could not fetch data. This is likely due to a misconfiguration or a bug. Check the console for more details.");
|
|
87
|
-
}
|
|
88
119
|
return stegaEncode(selector, {});
|
|
89
120
|
});
|
|
90
121
|
}
|
|
@@ -137,11 +168,65 @@ function getHost(headers) {
|
|
|
137
168
|
|
|
138
169
|
var valApiEndpoints = "/api/val";
|
|
139
170
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
140
|
-
function initValRsc(config, rscNextConfig) {
|
|
171
|
+
function initValRsc(config, valModules, rscNextConfig) {
|
|
172
|
+
var coreVersion = Internal.VERSION.core;
|
|
173
|
+
if (!coreVersion) {
|
|
174
|
+
throw new Error("Could not get @valbuild/core package version");
|
|
175
|
+
}
|
|
176
|
+
var nextVersion = VERSION;
|
|
177
|
+
if (!nextVersion) {
|
|
178
|
+
throw new Error("Could not get @valbuild/next package version");
|
|
179
|
+
}
|
|
180
|
+
var valServerPromise = createValServer(valModules, "/api/val", _objectSpread2({
|
|
181
|
+
versions: {
|
|
182
|
+
next: nextVersion,
|
|
183
|
+
core: coreVersion
|
|
184
|
+
}
|
|
185
|
+
}, config), config, {
|
|
186
|
+
isEnabled: function isEnabled() {
|
|
187
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
188
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
189
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
190
|
+
case 0:
|
|
191
|
+
return _context2.abrupt("return", rscNextConfig.draftMode().isEnabled);
|
|
192
|
+
case 1:
|
|
193
|
+
case "end":
|
|
194
|
+
return _context2.stop();
|
|
195
|
+
}
|
|
196
|
+
}, _callee2);
|
|
197
|
+
}))();
|
|
198
|
+
},
|
|
199
|
+
onEnable: function onEnable() {
|
|
200
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
202
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
rscNextConfig.draftMode().enable();
|
|
205
|
+
case 1:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context3.stop();
|
|
208
|
+
}
|
|
209
|
+
}, _callee3);
|
|
210
|
+
}))();
|
|
211
|
+
},
|
|
212
|
+
onDisable: function onDisable() {
|
|
213
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
214
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
215
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
216
|
+
case 0:
|
|
217
|
+
rscNextConfig.draftMode().disable();
|
|
218
|
+
case 1:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context4.stop();
|
|
221
|
+
}
|
|
222
|
+
}, _callee4);
|
|
223
|
+
}))();
|
|
224
|
+
}
|
|
225
|
+
});
|
|
141
226
|
return {
|
|
142
227
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
143
228
|
// TODO: get from config
|
|
144
|
-
function () {
|
|
229
|
+
valServerPromise, function () {
|
|
145
230
|
return rscNextConfig.draftMode().isEnabled;
|
|
146
231
|
}, function () {
|
|
147
232
|
return rscNextConfig.headers();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/server/index";
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
export * from "../../dist/declarations/src/server/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtbmV4dC1zZXJ2ZXIuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kaXN0L2RlY2xhcmF0aW9ucy9zcmMvc2VydmVyL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('server-only');
|
|
6
|
-
var slicedToArray = require('../../dist/slicedToArray-
|
|
7
|
-
var asyncToGenerator = require('../../dist/asyncToGenerator-
|
|
8
|
-
var objectSpread2 = require('../../dist/objectSpread2-
|
|
6
|
+
var slicedToArray = require('../../dist/slicedToArray-44036a76.cjs.dev.js');
|
|
7
|
+
var asyncToGenerator = require('../../dist/asyncToGenerator-6ba61221.cjs.dev.js');
|
|
8
|
+
var objectSpread2 = require('../../dist/objectSpread2-792eb2c2.cjs.dev.js');
|
|
9
9
|
var core = require('@valbuild/core');
|
|
10
10
|
var server = require('@valbuild/server');
|
|
11
11
|
var server$1 = require('next/server');
|
|
12
12
|
var version = require('../../dist/version-82faa1d0.cjs.dev.js');
|
|
13
|
-
require('../../dist/unsupportedIterableToArray-
|
|
13
|
+
require('../../dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
|
|
14
14
|
|
|
15
15
|
var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
|
|
16
16
|
var route = "/api/val"; // TODO: get from config
|
|
@@ -27,9 +27,9 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
27
27
|
next: nextVersion,
|
|
28
28
|
core: coreVersion
|
|
29
29
|
}
|
|
30
|
-
}, config), {
|
|
30
|
+
}, config), config, {
|
|
31
31
|
isEnabled: function isEnabled() {
|
|
32
|
-
return asyncToGenerator._asyncToGenerator(
|
|
32
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
|
|
33
33
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
@@ -42,7 +42,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
42
42
|
}))();
|
|
43
43
|
},
|
|
44
44
|
onEnable: function onEnable() {
|
|
45
|
-
return asyncToGenerator._asyncToGenerator(
|
|
45
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2() {
|
|
46
46
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
47
47
|
while (1) switch (_context2.prev = _context2.next) {
|
|
48
48
|
case 0:
|
|
@@ -55,7 +55,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
55
55
|
}))();
|
|
56
56
|
},
|
|
57
57
|
onDisable: function onDisable() {
|
|
58
|
-
return asyncToGenerator._asyncToGenerator(
|
|
58
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee3() {
|
|
59
59
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
60
60
|
while (1) switch (_context3.prev = _context3.next) {
|
|
61
61
|
case 0:
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('server-only');
|
|
6
|
-
var slicedToArray = require('../../dist/slicedToArray-
|
|
7
|
-
var asyncToGenerator = require('../../dist/asyncToGenerator-
|
|
8
|
-
var objectSpread2 = require('../../dist/objectSpread2-
|
|
6
|
+
var slicedToArray = require('../../dist/slicedToArray-ce613de6.cjs.prod.js');
|
|
7
|
+
var asyncToGenerator = require('../../dist/asyncToGenerator-67a5ff70.cjs.prod.js');
|
|
8
|
+
var objectSpread2 = require('../../dist/objectSpread2-3c87fb4f.cjs.prod.js');
|
|
9
9
|
var core = require('@valbuild/core');
|
|
10
10
|
var server = require('@valbuild/server');
|
|
11
11
|
var server$1 = require('next/server');
|
|
12
12
|
var version = require('../../dist/version-a9a6a619.cjs.prod.js');
|
|
13
|
-
require('../../dist/unsupportedIterableToArray-
|
|
13
|
+
require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
14
14
|
|
|
15
15
|
var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
|
|
16
16
|
var route = "/api/val"; // TODO: get from config
|
|
@@ -27,9 +27,9 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
27
27
|
next: nextVersion,
|
|
28
28
|
core: coreVersion
|
|
29
29
|
}
|
|
30
|
-
}, config), {
|
|
30
|
+
}, config), config, {
|
|
31
31
|
isEnabled: function isEnabled() {
|
|
32
|
-
return asyncToGenerator._asyncToGenerator(
|
|
32
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
|
|
33
33
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
@@ -42,7 +42,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
42
42
|
}))();
|
|
43
43
|
},
|
|
44
44
|
onEnable: function onEnable() {
|
|
45
|
-
return asyncToGenerator._asyncToGenerator(
|
|
45
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2() {
|
|
46
46
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
47
47
|
while (1) switch (_context2.prev = _context2.next) {
|
|
48
48
|
case 0:
|
|
@@ -55,7 +55,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
55
55
|
}))();
|
|
56
56
|
},
|
|
57
57
|
onDisable: function onDisable() {
|
|
58
|
-
return asyncToGenerator._asyncToGenerator(
|
|
58
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee3() {
|
|
59
59
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
60
60
|
while (1) switch (_context3.prev = _context3.next) {
|
|
61
61
|
case 0:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
|
-
import { _ as _slicedToArray } from '../../dist/slicedToArray-
|
|
3
|
-
import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../../dist/asyncToGenerator-
|
|
4
|
-
import { _ as _objectSpread2 } from '../../dist/objectSpread2-
|
|
2
|
+
import { _ as _slicedToArray } from '../../dist/slicedToArray-aa291011.esm.js';
|
|
3
|
+
import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../../dist/asyncToGenerator-5f8c02f3.esm.js';
|
|
4
|
+
import { _ as _objectSpread2 } from '../../dist/objectSpread2-c1340c1c.esm.js';
|
|
5
5
|
import { Internal } from '@valbuild/core';
|
|
6
6
|
import { createValApiRouter, createValServer } from '@valbuild/server';
|
|
7
7
|
import { NextResponse } from 'next/server';
|
|
8
8
|
import { V as VERSION } from '../../dist/version-98ec5c7a.esm.js';
|
|
9
|
-
import '../../dist/unsupportedIterableToArray-
|
|
9
|
+
import '../../dist/unsupportedIterableToArray-5baabfdc.esm.js';
|
|
10
10
|
|
|
11
11
|
var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
|
|
12
12
|
var route = "/api/val"; // TODO: get from config
|
|
@@ -23,9 +23,9 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
23
23
|
next: nextVersion,
|
|
24
24
|
core: coreVersion
|
|
25
25
|
}
|
|
26
|
-
}, config), {
|
|
26
|
+
}, config), config, {
|
|
27
27
|
isEnabled: function isEnabled() {
|
|
28
|
-
return _asyncToGenerator(
|
|
28
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
29
29
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
30
30
|
while (1) switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
@@ -38,7 +38,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
38
38
|
}))();
|
|
39
39
|
},
|
|
40
40
|
onEnable: function onEnable() {
|
|
41
|
-
return _asyncToGenerator(
|
|
41
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
42
42
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
43
43
|
while (1) switch (_context2.prev = _context2.next) {
|
|
44
44
|
case 0:
|
|
@@ -51,7 +51,7 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
51
51
|
}))();
|
|
52
52
|
},
|
|
53
53
|
onDisable: function onDisable() {
|
|
54
|
-
return _asyncToGenerator(
|
|
54
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
55
55
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
56
56
|
while (1) switch (_context3.prev = _context3.next) {
|
|
57
57
|
case 0:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valbuild-next-client.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/client/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var ui = require('@valbuild/ui');
|
|
7
|
-
var Script = require('next/script');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
13
|
-
|
|
14
|
-
function _objectDestructuringEmpty(obj) {
|
|
15
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var ValApp = function ValApp(_ref) {
|
|
19
|
-
_objectDestructuringEmpty(_ref);
|
|
20
|
-
var route = "/api/val";
|
|
21
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
22
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("link", {
|
|
23
|
-
rel: "stylesheet",
|
|
24
|
-
href: "".concat(route , "/static").concat(ui.VAL_CSS_PATH)
|
|
25
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
26
|
-
type: "module",
|
|
27
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
28
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
29
|
-
id: ui.VAL_APP_ID
|
|
30
|
-
})]
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
exports.ValApp = ValApp;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { VAL_CSS_PATH, VAL_APP_PATH, VAL_APP_ID } from '@valbuild/ui';
|
|
3
|
-
import Script from 'next/script';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
function _objectDestructuringEmpty(obj) {
|
|
7
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
var ValApp = function ValApp(_ref) {
|
|
11
|
-
_objectDestructuringEmpty(_ref);
|
|
12
|
-
var route = "/api/val";
|
|
13
|
-
return /*#__PURE__*/jsxs("div", {
|
|
14
|
-
children: [/*#__PURE__*/jsx("link", {
|
|
15
|
-
rel: "stylesheet",
|
|
16
|
-
href: "".concat(route , "/static").concat(VAL_CSS_PATH)
|
|
17
|
-
}), /*#__PURE__*/jsx(Script, {
|
|
18
|
-
type: "module",
|
|
19
|
-
src: "".concat(route, "/static").concat(VAL_APP_PATH)
|
|
20
|
-
}), /*#__PURE__*/jsx("div", {
|
|
21
|
-
id: VAL_APP_ID
|
|
22
|
-
})]
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { ValApp };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var ui = require('@valbuild/ui');
|
|
7
|
-
var Script = require('next/script');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
13
|
-
|
|
14
|
-
function _objectDestructuringEmpty(obj) {
|
|
15
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var ValApp = function ValApp(_ref) {
|
|
19
|
-
_objectDestructuringEmpty(_ref);
|
|
20
|
-
var route = "/api/val";
|
|
21
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
22
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("link", {
|
|
23
|
-
rel: "stylesheet",
|
|
24
|
-
href: "".concat(route , "/static").concat(ui.VAL_CSS_PATH)
|
|
25
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
26
|
-
type: "module",
|
|
27
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
28
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
29
|
-
id: ui.VAL_APP_ID
|
|
30
|
-
})]
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
exports.ValApp = ValApp;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var slicedToArray = require('./slicedToArray-1d91551a.cjs.prod.js');
|
|
7
|
-
var core = require('@valbuild/core');
|
|
8
|
-
var ui = require('@valbuild/ui');
|
|
9
|
-
var navigation = require('next/navigation');
|
|
10
|
-
var Script = require('next/script');
|
|
11
|
-
var React = require('react');
|
|
12
|
-
var ValContext = require('./ValContext-12a3eca2.cjs.prod.js');
|
|
13
|
-
var stega = require('@valbuild/react/stega');
|
|
14
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
-
require('./unsupportedIterableToArray-afbea1dd.cjs.prod.js');
|
|
16
|
-
|
|
17
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
18
|
-
|
|
19
|
-
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
20
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
21
|
-
|
|
22
|
-
var ValNextProvider = function ValNextProvider(props) {
|
|
23
|
-
var pathname = navigation.usePathname();
|
|
24
|
-
|
|
25
|
-
// TODO: use config to get /val and /api/val
|
|
26
|
-
if (pathname.startsWith("/val")) {
|
|
27
|
-
return props.children;
|
|
28
|
-
}
|
|
29
|
-
var route = "/api/val";
|
|
30
|
-
|
|
31
|
-
// TODO: move below into react package
|
|
32
|
-
var valEvents = React__default["default"].useMemo(function () {
|
|
33
|
-
return new ValContext.ValEvents();
|
|
34
|
-
}, []);
|
|
35
|
-
var _React$useTransition = React__default["default"].useTransition(),
|
|
36
|
-
_React$useTransition2 = slicedToArray._slicedToArray(_React$useTransition, 2),
|
|
37
|
-
startTransition = _React$useTransition2[1];
|
|
38
|
-
var router = navigation.useRouter();
|
|
39
|
-
var _React$useState = React__default["default"].useState(false),
|
|
40
|
-
_React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
|
|
41
|
-
enabled = _React$useState2[0],
|
|
42
|
-
setEnabled = _React$useState2[1];
|
|
43
|
-
React__default["default"].useEffect(function () {
|
|
44
|
-
setEnabled(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
|
|
45
|
-
}, []);
|
|
46
|
-
React__default["default"].useEffect(function () {
|
|
47
|
-
if (enabled) {
|
|
48
|
-
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
49
|
-
var valEventListener = function valEventListener(event) {
|
|
50
|
-
if (event instanceof CustomEvent) {
|
|
51
|
-
if (event.detail.type === "module-update") {
|
|
52
|
-
var _event$detail = event.detail,
|
|
53
|
-
path = _event$detail.path,
|
|
54
|
-
source = _event$detail.source;
|
|
55
|
-
if (typeof path === "string" && source !== undefined) {
|
|
56
|
-
valEvents.update(path, source);
|
|
57
|
-
} else {
|
|
58
|
-
console.error("Val: invalid event detail", event.detail);
|
|
59
|
-
}
|
|
60
|
-
} else if (event.detail.type === "overlay-submit") {
|
|
61
|
-
var refreshRequired = event.detail.refreshRequired;
|
|
62
|
-
if (refreshRequired && !props.disableRefresh) {
|
|
63
|
-
startTransition(function () {
|
|
64
|
-
router.refresh();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
console.error("Val: invalid event", event);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
window.addEventListener("val-event", valEventListener);
|
|
73
|
-
return function () {
|
|
74
|
-
window.removeEventListener("val-event", valEventListener);
|
|
75
|
-
};
|
|
76
|
-
} else {
|
|
77
|
-
stega.SET_AUTO_TAG_JSX_ENABLED(false);
|
|
78
|
-
if (process.env["NODE_ENV"] === "development" && !document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"))) {
|
|
79
|
-
console.warn("This page is built with Val Build - the lightweight CMS where content is code.\n\nVal is currently hidden and disabled.\n\nTo enable Val, go to the following URL:\n".concat(window.location.origin, "/api/val/enable?redirect_to=").concat(encodeURIComponent(window.location.href), "\n \nYou are seeing this message because you are in development mode."));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, [enabled]);
|
|
83
|
-
|
|
84
|
-
// TODO: use portal to mount overlay
|
|
85
|
-
return /*#__PURE__*/jsxRuntime.jsxs(ValContext.ValContext.Provider, {
|
|
86
|
-
value: {
|
|
87
|
-
valEvents: valEvents,
|
|
88
|
-
enabled: enabled
|
|
89
|
-
},
|
|
90
|
-
children: [props.children, enabled && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
91
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
92
|
-
type: "module",
|
|
93
|
-
src: "".concat(route, "/static").concat(ui.VAL_APP_PATH)
|
|
94
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
95
|
-
id: ui.VAL_OVERLAY_ID
|
|
96
|
-
})]
|
|
97
|
-
})]
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
exports.ValNextProvider = ValNextProvider;
|