@valbuild/shared 0.150.1 → 0.150.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +3 -0
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +19 -10
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +19 -10
- package/internal/dist/valbuild-shared-internal.esm.js +19 -10
- package/package.json +2 -2
- package/typecheck/dist/valbuild-shared-typecheck.cjs.dev.js +172 -93
- package/typecheck/dist/valbuild-shared-typecheck.cjs.prod.js +172 -93
- package/typecheck/dist/valbuild-shared-typecheck.esm.js +172 -93
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.150.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#949](https://github.com/valbuild/val/pull/949) [`36412b2`](https://github.com/valbuild/val/commit/36412b28bb009083f652b26462b76a74c80ff595) Thanks [@freekh](https://github.com/freekh)! - Val Studio now shows content analytics beside the content being edited, for a hosted project with content analytics switched on. Each field and list row shows how many page views it was seen in (hover for how many it was on the page in, and the share). The heading of what is open says the same for all of it, and lists what in it was seen most, by the names the Studio gives them everywhere else. Nothing is shown, and nothing is asked of Val Build, for a project with analytics off or a Studio not signed in to Val Build.
|
|
8
|
+
|
|
9
|
+
- [#953](https://github.com/valbuild/val/pull/953) [`8f598b6`](https://github.com/valbuild/val/commit/8f598b618b794e59ef5b9c6ef94650be4ff006e7) Thanks [@freekh](https://github.com/freekh)! - A proposal's typecheck no longer downloads TypeScript again for its second check. The compiler (about 13 MB) is kept by the typecheck's worker once fetched, for every check that asks for the same version after it.
|
|
10
|
+
|
|
11
|
+
- [#952](https://github.com/valbuild/val/pull/952) [`95d17e6`](https://github.com/valbuild/val/commit/95d17e6bbecceb2f09d6a6226808e9c60b2d4795) Thanks [@freekh](https://github.com/freekh)! - A proposal's typecheck (an upgrade, or a proposal with dependencies of its own) now checks the proposal first, and checks the site as it is only when the proposal has type errors, to tell the errors the site already had from the ones the proposal adds. A proposal that typechecks cleanly is done in one check instead of two, which is most of them. A site with no lockfile on record no longer has one worked out for it unless the second check needs it.
|
|
12
|
+
- Updated dependencies [[`155a079`](https://github.com/valbuild/val/commit/155a0792c2a437a1cbcdd6342131999be70e0d70)]:
|
|
13
|
+
- @valbuild/core@0.150.2
|
|
14
|
+
|
|
3
15
|
## 0.150.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -2348,6 +2348,9 @@ export type ClientOf<Api extends ApiGuard> = <Route extends keyof Api, Method ex
|
|
|
2348
2348
|
query: Endpoint["req"]["query"] extends Record<string, z.ZodSchema<ValidQueryParamTypes>> ? {
|
|
2349
2349
|
[key in keyof Endpoint["req"]["query"]]: z.infer<Endpoint["req"]["query"][key]>;
|
|
2350
2350
|
} : undefined;
|
|
2351
|
+
headers: Endpoint["req"]["headers"] extends Record<string, z.ZodSchema<string | undefined>> ? {
|
|
2352
|
+
[key in keyof Endpoint["req"]["headers"]]: z.infer<Endpoint["req"]["headers"][key]>;
|
|
2353
|
+
} : undefined;
|
|
2351
2354
|
}>) => Promise<z.infer<Endpoint["res"]> | ClientFetchErrors>;
|
|
2352
2355
|
export type ClientFetchErrors = {
|
|
2353
2356
|
status: 404;
|
|
@@ -3755,7 +3755,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3755
3755
|
return /*#__PURE__*/function () {
|
|
3756
3756
|
var _ref = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(path, method, req) {
|
|
3757
3757
|
var _anyApi$path, _apiEndpoint$req$body;
|
|
3758
|
-
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, res, _t;
|
|
3758
|
+
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, headers, _i2, _Object$entries, _Object$entries$_i, name, _value, res, _t;
|
|
3759
3759
|
return slicedToArray._regenerator().w(function (_context2) {
|
|
3760
3760
|
while (1) switch (_context2.p = _context2.n) {
|
|
3761
3761
|
case 0:
|
|
@@ -3838,13 +3838,22 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
});
|
|
3840
3840
|
case 2:
|
|
3841
|
-
|
|
3842
|
-
|
|
3841
|
+
headers = {
|
|
3842
|
+
"Content-Type": "application/json"
|
|
3843
|
+
};
|
|
3844
|
+
if (anyReq !== null && anyReq !== void 0 && anyReq.headers) {
|
|
3845
|
+
for (_i2 = 0, _Object$entries = Object.entries(anyReq.headers); _i2 < _Object$entries.length; _i2++) {
|
|
3846
|
+
_Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i2], 2), name = _Object$entries$_i[0], _value = _Object$entries$_i[1];
|
|
3847
|
+
if (typeof _value === "string") {
|
|
3848
|
+
headers[name] = _value;
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
_context2.p = 3;
|
|
3853
|
+
_context2.n = 4;
|
|
3843
3854
|
return send("".concat(host).concat(fullPath), {
|
|
3844
3855
|
method: method,
|
|
3845
|
-
headers:
|
|
3846
|
-
"Content-Type": "application/json"
|
|
3847
|
-
},
|
|
3856
|
+
headers: headers,
|
|
3848
3857
|
body: anyReq.body !== undefined ? JSON.stringify(anyReq.body) : undefined
|
|
3849
3858
|
}).then(/*#__PURE__*/function () {
|
|
3850
3859
|
var _ref2 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(res) {
|
|
@@ -3936,11 +3945,11 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3936
3945
|
return _ref2.apply(this, arguments);
|
|
3937
3946
|
};
|
|
3938
3947
|
}());
|
|
3939
|
-
case
|
|
3948
|
+
case 4:
|
|
3940
3949
|
res = _context2.v;
|
|
3941
3950
|
return _context2.a(2, res);
|
|
3942
|
-
case
|
|
3943
|
-
_context2.p =
|
|
3951
|
+
case 5:
|
|
3952
|
+
_context2.p = 5;
|
|
3944
3953
|
_t = _context2.v;
|
|
3945
3954
|
return _context2.a(2, {
|
|
3946
3955
|
status: null,
|
|
@@ -3952,7 +3961,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3952
3961
|
}
|
|
3953
3962
|
});
|
|
3954
3963
|
}
|
|
3955
|
-
}, _callee2, null, [[
|
|
3964
|
+
}, _callee2, null, [[3, 5]]);
|
|
3956
3965
|
}));
|
|
3957
3966
|
return function (_x, _x2, _x3) {
|
|
3958
3967
|
return _ref.apply(this, arguments);
|
|
@@ -3755,7 +3755,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3755
3755
|
return /*#__PURE__*/function () {
|
|
3756
3756
|
var _ref = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(path, method, req) {
|
|
3757
3757
|
var _anyApi$path, _apiEndpoint$req$body;
|
|
3758
|
-
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, res, _t;
|
|
3758
|
+
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, headers, _i2, _Object$entries, _Object$entries$_i, name, _value, res, _t;
|
|
3759
3759
|
return slicedToArray._regenerator().w(function (_context2) {
|
|
3760
3760
|
while (1) switch (_context2.p = _context2.n) {
|
|
3761
3761
|
case 0:
|
|
@@ -3838,13 +3838,22 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
});
|
|
3840
3840
|
case 2:
|
|
3841
|
-
|
|
3842
|
-
|
|
3841
|
+
headers = {
|
|
3842
|
+
"Content-Type": "application/json"
|
|
3843
|
+
};
|
|
3844
|
+
if (anyReq !== null && anyReq !== void 0 && anyReq.headers) {
|
|
3845
|
+
for (_i2 = 0, _Object$entries = Object.entries(anyReq.headers); _i2 < _Object$entries.length; _i2++) {
|
|
3846
|
+
_Object$entries$_i = slicedToArray._slicedToArray(_Object$entries[_i2], 2), name = _Object$entries$_i[0], _value = _Object$entries$_i[1];
|
|
3847
|
+
if (typeof _value === "string") {
|
|
3848
|
+
headers[name] = _value;
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
_context2.p = 3;
|
|
3853
|
+
_context2.n = 4;
|
|
3843
3854
|
return send("".concat(host).concat(fullPath), {
|
|
3844
3855
|
method: method,
|
|
3845
|
-
headers:
|
|
3846
|
-
"Content-Type": "application/json"
|
|
3847
|
-
},
|
|
3856
|
+
headers: headers,
|
|
3848
3857
|
body: anyReq.body !== undefined ? JSON.stringify(anyReq.body) : undefined
|
|
3849
3858
|
}).then(/*#__PURE__*/function () {
|
|
3850
3859
|
var _ref2 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee(res) {
|
|
@@ -3936,11 +3945,11 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3936
3945
|
return _ref2.apply(this, arguments);
|
|
3937
3946
|
};
|
|
3938
3947
|
}());
|
|
3939
|
-
case
|
|
3948
|
+
case 4:
|
|
3940
3949
|
res = _context2.v;
|
|
3941
3950
|
return _context2.a(2, res);
|
|
3942
|
-
case
|
|
3943
|
-
_context2.p =
|
|
3951
|
+
case 5:
|
|
3952
|
+
_context2.p = 5;
|
|
3944
3953
|
_t = _context2.v;
|
|
3945
3954
|
return _context2.a(2, {
|
|
3946
3955
|
status: null,
|
|
@@ -3952,7 +3961,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3952
3961
|
}
|
|
3953
3962
|
});
|
|
3954
3963
|
}
|
|
3955
|
-
}, _callee2, null, [[
|
|
3964
|
+
}, _callee2, null, [[3, 5]]);
|
|
3956
3965
|
}));
|
|
3957
3966
|
return function (_x, _x2, _x3) {
|
|
3958
3967
|
return _ref.apply(this, arguments);
|
|
@@ -3748,7 +3748,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3748
3748
|
return /*#__PURE__*/function () {
|
|
3749
3749
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(path, method, req) {
|
|
3750
3750
|
var _anyApi$path, _apiEndpoint$req$body;
|
|
3751
|
-
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, res, _t;
|
|
3751
|
+
var anyReq, fullPath, params, _i, _Object$keys, _anyReq$query, key, _anyReq$query2, _iterator, _step, value, _anyReq$query3, _anyReq$query4, apiEndpoint, reqBodyResult, headers, _i2, _Object$entries, _Object$entries$_i, name, _value, res, _t;
|
|
3752
3752
|
return _regenerator().w(function (_context2) {
|
|
3753
3753
|
while (1) switch (_context2.p = _context2.n) {
|
|
3754
3754
|
case 0:
|
|
@@ -3831,13 +3831,22 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3831
3831
|
}
|
|
3832
3832
|
});
|
|
3833
3833
|
case 2:
|
|
3834
|
-
|
|
3835
|
-
|
|
3834
|
+
headers = {
|
|
3835
|
+
"Content-Type": "application/json"
|
|
3836
|
+
};
|
|
3837
|
+
if (anyReq !== null && anyReq !== void 0 && anyReq.headers) {
|
|
3838
|
+
for (_i2 = 0, _Object$entries = Object.entries(anyReq.headers); _i2 < _Object$entries.length; _i2++) {
|
|
3839
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2), name = _Object$entries$_i[0], _value = _Object$entries$_i[1];
|
|
3840
|
+
if (typeof _value === "string") {
|
|
3841
|
+
headers[name] = _value;
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
_context2.p = 3;
|
|
3846
|
+
_context2.n = 4;
|
|
3836
3847
|
return send("".concat(host).concat(fullPath), {
|
|
3837
3848
|
method: method,
|
|
3838
|
-
headers:
|
|
3839
|
-
"Content-Type": "application/json"
|
|
3840
|
-
},
|
|
3849
|
+
headers: headers,
|
|
3841
3850
|
body: anyReq.body !== undefined ? JSON.stringify(anyReq.body) : undefined
|
|
3842
3851
|
}).then(/*#__PURE__*/function () {
|
|
3843
3852
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(res) {
|
|
@@ -3929,11 +3938,11 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3929
3938
|
return _ref2.apply(this, arguments);
|
|
3930
3939
|
};
|
|
3931
3940
|
}());
|
|
3932
|
-
case
|
|
3941
|
+
case 4:
|
|
3933
3942
|
res = _context2.v;
|
|
3934
3943
|
return _context2.a(2, res);
|
|
3935
|
-
case
|
|
3936
|
-
_context2.p =
|
|
3944
|
+
case 5:
|
|
3945
|
+
_context2.p = 5;
|
|
3937
3946
|
_t = _context2.v;
|
|
3938
3947
|
return _context2.a(2, {
|
|
3939
3948
|
status: null,
|
|
@@ -3945,7 +3954,7 @@ var createValClient = function createValClient(host, config, options) {
|
|
|
3945
3954
|
}
|
|
3946
3955
|
});
|
|
3947
3956
|
}
|
|
3948
|
-
}, _callee2, null, [[
|
|
3957
|
+
}, _callee2, null, [[3, 5]]);
|
|
3949
3958
|
}));
|
|
3950
3959
|
return function (_x, _x2, _x3) {
|
|
3951
3960
|
return _ref.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.150.
|
|
3
|
+
"version": "0.150.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"yaml": "^2.9.0",
|
|
54
54
|
"zod": "^4.4.3",
|
|
55
55
|
"zod-validation-error": "^5.0.0",
|
|
56
|
-
"@valbuild/core": "0.150.
|
|
56
|
+
"@valbuild/core": "0.150.2"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"CHANGELOG.md",
|
|
@@ -822,6 +822,7 @@ function sourceErrorOf(error, what) {
|
|
|
822
822
|
function getJson(_x, _x2, _x3) {
|
|
823
823
|
return _getJson.apply(this, arguments);
|
|
824
824
|
}
|
|
825
|
+
/** `fetch` as the caller's global has it, when no other is given. */
|
|
825
826
|
function _getJson() {
|
|
826
827
|
_getJson = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee4(fetchImpl, url, init) {
|
|
827
828
|
var res, text, parsed, message;
|
|
@@ -856,11 +857,21 @@ function _getJson() {
|
|
|
856
857
|
}));
|
|
857
858
|
return _getJson.apply(this, arguments);
|
|
858
859
|
}
|
|
860
|
+
var defaultFetch = function defaultFetch() {
|
|
861
|
+
return fetch.apply(void 0, arguments);
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Compilers already fetched, by the `fetch` that fetched them and their URL.
|
|
866
|
+
* A worker that checks a proposal and then the site asks for the same 13 MB
|
|
867
|
+
* twice, with a new `adeptSources` for each check, and a version's compiler
|
|
868
|
+
* is the same every time. A fetch that failed is not kept, so asking again
|
|
869
|
+
* asks again.
|
|
870
|
+
*/
|
|
871
|
+
var compilers = new WeakMap();
|
|
859
872
|
function adeptSources(options) {
|
|
860
873
|
var _options$fetch, _options$credentials;
|
|
861
|
-
var fetchImpl = (_options$fetch = options.fetch) !== null && _options$fetch !== void 0 ? _options$fetch :
|
|
862
|
-
return fetch.apply(void 0, arguments);
|
|
863
|
-
};
|
|
874
|
+
var fetchImpl = (_options$fetch = options.fetch) !== null && _options$fetch !== void 0 ? _options$fetch : defaultFetch;
|
|
864
875
|
var init = createForOfIteratorHelper._objectSpread2({
|
|
865
876
|
credentials: (_options$credentials = options.credentials) !== null && _options$credentials !== void 0 ? _options$credentials : "same-origin"
|
|
866
877
|
}, options.headers ? {
|
|
@@ -890,71 +901,93 @@ function adeptSources(options) {
|
|
|
890
901
|
return _ref.apply(this, arguments);
|
|
891
902
|
};
|
|
892
903
|
}();
|
|
904
|
+
var fetchCompiler = /*#__PURE__*/function () {
|
|
905
|
+
var _ref2 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(url, version) {
|
|
906
|
+
var what, answer;
|
|
907
|
+
return slicedToArray._regenerator().w(function (_context2) {
|
|
908
|
+
while (1) switch (_context2.n) {
|
|
909
|
+
case 0:
|
|
910
|
+
what = "TypeScript ".concat(version);
|
|
911
|
+
_context2.n = 1;
|
|
912
|
+
return get(url, what);
|
|
913
|
+
case 1:
|
|
914
|
+
answer = _context2.v;
|
|
915
|
+
if (!(!isRecord(answer) || !isTextFiles(answer["files"]))) {
|
|
916
|
+
_context2.n = 2;
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
throw new acquireTypes.SourceError("".concat(what, ": adept answered without the compiler's files."), "unexpected-answer", false);
|
|
920
|
+
case 2:
|
|
921
|
+
return _context2.a(2, {
|
|
922
|
+
version: typeof answer["version"] === "string" ? answer["version"] : version,
|
|
923
|
+
files: answer["files"]
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}, _callee2);
|
|
927
|
+
}));
|
|
928
|
+
return function fetchCompiler(_x6, _x7) {
|
|
929
|
+
return _ref2.apply(this, arguments);
|
|
930
|
+
};
|
|
931
|
+
}();
|
|
893
932
|
return {
|
|
894
933
|
types: function types(pkg) {
|
|
895
|
-
return slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function
|
|
934
|
+
return slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee3() {
|
|
896
935
|
var what, query, answer, stubs;
|
|
897
|
-
return slicedToArray._regenerator().w(function (
|
|
898
|
-
while (1) switch (
|
|
936
|
+
return slicedToArray._regenerator().w(function (_context3) {
|
|
937
|
+
while (1) switch (_context3.n) {
|
|
899
938
|
case 0:
|
|
900
939
|
what = "The types of ".concat(pkg.name, "@").concat(pkg.version);
|
|
901
940
|
query = pkg.integrity ? "?integrity=".concat(encodeURIComponent(pkg.integrity)) : "";
|
|
902
|
-
|
|
941
|
+
_context3.n = 1;
|
|
903
942
|
return get("".concat(options.base, "/types/public/").concat(pkg.name, "@").concat(pkg.version).concat(query), what);
|
|
904
943
|
case 1:
|
|
905
|
-
answer =
|
|
944
|
+
answer = _context3.v;
|
|
906
945
|
if (!(!isRecord(answer) || !isTextFiles(answer["files"]))) {
|
|
907
|
-
|
|
946
|
+
_context3.n = 2;
|
|
908
947
|
break;
|
|
909
948
|
}
|
|
910
949
|
throw new acquireTypes.SourceError("".concat(what, ": adept answered without a bundle."), "unexpected-answer", false);
|
|
911
950
|
case 2:
|
|
912
951
|
stubs = answer["stubs"];
|
|
913
|
-
return
|
|
952
|
+
return _context3.a(2, {
|
|
914
953
|
files: answer["files"],
|
|
915
954
|
stubs: Array.isArray(stubs) ? stubs.filter(function (stub) {
|
|
916
955
|
return typeof stub === "string";
|
|
917
956
|
}) : []
|
|
918
957
|
});
|
|
919
958
|
}
|
|
920
|
-
},
|
|
959
|
+
}, _callee3);
|
|
921
960
|
}))();
|
|
922
961
|
},
|
|
923
962
|
compiler: function compiler(version) {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
break;
|
|
937
|
-
}
|
|
938
|
-
throw new acquireTypes.SourceError("".concat(what, ": adept answered without the compiler's files."), "unexpected-answer", false);
|
|
939
|
-
case 2:
|
|
940
|
-
return _context3.a(2, {
|
|
941
|
-
version: typeof answer["version"] === "string" ? answer["version"] : version,
|
|
942
|
-
files: answer["files"]
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
}, _callee3);
|
|
946
|
-
}))();
|
|
963
|
+
var _compilers$get;
|
|
964
|
+
var url = "".concat(options.base, "/compiler/").concat(version);
|
|
965
|
+
var kept = (_compilers$get = compilers.get(fetchImpl)) !== null && _compilers$get !== void 0 ? _compilers$get : new Map();
|
|
966
|
+
compilers.set(fetchImpl, kept);
|
|
967
|
+
var held = kept.get(url);
|
|
968
|
+
if (held !== undefined) return held;
|
|
969
|
+
var fetching = fetchCompiler(url, version);
|
|
970
|
+
kept.set(url, fetching);
|
|
971
|
+
fetching["catch"](function () {
|
|
972
|
+
if (kept.get(url) === fetching) kept["delete"](url);
|
|
973
|
+
});
|
|
974
|
+
return fetching;
|
|
947
975
|
}
|
|
948
976
|
};
|
|
949
977
|
}
|
|
950
978
|
|
|
951
979
|
/*
|
|
952
980
|
* The typecheck of a proposal whose dependencies are its own (valbuild/home
|
|
953
|
-
* `docs/adept.md`, decision 20): the
|
|
954
|
-
*
|
|
955
|
-
* would be after `pnpm install`, in the browser.
|
|
956
|
-
* does not have count, and content is told them: a
|
|
957
|
-
* of its own is not published until a typecheck
|
|
981
|
+
* `docs/adept.md`, decision 20): the proposal's code with its lockfile and,
|
|
982
|
+
* only when that has errors, the site's code with the site's lockfile -- the
|
|
983
|
+
* base -- each checked as it would be after `pnpm install`, in the browser.
|
|
984
|
+
* Only the errors the base does not have count, and content is told them: a
|
|
985
|
+
* proposal with dependencies of its own is not published until a typecheck
|
|
986
|
+
* of what it stages has none.
|
|
987
|
+
*
|
|
988
|
+
* The proposal goes first because a proposal without errors adds none,
|
|
989
|
+
* whatever the base has, and that is most of them: the base is checked only
|
|
990
|
+
* to tell the errors the site already had from the ones the proposal adds.
|
|
958
991
|
*/
|
|
959
992
|
|
|
960
993
|
/** At most this many of the new errors are sent; the count says how many. */
|
|
@@ -1002,78 +1035,95 @@ function runProposalTypecheck(_x) {
|
|
|
1002
1035
|
|
|
1003
1036
|
/** New errors by file, each file's in order: how the dialog lists them. */
|
|
1004
1037
|
function _runProposalTypecheck() {
|
|
1005
|
-
_runProposalTypecheck = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function
|
|
1006
|
-
var _deps$onStep, _yield$deps$siteSourc,
|
|
1007
|
-
var read, inputs, site, recorded,
|
|
1008
|
-
return slicedToArray._regenerator().w(function (
|
|
1009
|
-
while (1) switch (
|
|
1038
|
+
_runProposalTypecheck = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(deps) {
|
|
1039
|
+
var _deps$onStep, _yield$deps$siteSourc, _ref7, _recorded$WORKSPACE, _project$LOCKFILE, _project$WORKSPACE, _base$errors;
|
|
1040
|
+
var read, inputs, site, recorded, computed, baseLockfile, baseWorkspace, withoutLockfile, project, checkOne, next, base, errors, typecheck, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
1041
|
+
return slicedToArray._regenerator().w(function (_context2) {
|
|
1042
|
+
while (1) switch (_context2.n) {
|
|
1010
1043
|
case 0:
|
|
1011
1044
|
(_deps$onStep = deps.onStep) === null || _deps$onStep === void 0 || _deps$onStep.call(deps, {
|
|
1012
1045
|
step: "reading"
|
|
1013
1046
|
});
|
|
1014
|
-
|
|
1047
|
+
_context2.n = 1;
|
|
1015
1048
|
return deps.client.files(deps.name);
|
|
1016
1049
|
case 1:
|
|
1017
|
-
read =
|
|
1050
|
+
read = _context2.v;
|
|
1018
1051
|
inputs = read.staged.inputs;
|
|
1019
1052
|
if (!(inputs === null)) {
|
|
1020
|
-
|
|
1053
|
+
_context2.n = 2;
|
|
1021
1054
|
break;
|
|
1022
1055
|
}
|
|
1023
|
-
return
|
|
1056
|
+
return _context2.a(2, {
|
|
1024
1057
|
status: "nothing-staged"
|
|
1025
1058
|
});
|
|
1026
1059
|
case 2:
|
|
1027
|
-
|
|
1060
|
+
_context2.n = 3;
|
|
1028
1061
|
return deps.siteSource();
|
|
1029
1062
|
case 3:
|
|
1030
|
-
_t2 = _yield$deps$siteSourc =
|
|
1063
|
+
_t2 = _yield$deps$siteSourc = _context2.v;
|
|
1031
1064
|
_t = _t2 !== null;
|
|
1032
1065
|
if (!_t) {
|
|
1033
|
-
|
|
1066
|
+
_context2.n = 4;
|
|
1034
1067
|
break;
|
|
1035
1068
|
}
|
|
1036
1069
|
_t = _yield$deps$siteSourc !== void 0;
|
|
1037
1070
|
case 4:
|
|
1038
1071
|
if (!_t) {
|
|
1039
|
-
|
|
1072
|
+
_context2.n = 5;
|
|
1040
1073
|
break;
|
|
1041
1074
|
}
|
|
1042
1075
|
_t3 = _yield$deps$siteSourc;
|
|
1043
|
-
|
|
1076
|
+
_context2.n = 6;
|
|
1044
1077
|
break;
|
|
1045
1078
|
case 5:
|
|
1046
1079
|
_t3 = {};
|
|
1047
1080
|
case 6:
|
|
1048
1081
|
site = _t3;
|
|
1049
|
-
|
|
1082
|
+
_context2.n = 7;
|
|
1050
1083
|
return deps.siteDependencyFiles();
|
|
1051
1084
|
case 7:
|
|
1052
|
-
recorded =
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1085
|
+
recorded = _context2.v;
|
|
1086
|
+
computed = null;
|
|
1087
|
+
baseLockfile = /*#__PURE__*/function () {
|
|
1088
|
+
var _ref5 = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee() {
|
|
1089
|
+
var _ref6, _recorded$LOCKFILE, _deps$onStep2;
|
|
1090
|
+
var lockfile, packageJson;
|
|
1091
|
+
return slicedToArray._regenerator().w(function (_context) {
|
|
1092
|
+
while (1) switch (_context.n) {
|
|
1093
|
+
case 0:
|
|
1094
|
+
lockfile = (_ref6 = (_recorded$LOCKFILE = recorded[LOCKFILE]) !== null && _recorded$LOCKFILE !== void 0 ? _recorded$LOCKFILE : site[LOCKFILE]) !== null && _ref6 !== void 0 ? _ref6 : computed;
|
|
1095
|
+
if (!(lockfile !== null)) {
|
|
1096
|
+
_context.n = 1;
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
return _context.a(2, lockfile);
|
|
1100
|
+
case 1:
|
|
1101
|
+
// A site made before proposals carried dependencies has no lockfile on
|
|
1102
|
+
// record: the base is checked against one computed from its package.json,
|
|
1103
|
+
// as `pnpm install` would make it.
|
|
1104
|
+
packageJson = site["package.json"];
|
|
1105
|
+
if (!(packageJson === undefined)) {
|
|
1106
|
+
_context.n = 2;
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
throw new Error("The site has no package.json, so there is nothing to check the proposal against.");
|
|
1110
|
+
case 2:
|
|
1111
|
+
(_deps$onStep2 = deps.onStep) === null || _deps$onStep2 === void 0 || _deps$onStep2.call(deps, {
|
|
1112
|
+
step: "lockfile"
|
|
1113
|
+
});
|
|
1114
|
+
_context.n = 3;
|
|
1115
|
+
return deps.computeLockfile(packageJson, deps.signal);
|
|
1116
|
+
case 3:
|
|
1117
|
+
computed = _context.v;
|
|
1118
|
+
return _context.a(2, computed);
|
|
1119
|
+
}
|
|
1120
|
+
}, _callee);
|
|
1121
|
+
}));
|
|
1122
|
+
return function baseLockfile() {
|
|
1123
|
+
return _ref5.apply(this, arguments);
|
|
1124
|
+
};
|
|
1125
|
+
}();
|
|
1126
|
+
baseWorkspace = (_ref7 = (_recorded$WORKSPACE = recorded[WORKSPACE]) !== null && _recorded$WORKSPACE !== void 0 ? _recorded$WORKSPACE : site[WORKSPACE]) !== null && _ref7 !== void 0 ? _ref7 : null;
|
|
1077
1127
|
withoutLockfile = function withoutLockfile(files) {
|
|
1078
1128
|
var out = createForOfIteratorHelper._objectSpread2({}, files);
|
|
1079
1129
|
delete out[LOCKFILE];
|
|
@@ -1096,34 +1146,63 @@ function _runProposalTypecheck() {
|
|
|
1096
1146
|
});
|
|
1097
1147
|
}
|
|
1098
1148
|
});
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1149
|
+
};
|
|
1150
|
+
_t4 = checkOne;
|
|
1151
|
+
_t5 = project;
|
|
1152
|
+
if (!((_project$LOCKFILE = project[LOCKFILE]) !== null && _project$LOCKFILE !== void 0)) {
|
|
1153
|
+
_context2.n = 8;
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
_t6 = _project$LOCKFILE;
|
|
1157
|
+
_context2.n = 10;
|
|
1158
|
+
break;
|
|
1159
|
+
case 8:
|
|
1160
|
+
_context2.n = 9;
|
|
1161
|
+
return baseLockfile();
|
|
1162
|
+
case 9:
|
|
1163
|
+
_t6 = _context2.v;
|
|
1164
|
+
case 10:
|
|
1165
|
+
_context2.n = 11;
|
|
1166
|
+
return _t4("proposal", _t5, _t6, (_project$WORKSPACE = project[WORKSPACE]) !== null && _project$WORKSPACE !== void 0 ? _project$WORKSPACE : baseWorkspace);
|
|
1103
1167
|
case 11:
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1168
|
+
next = _context2.v;
|
|
1169
|
+
if (!(next.errors.length === 0)) {
|
|
1170
|
+
_context2.n = 12;
|
|
1171
|
+
break;
|
|
1172
|
+
}
|
|
1173
|
+
_t7 = null;
|
|
1174
|
+
_context2.n = 15;
|
|
1175
|
+
break;
|
|
1107
1176
|
case 12:
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1177
|
+
_t8 = checkOne;
|
|
1178
|
+
_t9 = site;
|
|
1179
|
+
_context2.n = 13;
|
|
1180
|
+
return baseLockfile();
|
|
1181
|
+
case 13:
|
|
1182
|
+
_context2.n = 14;
|
|
1183
|
+
return _t8("site", _t9, _context2.v, baseWorkspace);
|
|
1184
|
+
case 14:
|
|
1185
|
+
_t7 = _context2.v;
|
|
1186
|
+
case 15:
|
|
1187
|
+
base = _t7;
|
|
1188
|
+
errors = newErrors((_base$errors = base === null || base === void 0 ? void 0 : base.errors) !== null && _base$errors !== void 0 ? _base$errors : [], next.errors).map(reportedError);
|
|
1189
|
+
_context2.n = 16;
|
|
1111
1190
|
return deps.client.reportTypecheck(deps.name, createForOfIteratorHelper._objectSpread2({
|
|
1112
1191
|
inputs: inputs,
|
|
1113
1192
|
newErrors: errors.slice(0, MAX_REPORTED_ERRORS)
|
|
1114
1193
|
}, errors.length > MAX_REPORTED_ERRORS ? {
|
|
1115
1194
|
count: errors.length
|
|
1116
1195
|
} : {}));
|
|
1117
|
-
case
|
|
1118
|
-
typecheck =
|
|
1119
|
-
return
|
|
1196
|
+
case 16:
|
|
1197
|
+
typecheck = _context2.v;
|
|
1198
|
+
return _context2.a(2, {
|
|
1120
1199
|
status: "checked",
|
|
1121
1200
|
inputs: inputs,
|
|
1122
1201
|
errors: errors,
|
|
1123
1202
|
typecheck: typecheck
|
|
1124
1203
|
});
|
|
1125
1204
|
}
|
|
1126
|
-
},
|
|
1205
|
+
}, _callee2);
|
|
1127
1206
|
}));
|
|
1128
1207
|
return _runProposalTypecheck.apply(this, arguments);
|
|
1129
1208
|
}
|