@valbuild/core 0.147.0 → 0.148.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @valbuild/core
2
2
 
3
+ ## 0.148.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#818](https://github.com/valbuild/val/pull/818) [`562d032`](https://github.com/valbuild/val/commit/562d03280c3fcf97a80562e8b017dd2125ac4ad1) Thanks [@freekh](https://github.com/freekh)! - Remote files served from a project's own site (addresses like
8
+ `https://www.acme.no/_val/file/…`) are now checked for whether that address
9
+ still serves the project. When a custom domain has been removed or moved to
10
+ another project, the image or file is reported, and **Fix** on the Studio's
11
+ Validate page — or `val validate --fix` — points it at the project's permanent
12
+ `<id>.valstart.dev` address. Nothing is uploaded or downloaded: only the address
13
+ changes.
14
+
15
+ Remote file addresses with a `/_val` prefix after the host are now recognised.
16
+
3
17
  ## 0.147.0
4
18
 
5
19
  ### Minor Changes
@@ -1,3 +1,2 @@
1
- import { Buffer } from "buffer";
2
1
  export declare function hashToRemoteFileHash(hash: string): string;
3
- export declare function getFileHash(text: Buffer): string;
2
+ export declare function getFileHash(bytes: Uint8Array): string;
@@ -1,2 +1,2 @@
1
- export declare const ValidationFix: readonly ["image:add-metadata", "image:check-metadata", "image:upload-remote", "image:download-remote", "image:check-remote", "images:check-remote", "images:upload-remote", "file:add-metadata", "file:check-metadata", "file:upload-remote", "file:download-remote", "file:check-remote", "files:check-remote", "files:upload-remote", "video:add-metadata", "video:upload-remote", "video:download-remote", "videos:add-metadata", "videos:check-remote", "videos:upload-remote", "keyof:check-keys", "image:check-gallery", "file:check-gallery", "video:check-gallery", "router:check-route", "locale:check-locale", "router:check-locale-param", "images:check-unique-folder", "files:check-unique-folder", "images:check-all-files", "files:check-all-files", "videos:check-unique-folder", "videos:check-all-files", "jsonValues:extract-entry", "record:fill-keys", "external:upload", "view:check-module"];
1
+ export declare const ValidationFix: readonly ["image:add-metadata", "image:check-metadata", "image:upload-remote", "image:download-remote", "image:check-remote", "images:check-remote", "images:upload-remote", "file:add-metadata", "file:check-metadata", "file:upload-remote", "file:download-remote", "file:check-remote", "files:check-remote", "files:upload-remote", "video:add-metadata", "video:upload-remote", "video:download-remote", "videos:add-metadata", "videos:check-remote", "videos:upload-remote", "keyof:check-keys", "image:check-gallery", "file:check-gallery", "video:check-gallery", "router:check-route", "locale:check-locale", "router:check-locale-param", "images:check-unique-folder", "files:check-unique-folder", "images:check-all-files", "files:check-all-files", "videos:check-unique-folder", "videos:check-all-files", "jsonValues:extract-entry", "record:fill-keys", "external:upload", "view:check-module", "remote:rewrite-host"];
2
2
  export type ValidationFix = (typeof ValidationFix)[number];
@@ -2784,7 +2784,14 @@ function _objectWithoutProperties(e, t) {
2784
2784
  return i;
2785
2785
  }
2786
2786
 
2787
- var RegEx$1 = /^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2787
+ /**
2788
+ * The host part may carry a `/_val` prefix: a ref served by the platform
2789
+ * loader names `https://www.acme.no/_val/file/…`, because a customer's site
2790
+ * can have a `/file/…` route of its own. The prefix is part of `remoteHost`,
2791
+ * so `createRemoteRef(remoteHost, …)` writes it back unchanged. See valbuild/home
2792
+ * `docs/remote-files-on-platform.md`, "The ref".
2793
+ */
2794
+ var RegEx$1 = /^(https?:\/\/[^/]+(?:\/_val)?)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2788
2795
  function splitRemoteRef(ref) {
2789
2796
  if (ref[0] === "/") {
2790
2797
  return {
@@ -16119,8 +16126,8 @@ function hashToRemoteFileHash(hash) {
16119
16126
  return hash.slice(0, 12 // 12 hex characters = 6 bytes = 48 bits = 2^48 = 281474976710656 possibilities or 1 in 281474976710656 or using birthday problem estimate with 10K files: p = (k, n) => (k*k)/(2x2**n) and p(10_000,12*4) = 1.7763568394002505e-7 chance of collision which should be good enough
16120
16127
  );
16121
16128
  }
16122
- function getFileHash(text) {
16123
- return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(text)));
16129
+ function getFileHash(bytes) {
16130
+ return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(bytes)));
16124
16131
  }
16125
16132
 
16126
16133
  var cache$1 = new WeakMap();
