@optique/core 1.0.0-dev.1860 → 1.0.0-dev.1864
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/annotations.cjs +11 -3
- package/dist/annotations.js +11 -3
- package/package.json +1 -1
package/dist/annotations.cjs
CHANGED
|
@@ -164,9 +164,13 @@ function createProtectedMapView(target, context) {
|
|
|
164
164
|
const view = new Proxy(cloned, {
|
|
165
165
|
get(clonedTarget, key) {
|
|
166
166
|
if (key === "size") return clonedTarget.size;
|
|
167
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
167
168
|
if (key === "set" || key === "delete" || key === "clear") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
168
|
-
if (key === "get") return cacheProtectedMethod(methodCache, key, () => (lookup) =>
|
|
169
|
-
|
|
169
|
+
if (key === "get") return cacheProtectedMethod(methodCache, key, () => (lookup) => {
|
|
170
|
+
if (clonedTarget.has(lookup)) return protectAnnotationValue(clonedTarget.get(lookup), context);
|
|
171
|
+
return protectAnnotationValue(clonedTarget.get(unwrapProtectedAnnotationTarget(lookup)), context);
|
|
172
|
+
});
|
|
173
|
+
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(lookup) || clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
170
174
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1, mapKey) => {
|
|
171
175
|
callback.call(thisArg, protectAnnotationValue(value$1, context), protectAnnotationValue(mapKey, context), view);
|
|
172
176
|
}));
|
|
@@ -210,8 +214,9 @@ function createProtectedSetView(target, context) {
|
|
|
210
214
|
const view = new Proxy(cloned, {
|
|
211
215
|
get(clonedTarget, key) {
|
|
212
216
|
if (key === "size") return clonedTarget.size;
|
|
217
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
213
218
|
if (key === "add" || key === "delete" || key === "clear") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
214
|
-
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
219
|
+
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(lookup) || clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
215
220
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1) => {
|
|
216
221
|
const protectedValue = protectAnnotationValue(value$1, context);
|
|
217
222
|
callback.call(thisArg, protectedValue, protectedValue, view);
|
|
@@ -285,6 +290,7 @@ function createProtectedRegExpView(target, context) {
|
|
|
285
290
|
const view = new Proxy(cloned, {
|
|
286
291
|
get(clonedTarget, key) {
|
|
287
292
|
if (key === "compile") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
293
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
288
294
|
const ownDescriptor = Object.getOwnPropertyDescriptor(clonedTarget, key);
|
|
289
295
|
if (ownDescriptor != null && "value" in ownDescriptor) return ownDescriptor.value;
|
|
290
296
|
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
@@ -317,6 +323,7 @@ function createProtectedURLSearchParamsView(target, context) {
|
|
|
317
323
|
const view = new Proxy(cloned, {
|
|
318
324
|
get(clonedTarget, key) {
|
|
319
325
|
if (key === "append" || key === "delete" || key === "set" || key === "sort") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
326
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
320
327
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1, name) => {
|
|
321
328
|
callback.call(thisArg, value$1, name, view);
|
|
322
329
|
}));
|
|
@@ -355,6 +362,7 @@ function createProtectedURLView(target, context) {
|
|
|
355
362
|
const cloned = new URL(target.href);
|
|
356
363
|
const view = new Proxy(cloned, {
|
|
357
364
|
get(clonedTarget, key) {
|
|
365
|
+
if (key === "valueOf") return () => view;
|
|
358
366
|
if (key === "searchParams") return protectAnnotationValue(clonedTarget.searchParams, context);
|
|
359
367
|
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
360
368
|
return typeof value === "function" ? value.bind(clonedTarget) : protectAnnotationValue(value, context);
|
package/dist/annotations.js
CHANGED
|
@@ -163,9 +163,13 @@ function createProtectedMapView(target, context) {
|
|
|
163
163
|
const view = new Proxy(cloned, {
|
|
164
164
|
get(clonedTarget, key) {
|
|
165
165
|
if (key === "size") return clonedTarget.size;
|
|
166
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
166
167
|
if (key === "set" || key === "delete" || key === "clear") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
167
|
-
if (key === "get") return cacheProtectedMethod(methodCache, key, () => (lookup) =>
|
|
168
|
-
|
|
168
|
+
if (key === "get") return cacheProtectedMethod(methodCache, key, () => (lookup) => {
|
|
169
|
+
if (clonedTarget.has(lookup)) return protectAnnotationValue(clonedTarget.get(lookup), context);
|
|
170
|
+
return protectAnnotationValue(clonedTarget.get(unwrapProtectedAnnotationTarget(lookup)), context);
|
|
171
|
+
});
|
|
172
|
+
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(lookup) || clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
169
173
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1, mapKey) => {
|
|
170
174
|
callback.call(thisArg, protectAnnotationValue(value$1, context), protectAnnotationValue(mapKey, context), view);
|
|
171
175
|
}));
|
|
@@ -209,8 +213,9 @@ function createProtectedSetView(target, context) {
|
|
|
209
213
|
const view = new Proxy(cloned, {
|
|
210
214
|
get(clonedTarget, key) {
|
|
211
215
|
if (key === "size") return clonedTarget.size;
|
|
216
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
212
217
|
if (key === "add" || key === "delete" || key === "clear") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
213
|
-
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
218
|
+
if (key === "has") return cacheProtectedMethod(methodCache, key, () => (lookup) => clonedTarget.has(lookup) || clonedTarget.has(unwrapProtectedAnnotationTarget(lookup)));
|
|
214
219
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1) => {
|
|
215
220
|
const protectedValue = protectAnnotationValue(value$1, context);
|
|
216
221
|
callback.call(thisArg, protectedValue, protectedValue, view);
|
|
@@ -284,6 +289,7 @@ function createProtectedRegExpView(target, context) {
|
|
|
284
289
|
const view = new Proxy(cloned, {
|
|
285
290
|
get(clonedTarget, key) {
|
|
286
291
|
if (key === "compile") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
292
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
287
293
|
const ownDescriptor = Object.getOwnPropertyDescriptor(clonedTarget, key);
|
|
288
294
|
if (ownDescriptor != null && "value" in ownDescriptor) return ownDescriptor.value;
|
|
289
295
|
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
@@ -316,6 +322,7 @@ function createProtectedURLSearchParamsView(target, context) {
|
|
|
316
322
|
const view = new Proxy(cloned, {
|
|
317
323
|
get(clonedTarget, key) {
|
|
318
324
|
if (key === "append" || key === "delete" || key === "set" || key === "sort") return cacheProtectedMethod(methodCache, key, () => (..._args) => throwReadonlyAnnotationMutation());
|
|
325
|
+
if (key === "valueOf") return cacheProtectedMethod(methodCache, key, () => () => view);
|
|
319
326
|
if (key === "forEach") return cacheProtectedMethod(methodCache, key, () => (callback, thisArg) => clonedTarget.forEach((value$1, name) => {
|
|
320
327
|
callback.call(thisArg, value$1, name, view);
|
|
321
328
|
}));
|
|
@@ -354,6 +361,7 @@ function createProtectedURLView(target, context) {
|
|
|
354
361
|
const cloned = new URL(target.href);
|
|
355
362
|
const view = new Proxy(cloned, {
|
|
356
363
|
get(clonedTarget, key) {
|
|
364
|
+
if (key === "valueOf") return () => view;
|
|
357
365
|
if (key === "searchParams") return protectAnnotationValue(clonedTarget.searchParams, context);
|
|
358
366
|
const value = Reflect.get(clonedTarget, key, clonedTarget);
|
|
359
367
|
return typeof value === "function" ? value.bind(clonedTarget) : protectAnnotationValue(value, context);
|