@valbuild/server 0.152.1 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -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/{ValRouter-b4125d35.esm.js → ValRouter-0393906a.esm.js} +86 -12
- package/dist/{ValRouter-541c76f5.cjs.dev.js → ValRouter-c289e074.cjs.prod.js} +86 -11
- package/dist/{ValRouter-e1e0101b.cjs.prod.js → ValRouter-cf781930.cjs.dev.js} +86 -11
- package/dist/{ValRouterCore-bd3e9b6c.cjs.dev.js → ValRouterCore-0aff3db3.cjs.dev.js} +305 -251
- package/dist/{ValRouterCore-0c0359fe.cjs.prod.js → ValRouterCore-356d7093.cjs.prod.js} +305 -251
- package/dist/{ValRouterCore-eea19e82.esm.js → ValRouterCore-5cf45273.esm.js} +305 -251
- package/dist/declarations/src/ValOps.d.ts +42 -4
- package/dist/declarations/src/ValOpsFS.d.ts +6 -3
- package/dist/declarations/src/ValOpsHttp.d.ts +5 -2
- package/dist/declarations/src/ValOpsMemory.d.ts +3 -2
- package/dist/declarations/src/ValRouter.d.ts +10 -0
- package/dist/declarations/src/ValServer.d.ts +2 -0
- package/dist/declarations/src/internal/index.d.ts +1 -1
- package/dist/declarations/src/proposal.d.ts +19 -3
- package/dist/{inTabFetch-de7cf596.esm.js → inTabFetch-3c5fa83d.esm.js} +1 -1
- package/dist/{inTabFetch-6d54acd8.cjs.dev.js → inTabFetch-40a26012.cjs.dev.js} +1 -1
- package/dist/{inTabFetch-5caf8250.cjs.prod.js → inTabFetch-731f199d.cjs.prod.js} +1 -1
- package/dist/{publishKit-c13ba76f.esm.js → publishKit-3f9af1dd.esm.js} +3 -3
- package/dist/{publishKit-42f08a69.cjs.dev.js → publishKit-90ea0493.cjs.dev.js} +2 -2
- package/dist/{publishKit-9600ecef.cjs.prod.js → publishKit-c17c1152.cjs.prod.js} +2 -2
- package/dist/valbuild-server.cjs.dev.js +2 -2
- package/dist/valbuild-server.cjs.prod.js +2 -2
- package/dist/valbuild-server.esm.js +4 -4
- 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 +3 -2
- package/internal/dist/valbuild-server-internal.cjs.prod.js +3 -2
- package/internal/dist/valbuild-server-internal.esm.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.153.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Editing content in a proposal whose code changed, before the proposal is built again:
|
|
8
|
+
|
|
9
|
+
- **A module the proposal adds** can be edited and saved right away. Its content is read from the new file and saved. Before, those edits were dropped. If the module's content is made by code (not written out in the file), the save waits and says to build the proposal first.
|
|
10
|
+
- **A module whose schema moved because a file it imports changed** (for example a shared `src/schemas/*.ts`) is no longer read with the old schema. Pages keep showing the content as built until the proposal is built again.
|
|
11
|
+
- **Edits that no longer fit the schema** can be handed to the assistant. The banner that lists them has a **Have the assistant move it** button for each one. You still discard the held edit yourself afterwards.
|
|
12
|
+
|
|
13
|
+
For this, `@valbuild/tanstack-build` records which files each Val module imports, and the `val.server.ts` it generates passes that to Val as the new optional `moduleDependencies` option of `initValServer` and `initValContent`. You do not need to set it yourself. A site built before this has no `moduleDependencies` and works as before.
|
|
14
|
+
|
|
15
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Removed what 0.151.0 kept only so that a Studio, a page and a server from the release before could still talk to each other during a deploy:
|
|
16
|
+
|
|
17
|
+
- **`PUT /api/val/sources/~`** is gone. Nothing in 0.151.0 asked it: the Studio reads modules through `GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and `fetchVal`, `useVal` and the MCP tools read the server's content in-process. If a script or test of yours read content through it, read one module with `GET /api/val/modules/~<path>` instead. Its answer has the module's `source` and `version`, and an `entries` map holding the `.jsonValues()` entries pending changes touched.
|
|
18
|
+
- **`ValDraft.base`** is gone from the type. It has not been sent or read since 0.151.0, so a `draft` you pass to `ValProvider` is not affected.
|
|
19
|
+
- **A page no longer accepts edits relayed by a Studio from before 0.151.0.** Such a Studio sent each module as a bare `source`. After the upgrade, the Studio and your pages come from the same deploy, so this only matters while an older Studio is still open in a tab during a rollout. Reloading that tab fixes it.
|
|
20
|
+
- **`/api/val/stat`** no longer needs `sourcesSha` and `schemaSha`. The Studio now tells your local server which version it last saw, and the server still sends both fields for a Studio of 0.151.0. They stop being sent in the next release.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#1028](https://github.com/valbuild/val/pull/1028) [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21) Thanks [@freekh](https://github.com/freekh)! - Another editor's keystroke costs the Studio less. Locally (`pnpm dev`, and
|
|
25
|
+
anywhere `/stat` long-polls), the Studio no longer asks for the manifest or
|
|
26
|
+
the changed module after someone else types: `/stat` now carries what
|
|
27
|
+
`GET /manifest` would have answered, and the module's new version is computed
|
|
28
|
+
from the patch the Studio already fetched. Where neither can be used (an
|
|
29
|
+
older server, a version that does not match), the Studio asks for them as
|
|
30
|
+
before.
|
|
31
|
+
|
|
32
|
+
- [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - `/api/val/enable`, `/api/val/disable` and Val's other routes that take `redirect_to` now accept a path on your site, such as `?redirect_to=/blog`, and redirect to it on the same origin. In a Next.js app a path used to answer 500. A value that is neither a path starting with `/` nor an absolute URL is refused with a 400 that says what is accepted.
|
|
33
|
+
- Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`56ab7d5`](https://github.com/valbuild/val/commit/56ab7d5818772a9e310a561ebdb798b27ee704c9)]:
|
|
34
|
+
- @valbuild/ui@0.153.0
|
|
35
|
+
- @valbuild/core@0.153.0
|
|
36
|
+
- @valbuild/shared@0.153.0
|
|
37
|
+
|
|
38
|
+
## 0.152.2
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`077ab3e`](https://github.com/valbuild/val/commit/077ab3eeccc2ab75b1b6fd4a5cf14b71c9ee8344)]:
|
|
43
|
+
- @valbuild/ui@0.152.2
|
|
44
|
+
|
|
3
45
|
## 0.152.1
|
|
4
46
|
|
|
5
47
|
### 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-40a26012.cjs.dev.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValRouterCore-
|
|
7
|
+
require('../../dist/ValRouterCore-0aff3db3.cjs.dev.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('zod-validation-error');
|
|
@@ -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-731f199d.cjs.prod.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValRouterCore-
|
|
7
|
+
require('../../dist/ValRouterCore-356d7093.cjs.prod.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('zod-validation-error');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createInTabValFetch } from '../../dist/inTabFetch-
|
|
1
|
+
export { c as createInTabValFetch } from '../../dist/inTabFetch-3c5fa83d.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
3
|
-
import '../../dist/ValRouterCore-
|
|
3
|
+
import '../../dist/ValRouterCore-5cf45273.esm.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@valbuild/shared/internal';
|
|
6
6
|
import 'zod-validation-error';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Internal, deserializeSchema, DEFAULT_CONTENT_HOST, DEFAULT_VAL_REMOTE_HOST } from '@valbuild/core';
|
|
2
2
|
import { createUIRequestHandler } from '@valbuild/ui/server';
|
|
3
|
-
import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as bufferFromDataUrl, o as getFieldsForType, u as uploadRemoteFile, d as getFileExt, p as guessMimeTypeFromPath, q as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, t as sessionAuth, w as isHttpOps, x as isHlsMasterPlaylist, y as sumHlsSegmentDurations, z as parseHlsMasterVariants, A as largestHlsVariant, B as fallbackRefOf, C as mapHlsUris, E as movedRemoteHost, F as needsHostCheck, G as rewriteRefHost, H as fallbackRemoteHost, J as checkRemoteFiles, K as ValServer, L as createValRequestHandler } from './ValRouterCore-
|
|
3
|
+
import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as bufferFromDataUrl, o as getFieldsForType, u as uploadRemoteFile, d as getFileExt, p as guessMimeTypeFromPath, q as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, t as sessionAuth, w as isHttpOps, x as isHlsMasterPlaylist, y as sumHlsSegmentDurations, z as parseHlsMasterVariants, A as largestHlsVariant, B as fallbackRefOf, C as mapHlsUris, E as movedRemoteHost, F as needsHostCheck, G as rewriteRefHost, H as fallbackRemoteHost, J as checkRemoteFiles, K as ValServer, L as createValRequestHandler } from './ValRouterCore-5cf45273.esm.js';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import ts from 'typescript';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -2171,7 +2171,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
|
|
|
2171
2171
|
* as a bundler does.
|
|
2172
2172
|
*/
|
|
2173
2173
|
function loadTypeScriptKit() {
|
|
2174
|
-
return import('./publishKit-
|
|
2174
|
+
return import('./publishKit-3f9af1dd.esm.js');
|
|
2175
2175
|
}
|
|
2176
2176
|
|
|
2177
2177
|
/** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
|
|
@@ -2390,9 +2390,12 @@ class ValOpsFS extends ValOps {
|
|
|
2390
2390
|
const didChange = !params ||
|
|
2391
2391
|
// An entry file changed on disk: nothing else here can see that, since a
|
|
2392
2392
|
// jsonValues module's source is markers.
|
|
2393
|
-
params.jsonEntriesSha !== undefined && currentJsonEntriesSha !== params.jsonEntriesSha || currentBaseSha !== params.baseSha ||
|
|
2394
|
-
//
|
|
2395
|
-
|
|
2393
|
+
params.jsonEntriesSha !== undefined && currentJsonEntriesSha !== params.jsonEntriesSha || currentBaseSha !== params.baseSha || (
|
|
2394
|
+
// Another build: by the version the Studio echoes -- the build the
|
|
2395
|
+
// chain is relative to (`chainBuild`), which every instance on this
|
|
2396
|
+
// store answers with -- or, from a Studio that echoes no version
|
|
2397
|
+
// (the release that shipped the one content model), by the shas.
|
|
2398
|
+
params.version !== undefined ? params.version.build !== (await this.chainBuild()) : currentSourcesSha !== params.sourcesSha || currentSchemaSha !== params.schemaSha) || patches.length !== params.patches.length || patches.some((p, i) => p !== params.patches[i]);
|
|
2396
2399
|
if (didChange) {
|
|
2397
2400
|
return {
|
|
2398
2401
|
type: "did-change",
|
|
@@ -3573,16 +3576,76 @@ class FSOpsHost {
|
|
|
3573
3576
|
* sound: a module's schema can move with a file it imports, so "its own file
|
|
3574
3577
|
* is unchanged" never says its code is in the build.
|
|
3575
3578
|
*/
|
|
3576
|
-
function stagedAfterBuild(proposal) {
|
|
3579
|
+
function stagedAfterBuild(proposal, build) {
|
|
3577
3580
|
const inBuild = proposal.buildInputs === null || proposal.buildInputs === undefined ? null : `${STAGED_SCHEMA_PREFIX}${proposal.buildInputs}`;
|
|
3578
3581
|
const after = {};
|
|
3579
3582
|
for (const [path, version] of Object.entries(proposal.staged ?? {})) {
|
|
3580
3583
|
if (version === inBuild) continue;
|
|
3581
3584
|
after[path] = version;
|
|
3582
3585
|
}
|
|
3586
|
+
if (build === undefined || proposal.files === undefined) return after;
|
|
3587
|
+
/*
|
|
3588
|
+
* Through what a module imports. The overlay names only staged MODULE
|
|
3589
|
+
* files, and a module's schema moves with any file it imports, so a module
|
|
3590
|
+
* whose own file is not staged can still be of code the build was not made
|
|
3591
|
+
* of. What changed since the build is read from text: a file the proposal
|
|
3592
|
+
* holds that is code (not a module file, not an entry's `*.val.json` --
|
|
3593
|
+
* saves write those, stagings write code) and whose text is not what the
|
|
3594
|
+
* build was made of; and every module file staged after the build. A
|
|
3595
|
+
* module that depends on one of those, as the build resolved its imports,
|
|
3596
|
+
* is staged after the build as well.
|
|
3597
|
+
*/
|
|
3598
|
+
const changed = new Set(Object.keys(after).map(path => path.replace(/^\/+/, "")));
|
|
3599
|
+
const changedCode = [];
|
|
3600
|
+
for (const [path, text] of Object.entries(proposal.files)) {
|
|
3601
|
+
if (isModuleOrEntryFile(path)) continue;
|
|
3602
|
+
if (build.source[path] === text) continue;
|
|
3603
|
+
changed.add(path);
|
|
3604
|
+
changedCode.push([path, text]);
|
|
3605
|
+
}
|
|
3606
|
+
if (changed.size === 0) return after;
|
|
3607
|
+
/*
|
|
3608
|
+
* Named after the staging where the overlay names it (every staged
|
|
3609
|
+
* module's version is the same `staged:<inputs>`); where it names none --
|
|
3610
|
+
* only code that is not a module was staged -- after the code that
|
|
3611
|
+
* changed, which is as distinct per staging and is never a build's.
|
|
3612
|
+
*/
|
|
3613
|
+
const named = Object.values(proposal.staged ?? {})[0] ?? `${STAGED_SCHEMA_PREFIX}${hashOfFiles(changedCode)}`;
|
|
3614
|
+
for (const [modulePath, dependencies] of Object.entries(build.moduleDependencies)) {
|
|
3615
|
+
const moduleFilePath = `/${modulePath.replace(/^\/+/, "")}`;
|
|
3616
|
+
if (after[moduleFilePath] !== undefined) continue;
|
|
3617
|
+
if (dependencies.some(dependency => changed.has(dependency))) {
|
|
3618
|
+
after[moduleFilePath] = named;
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3583
3621
|
return after;
|
|
3584
3622
|
}
|
|
3585
3623
|
|
|
3624
|
+
/**
|
|
3625
|
+
* What the build serving the address was made of, as the platform builds it
|
|
3626
|
+
* and embeds it: its own source (`platform:project-source`) and, for each
|
|
3627
|
+
* module file, every project file it depends on as the build resolved its
|
|
3628
|
+
* imports (`moduleDependencies`, by path with no leading slash, transitive).
|
|
3629
|
+
* For {@link stagedAfterBuild}.
|
|
3630
|
+
*/
|
|
3631
|
+
|
|
3632
|
+
/** The {@link ServingBuild} a host handed over, or `undefined` when not both. */
|
|
3633
|
+
function servingBuildOf(http) {
|
|
3634
|
+
return http.projectSource !== undefined && http.moduleDependencies !== undefined ? {
|
|
3635
|
+
source: http.projectSource,
|
|
3636
|
+
moduleDependencies: http.moduleDependencies
|
|
3637
|
+
} : undefined;
|
|
3638
|
+
}
|
|
3639
|
+
function isModuleOrEntryFile(path) {
|
|
3640
|
+
return /\.val\.(ts|js|json)$/.test(path);
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
/** A 64-hex name for code that changed: its paths and text, in order. */
|
|
3644
|
+
function hashOfFiles(files) {
|
|
3645
|
+
const sorted = [...files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
3646
|
+
return Internal.getSHA256Hash(new TextEncoder().encode(JSON.stringify(sorted)));
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3586
3649
|
/**
|
|
3587
3650
|
* The proposal a platform describes in its runtime env, or `undefined` when
|
|
3588
3651
|
* this is not a proposal's address.
|
|
@@ -3856,8 +3919,8 @@ function layeredSnapshot(proposal, contentVersion) {
|
|
|
3856
3919
|
* -- until a build of the staging serves the address. The same rule as
|
|
3857
3920
|
* `layered`'s, for the one source that carries no version.
|
|
3858
3921
|
*/
|
|
3859
|
-
function proposalAsBuilt(proposal) {
|
|
3860
|
-
const after = stagedAfterBuild(proposal);
|
|
3922
|
+
function proposalAsBuilt(proposal, build) {
|
|
3923
|
+
const after = stagedAfterBuild(proposal, build);
|
|
3861
3924
|
if (Object.keys(after).length === 0) return proposal;
|
|
3862
3925
|
const modules = {};
|
|
3863
3926
|
for (const [path, source] of Object.entries(proposal.modules)) {
|
|
@@ -4892,7 +4955,7 @@ async function stagedModuleSources(files) {
|
|
|
4892
4955
|
parseValFile,
|
|
4893
4956
|
analyzeValModule,
|
|
4894
4957
|
evaluateModuleSource
|
|
4895
|
-
} = await import('./publishKit-
|
|
4958
|
+
} = await import('./publishKit-3f9af1dd.esm.js');
|
|
4896
4959
|
const sources = {};
|
|
4897
4960
|
for (const {
|
|
4898
4961
|
path,
|
|
@@ -5729,7 +5792,7 @@ class ValOpsHttp extends ValOps {
|
|
|
5729
5792
|
* their staged text, versioned as their staging. See `stagedAfterBuild`.
|
|
5730
5793
|
*/
|
|
5731
5794
|
const proposal = options === null || options === void 0 ? void 0 : options.proposal;
|
|
5732
|
-
const staged = proposal !== undefined ? stagedAfterBuild(proposal) : {};
|
|
5795
|
+
const staged = proposal !== undefined ? stagedAfterBuild(proposal, servingBuildOf(options ?? {})) : {};
|
|
5733
5796
|
const stagedPaths = Object.keys(staged);
|
|
5734
5797
|
super(valModules, options && snapshot ? {
|
|
5735
5798
|
...options,
|
|
@@ -5740,8 +5803,12 @@ class ValOpsHttp extends ValOps {
|
|
|
5740
5803
|
stagedAfterBuild: {
|
|
5741
5804
|
versions: staged,
|
|
5742
5805
|
readSources: () => stagedModuleSources(Object.fromEntries(stagedPaths.map(path => {
|
|
5806
|
+
var _options$projectSourc;
|
|
5743
5807
|
const file = path.replace(/^\/+/, "");
|
|
5744
|
-
|
|
5808
|
+
// A module staged after the build through a file
|
|
5809
|
+
// it imports has its own text unstaged: the
|
|
5810
|
+
// build's, unless a save rewrote it.
|
|
5811
|
+
return [file, proposal.files[file] ?? ((_options$projectSourc = options.projectSource) === null || _options$projectSourc === void 0 ? void 0 : _options$projectSourc[file]) ?? null];
|
|
5745
5812
|
})))
|
|
5746
5813
|
}
|
|
5747
5814
|
} : {}),
|
|
@@ -8838,6 +8905,9 @@ async function initHandlerOptions(route, opts, config) {
|
|
|
8838
8905
|
...(opts.projectSource !== undefined ? {
|
|
8839
8906
|
projectSource: opts.projectSource
|
|
8840
8907
|
} : {}),
|
|
8908
|
+
...(opts.moduleDependencies !== undefined ? {
|
|
8909
|
+
moduleDependencies: opts.moduleDependencies
|
|
8910
|
+
} : {}),
|
|
8841
8911
|
...(opts.publishJob !== undefined ? {
|
|
8842
8912
|
publishJob: opts.publishJob
|
|
8843
8913
|
} : {}),
|
|
@@ -8921,6 +8991,9 @@ function createValOps(valModules, options) {
|
|
|
8921
8991
|
...(options.projectSource !== undefined ? {
|
|
8922
8992
|
projectSource: options.projectSource
|
|
8923
8993
|
} : {}),
|
|
8994
|
+
...(options.moduleDependencies !== undefined ? {
|
|
8995
|
+
moduleDependencies: options.moduleDependencies
|
|
8996
|
+
} : {}),
|
|
8924
8997
|
...(options.publishJob !== undefined ? {
|
|
8925
8998
|
publishJob: options.publishJob
|
|
8926
8999
|
} : {}),
|
|
@@ -9428,6 +9501,7 @@ function differences(a, b) {
|
|
|
9428
9501
|
check("git", sameValue(a.git, b.git));
|
|
9429
9502
|
check("root", a.root === b.root);
|
|
9430
9503
|
check("projectSource", sameValue(a.projectSource, b.projectSource));
|
|
9504
|
+
check("moduleDependencies", sameValue(a.moduleDependencies, b.moduleDependencies));
|
|
9431
9505
|
check("publishJob", a.publishJob === b.publishJob);
|
|
9432
9506
|
check("publishBuild", a.publishBuild === b.publishBuild);
|
|
9433
9507
|
check("proposal", sameValue(a.proposal, b.proposal));
|
|
@@ -14340,4 +14414,4 @@ function createValApiRouter(route, valServerPromise, convert) {
|
|
|
14340
14414
|
return createValRequestHandler(route, valServerPromise, convert, uiRequestHandler);
|
|
14341
14415
|
}
|
|
14342
14416
|
|
|
14343
|
-
export { verifyJwt as $, proposalSnapshot as A, proposalSnapshotForReaders as B, initHandlerOptions as C, createValOps as D, resolveRemoteFileAuth as E, APP_MODE_REQUIRES_REMOTE_FILES as F, formatSyntaxErrorTree as G, createFixPatch as H, videosetEntryVideoSchema as I, filesOfVideosetEntry as J, parsePersonalAccessTokenFile as K, extractImageMetadata as L, extractFileMetadata as M, extractVideoMetadata as N, extractVideoMetadataFromFile as O, filesOfVideo as P, getValidationErrorFileRef as Q, checkRemoteRef as R, downloadFileFromRemote as S, TSOps as T, getCachedRemoteFileDir as U, ValOpsFS as V, getCachedRemoteFilePath as W, ValOpsHttp as X, loadTypeScriptKit as Y, readPatchStore as Z, describePatchStoreProblems as _, analyzeValModule as a, decodeJwtWithoutVerifying as a0, getExpire as a1, encodeJwt as a2, createValRuntime as a3, proposalAsBuilt as a4,
|
|
14417
|
+
export { verifyJwt as $, proposalSnapshot as A, proposalSnapshotForReaders as B, initHandlerOptions as C, createValOps as D, resolveRemoteFileAuth as E, APP_MODE_REQUIRES_REMOTE_FILES as F, formatSyntaxErrorTree as G, createFixPatch as H, videosetEntryVideoSchema as I, filesOfVideosetEntry as J, parsePersonalAccessTokenFile as K, extractImageMetadata as L, extractFileMetadata as M, extractVideoMetadata as N, extractVideoMetadataFromFile as O, filesOfVideo as P, getValidationErrorFileRef as Q, checkRemoteRef as R, downloadFileFromRemote as S, TSOps as T, getCachedRemoteFileDir as U, ValOpsFS as V, getCachedRemoteFilePath as W, ValOpsHttp as X, loadTypeScriptKit as Y, readPatchStore as Z, describePatchStoreProblems as _, analyzeValModule as a, decodeJwtWithoutVerifying as a0, getExpire as a1, encodeJwt as a2, createValRuntime as a3, proposalAsBuilt as a4, servingBuildOf as a5, stagedAfterBuild as a6, valRuntime as a7, evaluateModuleSource as a8, jsonValuesRecordKeys as a9, formatSyntaxError as b, analyzeJsonValuesEntries as c, collectionReferencePatches as d, checkGalleryFiles as e, flatMapErrors as f, handleVideoDownloadRemote as g, handleVideoUploadRemote as h, insertValJsonEntry as i, handleVideosetMetadata as j, handleVideosetUploadRemote as k, handleVideosetCheckRemote as l, handleVideosetCheckAllFiles as m, canReadVideoMetadata as n, localFilesWarning as o, openRemoteUploadSession as p, uploadBytesToRemote as q, removeValJsonEntry as r, getPersonalAccessTokenPath as s, createValApiRouter as t, unreadableVideoMetadataMessage as u, createValServer as v, safeReadGit as w, contentFromEnv as x, proposalFromEnv as y, layeredSnapshot as z };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@valbuild/core');
|
|
4
4
|
var server = require('@valbuild/ui/server');
|
|
5
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
5
|
+
var ValRouterCore = require('./ValRouterCore-356d7093.cjs.prod.js');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var ts = require('typescript');
|
|
8
8
|
var z = require('zod');
|
|
@@ -2205,7 +2205,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
|
|
|
2205
2205
|
* as a bundler does.
|
|
2206
2206
|
*/
|
|
2207
2207
|
function loadTypeScriptKit() {
|
|
2208
|
-
return Promise.resolve().then(function () { return require('./publishKit-
|
|
2208
|
+
return Promise.resolve().then(function () { return require('./publishKit-c17c1152.cjs.prod.js'); });
|
|
2209
2209
|
}
|
|
2210
2210
|
|
|
2211
2211
|
/** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
|
|
@@ -2424,9 +2424,12 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2424
2424
|
const didChange = !params ||
|
|
2425
2425
|
// An entry file changed on disk: nothing else here can see that, since a
|
|
2426
2426
|
// jsonValues module's source is markers.
|
|
2427
|
-
params.jsonEntriesSha !== undefined && currentJsonEntriesSha !== params.jsonEntriesSha || currentBaseSha !== params.baseSha ||
|
|
2428
|
-
//
|
|
2429
|
-
|
|
2427
|
+
params.jsonEntriesSha !== undefined && currentJsonEntriesSha !== params.jsonEntriesSha || currentBaseSha !== params.baseSha || (
|
|
2428
|
+
// Another build: by the version the Studio echoes -- the build the
|
|
2429
|
+
// chain is relative to (`chainBuild`), which every instance on this
|
|
2430
|
+
// store answers with -- or, from a Studio that echoes no version
|
|
2431
|
+
// (the release that shipped the one content model), by the shas.
|
|
2432
|
+
params.version !== undefined ? params.version.build !== (await this.chainBuild()) : currentSourcesSha !== params.sourcesSha || currentSchemaSha !== params.schemaSha) || patches.length !== params.patches.length || patches.some((p, i) => p !== params.patches[i]);
|
|
2430
2433
|
if (didChange) {
|
|
2431
2434
|
return {
|
|
2432
2435
|
type: "did-change",
|
|
@@ -3607,16 +3610,76 @@ class FSOpsHost {
|
|
|
3607
3610
|
* sound: a module's schema can move with a file it imports, so "its own file
|
|
3608
3611
|
* is unchanged" never says its code is in the build.
|
|
3609
3612
|
*/
|
|
3610
|
-
function stagedAfterBuild(proposal) {
|
|
3613
|
+
function stagedAfterBuild(proposal, build) {
|
|
3611
3614
|
const inBuild = proposal.buildInputs === null || proposal.buildInputs === undefined ? null : `${internal.STAGED_SCHEMA_PREFIX}${proposal.buildInputs}`;
|
|
3612
3615
|
const after = {};
|
|
3613
3616
|
for (const [path, version] of Object.entries(proposal.staged ?? {})) {
|
|
3614
3617
|
if (version === inBuild) continue;
|
|
3615
3618
|
after[path] = version;
|
|
3616
3619
|
}
|
|
3620
|
+
if (build === undefined || proposal.files === undefined) return after;
|
|
3621
|
+
/*
|
|
3622
|
+
* Through what a module imports. The overlay names only staged MODULE
|
|
3623
|
+
* files, and a module's schema moves with any file it imports, so a module
|
|
3624
|
+
* whose own file is not staged can still be of code the build was not made
|
|
3625
|
+
* of. What changed since the build is read from text: a file the proposal
|
|
3626
|
+
* holds that is code (not a module file, not an entry's `*.val.json` --
|
|
3627
|
+
* saves write those, stagings write code) and whose text is not what the
|
|
3628
|
+
* build was made of; and every module file staged after the build. A
|
|
3629
|
+
* module that depends on one of those, as the build resolved its imports,
|
|
3630
|
+
* is staged after the build as well.
|
|
3631
|
+
*/
|
|
3632
|
+
const changed = new Set(Object.keys(after).map(path => path.replace(/^\/+/, "")));
|
|
3633
|
+
const changedCode = [];
|
|
3634
|
+
for (const [path, text] of Object.entries(proposal.files)) {
|
|
3635
|
+
if (isModuleOrEntryFile(path)) continue;
|
|
3636
|
+
if (build.source[path] === text) continue;
|
|
3637
|
+
changed.add(path);
|
|
3638
|
+
changedCode.push([path, text]);
|
|
3639
|
+
}
|
|
3640
|
+
if (changed.size === 0) return after;
|
|
3641
|
+
/*
|
|
3642
|
+
* Named after the staging where the overlay names it (every staged
|
|
3643
|
+
* module's version is the same `staged:<inputs>`); where it names none --
|
|
3644
|
+
* only code that is not a module was staged -- after the code that
|
|
3645
|
+
* changed, which is as distinct per staging and is never a build's.
|
|
3646
|
+
*/
|
|
3647
|
+
const named = Object.values(proposal.staged ?? {})[0] ?? `${internal.STAGED_SCHEMA_PREFIX}${hashOfFiles(changedCode)}`;
|
|
3648
|
+
for (const [modulePath, dependencies] of Object.entries(build.moduleDependencies)) {
|
|
3649
|
+
const moduleFilePath = `/${modulePath.replace(/^\/+/, "")}`;
|
|
3650
|
+
if (after[moduleFilePath] !== undefined) continue;
|
|
3651
|
+
if (dependencies.some(dependency => changed.has(dependency))) {
|
|
3652
|
+
after[moduleFilePath] = named;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3617
3655
|
return after;
|
|
3618
3656
|
}
|
|
3619
3657
|
|
|
3658
|
+
/**
|
|
3659
|
+
* What the build serving the address was made of, as the platform builds it
|
|
3660
|
+
* and embeds it: its own source (`platform:project-source`) and, for each
|
|
3661
|
+
* module file, every project file it depends on as the build resolved its
|
|
3662
|
+
* imports (`moduleDependencies`, by path with no leading slash, transitive).
|
|
3663
|
+
* For {@link stagedAfterBuild}.
|
|
3664
|
+
*/
|
|
3665
|
+
|
|
3666
|
+
/** The {@link ServingBuild} a host handed over, or `undefined` when not both. */
|
|
3667
|
+
function servingBuildOf(http) {
|
|
3668
|
+
return http.projectSource !== undefined && http.moduleDependencies !== undefined ? {
|
|
3669
|
+
source: http.projectSource,
|
|
3670
|
+
moduleDependencies: http.moduleDependencies
|
|
3671
|
+
} : undefined;
|
|
3672
|
+
}
|
|
3673
|
+
function isModuleOrEntryFile(path) {
|
|
3674
|
+
return /\.val\.(ts|js|json)$/.test(path);
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
/** A 64-hex name for code that changed: its paths and text, in order. */
|
|
3678
|
+
function hashOfFiles(files) {
|
|
3679
|
+
const sorted = [...files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
3680
|
+
return core.Internal.getSHA256Hash(new TextEncoder().encode(JSON.stringify(sorted)));
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3620
3683
|
/**
|
|
3621
3684
|
* The proposal a platform describes in its runtime env, or `undefined` when
|
|
3622
3685
|
* this is not a proposal's address.
|
|
@@ -3890,8 +3953,8 @@ function layeredSnapshot(proposal, contentVersion) {
|
|
|
3890
3953
|
* -- until a build of the staging serves the address. The same rule as
|
|
3891
3954
|
* `layered`'s, for the one source that carries no version.
|
|
3892
3955
|
*/
|
|
3893
|
-
function proposalAsBuilt(proposal) {
|
|
3894
|
-
const after = stagedAfterBuild(proposal);
|
|
3956
|
+
function proposalAsBuilt(proposal, build) {
|
|
3957
|
+
const after = stagedAfterBuild(proposal, build);
|
|
3895
3958
|
if (Object.keys(after).length === 0) return proposal;
|
|
3896
3959
|
const modules = {};
|
|
3897
3960
|
for (const [path, source] of Object.entries(proposal.modules)) {
|
|
@@ -4926,7 +4989,7 @@ async function stagedModuleSources(files) {
|
|
|
4926
4989
|
parseValFile,
|
|
4927
4990
|
analyzeValModule,
|
|
4928
4991
|
evaluateModuleSource
|
|
4929
|
-
} = await Promise.resolve().then(function () { return require('./publishKit-
|
|
4992
|
+
} = await Promise.resolve().then(function () { return require('./publishKit-c17c1152.cjs.prod.js'); });
|
|
4930
4993
|
const sources = {};
|
|
4931
4994
|
for (const {
|
|
4932
4995
|
path,
|
|
@@ -5763,7 +5826,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
5763
5826
|
* their staged text, versioned as their staging. See `stagedAfterBuild`.
|
|
5764
5827
|
*/
|
|
5765
5828
|
const proposal = options === null || options === void 0 ? void 0 : options.proposal;
|
|
5766
|
-
const staged = proposal !== undefined ? stagedAfterBuild(proposal) : {};
|
|
5829
|
+
const staged = proposal !== undefined ? stagedAfterBuild(proposal, servingBuildOf(options ?? {})) : {};
|
|
5767
5830
|
const stagedPaths = Object.keys(staged);
|
|
5768
5831
|
super(valModules, options && snapshot ? {
|
|
5769
5832
|
...options,
|
|
@@ -5774,8 +5837,12 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
5774
5837
|
stagedAfterBuild: {
|
|
5775
5838
|
versions: staged,
|
|
5776
5839
|
readSources: () => stagedModuleSources(Object.fromEntries(stagedPaths.map(path => {
|
|
5840
|
+
var _options$projectSourc;
|
|
5777
5841
|
const file = path.replace(/^\/+/, "");
|
|
5778
|
-
|
|
5842
|
+
// A module staged after the build through a file
|
|
5843
|
+
// it imports has its own text unstaged: the
|
|
5844
|
+
// build's, unless a save rewrote it.
|
|
5845
|
+
return [file, proposal.files[file] ?? ((_options$projectSourc = options.projectSource) === null || _options$projectSourc === void 0 ? void 0 : _options$projectSourc[file]) ?? null];
|
|
5779
5846
|
})))
|
|
5780
5847
|
}
|
|
5781
5848
|
} : {}),
|
|
@@ -8872,6 +8939,9 @@ async function initHandlerOptions(route, opts, config) {
|
|
|
8872
8939
|
...(opts.projectSource !== undefined ? {
|
|
8873
8940
|
projectSource: opts.projectSource
|
|
8874
8941
|
} : {}),
|
|
8942
|
+
...(opts.moduleDependencies !== undefined ? {
|
|
8943
|
+
moduleDependencies: opts.moduleDependencies
|
|
8944
|
+
} : {}),
|
|
8875
8945
|
...(opts.publishJob !== undefined ? {
|
|
8876
8946
|
publishJob: opts.publishJob
|
|
8877
8947
|
} : {}),
|
|
@@ -8955,6 +9025,9 @@ function createValOps(valModules, options) {
|
|
|
8955
9025
|
...(options.projectSource !== undefined ? {
|
|
8956
9026
|
projectSource: options.projectSource
|
|
8957
9027
|
} : {}),
|
|
9028
|
+
...(options.moduleDependencies !== undefined ? {
|
|
9029
|
+
moduleDependencies: options.moduleDependencies
|
|
9030
|
+
} : {}),
|
|
8958
9031
|
...(options.publishJob !== undefined ? {
|
|
8959
9032
|
publishJob: options.publishJob
|
|
8960
9033
|
} : {}),
|
|
@@ -9462,6 +9535,7 @@ function differences(a, b) {
|
|
|
9462
9535
|
check("git", sameValue(a.git, b.git));
|
|
9463
9536
|
check("root", a.root === b.root);
|
|
9464
9537
|
check("projectSource", sameValue(a.projectSource, b.projectSource));
|
|
9538
|
+
check("moduleDependencies", sameValue(a.moduleDependencies, b.moduleDependencies));
|
|
9465
9539
|
check("publishJob", a.publishJob === b.publishJob);
|
|
9466
9540
|
check("publishBuild", a.publishBuild === b.publishBuild);
|
|
9467
9541
|
check("proposal", sameValue(a.proposal, b.proposal));
|
|
@@ -14431,6 +14505,7 @@ exports.readPatchStore = readPatchStore;
|
|
|
14431
14505
|
exports.removeValJsonEntry = removeValJsonEntry;
|
|
14432
14506
|
exports.resolveRemoteFileAuth = resolveRemoteFileAuth;
|
|
14433
14507
|
exports.safeReadGit = safeReadGit;
|
|
14508
|
+
exports.servingBuildOf = servingBuildOf;
|
|
14434
14509
|
exports.stagedAfterBuild = stagedAfterBuild;
|
|
14435
14510
|
exports.unreadableVideoMetadataMessage = unreadableVideoMetadataMessage;
|
|
14436
14511
|
exports.uploadBytesToRemote = uploadBytesToRemote;
|