@yiin/reactive-proxy-state 1.0.18 → 1.0.20
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/dist/index.cjs +1612 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -0
- package/dist/mark-raw.d.ts +9 -0
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1240,6 +1240,9 @@ function toRaw(observed) {
|
|
|
1240
1240
|
return raw ? toRaw(raw) : observed;
|
|
1241
1241
|
}
|
|
1242
1242
|
function reactive(obj, emit, path = []) {
|
|
1243
|
+
if (obj["__v_skip" /* SKIP */]) {
|
|
1244
|
+
return obj;
|
|
1245
|
+
}
|
|
1243
1246
|
if (globalSeen.has(obj))
|
|
1244
1247
|
return globalSeen.get(obj);
|
|
1245
1248
|
if (emit && path.length === 0) {
|
|
@@ -1524,6 +1527,18 @@ function watch(source, callback, options = {}) {
|
|
|
1524
1527
|
});
|
|
1525
1528
|
return stopEffect;
|
|
1526
1529
|
}
|
|
1530
|
+
// src/mark-raw.ts
|
|
1531
|
+
function markRaw(obj) {
|
|
1532
|
+
if (obj && typeof obj === "object") {
|
|
1533
|
+
Object.defineProperty(obj, "__v_skip" /* SKIP */, {
|
|
1534
|
+
value: true,
|
|
1535
|
+
enumerable: false,
|
|
1536
|
+
configurable: false,
|
|
1537
|
+
writable: false
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
return obj;
|
|
1541
|
+
}
|
|
1527
1542
|
export {
|
|
1528
1543
|
wrapperCache,
|
|
1529
1544
|
wrapSet,
|
|
@@ -1548,6 +1563,7 @@ export {
|
|
|
1548
1563
|
reactive,
|
|
1549
1564
|
pathConcatCache,
|
|
1550
1565
|
pathCache,
|
|
1566
|
+
markRaw,
|
|
1551
1567
|
isRefSymbol,
|
|
1552
1568
|
isRef,
|
|
1553
1569
|
isReactive,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks an object so that it will never be converted into a reactive proxy.
|
|
3
|
+
*
|
|
4
|
+
* Similar to Vue's `markRaw`, this is useful when you need to store
|
|
5
|
+
* non-reactive, opaque objects (e.g. DOM nodes, complex class instances,
|
|
6
|
+
* third-party library objects) inside a reactive tree without having them
|
|
7
|
+
* wrapped by the reactivity system.
|
|
8
|
+
*/
|
|
9
|
+
export declare function markRaw<T extends object>(obj: T): T;
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yiin/reactive-proxy-state",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"author": "Yiin <stanislovas@yiin.lt>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Yiin/reactive-proxy-state.git"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
|
+
"module": "dist/index.js",
|
|
11
|
+
"type": "module",
|
|
10
12
|
"devDependencies": {
|
|
11
13
|
"bun-types": "^1.2.8",
|
|
12
14
|
"typescript": "^5.0.4",
|
|
@@ -16,7 +18,9 @@
|
|
|
16
18
|
"exports": {
|
|
17
19
|
".": {
|
|
18
20
|
"types": "./dist/index.d.ts",
|
|
19
|
-
"
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs",
|
|
23
|
+
"default": "./dist/index.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"bugs": {
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
"access": "public"
|
|
46
50
|
},
|
|
47
51
|
"scripts": {
|
|
48
|
-
"build": "bun build src/index.ts --outdir dist --target node --format esm && tsc --emitDeclarationOnly --outDir dist",
|
|
52
|
+
"build": "bun build src/index.ts --outdir dist --target node --format esm && bun build src/index.ts --outfile dist/index.cjs --target node --format cjs && tsc --emitDeclarationOnly --outDir dist",
|
|
49
53
|
"test": "bun test",
|
|
50
54
|
"test:watch": "bun test --watch",
|
|
51
55
|
"test:bench": "bun --bun ./benchmarks/state-sync.bench.ts",
|