@optique/core 1.0.0-dev.1858 → 1.0.0-dev.1860
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 +7 -2
- package/dist/annotations.d.cts +1 -1
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +7 -2
- package/package.json +1 -1
package/dist/annotations.cjs
CHANGED
|
@@ -104,6 +104,9 @@ function copyOwnProperties(source, target, transformValue, excludedKeys) {
|
|
|
104
104
|
Object.defineProperty(target, key, descriptor);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
function normalizeProtectedCollectionItem(value, context) {
|
|
108
|
+
return context.rewrapProtectedViews && isProtectedAnnotationView(value) ? unwrapProtectedAnnotationTarget(value) : value;
|
|
109
|
+
}
|
|
107
110
|
const regExpExcludedKeys = new Set(["lastIndex"]);
|
|
108
111
|
function copyRegExpMetadata(source, target, transformValue) {
|
|
109
112
|
copyOwnProperties(source, target, transformValue, regExpExcludedKeys);
|
|
@@ -156,7 +159,8 @@ function createProtectedObjectView(target, context) {
|
|
|
156
159
|
}
|
|
157
160
|
function createProtectedMapView(target, context) {
|
|
158
161
|
const methodCache = /* @__PURE__ */ new Map();
|
|
159
|
-
const cloned = new Map(
|
|
162
|
+
const cloned = /* @__PURE__ */ new Map();
|
|
163
|
+
for (const [entryKey, entryValue] of target.entries()) cloned.set(normalizeProtectedCollectionItem(entryKey, context), normalizeProtectedCollectionItem(entryValue, context));
|
|
160
164
|
const view = new Proxy(cloned, {
|
|
161
165
|
get(clonedTarget, key) {
|
|
162
166
|
if (key === "size") return clonedTarget.size;
|
|
@@ -201,7 +205,8 @@ function createProtectedMapView(target, context) {
|
|
|
201
205
|
}
|
|
202
206
|
function createProtectedSetView(target, context) {
|
|
203
207
|
const methodCache = /* @__PURE__ */ new Map();
|
|
204
|
-
const cloned = new Set(
|
|
208
|
+
const cloned = /* @__PURE__ */ new Set();
|
|
209
|
+
for (const value of target.values()) cloned.add(normalizeProtectedCollectionItem(value, context));
|
|
205
210
|
const view = new Proxy(cloned, {
|
|
206
211
|
get(clonedTarget, key) {
|
|
207
212
|
if (key === "size") return clonedTarget.size;
|
package/dist/annotations.d.cts
CHANGED
|
@@ -88,7 +88,7 @@ interface ParseOptions {
|
|
|
88
88
|
* Optique treats these values as immutable input and exposes them back to
|
|
89
89
|
* parsers only through protected read-only views.
|
|
90
90
|
*/
|
|
91
|
-
annotations?: Annotations | ReadonlyAnnotations;
|
|
91
|
+
readonly annotations?: Annotations | ReadonlyAnnotations;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Extracts annotations from parser state.
|
package/dist/annotations.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ interface ParseOptions {
|
|
|
88
88
|
* Optique treats these values as immutable input and exposes them back to
|
|
89
89
|
* parsers only through protected read-only views.
|
|
90
90
|
*/
|
|
91
|
-
annotations?: Annotations | ReadonlyAnnotations;
|
|
91
|
+
readonly annotations?: Annotations | ReadonlyAnnotations;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Extracts annotations from parser state.
|
package/dist/annotations.js
CHANGED
|
@@ -103,6 +103,9 @@ function copyOwnProperties(source, target, transformValue, excludedKeys) {
|
|
|
103
103
|
Object.defineProperty(target, key, descriptor);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
function normalizeProtectedCollectionItem(value, context) {
|
|
107
|
+
return context.rewrapProtectedViews && isProtectedAnnotationView(value) ? unwrapProtectedAnnotationTarget(value) : value;
|
|
108
|
+
}
|
|
106
109
|
const regExpExcludedKeys = new Set(["lastIndex"]);
|
|
107
110
|
function copyRegExpMetadata(source, target, transformValue) {
|
|
108
111
|
copyOwnProperties(source, target, transformValue, regExpExcludedKeys);
|
|
@@ -155,7 +158,8 @@ function createProtectedObjectView(target, context) {
|
|
|
155
158
|
}
|
|
156
159
|
function createProtectedMapView(target, context) {
|
|
157
160
|
const methodCache = /* @__PURE__ */ new Map();
|
|
158
|
-
const cloned = new Map(
|
|
161
|
+
const cloned = /* @__PURE__ */ new Map();
|
|
162
|
+
for (const [entryKey, entryValue] of target.entries()) cloned.set(normalizeProtectedCollectionItem(entryKey, context), normalizeProtectedCollectionItem(entryValue, context));
|
|
159
163
|
const view = new Proxy(cloned, {
|
|
160
164
|
get(clonedTarget, key) {
|
|
161
165
|
if (key === "size") return clonedTarget.size;
|
|
@@ -200,7 +204,8 @@ function createProtectedMapView(target, context) {
|
|
|
200
204
|
}
|
|
201
205
|
function createProtectedSetView(target, context) {
|
|
202
206
|
const methodCache = /* @__PURE__ */ new Map();
|
|
203
|
-
const cloned = new Set(
|
|
207
|
+
const cloned = /* @__PURE__ */ new Set();
|
|
208
|
+
for (const value of target.values()) cloned.add(normalizeProtectedCollectionItem(value, context));
|
|
204
209
|
const view = new Proxy(cloned, {
|
|
205
210
|
get(clonedTarget, key) {
|
|
206
211
|
if (key === "size") return clonedTarget.size;
|