@valbuild/core 0.60.24 → 0.61.0

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 (35) hide show
  1. package/dist/declarations/src/index.d.ts +1 -0
  2. package/dist/declarations/src/initSchema.d.ts +1 -5
  3. package/dist/declarations/src/modules.d.ts +30 -0
  4. package/dist/declarations/src/schema/array.d.ts +1 -1
  5. package/dist/declarations/src/schema/boolean.d.ts +1 -1
  6. package/dist/declarations/src/schema/file.d.ts +1 -1
  7. package/dist/declarations/src/schema/image.d.ts +1 -1
  8. package/dist/declarations/src/schema/index.d.ts +1 -2
  9. package/dist/declarations/src/schema/keyOf.d.ts +1 -1
  10. package/dist/declarations/src/schema/literal.d.ts +1 -1
  11. package/dist/declarations/src/schema/number.d.ts +1 -1
  12. package/dist/declarations/src/schema/object.d.ts +1 -1
  13. package/dist/declarations/src/schema/record.d.ts +1 -1
  14. package/dist/declarations/src/schema/richtext.d.ts +1 -1
  15. package/dist/declarations/src/schema/string.d.ts +2 -2
  16. package/dist/declarations/src/schema/union.d.ts +1 -1
  17. package/dist/{index-0a0de0f1.esm.js → index-051c34f3.esm.js} +5 -9
  18. package/dist/{index-670f24da.cjs.dev.js → index-0df230ef.cjs.dev.js} +5 -9
  19. package/dist/{index-7db171cd.cjs.prod.js → index-2dfaf8f7.cjs.prod.js} +1 -1
  20. package/dist/{index-70585611.cjs.dev.js → index-e8ab2166.cjs.dev.js} +1 -1
  21. package/dist/{index-065c2067.esm.js → index-ed5767a3.esm.js} +1 -1
  22. package/dist/{index-d2faad99.cjs.prod.js → index-f2552460.cjs.prod.js} +5 -9
  23. package/dist/{ops-61b64d16.cjs.dev.js → ops-34737ef0.cjs.dev.js} +15 -15
  24. package/dist/{ops-2b2892a3.cjs.prod.js → ops-92570725.cjs.prod.js} +15 -15
  25. package/dist/{ops-b552a170.esm.js → ops-9262cf01.esm.js} +15 -15
  26. package/dist/valbuild-core.cjs.dev.js +31 -11
  27. package/dist/valbuild-core.cjs.prod.js +31 -11
  28. package/dist/valbuild-core.esm.js +33 -14
  29. package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
  30. package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
  31. package/expr/dist/valbuild-core-expr.esm.js +2 -2
  32. package/package.json +1 -1
  33. package/patch/dist/valbuild-core-patch.cjs.dev.js +2 -2
  34. package/patch/dist/valbuild-core-patch.cjs.prod.js +2 -2
  35. package/patch/dist/valbuild-core-patch.esm.js +3 -3
@@ -1,4 +1,5 @@
1
1
  export { initVal } from "./initVal.js";
2
+ export { modules, type ValModules } from "./modules.js";
2
3
  export type { InitVal, ValConfig, ValConstructor, ContentConstructor, } from "./initVal.js";
3
4
  export { Schema, type SerializedSchema, type SelectorOfSchema } from "./schema/index.js";
4
5
  export type { ImageMetadata } from "./schema/image.js";
@@ -25,11 +25,7 @@ export type InitSchema = {
25
25
  readonly file: typeof file;
26
26
  };
27
27
  export declare function initSchema(): {
28
- string: <T extends string>(options?: {
29
- maxLength?: number | undefined;
30
- minLength?: number | undefined;
31
- regexp?: RegExp | undefined;
32
- } | undefined) => import("./schema/string.js").StringSchema<T>;
28
+ string: <T extends string>(options?: Record<string, never> | undefined) => import("./schema/string.js").StringSchema<T>;
33
29
  boolean: () => import("./schema/index.js").Schema<boolean>;
34
30
  array: <S extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S) => import("./schema/index.js").Schema<import("./schema/index.js").SelectorOfSchema<S>[]>;
35
31
  object: <Props extends {
@@ -0,0 +1,30 @@
1
+ import { ValConfig } from "./initVal.js";
2
+ import { ValModule } from "./module.js";
3
+ import { SelectorSource } from "./selector/index.js";
4
+ export type ValModules = {
5
+ config: ValConfig;
6
+ modules: {
7
+ /**
8
+ * A module definition defined as a function that returns a promise that resolves to the module.
9
+ *
10
+ * @example
11
+ * { def: () => import('./module.val') }
12
+ */
13
+ def: () => Promise<{
14
+ default: ValModule<SelectorSource>;
15
+ }>;
16
+ }[];
17
+ };
18
+ /**
19
+ * Define the set of modules that can be edited using the Val UI.
20
+ *
21
+ * @example
22
+ * import { modules } from "@valbuild/next";
23
+ * import { config } from "./val.config";
24
+ *
25
+ * export default modules(config, [
26
+ * { def: () => import("./app/page.val.ts") },
27
+ * { def: () => import("./app/another/page.val.ts") },
28
+ * ]);
29
+ */
30
+ export declare function modules(config: ValConfig, modules: ValModules["modules"]): ValModules;
@@ -13,7 +13,7 @@ export declare class ArraySchema<T extends Schema<SelectorSource>> extends Schem
13
13
  constructor(item: T, opt?: boolean);
14
14
  validate(path: SourcePath, src: SelectorOfSchema<T>[]): ValidationErrors;
15
15
  assert(src: SelectorOfSchema<T>[]): boolean;
16
- optional(): Schema<SelectorOfSchema<T>[] | null>;
16
+ nullable(): Schema<SelectorOfSchema<T>[] | null>;
17
17
  serialize(): SerializedArraySchema;
18
18
  }
