@valbuild/shared 0.149.7 → 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 +64 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +3 -0
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/validation/validationWarnings.d.ts +33 -0
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +64 -10
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +64 -10
- package/internal/dist/valbuild-shared-internal.esm.js +60 -11
- package/package.json +3 -3
- 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,69 @@
|
|
|
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
|
+
|
|
15
|
+
## 0.150.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#894](https://github.com/valbuild/val/pull/894) [`9171baa`](https://github.com/valbuild/val/commit/9171baad7beb1b2a355c70724d2339467b126e02) Thanks [@freekh](https://github.com/freekh)! - `val validate` no longer fails a project just because some of its files are
|
|
20
|
+
local while the project stores files remotely (`files: { remote: true }` or
|
|
21
|
+
`.remote()`). Every project made from a template starts like that, and the
|
|
22
|
+
site serves those files from `public/` until they are uploaded. They are now
|
|
23
|
+
reported as **warnings**, grouped into one block per file with the command
|
|
24
|
+
that uploads them:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
content/images.val.ts ⚠ 7 warnings (12ms)
|
|
28
|
+
│
|
|
29
|
+
│ ⚠ Local files in a project with remote files. Your site serves them from public/ for now; they move to remote storage when uploaded.
|
|
30
|
+
│
|
|
31
|
+
│ content/images.val.ts:7:5 /public/val/images/image-0_00000.png
|
|
32
|
+
│ content/images.val.ts:8:5 /public/val/images/image-1_00001.png
|
|
33
|
+
│ content/images.val.ts:9:5 /public/val/images/image-2_00002.png
|
|
34
|
+
│ content/images.val.ts:10:5 /public/val/images/image-3_00003.png
|
|
35
|
+
│ content/images.val.ts:11:5 /public/val/images/image-4_00004.png
|
|
36
|
+
│ … 2 more
|
|
37
|
+
│
|
|
38
|
+
│ → val validate --fix uploads them (needs val login)
|
|
39
|
+
│
|
|
40
|
+
|
|
41
|
+
✔ No validation errors · 7 warnings in 1 file
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `--strict` on `val validate` and `val publish` makes warnings fail too.
|
|
45
|
+
- `val validate --fix` still fails when it cannot upload them, for example
|
|
46
|
+
when you are not logged in.
|
|
47
|
+
- A local file that does not exist is still an error.
|
|
48
|
+
- The language server shows these as warnings.
|
|
49
|
+
- In the Studio, **Check everything** on the Validate page lists them with a
|
|
50
|
+
**Fix** button that uploads them, so a hosted project, which
|
|
51
|
+
has no command line, can move its template's images and files to remote
|
|
52
|
+
storage. That covers images, files and videos (a video's poster, captions
|
|
53
|
+
and HLS stream go up with it), images inside rich text included, and the
|
|
54
|
+
fields that picked a gallery image or a video from a set are updated with
|
|
55
|
+
it.
|
|
56
|
+
- On a hosted project, **Check everything** no longer reports the template's
|
|
57
|
+
images and videos as "The file is gone", and no longer offers a Fix that
|
|
58
|
+
would remove them from their gallery or video set.
|
|
59
|
+
|
|
60
|
+
Fixable errors are now printed with `✘`, like every other error, instead of
|
|
61
|
+
the `⚠` warnings use. They were always errors and still make `val validate`
|
|
62
|
+
fail.
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [[`9171baa`](https://github.com/valbuild/val/commit/9171baad7beb1b2a355c70724d2339467b126e02)]:
|
|
65
|
+
- @valbuild/core@0.150.1
|
|
66
|
+
|
|
3
67
|
## 0.149.7
|
|
4
68
|
|
|
5
69
|
### 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;
|
|
@@ -31,6 +31,7 @@ export * from "./aiTools/aiSourceToolPatches.js";
|
|
|
31
31
|
export * from "./validation/partitionValidationErrors.js";
|
|
32
32
|
export * from "./validation/blockingValidationErrors.js";
|
|
33
33
|
export * from "./validation/studioFixes.js";
|
|
34
|
+
export * from "./validation/validationWarnings.js";
|
|
34
35
|
export * from "./media/encodeImageDecisions.js";
|
|
35
36
|
export * from "./search/searchIndex.js";
|
|
36
37
|
export * from "./search/traverseSchemaSource.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ValidationFix } from "@valbuild/core";
|
|
2
|
+
/**
|
|
3
|
+
* The fixes whose errors are WARNINGS: reported, but never a reason on their
|
|
4
|
+
* own for `val validate` or `val publish` to fail (unless `--strict`).
|
|
5
|
+
*
|
|
6
|
+
* All of them say the same thing: a local file in a project that stores its
|
|
7
|
+
* files remotely (`files: { remote: true }`, or `.remote()`). Nothing is broken
|
|
8
|
+
* -- the site serves the file from `public/` until it is uploaded -- and every
|
|
9
|
+
* project made from a template starts this way, including a hosted one, which
|
|
10
|
+
* has no CLI to upload with. A local file that does not EXIST is still an
|
|
11
|
+
* error; the CLI's handlers check that before reporting a warning.
|
|
12
|
+
*
|
|
13
|
+
* `--fix` is different: asked to upload and unable to (not logged in, no
|
|
14
|
+
* project), `val validate --fix` fails, because it was asked to do something
|
|
15
|
+
* it did not do.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WARNING_FIXES: readonly ["image:upload-remote", "images:upload-remote", "file:upload-remote", "files:upload-remote", "video:upload-remote", "videos:upload-remote"];
|
|
18
|
+
export type WarningFix = (typeof WARNING_FIXES)[number];
|
|
19
|
+
export declare function isWarningFix(fix: ValidationFix): fix is WarningFix;
|
|
20
|
+
/**
|
|
21
|
+
* Whether an error is a warning: it carries fixes, and every one of them is a
|
|
22
|
+
* {@link WARNING_FIXES} code. An error tagged with any other fix as well is an
|
|
23
|
+
* error, the same rule `isRepairedOnSave` uses.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isValidationWarning(error: {
|
|
26
|
+
fixes?: ValidationFix[];
|
|
27
|
+
}): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* What `val validate` says about a local file in a remote project, once for
|
|
30
|
+
* all of a module's: the CLI groups warnings by message.
|
|
31
|
+
*/
|
|
32
|
+
export declare const LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = "Local files in a project with remote files. Your site serves them from public/ for now; they move to remote storage when uploaded.";
|
|
33
|
+
export declare const LOCAL_FILE_IN_REMOTE_PROJECT_HINT = "val validate --fix uploads them (needs val login)";
|
|
@@ -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);
|
|
@@ -6472,6 +6481,46 @@ function isStudioFix(fix) {
|
|
|
6472
6481
|
});
|
|
6473
6482
|
}
|
|
6474
6483
|
|
|
6484
|
+
/**
|
|
6485
|
+
* The fixes whose errors are WARNINGS: reported, but never a reason on their
|
|
6486
|
+
* own for `val validate` or `val publish` to fail (unless `--strict`).
|
|
6487
|
+
*
|
|
6488
|
+
* All of them say the same thing: a local file in a project that stores its
|
|
6489
|
+
* files remotely (`files: { remote: true }`, or `.remote()`). Nothing is broken
|
|
6490
|
+
* -- the site serves the file from `public/` until it is uploaded -- and every
|
|
6491
|
+
* project made from a template starts this way, including a hosted one, which
|
|
6492
|
+
* has no CLI to upload with. A local file that does not EXIST is still an
|
|
6493
|
+
* error; the CLI's handlers check that before reporting a warning.
|
|
6494
|
+
*
|
|
6495
|
+
* `--fix` is different: asked to upload and unable to (not logged in, no
|
|
6496
|
+
* project), `val validate --fix` fails, because it was asked to do something
|
|
6497
|
+
* it did not do.
|
|
6498
|
+
*/
|
|
6499
|
+
var WARNING_FIXES = ["image:upload-remote", "images:upload-remote", "file:upload-remote", "files:upload-remote", "video:upload-remote", "videos:upload-remote"];
|
|
6500
|
+
function isWarningFix(fix) {
|
|
6501
|
+
return WARNING_FIXES.some(function (warningFix) {
|
|
6502
|
+
return warningFix === fix;
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6506
|
+
/**
|
|
6507
|
+
* Whether an error is a warning: it carries fixes, and every one of them is a
|
|
6508
|
+
* {@link WARNING_FIXES} code. An error tagged with any other fix as well is an
|
|
6509
|
+
* error, the same rule `isRepairedOnSave` uses.
|
|
6510
|
+
*/
|
|
6511
|
+
function isValidationWarning(error) {
|
|
6512
|
+
var _error$fixes;
|
|
6513
|
+
var fixes = (_error$fixes = error.fixes) !== null && _error$fixes !== void 0 ? _error$fixes : [];
|
|
6514
|
+
return fixes.length > 0 && fixes.every(isWarningFix);
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
/**
|
|
6518
|
+
* What `val validate` says about a local file in a remote project, once for
|
|
6519
|
+
* all of a module's: the CLI groups warnings by message.
|
|
6520
|
+
*/
|
|
6521
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = "Local files in a project with remote files. Your site serves them from public/ for now; they move to remote storage when uploaded.";
|
|
6522
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_HINT = "val validate --fix uploads them (needs val login)";
|
|
6523
|
+
|
|
6475
6524
|
/**
|
|
6476
6525
|
* Every decision `encode` makes, with none of the pixels.
|
|
6477
6526
|
*
|
|
@@ -8624,6 +8673,8 @@ exports.ImageEncodeOption = ImageEncodeOption;
|
|
|
8624
8673
|
exports.ImageOptions = ImageOptions;
|
|
8625
8674
|
exports.JSONValue = JSONValue;
|
|
8626
8675
|
exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
|
|
8676
|
+
exports.LOCAL_FILE_IN_REMOTE_PROJECT_HINT = LOCAL_FILE_IN_REMOTE_PROJECT_HINT;
|
|
8677
|
+
exports.LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = LOCAL_FILE_IN_REMOTE_PROJECT_WARNING;
|
|
8627
8678
|
exports.ModuleComparison = ModuleComparison;
|
|
8628
8679
|
exports.NEVER_ENCODED = NEVER_ENCODED;
|
|
8629
8680
|
exports.ParentRef = ParentRef$1;
|
|
@@ -8683,6 +8734,7 @@ exports.ValCommit = ValCommit;
|
|
|
8683
8734
|
exports.ValDeployment = ValDeployment;
|
|
8684
8735
|
exports.VideoOptions = VideoOptions;
|
|
8685
8736
|
exports.VideoStreamOption = VideoStreamOption;
|
|
8737
|
+
exports.WARNING_FIXES = WARNING_FIXES;
|
|
8686
8738
|
exports.WASM_ENCODED_MIME_TYPES = WASM_ENCODED_MIME_TYPES;
|
|
8687
8739
|
exports.accentRamp = accentRamp;
|
|
8688
8740
|
exports.buildDuplicatePatch = buildDuplicatePatch;
|
|
@@ -8729,6 +8781,8 @@ exports.isRepairedOnSave = isRepairedOnSave;
|
|
|
8729
8781
|
exports.isSchemaSourceFixError = isSchemaSourceFixError;
|
|
8730
8782
|
exports.isSkippedSource = isSkippedSource;
|
|
8731
8783
|
exports.isStudioFix = isStudioFix;
|
|
8784
|
+
exports.isValidationWarning = isValidationWarning;
|
|
8785
|
+
exports.isWarningFix = isWarningFix;
|
|
8732
8786
|
exports.joinSharedChanges = joinSharedChanges;
|
|
8733
8787
|
exports.keyOfRecordPath = keyOfRecordPath;
|
|
8734
8788
|
exports.levenshtein = levenshtein;
|
|
@@ -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);
|
|
@@ -6472,6 +6481,46 @@ function isStudioFix(fix) {
|
|
|
6472
6481
|
});
|
|
6473
6482
|
}
|
|
6474
6483
|
|
|
6484
|
+
/**
|
|
6485
|
+
* The fixes whose errors are WARNINGS: reported, but never a reason on their
|
|
6486
|
+
* own for `val validate` or `val publish` to fail (unless `--strict`).
|
|
6487
|
+
*
|
|
6488
|
+
* All of them say the same thing: a local file in a project that stores its
|
|
6489
|
+
* files remotely (`files: { remote: true }`, or `.remote()`). Nothing is broken
|
|
6490
|
+
* -- the site serves the file from `public/` until it is uploaded -- and every
|
|
6491
|
+
* project made from a template starts this way, including a hosted one, which
|
|
6492
|
+
* has no CLI to upload with. A local file that does not EXIST is still an
|
|
6493
|
+
* error; the CLI's handlers check that before reporting a warning.
|
|
6494
|
+
*
|
|
6495
|
+
* `--fix` is different: asked to upload and unable to (not logged in, no
|
|
6496
|
+
* project), `val validate --fix` fails, because it was asked to do something
|
|
6497
|
+
* it did not do.
|
|
6498
|
+
*/
|
|
6499
|
+
var WARNING_FIXES = ["image:upload-remote", "images:upload-remote", "file:upload-remote", "files:upload-remote", "video:upload-remote", "videos:upload-remote"];
|
|
6500
|
+
function isWarningFix(fix) {
|
|
6501
|
+
return WARNING_FIXES.some(function (warningFix) {
|
|
6502
|
+
return warningFix === fix;
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6506
|
+
/**
|
|
6507
|
+
* Whether an error is a warning: it carries fixes, and every one of them is a
|
|
6508
|
+
* {@link WARNING_FIXES} code. An error tagged with any other fix as well is an
|
|
6509
|
+
* error, the same rule `isRepairedOnSave` uses.
|
|
6510
|
+
*/
|
|
6511
|
+
function isValidationWarning(error) {
|
|
6512
|
+
var _error$fixes;
|
|
6513
|
+
var fixes = (_error$fixes = error.fixes) !== null && _error$fixes !== void 0 ? _error$fixes : [];
|
|
6514
|
+
return fixes.length > 0 && fixes.every(isWarningFix);
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
/**
|
|
6518
|
+
* What `val validate` says about a local file in a remote project, once for
|
|
6519
|
+
* all of a module's: the CLI groups warnings by message.
|
|
6520
|
+
*/
|
|
6521
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = "Local files in a project with remote files. Your site serves them from public/ for now; they move to remote storage when uploaded.";
|
|
6522
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_HINT = "val validate --fix uploads them (needs val login)";
|
|
6523
|
+
|
|
6475
6524
|
/**
|
|
6476
6525
|
* Every decision `encode` makes, with none of the pixels.
|
|
6477
6526
|
*
|
|
@@ -8624,6 +8673,8 @@ exports.ImageEncodeOption = ImageEncodeOption;
|
|
|
8624
8673
|
exports.ImageOptions = ImageOptions;
|
|
8625
8674
|
exports.JSONValue = JSONValue;
|
|
8626
8675
|
exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
|
|
8676
|
+
exports.LOCAL_FILE_IN_REMOTE_PROJECT_HINT = LOCAL_FILE_IN_REMOTE_PROJECT_HINT;
|
|
8677
|
+
exports.LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = LOCAL_FILE_IN_REMOTE_PROJECT_WARNING;
|
|
8627
8678
|
exports.ModuleComparison = ModuleComparison;
|
|
8628
8679
|
exports.NEVER_ENCODED = NEVER_ENCODED;
|
|
8629
8680
|
exports.ParentRef = ParentRef$1;
|
|
@@ -8683,6 +8734,7 @@ exports.ValCommit = ValCommit;
|
|
|
8683
8734
|
exports.ValDeployment = ValDeployment;
|
|
8684
8735
|
exports.VideoOptions = VideoOptions;
|
|
8685
8736
|
exports.VideoStreamOption = VideoStreamOption;
|
|
8737
|
+
exports.WARNING_FIXES = WARNING_FIXES;
|
|
8686
8738
|
exports.WASM_ENCODED_MIME_TYPES = WASM_ENCODED_MIME_TYPES;
|
|
8687
8739
|
exports.accentRamp = accentRamp;
|
|
8688
8740
|
exports.buildDuplicatePatch = buildDuplicatePatch;
|
|
@@ -8729,6 +8781,8 @@ exports.isRepairedOnSave = isRepairedOnSave;
|
|
|
8729
8781
|
exports.isSchemaSourceFixError = isSchemaSourceFixError;
|
|
8730
8782
|
exports.isSkippedSource = isSkippedSource;
|
|
8731
8783
|
exports.isStudioFix = isStudioFix;
|
|
8784
|
+
exports.isValidationWarning = isValidationWarning;
|
|
8785
|
+
exports.isWarningFix = isWarningFix;
|
|
8732
8786
|
exports.joinSharedChanges = joinSharedChanges;
|
|
8733
8787
|
exports.keyOfRecordPath = keyOfRecordPath;
|
|
8734
8788
|
exports.levenshtein = levenshtein;
|
|
@@ -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);
|
|
@@ -6465,6 +6474,46 @@ function isStudioFix(fix) {
|
|
|
6465
6474
|
});
|
|
6466
6475
|
}
|
|
6467
6476
|
|
|
6477
|
+
/**
|
|
6478
|
+
* The fixes whose errors are WARNINGS: reported, but never a reason on their
|
|
6479
|
+
* own for `val validate` or `val publish` to fail (unless `--strict`).
|
|
6480
|
+
*
|
|
6481
|
+
* All of them say the same thing: a local file in a project that stores its
|
|
6482
|
+
* files remotely (`files: { remote: true }`, or `.remote()`). Nothing is broken
|
|
6483
|
+
* -- the site serves the file from `public/` until it is uploaded -- and every
|
|
6484
|
+
* project made from a template starts this way, including a hosted one, which
|
|
6485
|
+
* has no CLI to upload with. A local file that does not EXIST is still an
|
|
6486
|
+
* error; the CLI's handlers check that before reporting a warning.
|
|
6487
|
+
*
|
|
6488
|
+
* `--fix` is different: asked to upload and unable to (not logged in, no
|
|
6489
|
+
* project), `val validate --fix` fails, because it was asked to do something
|
|
6490
|
+
* it did not do.
|
|
6491
|
+
*/
|
|
6492
|
+
var WARNING_FIXES = ["image:upload-remote", "images:upload-remote", "file:upload-remote", "files:upload-remote", "video:upload-remote", "videos:upload-remote"];
|
|
6493
|
+
function isWarningFix(fix) {
|
|
6494
|
+
return WARNING_FIXES.some(function (warningFix) {
|
|
6495
|
+
return warningFix === fix;
|
|
6496
|
+
});
|
|
6497
|
+
}
|
|
6498
|
+
|
|
6499
|
+
/**
|
|
6500
|
+
* Whether an error is a warning: it carries fixes, and every one of them is a
|
|
6501
|
+
* {@link WARNING_FIXES} code. An error tagged with any other fix as well is an
|
|
6502
|
+
* error, the same rule `isRepairedOnSave` uses.
|
|
6503
|
+
*/
|
|
6504
|
+
function isValidationWarning(error) {
|
|
6505
|
+
var _error$fixes;
|
|
6506
|
+
var fixes = (_error$fixes = error.fixes) !== null && _error$fixes !== void 0 ? _error$fixes : [];
|
|
6507
|
+
return fixes.length > 0 && fixes.every(isWarningFix);
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6510
|
+
/**
|
|
6511
|
+
* What `val validate` says about a local file in a remote project, once for
|
|
6512
|
+
* all of a module's: the CLI groups warnings by message.
|
|
6513
|
+
*/
|
|
6514
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_WARNING = "Local files in a project with remote files. Your site serves them from public/ for now; they move to remote storage when uploaded.";
|
|
6515
|
+
var LOCAL_FILE_IN_REMOTE_PROJECT_HINT = "val validate --fix uploads them (needs val login)";
|
|
6516
|
+
|
|
6468
6517
|
/**
|
|
6469
6518
|
* Every decision `encode` makes, with none of the pixels.
|
|
6470
6519
|
*
|
|
@@ -8559,4 +8608,4 @@ var messageOf = function messageOf(error) {
|
|
|
8559
8608
|
return error instanceof Error ? error.message : String(error);
|
|
8560
8609
|
};
|
|
8561
8610
|
|
|
8562
|
-
export { AA_LARGE, AA_TEXT, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, indexModule, isInsidePatchSetPath, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, memoizePerRequest, newestCommitSha, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
|
|
8611
|
+
export { AA_LARGE, AA_TEXT, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, indexModule, isInsidePatchSetPath, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, memoizePerRequest, newestCommitSha, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
56
|
+
"@valbuild/core": "0.150.2"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"CHANGELOG.md",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
],
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"typescript": "^6.0.3",
|
|
74
|
-
"@valbuild/tanstack-build": "0.
|
|
74
|
+
"@valbuild/tanstack-build": "0.150.1"
|
|
75
75
|
},
|
|
76
76
|
"sideEffects": false,
|
|
77
77
|
"scripts": {
|