@valbuild/core 0.19.0 → 0.20.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.
@@ -47,7 +47,7 @@ export declare function initSchema(): {
47
47
  val?: undefined;
48
48
  valPath?: undefined;
49
49
  } & { [k in Key]: string; }>[]>(key: Key, ...objects: T_1) => import("./schema/index.js").Schema<T_1 extends import("./schema/index.js").Schema<infer S_1 extends import("./selector/index.js").SelectorSource>[] ? S_1 extends import("./selector/index.js").SelectorSource ? S_1 : never : never>;
50
- richtext: <O extends import("./index.js").RichTextOptions>(options: O) => import("./schema/index.js").Schema<import("./index.js").RichTextSource<O>>;
50
+ richtext: <O extends import("./index.js").RichTextOptions>(options?: O | undefined) => import("./schema/index.js").Schema<import("./index.js").RichTextSource<O>>;
51
51
  image: (options?: import("./schema/image.js").ImageOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").FileSource<import("./schema/image.js").ImageMetadata>>;
52
52
  literal: <T_2 extends string>(value: T_2) => import("./schema/index.js").Schema<T_2>;
53
53
  keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject | import("./source/index.js").SourceArray, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/index.js").Schema<Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly any[] ? number : S_2 extends import("./source/index.js").SourceObject ? keyof S_2 : S_2 extends Record<string, any> ? string : never : never>;
@@ -15,4 +15,4 @@ export declare class RichTextSchema<O extends RichTextOptions, Src extends RichT
15
15
  optional(): Schema<RichTextSource<O> | null>;
16
16
  serialize(): SerializedSchema;
17
17
  }
18
- export declare const richtext: <O extends RichTextOptions>(options: O) => Schema<RichTextSource<O>>;
18
+ export declare const richtext: <O extends RichTextOptions>(options?: O | undefined) => Schema<RichTextSource<O>>;
@@ -14,7 +14,7 @@ export type SerializedStringSchema = {
14
14
  export declare class StringSchema<Src extends string | null> extends Schema<Src> {
15
15
  readonly options?: StringOptions | undefined;
16
16
  readonly opt: boolean;
17
- readonly isRaw: boolean;
17
+ private readonly isRaw;
18
18
  constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean);
19
19
  validate(path: SourcePath, src: Src): ValidationErrors;
20
20
  assert(src: Src): boolean;
@@ -11,7 +11,7 @@ export type RichTextOptions = {
11
11
  };
12
12
  export type ParagraphNode<O extends RichTextOptions> = {
13
13
  tag: "p";
14
- children: (string | SpanNode<O> | ImageNode<O>)[];
14
+ children: (string | SpanNode<O>)[];
15
15
  };
16
16
  export type LineThrough<O extends RichTextOptions> = O["lineThrough"] extends true ? "line-through" : never;
17
17
  export type Italic<O extends RichTextOptions> = O["italic"] extends true ? "italic" : never;
@@ -30,7 +30,7 @@ export type ImageNode<O extends RichTextOptions> = O["img"] extends true ? {
30
30
  } : never;
31
31
  export type ListItemNode<O extends RichTextOptions> = {
32
32
  tag: "li";
33
- children: (string | SpanNode<O> | ImageNode<O> | UnorderedListNode<O> | OrderedListNode<O>)[];
33
+ children: (string | SpanNode<O> | UnorderedListNode<O> | OrderedListNode<O>)[];
34
34
  };
35
35
  export type UnorderedListNode<O extends RichTextOptions> = O["ul"] extends true ? {
36
36
  tag: "ul";
@@ -63,7 +63,7 @@ export type AnyRichTextOptions = {
63
63
  };
64
64
  export type RichTextSourceNode<O extends RichTextOptions> = Exclude<RichTextNode<O>, {
65
65
  tag: "img";
66
- }> | ParagraphNode<O> | ListItemNode<O> | ImageNode<O> | SourceNode<O>;
66
+ }> | SourceNode<O>;
67
67
  export type RichTextSource<O extends RichTextOptions> = {
68
68
  [VAL_EXTENSION]: "richtext";
69
69
  children: (HeadingNode<O> | ParagraphNode<O> | UnorderedListNode<O> | OrderedListNode<O> | SourceNode<O>)[];
@@ -416,7 +416,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
416
416
  return RichTextSchema;
417
417
  }(Schema);
418
418
  var richtext = function richtext(options) {
419
- return new RichTextSchema(options);
419
+ return new RichTextSchema(options !== null && options !== void 0 ? options : {});
420
420
  };
421
421
 
422
422
  var RecordSchema = /*#__PURE__*/function (_Schema) {
@@ -418,7 +418,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
418
418
  return RichTextSchema;
419
419
  }(index.Schema);
420
420
  var richtext = function richtext(options) {
421
- return new RichTextSchema(options);
421
+ return new RichTextSchema(options !== null && options !== void 0 ? options : {});
422
422
  };
423
423
 
424
424
  var RecordSchema = /*#__PURE__*/function (_Schema) {
@@ -418,7 +418,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
418
418
  return RichTextSchema;
419
419
  }(index.Schema);
420
420
  var richtext = function richtext(options) {
421
- return new RichTextSchema(options);
421
+ return new RichTextSchema(options !== null && options !== void 0 ? options : {});
422
422
  };
423
423
 
424
424
  var RecordSchema = /*#__PURE__*/function (_Schema) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var index = require('./index-a6e642dd.cjs.dev.js');
6
- var ops = require('./ops-2d7e1742.cjs.dev.js');
6
+ var ops = require('./ops-b0a33248.cjs.dev.js');
7
7
  var marked = require('marked');
8
8
  var expr_dist_valbuildCoreExpr = require('./index-486c7fbf.cjs.dev.js');
9
9
  var result = require('./result-48320acd.cjs.dev.js');
@@ -456,6 +456,9 @@ function parseTokens(tokens) {
456
456
  }];
