@valbuild/shared 0.150.10 → 0.150.12

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 (51) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client/dist/valbuild-shared-client.cjs.dev.js +16 -2
  3. package/client/dist/valbuild-shared-client.cjs.prod.js +16 -2
  4. package/client/dist/valbuild-shared-client.esm.js +2 -2
  5. package/dist/{acquireTypes-dd976839.cjs.prod.js → acquireTypes-6250a305.cjs.prod.js} +46 -46
  6. package/dist/{acquireTypes-6e2f7961.esm.js → acquireTypes-c2227b23.esm.js} +2 -2
  7. package/dist/{acquireTypes-84a4077a.cjs.dev.js → acquireTypes-c9e757a1.cjs.dev.js} +46 -46
  8. package/dist/{slicedToArray-22567815.esm.js → createForOfIteratorHelper-9b80f1a2.esm.js} +136 -106
  9. package/dist/{slicedToArray-d99b4e2e.cjs.prod.js → createForOfIteratorHelper-9ca2078d.cjs.prod.js} +142 -111
  10. package/dist/{slicedToArray-c8a29f6b.cjs.dev.js → createForOfIteratorHelper-f2d7ac6d.cjs.dev.js} +142 -111
  11. package/dist/declarations/src/client/index.d.ts +2 -0
  12. package/dist/declarations/src/internal/ApiRoutes.d.ts +35 -0
  13. package/dist/declarations/src/internal/index.d.ts +2 -0
  14. package/dist/declarations/src/internal/pageInspection.d.ts +117 -0
  15. package/dist/declarations/src/internal/quickPreview.d.ts +91 -0
  16. package/dist/declarations/src/internal/valCanvasProtocol.d.ts +53 -0
  17. package/dist/declarations/src/publish/buildProposal.d.ts +16 -1
  18. package/dist/declarations/src/publish/buildQuickPreview.d.ts +46 -0
  19. package/dist/declarations/src/publish/index.d.ts +3 -2
  20. package/dist/declarations/src/publish/runStudioDeploy.d.ts +10 -0
  21. package/dist/getSitemapTree-5354ce90.cjs.prod.js +1421 -0
  22. package/dist/getSitemapTree-97b3166f.esm.js +1381 -0
  23. package/dist/getSitemapTree-d934ff9c.cjs.dev.js +1421 -0
  24. package/dist/{proposalProject-689c24cc.esm.js → proposalProject-5da177d5.esm.js} +1 -2
  25. package/dist/{proposalProject-926f2c68.cjs.dev.js → proposalProject-76caa377.cjs.prod.js} +2 -3
  26. package/dist/{proposalProject-fab0c026.cjs.prod.js → proposalProject-81fee08f.cjs.dev.js} +2 -3
  27. package/dist/{protocol-7ddc1a71.esm.js → protocol-55cfa3cf.esm.js} +1 -1
  28. package/dist/{protocol-4e2a455b.cjs.prod.js → protocol-b1055ef0.cjs.prod.js} +6 -6
  29. package/dist/{protocol-ac1c3ec7.cjs.dev.js → protocol-d0efb8cd.cjs.dev.js} +6 -6
  30. package/dist/wrapNativeSuper-639b12b7.esm.js +107 -0
  31. package/dist/wrapNativeSuper-8673414f.cjs.prod.js +113 -0
  32. package/dist/wrapNativeSuper-933f991e.cjs.dev.js +113 -0
  33. package/internal/dist/valbuild-shared-internal.cjs.dev.js +94 -34
  34. package/internal/dist/valbuild-shared-internal.cjs.prod.js +94 -34
  35. package/internal/dist/valbuild-shared-internal.esm.js +52 -6
  36. package/package.json +2 -2
  37. package/publish/dist/valbuild-shared-publish.cjs.dev.js +589 -237
  38. package/publish/dist/valbuild-shared-publish.cjs.prod.js +589 -237
  39. package/publish/dist/valbuild-shared-publish.esm.js +504 -155
  40. package/typecheck/dist/valbuild-shared-typecheck.cjs.dev.js +34 -34
  41. package/typecheck/dist/valbuild-shared-typecheck.cjs.prod.js +34 -34
  42. package/typecheck/dist/valbuild-shared-typecheck.esm.js +5 -5
  43. package/typecheck/testing/dist/valbuild-shared-typecheck-testing.cjs.dev.js +7 -7
  44. package/typecheck/testing/dist/valbuild-shared-typecheck-testing.cjs.prod.js +7 -7
  45. package/typecheck/testing/dist/valbuild-shared-typecheck-testing.esm.js +3 -3
  46. package/dist/createForOfIteratorHelper-666a6d17.esm.js +0 -137
  47. package/dist/createForOfIteratorHelper-87a33eff.cjs.dev.js +0 -145
  48. package/dist/createForOfIteratorHelper-fef4fa7d.cjs.prod.js +0 -145
  49. package/dist/getSitemapTree-873f7266.cjs.prod.js +0 -743
  50. package/dist/getSitemapTree-b6161fd8.esm.js +0 -717
  51. package/dist/getSitemapTree-be70d9fc.cjs.dev.js +0 -743
@@ -1,8 +1,9 @@
1
- import { _ as _inherits, a as _createClass, b as _asyncToGenerator, c as _wrapNativeSuper, d as _regenerator, e as _classCallCheck, f as _callSuper, g as _slicedToArray } from '../../dist/slicedToArray-22567815.esm.js';
2
- import { _ as _typeof, a as _objectSpread2, d as _defineProperty, c as _createForOfIteratorHelper, b as _toConsumableArray } from '../../dist/createForOfIteratorHelper-666a6d17.esm.js';
3
- import { p as parseBuildTarget, a as parseDeclare, b as parseArtifacts, c as parseVerify, d as parsePromote, e as parseStatus, f as parseProjectSource, g as parseProblems, h as parsePress, i as parseRequestStatus, j as parseJob, k as parseRenew, l as parseCancel, m as parseDiscard, n as parseNewestCiRun, _ as _objectWithoutProperties } from '../../dist/protocol-7ddc1a71.esm.js';
1
+ import { b as _asyncToGenerator, c as _regenerator, _ as _typeof, d as _objectSpread2, g as _defineProperty, a as _slicedToArray, f as _createForOfIteratorHelper, e as _toConsumableArray } from '../../dist/createForOfIteratorHelper-9b80f1a2.esm.js';
2
+ import { _ as _inherits, a as _createClass, b as _wrapNativeSuper, c as _classCallCheck, d as _callSuper } from '../../dist/wrapNativeSuper-639b12b7.esm.js';
3
+ import { p as parseBuildTarget, a as parseDeclare, b as parseArtifacts, c as parseVerify, d as parsePromote, e as parseStatus, f as parseProjectSource, g as parseProblems, h as parsePress, i as parseRequestStatus, j as parseJob, k as parseRenew, l as parseCancel, m as parseDiscard, n as parseNewestCiRun, _ as _objectWithoutProperties } from '../../dist/protocol-55cfa3cf.esm.js';
4
4
  import { z } from 'zod';
