@valbuild/server 0.153.1 → 0.153.3

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/browser/dist/valbuild-server-browser.cjs.dev.js +2 -2
  3. package/browser/dist/valbuild-server-browser.cjs.prod.js +2 -2
  4. package/browser/dist/valbuild-server-browser.esm.js +2 -2
  5. package/dist/{ValRouter-40bf46a2.cjs.prod.js → ValRouter-053b57b7.cjs.prod.js} +3 -3
  6. package/dist/{ValRouter-db465719.esm.js → ValRouter-c3d7b733.esm.js} +3 -3
  7. package/dist/{ValRouter-6c633acf.cjs.dev.js → ValRouter-e478ff3c.cjs.dev.js} +3 -3
  8. package/dist/{ValRouterCore-b3773130.esm.js → ValRouterCore-136fb247.esm.js} +46 -4
  9. package/dist/{ValRouterCore-a4d99115.cjs.dev.js → ValRouterCore-9b9cfad3.cjs.prod.js} +46 -4
  10. package/dist/{ValRouterCore-2d86ff95.cjs.prod.js → ValRouterCore-a259030a.cjs.dev.js} +46 -4
  11. package/dist/declarations/src/ValOps.d.ts +23 -0
  12. package/dist/{inTabFetch-80b6b9e8.esm.js → inTabFetch-0ca07526.esm.js} +1 -1
  13. package/dist/{inTabFetch-6382d21a.cjs.dev.js → inTabFetch-1600f348.cjs.dev.js} +1 -1
  14. package/dist/{inTabFetch-95c17bcc.cjs.prod.js → inTabFetch-a9c9d3af.cjs.prod.js} +1 -1
  15. package/dist/{publishKit-500645fd.cjs.dev.js → publishKit-85888dad.cjs.dev.js} +2 -2
  16. package/dist/{publishKit-c03f3e49.esm.js → publishKit-da1c2aeb.esm.js} +3 -3
  17. package/dist/{publishKit-b4c47ed0.cjs.prod.js → publishKit-eb2ed978.cjs.prod.js} +2 -2
  18. package/dist/valbuild-server.cjs.dev.js +2 -2
  19. package/dist/valbuild-server.cjs.prod.js +2 -2
  20. package/dist/valbuild-server.esm.js +4 -4
  21. package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +2 -2
  22. package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +2 -2
  23. package/internal/browser/dist/valbuild-server-internal-browser.esm.js +2 -2
  24. package/internal/dist/valbuild-server-internal.cjs.dev.js +2 -2
  25. package/internal/dist/valbuild-server-internal.cjs.prod.js +2 -2
  26. package/internal/dist/valbuild-server-internal.esm.js +2 -2
  27. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @valbuild/server
2
2
 
3
+ ## 0.153.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1036](https://github.com/valbuild/val/pull/1036) [`a5f9fb5`](https://github.com/valbuild/val/commit/a5f9fb5c96f5b675fb346232c7084926c8b07cf0) Thanks [@freekh](https://github.com/freekh)! - Publishing again before the site has redeployed no longer reverts what the previous publish changed in the same file.
8
+
9
+ A publish now renders its changes on top of everything published since the running build was made, not on top of the build's own text. Before, two publishes into the same `.val.ts` with no deploy in between produced a second commit that silently undid the first one's change. Val still lets you publish while a deployment is pending.
10
+
11
+ - Updated dependencies [[`c957eb5`](https://github.com/valbuild/val/commit/c957eb5c5b010938b57fa475febdeae169b8831a)]:
12
+ - @valbuild/ui@0.153.3
13
+
14
+ ## 0.153.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`75877d7`](https://github.com/valbuild/val/commit/75877d704582abdc1bfb14902b311a857066261a)]:
19
+ - @valbuild/ui@0.153.2
20
+
3
21
  ## 0.153.1
4
22
 
5
23
  ### Patch Changes
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../dist/inTabFetch-6382d21a.cjs.dev.js');
5
+ var inTabFetch = require('../../dist/inTabFetch-1600f348.cjs.dev.js');
6
6
  require('@valbuild/core');
7
- require('../../dist/ValRouterCore-a4d99115.cjs.dev.js');
7
+ require('../../dist/ValRouterCore-a259030a.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-95c17bcc.cjs.prod.js');
5
+ var inTabFetch = require('../../dist/inTabFetch-a9c9d3af.cjs.prod.js');
6
6
  require('@valbuild/core');
7
- require('../../dist/ValRouterCore-2d86ff95.cjs.prod.js');
7
+ require('../../dist/ValRouterCore-9b9cfad3.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-80b6b9e8.esm.js';
1
+ export { c as createInTabValFetch } from '../../dist/inTabFetch-0ca07526.esm.js';
2
2
  import '@valbuild/core';
3
- import '../../dist/ValRouterCore-b3773130.esm.js';
3
+ import '../../dist/ValRouterCore-136fb247.esm.js';
4
4
  import 'zod';
5
5
  import '@valbuild/shared/internal';
6
6
  import 'zod-validation-error';
@@ -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-2d86ff95.cjs.prod.js');
5
+ var ValRouterCore = require('./ValRouterCore-9b9cfad3.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-b4c47ed0.cjs.prod.js'); });
2208
+ return Promise.resolve().then(function () { return require('./publishKit-eb2ed978.cjs.prod.js'); });
2209
2209
  }