457
457
  }
458
458
  if (token.type === "text") {
459
+ if ("tokens" in token && Array.isArray(token.tokens)) {
460
+ return parseTokens(token.tokens);
461
+ }
459
462
  return [token.text];
460
463
  }
461
464
  if (token.type === "list") {
@@ -480,7 +483,9 @@ function parseTokens(tokens) {
480
483
  children: [token.text]
481
484
  }];
482
485
  }
483
- console.error("Could not parse markdown: unsupported token type: ".concat(token.type, ". Found: ").concat(token.raw));
486
+ // console.error(
487
+ // `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
488
+ // );
484
489
  return [token.raw];
485
490
  });
486
491
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var index = require('./index-8706c87e.cjs.prod.js');
6
- var ops = require('./ops-ae089ab2.cjs.prod.js');
6
+ var ops = require('./ops-def81fc3.cjs.prod.js');
7
7
  var marked = require('marked');
8
8
  var expr_dist_valbuildCoreExpr = require('./index-601a7d73.cjs.prod.js');
9
9
  var result = require('./result-26f67b40.cjs.prod.js');
@@ -456,6 +456,9 @@ function parseTokens(tokens) {
456
456
  }];
457
457
  }
458
458
  if (token.type === "text") {
459
+ if ("tokens" in token && Array.isArray(token.tokens)) {
460
+ return parseTokens(token.tokens);
461
+ }
459
462
  return [token.text];
460
463
  }
461
464
  if (token.type === "list") {
@@ -480,7 +483,9 @@ function parseTokens(tokens) {
480
483
  children: [token.text]
481
484
  }];
482
485
  }
483
- console.error("Could not parse markdown: unsupported token type: ".concat(token.type, ". Found: ").concat(token.raw));
486
+ // console.error(
487
+ // `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
488
+ // );
484
489
  return [token.raw];
485
490
  });
486
491
  }
@@ -1,6 +1,6 @@
1
1
  import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, G as GetSchema, g as getValPath, i as image, V as VAL_EXTENSION, f as convertFileSource, h as file, j as _objectSpread2, k as _slicedToArray, l as isFile, F as FILE_REF_PROP, P as Path, m as GetSource, n as isSerializedVal, o as getSchema, p as isVal } from './index-bccf1907.esm.js';
2
2
  export { F as FILE_REF_PROP, q as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-bccf1907.esm.js';
3
- import { a as array, o as object, u as union, r as richtext$1, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, i as isSelector, g as getSource, e as resolvePath, s as splitModuleIdAndModulePath } from './ops-7ef32b0a.esm.js';
3
+ import { a as array, o as object, u as union, r as richtext$1, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, i as isSelector, g as getSource, e as resolvePath, s as splitModuleIdAndModulePath } from './ops-22b624eb.esm.js';
4
4
  import * as marked from 'marked';
5
5
  export { i as expr } from './index-5d1ab97c.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';
@@ -433,6 +433,9 @@ function parseTokens(tokens) {
433
433
  }];