5
- export { p as proposalProject } from '../../dist/proposalProject-689c24cc.esm.js';
5
+ import { p as proposalProject } from '../../dist/proposalProject-5da177d5.esm.js';
6
+ export { p as proposalProject } from '../../dist/proposalProject-5da177d5.esm.js';
6
7
  import 'zod-validation-error';
7
8
 
8
9
  /*
@@ -833,7 +834,7 @@ function resetLoadedLayerForTests() {
833
834
  * constant is four characters and the guard that says so is worth more. See
834
835
  * `onlyBuilderRoot.test.ts`.
835
836
  */
836
- var ROUTES_PREFIX = "src/routes/";
837
+ var ROUTES_PREFIX$1 = "src/routes/";
837
838
 
838
839
  /**
839
840
  * Where a project's served-as-is files live, and the artifact prefix they are
@@ -865,7 +866,7 @@ function runStudioDeploy(_x) {
865
866
  function _runStudioDeploy() {
866
867
  _runStudioDeploy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
867
868
  var _options$committedFil3, _git$commit, _git, _git$branch, _git2;
868
- var client, onPhase, failed, publishByName, builder, target, source, carried, refetched, _options$target, _options$committedBin, _options$committedBin2, _options$committedFil, _yield$Promise$all, _yield$Promise$all2, readTarget, readSource, readPublic, unread, _options$committedFil2, build, git, wiredSource, _ref8, _options$branch, _yield$builder$bakedG, _options$committedBin3, _options$committedBin4, branch, wired, fileBased, generateRouteTree, binaries, extraInputs, input, name, held, live, artifacts, _live, declared, published, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
869
+ var client, onPhase, failed, stopped, publishByName, builder, _stopped, target, source, carried, refetched, _options$target, _options$committedBin, _options$committedBin2, _options$committedFil, stoppedNow, _yield$Promise$all, _yield$Promise$all2, readTarget, readSource, readPublic, unread, _options$committedFil2, _stopped2, build, git, wiredSource, _ref8, _options$branch, _yield$builder$bakedG, _options$committedBin3, _options$committedBin4, _stoppedNow, branch, wired, fileBased, generateRouteTree, binaries, extraInputs, input, name, held, _stoppedNow2, live, _stopped3, artifacts, _stoppedNow3, _stopped4, stoppedAfterBuild, _live, declared, published, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
869
870
  return _regenerator().w(function (_context2) {
870
871
  while (1) switch (_context2.p = _context2.n) {
871
872
  case 0:
@@ -877,6 +878,11 @@ function _runStudioDeploy() {
877
878
  problems: []
878
879
  };
879
880
  };
881
+ /** The deploy was stopped: `null` while it was not. */
882
+ stopped = function stopped() {
883
+ var _options$signal;
884
+ return (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted ? failed(DEPLOY_STOPPED_MESSAGE) : null;
885
+ };
880
886
  /*
881
887
  * The build content already holds under this name, published as any build
882
888
  * is -- or `null` when content holds none, or cannot be asked by name (one
@@ -941,9 +947,16 @@ function _runStudioDeploy() {
941
947
  case 3:
942
948
  _context2.p = 3;
943
949
  _t = _context2.v;
944
- return _context2.a(2, failed(messageOf$2(_t)));
950
+ return _context2.a(2, (_stopped = stopped()) !== null && _stopped !== void 0 ? _stopped : failed(messageOf$2(_t)));
945
951
  case 4:
946
952
  _context2.p = 4;
953
+ stoppedNow = stopped();
954
+ if (!(stoppedNow !== null)) {
955
+ _context2.n = 5;
956
+ break;
957
+ }
958
+ return _context2.a(2, stoppedNow);
959
+ case 5:
947
960
  onPhase({
948
961
  kind: "reading"
949
962
  });
@@ -951,28 +964,28 @@ function _runStudioDeploy() {
951
964
  * Together, because they are one answer with two halves and neither is
952
965
  * useful alone -- and because the round trip is the cost, not the work.
953
966
  */
954
- _context2.n = 5;
967
+ _context2.n = 6;
955
968
  return Promise.all([(_options$target = options.target) !== null && _options$target !== void 0 ? _options$target : client.buildTarget(), client.projectSource(), client.publicFiles()]);
956
- case 5:
969
+ case 6:
957
970
  _yield$Promise$all = _context2.v;
958
971
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
959
972
  readTarget = _yield$Promise$all2[0];
960
973
  readSource = _yield$Promise$all2[1];
961
974
  readPublic = _yield$Promise$all2[2];
962
975
  if (!(readSource === null)) {
963
- _context2.n = 6;
976
+ _context2.n = 7;
964
977
  break;
965
978
  }
966
979
  return _context2.a(2, failed("This project has no published source to build from. Publish it once " + "from a checkout before editing it here."));
967
- case 6:
980
+ case 7:
968
981
  if (!(readTarget.project.rev === null)) {
969
- _context2.n = 7;
982
+ _context2.n = 8;
970
983
  break;
971
984
  }
972
985
  return _context2.a(2, failed("This project has no dependency layer yet, and one cannot be built " + "from the browser. Publish it once from a checkout, which builds it."));
973
- case 7:
986
+ case 8:
974
987
  if (!(options.target === undefined && layerMoved(options.loadedLayer, readTarget.project.rev))) {
975
- _context2.n = 8;
988
+ _context2.n = 9;
976
989
  break;
977
990
  }
978
991
  return _context2.a(2, {
@@ -983,31 +996,31 @@ function _runStudioDeploy() {
983
996
  message: STUDIO_OUT_OF_DATE_MESSAGE
984
997
  }]
985
998
  });
986
- case 8:
999
+ case 9:
987
1000
  if (!(readPublic === null || "paths" in readPublic && options.fetchPublicFile === undefined)) {
988
- _context2.n = 9;
1001
+ _context2.n = 10;
989
1002
  break;
990
1003
  }
991
1004
  return _context2.a(2, failed("The Studio cannot tell which images and other public files this " + "site serves, so publishing would remove them. Publish it once from " + "a checkout with `val publish`, and the Studio can publish it from " + "then on."));
