@valbuild/core 0.60.27 → 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.
@@ -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";
@@ -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;
@@ -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;
@@ -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;
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.60.27",
3
+ "version": "0.61.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {