@valbuild/core 0.99.0 → 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.
- package/dist/declarations/src/schema/array.d.ts +14 -12
- package/dist/declarations/src/schema/record.d.ts +14 -3
- package/dist/{index-d152e3e2.esm.js → index-204b5d78.esm.js} +176 -139
- package/dist/{index-11f47a61.cjs.prod.js → index-28d99c34.cjs.prod.js} +176 -139
- package/dist/{index-233a49d6.cjs.dev.js → index-b2601ac3.cjs.dev.js} +176 -139
- package/dist/valbuild-core.cjs.dev.js +1 -1
- package/dist/valbuild-core.cjs.prod.js +1 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -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.
|
|
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",
|
|
@@ -3327,29 +3328,29 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3327
3328
|
}, {
|
|
3328
3329
|
key: "nullable",
|
|
3329
3330
|
value: function nullable() {
|
|
3330
|
-
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);
|
|
3331
3332
|
}
|
|
3332
3333
|
}, {
|
|
3333
3334
|
key: "readonly",
|
|
3334
3335
|
value: function readonly() {
|
|
3335
|
-
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);
|
|
3336
3337
|
}
|
|
3337
3338
|
}, {
|
|
3338
3339
|
key: "hidden",
|
|
3339
3340
|
value: function hidden() {
|
|
3340
|
-
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);
|
|
3341
3342
|
}
|
|
3342
3343
|
}, {
|
|
3343
3344
|
key: "router",
|
|
3344
3345
|
value: function router(_router) {
|
|
3345
|
-
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);
|
|
3346
3347
|
}
|
|
3347
3348
|
}, {
|
|
3348
3349
|
key: "remote",
|
|
3349
3350
|
value: function remote() {
|
|
3350
3351
|
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
|
|
3351
3352
|
remote: true
|
|
3352
|
-
}) : undefined, this.isReadonly, this.isHidden, this.description);
|
|
3353
|
+
}) : undefined, this.isReadonly, this.isHidden, this.description, this.renderInput);
|
|
3353
3354
|
}
|
|
3354
3355
|
}, {
|
|
3355
3356
|
key: "getRouterValidations",
|
|
@@ -3486,11 +3487,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3486
3487
|
}, {
|
|
3487
3488
|
key: "render",
|
|
3488
3489
|
value: function render(input) {
|
|
3489
|
-
this.
|
|
3490
|
+
return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, {
|
|
3490
3491
|
layout: input.as,
|
|
3491
3492
|
select: input.select
|
|
3492
|
-
};
|
|
3493
|
-
return this;
|
|
3493
|
+
});
|
|
3494
3494
|
}
|
|
3495
3495
|
}]);
|
|
3496
3496
|
}(Schema);
|
|
@@ -5162,24 +5162,6 @@ function modules(config, modules) {
|
|
|
5162
5162
|
};
|
|
5163
5163
|
}
|
|
5164
5164
|
|
|
5165
|
-
function _regeneratorValues(e) {
|
|
5166
|
-
if (null != e) {
|
|
5167
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
5168
|
-
r = 0;
|
|
5169
|
-
if (t) return t.call(e);
|
|
5170
|
-
if ("function" == typeof e.next) return e;
|
|
5171
|
-
if (!isNaN(e.length)) return {
|
|
5172
|
-
next: function () {
|
|
5173
|
-
return e && r >= e.length && (e = void 0), {
|
|
5174
|
-
value: e && e[r++],
|
|
5175
|
-
done: !e
|
|
5176
|
-
};
|
|
5177
|
-
}
|
|
5178
|
-
};
|
|
5179
|
-
}
|
|
5180
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
5181
|
-
}
|
|
5182
|
-
|
|
5183
5165
|
function _regeneratorDefine(e, r, n, t) {
|
|
5184
5166
|
var i = Object.defineProperty;
|
|
5185
5167
|
try {
|
|
@@ -5661,6 +5643,29 @@ function getTextEncoder() {
|
|
|
5661
5643
|
}
|
|
5662
5644
|
return textEncoder;
|
|
5663
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
|
+
}
|
|
5664
5669
|
function hash(input) {
|
|
5665
5670
|
if (_typeof(input) === "object") {
|
|
5666
5671
|
return hashObject(input);
|
|
@@ -5715,127 +5720,159 @@ function extractValModules(_x) {
|
|
|
5715
5720
|
}
|
|
5716
5721
|
function _extractValModules() {
|
|
5717
5722
|
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
5718
|
-
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, configSha, sourcesSha, baseSha, schemaSha,
|
|
5719
|
-
return _regenerator().w(function (
|
|
5720
|
-
while (1) switch (
|
|
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) {
|
|
5721
5726
|
case 0:
|
|
5722
|
-
moduleErrors = [];
|
|
5723
|
-
|
|
5724
|
-
|
|
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({
|
|
5725
5731
|
message: message,
|
|
5726
5732
|
path: path
|
|
5727
|
-
};
|
|
5733
|
+
});
|
|
5728
5734
|
};
|
|
5729
5735
|
sources = {};
|
|
5730
5736
|
schemas = {};
|
|
5731
5737
|
serializedSchemas = {};
|
|
5732
5738
|
configSha = hash(JSON.stringify(valModules.config));
|
|
5733
5739
|
sourcesSha = "";
|
|
5734
|
-
baseSha = configSha;
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
_context.n = 1;
|
|
5744
|
-
break;
|
|
5745
|
-
}
|
|
5746
|
-
addModuleError("val.modules is missing 'def' property", moduleIdx);
|
|
5747
|
-
return _context.a(2, 0);
|
|
5748
|
-
case 1:
|
|
5749
|
-
if (!(typeof module.def !== "function")) {
|
|
5750
|
-
_context.n = 2;
|
|
5751
|
-
break;
|
|
5752
|
-
}
|
|
5753
|
-
addModuleError("val.modules 'def' property is not a function", moduleIdx);
|
|
5754
|
-
return _context.a(2, 0);
|
|
5755
|
-
case 2:
|
|
5756
|
-
_context.n = 3;
|
|
5757
|
-
return module.def().then(function (value) {
|
|
5758
|
-
if (!value) {
|
|
5759
|
-
addModuleError("val.modules 'def' did not return a value", moduleIdx);
|
|
5760
|
-
return;
|
|
5761
|
-
}
|
|
5762
|
-
if (!value["default"]) {
|
|
5763
|
-
addModuleError("val.modules 'def' did not return a default export", moduleIdx);
|
|
5764
|
-
return;
|
|
5765
|
-
}
|
|
5766
|
-
var path = getValPath(value["default"]);
|
|
5767
|
-
if (path === undefined) {
|
|
5768
|
-
addModuleError("path is undefined", moduleIdx);
|
|
5769
|
-
return;
|
|
5770
|
-
}
|
|
5771
|
-
var schema = getSchema(value["default"]);
|
|
5772
|
-
if (schema === undefined) {
|
|
5773
|
-
addModuleError("schema in path '".concat(path, "' is undefined"), moduleIdx, path);
|
|
5774
|
-
return;
|
|
5775
|
-
}
|
|
5776
|
-
// Avoid `schema instanceof Schema` — the editor SPA and the host
|
|
5777
|
-
// Next.js bundle each ship their own copy of @valbuild/core, so the
|
|
5778
|
-
// `Schema` class identity differs between them and the instanceof
|
|
5779
|
-
// check would fail for cross-bundle modules. The executeSerialize
|
|
5780
|
-
// check below is the actual contract we depend on.
|
|
5781
|
-
if (typeof schema["executeSerialize"] !== "function") {
|
|
5782
|
-
addModuleError("schema.serialize in path '".concat(path, "' is not a function"), moduleIdx, path);
|
|
5783
|
-
return;
|
|
5784
|
-
}
|
|
5785
|
-
var source = getSource(value["default"]);
|
|
5786
|
-
if (source === undefined) {
|
|
5787
|
-
addModuleError("source in ".concat(path, " is undefined"), moduleIdx, path);
|
|
5788
|
-
return;
|
|
5789
|
-
}
|
|
5790
|
-
var serializedSchema;
|
|
5791
|
-
try {
|
|
5792
|
-
serializedSchema = schema["executeSerialize"]();
|
|
5793
|
-
} catch (e) {
|
|
5794
|
-
var message = e instanceof Error ? e.message : JSON.stringify(e);
|
|
5795
|
-
addModuleError("Could not serialize module: '".concat(path, "'. Error: ").concat(message), moduleIdx, path);
|
|
5796
|
-
return;
|
|
5797
|
-
}
|
|
5798
|
-
var pathM = path;
|
|
5799
|
-
sources[pathM] = source;
|
|
5800
|
-
schemas[pathM] = schema;
|
|
5801
|
-
serializedSchemas[pathM] = serializedSchema;
|
|
5802
|
-
sourcesSha = hash(sourcesSha + JSON.stringify({
|
|
5803
|
-
path: path,
|
|
5804
|
-
source: source
|
|
5805
|
-
}));
|
|
5806
|
-
baseSha = hash(baseSha + JSON.stringify({
|
|
5807
|
-
path: path,
|
|
5808
|
-
schema: serializedSchema,
|
|
5809
|
-
source: source,
|
|
5810
|
-
modulesErrors: moduleErrors
|
|
5811
|
-
}));
|
|
5812
|
-
schemaSha = hash(schemaSha + JSON.stringify(serializedSchema));
|
|
5813
|
-
});
|
|
5814
|
-
case 3:
|
|
5815
|
-
return _context.a(2);
|
|
5816
|
-
}
|
|
5817
|
-
}, _loop);
|
|
5818
|
-
});
|
|
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 = "";
|
|
5819
5749
|
moduleIdx = 0;
|
|
5820
5750
|
case 1:
|
|
5821
5751
|
if (!(moduleIdx < valModules.modules.length)) {
|
|
5822
|
-
|
|
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;
|
|
5823
5760
|
break;
|
|
5824
5761
|
}
|
|
5825
|
-
|
|
5762
|
+
addModuleError("val.modules ".concat(at, " is missing 'def' property"));
|
|
5763
|
+
return _context.a(3, 17);
|
|
5826
5764
|
case 2:
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
_context2.n = 3;
|
|
5765
|
+
if (!(typeof module.def !== "function")) {
|
|
5766
|
+
_context.n = 3;
|
|
5830
5767
|
break;
|
|
5831
5768
|
}
|
|
5832
|
-
|
|
5769
|
+
addModuleError("val.modules ".concat(at, " 'def' property is not a function"));
|
|
5770
|
+
return _context.a(3, 17);
|
|
5833
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:
|
|
5834
5871
|
moduleIdx++;
|
|
5835
|
-
|
|
5872
|
+
_context.n = 1;
|
|
5836
5873
|
break;
|
|
5837
|
-
case
|
|
5838
|
-
return
|
|
5874
|
+
case 18:
|
|
5875
|
+
return _context.a(2, {
|
|
5839
5876
|
sources: sources,
|
|
5840
5877
|
schemas: schemas,
|
|
5841
5878
|
serializedSchemas: serializedSchemas,
|
|
@@ -5846,7 +5883,7 @@ function _extractValModules() {
|
|
|
5846
5883
|
moduleErrors: moduleErrors
|
|
5847
5884
|
});
|
|
5848
5885
|
}
|
|
5849
|
-
}, _callee);
|
|
5886
|
+
}, _callee, null, [[14, 15], [4, 6]]);
|
|
5850
5887
|
}));
|
|
5851
5888
|
return _extractValModules.apply(this, arguments);
|
|
5852
5889
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, g as DEFAULT_VAL_REMOTE_HOST, p as DateSchema, q as DateTimeSchema, F as FATAL_ERROR_TYPES, h as FILE_REF_PROP, j as FILE_REF_SUBTYPE_TAG, o as FileSchema, G as GenericSelector, n as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, t as RichTextSchema, r as RouteSchema, S as Schema, l as StringSchema, U as UnionSchema, V as VAL_EXTENSION, k as derefPatch, u as deserializeSchema, f as extractValModules, v as getSourcePathFromRoute, i as initVal, m as modules } from './index-
|
|
1
|
+
export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, g as DEFAULT_VAL_REMOTE_HOST, p as DateSchema, q as DateTimeSchema, F as FATAL_ERROR_TYPES, h as FILE_REF_PROP, j as FILE_REF_SUBTYPE_TAG, o as FileSchema, G as GenericSelector, n as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, t as RichTextSchema, r as RouteSchema, S as Schema, l as StringSchema, U as UnionSchema, V as VAL_EXTENSION, k as derefPatch, u as deserializeSchema, f as extractValModules, v as getSourcePathFromRoute, i as initVal, m as modules } from './index-204b5d78.esm.js';
|
|
2
2
|
import './result-4bd63123.esm.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-b2601ac3.cjs.dev.js');
|
|
6
6
|
var result = require('../../dist/result-bb1f436e.cjs.dev.js');
|
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-28d99c34.cjs.prod.js');
|
|
6
6
|
var result = require('../../dist/result-787e35f6.cjs.prod.js');
|
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-204b5d78.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-204b5d78.esm.js';
|
|
3
3
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-4bd63123.esm.js';
|
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
|
5
5
|
|