@valbuild/server 0.155.0 → 0.156.1
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 +30 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +2 -2
- package/browser/dist/valbuild-server-browser.cjs.prod.js +2 -2
- package/browser/dist/valbuild-server-browser.esm.js +2 -2
- package/dist/{ValOpsMemory-f000531b.cjs.prod.js → ValOpsMemory-6155aa9b.cjs.prod.js} +36 -4
- package/dist/{ValOpsMemory-1a0bc2dc.esm.js → ValOpsMemory-a00c3187.esm.js} +36 -4
- package/dist/{ValOpsMemory-6e829758.cjs.dev.js → ValOpsMemory-c1453e6a.cjs.dev.js} +36 -4
- package/dist/{createPrettierFormatter-5d830bdf.cjs.dev.js → createPrettierFormatter-8e60f596.cjs.prod.js} +1 -1
- package/dist/{createPrettierFormatter-b31bfbe5.cjs.prod.js → createPrettierFormatter-a9109288.cjs.dev.js} +1 -1
- package/dist/{createPrettierFormatter-ce478de1.esm.js → createPrettierFormatter-fb68e363.esm.js} +1 -1
- package/dist/{createValRuntime-f55300a0.esm.js → createValRuntime-4371c69b.esm.js} +6 -4
- package/dist/{createValRuntime-a519939b.cjs.prod.js → createValRuntime-5eb0336d.cjs.prod.js} +6 -4
- package/dist/{createValRuntime-1c7d891e.cjs.dev.js → createValRuntime-82f38747.cjs.dev.js} +6 -4
- package/dist/declarations/src/internal/index.d.ts +14 -0
- package/dist/declarations/src/proposalMerge/foldContent.d.ts +45 -0
- package/dist/declarations/src/proposalMerge/project.d.ts +124 -0
- package/dist/declarations/src/proposalMerge/threeWay.d.ts +51 -0
- package/dist/declarations/src/proposalMerge/validate.d.ts +16 -0
- package/dist/foldContent-2c218a30.cjs.dev.js +216 -0
- package/dist/foldContent-54f2c87c.cjs.prod.js +216 -0
- package/dist/foldContent-f065c19f.esm.js +214 -0
- package/dist/{inTabFetch-dae5dd87.esm.js → inTabFetch-22fc6815.esm.js} +1 -1
- package/dist/{inTabFetch-3d8ceb84.cjs.prod.js → inTabFetch-4efbd411.cjs.prod.js} +1 -1
- package/dist/{inTabFetch-75753a09.cjs.dev.js → inTabFetch-f5eedbd0.cjs.dev.js} +1 -1
- package/dist/{proposalJsonEntries-2cd6f6fe.esm.js → jsonValuesModule-12fc4bb0.esm.js} +2 -128
- package/dist/{proposalJsonEntries-d21900d4.cjs.dev.js → jsonValuesModule-6cf73937.cjs.prod.js} +2 -130
- package/dist/{proposalJsonEntries-d4623810.cjs.prod.js → jsonValuesModule-ed68a9de.cjs.dev.js} +2 -130
- package/dist/merge-5a8fc685.cjs.prod.js +1596 -0
- package/dist/merge-a21a9c78.cjs.dev.js +1596 -0
- package/dist/merge-eca8ec38.esm.js +1566 -0
- package/dist/proposalJsonEntries-4fcfab08.cjs.prod.js +135 -0
- package/dist/proposalJsonEntries-878ad5b6.cjs.dev.js +135 -0
- package/dist/proposalJsonEntries-e1b07915.esm.js +128 -0
- package/dist/{publishKit-395b92e5.cjs.prod.js → publishKit-0ec427f3.cjs.prod.js} +19 -22
- package/dist/{publishKit-04b6d255.esm.js → publishKit-a40062cd.esm.js} +11 -14
- package/dist/{publishKit-de4baed6.cjs.dev.js → publishKit-ffcaf2af.cjs.dev.js} +19 -22
- package/dist/{valRuntime-e922e372.cjs.prod.js → valRuntime-175e2032.cjs.prod.js} +21 -995
- package/dist/{valRuntime-7fd12e16.esm.js → valRuntime-18d4c693.esm.js} +11 -982
- package/dist/{valRuntime-d3cc6e0d.cjs.dev.js → valRuntime-c4b2e906.cjs.dev.js} +21 -995
- package/dist/valbuild-server.cjs.dev.js +45 -462
- package/dist/valbuild-server.cjs.prod.js +45 -462
- package/dist/valbuild-server.esm.js +15 -431
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +2 -2
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +2 -2
- package/internal/browser/dist/valbuild-server-internal-browser.esm.js +2 -2
- package/internal/dist/valbuild-server-internal.cjs.dev.js +20 -2
- package/internal/dist/valbuild-server-internal.cjs.prod.js +20 -2
- package/internal/dist/valbuild-server-internal.esm.js +20 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.156.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1082](https://github.com/valbuild/val/pull/1082) [`156b58e`](https://github.com/valbuild/val/commit/156b58e6a268c704db8aac6eb6769e6cca518f2c) Thanks [@freekh](https://github.com/freekh)! - Discarding many changes is now one request, and a discard that only partly succeeds no longer leaves discarded changes on screen.
|
|
8
|
+
|
|
9
|
+
When some of the changes could not be discarded, for example because one was part of a publish that was running, the Studio said nothing had been discarded and kept showing changes that were already gone. It now drops the ones that were discarded, keeps the rest, and says how many went through, with **Try again** (or **Cancel publish**) for the ones that are left. **Cancel publish** is offered again when a running publish holds a change: that refusal never reached the Studio before.
|
|
10
|
+
|
|
11
|
+
`DELETE /api/val/patches` now takes its ids in the body (`{ "ids": [...] }`), and still accepts the `id` query parameters older Studio tabs send. When it answers 500 because some changes were refused, it now also says which ones it deleted (`deleted`) and the version it moved to (`headVersion`).
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`156b58e`](https://github.com/valbuild/val/commit/156b58e6a268c704db8aac6eb6769e6cca518f2c), [`604d91a`](https://github.com/valbuild/val/commit/604d91a54fbf19e319c39867217caad8bb2f7e8d), [`99b798c`](https://github.com/valbuild/val/commit/99b798ce785c11543891b58b3d53a66339953882)]:
|
|
14
|
+
- @valbuild/ui@0.156.1
|
|
15
|
+
- @valbuild/shared@0.156.1
|
|
16
|
+
|
|
17
|
+
## 0.156.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1106](https://github.com/valbuild/val/pull/1106) [`332c386`](https://github.com/valbuild/val/commit/332c386621f3aab44412307352319e176824160d) Thanks [@freekh](https://github.com/freekh)! - A site's pages no longer load the TypeScript compiler
|
|
22
|
+
|
|
23
|
+
`foldContent`, new in `@valbuild/server/internal`, was exported in a way that loaded the TypeScript compiler with that entry, which is also what a site's pages read their content through. It is now loaded only when it is called, so a page a visitor opens evaluates none of it again.
|
|
24
|
+
|
|
25
|
+
- [#1063](https://github.com/valbuild/val/pull/1063) [`27b87f6`](https://github.com/valbuild/val/commit/27b87f6fadb27ccb9d67c0a07ac560772d4e3ae4) Thanks [@freekh](https://github.com/freekh)! - `@valbuild/server/internal` exports `foldContent`, which writes each module's recorded content back into a project's `.val.ts` files (and a `.jsonValues()` record's `.val.json` entries) the way a save writes them, then checks that every module reads back exactly as recorded. It is what Val Build needs to connect a project it hosts to a repository. A content change Val cannot write into the code that builds it is refused by name.
|
|
26
|
+
|
|
27
|
+
Also: a merge whose content cannot be written into a file now says why, instead of `[object Object]`, and a project loaded for a merge whose `tsconfig.json` names its inputs by `include` glob now loads.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`3955b0e`](https://github.com/valbuild/val/commit/3955b0ec25a2c0759f8323efd88529e6867f17e2), [`0cf24ba`](https://github.com/valbuild/val/commit/0cf24ba78e5e0a86ed594b58ff7f7fb5e7fcc440), [`7c47276`](https://github.com/valbuild/val/commit/7c472766183a425ef022e84d341e666c48a6bc3b)]:
|
|
30
|
+
- @valbuild/shared@0.156.0
|
|
31
|
+
- @valbuild/ui@0.156.0
|
|
32
|
+
|
|
3
33
|
## 0.155.0
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-f5eedbd0.cjs.dev.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValOpsMemory-
|
|
7
|
+
require('../../dist/ValOpsMemory-c1453e6a.cjs.dev.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('../../dist/jsonValuesPatch-88bc661d.cjs.dev.js');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-4efbd411.cjs.prod.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValOpsMemory-
|
|
7
|
+
require('../../dist/ValOpsMemory-6155aa9b.cjs.prod.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('../../dist/jsonValuesPatch-92798812.cjs.prod.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createInTabValFetch } from '../../dist/inTabFetch-
|
|
1
|
+
export { c as createInTabValFetch } from '../../dist/inTabFetch-22fc6815.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
3
|
-
import '../../dist/ValOpsMemory-
|
|
3
|
+
import '../../dist/ValOpsMemory-a00c3187.esm.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@valbuild/shared/internal';
|
|
6
6
|
import '../../dist/jsonValuesPatch-13acc674.esm.js';
|
|
@@ -5124,7 +5124,7 @@ var packageJson = {
|
|
|
5124
5124
|
],
|
|
5125
5125
|
exports: true
|
|
5126
5126
|
},
|
|
5127
|
-
version: "0.
|
|
5127
|
+
version: "0.156.1",
|
|
5128
5128
|
scripts: {
|
|
5129
5129
|
typecheck: "tsc --noEmit",
|
|
5130
5130
|
test: "jest",
|
|
@@ -8285,7 +8285,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8285
8285
|
};
|
|
8286
8286
|
},
|
|
8287
8287
|
DELETE: async req => {
|
|
8288
|
-
var _req$body;
|
|
8288
|
+
var _req$body, _req$body2;
|
|
8289
8289
|
const query = req.query;
|
|
8290
8290
|
const cookies = req.cookies;
|
|
8291
8291
|
const auth = getAuth(cookies);
|
|
@@ -8305,7 +8305,30 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8305
8305
|
}
|
|
8306
8306
|
};
|
|
8307
8307
|
}
|
|
8308
|
-
|
|
8308
|
+
/*
|
|
8309
|
+
* In the body, from the Studio; in the query, from a tab opened before
|
|
8310
|
+
* the ids moved there. One or the other: a request with both is a bug
|
|
8311
|
+
* in whatever sent it, and deleting the union would hide it.
|
|
8312
|
+
*/
|
|
8313
|
+
const fromBody = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body.ids;
|
|
8314
|
+
const fromQuery = query.id;
|
|
8315
|
+
if (fromBody !== undefined && fromQuery !== undefined) {
|
|
8316
|
+
return {
|
|
8317
|
+
status: 400,
|
|
8318
|
+
json: {
|
|
8319
|
+
message: "Send the patch ids either in the body (`ids`) or in the query (`id`), not both"
|
|
8320
|
+
}
|
|
8321
|
+
};
|
|
8322
|
+
}
|
|
8323
|
+
const ids = fromBody ?? fromQuery ?? [];
|
|
8324
|
+
if (ids.length === 0) {
|
|
8325
|
+
return {
|
|
8326
|
+
status: 400,
|
|
8327
|
+
json: {
|
|
8328
|
+
message: "At least one patch id is required"
|
|
8329
|
+
}
|
|
8330
|
+
};
|
|
8331
|
+
}
|
|
8309
8332
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
8310
8333
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8311
8334
|
/*
|
|
@@ -8332,6 +8355,15 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8332
8355
|
status: 500,
|
|
8333
8356
|
json: {
|
|
8334
8357
|
message: "Failed to delete patches",
|
|
8358
|
+
/*
|
|
8359
|
+
* The ones that went, though others did not. Without them the
|
|
8360
|
+
* Studio kept showing -- and saving, and publishing -- changes
|
|
8361
|
+
* that were already gone.
|
|
8362
|
+
*/
|
|
8363
|
+
deleted: deleteRes.deleted,
|
|
8364
|
+
...(deleteRes.headVersion !== undefined ? {
|
|
8365
|
+
headVersion: deleteRes.headVersion
|
|
8366
|
+
} : {}),
|
|
8335
8367
|
errors: Object.entries(deleteRes.errors).map(([id, error]) => ({
|
|
8336
8368
|
patchId: id,
|
|
8337
8369
|
...error,
|
|
@@ -8346,7 +8378,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8346
8378
|
}
|
|
8347
8379
|
};
|
|
8348
8380
|
}
|
|
8349
|
-
if (((_req$
|
|
8381
|
+
if (((_req$body2 = req.body) === null || _req$body2 === void 0 ? void 0 : _req$body2.reportHeadVersion) === true) {
|
|
8350
8382
|
return {
|
|
8351
8383
|
status: 200,
|
|
8352
8384
|
json: {
|
|
@@ -5118,7 +5118,7 @@ var packageJson = {
|
|
|
5118
5118
|
],
|
|
5119
5119
|
exports: true
|
|
5120
5120
|
},
|
|
5121
|
-
version: "0.
|
|
5121
|
+
version: "0.156.1",
|
|
5122
5122
|
scripts: {
|
|
5123
5123
|
typecheck: "tsc --noEmit",
|
|
5124
5124
|
test: "jest",
|
|
@@ -8279,7 +8279,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8279
8279
|
};
|
|
8280
8280
|
},
|
|
8281
8281
|
DELETE: async req => {
|
|
8282
|
-
var _req$body;
|
|
8282
|
+
var _req$body, _req$body2;
|
|
8283
8283
|
const query = req.query;
|
|
8284
8284
|
const cookies = req.cookies;
|
|
8285
8285
|
const auth = getAuth(cookies);
|
|
@@ -8299,7 +8299,30 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8299
8299
|
}
|
|
8300
8300
|
};
|
|
8301
8301
|
}
|
|
8302
|
-
|
|
8302
|
+
/*
|
|
8303
|
+
* In the body, from the Studio; in the query, from a tab opened before
|
|
8304
|
+
* the ids moved there. One or the other: a request with both is a bug
|
|
8305
|
+
* in whatever sent it, and deleting the union would hide it.
|
|
8306
|
+
*/
|
|
8307
|
+
const fromBody = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body.ids;
|
|
8308
|
+
const fromQuery = query.id;
|
|
8309
|
+
if (fromBody !== undefined && fromQuery !== undefined) {
|
|
8310
|
+
return {
|
|
8311
|
+
status: 400,
|
|
8312
|
+
json: {
|
|
8313
|
+
message: "Send the patch ids either in the body (`ids`) or in the query (`id`), not both"
|
|
8314
|
+
}
|
|
8315
|
+
};
|
|
8316
|
+
}
|
|
8317
|
+
const ids = fromBody ?? fromQuery ?? [];
|
|
8318
|
+
if (ids.length === 0) {
|
|
8319
|
+
return {
|
|
8320
|
+
status: 400,
|
|
8321
|
+
json: {
|
|
8322
|
+
message: "At least one patch id is required"
|
|
8323
|
+
}
|
|
8324
|
+
};
|
|
8325
|
+
}
|
|
8303
8326
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
8304
8327
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8305
8328
|
/*
|
|
@@ -8326,6 +8349,15 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8326
8349
|
status: 500,
|
|
8327
8350
|
json: {
|
|
8328
8351
|
message: "Failed to delete patches",
|
|
8352
|
+
/*
|
|
8353
|
+
* The ones that went, though others did not. Without them the
|
|
8354
|
+
* Studio kept showing -- and saving, and publishing -- changes
|
|
8355
|
+
* that were already gone.
|
|
8356
|
+
*/
|
|
8357
|
+
deleted: deleteRes.deleted,
|
|
8358
|
+
...(deleteRes.headVersion !== undefined ? {
|
|
8359
|
+
headVersion: deleteRes.headVersion
|
|
8360
|
+
} : {}),
|
|
8329
8361
|
errors: Object.entries(deleteRes.errors).map(([id, error]) => ({
|
|
8330
8362
|
patchId: id,
|
|
8331
8363
|
...error,
|
|
@@ -8340,7 +8372,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8340
8372
|
}
|
|
8341
8373
|
};
|
|
8342
8374
|
}
|
|
8343
|
-
if (((_req$
|
|
8375
|
+
if (((_req$body2 = req.body) === null || _req$body2 === void 0 ? void 0 : _req$body2.reportHeadVersion) === true) {
|
|
8344
8376
|
return {
|
|
8345
8377
|
status: 200,
|
|
8346
8378
|
json: {
|
|
@@ -5124,7 +5124,7 @@ var packageJson = {
|
|
|
5124
5124
|
],
|
|
5125
5125
|
exports: true
|
|
5126
5126
|
},
|
|
5127
|
-
version: "0.
|
|
5127
|
+
version: "0.156.1",
|
|
5128
5128
|
scripts: {
|
|
5129
5129
|
typecheck: "tsc --noEmit",
|
|
5130
5130
|
test: "jest",
|
|
@@ -8285,7 +8285,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8285
8285
|
};
|
|
8286
8286
|
},
|
|
8287
8287
|
DELETE: async req => {
|
|
8288
|
-
var _req$body;
|
|
8288
|
+
var _req$body, _req$body2;
|
|
8289
8289
|
const query = req.query;
|
|
8290
8290
|
const cookies = req.cookies;
|
|
8291
8291
|
const auth = getAuth(cookies);
|
|
@@ -8305,7 +8305,30 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8305
8305
|
}
|
|
8306
8306
|
};
|
|
8307
8307
|
}
|
|
8308
|
-
|
|
8308
|
+
/*
|
|
8309
|
+
* In the body, from the Studio; in the query, from a tab opened before
|
|
8310
|
+
* the ids moved there. One or the other: a request with both is a bug
|
|
8311
|
+
* in whatever sent it, and deleting the union would hide it.
|
|
8312
|
+
*/
|
|
8313
|
+
const fromBody = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body.ids;
|
|
8314
|
+
const fromQuery = query.id;
|
|
8315
|
+
if (fromBody !== undefined && fromQuery !== undefined) {
|
|
8316
|
+
return {
|
|
8317
|
+
status: 400,
|
|
8318
|
+
json: {
|
|
8319
|
+
message: "Send the patch ids either in the body (`ids`) or in the query (`id`), not both"
|
|
8320
|
+
}
|
|
8321
|
+
};
|
|
8322
|
+
}
|
|
8323
|
+
const ids = fromBody ?? fromQuery ?? [];
|
|
8324
|
+
if (ids.length === 0) {
|
|
8325
|
+
return {
|
|
8326
|
+
status: 400,
|
|
8327
|
+
json: {
|
|
8328
|
+
message: "At least one patch id is required"
|
|
8329
|
+
}
|
|
8330
|
+
};
|
|
8331
|
+
}
|
|
8309
8332
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
8310
8333
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8311
8334
|
/*
|
|
@@ -8332,6 +8355,15 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8332
8355
|
status: 500,
|
|
8333
8356
|
json: {
|
|
8334
8357
|
message: "Failed to delete patches",
|
|
8358
|
+
/*
|
|
8359
|
+
* The ones that went, though others did not. Without them the
|
|
8360
|
+
* Studio kept showing -- and saving, and publishing -- changes
|
|
8361
|
+
* that were already gone.
|
|
8362
|
+
*/
|
|
8363
|
+
deleted: deleteRes.deleted,
|
|
8364
|
+
...(deleteRes.headVersion !== undefined ? {
|
|
8365
|
+
headVersion: deleteRes.headVersion
|
|
8366
|
+
} : {}),
|
|
8335
8367
|
errors: Object.entries(deleteRes.errors).map(([id, error]) => ({
|
|
8336
8368
|
patchId: id,
|
|
8337
8369
|
...error,
|
|
@@ -8346,7 +8378,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8346
8378
|
}
|
|
8347
8379
|
};
|
|
8348
8380
|
}
|
|
8349
|
-
if (((_req$
|
|
8381
|
+
if (((_req$body2 = req.body) === null || _req$body2 === void 0 ? void 0 : _req$body2.reportHeadVersion) === true) {
|
|
8350
8382
|
return {
|
|
8351
8383
|
status: 200,
|
|
8352
8384
|
json: {
|
|
@@ -415,7 +415,7 @@ async function readerSnapshot(proposal, projectSource) {
|
|
|
415
415
|
}
|
|
416
416
|
const {
|
|
417
417
|
proposalSnapshotForReaders
|
|
418
|
-
} = await Promise.resolve().then(function () { return require('./proposalJsonEntries-
|
|
418
|
+
} = await Promise.resolve().then(function () { return require('./proposalJsonEntries-4fcfab08.cjs.prod.js'); });
|
|
419
419
|
return proposalSnapshotForReaders(proposal, projectSource);
|
|
420
420
|
}
|
|
421
421
|
|
|
@@ -415,7 +415,7 @@ async function readerSnapshot(proposal, projectSource) {
|
|
|
415
415
|
}
|
|
416
416
|
const {
|
|
417
417
|
proposalSnapshotForReaders
|
|
418
|
-
} = await Promise.resolve().then(function () { return require('./proposalJsonEntries-
|
|
418
|
+
} = await Promise.resolve().then(function () { return require('./proposalJsonEntries-878ad5b6.cjs.dev.js'); });
|
|
419
419
|
return proposalSnapshotForReaders(proposal, projectSource);
|
|
420
420
|
}
|
|
421
421
|
|
package/dist/{createPrettierFormatter-ce478de1.esm.js → createPrettierFormatter-fb68e363.esm.js}
RENAMED
|
@@ -409,7 +409,7 @@ async function readerSnapshot(proposal, projectSource) {
|
|
|
409
409
|
}
|
|
410
410
|
const {
|
|
411
411
|
proposalSnapshotForReaders
|
|
412
|
-
} = await import('./proposalJsonEntries-
|
|
412
|
+
} = await import('./proposalJsonEntries-e1b07915.esm.js');
|
|
413
413
|
return proposalSnapshotForReaders(proposal, projectSource);
|
|
414
414
|
}
|
|
415
415
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as initHandlerOptions, v as valRuntime } from './valRuntime-
|
|
1
|
+
import { i as initHandlerOptions, v as valRuntime } from './valRuntime-18d4c693.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
3
|
-
import './ValOpsMemory-
|
|
3
|
+
import './ValOpsMemory-a00c3187.esm.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@valbuild/shared/internal';
|
|
6
6
|
import './jsonValuesPatch-13acc674.esm.js';
|
|
@@ -12,11 +12,13 @@ import 'image-size';
|
|
|
12
12
|
import 'path';
|
|
13
13
|
import 'typescript';
|
|
14
14
|
import 'fs';
|
|
15
|
-
import './
|
|
16
|
-
import './createPrettierFormatter-ce478de1.esm.js';
|
|
15
|
+
import './jsonValuesModule-12fc4bb0.esm.js';
|
|
17
16
|
import 'os';
|
|
18
17
|
import 'crypto';
|
|
19
18
|
import 'buffer';
|
|
19
|
+
import './proposalJsonEntries-e1b07915.esm.js';
|
|
20
|
+
import './createPrettierFormatter-fb68e363.esm.js';
|
|
21
|
+
import './merge-eca8ec38.esm.js';
|
|
20
22
|
import 'node:vm';
|
|
21
23
|
import 'node:module';
|
|
22
24
|
|
package/dist/{createValRuntime-a519939b.cjs.prod.js → createValRuntime-5eb0336d.cjs.prod.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var valRuntime = require('./valRuntime-
|
|
3
|
+
var valRuntime = require('./valRuntime-175e2032.cjs.prod.js');
|
|
4
4
|
require('@valbuild/core');
|
|
5
|
-
require('./ValOpsMemory-
|
|
5
|
+
require('./ValOpsMemory-6155aa9b.cjs.prod.js');
|
|
6
6
|
require('zod');
|
|
7
7
|
require('@valbuild/shared/internal');
|
|
8
8
|
require('./jsonValuesPatch-92798812.cjs.prod.js');
|
|
@@ -14,11 +14,13 @@ require('image-size');
|
|
|
14
14
|
require('path');
|
|
15
15
|
require('typescript');
|
|
16
16
|
require('fs');
|
|
17
|
-
require('./
|
|
18
|
-
require('./createPrettierFormatter-b31bfbe5.cjs.prod.js');
|
|
17
|
+
require('./jsonValuesModule-6cf73937.cjs.prod.js');
|
|
19
18
|
require('os');
|
|
20
19
|
require('crypto');
|
|
21
20
|
require('buffer');
|
|
21
|
+
require('./proposalJsonEntries-4fcfab08.cjs.prod.js');
|
|
22
|
+
require('./createPrettierFormatter-8e60f596.cjs.prod.js');
|
|
23
|
+
require('./merge-5a8fc685.cjs.prod.js');
|
|
22
24
|
require('node:vm');
|
|
23
25
|
require('node:module');
|
|
24
26
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var valRuntime = require('./valRuntime-
|
|
3
|
+
var valRuntime = require('./valRuntime-c4b2e906.cjs.dev.js');
|
|
4
4
|
require('@valbuild/core');
|
|
5
|
-
require('./ValOpsMemory-
|
|
5
|
+
require('./ValOpsMemory-c1453e6a.cjs.dev.js');
|
|
6
6
|
require('zod');
|
|
7
7
|
require('@valbuild/shared/internal');
|
|
8
8
|
require('./jsonValuesPatch-88bc661d.cjs.dev.js');
|
|
@@ -14,11 +14,13 @@ require('image-size');
|
|
|
14
14
|
require('path');
|
|
15
15
|
require('typescript');
|
|
16
16
|
require('fs');
|
|
17
|
-
require('./
|
|
18
|
-
require('./createPrettierFormatter-5d830bdf.cjs.dev.js');
|
|
17
|
+
require('./jsonValuesModule-ed68a9de.cjs.dev.js');
|
|
19
18
|
require('os');
|
|
20
19
|
require('crypto');
|
|
21
20
|
require('buffer');
|
|
21
|
+
require('./proposalJsonEntries-878ad5b6.cjs.dev.js');
|
|
22
|
+
require('./createPrettierFormatter-a9109288.cjs.dev.js');
|
|
23
|
+
require('./merge-a21a9c78.cjs.dev.js');
|
|
22
24
|
require('node:vm');
|
|
23
25
|
require('node:module');
|
|
24
26
|
|
|
@@ -35,3 +35,17 @@ export { serverCanStartLazily } from "../serverMode.js";
|
|
|
35
35
|
export { InMemoryPatchStore, type StoredFile, type StoredPatch, type ValPatchStore, } from "../ValPatchStore.js";
|
|
36
36
|
export { createPrettierFormatter, type PrettierLike, type PrettierLoader, type ValFormatter, } from "../createPrettierFormatter.js";
|
|
37
37
|
export { ValHead, headWork, HEAD_BUDGET_BYTES, HEAD_VERSIONS_PER_MODULE, type Draft, type HeadChain, type HeadEntries, type HeadModule, type HeadTree, type ModuleAnswer, } from "../head.js";
|
|
38
|
+
export type { FoldResult, FoldRefusal } from "../proposalMerge/foldContent.js";
|
|
39
|
+
export type { Files as ProjectFiles } from "../proposalMerge/project.js";
|
|
40
|
+
/**
|
|
41
|
+
* Content written back into a project's files, for connecting a project Val
|
|
42
|
+
* Build hosts to a repository (valbuild/home,
|
|
43
|
+
* docs/plans/connect-with-history.md, phase 6a). See
|
|
44
|
+
* `proposalMerge/foldContent.ts`.
|
|
45
|
+
*
|
|
46
|
+
* Loaded when it is called, never with this entry: it brings the TypeScript
|
|
47
|
+
* compiler, and this entry is also what a site's page reads content through,
|
|
48
|
+
* which must evaluate none of it (`servingPath.test.ts` in
|
|
49
|
+
* `@valbuild/tanstack`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function foldContent(...args: Parameters<typeof import("../proposalMerge/foldContent.js").foldContent>): ReturnType<typeof import("../proposalMerge/foldContent.js").foldContent>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ModuleFilePath } from "@valbuild/core";
|
|
2
|
+
import type { JSONValue } from "@valbuild/core/patch";
|
|
3
|
+
import { type Files } from "./project.js";
|
|
4
|
+
/**
|
|
5
|
+
* Content written back into a project's files: each module's content as it is
|
|
6
|
+
* recorded, written into its `.val.ts` (and a `.jsonValues()` record's
|
|
7
|
+
* `.val.json` entries) the way a save writes them.
|
|
8
|
+
*
|
|
9
|
+
* What connecting a project that has history needs (valbuild/home,
|
|
10
|
+
* `docs/plans/connect-with-history.md`, phase 6a). A project Val Build hosts
|
|
11
|
+
* keeps its content as each module's Source, never as file text: its
|
|
12
|
+
* `.val.ts` files still hold what the project was made with. Before its code
|
|
13
|
+
* can go into a repository, the content has to be in the files.
|
|
14
|
+
*
|
|
15
|
+
* The same writer a merge uses (`writeContent`, `writeEntries`): the smallest
|
|
16
|
+
* patch, through the AST operations a save uses, so the code around the
|
|
17
|
+
* content -- imports, comments, formatting, the schema -- is left exactly as
|
|
18
|
+
* it was. Then the project is loaded again, and every module must read back
|
|
19
|
+
* as exactly what was recorded, key order too. A module whose targeted write
|
|
20
|
+
* does not read back is written whole; one that still does not -- content its
|
|
21
|
+
* code computes rather than holds, say -- is refused by name. Nothing is
|
|
22
|
+
* guessed.
|
|
23
|
+
*/
|
|
24
|
+
export type FoldRefusal = {
|
|
25
|
+
/** The module, or `null` when the written project as a whole would not load. */
|
|
26
|
+
module: ModuleFilePath | null;
|
|
27
|
+
/** Why, in a developer's words. */
|
|
28
|
+
reason: string;
|
|
29
|
+
};
|
|
30
|
+
export type FoldResult = {
|
|
31
|
+
status: "folded";
|
|
32
|
+
/** The whole project, with the content written in. */
|
|
33
|
+
files: Files;
|
|
34
|
+
/** The files that changed, by path; a removed `.val.json` entry too. */
|
|
35
|
+
changed: string[];
|
|
36
|
+
} | {
|
|
37
|
+
status: "refused";
|
|
38
|
+
refusals: FoldRefusal[];
|
|
39
|
+
};
|
|
40
|
+
export declare function foldContent(input: {
|
|
41
|
+
/** The project's files: its code, as the live build has it. */
|
|
42
|
+
files: Files;
|
|
43
|
+
/** Each module's content as recorded. A module left out is not touched. */
|
|
44
|
+
content: Record<ModuleFilePath, JSONValue>;
|
|
45
|
+
}): Promise<FoldResult>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type ModuleFilePath, type SerializedSchema, type ValModule } from "@valbuild/core";
|
|
2
|
+
import { type JSONValue } from "@valbuild/core/patch";
|
|
3
|
+
import { loadValModules } from "../loadValModules.js";
|
|
4
|
+
import type { Value } from "./threeWay.js";
|
|
5
|
+
import { type SchemaError } from "./validate.js";
|
|
6
|
+
/**
|
|
7
|
+
* A project as git holds it: every file's text, by path from the project
|
|
8
|
+
* root. A commit in the world is one of these -- `.val.ts` files, the
|
|
9
|
+
* components that render them, `val.modules.ts` -- and nothing else, the same
|
|
10
|
+
* way a commit on content's line is.
|
|
11
|
+
*/
|
|
12
|
+
export type Files = Record<string, string | null>;
|
|
13
|
+
/**
|
|
14
|
+
* A module, as the merge needs it: data, so whoever evaluated the project's
|
|
15
|
+
* schemas can hand it over -- Val's loader here and in `val validate`, the
|
|
16
|
+
* builder tab with rolldown -- and the merge itself never runs project code.
|
|
17
|
+
*/
|
|
18
|
+
export type ProjectModule = {
|
|
19
|
+
/**
|
|
20
|
+
* Its content, as the files hold it -- a `.jsonValues()` record's entries
|
|
21
|
+
* read from their `.val.json` files, so it is merged and validated as one
|
|
22
|
+
* record.
|
|
23
|
+
*/
|
|
24
|
+
source: JSONValue;
|
|
25
|
+
/**
|
|
26
|
+
* The content its file's text holds, when that is not `source`: a build's
|
|
27
|
+
* `.val.ts` keeps the content of when it was built, while `source` is
|
|
28
|
+
* content's index. The merge is written into the text from this. Absent:
|
|
29
|
+
* the text holds `source`.
|
|
30
|
+
*/
|
|
31
|
+
written?: JSONValue;
|
|
32
|
+
schema: SerializedSchema;
|
|
33
|
+
/**
|
|
34
|
+
* For a `.jsonValues()` record: each entry's file, by key, from the project
|
|
35
|
+
* root. `null` for any other module.
|
|
36
|
+
*/
|
|
37
|
+
entries: Record<string, string> | null;
|
|
38
|
+
/**
|
|
39
|
+
* The evaluated schema's own validation, custom rules too. Without it, the
|
|
40
|
+
* serialized schema's rules are used (`validateModule`).
|
|
41
|
+
*/
|
|
42
|
+
validate?: (source: Value) => SchemaError[];
|
|
43
|
+
/**
|
|
44
|
+
* The errors of `source` under this schema, where they were found where the
|
|
45
|
+
* schema was evaluated (the builder tab) and only the result crossed over.
|
|
46
|
+
* What the schema check reads first.
|
|
47
|
+
*/
|
|
48
|
+
errors?: SchemaError[];
|
|
49
|
+
};
|
|
50
|
+
/** A project at one commit: its files, and its modules as data. */
|
|
51
|
+
export type Project = {
|
|
52
|
+
files: Files;
|
|
53
|
+
modules: Record<ModuleFilePath, ProjectModule>;
|
|
54
|
+
};
|
|
55
|
+
/** A loaded project, as the merge takes it. */
|
|
56
|
+
export declare function projectOf(files: Files, loaded: LoadedProject): Project;
|
|
57
|
+
/** A module as the project defines it, read by Val's own loader. */
|
|
58
|
+
export type LoadedModule = {
|
|
59
|
+
module: ValModule<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Its content, as the files hold it -- a `.jsonValues()` record's entries
|
|
62
|
+
* read from their `.val.json` files, so it can be merged and validated as
|
|
63
|
+
* one record.
|
|
64
|
+
*/
|
|
65
|
+
source: JSONValue;
|
|
66
|
+
/**
|
|
67
|
+
* For a `.jsonValues()` record: each entry's file, by key, from the project
|
|
68
|
+
* root. `null` for any other module.
|
|
69
|
+
*/
|
|
70
|
+
entries: Record<string, string> | null;
|
|
71
|
+
};
|
|
72
|
+
export type LoadedProject = {
|
|
73
|
+
valModules: ReturnType<typeof loadValModules>;
|
|
74
|
+
modules: Record<ModuleFilePath, LoadedModule>;
|
|
75
|
+
/** The `.val.ts` files and `.jsonValues()` entries, as `ValOpsMemory` takes them. */
|
|
76
|
+
sourceFiles: Record<string, string>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Loads the project at a commit the way `val validate` does: `val.modules.ts`
|
|
80
|
+
* and every `.val.ts` it imports, transpiled and evaluated
|
|
81
|
+
* (`loadValModules`). So a schema a proposal changed is the schema it changed
|
|
82
|
+
* to, read from the text it wrote.
|
|
83
|
+
*/
|
|
84
|
+
export declare function loadProject(files: Files): Promise<LoadedProject>;
|
|
85
|
+
/**
|
|
86
|
+
* A `.jsonValues()` record's entry files, by key, read out of its `.val.ts`
|
|
87
|
+
* (the loaded marker does not carry the path). `null` when it has none.
|
|
88
|
+
*/
|
|
89
|
+
export declare function entryFilesOf(moduleFilePath: ModuleFilePath, text: string): Record<string, string> | null;
|
|
90
|
+
/** Every project's first two files, as `npm create @valbuild` writes them. */
|
|
91
|
+
export declare function scaffold(moduleFiles: string[]): Files;
|
|
92
|
+
/** `val.modules.ts` naming these modules: what adding a page changes. */
|
|
93
|
+
export declare function valModulesFile(moduleFiles: string[]): string;
|
|
94
|
+
/**
|
|
95
|
+
* A `.val.ts` file: `c.define` with a schema written as code and its content.
|
|
96
|
+
* The text is the file; a proposal that changes the schema writes another
|
|
97
|
+
* one.
|
|
98
|
+
*/
|
|
99
|
+
export declare function valFile(file: string, schema: string, content: unknown): string;
|
|
100
|
+
/** A page of the world: its `.val.ts`, as the site starts with it. */
|
|
101
|
+
export type Page = {
|
|
102
|
+
file: string;
|
|
103
|
+
moduleFilePath: ModuleFilePath;
|
|
104
|
+
text: string;
|
|
105
|
+
/** Files the page's content lives in besides its `.val.ts`: `.jsonValues()` entries. */
|
|
106
|
+
files: Files;
|
|
107
|
+
/** The same file with another schema: what a proposal stages to change it. */
|
|
108
|
+
withSchema(schema: string, content: unknown): string;
|
|
109
|
+
};
|
|
110
|
+
export declare function page(file: string, schema: string, content: unknown): Page;
|
|
111
|
+
/**
|
|
112
|
+
* A `.jsonValues()` record: each entry in a `.val.json` of its own, next to the
|
|
113
|
+
* module in a directory named after it, as the Studio writes new ones.
|
|
114
|
+
*/
|
|
115
|
+
export declare function jsonValuesPage(file: string, itemSchema: string, entries: Record<string, unknown>): Page;
|
|
116
|
+
/**
|
|
117
|
+
* A file's code: for a `.val.ts`, everything but `c.define`'s content
|
|
118
|
+
* argument, which Val reads at request time (step 2) and so is no part of a
|
|
119
|
+
* build; a `.val.json` entry is no code at all. Every other file is code
|
|
120
|
+
* whole.
|
|
121
|
+
*/
|
|
122
|
+
export declare function codeOf(file: string, text: string): string;
|
|
123
|
+
/** A build's name: the hash of the code it is made of (step 3). */
|
|
124
|
+
export declare function buildName(files: Files): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type JSONValue, type Operation } from "@valbuild/core/patch";
|
|
2
|
+
/**
|
|
3
|
+
* The three-way merge of a module's content: where both sides started
|
|
4
|
+
* (`base`), and each side's version. Pure JSON -- the schema decides nothing
|
|
5
|
+
* here, and is checked afterwards (the schema check in `merge.ts`).
|
|
6
|
+
*
|
|
7
|
+
* The rules (valbuild/home `docs/hosted-publishing.md` step 8.2):
|
|
8
|
+
*
|
|
9
|
+
* - Changed on one side: that side's.
|
|
10
|
+
* - Changed on both: a conflict -- even to the same value, which is an easy
|
|
11
|
+
* conflict to resolve but still one somebody decides.
|
|
12
|
+
* - An object (a page, a record) merges key by key, so two keys changed on
|
|
13
|
+
* two sides combine.
|
|
14
|
+
* - A list merges item by item only when neither side changed its shape: no
|
|
15
|
+
* item added, removed or moved. Otherwise positions mean different items on
|
|
16
|
+
* the two sides, and the whole list is the conflict.
|
|
17
|
+
*/
|
|
18
|
+
export type Value = JSONValue | undefined;
|
|
19
|
+
export type ValueConflict = {
|
|
20
|
+
path: string[];
|
|
21
|
+
base: Value;
|
|
22
|
+
site: Value;
|
|
23
|
+
proposal: Value;
|
|
24
|
+
};
|
|
25
|
+
export type Merged = {
|
|
26
|
+
/**
|
|
27
|
+
* Both sides combined. At a conflict it holds the site's value, until a
|
|
28
|
+
* resolution replaces it.
|
|
29
|
+
*/
|
|
30
|
+
value: Value;
|
|
31
|
+
conflicts: ValueConflict[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Did this side add, remove or move an item? Lengths differ, or an item now
|
|
35
|
+
* sits where it was not, while it is still what used to be somewhere else.
|
|
36
|
+
*/
|
|
37
|
+
export declare function reshaped(base: JSONValue[], side: JSONValue[]): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Where a value is one value, though it is an object: a media value (its path
|
|
40
|
+
* and what describes that file) or rich text. The schema says; see `merge.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export type IsAtomic = (path: string[]) => boolean;
|
|
43
|
+
export declare function mergeValues(base: Value, site: Value, proposal: Value, atomic?: IsAtomic, path?: string[]): Merged;
|
|
44
|
+
/** `doc` with `value` at `path`; `undefined` removes it. `doc` is not changed. */
|
|
45
|
+
export declare function setAt(doc: Value, path: string[], value: Value): Value;
|
|
46
|
+
export declare function valueAt(doc: Value, path: string[]): Value;
|
|
47
|
+
/**
|
|
48
|
+
* The Val patch that turns `from` into `to`, as small as it can be: what
|
|
49
|
+
* writes a merge into a `.val.ts` without rewriting what did not change.
|
|
50
|
+
*/
|
|
51
|
+
export declare function diffOps(from: Value, to: Value, path?: string[]): Operation[];
|