@valbuild/server 0.152.2 → 0.153.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 +44 -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-709cceaa.cjs.prod.js → ValRouter-40bf46a2.cjs.prod.js} +86 -11
- package/dist/{ValRouter-ff659cff.cjs.dev.js → ValRouter-6c633acf.cjs.dev.js} +86 -11
- package/dist/{ValRouter-7e314a55.esm.js → ValRouter-db465719.esm.js} +86 -12
- package/dist/{ValRouterCore-a5f17ad7.cjs.dev.js → ValRouterCore-2d86ff95.cjs.prod.js} +305 -251
- package/dist/{ValRouterCore-4e858bec.cjs.prod.js → ValRouterCore-a4d99115.cjs.dev.js} +305 -251
- package/dist/{ValRouterCore-c729eed3.esm.js → ValRouterCore-b3773130.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/draftReads.d.ts +1 -8
- package/dist/declarations/src/internal/index.d.ts +2 -2
- package/dist/declarations/src/proposal.d.ts +19 -3
- package/dist/{draftReads-05415ff6.cjs.dev.js → draftReads-0dcddf72.cjs.prod.js} +0 -17
- package/dist/{draftReads-5f99edd3.esm.js → draftReads-1f29aedd.esm.js} +2 -18
- package/dist/{draftReads-ea3946e0.cjs.prod.js → draftReads-df44e629.cjs.dev.js} +0 -17
- package/dist/{inTabFetch-fb9ee475.cjs.dev.js → inTabFetch-6382d21a.cjs.dev.js} +1 -1
- package/dist/{inTabFetch-b0a0e42f.esm.js → inTabFetch-80b6b9e8.esm.js} +1 -1
- package/dist/{inTabFetch-9b93a5d8.cjs.prod.js → inTabFetch-95c17bcc.cjs.prod.js} +1 -1
- package/dist/{publishKit-9c0c6880.cjs.dev.js → publishKit-500645fd.cjs.dev.js} +2 -2
- package/dist/{publishKit-ba7ff0e3.cjs.prod.js → publishKit-b4c47ed0.cjs.prod.js} +2 -2
- package/dist/{publishKit-5fe7f248.esm.js → publishKit-c03f3e49.esm.js} +3 -3
- 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 +3 -3
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +3 -3
- package/internal/browser/dist/valbuild-server-internal-browser.esm.js +3 -3
- package/internal/dist/valbuild-server-internal.cjs.dev.js +4 -4
- package/internal/dist/valbuild-server-internal.cjs.prod.js +4 -4
- package/internal/dist/valbuild-server-internal.esm.js +3 -3
- package/package.json +4 -4
|
@@ -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-b3773130.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-c03f3e49.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-c03f3e49.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 };
|