@valbuild/core 0.97.7 → 0.99.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.
@@ -1177,27 +1177,28 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1177
1177
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1178
1178
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1179
1179
  var description = arguments.length > 5 ? arguments[5] : undefined;
1180
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
1180
1181
  _classCallCheck(this, ArraySchema);
1181
1182
  _this = _callSuper(this, ArraySchema);
1182
- _defineProperty(_this, "renderInput", null);
1183
1183
  _this.item = item;
1184
1184
  _this.opt = opt;
1185
1185
  _this.customValidateFunctions = customValidateFunctions;
1186
1186
  _this.isReadonly = isReadonly;
1187
1187
  _this.isHidden = isHidden;
1188
1188
  _this.description = description;
1189
+ _this.renderInput = renderInput;
1189
1190
  return _this;
1190
1191
  }
1191
1192
  _inherits(ArraySchema, _Schema);
1192
1193
  return _createClass(ArraySchema, [{
1193
1194
  key: "describe",
1194
1195
  value: function describe(description) {
1195
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
1196
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput);
1196
1197
  }
1197
1198
  }, {
1198
1199
  key: "validate",
1199
1200
  value: function validate(validationFunction) {
1200
- return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
1201
+ return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput);
1201
1202
  }
1202
1203
  }, {
1203
1204
  key: "executeValidate",
@@ -1264,17 +1265,17 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1264
1265
  }, {
1265
1266
  key: "nullable",
1266
1267
  value: function nullable() {
1267
- return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description);
1268
+ return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput);
1268
1269
  }
1269
1270
  }, {
1270
1271
  key: "readonly",
1271
1272
  value: function readonly() {
1272
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
1273
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput);
1273
1274
  }
1274
1275
  }, {
1275
1276
  key: "hidden",
1276
1277
  value: function hidden() {
1277
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1278
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput);
1278
1279
  }
1279
1280
  }, {
1280
1281
  key: "executeSerialize",
@@ -1354,8 +1355,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1354
1355
  }, {
1355
1356
  key: "render",
1356
1357
  value: function render(input) {
1357
- this.renderInput = input;
1358
- return this;
1358
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input);
1359
1359
  }
1360
1360
  }]);
1361
1361
  }(Schema);
@@ -2948,9 +2948,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
2948
2948
  var isReadonly = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
2949
2949
  var isHidden = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
2950
2950
  var description = arguments.length > 8 ? arguments[8] : undefined;
2951
+ var renderInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
2951
2952
  _classCallCheck(this, RecordSchema);
2952
2953
  _this = _callSuper(this, RecordSchema);
2953
- _defineProperty(_this, "renderInput", null);
2954
2954
  _this.item = item;
2955
2955
  _this.opt = opt;
2956
2956
  _this.customValidateFunctions = customValidateFunctions;
@@ -2960,18 +2960,19 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
2960
2960
  _this.isReadonly = isReadonly;
2961
2961
  _this.isHidden = isHidden;
2962
2962
  _this.description = description;
2963
+ _this.renderInput = renderInput;
2963
2964
  return _this;
2964
2965
  }
2965
2966
  _inherits(RecordSchema, _Schema);
2966
2967
  return _createClass(RecordSchema, [{
2967
2968
  key: "describe",
2968
2969
  value: function describe(description) {
2969
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
2970
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput);
2970
2971
  }
2971
2972
  }, {
2972
2973
  key: "validate",
2973
2974
  value: function validate(validationFunction) {
2974
- return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
2975
+ return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
2975
2976
  }
2976
2977
  }, {
2977
2978
  key: "executeValidate",
@@ -3154,6 +3155,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3154
3155
  value: key
3155
3156
  }]);
3156
3157
  }
3158
+ // Local path in a remote gallery: needs to be uploaded to remote.
3159
+ var uploadRemoteFix = type === "images" ? "images:upload-remote" : "files:upload-remote";
3160
+ return _defineProperty({}, path, [{
3161
+ message: "Expected a remote ".concat(type === "images" ? "image" : "file", ", but got a local path. Use Val tooling (CLI --fix, VS Code extension, or Val Studio) to upload it. Got: ").concat(key),
3162
+ value: key,
3163
+ fixes: [uploadRemoteFix]
3164
+ }]);
3157
3165
  } else {
3158
3166
  // When remote is disabled, only accept local paths
3159
3167
  if (isRemoteUrl) {
@@ -3320,29 +3328,29 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3320
3328
  }, {
3321
3329
  key: "nullable",
3322
3330
  value: function nullable() {
3323
- return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
3331
+ return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
3324
3332
  }
3325
3333
  }, {
3326
3334
  key: "readonly",
3327
3335
  value: function readonly() {
3328
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description);
3336
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description, this.renderInput);
3329
3337
  }