@@ -16796,7 +16803,7 @@ function isInlineRender(container) {
16796
16803
 
16797
16804
  var corePackageJson = {
16798
16805
  name: "@valbuild/core",
16799
- version: "0.147.0",
16806
+ version: "0.148.0",
16800
16807
  "private": false,
16801
16808
  description: "Val - supercharged hard-coded content",
16802
16809
  repository: {
@@ -2786,7 +2786,14 @@ function _objectWithoutProperties(e, t) {
2786
2786
  return i;
2787
2787
  }
2788
2788
 
2789
- var RegEx$1 = /^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2789
+ /**
2790
+ * The host part may carry a `/_val` prefix: a ref served by the platform
2791
+ * loader names `https://www.acme.no/_val/file/…`, because a customer's site
2792
+ * can have a `/file/…` route of its own. The prefix is part of `remoteHost`,
2793
+ * so `createRemoteRef(remoteHost, …)` writes it back unchanged. See valbuild/home
2794
+ * `docs/remote-files-on-platform.md`, "The ref".
2795
+ */
2796
+ var RegEx$1 = /^(https?:\/\/[^/]+(?:\/_val)?)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2790
2797
  function splitRemoteRef(ref) {
2791
2798
  if (ref[0] === "/") {
2792
2799
  return {
@@ -16121,8 +16128,8 @@ function hashToRemoteFileHash(hash) {
16121
16128
  return hash.slice(0, 12 // 12 hex characters = 6 bytes = 48 bits = 2^48 = 281474976710656 possibilities or 1 in 281474976710656 or using birthday problem estimate with 10K files: p = (k, n) => (k*k)/(2x2**n) and p(10_000,12*4) = 1.7763568394002505e-7 chance of collision which should be good enough
16122
16129
  );
16123
16130
  }
16124
- function getFileHash(text) {
16125
- return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(text)));
16131
+ function getFileHash(bytes) {
16132
+ return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(bytes)));
16126
16133
  }
16127
16134
 
16128
16135
  var cache$1 = new WeakMap();
@@ -16798,7 +16805,7 @@ function isInlineRender(container) {
16798
16805
 
16799
16806
  var corePackageJson = {
16800
16807
  name: "@valbuild/core",
16801
- version: "0.147.0",
16808
+ version: "0.148.0",
16802
16809
  "private": false,
16803
16810
  description: "Val - supercharged hard-coded content",
16804
16811
  repository: {
@@ -2786,7 +2786,14 @@ function _objectWithoutProperties(e, t) {
2786
2786
  return i;
2787
2787
  }
2788
2788
 
2789
- var RegEx$1 = /^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2789
+ /**
2790
+ * The host part may carry a `/_val` prefix: a ref served by the platform
2791
+ * loader names `https://www.acme.no/_val/file/…`, because a customer's site
2792
+ * can have a `/file/…` route of its own. The prefix is part of `remoteHost`,
2793
+ * so `createRemoteRef(remoteHost, …)` writes it back unchanged. See valbuild/home
2794
+ * `docs/remote-files-on-platform.md`, "The ref".
2795
+ */
2796
+ var RegEx$1 = /^(https?:\/\/[^/]+(?:\/_val)?)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2790
2797
  function splitRemoteRef(ref) {
2791
2798
  if (ref[0] === "/") {
2792
2799
  return {
@@ -16121,8 +16128,8 @@ function hashToRemoteFileHash(hash) {
16121
16128
  return hash.slice(0, 12 // 12 hex characters = 6 bytes = 48 bits = 2^48 = 281474976710656 possibilities or 1 in 281474976710656 or using birthday problem estimate with 10K files: p = (k, n) => (k*k)/(2x2**n) and p(10_000,12*4) = 1.7763568394002505e-7 chance of collision which should be good enough
16122
16129
  );
16123
16130
  }
16124
- function getFileHash(text) {
16125
- return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(text)));
16131
+ function getFileHash(bytes) {
16132
+ return hashToRemoteFileHash(getSHA256Hash(new Uint8Array(bytes)));
16126
16133
  }
16127
16134
 
16128
16135
  var cache$1 = new WeakMap();
@@ -16798,7 +16805,7 @@ function isInlineRender(container) {
16798
16805
 
16799
16806
  var corePackageJson = {
16800
16807
  name: "@valbuild/core",
16801
- version: "0.147.0",
16808
+ version: "0.148.0",
16802
16809
  "private": false,
16803
16810
  description: "Val - supercharged hard-coded content",
16804
16811
  repository: {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-63547301.cjs.dev.js');
5
+ var dist_valbuildCore = require('./index-b0fa804a.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-989ebd80.cjs.prod.js');
5
+ var dist_valbuildCore = require('./index-ad3488f6.cjs.prod.js');
6
6
  require('./result-787e35f6.cjs.prod.js');
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export { H as ASSISTANT_SETTINGS_MAX_LENGTH, A as ArraySchema, B as BooleanSchema, a4 as CODE_LANGUAGES, a5 as COLOR_FORMATS, a3 as CodeSchema, a2 as ColorSchema, e as DEFAULT_APP_HOST, a6 as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, u as DEFAULT_FONT_ACCEPT, f as DEFAULT_STATIC_HOST, o as DEFAULT_VAL_REMOTE_HOST, x as DEFAULT_VIDEO_ACCEPT, y as DEFAULT_VIDEO_RENDITIONS, z as DEFAULT_VIDEO_SEGMENT_DURATION, C as DateSchema, a7 as DateTimeSchema, ad as DiscriminatedUnionSchema, ae as EnumSchema, F as FATAL_ERROR_TYPES, v as FONT_MIME_TYPES, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, a8 as KeyOfSchema, af as LiteralSchema, Z as LocaleSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, ac as RichTextSchema, ab as RouteSchema, Q as SETTINGS_MODULE_CONVENTION, S as Schema, E as SettingsSchema, q as StringSchema, T as THEME_LOGO_DIRECTORY, K as THEME_RADIUS_LENGTHS, J as THEME_RADIUS_STEPS, av as UNSAFE_URL_SCHEMES, V as VAL_EXTENSION, a9 as ValViewSchema, w as VideoSchema, L as assistantAvailability, k as computeSchemaSha, j as computeSourcesSha, h as computeValModuleShas, $ as declaredKeySetOf, p as derefPatch, ar as describeSchemeRejection, ag as deserializeSchema, a1 as discriminatedUnionBranchOf, g as extractValModules, ao as getSourcePathFromRoute, n as hasMediaSchema, l as hasRemoteFileSchema, i as initVal, as as isCheckableScheme, ai as isInlineRender, ap as isPageRouter, U as isRootModuleFilePath, aa as isValViewSource, Y as localeOfValue, X as localeTagError, an as matchRoutePattern, a0 as missingDeclaredKeys, m as modules, aj as parseNextJsRoutePattern, ak as parseTanStackRoutePattern, ah as previewScope, at as rejectScheme, W as resolveSettingsModule, aq as routePatternOf, au as schemeOf, al as tanStackSegmentsOfRoutePath, am as validateUrlAgainstPattern } from './index-cb122769.esm.js';
1
+ export { H as ASSISTANT_SETTINGS_MAX_LENGTH, A as ArraySchema, B as BooleanSchema, a4 as CODE_LANGUAGES, a5 as COLOR_FORMATS, a3 as CodeSchema, a2 as ColorSchema, e as DEFAULT_APP_HOST, a6 as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, u as DEFAULT_FONT_ACCEPT, f as DEFAULT_STATIC_HOST, o as DEFAULT_VAL_REMOTE_HOST, x as DEFAULT_VIDEO_ACCEPT, y as DEFAULT_VIDEO_RENDITIONS, z as DEFAULT_VIDEO_SEGMENT_DURATION, C as DateSchema, a7 as DateTimeSchema, ad as DiscriminatedUnionSchema, ae as EnumSchema, F as FATAL_ERROR_TYPES, v as FONT_MIME_TYPES, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, a8 as KeyOfSchema, af as LiteralSchema, Z as LocaleSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, ac as RichTextSchema, ab as RouteSchema, Q as SETTINGS_MODULE_CONVENTION, S as Schema, E as SettingsSchema, q as StringSchema, T as THEME_LOGO_DIRECTORY, K as THEME_RADIUS_LENGTHS, J as THEME_RADIUS_STEPS, av as UNSAFE_URL_SCHEMES, V as VAL_EXTENSION, a9 as ValViewSchema, w as VideoSchema, L as assistantAvailability, k as computeSchemaSha, j as computeSourcesSha, h as computeValModuleShas, $ as declaredKeySetOf, p as derefPatch, ar as describeSchemeRejection, ag as deserializeSchema, a1 as discriminatedUnionBranchOf, g as extractValModules, ao as getSourcePathFromRoute, n as hasMediaSchema, l as hasRemoteFileSchema, i as initVal, as as isCheckableScheme, ai as isInlineRender, ap as isPageRouter, U as isRootModuleFilePath, aa as isValViewSource, Y as localeOfValue, X as localeTagError, an as matchRoutePattern, a0 as missingDeclaredKeys, m as modules, aj as parseNextJsRoutePattern, ak as parseTanStackRoutePattern, ah as previewScope, at as rejectScheme, W as resolveSettingsModule, aq as routePatternOf, au as schemeOf, al as tanStackSegmentsOfRoutePath, am as validateUrlAgainstPattern } from './index-09bd1d7d.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.147.0",
3
+ "version": "0.148.0",
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-63547301.cjs.dev.js');
5
+ var dist_valbuildCore = require('../../dist/index-b0fa804a.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-989ebd80.cjs.prod.js');
5
+ var dist_valbuildCore = require('../../dist/index-ad3488f6.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-cb122769.esm.js';
2
- export { P as PatchError } from '../../dist/index-cb122769.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-09bd1d7d.esm.js';
2
+ export { P as PatchError } from '../../dist/index-09bd1d7d.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