@valbuild/next 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.
package/README.md CHANGED
@@ -149,7 +149,7 @@ Check out this README or the [examples](./examples) directory for examples.
149
149
  - Install the packages (@valbuild/eslint-plugin is recommended but not required):
150
150
 
151
151
  ```sh
152
- npm install @valbuild/next@latest @valbuild/eslint-plugin@latest
152
+ npm install @valbuild/core@latest @valbuild/next@latest @valbuild/eslint-plugin@latest
153
153
  ```
154
154
 
155
155
  - Run the init script:
@@ -15,11 +15,11 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
15
15
  var React__default = /*#__PURE__*/_interopDefault(React);
16
16
 
17
17
  function useValStega(selector) {
18
- var valEvents = ValContext.useValEvents();
19
18
  var _React$useState = React__default["default"].useState(false),
20
19
  _React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
21
20
  enabled = _React$useState2[0],
22
21
  setEnabled = _React$useState2[1];
22
+ var valEvents = ValContext.useValEvents();
23
23
  React__default["default"].useEffect(function () {
24
24
  setEnabled(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
25
25
  }, [valEvents]);
@@ -15,11 +15,11 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
15
15
  var React__default = /*#__PURE__*/_interopDefault(React);
16
16
 
17
17
  function useValStega(selector) {
18
- var valEvents = ValContext.useValEvents();
19
18
  var _React$useState = React__default["default"].useState(false),
20
19
  _React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
21
20
  enabled = _React$useState2[0],
22
21
  setEnabled = _React$useState2[1];
22
+ var valEvents = ValContext.useValEvents();
23
23
  React__default["default"].useEffect(function () {
24
24
  setEnabled(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
25
25
  }, [valEvents]);
@@ -7,11 +7,11 @@ import { useValEvents } from '../../dist/ValContext-e5293493.esm.js';
7
7
  import '../../dist/unsupportedIterableToArray-51bb61c2.esm.js';
8
8
 
9
9
  function useValStega(selector) {
10
- var valEvents = useValEvents();
11
10
  var _React$useState = React.useState(false),
12
11
  _React$useState2 = _slicedToArray(_React$useState, 2),
13
12
  enabled = _React$useState2[0],
14
13
  setEnabled = _React$useState2[1];
14
+ var valEvents = useValEvents();
15
15
  React.useEffect(function () {
16
16
  setEnabled(document.cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
17
17
  }, [valEvents]);
@@ -4,6 +4,7 @@ export type { ValModule, SerializedModule } from "@valbuild/core";
4
4
  export type { FileSource } from "@valbuild/core";
5
5
  export type { RichTextSource, RichText } from "@valbuild/core";
6
6
  export { type Val, type SerializedVal, type ModuleId, type ModulePath, type SourcePath, type JsonOfSource, } from "@valbuild/core";
7
+ export { modules, type ValModules } from "@valbuild/core";
7
8
  export type { Json, JsonPrimitive } from "@valbuild/core";
8
9
  export type { ValidationErrors, ValidationError } from "@valbuild/core";
9
10
  export type { ValidationFix } from "@valbuild/core";
@@ -1,11 +1,11 @@
1
- import { ValConfig } from "@valbuild/core";
1
+ import { ValConfig, ValModules } from "@valbuild/core";
2
2
  import type { draftMode } from "next/headers";
3
3
  import { NextResponse } from "next/server";
4
- declare const initValNextAppRouter: (config: ValConfig, nextConfig: ValServerNextConfig) => (req: Request) => Promise<NextResponse<unknown>>;
4
+ declare const initValNextAppRouter: (valModules: ValModules, config: ValConfig, nextConfig: ValServerNextConfig) => (req: Request) => Promise<NextResponse<unknown>>;
5
5
  type ValServerNextConfig = {
6
6
  draftMode: typeof draftMode;
7
7
  };
8
- export declare function initValServer(config: ValConfig & {
8
+ export declare function initValServer(valModules: ValModules, config: ValConfig & {
9
9
  disableCache?: boolean;
10
10
  }, nextConfig: ValServerNextConfig): {
11
11
  valNextAppRouter: ReturnType<typeof initValNextAppRouter>;
@@ -195,6 +195,10 @@ Object.defineProperty(exports, 'derefPatch', {
195
195
  get: function () { return core.derefPatch; }
196
196
  });
197
197
  exports.expr = core__namespace;
198
+ Object.defineProperty(exports, 'modules', {
199
+ enumerable: true,
200
+ get: function () { return core.modules; }
201
+ });
198
202
  Object.defineProperty(exports, 'ValRichText', {
199
203
  enumerable: true,
200
204
  get: function () { return internal.ValRichText; }
@@ -195,6 +195,10 @@ Object.defineProperty(exports, 'derefPatch', {
195
195
  get: function () { return core.derefPatch; }
196
196
  });
197
197
  exports.expr = core__namespace;
198
+ Object.defineProperty(exports, 'modules', {
199
+ enumerable: true,
200
+ get: function () { return core.modules; }
201
+ });
198
202
  Object.defineProperty(exports, 'ValRichText', {
199
203
  enumerable: true,
200
204
  get: function () { return internal.ValRichText; }
@@ -2,7 +2,7 @@ import { _ as _objectSpread2 } from './objectSpread2-439bdcdd.esm.js';
2
2
  import { initVal as initVal$1, Internal as Internal$1 } from '@valbuild/core';
3
3
  import * as core from '@valbuild/core';
4
4
  export { core as expr };
5
- export { FILE_REF_PROP, GenericSelector, Schema, VAL_EXTENSION, derefPatch } from '@valbuild/core';
5
+ export { FILE_REF_PROP, GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
6
6
  import { stegaClean, stegaDecodeString, autoTagJSX } from '@valbuild/react/stega';
7
7
  export { ValRichText } from '@valbuild/react/internal';
8
8
  import { ValNextProvider } from './ValNextProvider-23099a43.esm.js';
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "next",
9
9
  "react"
10
10
  ],
11
- "version": "0.60.24",
11
+ "version": "0.61.0",
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
14
  "test": "jest"
@@ -45,10 +45,10 @@
45
45
  "exports": true
46
46
  },
47
47
  "dependencies": {
48
- "@valbuild/core": "~0.60.24",
49
- "@valbuild/react": "~0.60.24",
50
- "@valbuild/server": "~0.60.24",
51
- "@valbuild/ui": "~0.60.24",
48
+ "@valbuild/core": "~0.61.0",
49
+ "@valbuild/react": "~0.61.0",
50
+ "@valbuild/server": "~0.61.0",
51
+ "@valbuild/ui": "~0.61.0",
52
52
  "client-only": "^0.0.1",
53
53
  "server-only": "^0.0.1"
54
54
  },
@@ -344,7 +344,7 @@ function _asyncToGenerator(fn) {
344
344
  };
345
345
  }
346
346
 
347
- var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
347
+ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
348
348
  var route = "/api/val"; // TODO: get from config
349
349
  var coreVersion = core.Internal.VERSION.core;
350
350
  if (!coreVersion) {
@@ -354,7 +354,7 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
354
354
  if (!nextVersion) {
355
355
  throw new Error("Could not get @valbuild/next package version");
356
356
  }
357
- return server.createValApiRouter(route, server.createValServer(route, objectSpread2._objectSpread2({
357
+ return server.createValApiRouter(route, server.createValServer(valModules, route, objectSpread2._objectSpread2({
358
358
  versions: {
359
359
  next: nextVersion,
360
360
  core: coreVersion
@@ -443,9 +443,9 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
443
443
  });
444
444
  };
445
445
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
446
- function initValServer(config, nextConfig) {
446
+ function initValServer(valModules, config, nextConfig) {
447
447
  return {
448
- valNextAppRouter: initValNextAppRouter(config, nextConfig)
448
+ valNextAppRouter: initValNextAppRouter(valModules, config, nextConfig)
449
449
  };
450
450
  }
451
451
 
@@ -344,7 +344,7 @@ function _asyncToGenerator(fn) {
344
344
  };
345
345
  }
346
346
 
347
- var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
347
+ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
348
348
  var route = "/api/val"; // TODO: get from config
349
349
  var coreVersion = core.Internal.VERSION.core;
350
350
  if (!coreVersion) {
@@ -354,7 +354,7 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
354
354
  if (!nextVersion) {
355
355
  throw new Error("Could not get @valbuild/next package version");
356
356
  }
357
- return server.createValApiRouter(route, server.createValServer(route, objectSpread2._objectSpread2({
357
+ return server.createValApiRouter(route, server.createValServer(valModules, route, objectSpread2._objectSpread2({
358
358
  versions: {
359
359
  next: nextVersion,
360
360
  core: coreVersion
@@ -443,9 +443,9 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
443
443
  });
444
444
  };
445
445
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
446
- function initValServer(config, nextConfig) {
446
+ function initValServer(valModules, config, nextConfig) {
447
447
  return {
448
- valNextAppRouter: initValNextAppRouter(config, nextConfig)
448
+ valNextAppRouter: initValNextAppRouter(valModules, config, nextConfig)
449
449
  };
450
450
  }
451
451
 
@@ -340,7 +340,7 @@ function _asyncToGenerator(fn) {
340
340
  };
341
341
  }
342
342
 
343
- var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
343
+ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
344
344
  var route = "/api/val"; // TODO: get from config
345
345
  var coreVersion = Internal.VERSION.core;
346
346
  if (!coreVersion) {
@@ -350,7 +350,7 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
350
350
  if (!nextVersion) {
351
351
  throw new Error("Could not get @valbuild/next package version");
352
352
  }
353
- return createValApiRouter(route, createValServer(route, _objectSpread2({
353
+ return createValApiRouter(route, createValServer(valModules, route, _objectSpread2({
354
354
  versions: {
355
355
  next: nextVersion,
356
356
  core: coreVersion
@@ -439,9 +439,9 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
439
439
  });
440
440
  };
441
441
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
442
- function initValServer(config, nextConfig) {
442
+ function initValServer(valModules, config, nextConfig) {
443
443
  return {
444
- valNextAppRouter: initValNextAppRouter(config, nextConfig)
444
+ valNextAppRouter: initValNextAppRouter(valModules, config, nextConfig)
445
445
  };
446
446
  }
447
447