992
- case 9:
1005
+ case 10:
993
1006
  unread = (_options$committedBin = (_options$committedBin2 = options.committedBinaryFiles) === null || _options$committedBin2 === void 0 ? void 0 : _options$committedBin2.unread) !== null && _options$committedBin !== void 0 ? _options$committedBin : [];
994
1007
  if (!(unread.length > 0)) {
995
- _context2.n = 10;
1008
+ _context2.n = 11;
996
1009
  break;
997
1010
  }
998
1011
  return _context2.a(2, failed("Your changes are saved, but ".concat(unread.join(", "), " could not be read ") + "back to build with, and the site would link a file it does not " + "serve. Try publishing again."));
999
- case 10:
1012
+ case 11:
1000
1013
  target = readTarget;
1001
1014
  source = withCommittedFiles(readSource, (_options$committedFil = options.committedFiles) !== null && _options$committedFil !== void 0 ? _options$committedFil : null);
1002
1015
  if (!("carried" in readPublic)) {
1003
- _context2.n = 11;
1016
+ _context2.n = 12;
1004
1017
  break;
1005
1018
  }
1006
1019
  carried = readPublic.carried;
1007
1020
  refetched = {};
1008
- _context2.n = 13;
1021
+ _context2.n = 14;
1009
1022
  break;
1010
- case 11:
1023
+ case 12:
1011
1024
  /*
1012
1025
  * Content has no record of the live build -- a project cloned from a
1013
1026
  * template seed -- but the loader knows what it serves, and this page is
@@ -1016,19 +1029,26 @@ function _runStudioDeploy() {
1016
1029
  * carries them without fetching.
1017
1030
  */
1018
1031
  carried = [];
1019
- _context2.n = 12;
1032
+ _context2.n = 13;
1020
1033
  return refetchPublicFiles(readPublic.paths, (_options$committedFil2 = options.committedFiles) !== null && _options$committedFil2 !== void 0 ? _options$committedFil2 : null, options.fetchPublicFile);
1021
- case 12:
1022
- refetched = _context2.v;
1023
1034
  case 13:
1024
- _context2.n = 15;
1025
- break;
1035
+ refetched = _context2.v;
1026
1036
  case 14:
1027
- _context2.p = 14;
1028
- _t2 = _context2.v;
1029
- return _context2.a(2, failed(messageOf$2(_t2)));
1037
+ _context2.n = 16;
1038
+ break;
1030
1039
  case 15:
1031
1040
  _context2.p = 15;
1041
+ _t2 = _context2.v;
1042
+ return _context2.a(2, (_stopped2 = stopped()) !== null && _stopped2 !== void 0 ? _stopped2 : failed(messageOf$2(_t2)));
1043
+ case 16:
1044
+ _context2.p = 16;
1045
+ _stoppedNow = stopped();
1046
+ if (!(_stoppedNow !== null)) {
1047
+ _context2.n = 17;
1048
+ break;
1049
+ }
1050
+ return _context2.a(2, _stoppedNow);
1051
+ case 17:
1032
1052
  onPhase({
1033
1053
  kind: "building"
1034
1054
  });