19
19
  export declare const array: <S extends Schema<SelectorSource>>(schema: S) => Schema<SelectorOfSchema<S>[]>;
@@ -10,7 +10,7 @@ export declare class BooleanSchema<Src extends boolean | null> extends Schema<Sr
10
10
  constructor(opt?: boolean);
11
11
  validate(path: SourcePath, src: Src): ValidationErrors;
12
12
  assert(src: Src): boolean;
13
- optional(): Schema<Src | null>;
13
+ nullable(): Schema<Src | null>;
14
14
  serialize(): SerializedSchema;
15
15
  }
16
16
  export declare const boolean: () => Schema<boolean>;
@@ -19,7 +19,7 @@ export declare class FileSchema<Src extends FileSource<FileMetadata | undefined>
19
19
  constructor(options?: FileOptions | undefined, opt?: boolean);
20
20
  validate(path: SourcePath, src: Src): ValidationErrors;
21
21
  assert(src: Src): boolean;
22
- optional(): Schema<Src | null>;
22
+ nullable(): Schema<Src | null>;
23
23
  serialize(): SerializedSchema;
24
24
  }
25
25
  export declare const file: (options?: FileOptions) => Schema<FileSource<FileMetadata>>;
@@ -31,7 +31,7 @@ export declare class ImageSchema<Src extends FileSource<ImageMetadata | undefine
31
31
  constructor(options?: ImageOptions | undefined, opt?: boolean);
32
32
  validate(path: SourcePath, src: Src): ValidationErrors;
33
33
  assert(src: Src): boolean;
34
- optional(): Schema<Src | null>;
34
+ nullable(): Schema<Src | null>;
35
35
  serialize(): SerializedSchema;
36
36
  }
37
37
  export declare const image: (options?: ImageOptions) => Schema<ImageSource>;
@@ -17,9 +17,8 @@ export type SerializedSchema = SerializedStringSchema | SerializedLiteralSchema
17
17
  export declare abstract class Schema<Src extends SelectorSource> {
18
18
  abstract validate(path: SourcePath, src: Src): ValidationErrors;
19
19
  abstract assert(src: Src): boolean;
20
- abstract optional(): Schema<Src | null>;
20
+ abstract nullable(): Schema<Src | null>;
21
21
  abstract serialize(): SerializedSchema;
22
- nullable(): Schema<Src | null>;
23
22
  /** MUTATES! since internal and perf sensitive */
24
23
  protected appendValidationError(current: ValidationErrors, path: SourcePath, message: string, value?: unknown): ValidationErrors;
25
24
  }
@@ -19,7 +19,7 @@ export declare class KeyOfSchema<Sel extends GenericSelector<SourceArray | Sourc
19
19
  constructor(schema?: SerializedSchema | undefined, sourcePath?: SourcePath | undefined, opt?: boolean);
20
20
  validate(path: SourcePath, src: KeyOfSelector<Sel>): ValidationErrors;
21
21
  assert(src: KeyOfSelector<Sel>): boolean;
22
- optional(): Schema<KeyOfSelector<Sel> | null>;
22
+ nullable(): Schema<KeyOfSelector<Sel> | null>;
23
23
  serialize(): SerializedSchema;
24
24
  }
25
25
  export declare const keyOf: <Src extends GenericSelector<SourceObject | SourceArray, undefined> & ValModuleBrand>(valModule: Src) => Schema<KeyOfSelector<Src>>;
@@ -12,7 +12,7 @@ export declare class LiteralSchema<Src extends string | null> extends Schema<Src
12
12
  constructor(value: string, opt?: boolean);
13
13
  validate(path: SourcePath, src: Src): ValidationErrors;
14
14
  assert(src: Src): boolean;
15
- optional(): Schema<Src | null>;
15
+ nullable(): Schema<Src | null>;
16
16
  serialize(): SerializedSchema;
17
17
  }
18
18
  export declare const literal: <T extends string>(value: T) => Schema<T>;
@@ -16,7 +16,7 @@ export declare class NumberSchema<Src extends number | null> extends Schema<Src>
16
16
  constructor(options?: NumberOptions | undefined, opt?: boolean);
17
17
  validate(path: SourcePath, src: Src): ValidationErrors;
18
18
  assert(src: Src): boolean;
19
- optional(): Schema<Src | null>;
19
+ nullable(): Schema<Src | null>;
20
20
  serialize(): SerializedSchema;
21
21
  }
22
22
  export declare const number: (options?: NumberOptions) => Schema<number>;
@@ -19,7 +19,7 @@ export declare class ObjectSchema<Props extends ObjectSchemaProps> extends Schem
19
19
  constructor(items: Props, opt?: boolean);
20
20
  validate(path: SourcePath, src: ObjectSchemaSrcOf<Props>): ValidationErrors;
21
21
  assert(src: ObjectSchemaSrcOf<Props>): boolean;