3330
3338
  }, {
3331
3339
  key: "hidden",
3332
3340
  value: function hidden() {
3333
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description);
3341
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description, this.renderInput);
3334
3342
  }
3335
3343
  }, {
3336
3344
  key: "router",
3337
3345
  value: function router(_router) {
3338
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description);
3346
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
3339
3347
  }
3340
3348
  }, {
3341
3349
  key: "remote",
3342
3350
  value: function remote() {
3343
3351
  return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
3344
3352
  remote: true
3345
- }) : undefined, this.isReadonly, this.isHidden, this.description);
3353
+ }) : undefined, this.isReadonly, this.isHidden, this.description, this.renderInput);
3346
3354
  }
3347
3355
  }, {
3348
3356
  key: "getRouterValidations",
@@ -3447,10 +3455,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3447
3455
  data: {
3448
3456
  layout: "list",
3449
3457
  parent: "record",
3450
- items: Object.entries(src).map(function (_ref13) {
3451
- var _ref14 = _slicedToArray(_ref13, 2),
3452
- key = _ref14[0],
3453
- val = _ref14[1];
3458
+ items: Object.entries(src).map(function (_ref14) {
3459
+ var _ref15 = _slicedToArray(_ref14, 2),
3460
+ key = _ref15[0],
3461
+ val = _ref15[1];
3454
3462
  // NB NB: display is actually defined by the user
3455
3463
  var _prepare = prepare({
3456
3464
  key: key,
@@ -3479,11 +3487,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3479
3487
  }, {
3480
3488
  key: "render",
3481
3489
  value: function render(input) {
3482
- this.renderInput = {
3490
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, {
3483
3491
  layout: input.as,
3484
3492
  select: input.select
3485
- };
3486
- return this;
3493
+ });
3487
3494
  }
3488
3495
  }]);
3489
3496
  }(Schema);
@@ -5155,24 +5162,6 @@ function modules(config, modules) {
5155
5162
  };
5156
5163
  }
5157
5164
 
5158
- function _regeneratorValues(e) {
5159
- if (null != e) {
5160
- var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
5161
- r = 0;
5162
- if (t) return t.call(e);
5163
- if ("function" == typeof e.next) return e;
5164
- if (!isNaN(e.length)) return {
5165
- next: function () {
5166
- return e && r >= e.length && (e = void 0), {
5167
- value: e && e[r++],
5168
- done: !e
5169
- };
5170
- }
5171
- };
5172
- }
5173
- throw new TypeError(typeof e + " is not iterable");
5174
- }
5175
-
5176
5165
  function _regeneratorDefine(e, r, n, t) {
5177
5166
  var i = Object.defineProperty;
5178
5167
  try {
@@ -5642,10 +5631,11 @@ var getSHA256Hash = function getSHA256Hash(bits) {
5642
5631
  return createHash().update(bits).digest("hex");
5643
5632
  };
5644
5633
 
5645
- // Lazily constructed: this module is also evaluated inside the QuickJS
5646
- // sandbox (when user val modules import @valbuild/core), and that sandbox
5647
- // has no `TextEncoder` global. `hash()` is never called from inside the
5648
- // sandbox, so deferring construction avoids a ReferenceError at import time.
5634
+ // Lazily constructed: this module is also evaluated inside the `vm` sandbox
5635
+ // used by loadValModules (when user val modules import @valbuild/core), and
5636
+ // that sandbox has no `TextEncoder` global. `hash()` is never called from
5637
+ // inside the sandbox, so deferring construction avoids a ReferenceError at
5638
+ // import time.
5649
5639
  var textEncoder;
5650
5640
  function getTextEncoder() {
5651
5641
  if (!textEncoder) {
@@ -5653,6 +5643,29 @@ function getTextEncoder() {
5653
5643
  }
5654
5644
  return textEncoder;
5655
5645
  }
5646
+ function errorMessage(e) {
5647
+ // NOT `e instanceof Error`. Val modules are evaluated inside a `node:vm`
5648
+ // context, so an error thrown from inside the sandbox is built from THAT
5649
+ // realm's Error constructor and fails the instanceof check - and
5650
+ // JSON.stringify flattens it to "{}", throwing away the only useful part.
5651
+ // Duck-type the message instead (the same reason the schema check below
5652
+ // avoids `instanceof Schema`).
5653
+ if (_typeof(e) === "object" && e !== null && "message" in e) {
5654
+ var message = e.message;
5655
+ if (typeof message === "string") {
5656
+ return message;
5657
+ }
5658
+ }
5659
+ if (typeof e === "string") {
5660
+ return e;
5661
+ }
5662
+ try {
5663
+ var _JSON$stringify;
5664
+ return (_JSON$stringify = JSON.stringify(e)) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : String(e);
5665
+ } catch (_unused) {
5666
+ return String(e);
5667
+ }
5668
+ }
5656
5669
  function hash(input) {
5657
5670
  if (_typeof(input) === "object") {
5658
5671
  return hashObject(input);
@@ -5707,127 +5720,159 @@ function extractValModules(_x) {
5707
5720
  }
5708
5721
  function _extractValModules() {
5709
5722
  _extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
5710
- var moduleErrors, addModuleError, sources, schemas, serializedSchemas, configSha, sourcesSha, baseSha, schemaSha, _loop, _ret, moduleIdx;
5711
- return _regenerator().w(function (_context2) {
5712
- while (1) switch (_context2.n) {
5723
+ var moduleErrors, addModuleError, sources, schemas, serializedSchemas, configSha, sourcesSha, baseSha, schemaSha, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM, _t, _t2;
5724
+ return _regenerator().w(function (_context) {
5725
+ while (1) switch (_context.p = _context.n) {
5713
5726
  case 0:
5714
- moduleErrors = [];
5715
- addModuleError = function addModuleError(message, index, path) {
5716
- moduleErrors[index] = {
5727
+ moduleErrors = []; // NOTE: push (not index assignment) - a sparse array makes consumers that
5728
+ // use Array.prototype.find (which visits holes) crash on undefined entries.
5729
+ addModuleError = function addModuleError(message, path) {
5730
+ moduleErrors.push({
5717
5731
  message: message,
5718
5732
  path: path
5719
- };
5733
+ });
5720
5734
  };
5721
5735
  sources = {};
5722
5736
  schemas = {};
5723
5737
  serializedSchemas = {};
5724
5738
  configSha = hash(JSON.stringify(valModules.config));
5725
5739
  sourcesSha = "";
5726
- baseSha = configSha;
5727
- schemaSha = configSha;
5728
- _loop = /*#__PURE__*/_regenerator().m(function _loop(moduleIdx) {
5729
- var module;
5730
- return _regenerator().w(function (_context) {
5731
- while (1) switch (_context.n) {
5732
- case 0:
5733
- module = valModules.modules[moduleIdx];
5734
- if (module.def) {
5735
- _context.n = 1;
5736
- break;
5737
- }
5738
- addModuleError("val.modules is missing 'def' property", moduleIdx);
5739
- return _context.a(2, 0);
5740
- case 1:
5741
- if (!(typeof module.def !== "function")) {
5742
- _context.n = 2;
5743
- break;
5744
- }
5745
- addModuleError("val.modules 'def' property is not a function", moduleIdx);
5746
- return _context.a(2, 0);
5747
- case 2:
5748
- _context.n = 3;
5749
- return module.def().then(function (value) {
5750
- if (!value) {
5751
- addModuleError("val.modules 'def' did not return a value", moduleIdx);
5752
- return;
5753
- }
5754
- if (!value["default"]) {
5755
- addModuleError("val.modules 'def' did not return a default export", moduleIdx);
5756
- return;
5757
- }
5758
- var path = getValPath(value["default"]);
5759
- if (path === undefined) {
5760
- addModuleError("path is undefined", moduleIdx);
5761
- return;
5762
- }
5763
- var schema = getSchema(value["default"]);
5764
- if (schema === undefined) {
5765
- addModuleError("schema in path '".concat(path, "' is undefined"), moduleIdx, path);
5766
- return;
5767
- }
5768
- // Avoid `schema instanceof Schema` — the editor SPA and the host
5769
- // Next.js bundle each ship their own copy of @valbuild/core, so the
5770
- // `Schema` class identity differs between them and the instanceof
5771
- // check would fail for cross-bundle modules. The executeSerialize
5772
- // check below is the actual contract we depend on.
5773
- if (typeof schema["executeSerialize"] !== "function") {
5774
- addModuleError("schema.serialize in path '".concat(path, "' is not a function"), moduleIdx, path);
5775
- return;
5776
- }
5777
- var source = getSource(value["default"]);
5778
- if (source === undefined) {
5779
- addModuleError("source in ".concat(path, " is undefined"), moduleIdx, path);
5780
- return;
5781
- }
5782
- var serializedSchema;
5783
- try {
5784
- serializedSchema = schema["executeSerialize"]();
5785
- } catch (e) {
5786
- var message = e instanceof Error ? e.message : JSON.stringify(e);
5787
- addModuleError("Could not serialize module: '".concat(path, "'. Error: ").concat(message), moduleIdx, path);
5788
- return;
5789
- }
5790
- var pathM = path;
5791
- sources[pathM] = source;
5792
- schemas[pathM] = schema;
5793
- serializedSchemas[pathM] = serializedSchema;
5794
- sourcesSha = hash(sourcesSha + JSON.stringify({
5795
- path: path,
5796
- source: source
5797
- }));
5798
- baseSha = hash(baseSha + JSON.stringify({
5799
- path: path,
5800
- schema: serializedSchema,
5801
- source: source,
5802
- modulesErrors: moduleErrors
5803
- }));
5804
- schemaSha = hash(schemaSha + JSON.stringify(serializedSchema));
5805
- });
5806
- case 3:
5807
- return _context.a(2);
5808
- }
5809
- }, _loop);
5810
- });
5740
+ baseSha = configSha; // NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
5741
+ // across bundles (the server extracts from the Node bundle, the editor SPA
5742
+ // from the browser bundle) to detect that a new version has been deployed.
5743
+ // The config contains values that are not part of the schema and that differ
5744
+ // between those two bundles - most notably the documented
5745
+ // `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
5746
+ // server-only env vars and therefore `undefined` in the browser. Seeding with
5747
+ // them made the two sides disagree on every production load.
5748
+ schemaSha = "";
5811
5749
  moduleIdx = 0;
5812
5750
  case 1:
5813
5751
  if (!(moduleIdx < valModules.modules.length)) {
5814
- _context2.n = 4;
5752
+ _context.n = 18;
5753
+ break;
5754
+ }
5755
+ module = valModules.modules[moduleIdx]; // NOTE: `at index N` refers to the module's position in the val.modules
5756
+ // array, which is all we can name when the module never loaded.
5757
+ at = "at index ".concat(moduleIdx);
5758
+ if (module.def) {
5759
+ _context.n = 2;
5815
5760
  break;
5816
5761
  }
5817
- return _context2.d(_regeneratorValues(_loop(moduleIdx)), 2);
5762
+ addModuleError("val.modules ".concat(at, " is missing 'def' property"));
5763
+ return _context.a(3, 17);
5818
5764
  case 2:
5819
- _ret = _context2.v;
5820
- if (!(_ret === 0)) {
5821
- _context2.n = 3;
5765
+ if (!(typeof module.def !== "function")) {
5766
+ _context.n = 3;
5822
5767
  break;
5823
5768
  }
5824
- return _context2.a(3, 3);
5769
+ addModuleError("val.modules ".concat(at, " 'def' property is not a function"));
5770
+ return _context.a(3, 17);
5825
5771
  case 3:
5772
+ value = void 0;
5773
+ _context.p = 4;
5774
+ _context.n = 5;
5775
+ return module.def();
5776
+ case 5:
5777
+ value = _context.v;
5778
+ _context.n = 7;
5779
+ break;
5780
+ case 6:
5781
+ _context.p = 6;
5782
+ _t = _context.v;
5783
+ // A module that throws while importing (a syntax error, a throwing
5784
+ // top-level statement, a missing file) has to be reported like any other
5785
+ // module error. Letting it reject aborts the whole extraction, which on
5786
+ // the server means ValOps.initSources rejects and /stat, /schema and
5787
+ // /sources/~ all fail opaquely instead of naming the broken module.
5788
+ addModuleError("val.modules 'def' ".concat(at, " could not be loaded. Error: ").concat(errorMessage(_t)));
5789
+ return _context.a(3, 17);
5790
+ case 7:
5791
+ if (value) {
5792
+ _context.n = 8;
5793
+ break;
5794
+ }
5795
+ addModuleError("val.modules 'def' ".concat(at, " did not return a value"));
5796
+ return _context.a(3, 17);
5797
+ case 8:
5798
+ if (value["default"]) {
5799
+ _context.n = 9;
5800
+ break;
5801
+ }
5802
+ addModuleError("val.modules 'def' ".concat(at, " did not return a default export"));
5803
+ return _context.a(3, 17);
5804
+ case 9:
5805
+ path = getValPath(value["default"]);
5806
+ if (!(path === undefined)) {
5807
+ _context.n = 10;
5808
+ break;
5809
+ }
5810
+ addModuleError("path is undefined for val.modules 'def' ".concat(at));
5811
+ return _context.a(3, 17);
5812
+ case 10:
5813
+ schema = getSchema(value["default"]);
5814
+ if (!(schema === undefined)) {
5815
+ _context.n = 11;
5816
+ break;
5817
+ }
5818
+ addModuleError("schema in path '".concat(path, "' is undefined"), path);
5819
+ return _context.a(3, 17);
5820
+ case 11:
5821
+ if (!(typeof schema["executeSerialize"] !== "function")) {
5822
+ _context.n = 12;
5823
+ break;
5824
+ }
5825
+ addModuleError("schema.serialize in path '".concat(path, "' is not a function"), path);
5826
+ return _context.a(3, 17);
5827
+ case 12:
5828
+ source = getSource(value["default"]);
5829
+ if (!(source === undefined)) {
5830
+ _context.n = 13;
5831
+ break;
5832
+ }
5833
+ addModuleError("source in ".concat(path, " is undefined"), path);
5834
+ return _context.a(3, 17);
5835
+ case 13:
5836
+ serializedSchema = void 0;
5837
+ _context.p = 14;
5838
+ serializedSchema = schema["executeSerialize"]();
5839
+ _context.n = 16;
5840
+ break;
5841
+ case 15:
5842
+ _context.p = 15;
5843
+ _t2 = _context.v;
5844
+ addModuleError("Could not serialize module: '".concat(path, "'. Error: ").concat(errorMessage(_t2)), path);
5845
+ return _context.a(3, 17);
5846
+ case 16:
5847
+ pathM = path;
5848
+ sources[pathM] = source;
5849
+ schemas[pathM] = schema;
5850
+ serializedSchemas[pathM] = serializedSchema;
5851
+ sourcesSha = hash(sourcesSha + JSON.stringify({
5852
+ path: path,
5853
+ source: source
5854
+ }));
5855
+ baseSha = hash(baseSha + JSON.stringify({
5856
+ path: path,
5857
+ schema: serializedSchema,
5858
+ source: source,
5859
+ modulesErrors: moduleErrors
5860
+ }));
5861
+ // The PATH is part of the schema set, not just the schema: renaming a
5862
+ // module while leaving its schema byte-identical still changes which paths
5863
+ // exist, and an open client keyed its schema cache by the old path. Hashing
5864
+ // the schema alone left this SHA unchanged, so with no commitSha to fall
5865
+ // back on the client never refetched /schema.
5866
+ schemaSha = hash(schemaSha + JSON.stringify({
5867
+ path: path,
5868
+ schema: serializedSchema
5869
+ }));
5870
+ case 17:
5826
5871
  moduleIdx++;
5827
- _context2.n = 1;
5872
+ _context.n = 1;
5828
5873
  break;
5829
- case 4:
5830
- return _context2.a(2, {
5874
+ case 18:
5875
+ return _context.a(2, {
5831
5876
  sources: sources,
5832
5877
  schemas: schemas,
5833
5878
  serializedSchemas: serializedSchemas,
@@ -5838,7 +5883,7 @@ function _extractValModules() {
5838
5883
  moduleErrors: moduleErrors
5839
5884
  });
5840
5885
  }
5841
- }, _callee);
5886
+ }, _callee, null, [[14, 15], [4, 6]]);
5842
5887
  }));
5843
5888
  return _extractValModules.apply(this, arguments);
5844
5889
  }