2210
2210
 
2211
2211
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -4989,7 +4989,7 @@ async function stagedModuleSources(files) {
4989
4989
  parseValFile,
4990
4990
  analyzeValModule,
4991
4991
  evaluateModuleSource
4992
- } = await Promise.resolve().then(function () { return require('./publishKit-b4c47ed0.cjs.prod.js'); });
4992
+ } = await Promise.resolve().then(function () { return require('./publishKit-eb2ed978.cjs.prod.js'); });
4993
4993
  const sources = {};
4994
4994
  for (const {
4995
4995
  path,
@@ -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-b3773130.esm.js';
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-136fb247.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-c03f3e49.esm.js');
2174
+ return import('./publishKit-da1c2aeb.esm.js');
2175
2175
  }
2176
2176
 
2177
2177
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -4955,7 +4955,7 @@ async function stagedModuleSources(files) {
4955
4955
  parseValFile,
4956
4956
  analyzeValModule,
4957
4957
  evaluateModuleSource
4958
- } = await import('./publishKit-c03f3e49.esm.js');
4958
+ } = await import('./publishKit-da1c2aeb.esm.js');
4959
4959
  const sources = {};
4960
4960
  for (const {
4961
4961
  path,
@@ -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-a4d99115.cjs.dev.js');
5
+ var ValRouterCore = require('./ValRouterCore-a259030a.cjs.dev.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-500645fd.cjs.dev.js'); });
2208
+ return Promise.resolve().then(function () { return require('./publishKit-85888dad.cjs.dev.js'); });
2209
2209
  }
2210
2210
 
2211
2211
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -4989,7 +4989,7 @@ async function stagedModuleSources(files) {
4989
4989
  parseValFile,
4990
4990
  analyzeValModule,
4991
4991
  evaluateModuleSource
4992
- } = await Promise.resolve().then(function () { return require('./publishKit-500645fd.cjs.dev.js'); });
4992
+ } = await Promise.resolve().then(function () { return require('./publishKit-85888dad.cjs.dev.js'); });
4993
4993
  const sources = {};