@@ -1045,66 +1065,66 @@ function _runStudioDeploy() {
1045
1065
  * about which commit this build is wired at.
1046
1066
  */
1047
1067
  if (!((_options$branch = options.branch) !== null && _options$branch !== void 0)) {
1048
- _context2.n = 16;
1068
+ _context2.n = 18;
1049
1069
  break;
1050
1070
  }
1051
1071
  _t4 = _options$branch;
1052
- _context2.n = 21;
1072
+ _context2.n = 23;
1053
1073
  break;
1054
- case 16:
1055
- _context2.n = 17;
1074
+ case 18:
1075
+ _context2.n = 19;
1056
1076
  return builder.bakedGit(source);
1057
- case 17:
1077
+ case 19:
1058
1078
  _t6 = _yield$builder$bakedG = _context2.v;
1059
1079
  _t5 = _t6 === null;
1060
1080
  if (_t5) {
1061
- _context2.n = 18;
1081
+ _context2.n = 20;
1062
1082
  break;
1063
1083
  }
1064
1084
  _t5 = _yield$builder$bakedG === void 0;
1065
- case 18:
1085
+ case 20:
1066
1086
  if (!_t5) {
1067
- _context2.n = 19;
1087
+ _context2.n = 21;
1068
1088
  break;
1069
1089
  }
1070
1090
  _t7 = void 0;
1071
- _context2.n = 20;
1091
+ _context2.n = 22;
1072
1092
  break;
1073
- case 19:
1093
+ case 21:
1074
1094
  _t7 = _yield$builder$bakedG.branch;
1075
- case 20:
1095
+ case 22:
1076
1096
  _t4 = _t7;
1077
- case 21:
1097
+ case 23:
1078
1098
  _t8 = _ref8 = _t4;
1079
1099
  _t3 = _t8 !== null;
1080
1100
  if (!_t3) {
1081
- _context2.n = 22;
1101
+ _context2.n = 24;
1082
1102
  break;
1083
1103
  }
1084
1104
  _t3 = _ref8 !== void 0;
1085
- case 22:
1105
+ case 24:
1086
1106
  if (!_t3) {
1087
- _context2.n = 23;
1107
+ _context2.n = 25;
1088
1108
  break;
1089
1109
  }
1090
1110
  _t9 = _ref8;
1091
- _context2.n = 24;
1111
+ _context2.n = 26;
1092
1112
  break;
1093
- case 23:
1113
+ case 25:
1094
1114
  _t9 = null;
1095
- case 24:
1115
+ case 26:
1096
1116
  branch = _t9;
1097
1117
  git = options.commit === null || branch === null ? null : {
1098
1118
  commit: options.commit,
1099
1119
  branch: branch
1100
1120
  };
1101
- _context2.n = 25;
1121
+ _context2.n = 27;
1102
1122
  return builder.rebakeGit(source, git, options.job);
1103
- case 25:
1123
+ case 27:
1104
1124
  wired = _context2.v;
1105
1125
  wiredSource = wired;
1106
1126
  fileBased = Object.keys(wired).some(function (path) {
1107
- return path.startsWith(ROUTES_PREFIX);
1127
+ return path.startsWith(ROUTES_PREFIX$1);
1108
1128
  });
1109
1129
  /*
1110
1130
  * Read out before the branch, so the guard below and the call are the same
@@ -1112,11 +1132,11 @@ function _runStudioDeploy() {
1112
1132
  */
1113
1133
  generateRouteTree = options.generateRouteTree;
1114
1134
  if (!(fileBased && generateRouteTree === undefined)) {
1115
- _context2.n = 26;
1135
+ _context2.n = 28;
1116
1136
  break;
1117
1137
  }
1118
1138
  return _context2.a(2, failed("This project's pages are files under src/routes, and building those " + "needs a route generator this page was not given. Publish it from a " + "checkout, or mount the Studio in a deployment that supplies one."));
1119
- case 26:
1139
+ case 28:
1120
1140
  binaries = splitBinaryFiles((_options$committedBin3 = (_options$committedBin4 = options.committedBinaryFiles) === null || _options$committedBin4 === void 0 ? void 0 : _options$committedBin4.files) !== null && _options$committedBin3 !== void 0 ? _options$committedBin3 : {});
1121
1141
  /*
1122
1142
  * What this build ships that it is not built from, so the build's name
@@ -1129,18 +1149,18 @@ function _runStudioDeploy() {
1129
1149
  return ["carried:".concat(key), sha256];
1130
1150
  }));
1131
1151
  if (!(fileBased && generateRouteTree !== undefined)) {
1132
- _context2.n = 28;
1152
+ _context2.n = 30;
1133
1153
  break;
1134
1154
  }
1135
- _context2.n = 27;
1155
+ _context2.n = 29;
1136
1156
  return generateRouteTree(wired);
1137
- case 27:
1157
+ case 29:
1138
1158
  _t0 = _context2.v;
1139
- _context2.n = 29;
1159
+ _context2.n = 31;
1140
1160
  break;
1141
- case 28:
1161
+ case 30:
1142
1162
  _t0 = wired;
1143
- case 29:
1163
+ case 31:
1144
1164
  _t1 = _t0;
1145
1165
  _t10 = _objectSpread2(_objectSpread2({}, refetched), binaries.publicFiles);
1146
1166
  _t11 = binaries.assets;
@@ -1155,99 +1175,120 @@ function _runStudioDeploy() {
1155
1175
  target: _t13,
1156
1176
  extraInputs: _t14
1157
1177
  };
1158
- _context2.n = 30;
1178
+ _context2.n = 32;
1159
1179
  return builder.buildInputId(input)["catch"](function () {
1160
1180
  return null;
1161
1181
  });
1162
- case 30:
1182
+ case 32:
1163
1183
  name = _context2.v;
1164
1184
  if (!(name !== null)) {
1165
- _context2.n = 33;
1185
+ _context2.n = 36;
1166
1186
  break;
1167
1187
  }
1168
- _context2.n = 31;
1188
+ _context2.n = 33;
1169
1189
  return publishByName(name, {
1170
1190
  git: git,
1171
1191
  layerRev: target.project.rev
1172
1192
  });
1173
- case 31:
1193
+ case 33:
1174
1194
  held = _context2.v;
1175
1195
  if (!(held !== null)) {
1176
- _context2.n = 32;
1196
+ _context2.n = 34;
1177
1197
  break;
1178
1198
  }
1179
1199
  return _context2.a(2, held);
1180
- case 32:
1200
+ case 34:
1201
+ _stoppedNow2 = stopped();
1202
+ if (!(_stoppedNow2 !== null)) {
1203
+ _context2.n = 35;
1204
+ break;
1205
+ }
1206
+ return _context2.a(2, _stoppedNow2);
1207
+ case 35:
1181
1208
  onPhase({
1182
1209
  kind: "building"
1183
1210
  });
1184
- case 33:
1185
- _context2.n = 34;
1211
+ case 36:
1212
+ _context2.n = 37;
1186
1213
  return builder.buildUserApp(input);
1187
- case 34:
1214
+ case 37:
1188
1215
  build = _context2.v;
1189
1216
  if (!(build.cssCode === "" && options.liveStylesheet)) {
1190
- _context2.n = 37;
1217
+ _context2.n = 40;
1191
1218
  break;
1192
1219
  }
1193
- _context2.n = 35;
1220
+ _context2.n = 38;
1194
1221
  return options.liveStylesheet();
1195
- case 35:
1222
+ case 38:
1196
1223
  live = _context2.v;
1197
1224
  if (!(live !== "")) {
1198
- _context2.n = 37;
1225
+ _context2.n = 40;
1199
1226
  break;
1200
1227
  }
1201
1228
  _t15 = _objectSpread2;
1202
1229
  _t16 = _objectSpread2({}, build);
1203
1230
  _t17 = {};
1204
1231
  _t18 = live;
1205
- _context2.n = 36;
1232
+ _context2.n = 39;
1206
1233
  return builder.buildInputId(_objectSpread2(_objectSpread2({}, input), {}, {
1207
1234
  extraInputs: _objectSpread2(_objectSpread2({}, extraInputs), {}, {
1208
1235
  liveStylesheet: live
1209
1236
  })
1210
1237
  }));
1211
- case 36:
1238
+ case 39:
1212
1239
  _t19 = _context2.v;
1213
1240
  build = _t15(_t16, _t17, {
1214
1241
  cssCode: _t18,
1215
1242
  hash: _t19
1216
1243
  });
1217
- case 37:
1218
- _context2.n = 39;
1244
+ case 40:
1245
+ _context2.n = 42;
1219
1246
  break;
1220
- case 38:
1221
- _context2.p = 38;
1247
+ case 41:
1248
+ _context2.p = 41;
1222
1249
  _t20 = _context2.v;
1223
- return _context2.a(2, failed(messageOf$2(_t20)));
1224
- case 39:
1225
- _context2.p = 39;
1226
- _context2.n = 40;
1250
+ return _context2.a(2, (_stopped3 = stopped()) !== null && _stopped3 !== void 0 ? _stopped3 : failed(messageOf$2(_t20)));
1251
+ case 42:
1252
+ _context2.p = 42;
1253
+ _stoppedNow3 = stopped();
1254
+ if (!(_stoppedNow3 !== null)) {
1255
+ _context2.n = 43;
1256
+ break;
1257
+ }
1258
+ return _context2.a(2, _stoppedNow3);
1259
+ case 43:
1260
+ _context2.n = 44;
1227
1261
  return builder.publishArtifacts(build, {
1228
1262
  projectSource: wiredSource
1229
1263
  });
1230
- case 40:
1264
+ case 44:
1231
1265
  artifacts = _context2.v;
1232
- _context2.n = 42;
1266
+ _context2.n = 46;
1233
1267
  break;
1234
- case 41:
1235
- _context2.p = 41;
1268
+ case 45:
1269
+ _context2.p = 45;
1236
1270
  _t21 = _context2.v;
1237
- return _context2.a(2, failed(messageOf$2(_t21)));
1238
- case 42:
1271
+ return _context2.a(2, (_stopped4 = stopped()) !== null && _stopped4 !== void 0 ? _stopped4 : failed(messageOf$2(_t21)));
1272
+ case 46:
1273
+ stoppedAfterBuild = stopped();
1274
+ if (!(stoppedAfterBuild !== null)) {
1275
+ _context2.n = 47;
1276
+ break;
1277
+ }
1278
+ return _context2.a(2, stoppedAfterBuild);
1279
+ case 47:
1239
1280
  if (!(options.target === undefined && options.liveLayer !== undefined)) {
1240
- _context2.n = 44;
1281
+ _context2.n = 49;
1241
1282
  break;
1242
1283
  }
1243
- _context2.n = 43;
1284
+ _context2.n = 48;
1244
1285
  return options.liveLayer()["catch"](function () {
1245
1286
  return undefined;
1246
1287
  });
1247
- case 43:
1288
+ case 48:
1248
1289
  _live = _context2.v;
1249
1290
  if (!layerMoved(options.loadedLayer, _live)) {
1250
- _context2.n = 44;
1291
+ _context2.n = 49;
1251
1292
  break;
1252
1293
  }
1253
1294
  return _context2.a(2, {
@@ -1258,7 +1299,7 @@ function _runStudioDeploy() {
1258
1299
  message: STUDIO_OUT_OF_DATE_MESSAGE
1259
1300
  }]
1260
1301
  });
1261
- case 44:
1302
+ case 49:
1262
1303
  declared = [].concat(_toConsumableArray(artifacts.map(function (_ref0) {
1263
1304
  var key = _ref0.key,
1264
1305
  sha256 = _ref0.sha256,
@@ -1269,7 +1310,7 @@ function _runStudioDeploy() {
1269
1310
  bytes: bytes
1270
1311
  };
1271
1312
  })), _toConsumableArray(carriedInto(artifacts, carried, (_options$committedFil3 = options.committedFiles) !== null && _options$committedFil3 !== void 0 ? _options$committedFil3 : null)));
1272
- _context2.n = 45;
1313
+ _context2.n = 50;
1273
1314
  return runStudioPublish(_objectSpread2({
1274
1315
  client: client,
1275
1316
  artifacts: artifacts,
@@ -1293,11 +1334,11 @@ function _runStudioDeploy() {
1293
1334
  }, options.until !== undefined ? {
1294
1335
  until: options.until
1295
1336
  } : {}));
1296
- case 45:
1337
+ case 50:
1297
1338
  published = _context2.v;
1298
1339
  return _context2.a(2, asDeployResult(published));
1299
1340
  }
1300
- }, _callee2, null, [[39, 41], [15, 38], [4, 14], [1, 3]]);
1341
+ }, _callee2, null, [[42, 45], [16, 41], [4, 15], [1, 3]]);
1301
1342
  }));
1302
1343
  return _runStudioDeploy.apply(this, arguments);
1303
1344
  }
@@ -1445,6 +1486,9 @@ function carriedInto(built, carried, committed) {
1445
1486
  return key.startsWith(PUBLIC_PREFIX) && !produced.has(key) && !deleted.has(key);
1446
1487
  });
1447
1488
  }
1489
+
1490
+ /** What a deploy stopped by its `signal` answers. */
1491
+ var DEPLOY_STOPPED_MESSAGE = "The build was stopped.";
1448
1492
  var asDeployResult = function asDeployResult(published) {
1449
1493
  switch (published.status) {
1450
1494
  case "live":
@@ -2148,6 +2192,53 @@ function messageOf(error) {
2148
2192
 
2149
2193
  /** What a build of the proposal came to. */
2150
2194
 
2195
+ /** What a cancelled build answers. */
2196
+ var BUILD_CANCELLED_MESSAGE = "The build was cancelled.";
2197
+
2198
+ /**
2199
+ * Why a build stopped early, as its outcome: `signal.reason` when it was
2200
+ * stopped with an `Error` of its own -- a watchdog saying where it stalled --
2201
+ * and otherwise a cancel.
2202
+ */
2203
+ function abortedOutcome(signal) {
2204
+ var reason = signal === null || signal === void 0 ? void 0 : signal.reason;
2205
+ return reason instanceof Error && reason.name !== "AbortError" ? {
2206
+ status: "failed",
2207
+ message: reason.message
2208
+ } : {
2209
+ status: "failed",
2210
+ message: BUILD_CANCELLED_MESSAGE,
2211
+ cancelled: true
2212
+ };
2213
+ }
2214
+ var ABORTED = Symbol("aborted");
2215
+
2216
+ /**
2217
+ * `work`, or `ABORTED` as soon as `signal` is: a request that never answers
2218
+ * is not waited for once the build is stopped. The work itself is not
2219
+ * stopped by this -- the caller's `signal` does that where it can -- only no
2220
+ * longer waited for.
2221
+ */
2222
+ function orAborted(work, signal) {
2223
+ if (signal === undefined) return work;
2224
+ if (signal.aborted) return Promise.resolve(ABORTED);
2225
+ return new Promise(function (resolve, reject) {
2226
+ var onAbort = function onAbort() {
2227
+ return resolve(ABORTED);
2228
+ };
2229
+ signal.addEventListener("abort", onAbort, {
2230
+ once: true
2231
+ });
2232
+ work.then(function (value) {
2233
+ signal.removeEventListener("abort", onAbort);
2234
+ resolve(value);
2235
+ }, function (error) {
2236
+ signal.removeEventListener("abort", onAbort);
2237
+ reject(error);
2238
+ });
2239
+ });
2240
+ }
2241
+
2151
2242
  /**
2152
2243
  * Where a build of the proposal is, around the deploy: the deploy's own steps
2153
2244
  * are the Studio's deploy state (`useStudioDeployState`), and these are the
@@ -2218,7 +2309,7 @@ function buildProposal(_x) {
2218
2309
  function _buildProposal() {
2219
2310
  _buildProposal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(deps) {
2220
2311
  var _deps$now, _deps$sleep, _deps$onStep;
2221
- var now, sleep, step, read, _read, files, staged, inputs, target, asked, built, serve, servedNow, builtOf, since, served, _t2, _t3, _t4, _t5, _t6, _t7;
2312
+ var now, sleep, step, signal, read, _read, files, staged, inputs, target, asked, built, serve, servedNow, builtOf, served, since, _served, again, _t2, _t3, _t4, _t5, _t6, _t7;
2222
2313
  return _regenerator().w(function (_context3) {
2223
2314
  while (1) switch (_context3.p = _context3.n) {
2224
2315
  case 0:
@@ -2238,12 +2329,13 @@ function _buildProposal() {
2238
2329
  message: "This browser cannot build in this tab. Open the proposal in Chrome, Edge or Firefox and build it there"
2239
2330
  });
2240
2331
  case 1:
2332
+ signal = deps.signal;
2241
2333
  step({
2242
2334
  kind: "reading"
2243
2335
  });
2244
2336
  _context3.p = 2;
2245
2337
  _context3.n = 3;
2246
- return deps.client.files(deps.name);
2338
+ return orAborted(deps.client.files(deps.name), signal);
2247
2339
  case 3:
2248
2340
  read = _context3.v;
2249
2341
  _context3.n = 5;
@@ -2256,61 +2348,85 @@ function _buildProposal() {
2256
2348
  message: messageOf(_t2)
2257
2349
  });
2258
2350
  case 5:
2351
+ if (!(read === ABORTED || signal !== null && signal !== void 0 && signal.aborted)) {
2352
+ _context3.n = 6;
2353
+ break;
2354
+ }
2355
+ return _context3.a(2, abortedOutcome(signal));
2356
+ case 6:
2259
2357
  _read = read, files = _read.files, staged = _read.staged;
2260
2358
  if (!(staged.inputs === null)) {
2261
- _context3.n = 6;
2359
+ _context3.n = 7;
2262
2360
  break;
2263
2361
  }
2264
2362
  return _context3.a(2, {
2265
2363
  status: "nothing-staged"
2266
2364
  });
2267
- case 6:
2365
+ case 7:
2268
2366
  if (staged.buildRequired) {
2269
- _context3.n = 7;
2367
+ _context3.n = 8;
2270
2368
  break;
2271
2369
  }
2272
2370
  return _context3.a(2, {
2273
2371
  status: "already-built",
2274
2372
  hash: null
2275
2373
  });
2276
- case 7:
2374
+ case 8:
2277
2375
  inputs = staged.inputs;
2278
- _context3.p = 8;
2279
- _context3.n = 9;
2280
- return deps.client.buildTarget(deps.name);
2281
- case 9:
2376
+ _context3.p = 9;
2377
+ _context3.n = 10;
2378
+ return orAborted(deps.client.buildTarget(deps.name), signal);
2379
+ case 10:
2282
2380
  asked = _context3.v;
2381
+ if (!(asked === ABORTED)) {
2382
+ _context3.n = 11;
2383
+ break;
2384
+ }
2385
+ return _context3.a(2, abortedOutcome(signal));
2386
+ case 11:
2283
2387
  target = asked.layer === "own" ? asked.target : undefined;
2284
- _context3.n = 11;
2388
+ _context3.n = 13;
2285
2389
  break;
2286
- case 10:
2287
- _context3.p = 10;
2390
+ case 12:
2391
+ _context3.p = 12;
2288
2392
  _t3 = _context3.v;
2289
2393
  if (!(statusOf(_t3) !== 404)) {
2290
- _context3.n = 11;
2394
+ _context3.n = 13;
2291
2395
  break;
2292
2396
  }
2293
2397
  return _context3.a(2, {
2294
2398
  status: "failed",
2295
2399
  message: messageOf(_t3)
2296
2400
  });
2297
- case 11:
2401
+ case 13:
2402
+ if (!(signal !== null && signal !== void 0 && signal.aborted)) {
2403
+ _context3.n = 14;
2404
+ break;
2405
+ }
2406
+ return _context3.a(2, abortedOutcome(signal));
2407
+ case 14:
2298
2408
  step({
2299
2409
  kind: "deploying"
2300
2410
  });
2301
- _context3.n = 12;
2302
- return deps.deploy(withoutLockfiles(files), target);
2303
- case 12:
2411
+ _context3.n = 15;
2412
+ return orAborted(deps.deploy(withoutLockfiles(files), target, signal), signal);
2413
+ case 15:
2304
2414
  built = _context3.v;
2415
+ if (!(built === ABORTED || signal !== null && signal !== void 0 && signal.aborted)) {
2416
+ _context3.n = 16;
2417
+ break;
2418
+ }
2419
+ return _context3.a(2, abortedOutcome(signal));
2420
+ case 16:
2305
2421
  if (!(built.status !== "uploaded")) {
2306
- _context3.n = 13;
2422
+ _context3.n = 17;
2307
2423
  break;
2308
2424
  }
2309
2425
  return _context3.a(2, {
2310
2426
  status: "failed",
2311
2427
  message: built.status === "failed" ? built.message : "The build went live instead of stopping once uploaded."
2312
2428
  });
2313
- case 13:
2429
+ case 17:
2314
2430
  serve = /*#__PURE__*/function () {
2315
2431
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
2316
2432
  return _regenerator().w(function (_context) {
@@ -2362,67 +2478,300 @@ function _buildProposal() {
2362
2478
  proposal: proposal
2363
2479
  };
2364
2480
  };
2365
- _context3.p = 14;
2366
- _t4 = builtOf;
2367
- _context3.n = 15;
2368
- return serve();
2369
- case 15:
2370
- return _context3.a(2, _t4(_context3.v));
2371
- case 16:
2372
- _context3.p = 16;
2373
- _t5 = _context3.v;
2374
- if (gatewayGaveUp(_t5)) {
2375
- _context3.n = 17;
2481
+ _context3.p = 18;
2482
+ _context3.n = 19;
2483
+ return orAborted(serve(), signal);
2484
+ case 19:
2485
+ served = _context3.v;
2486
+ if (!(served === ABORTED)) {
2487
+ _context3.n = 20;
2488
+ break;
2489
+ }
2490
+ return _context3.a(2, abortedOutcome(signal));
2491
+ case 20:
2492
+ return _context3.a(2, builtOf(served));
2493
+ case 21:
2494
+ _context3.p = 21;
2495
+ _t4 = _context3.v;
2496
+ if (gatewayGaveUp(_t4)) {
2497
+ _context3.n = 22;
2376
2498
  break;
2377
2499
  }
2378
2500
  return _context3.a(2, {
2379
2501
  status: "failed",
2380
- message: messageOf(_t5)
2502
+ message: messageOf(_t4)
2381
2503
  });
2382
- case 17:
2504
+ case 22:
2383
2505
  since = now();
2384
2506
  step({
2385
2507
  kind: "waiting",
2386
2508
  since: since
2387
2509
  });
2388
- case 18:
2510
+ case 23:
2389
2511
  if (!(now() - since < SERVE_WAIT_MS)) {
2390
- _context3.n = 22;
2512
+ _context3.n = 29;
2391
2513
  break;
2392
2514
  }
2393
- _context3.n = 19;
2394
- return sleep(SERVE_POLL_MS);
2395
- case 19:
2396
- _context3.n = 20;
2397
- return servedNow();
2398
- case 20:
2399
- served = _context3.v;
2400
- if (!(served !== null)) {
2401
- _context3.n = 21;
2515
+ _context3.n = 24;
2516
+ return orAborted(sleep(SERVE_POLL_MS), signal);
2517
+ case 24:
2518
+ _t5 = _context3.v;
2519
+ _t6 = ABORTED;
2520
+ if (!(_t5 === _t6)) {
2521
+ _context3.n = 25;
2402
2522
  break;
2403
2523
  }
2404
- return _context3.a(2, builtOf(served));
2405
- case 21:
2406
- _context3.n = 18;
2407
- break;
2408
- case 22:
2409
- _context3.p = 22;
2410
- _t6 = builtOf;
2524
+ return _context3.a(2, abortedOutcome(signal));
2525
+ case 25:
2526
+ _context3.n = 26;
2527
+ return orAborted(servedNow(), signal);
2528
+ case 26:
2529
+ _served = _context3.v;
2530
+ if (!(_served === ABORTED)) {
2531
+ _context3.n = 27;
2532
+ break;
2533
+ }
2534
+ return _context3.a(2, abortedOutcome(signal));
2535
+ case 27:
2536
+ if (!(_served !== null)) {
2537
+ _context3.n = 28;
2538
+ break;
2539
+ }
2540
+ return _context3.a(2, builtOf(_served));
2541
+ case 28:
2411
2542
  _context3.n = 23;
2412
- return serve();
2413
- case 23:
2414
- return _context3.a(2, _t6(_context3.v));
2415
- case 24:
2416
- _context3.p = 24;
2543
+ break;
2544
+ case 29:
2545
+ _context3.p = 29;
2546
+ _context3.n = 30;
2547
+ return orAborted(serve(), signal);
2548
+ case 30:
2549
+ again = _context3.v;
2550
+ if (!(again === ABORTED)) {
2551
+ _context3.n = 31;
2552
+ break;
2553
+ }
2554
+ return _context3.a(2, abortedOutcome(signal));
2555
+ case 31:
2556
+ return _context3.a(2, builtOf(again));
2557
+ case 32:
2558
+ _context3.p = 32;
2417
2559
  _t7 = _context3.v;
2418
2560
  return _context3.a(2, {
2419
2561
  status: "failed",
2420
2562
  message: messageOf(_t7)
2421
2563
  });
2422
2564
  }
2423
- }, _callee3, null, [[22, 24], [14, 16], [8, 10], [2, 4]]);
2565
+ }, _callee3, null, [[29, 32], [18, 21], [9, 12], [2, 4]]);
2424
2566
  }));