22
- optional(): Schema<ObjectSchemaSrcOf<Props> | null>;
22
+ nullable(): Schema<ObjectSchemaSrcOf<Props> | null>;
23
23
  serialize(): SerializedSchema;
24
24
  }
25
25
  export declare const object: <Props extends ObjectSchemaProps>(schema: Props) => Schema<{ [key in keyof Props]: SelectorOfSchema<Props[key]>; }>;
@@ -13,7 +13,7 @@ export declare class RecordSchema<T extends Schema<SelectorSource>> extends Sche
13
13
  constructor(item: T, opt?: boolean);
14
14
  validate(path: SourcePath, src: Record<string, SelectorOfSchema<T>>): ValidationErrors;
15
15
  assert(src: Record<string, SelectorOfSchema<T>>): boolean;
16
- optional(): Schema<Record<string, SelectorOfSchema<T>> | null>;
16
+ nullable(): Schema<Record<string, SelectorOfSchema<T>> | null>;
17
17
  serialize(): SerializedRecordSchema;
18
18
  }
19
19
  export declare const record: <S extends Schema<SelectorSource>>(schema: S) => Schema<Record<string, SelectorOfSchema<S>>>;
@@ -13,7 +13,7 @@ export declare class RichTextSchema<O extends RichTextOptions, Src extends RichT
13
13
  constructor(options: O, opt?: boolean);
14
14
  validate(path: SourcePath, src: Src): ValidationErrors;
15
15
  assert(src: Src): boolean;
16
- optional(): Schema<RichTextSource<O> | null>;
16
+ nullable(): Schema<RichTextSource<O> | null>;
17
17
  serialize(): SerializedSchema;
18
18
  }
19
19
  export declare const richtext: <O extends RichTextOptions>(options?: O | undefined) => Schema<RichTextSource<O>>;
@@ -33,9 +33,9 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
33
33
  regexp(regexp: RegExp): StringSchema<Src>;
34
34
  validate(path: SourcePath, src: Src): ValidationErrors;
35
35
  assert(src: Src): boolean;
36
- optional(): StringSchema<Src | null>;
36
+ nullable(): StringSchema<Src | null>;
37
37
  raw(): StringSchema<Src extends null ? RawString | null : RawString>;
38
38
  serialize(): SerializedSchema;
39
39
  }
40
- export declare const string: <T extends string>(options?: StringOptions) => StringSchema<T>;
40
+ export declare const string: <T extends string>(options?: Record<string, never>) => StringSchema<T>;
41
41
  export {};
@@ -20,7 +20,7 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
20
20
  readonly opt: boolean;
21
21
  validate(path: SourcePath, src: SourceOf<Key, T>): ValidationErrors;
22
22
  assert(src: SourceOf<Key, T>): boolean;
23
- optional(): Schema<SourceOf<Key, T> | null>;
23
+ nullable(): Schema<SourceOf<Key, T> | null>;
24
24
  serialize(): SerializedSchema;
25
25
  constructor(key: Key, items: T, opt?: boolean);
26
26
  }
@@ -214,10 +214,8 @@ var Schema = /*#__PURE__*/function () {
214
214
  _classCallCheck(this, Schema);
215
215
  }