4994
4994
  for (const {
4995
4995
  path,
@@ -3824,8 +3824,19 @@ class ValOps {
3824
3824
  analyzePatches(sortedPatches, commits, currentCommitSha) {
3825
3825
  const patchesByModule = {};
3826
3826
  const fileLastUpdatedByPatchId = {};
3827
+ const publishedByModule = {};
3827
3828
  for (const patch of sortedPatches) {
3828
3829
  if (patch.appliedAt) {
3830
+ var _patch$patch;
3831
+ /*
3832
+ * Published, and not yet in this build: the text a publish patches
3833
+ * has to have it, or the publish reverts it. See `publishedByModule`.
3834
+ */
3835
+ if ((_patch$patch = patch.patch) !== null && _patch$patch !== void 0 && _patch$patch.some(op => op.op !== "file")) {
3836
+ (publishedByModule[patch.path] ??= []).push({
3837
+ patchId: patch.patchId
3838
+ });
3839
+ }
3829
3840
  continue;
3830
3841
  }
3831
3842
  let hasSourceFileOps = false;
@@ -3864,7 +3875,8 @@ class ValOps {
3864
3875
  }
3865
3876
  return {
3866
3877
  patchesByModule,
3867
- fileLastUpdatedByPatchId
3878
+ fileLastUpdatedByPatchId,
3879
+ publishedByModule
3868
3880
  };
3869
3881
  }
3870
3882
 
@@ -4418,6 +4430,7 @@ class ValOps {
4418
4430
  const schemas = await this.getSchemas();
4419
4431
  const stagedAfterBuild = ((_this$options8 = this.options) === null || _this$options8 === void 0 || (_this$options8 = _this$options8.stagedAfterBuild) === null || _this$options8 === void 0 ? void 0 : _this$options8.versions) ?? {};
4420
4432
  const applySourceFilePatches = async (path, patches) => {
4433
+ var _patchAnalysis$publis;
4421
4434
  const errors = [];
4422
4435
  const held = this.heldStaged.get(path);
4423
4436
  if (held !== undefined) {
@@ -4635,10 +4648,25 @@ class ValOps {
4635
4648
  };
4636
4649
  const appliedPatches = [];
4637
4650
  const triedPatches = [];
4651
+ /*
4652
+ * What was published since this build, first: the base text is the
4653
+ * build's, and these bring it to what the last publish wrote. They are
4654
+ * replayed, not committed again, so they are never in `appliedPatches`.
4655
+ * See `PatchAnalysis.publishedByModule`.
4656
+ */
4657
+ const published = new Set((((_patchAnalysis$publis = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis === void 0 ? void 0 : _patchAnalysis$publis[path]) ?? []).map(p => p.patchId));
4638
4658
  for (const {
4639
4659
  patchId
4640
- } of patches) {
4660
+ } of [...(((_patchAnalysis$publis2 = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis2 === void 0 ? void 0 : _patchAnalysis$publis2[path]) ?? []), ...patches]) {
4661
+ var _patchAnalysis$publis2;
4641
4662
  const patchData = patchAnalysis.patches.find(p => p.patchId === patchId);
4663
+ if (!patchData && published.has(patchId)) {
4664
+ errors.push({
4665
+ message: `A change published since this build (${patchId}) is not in the chain, so ${path} cannot be brought up to what was published`,
4666
+ filePath: path
4667
+ });
4668
+ break;
4669
+ }
4642
4670
  if (!patchData) {
4643
4671
  const message = `Analysis required non-existing patch: ${patchId}`;
4644
4672
  errors.push({
@@ -4904,6 +4932,18 @@ class ValOps {
4904
4932
  break;
4905
4933
  }
4906
4934
  }
4935
+ if (patchHadError && published.has(patchId)) {
4936
+ /*
4937
+ * Not the editor's change, so not one to offer to remove: what was
4938
+ * published no longer applies to this build's text. Nothing pending
4939
+ * can go on top of that, whatever `continueOnError` says.
4940
+ */
4941
+ errors.push({
4942
+ message: `A change published since this build (${patchId}) could not be replayed over ${path} as this build has it, so the publish would revert it`,
4943
+ filePath: path
4944
+ });
4945
+ break;
4946
+ }
4907
4947
  if (patchHadError) {
4908
4948
  unappliablePatches[patchId] = {
4909
4949
  moduleFilePath: path,
@@ -4923,7 +4963,9 @@ class ValOps {
4923
4963
  }
4924
4964
  break;
4925
4965
  }
4926
- appliedPatches.push(patchId);
4966
+ if (!published.has(patchId)) {
4967
+ appliedPatches.push(patchId);
4968
+ }
4927
4969
  }
4928
4970
  if (errors.length > 0 && continueOnError) {
4929
4971
  // Diagnosis: expose what the source file would look like with the
@@ -6253,7 +6295,7 @@ var packageJson = {
6253
6295
  ],
6254
6296
  exports: true
6255
6297
  },
6256
- version: "0.153.1",
6298
+ version: "0.153.3",
6257
6299
  scripts: {
6258
6300
  typecheck: "tsc --noEmit",
6259
6301
  test: "jest",
@@ -3830,8 +3830,19 @@ class ValOps {
3830
3830
  analyzePatches(sortedPatches, commits, currentCommitSha) {
3831
3831
  const patchesByModule = {};
3832
3832
  const fileLastUpdatedByPatchId = {};
3833
+ const publishedByModule = {};
3833
3834
  for (const patch of sortedPatches) {
3834
3835
  if (patch.appliedAt) {
3836
+ var _patch$patch;
3837
+ /*
3838
+ * Published, and not yet in this build: the text a publish patches
3839
+ * has to have it, or the publish reverts it. See `publishedByModule`.
3840
+ */
3841
+ if ((_patch$patch = patch.patch) !== null && _patch$patch !== void 0 && _patch$patch.some(op => op.op !== "file")) {
3842
+ (publishedByModule[patch.path] ??= []).push({
3843
+ patchId: patch.patchId
3844
+ });
3845
+ }
3835
3846
  continue;
3836
3847
  }
3837
3848
  let hasSourceFileOps = false;
@@ -3870,7 +3881,8 @@ class ValOps {
3870
3881
  }
3871
3882
  return {
3872
3883
  patchesByModule,
3873
- fileLastUpdatedByPatchId
3884
+ fileLastUpdatedByPatchId,
3885
+ publishedByModule
3874
3886
  };
3875
3887
  }
3876
3888
 
@@ -4424,6 +4436,7 @@ class ValOps {
4424
4436
  const schemas = await this.getSchemas();
4425
4437
  const stagedAfterBuild = ((_this$options8 = this.options) === null || _this$options8 === void 0 || (_this$options8 = _this$options8.stagedAfterBuild) === null || _this$options8 === void 0 ? void 0 : _this$options8.versions) ?? {};
4426
4438
  const applySourceFilePatches = async (path, patches) => {
4439
+ var _patchAnalysis$publis;
4427
4440
  const errors = [];
4428
4441
  const held = this.heldStaged.get(path);
4429
4442
  if (held !== undefined) {
@@ -4641,10 +4654,25 @@ class ValOps {
4641
4654
  };
4642
4655
  const appliedPatches = [];
4643
4656
  const triedPatches = [];
4657
+ /*
4658
+ * What was published since this build, first: the base text is the
4659
+ * build's, and these bring it to what the last publish wrote. They are
4660
+ * replayed, not committed again, so they are never in `appliedPatches`.
4661
+ * See `PatchAnalysis.publishedByModule`.
4662
+ */
4663
+ const published = new Set((((_patchAnalysis$publis = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis === void 0 ? void 0 : _patchAnalysis$publis[path]) ?? []).map(p => p.patchId));
4644
4664
  for (const {
4645
4665
  patchId
4646
- } of patches) {
4666
+ } of [...(((_patchAnalysis$publis2 = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis2 === void 0 ? void 0 : _patchAnalysis$publis2[path]) ?? []), ...patches]) {
4667
+ var _patchAnalysis$publis2;
4647
4668
  const patchData = patchAnalysis.patches.find(p => p.patchId === patchId);
4669
+ if (!patchData && published.has(patchId)) {
4670
+ errors.push({
4671
+ message: `A change published since this build (${patchId}) is not in the chain, so ${path} cannot be brought up to what was published`,
4672
+ filePath: path
4673
+ });
4674
+ break;
4675
+ }
4648
4676
  if (!patchData) {
4649
4677
  const message = `Analysis required non-existing patch: ${patchId}`;
4650
4678
  errors.push({
@@ -4910,6 +4938,18 @@ class ValOps {
4910
4938
  break;
4911
4939
  }
4912
4940
  }
4941
+ if (patchHadError && published.has(patchId)) {
4942
+ /*
4943
+ * Not the editor's change, so not one to offer to remove: what was
4944
+ * published no longer applies to this build's text. Nothing pending
4945
+ * can go on top of that, whatever `continueOnError` says.
4946
+ */
4947
+ errors.push({
4948
+ message: `A change published since this build (${patchId}) could not be replayed over ${path} as this build has it, so the publish would revert it`,
4949
+ filePath: path
4950
+ });
4951
+ break;
4952
+ }
4913
4953
  if (patchHadError) {
4914
4954
  unappliablePatches[patchId] = {
4915
4955
  moduleFilePath: path,
@@ -4929,7 +4969,9 @@ class ValOps {
4929
4969
  }
4930
4970
  break;
4931
4971
  }
4932
- appliedPatches.push(patchId);
4972
+ if (!published.has(patchId)) {
4973
+ appliedPatches.push(patchId);
4974
+ }
4933
4975
  }
4934
4976
  if (errors.length > 0 && continueOnError) {
4935
4977
  // Diagnosis: expose what the source file would look like with the
@@ -6259,7 +6301,7 @@ var packageJson = {
6259
6301
  ],
6260
6302
  exports: true
6261
6303
  },
6262
- version: "0.153.1",
6304
+ version: "0.153.3",
6263
6305
  scripts: {
6264
6306
  typecheck: "tsc --noEmit",
6265
6307
  test: "jest",
@@ -3830,8 +3830,19 @@ class ValOps {
3830
3830
  analyzePatches(sortedPatches, commits, currentCommitSha) {
3831
3831
  const patchesByModule = {};
3832
3832
  const fileLastUpdatedByPatchId = {};
3833
+ const publishedByModule = {};
3833
3834
  for (const patch of sortedPatches) {
3834
3835
  if (patch.appliedAt) {
3836
+ var _patch$patch;
3837
+ /*
3838
+ * Published, and not yet in this build: the text a publish patches
3839
+ * has to have it, or the publish reverts it. See `publishedByModule`.
3840
+ */
3841
+ if ((_patch$patch = patch.patch) !== null && _patch$patch !== void 0 && _patch$patch.some(op => op.op !== "file")) {
3842
+ (publishedByModule[patch.path] ??= []).push({
3843
+ patchId: patch.patchId
3844
+ });
3845
+ }
3835
3846
  continue;
3836
3847
  }
3837
3848
  let hasSourceFileOps = false;
@@ -3870,7 +3881,8 @@ class ValOps {
3870
3881
  }
3871
3882
  return {
3872
3883
  patchesByModule,
3873
- fileLastUpdatedByPatchId
3884
+ fileLastUpdatedByPatchId,
3885
+ publishedByModule
3874
3886
  };
3875
3887
  }
3876
3888
 
@@ -4424,6 +4436,7 @@ class ValOps {
4424
4436
  const schemas = await this.getSchemas();
4425
4437
  const stagedAfterBuild = ((_this$options8 = this.options) === null || _this$options8 === void 0 || (_this$options8 = _this$options8.stagedAfterBuild) === null || _this$options8 === void 0 ? void 0 : _this$options8.versions) ?? {};
4426
4438
  const applySourceFilePatches = async (path, patches) => {
4439
+ var _patchAnalysis$publis;
4427
4440
  const errors = [];
4428
4441
  const held = this.heldStaged.get(path);
4429
4442
  if (held !== undefined) {
@@ -4641,10 +4654,25 @@ class ValOps {
4641
4654
  };
4642
4655
  const appliedPatches = [];
4643
4656
  const triedPatches = [];
4657
+ /*
4658
+ * What was published since this build, first: the base text is the
4659
+ * build's, and these bring it to what the last publish wrote. They are
4660
+ * replayed, not committed again, so they are never in `appliedPatches`.
4661
+ * See `PatchAnalysis.publishedByModule`.
4662
+ */
4663
+ const published = new Set((((_patchAnalysis$publis = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis === void 0 ? void 0 : _patchAnalysis$publis[path]) ?? []).map(p => p.patchId));
4644
4664
  for (const {
4645
4665
  patchId
4646
- } of patches) {
4666
+ } of [...(((_patchAnalysis$publis2 = patchAnalysis.publishedByModule) === null || _patchAnalysis$publis2 === void 0 ? void 0 : _patchAnalysis$publis2[path]) ?? []), ...patches]) {
4667
+ var _patchAnalysis$publis2;
4647
4668
  const patchData = patchAnalysis.patches.find(p => p.patchId === patchId);
4669
+ if (!patchData && published.has(patchId)) {
4670
+ errors.push({
4671
+ message: `A change published since this build (${patchId}) is not in the chain, so ${path} cannot be brought up to what was published`,
4672
+ filePath: path
4673
+ });
4674
+ break;
4675
+ }
4648
4676
  if (!patchData) {
4649
4677
  const message = `Analysis required non-existing patch: ${patchId}`;
4650
4678
  errors.push({
@@ -4910,6 +4938,18 @@ class ValOps {
4910
4938
  break;
4911
4939
  }
4912
4940
  }
4941
+ if (patchHadError && published.has(patchId)) {
4942
+ /*
4943
+ * Not the editor's change, so not one to offer to remove: what was
4944
+ * published no longer applies to this build's text. Nothing pending
4945
+ * can go on top of that, whatever `continueOnError` says.
4946
+ */
4947
+ errors.push({
4948
+ message: `A change published since this build (${patchId}) could not be replayed over ${path} as this build has it, so the publish would revert it`,
4949
+ filePath: path
4950
+ });
4951
+ break;
4952
+ }
4913
4953
  if (patchHadError) {
4914
4954
  unappliablePatches[patchId] = {
4915
4955
  moduleFilePath: path,
@@ -4929,7 +4969,9 @@ class ValOps {
4929
4969
  }
4930
4970
  break;
4931
4971
  }
4932
- appliedPatches.push(patchId);
4972
+ if (!published.has(patchId)) {
4973
+ appliedPatches.push(patchId);
4974
+ }
4933
4975
  }
4934
4976
  if (errors.length > 0 && continueOnError) {
4935
4977
  // Diagnosis: expose what the source file would look like with the
@@ -6259,7 +6301,7 @@ var packageJson = {
6259
6301
  ],
6260
6302
  exports: true
6261
6303
  },
6262
- version: "0.153.1",
6304
+ version: "0.153.3",
6263
6305
  scripts: {
6264
6306
  typecheck: "tsc --noEmit",
6265
6307
  test: "jest",
@@ -1128,6 +1128,29 @@ export type PatchAnalysis = {
1128
1128
  remote: boolean;
1129
1129
  isDelete: boolean;
1130
1130
  }>;
1131
+ /**
1132
+ * By module, in chain order: the patches that are PUBLISHED but not in this
1133
+ * build -- `appliedAt` set, which a patch keeps until a deployment moves the
1134
+ * base past it.
1135
+ *
1136
+ * Not part of anything a reader shows (the readers' sources already apply
1137
+ * them, as part of the chain) and not part of what a publish commits. They
1138
+ * are what a publish has to patch ON TOP OF: the base text it reads is the
1139
+ * build's, so `prepare` replays these over it first, and the result is the
1140
+ * text the last publish wrote. Without that, a second publish before the
1141
+ * site redeployed silently reverted the first one's change to the same file
1142
+ * (`e2e/http/publish.spec.ts`, "a second change publishes on top of the
1143
+ * first commit").
1144
+ *
1145
+ * Empty in `fs` and memory mode, where publishing rewrites the base and no
1146
+ * patch is ever applied-at-a-commit. Optional for a caller that builds an
1147
+ * analysis by hand.
1148
+ */
1149
+ publishedByModule?: {
1150
+ [path: ModuleFilePath]: {
1151
+ patchId: PatchId;
1152
+ }[];
1153
+ };
1131
1154
  };
1132
1155
  export type PatchSourceError = {
1133
1156
  message: string;
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_CONTENT_HOST } from '@valbuild/core';
2
- import { e as ValOpsMemory, M as bytesToBase64, K as ValServer, L as createValRequestHandler } from './ValRouterCore-b3773130.esm.js';
2
+ import { e as ValOpsMemory, M as bytesToBase64, K as ValServer, L as createValRequestHandler } from './ValRouterCore-136fb247.esm.js';
3
3
 
4
4
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
5
5
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValRouterCore = require('./ValRouterCore-a4d99115.cjs.dev.js');
4
+ var ValRouterCore = require('./ValRouterCore-a259030a.cjs.dev.js');
5
5
 
6
6
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValRouterCore = require('./ValRouterCore-2d86ff95.cjs.prod.js');
4
+ var ValRouterCore = require('./ValRouterCore-9b9cfad3.cjs.prod.js');
5
5
 
6
6
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
7
7
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var ValRouter = require('./ValRouter-6c633acf.cjs.dev.js');
6
- var ValRouterCore = require('./ValRouterCore-a4d99115.cjs.dev.js');
5
+ var ValRouter = require('./ValRouter-e478ff3c.cjs.dev.js');
6
+ var ValRouterCore = require('./ValRouterCore-a259030a.cjs.dev.js');
7
7
  require('@valbuild/core');
8
8
  require('@valbuild/ui/server');
9
9
  require('path');
@@ -1,8 +1,8 @@
1
1
  import ts from 'typescript';
2
2
  import { result, pipe } from '@valbuild/core/fp';
3
- import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-db465719.esm.js';
4
- export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-db465719.esm.js';
5
- import { R as bytesToUtf8, S as posixPath } from './ValRouterCore-b3773130.esm.js';
3
+ import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-c3d7b733.esm.js';
4
+ export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-c3d7b733.esm.js';
5
+ import { R as bytesToUtf8, S as posixPath } from './ValRouterCore-136fb247.esm.js';
6
6
  import '@valbuild/core';
7
7
  import '@valbuild/ui/server';
8
8
  import 'path';
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var ValRouter = require('./ValRouter-40bf46a2.cjs.prod.js');
6
- var ValRouterCore = require('./ValRouterCore-2d86ff95.cjs.prod.js');
5
+ var ValRouter = require('./ValRouter-053b57b7.cjs.prod.js');
6
+ var ValRouterCore = require('./ValRouterCore-9b9cfad3.cjs.prod.js');
7
7
  require('@valbuild/core');
8
8
  require('@valbuild/ui/server');
9
9
  require('path');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('./ValRouter-6c633acf.cjs.dev.js');
5
+ var ValRouter = require('./ValRouter-e478ff3c.cjs.dev.js');
6
6
  var patch = require('@valbuild/core/patch');
7
7
  var fp = require('@valbuild/core/fp');
8
8
  var core = require('@valbuild/core');
@@ -11,7 +11,7 @@ var path = require('path');
11
11
  var fs = require('fs');
12
12
  var vm = require('node:vm');
13
13
  var node_module = require('node:module');
14
- var ValRouterCore = require('./ValRouterCore-a4d99115.cjs.dev.js');
14
+ var ValRouterCore = require('./ValRouterCore-a259030a.cjs.dev.js');
15
15
  var internal = require('@valbuild/shared/internal');
16
16
  var sucrase = require('sucrase');
17
17
  var fs$1 = require('fs/promises');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('./ValRouter-40bf46a2.cjs.prod.js');
5
+ var ValRouter = require('./ValRouter-053b57b7.cjs.prod.js');
6
6
  var patch = require('@valbuild/core/patch');
7
7
  var fp = require('@valbuild/core/fp');
8
8
  var core = require('@valbuild/core');
@@ -11,7 +11,7 @@ var path = require('path');
11
11
  var fs = require('fs');
12
12
  var vm = require('node:vm');
13
13
  var node_module = require('node:module');
14
- var ValRouterCore = require('./ValRouterCore-2d86ff95.cjs.prod.js');
14
+ var ValRouterCore = require('./ValRouterCore-9b9cfad3.cjs.prod.js');
15
15
  var internal = require('@valbuild/shared/internal');
16
16
  var sucrase = require('sucrase');
17
17
  var fs$1 = require('fs/promises');
@@ -1,5 +1,5 @@
1
- import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-db465719.esm.js';
2
- export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-db465719.esm.js';
1
+ import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-c3d7b733.esm.js';
2
+ export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-c3d7b733.esm.js';
3
3
  import { applyPatch, PatchError, JSONOps, deepClone } from '@valbuild/core/patch';
4
4
  import { pipe, result } from '@valbuild/core/fp';
5
5
  import { derefPatch, Internal, extractValModules, DEFAULT_CONTENT_HOST } from '@valbuild/core';
@@ -9,8 +9,8 @@ import path from 'path';
9
9
  import fs from 'fs';
10
10
  import vm from 'node:vm';
11
11
  import { Module } from 'node:module';
12
- import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-b3773130.esm.js';
13
- export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-b3773130.esm.js';
12
+ import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-136fb247.esm.js';
13
+ export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-136fb247.esm.js';
14
14
  import { isJsonValuesRootOp, rebaseContentOp, classifyJsonValuesOp, richTextImageSchema } from '@valbuild/shared/internal';
15
15
  export { classifyJsonValuesOp, rebaseContentOp } from '@valbuild/shared/internal';
16
16
  import { transform } from 'sucrase';
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../../dist/inTabFetch-6382d21a.cjs.dev.js');
5
+ var inTabFetch = require('../../../dist/inTabFetch-1600f348.cjs.dev.js');
6
6
  var draftReads = require('../../../dist/draftReads-df44e629.cjs.dev.js');
7
7
  require('@valbuild/core');
8
- require('../../../dist/ValRouterCore-a4d99115.cjs.dev.js');
8
+ require('../../../dist/ValRouterCore-a259030a.cjs.dev.js');
9
9
  require('zod');
10
10
  require('@valbuild/shared/internal');
11
11
  require('zod-validation-error');
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../../dist/inTabFetch-95c17bcc.cjs.prod.js');
5
+ var inTabFetch = require('../../../dist/inTabFetch-a9c9d3af.cjs.prod.js');
6
6
  var draftReads = require('../../../dist/draftReads-0dcddf72.cjs.prod.js');
7
7
  require('@valbuild/core');
8
- require('../../../dist/ValRouterCore-2d86ff95.cjs.prod.js');
8
+ require('../../../dist/ValRouterCore-9b9cfad3.cjs.prod.js');
9
9
  require('zod');
10
10
  require('@valbuild/shared/internal');
11
11
  require('zod-validation-error');
@@ -1,7 +1,7 @@
1
- export { a as createInTabVal } from '../../../dist/inTabFetch-80b6b9e8.esm.js';
1
+ export { a as createInTabVal } from '../../../dist/inTabFetch-0ca07526.esm.js';
2
2
  export { s as serverDraftSource } from '../../../dist/draftReads-1f29aedd.esm.js';
3
3
  import '@valbuild/core';
4
- import '../../../dist/ValRouterCore-b3773130.esm.js';
4
+ import '../../../dist/ValRouterCore-136fb247.esm.js';
5
5
  import 'zod';
6
6
  import '@valbuild/shared/internal';
7
7
  import 'zod-validation-error';
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('../../dist/ValRouter-6c633acf.cjs.dev.js');
5
+ var ValRouter = require('../../dist/ValRouter-e478ff3c.cjs.dev.js');
6
6
  var draftReads = require('../../dist/draftReads-df44e629.cjs.dev.js');
7
- var ValRouterCore = require('../../dist/ValRouterCore-a4d99115.cjs.dev.js');
7
+ var ValRouterCore = require('../../dist/ValRouterCore-a259030a.cjs.dev.js');
8
8
  require('@valbuild/core');
9
9
  require('@valbuild/ui/server');
10
10
  require('path');
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('../../dist/ValRouter-40bf46a2.cjs.prod.js');
5
+ var ValRouter = require('../../dist/ValRouter-053b57b7.cjs.prod.js');
6
6
  var draftReads = require('../../dist/draftReads-0dcddf72.cjs.prod.js');
7
- var ValRouterCore = require('../../dist/ValRouterCore-2d86ff95.cjs.prod.js');
7
+ var ValRouterCore = require('../../dist/ValRouterCore-9b9cfad3.cjs.prod.js');
8
8
  require('@valbuild/core');
9
9
  require('@valbuild/ui/server');
10
10
  require('path');
@@ -1,6 +1,6 @@
1
- export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-db465719.esm.js';
1
+ export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-c3d7b733.esm.js';
2
2
  export { d as draftForRequest, r as readDraftChanges, s as serverDraftSource } from '../../dist/draftReads-1f29aedd.esm.js';
3
- export { P as HEAD_BUDGET_BYTES, Q as HEAD_VERSIONS_PER_MODULE, N as ValHead, O as headWork } from '../../dist/ValRouterCore-b3773130.esm.js';
3
+ export { P as HEAD_BUDGET_BYTES, Q as HEAD_VERSIONS_PER_MODULE, N as ValHead, O as headWork } from '../../dist/ValRouterCore-136fb247.esm.js';
4
4
  import '@valbuild/core';
5
5
  import '@valbuild/ui/server';
6
6
  import 'path';
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "exports": true
39
39
  },
40
- "version": "0.153.1",
40
+ "version": "0.153.3",
41
41
  "devDependencies": {
42
42
  "@prettier/sync": "^0.6.1",
43
43
  "@types/jest": "^30.0.0",
@@ -51,9 +51,9 @@
51
51
  "typescript": "^6.0.3",
52
52
  "zod": "^4.4.3",
53
53
  "zod-validation-error": "^5.0.0",
54
+ "@valbuild/ui": "0.153.3",
54
55
  "@valbuild/core": "0.153.0",
55
- "@valbuild/shared": "0.153.1",
56
- "@valbuild/ui": "0.153.1"
56
+ "@valbuild/shared": "0.153.1"
57
57
  },
58
58
  "engines": {
59
59
  "node": "^20.19.0 || >=22"