2425
2567
  return _buildProposal.apply(this, arguments);
2426
2568
  }
2427
2569
 
2428
- export { MergePrepareAnswer, RENEW_EVERY_MS, SERVE_POLL_MS, SERVE_WAIT_MS, STUDIO_OUT_OF_DATE, STUDIO_OUT_OF_DATE_MESSAGE, StudioPublishError, StudioUploadError, buildProposal, callJson, carriedInto, createStudioJobClient, createStudioPublishClient, isExpiredSlot, isMergeChange, isTransientPublishError, layerMoved, loadedLayer, markStudioOutOfDate, onPublishRefusal, publishApiOf, readLiveLayer, rememberLoadedLayer, resetLoadedLayerForTests, runJobToEnd, runStudioDeploy, runStudioJob, runStudioPublish, siteMovedSinceLoad, splitBinaryFiles, studioOutOfDateRefusals, subscribeStudioOutOfDate, withCommittedFiles, withoutLockfiles };
2570
+ /*
2571
+ * A quick preview's files: the proposal's app bundled in the tab, for the
2572
+ * browser half only (`quickPreview.ts` in `../internal` says what a quick
2573
+ * preview is and what it cannot show). Nothing is uploaded and nothing is
2574
+ * served: the files go to the page in the preview, whose worker hands them to
2575
+ * a page opened as the preview.
2576
+ */
2577
+
2578
+ /** Where a site's routes live: the generator is needed when there are any. */
2579
+ var ROUTES_PREFIX = "src/routes/";
2580
+ function buildQuickPreview(_x) {
2581
+ return _buildQuickPreview.apply(this, arguments);
2582
+ }
2583
+
2584
+ /**
2585
+ * The browser half of a build, as the worker serves it under `/_app/`. The
2586
+ * stylesheet only when the tab compiled one: an empty one is the case where a
2587
+ * build ships the site's live stylesheet (`liveStylesheet` on
2588
+ * `runStudioDeploy`), and the page already has that.
2589
+ */
2590
+ function _buildQuickPreview() {
2591
+ _buildQuickPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(deps) {
2592
+ var _deps$onStep;
2593
+ var step, failed, stopped, _yield$Promise$all, _yield$Promise$all2, read, site, asked, target, stoppedNow, builder, project, fileBased, files, stoppedBeforeBuild, build, stoppedAfterBuild, _stopped, _t, _t2;
2594
+ return _regenerator().w(function (_context) {
2595
+ while (1) switch (_context.p = _context.n) {
2596
+ case 0:
2597
+ step = (_deps$onStep = deps.onStep) !== null && _deps$onStep !== void 0 ? _deps$onStep : function () {};
2598
+ failed = function failed(message) {
2599
+ return {
2600
+ status: "failed",
2601
+ message: message
2602
+ };
2603
+ };
2604
+ stopped = function stopped() {
2605
+ var _deps$signal;
2606
+ return (_deps$signal = deps.signal) !== null && _deps$signal !== void 0 && _deps$signal.aborted ? failed("The quick preview was cancelled.") : null;
2607
+ };
2608
+ _context.p = 1;
2609
+ step("Reading the proposal");
2610
+ _context.n = 2;
2611
+ return Promise.all([deps.proposals.files(deps.name), deps.siteSource(), deps.proposals.buildTarget(deps.name)["catch"](function () {
2612
+ return null;
2613
+ })]);
2614
+ case 2:
2615
+ _yield$Promise$all = _context.v;
2616
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
2617
+ read = _yield$Promise$all2[0];
2618
+ site = _yield$Promise$all2[1];
2619
+ asked = _yield$Promise$all2[2];
2620
+ if (!(site === null)) {
2621
+ _context.n = 3;
2622
+ break;
2623
+ }
2624
+ return _context.a(2, failed("The site has no published source to build a preview from. Build the proposal instead."));
2625
+ case 3:
2626
+ if (!((asked === null || asked === void 0 ? void 0 : asked.layer) === "own")) {
2627
+ _context.n = 4;
2628
+ break;
2629
+ }
2630
+ return _context.a(2, failed("This proposal changes the site's dependencies, which a quick preview cannot load. Build the proposal to see it."));
2631
+ case 4:
2632
+ _context.n = 5;
2633
+ return deps.siteTarget();
2634
+ case 5:
2635
+ target = _context.v;
2636
+ if (!(target.project.rev === null)) {
2637
+ _context.n = 6;
2638
+ break;
2639
+ }
2640
+ return _context.a(2, failed("The site has no dependency layer yet. Build the proposal to see it."));
2641
+ case 6:
2642
+ stoppedNow = stopped();
2643
+ if (!(stoppedNow !== null)) {
2644
+ _context.n = 7;
2645
+ break;
2646
+ }
2647
+ return _context.a(2, stoppedNow);
2648
+ case 7:
2649
+ step("Loading the builder");
2650
+ _context.n = 8;
2651
+ return deps.loadBuilder();
2652
+ case 8:
2653
+ builder = _context.v;
2654
+ project = withoutLockfiles(proposalProject(site, read.files));
2655
+ fileBased = Object.keys(project).some(function (path) {
2656
+ return path.startsWith(ROUTES_PREFIX);
2657
+ });
2658
+ if (!(fileBased && deps.generateRouteTree === undefined)) {
2659
+ _context.n = 9;
2660
+ break;
2661
+ }
2662
+ return _context.a(2, failed("This page cannot generate the site's route tree, so it cannot build a preview. Build the proposal instead."));
2663
+ case 9:
2664
+ step("Building");
2665
+ if (!(fileBased && deps.generateRouteTree !== undefined)) {
2666
+ _context.n = 11;
2667
+ break;
2668
+ }
2669
+ _context.n = 10;
2670
+ return deps.generateRouteTree(project);
2671
+ case 10:
2672
+ _t = _context.v;
2673
+ _context.n = 12;
2674
+ break;
2675
+ case 11:
2676
+ _t = project;
2677
+ case 12:
2678
+ files = _t;
2679
+ stoppedBeforeBuild = stopped();
2680
+ if (!(stoppedBeforeBuild !== null)) {
2681
+ _context.n = 13;
2682
+ break;
2683
+ }
2684
+ return _context.a(2, stoppedBeforeBuild);
2685
+ case 13:
2686
+ _context.n = 14;
2687
+ return builder.buildUserApp({
2688
+ files: files,
2689
+ publicFiles: {},
2690
+ assets: {},
2691
+ projectSource: project,
2692
+ target: target,
2693
+ extraInputs: {}
2694
+ });
2695
+ case 14:
2696
+ build = _context.v;
2697
+ stoppedAfterBuild = stopped();
2698
+ if (!(stoppedAfterBuild !== null)) {
2699
+ _context.n = 15;
2700
+ break;
2701
+ }
2702
+ return _context.a(2, stoppedAfterBuild);
2703
+ case 15:
2704
+ return _context.a(2, {
2705
+ status: "built",
2706
+ files: clientFilesOf(build),
2707
+ inputs: read.staged.inputs
2708
+ });
2709
+ case 16:
2710
+ _context.p = 16;
2711
+ _t2 = _context.v;
2712
+ return _context.a(2, (_stopped = stopped()) !== null && _stopped !== void 0 ? _stopped : failed(_t2 instanceof Error ? _t2.message : String(_t2)));
2713
+ }
2714
+ }, _callee, null, [[1, 16]]);
2715
+ }));
2716
+ return _buildQuickPreview.apply(this, arguments);
2717
+ }
2718
+ function clientFilesOf(build) {
2719
+ var files = {
2720
+ "app.js": {
2721
+ body: build.clientCode,
2722
+ contentType: JS
2723
+ }
2724
+ };
2725
+ for (var _i = 0, _Object$entries = Object.entries(build.clientChunks); _i < _Object$entries.length; _i++) {
2726
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2727
+ name = _Object$entries$_i[0],
2728
+ code = _Object$entries$_i[1];
2729
+ files[name] = {
2730
+ body: code,
2731
+ contentType: JS
2732
+ };
2733
+ }
2734
+ if (build.cssCode !== "") {
2735
+ files["app.css"] = {
2736
+ body: build.cssCode,
2737
+ contentType: "text/css"
2738
+ };
2739
+ }
2740
+ for (var _i2 = 0, _Object$entries2 = Object.entries(build.assetFiles); _i2 < _Object$entries2.length; _i2++) {
2741
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
2742
+ _name = _Object$entries2$_i[0],
2743
+ base64 = _Object$entries2$_i[1];
2744
+ files["a/".concat(_name)] = {
2745
+ body: base64,
2746
+ contentType: contentTypeOf(_name),
2747
+ base64: true
2748
+ };
2749
+ }
2750
+ return files;
2751
+ }
2752
+ var JS = "text/javascript; charset=utf-8";
2753
+ var CONTENT_TYPES = {
2754
+ png: "image/png",
2755
+ jpg: "image/jpeg",
2756
+ jpeg: "image/jpeg",
2757
+ gif: "image/gif",
2758
+ webp: "image/webp",
2759
+ avif: "image/avif",
2760
+ svg: "image/svg+xml",
2761
+ ico: "image/x-icon",
2762
+ woff: "font/woff",
2763
+ woff2: "font/woff2",
2764
+ ttf: "font/ttf",
2765
+ otf: "font/otf",
2766
+ mp4: "video/mp4",
2767
+ webm: "video/webm",
2768
+ json: "application/json",
2769
+ txt: "text/plain"
2770
+ };
2771
+ function contentTypeOf(name) {
2772
+ var _CONTENT_TYPES$extens;
2773
+ var extension = name.slice(name.lastIndexOf(".") + 1).toLowerCase();
2774
+ return (_CONTENT_TYPES$extens = CONTENT_TYPES[extension]) !== null && _CONTENT_TYPES$extens !== void 0 ? _CONTENT_TYPES$extens : "application/octet-stream";
2775
+ }
2776
+
2777
+ export { BUILD_CANCELLED_MESSAGE, DEPLOY_STOPPED_MESSAGE, MergePrepareAnswer, RENEW_EVERY_MS, SERVE_POLL_MS, SERVE_WAIT_MS, STUDIO_OUT_OF_DATE, STUDIO_OUT_OF_DATE_MESSAGE, StudioPublishError, StudioUploadError, buildProposal, buildQuickPreview, callJson, carriedInto, clientFilesOf, createStudioJobClient, createStudioPublishClient, isExpiredSlot, isMergeChange, isTransientPublishError, layerMoved, loadedLayer, markStudioOutOfDate, onPublishRefusal, publishApiOf, readLiveLayer, rememberLoadedLayer, resetLoadedLayerForTests, runJobToEnd, runStudioDeploy, runStudioJob, runStudioPublish, siteMovedSinceLoad, splitBinaryFiles, studioOutOfDateRefusals, subscribeStudioOutOfDate, withCommittedFiles, withoutLockfiles };