216
216
  _createClass(Schema, [{
217
- key: "nullable",
218
- value: function nullable() {
219
- return this.optional();
220
- }
217
+ key: "appendValidationError",
218
+ value:
221
219
  // remote(): Src extends RemoteCompatibleSource
222
220
  // ? Schema<RemoteSource<Src>>
223
221
  // : never {
@@ -226,9 +224,7 @@ var Schema = /*#__PURE__*/function () {
226
224
  // }
227
225
 
228
226
  /** MUTATES! since internal and perf sensitive */
229
- }, {
230
- key: "appendValidationError",
231
- value: function appendValidationError(current, path, message, value) {
227
+ function appendValidationError(current, path, message, value) {
232
228
  if (current) {
233
229
  if (current[path]) {
234
230
  current[path].push({
@@ -473,8 +469,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
473
469
  return (src === null || src === void 0 ? void 0 : src[FILE_REF_PROP]) === "file" && (src === null || src === void 0 ? void 0 : src[VAL_EXTENSION]) === "file";
474
470
  }
475
471
  }, {
476
- key: "optional",
477
- value: function optional() {
472
+ key: "nullable",
473
+ value: function nullable() {
478
474
  return new FileSchema(this.options, true);
479
475
  }
480
476
  }, {
@@ -216,10 +216,8 @@ var Schema = /*#__PURE__*/function () {
216
216
  _classCallCheck(this, Schema);
217
217
  }
218
218
  _createClass(Schema, [{
219
- key: "nullable",
220
- value: function nullable() {
221
- return this.optional();
222
- }
219
+ key: "appendValidationError",
220
+ value:
223
221
  // remote(): Src extends RemoteCompatibleSource
224
222
  // ? Schema<RemoteSource<Src>>
225
223
  // : never {
@@ -228,9 +226,7 @@ var Schema = /*#__PURE__*/function () {
228
226
  // }
229
227
 
230
228
  /** MUTATES! since internal and perf sensitive */
231
- }, {
232
- key: "appendValidationError",
233
- value: function appendValidationError(current, path, message, value) {
229
+ function appendValidationError(current, path, message, value) {
234
230
  if (current) {
235
231
  if (current[path]) {
236
232
  current[path].push({
@@ -475,8 +471,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
475
471
  return (src === null || src === void 0 ? void 0 : src[FILE_REF_PROP]) === "file" && (src === null || src === void 0 ? void 0 : src[VAL_EXTENSION]) === "file";
476
472
  }
477
473
  }, {
478
- key: "optional",
479
- value: function optional() {
474
+ key: "nullable",
475
+ value: function nullable() {
480
476
  return new FileSchema(this.options, true);
481
477
  }
482
478
  }, {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index$1 = require('./index-d2faad99.cjs.prod.js');
3
+ var index$1 = require('./index-f2552460.cjs.prod.js');
4
4
  var result = require('./result-26f67b40.cjs.prod.js');
5
5
 
6
6
  var WHITE_SPACE = ["\n", "\r", "\t", " "];
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index$1 = require('./index-670f24da.cjs.dev.js');
3
+ var index$1 = require('./index-0df230ef.cjs.dev.js');
4
4
  var result = require('./result-48320acd.cjs.dev.js');
5
5
 
6
6
  var WHITE_SPACE = ["\n", "\r", "\t", " "];
@@ -1,4 +1,4 @@
1
- import { f as _objectSpread2, k as _slicedToArray, c as _createClass, a as _classCallCheck, t as Sym, C as Call, u as StringLiteral, v as StringTemplate, e as _typeof, n as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, p as convertFileSource, d as _defineProperty, E as Expr, S as Schema, w as _toConsumableArray, N as NilSym } from './index-0a0de0f1.esm.js';
1
+ import { f as _objectSpread2, k as _slicedToArray, c as _createClass, a as _classCallCheck, t as Sym, C as Call, u as StringLiteral, v as StringTemplate, e as _typeof, n as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, p as convertFileSource, d as _defineProperty, E as Expr, S as Schema, w as _toConsumableArray, N as NilSym } from './index-051c34f3.esm.js';
2
2
  import { i as isErr, e as err, o as ok, a as isOk } from './result-b96df128.esm.js';
3
3
 
4
4
  var WHITE_SPACE = ["\n", "\r", "\t", " "];
@@ -216,10 +216,8 @@ var Schema = /*#__PURE__*/function () {
216
216
  _classCallCheck(this, Schema);
217
217
  }
218
218
  _createClass(Schema, [{
219
- key: "nullable",
220
- value: function nullable() {
221
- return this.optional();
222
- }
219
+ key: "appendValidationError",
220
+ value:
223
221
  // remote(): Src extends RemoteCompatibleSource
224
222
  // ? Schema<RemoteSource<Src>>
225
223
  // : never {
@@ -228,9 +226,7 @@ var Schema = /*#__PURE__*/function () {
228
226
  // }
229
227
 
230
228
  /** MUTATES! since internal and perf sensitive */
231
- }, {
232
- key: "appendValidationError",
233
- value: function appendValidationError(current, path, message, value) {
229
+ function appendValidationError(current, path, message, value) {
234
230
  if (current) {
235
231
  if (current[path]) {
236
232
  current[path].push({
@@ -475,8 +471,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
475
471
  return (src === null || src === void 0 ? void 0 : src[FILE_REF_PROP]) === "file" && (src === null || src === void 0 ? void 0 : src[VAL_EXTENSION]) === "file";
476
472
  }
477
473
  }, {
478
- key: "optional",
479
- value: function optional() {
474
+ key: "nullable",
475
+ value: function nullable() {
480
476
  return new FileSchema(this.options, true);
481
477
  }
482
478
  }, {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-670f24da.cjs.dev.js');
3
+ var index = require('./index-0df230ef.cjs.dev.js');
4
4
  var result = require('./result-48320acd.cjs.dev.js');
5
5
 
6
6
  function hasOwn(obj, prop) {
@@ -216,8 +216,8 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
216
216
  return index._typeof(src) === "object" && !Array.isArray(src);
217
217
  }
218
218
  }, {
219
- key: "optional",
220
- value: function optional() {
219
+ key: "nullable",
220
+ value: function nullable() {
221
221
  return new ObjectSchema(this.items, true);
222
222
  }
223
223
  }, {
@@ -308,8 +308,8 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
308
308
  return index._typeof(src) === "object" && Array.isArray(src);
309
309
  }
310
310
  }, {
311
- key: "optional",
312
- value: function optional() {
311
+ key: "nullable",
312
+ value: function nullable() {
313
313
  return new ArraySchema(this.item, true);
314
314
  }
315
315
  }, {
@@ -368,8 +368,8 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
368
368
  return typeof src === "string";
369
369
  }
370
370
  }, {
371
- key: "optional",
372
- value: function optional() {
371
+ key: "nullable",
372
+ value: function nullable() {
373
373
  return new LiteralSchema(this.value, true);
374
374
  }
375
375
  }, {
@@ -547,8 +547,8 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
547
547
  return true;
548
548
  }
549
549
  }, {
550
- key: "optional",
551
- value: function optional() {
550
+ key: "nullable",
551
+ value: function nullable() {
552
552
  return new UnionSchema(this.key, this.items, true);
553
553
  }
554
554
  }, {
@@ -605,8 +605,8 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
605
605
  return true; // TODO
606
606
  }
607
607
  }, {
608
- key: "optional",
609
- value: function optional() {
608
+ key: "nullable",
609
+ value: function nullable() {
610
610
  return new RichTextSchema(this.options, true);
611
611
  }
612
612
  }, {
@@ -683,8 +683,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
683
683
  return (src === null || src === void 0 ? void 0 : src[index.FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[index.VAL_EXTENSION]) === "file";
684
684
  }
685
685
  }, {
686
- key: "optional",
687
- value: function optional() {
686
+ key: "nullable",
687
+ value: function nullable() {
688
688
  return new ImageSchema(this.options, true);
689
689
  }
690
690
  }, {
@@ -771,8 +771,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
771
771
  return index._typeof(src) === "object" && !Array.isArray(src);
772
772
  }
773
773
  }, {
774
- key: "optional",
775
- value: function optional() {
774
+ key: "nullable",
775
+ value: function nullable() {
776
776
  return new RecordSchema(this.item, true);
777
777
  }
778
778
  }, {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-d2faad99.cjs.prod.js');
3
+ var index = require('./index-f2552460.cjs.prod.js');
4
4
  var result = require('./result-26f67b40.cjs.prod.js');
5
5
 
6
6
  function hasOwn(obj, prop) {
@@ -216,8 +216,8 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
216
216
  return index._typeof(src) === "object" && !Array.isArray(src);
217
217
  }
218
218
  }, {
219
- key: "optional",
220
- value: function optional() {
219
+ key: "nullable",
220
+ value: function nullable() {
221
221
  return new ObjectSchema(this.items, true);
222
222
  }
223
223
  }, {
@@ -308,8 +308,8 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
308
308
  return index._typeof(src) === "object" && Array.isArray(src);
309
309
  }
310
310
  }, {
311
- key: "optional",
312
- value: function optional() {
311
+ key: "nullable",
312
+ value: function nullable() {
313
313
  return new ArraySchema(this.item, true);
314
314
  }
315
315
  }, {
@@ -368,8 +368,8 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
368
368
  return typeof src === "string";
369
369
  }
370
370
  }, {
371
- key: "optional",
372
- value: function optional() {
371
+ key: "nullable",
372
+ value: function nullable() {
373
373
  return new LiteralSchema(this.value, true);
374
374
  }
375
375
  }, {
@@ -547,8 +547,8 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
547
547
  return true;
548
548
  }
549
549
  }, {
550
- key: "optional",
551
- value: function optional() {
550
+ key: "nullable",
551
+ value: function nullable() {
552
552
  return new UnionSchema(this.key, this.items, true);
553
553
  }
554
554
  }, {
@@ -605,8 +605,8 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
605
605
  return true; // TODO
606
606
  }
607
607
  }, {
608
- key: "optional",
609
- value: function optional() {
608
+ key: "nullable",
609
+ value: function nullable() {
610
610
  return new RichTextSchema(this.options, true);
611
611
  }
612
612
  }, {
@@ -683,8 +683,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
683
683
  return (src === null || src === void 0 ? void 0 : src[index.FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[index.VAL_EXTENSION]) === "file";
684
684
  }
685
685
  }, {
686
- key: "optional",
687
- value: function optional() {
686
+ key: "nullable",
687
+ value: function nullable() {
688
688
  return new ImageSchema(this.options, true);
689
689
  }
690
690
  }, {
@@ -771,8 +771,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
771
771
  return index._typeof(src) === "object" && !Array.isArray(src);
772
772
  }
773
773
  }, {
774
- key: "optional",
775
- value: function optional() {
774
+ key: "nullable",
775
+ value: function nullable() {
776
776
  return new RecordSchema(this.item, true);
777
777
  }
778
778
  }, {
@@ -1,4 +1,4 @@
1
- import { e as _typeof, n as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, p as convertFileSource, d as _defineProperty, G as GetSchema, m as GetSource, E as Expr, P as Path, S as Schema, _ as _inherits, a as _classCallCheck, b as _callSuper, c as _createClass, k as _slicedToArray, f as _objectSpread2, w as _toConsumableArray } from './index-0a0de0f1.esm.js';
1
+ import { e as _typeof, n as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, p as convertFileSource, d as _defineProperty, G as GetSchema, m as GetSource, E as Expr, P as Path, S as Schema, _ as _inherits, a as _classCallCheck, b as _callSuper, c as _createClass, k as _slicedToArray, f as _objectSpread2, w as _toConsumableArray } from './index-051c34f3.esm.js';
2
2
  import { _ as _createForOfIteratorHelper } from './result-b96df128.esm.js';
3
3
 
4
4
  function hasOwn(obj, prop) {
@@ -214,8 +214,8 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
214
214
  return _typeof(src) === "object" && !Array.isArray(src);
215
215
  }
216
216
  }, {
217
- key: "optional",
218
- value: function optional() {
217
+ key: "nullable",
218
+ value: function nullable() {
219
219
  return new ObjectSchema(this.items, true);
220
220
  }
221
221
  }, {
@@ -306,8 +306,8 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
306
306
  return _typeof(src) === "object" && Array.isArray(src);
307
307
  }
308
308
  }, {
309
- key: "optional",
310
- value: function optional() {
309
+ key: "nullable",
310
+ value: function nullable() {
311
311
  return new ArraySchema(this.item, true);
312
312
  }
313
313
  }, {
@@ -366,8 +366,8 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
366
366
  return typeof src === "string";
367
367
  }
368
368
  }, {
369
- key: "optional",
370
- value: function optional() {
369
+ key: "nullable",
370
+ value: function nullable() {
371
371
  return new LiteralSchema(this.value, true);
372
372
  }
373
373
  }, {
@@ -545,8 +545,8 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
545
545
  return true;
546
546
  }
547
547
  }, {
548
- key: "optional",
549
- value: function optional() {
548
+ key: "nullable",
549
+ value: function nullable() {
550
550
  return new UnionSchema(this.key, this.items, true);
551
551
  }
552
552
  }, {
@@ -603,8 +603,8 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
603
603
  return true; // TODO
604
604
  }
605
605
  }, {
606
- key: "optional",
607
- value: function optional() {
606
+ key: "nullable",
607
+ value: function nullable() {
608
608
  return new RichTextSchema(this.options, true);
609
609
  }
610
610
  }, {
@@ -681,8 +681,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
681
681
  return (src === null || src === void 0 ? void 0 : src[FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[VAL_EXTENSION]) === "file";
682
682
  }
683
683
  }, {
684
- key: "optional",
685
- value: function optional() {
684
+ key: "nullable",
685
+ value: function nullable() {
686
686
  return new ImageSchema(this.options, true);
687
687
  }
688
688
  }, {
@@ -769,8 +769,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
769
769
  return _typeof(src) === "object" && !Array.isArray(src);
770
770
  }
771
771
  }, {
772
- key: "optional",
773
- value: function optional() {
772
+ key: "nullable",
773
+ value: function nullable() {
774
774
  return new RecordSchema(this.item, true);
775
775
  }
776
776
  }, {
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ops = require('./ops-61b64d16.cjs.dev.js');
6
- var index = require('./index-670f24da.cjs.dev.js');
7
- var expr_dist_valbuildCoreExpr = require('./index-70585611.cjs.dev.js');
5
+ var ops = require('./ops-34737ef0.cjs.dev.js');
6
+ var index = require('./index-0df230ef.cjs.dev.js');
7
+ var expr_dist_valbuildCoreExpr = require('./index-e8ab2166.cjs.dev.js');
8
8
  var result = require('./result-48320acd.cjs.dev.js');
9
9
 
10
10
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -41,8 +41,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
41
41
  return typeof src === "number";
42
42
  }
43
43
  }, {
44
- key: "optional",
45
- value: function optional() {
44
+ key: "nullable",
45
+ value: function nullable() {
46
46
  return new NumberSchema(this.options, true);
47
47
  }
48
48
  }, {
@@ -141,8 +141,8 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
141
141
  return typeof src === "string";
142
142
  }
143
143
  }, {
144
- key: "optional",
145
- value: function optional() {
144
+ key: "nullable",
145
+ value: function nullable() {
146
146
  return new StringSchema(this.options, true, this.isRaw);
147
147
  }
148
148
  }, {
@@ -208,8 +208,8 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
208
208
  return typeof src === "boolean";
209
209
  }
210
210
  }, {
211
- key: "optional",
212
- value: function optional() {
211
+ key: "nullable",
212
+ value: function nullable() {
213
213
  return new BooleanSchema(true);
214
214
  }
215
215
  }, {
@@ -311,8 +311,8 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
311
311
  return true;
312
312
  }
313
313
  }, {
314
- key: "optional",
315
- value: function optional() {
314
+ key: "nullable",
315
+ value: function nullable() {
316
316
  return new KeyOfSchema(this.schema, this.sourcePath, true);
317
317
  }
318
318
  }, {
@@ -479,6 +479,25 @@ var initVal = function initVal(config) {
479
479
  };
480
480
  };
481
481
 
482
+ /**
483
+ * Define the set of modules that can be edited using the Val UI.
484
+ *
485
+ * @example
486
+ * import { modules } from "@valbuild/next";
487
+ * import { config } from "./val.config";
488
+ *
489
+ * export default modules(config, [
490
+ * { def: () => import("./app/page.val.ts") },
491
+ * { def: () => import("./app/another/page.val.ts") },
492
+ * ]);
493
+ */
494
+ function modules(config, modules) {
495
+ return {
496
+ config: config,
497
+ modules: modules
498
+ };
499
+ }
500
+
482
501
  function derefPath(path) {
483
502
  var dereffedPath = [];
484
503
  var referencedPath = null;
@@ -1827,3 +1846,4 @@ exports.ValApi = ValApi;
1827
1846
  exports.derefPatch = derefPatch;
1828
1847
  exports.deserializeSchema = deserializeSchema;
1829
1848
  exports.initVal = initVal;
1849
+ exports.modules = modules;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ops = require('./ops-2b2892a3.cjs.prod.js');
6
- var index = require('./index-d2faad99.cjs.prod.js');
7
- var expr_dist_valbuildCoreExpr = require('./index-7db171cd.cjs.prod.js');
5
+ var ops = require('./ops-92570725.cjs.prod.js');
6
+ var index = require('./index-f2552460.cjs.prod.js');
7
+ var expr_dist_valbuildCoreExpr = require('./index-2dfaf8f7.cjs.prod.js');
8
8
  var result = require('./result-26f67b40.cjs.prod.js');
9
9
 
10
10
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -41,8 +41,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
41
41
  return typeof src === "number";
42
42
  }
43
43
  }, {
44
- key: "optional",
45
- value: function optional() {
44
+ key: "nullable",
45
+ value: function nullable() {
46
46
  return new NumberSchema(this.options, true);
47
47
  }
48
48
  }, {
@@ -141,8 +141,8 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
141
141
  return typeof src === "string";
142
142
  }
143
143
  }, {
144
- key: "optional",
145
- value: function optional() {
144
+ key: "nullable",
145
+ value: function nullable() {
146
146
  return new StringSchema(this.options, true, this.isRaw);
147
147
  }
148
148
  }, {
@@ -208,8 +208,8 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
208
208
  return typeof src === "boolean";
209
209
  }
210
210
  }, {
211
- key: "optional",
212
- value: function optional() {
211
+ key: "nullable",
212
+ value: function nullable() {
213
213
  return new BooleanSchema(true);
214
214
  }
215
215
  }, {
@@ -311,8 +311,8 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
311
311
  return true;
312
312
  }
313
313
  }, {
314
- key: "optional",
315
- value: function optional() {
314
+ key: "nullable",
315
+ value: function nullable() {
316
316
  return new KeyOfSchema(this.schema, this.sourcePath, true);
317
317
  }
318
318
  }, {
@@ -479,6 +479,25 @@ var initVal = function initVal(config) {
479
479
  };
480
480
  };
481
481
 
482
+ /**
483
+ * Define the set of modules that can be edited using the Val UI.
484
+ *
485
+ * @example
486
+ * import { modules } from "@valbuild/next";
487
+ * import { config } from "./val.config";
488
+ *
489
+ * export default modules(config, [
490
+ * { def: () => import("./app/page.val.ts") },
491
+ * { def: () => import("./app/another/page.val.ts") },
492
+ * ]);
493
+ */
494
+ function modules(config, modules) {
495
+ return {
496
+ config: config,
497
+ modules: modules
498
+ };
499
+ }
500
+
482
501
  function derefPath(path) {
483
502
  var dereffedPath = [];
484
503
  var referencedPath = null;
@@ -1827,3 +1846,4 @@ exports.ValApi = ValApi;
1827
1846
  exports.derefPatch = derefPatch;
1828
1847
  exports.deserializeSchema = deserializeSchema;
1829
1848
  exports.initVal = initVal;
1849
+ exports.modules = modules;
@@ -1,8 +1,8 @@
1
- import { a as array, o as object, u as union, r as richtext$1, i as image$1, l as literal, b as record, d as define, P as PatchError, n as newSelectorProxy, c as createValPathOfItem, e as isSelector, I as ImageSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema, A as ArraySchema, O as ObjectSchema, L as LiteralSchema, g as getSource, h as resolvePath, s as splitModuleIdAndModulePath, p as parsePath } from './ops-b552a170.esm.js';
2
- export { A as ArraySchema, I as ImageSchema, L as LiteralSchema, O as ObjectSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema } from './ops-b552a170.esm.js';
3
- import { _ as _inherits, a as _classCallCheck, b as _callSuper, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, f as _objectSpread2, G as GetSchema, g as getValPath, h as file, V as VAL_EXTENSION, F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, j as file$1, k as _slicedToArray, l as isFile, P as Path, m as GetSource, n as isSerializedVal, o as FileSchema, p as convertFileSource, q as getSchema, r as isVal } from './index-0a0de0f1.esm.js';
4
- export { F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, o as FileSchema, s as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-0a0de0f1.esm.js';
5
- export { i as expr } from './index-065c2067.esm.js';
1
+ import { a as array, o as object, u as union, r as richtext$1, i as image$1, l as literal, b as record, d as define, P as PatchError, n as newSelectorProxy, c as createValPathOfItem, e as isSelector, I as ImageSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema, A as ArraySchema, O as ObjectSchema, L as LiteralSchema, g as getSource, h as resolvePath, s as splitModuleIdAndModulePath, p as parsePath } from './ops-9262cf01.esm.js';
2
+ export { A as ArraySchema, I as ImageSchema, L as LiteralSchema, O as ObjectSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema } from './ops-9262cf01.esm.js';
3
+ import { _ as _inherits, a as _classCallCheck, b as _callSuper, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, f as _objectSpread2, G as GetSchema, g as getValPath, h as file, V as VAL_EXTENSION, F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, j as file$1, k as _slicedToArray, l as isFile, P as Path, m as GetSource, n as isSerializedVal, o as FileSchema, p as convertFileSource, q as getSchema, r as isVal } from './index-051c34f3.esm.js';
4
+ export { F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, o as FileSchema, s as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-051c34f3.esm.js';
5
+ export { i as expr } from './index-ed5767a3.esm.js';
6
6
  import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
7
7
 
8
8
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -39,8 +39,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
39
39
  return typeof src === "number";
40
40
  }
41
41
  }, {
42
- key: "optional",
43
- value: function optional() {
42
+ key: "nullable",
43
+ value: function nullable() {
44
44
  return new NumberSchema(this.options, true);
45
45
  }
46
46
  }, {
@@ -139,8 +139,8 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
139
139
  return typeof src === "string";
140
140
  }
141
141
  }, {
142
- key: "optional",
143
- value: function optional() {
142
+ key: "nullable",
143
+ value: function nullable() {
144
144
  return new StringSchema(this.options, true, this.isRaw);
145
145
  }
146
146
  }, {
@@ -206,8 +206,8 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
206
206
  return typeof src === "boolean";
207
207
  }
208
208
  }, {
209
- key: "optional",
210
- value: function optional() {
209
+ key: "nullable",
210
+ value: function nullable() {
211
211
  return new BooleanSchema(true);
212
212
  }
213
213
  }, {
@@ -309,8 +309,8 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
309
309
  return true;
310
310
  }
311
311
  }, {
312
- key: "optional",
313
- value: function optional() {
312
+ key: "nullable",
313
+ value: function nullable() {
314
314
  return new KeyOfSchema(this.schema, this.sourcePath, true);
315
315
  }
316
316
  }, {
@@ -477,6 +477,25 @@ var initVal = function initVal(config) {
477
477
  };
478
478
  };
479
479
 
480
+ /**
481
+ * Define the set of modules that can be edited using the Val UI.
482
+ *
483
+ * @example
484
+ * import { modules } from "@valbuild/next";
485
+ * import { config } from "./val.config";
486
+ *
487
+ * export default modules(config, [
488
+ * { def: () => import("./app/page.val.ts") },
489
+ * { def: () => import("./app/another/page.val.ts") },
490
+ * ]);
491
+ */
492
+ function modules(config, modules) {
493
+ return {
494
+ config: config,
495
+ modules: modules
496
+ };
497
+ }
498
+
480
499
  function derefPath(path) {
481
500
  var dereffedPath = [];
482
501
  var referencedPath = null;
@@ -1801,4 +1820,4 @@ function tryJsonParse(str) {
1801
1820
  }
1802
1821
  }
1803
1822
 
1804
- export { BooleanSchema, FATAL_ERROR_TYPES, Internal, NumberSchema, RT_IMAGE_TAG, StringSchema, ValApi, derefPatch, deserializeSchema, initVal };
1823
+ export { BooleanSchema, FATAL_ERROR_TYPES, Internal, NumberSchema, RT_IMAGE_TAG, StringSchema, ValApi, derefPatch, deserializeSchema, initVal, modules };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var expr_dist_valbuildCoreExpr = require('../../dist/index-70585611.cjs.dev.js');
6
- var index = require('../../dist/index-670f24da.cjs.dev.js');
5
+ var expr_dist_valbuildCoreExpr = require('../../dist/index-e8ab2166.cjs.dev.js');
6
+ var index = require('../../dist/index-0df230ef.cjs.dev.js');
7
7
  require('../../dist/result-48320acd.cjs.dev.js');
8
8
 
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var expr_dist_valbuildCoreExpr = require('../../dist/index-7db171cd.cjs.prod.js');
6
- var index = require('../../dist/index-d2faad99.cjs.prod.js');
5
+ var expr_dist_valbuildCoreExpr = require('../../dist/index-2dfaf8f7.cjs.prod.js');
6
+ var index = require('../../dist/index-f2552460.cjs.prod.js');
7
7
  require('../../dist/result-26f67b40.cjs.prod.js');
8
8
 
9
9
 
@@ -1,3 +1,3 @@
1
- export { e as evaluate, p as parse } from '../../dist/index-065c2067.esm.js';
2
- export { C as Call, E as Expr, N as NilSym, u as StringLiteral, v as StringTemplate, t as Sym } from '../../dist/index-0a0de0f1.esm.js';
1
+ export { e as evaluate, p as parse } from '../../dist/index-ed5767a3.esm.js';
2
+ export { C as Call, E as Expr, N as NilSym, u as StringLiteral, v as StringTemplate, t as Sym } from '../../dist/index-051c34f3.esm.js';
3
3
  import '../../dist/result-b96df128.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.60.24",
3
+ "version": "0.61.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-670f24da.cjs.dev.js');
5
+ var index = require('../../dist/index-0df230ef.cjs.dev.js');
6
6
  var result = require('../../dist/result-48320acd.cjs.dev.js');
7
7
  var util = require('../../dist/util-b213092b.cjs.dev.js');
8
- var ops = require('../../dist/ops-61b64d16.cjs.dev.js');
8
+ var ops = require('../../dist/ops-34737ef0.cjs.dev.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-d2faad99.cjs.prod.js');
5
+ var index = require('../../dist/index-f2552460.cjs.prod.js');
6
6
  var result = require('../../dist/result-26f67b40.cjs.prod.js');
7
7
  var util = require('../../dist/util-030d8a1f.cjs.prod.js');
8
- var ops = require('../../dist/ops-2b2892a3.cjs.prod.js');
8
+ var ops = require('../../dist/ops-92570725.cjs.prod.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -1,8 +1,8 @@
1
- import { e as _typeof, k as _slicedToArray, c as _createClass, a as _classCallCheck, w as _toConsumableArray } from '../../dist/index-0a0de0f1.esm.js';
1
+ import { e as _typeof, k as _slicedToArray, c as _createClass, a as _classCallCheck, w as _toConsumableArray } from '../../dist/index-051c34f3.esm.js';
2
2
  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-b96df128.esm.js';
3
3
  import { p as pipe } from '../../dist/util-18613e99.esm.js';
4
- import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-b552a170.esm.js';
5
- export { P as PatchError } from '../../dist/ops-b552a170.esm.js';
4
+ import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-9262cf01.esm.js';
5
+ export { P as PatchError } from '../../dist/ops-9262cf01.esm.js';
6
6
 
7
7
  function isNotRoot(path) {
8
8
  return isNonEmpty(path);