@valbuild/core 0.87.4 → 0.87.5

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.
@@ -52,7 +52,7 @@ export { type SerializedRichTextSchema, RichTextSchema, } from "./schema/richtex
52
52
  export { type SerializedUnionSchema, UnionSchema, type SerializedStringUnionSchema, type SerializedObjectUnionSchema, } from "./schema/union.js";
53
53
  export { type SerializedLiteralSchema, LiteralSchema } from "./schema/literal.js";
54
54
  export { deserializeSchema } from "./schema/deserialize.js";
55
- export { type ListRecordRender, type ListArrayRender, type ReifiedRender, } from "./render.js";
55
+ export { type ListRecordRender, type ListArrayRender, type ReifiedRender, type CodeLanguage, type CodeRender, } from "./render.js";
56
56
  export type { ValRouter, RouteValidationError } from "./router.js";
57
57
  export declare const FATAL_ERROR_TYPES: readonly ["no-schema", "no-source", "invalid-id", "no-module", "invalid-patch"];
58
58
  export type FatalErrorType = (typeof FATAL_ERROR_TYPES)[number];
@@ -28,7 +28,12 @@ export type ListArrayRender = {
28
28
  export type TextareaRender = {
29
29
  layout: "textarea";
30
30
  };
31
- type RenderTypes = ListRecordRender | ListArrayRender | TextareaRender;
31
+ export type CodeLanguage = "typescript" | "javascript" | "javascriptreact" | "typescriptreact" | "json" | "java" | "html" | "css" | "xml" | "markdown" | "sql" | "python" | "rust" | "php" | "go" | "cpp" | "sass" | "vue" | "angular";
32
+ export type CodeRender = {
33
+ layout: "code";
34
+ language: CodeLanguage;
35
+ };
36
+ type RenderTypes = ListRecordRender | ListArrayRender | TextareaRender | CodeRender;
32
37
  type WithStatus<T> = {
33
38
  status: "error";
34
39
  message: string;
@@ -1,5 +1,5 @@
1
1
  import { Schema, SchemaAssertResult, SerializedSchema } from "./index.js";
2
- import { ReifiedRender } from "../render.js";
2
+ import { CodeLanguage, ReifiedRender } from "../render.js";
3
3
  import { ModuleFilePath, SourcePath } from "../val/index.js";
4
4
  import { ValidationErrors } from "./validation/ValidationError.js";
5
5
  type StringOptions = {
@@ -36,6 +36,9 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
36
36
  private readonly renderInput;
37
37
  constructor(options?: StringOptions | undefined, opt?: boolean, isRaw?: boolean, customValidateFunctions?: ((src: Src) => false | string)[], renderInput?: {
38
38
  as: "textarea";
39
+ } | {
40
+ as: "code";
41
+ language: CodeLanguage;
39
42
  } | null);
40
43
  /**
41
44
  * @deprecated Use `minLength` instead
@@ -56,6 +59,9 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
56
59
  protected executeSerialize(): SerializedSchema;
57
60
  render(input: {
58
61
  as: "textarea";
62
+ } | {
63
+ as: "code";
64
+ language: CodeLanguage;
59
65
  }): StringSchema<Src>;
60
66
  protected executeRender(sourcePath: SourcePath | ModuleFilePath, src: Src): ReifiedRender;
61
67
  }
@@ -832,6 +832,15 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
832
832
  key: "executeRender",
833
833
  value: function executeRender(sourcePath, src) {
834
834
  if (this.renderInput) {
835
+ if (this.renderInput.as === "code") {
836
+ return _defineProperty({}, sourcePath, {
837
+ status: "success",
838
+ data: {
839
+ layout: this.renderInput.as,
840
+ language: this.renderInput.language
841
+ }
842
+ });
843
+ }
835
844
  return _defineProperty({}, sourcePath, {
836
845
  status: "success",
837
846
  data: {
@@ -834,6 +834,15 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
834
834
  key: "executeRender",
835
835
  value: function executeRender(sourcePath, src) {
836
836
  if (this.renderInput) {
837
+ if (this.renderInput.as === "code") {
838
+ return _defineProperty({}, sourcePath, {
839
+ status: "success",
840
+ data: {
841
+ layout: this.renderInput.as,
842
+ language: this.renderInput.language
843
+ }
844
+ });
845
+ }
837
846
  return _defineProperty({}, sourcePath, {
838
847
  status: "success",
839
848
  data: {
@@ -834,6 +834,15 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
834
834
  key: "executeRender",
835
835
  value: function executeRender(sourcePath, src) {
836
836
  if (this.renderInput) {
837
+ if (this.renderInput.as === "code") {
838
+ return _defineProperty({}, sourcePath, {
839
+ status: "success",
840
+ data: {
841
+ layout: this.renderInput.as,
842
+ language: this.renderInput.language
843
+ }
844
+ });
845
+ }
837
846
  return _defineProperty({}, sourcePath, {
838
847
  status: "success",
839
848
  data: {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-e3cd5eca.cjs.dev.js');
5
+ var dist_valbuildCore = require('./index-eb1a6b1f.cjs.dev.js');
6
6
  require('./result-bb1f436e.cjs.dev.js');
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-b20e3bab.cjs.prod.js');
5
+ var dist_valbuildCore = require('./index-34063fba.cjs.prod.js');
6
6
  require('./result-787e35f6.cjs.prod.js');
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, f as DEFAULT_VAL_REMOTE_HOST, o as DateSchema, F as FATAL_ERROR_TYPES, g as FILE_REF_PROP, h as FILE_REF_SUBTYPE_TAG, n as FileSchema, G as GenericSelector, l as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, p as RichTextSchema, S as Schema, k as StringSchema, U as UnionSchema, V as VAL_EXTENSION, j as derefPatch, q as deserializeSchema, i as initVal, m as modules } from './index-2b6db652.esm.js';
1
+ export { A as ArraySchema, B as BooleanSchema, e as DEFAULT_APP_HOST, D as DEFAULT_CONTENT_HOST, f as DEFAULT_VAL_REMOTE_HOST, o as DateSchema, F as FATAL_ERROR_TYPES, g as FILE_REF_PROP, h as FILE_REF_SUBTYPE_TAG, n as FileSchema, G as GenericSelector, l as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, p as RichTextSchema, S as Schema, k as StringSchema, U as UnionSchema, V as VAL_EXTENSION, j as derefPatch, q as deserializeSchema, i as initVal, m as modules } from './index-11591a0b.esm.js';
2
2
  import './result-daff1cae.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.87.4",
3
+ "version": "0.87.5",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "repository": {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('../../dist/index-e3cd5eca.cjs.dev.js');
5
+ var dist_valbuildCore = require('../../dist/index-eb1a6b1f.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-b20e3bab.cjs.prod.js');
5
+ var dist_valbuildCore = require('../../dist/index-34063fba.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-2b6db652.esm.js';
2
- export { P as PatchError } from '../../dist/index-2b6db652.esm.js';
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-11591a0b.esm.js';
2
+ export { P as PatchError } from '../../dist/index-11591a0b.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-daff1cae.esm.js';
4
4
  import { p as pipe } from '../../dist/util-18613e99.esm.js';
5
5