434
434
  }
435
435
  if (token.type === "text") {
436
+ if ("tokens" in token && Array.isArray(token.tokens)) {
437
+ return parseTokens(token.tokens);
438
+ }
436
439
  return [token.text];
437
440
  }
438
441
  if (token.type === "list") {
@@ -457,7 +460,9 @@ function parseTokens(tokens) {
457
460
  children: [token.text]
458
461
  }];
459
462
  }
460
- console.error("Could not parse markdown: unsupported token type: ".concat(token.type, ". Found: ").concat(token.raw));
463
+ // console.error(
464
+ // `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
465
+ // );
461
466
  return [token.raw];
462
467
  });
463
468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var index = require('../../dist/index-a6e642dd.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-2d7e1742.cjs.dev.js');
8
+ var ops = require('../../dist/ops-b0a33248.cjs.dev.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var index = require('../../dist/index-8706c87e.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-ae089ab2.cjs.prod.js');
8
+ var ops = require('../../dist/ops-def81fc3.cjs.prod.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -1,8 +1,8 @@
1
1
  import { e as _typeof, k as _slicedToArray, c as _createClass, b as _classCallCheck, u as _toConsumableArray } from '../../dist/index-bccf1907.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-7ef32b0a.esm.js';
5
- export { P as PatchError } from '../../dist/ops-7ef32b0a.esm.js';
4
+ import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-22b624eb.esm.js';
5
+ export { P as PatchError } from '../../dist/ops-22b624eb.esm.js';
6
6
 
7
7
  function isNotRoot(path) {
8
8
  return isNonEmpty(path);
@@ -38,7 +38,7 @@ export class RichTextSchema<
38
38
  }
39
39
 
40
40
  export const richtext = <O extends RichTextOptions>(
41
- options: O
41
+ options?: O
42
42
  ): Schema<RichTextSource<O>> => {
43
- return new RichTextSchema<O, RichTextSource<O>>(options);
43
+ return new RichTextSchema<O, RichTextSource<O>>(options ?? ({} as O));
44
44
  };
@@ -19,7 +19,7 @@ export class StringSchema<Src extends string | null> extends Schema<Src> {
19
19
  constructor(
20
20
  readonly options?: StringOptions,
21
21
  readonly opt: boolean = false,
22
- readonly isRaw: boolean = false
22
+ private readonly isRaw: boolean = false
23
23
  ) {
24
24
  super();
25
25
  }
@@ -19,7 +19,7 @@ export type RichTextOptions = {
19
19
 
20
20
  export type ParagraphNode<O extends RichTextOptions> = {
21
21
  tag: "p";
22
- children: (string | SpanNode<O> | ImageNode<O>)[];
22
+ children: (string | SpanNode<O>)[];
23
23
  // AnchorNode<O>
24
24
  };
25
25
 
@@ -79,7 +79,6 @@ export type ListItemNode<O extends RichTextOptions> = {
79
79
  | string
80
80
  | SpanNode<O>
81
81
  // | AnchorNode<O>
82
- | ImageNode<O>
83
82
  | UnorderedListNode<O>
84
83
  | OrderedListNode<O>
85
84
  )[];
@@ -140,9 +139,6 @@ export type AnyRichTextOptions = {
140
139
 
141
140
  export type RichTextSourceNode<O extends RichTextOptions> =
142
141
  | Exclude<RichTextNode<O>, { tag: "img" }>
143
- | ParagraphNode<O>
144
- | ListItemNode<O>
145
- | ImageNode<O>
146
142
  | SourceNode<O>;
147
143
 
148
144
  export type RichTextSource<O extends RichTextOptions> = {
@@ -230,6 +226,9 @@ function parseTokens<O extends RichTextOptions>(
230
226
  ];
231
227
  }
232
228
  if (token.type === "text") {
229
+ if ("tokens" in token && Array.isArray(token.tokens)) {
230
+ return parseTokens(token.tokens);
231
+ }
233
232
  return [token.text];
234
233
  }
235
234
  if (token.type === "list") {
@@ -261,9 +260,9 @@ function parseTokens<O extends RichTextOptions>(
261
260
  },
262
261
  ];
263
262
  }
264
- console.error(
265
- `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
266
- );
263
+ // console.error(
264
+ // `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
265
+ // );
267
266
  return [token.raw];
268
267
  });
269
268
  }