defuss-runtime 1.0.3 → 1.0.4

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
@@ -211,6 +211,6 @@ All commands are run from the root of the project, from a terminal:
211
211
 
212
212
  ---
213
213
 
214
- <img src="assets/defuss_comic.png" />
214
+ <img src="https://raw.githubusercontent.com/kyr0/defuss/refs/heads/main/assets/defuss_comic.png" />
215
215
 
216
216
  <caption><i><b>Come visit us on defuss island!</b></i></caption>
package/dist/index.cjs CHANGED
@@ -487,6 +487,17 @@ const isInteger = (value) => isSafeNumber(value) && Number.isInteger(value);
487
487
 
488
488
  const isEqual = (value, valueB) => equalsJSON(value, valueB);
489
489
 
490
+ function preload(url, as = "image") {
491
+ const urls = Array.isArray(url) ? url : [url];
492
+ urls.forEach((u) => {
493
+ const p = document.createElement("link");
494
+ p.href = u;
495
+ p.rel = "preload";
496
+ p.as = as;
497
+ document.head.appendChild(p);
498
+ });
499
+ }
500
+
490
501
  exports.PATH_ACCESSOR_SYMBOL = PATH_ACCESSOR_SYMBOL;
491
502
  exports._BASE64_CHARS = _BASE64_CHARS;
492
503
  exports._HEX_PREFIX = _HEX_PREFIX;
@@ -539,6 +550,7 @@ exports.isUrl = isUrl;
539
550
  exports.isUrlPath = isUrlPath;
540
551
  exports.omit = omit;
541
552
  exports.pick = pick;
553
+ exports.preload = preload;
542
554
  exports.setByPath = setByPath;
543
555
  exports.textToBinary = textToBinary;
544
556
  exports.throttle = throttle;
package/dist/index.d.cts CHANGED
@@ -235,4 +235,7 @@ declare const isInteger: ValidatorPrimitiveFn;
235
235
 
236
236
  declare const isEqual: (value: any, valueB: any) => boolean;
237
237
 
238
- export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
238
+ type PreloadAs = "image" | "script" | "style" | "fetch" | "track" | "font";
239
+ declare function preload(url: string | string[], as?: PreloadAs): void;
240
+
241
+ export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
package/dist/index.d.mts CHANGED
@@ -235,4 +235,7 @@ declare const isInteger: ValidatorPrimitiveFn;
235
235
 
236
236
  declare const isEqual: (value: any, valueB: any) => boolean;
237
237
 
238
- export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
238
+ type PreloadAs = "image" | "script" | "style" | "fetch" | "track" | "font";
239
+ declare function preload(url: string | string[], as?: PreloadAs): void;
240
+
241
+ export { type DateValue, type Dynamic, PATH_ACCESSOR_SYMBOL, type PathAccessor, type PreloadAs, type SingleValidationResult, type ValidationFnResult, type ValidationMessage, type ValidationStep, type ValidatorFn, type ValidatorPrimitiveFn, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
package/dist/index.mjs CHANGED
@@ -485,4 +485,15 @@ const isInteger = (value) => isSafeNumber(value) && Number.isInteger(value);
485
485
 
486
486
  const isEqual = (value, valueB) => equalsJSON(value, valueB);
487
487
 
488
- export { PATH_ACCESSOR_SYMBOL, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
488
+ function preload(url, as = "image") {
489
+ const urls = Array.isArray(url) ? url : [url];
490
+ urls.forEach((u) => {
491
+ const p = document.createElement("link");
492
+ p.href = u;
493
+ p.rel = "preload";
494
+ p.as = as;
495
+ document.head.appendChild(p);
496
+ });
497
+ }
498
+
499
+ export { PATH_ACCESSOR_SYMBOL, _BASE64_CHARS, _HEX_PREFIX, _base64LookupMap, _getBase64LookupMap, access, asArray, asBoolean, asDate, asInteger, asNumber, asString, base64ToBinary, binaryToBase64, binaryToHex, binaryToText, createTimeoutPromise, debounce, ensureKey, equalsJSON, getAllKeysFromPath, getByPath, getDateValue, hasPattern, hexToBinary, is, isAfter, isArray, isBefore, isBoolean, isDate, isDefined, isEmail, isEmpty, isEqual, isGreaterThan, isInteger, isLessThan, isLongerThan, isObject, isOneOf, isPathAccessor, isPhoneNumber, isRequired, isSafeNumber, isSafeNumeric, isShorterThan, isSlug, isString, isUrl, isUrlPath, omit, pick, preload, setByPath, textToBinary, throttle, unique, wait, waitForRef, waitForWithPolling };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss-runtime",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,6 +20,13 @@
20
20
  "url": "git+https://github.com/kyr0/defuss.git",
21
21
  "type": "git"
22
22
  },
23
+ "scripts": {
24
+ "clean": "rm -rf ./node_modules/.pnpm",
25
+ "pretest": "pnpm run build",
26
+ "prebuild": "pnpm run clean",
27
+ "build": "pkgroll",
28
+ "test": "vitest --run --coverage"
29
+ },
23
30
  "author": "Aron Homberg <info@aron-homberg.de>",
24
31
  "sideEffects": false,
25
32
  "exports": {
@@ -37,9 +44,7 @@
37
44
  "main": "./dist/index.cjs",
38
45
  "module": "./dist/index.mjs",
39
46
  "types": "./dist/index.d.cts",
40
- "files": [
41
- "dist"
42
- ],
47
+ "files": ["dist"],
43
48
  "engines": {
44
49
  "node": "^18.17.1 || ^20.3.0 || >=21.0.0"
45
50
  },
@@ -49,12 +54,5 @@
49
54
  "typescript": "^5.6.3",
50
55
  "vitest": "^3.1.3",
51
56
  "@vitest/coverage-v8": "^3.1.3"
52
- },
53
- "scripts": {
54
- "clean": "rm -rf ./node_modules/.pnpm",
55
- "pretest": "pnpm run build",
56
- "prebuild": "pnpm run clean",
57
- "build": "pkgroll",
58
- "test": "vitest --run --coverage"
59
57
  }
60
- }
58
+ }