@fedify/uri-template 2.4.0-dev.1668 → 2.4.0-dev.1727
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/mod.cjs +6 -4
- package/dist/mod.js +6 -4
- package/package.json +1 -1
package/dist/mod.cjs
CHANGED
|
@@ -592,7 +592,8 @@ function expandPrimitive(varSpec, value, spec) {
|
|
|
592
592
|
const prefixed = varSpec.prefix == null ? text : truncateValue(text, varSpec.prefix);
|
|
593
593
|
const encoded = encodeValue(spec.allowReserved)(prefixed);
|
|
594
594
|
if (!spec.named) return [encoded];
|
|
595
|
-
|
|
595
|
+
const name = encodeName(varSpec.name);
|
|
596
|
+
return [expandNamedPair(name, encoded, spec)];
|
|
596
597
|
}
|
|
597
598
|
function expandList(varSpec, encoded, spec) {
|
|
598
599
|
const name = encodeName(varSpec.name);
|
|
@@ -604,7 +605,8 @@ function expandAssociative(varSpec, pairs, spec) {
|
|
|
604
605
|
if (varSpec.explode) return pairs.map(([key, item]) => expandNamedPair(key, item, spec));
|
|
605
606
|
const item = pairs.flat(1).join(",");
|
|
606
607
|
if (!spec.named) return [item];
|
|
607
|
-
|
|
608
|
+
const key = encodeName(varSpec.name);
|
|
609
|
+
return [expandNamedPair(key, item, spec)];
|
|
608
610
|
}
|
|
609
611
|
const expandNamedPair = (key, item, spec) => item === "" ? `${key}${spec.ifEmpty}` : `${key}=${item}`;
|
|
610
612
|
const encodeListMembers = (value, allowReserved) => value.filter((item) => item != null).map(String).map(encodeValue(allowReserved));
|
|
@@ -1412,7 +1414,7 @@ const groupVarOperators = (tokens) => {
|
|
|
1412
1414
|
if (!isExpression(token)) continue;
|
|
1413
1415
|
for (const varSpec of token.vars) {
|
|
1414
1416
|
const set = grouped.get(varSpec.name);
|
|
1415
|
-
if (set == null) grouped.set(varSpec.name, new Set([token.operator]));
|
|
1417
|
+
if (set == null) grouped.set(varSpec.name, /* @__PURE__ */ new Set([token.operator]));
|
|
1416
1418
|
else set.add(token.operator);
|
|
1417
1419
|
}
|
|
1418
1420
|
}
|
|
@@ -1659,7 +1661,7 @@ const isIndexableRoute = (tokens) => {
|
|
|
1659
1661
|
return true;
|
|
1660
1662
|
};
|
|
1661
1663
|
const isIndexableExpression = ({ vars, operator }) => vars.length === 1 && INDEXABLE_OPERATORS.has(operator);
|
|
1662
|
-
const INDEXABLE_OPERATORS = new Set([
|
|
1664
|
+
const INDEXABLE_OPERATORS = /* @__PURE__ */ new Set([
|
|
1663
1665
|
"",
|
|
1664
1666
|
"/",
|
|
1665
1667
|
"+"
|
package/dist/mod.js
CHANGED
|
@@ -591,7 +591,8 @@ function expandPrimitive(varSpec, value, spec) {
|
|
|
591
591
|
const prefixed = varSpec.prefix == null ? text : truncateValue(text, varSpec.prefix);
|
|
592
592
|
const encoded = encodeValue(spec.allowReserved)(prefixed);
|
|
593
593
|
if (!spec.named) return [encoded];
|
|
594
|
-
|
|
594
|
+
const name = encodeName(varSpec.name);
|
|
595
|
+
return [expandNamedPair(name, encoded, spec)];
|
|
595
596
|
}
|
|
596
597
|
function expandList(varSpec, encoded, spec) {
|
|
597
598
|
const name = encodeName(varSpec.name);
|
|
@@ -603,7 +604,8 @@ function expandAssociative(varSpec, pairs, spec) {
|
|
|
603
604
|
if (varSpec.explode) return pairs.map(([key, item]) => expandNamedPair(key, item, spec));
|
|
604
605
|
const item = pairs.flat(1).join(",");
|
|
605
606
|
if (!spec.named) return [item];
|
|
606
|
-
|
|
607
|
+
const key = encodeName(varSpec.name);
|
|
608
|
+
return [expandNamedPair(key, item, spec)];
|
|
607
609
|
}
|
|
608
610
|
const expandNamedPair = (key, item, spec) => item === "" ? `${key}${spec.ifEmpty}` : `${key}=${item}`;
|
|
609
611
|
const encodeListMembers = (value, allowReserved) => value.filter((item) => item != null).map(String).map(encodeValue(allowReserved));
|
|
@@ -1411,7 +1413,7 @@ const groupVarOperators = (tokens) => {
|
|
|
1411
1413
|
if (!isExpression(token)) continue;
|
|
1412
1414
|
for (const varSpec of token.vars) {
|
|
1413
1415
|
const set = grouped.get(varSpec.name);
|
|
1414
|
-
if (set == null) grouped.set(varSpec.name, new Set([token.operator]));
|
|
1416
|
+
if (set == null) grouped.set(varSpec.name, /* @__PURE__ */ new Set([token.operator]));
|
|
1415
1417
|
else set.add(token.operator);
|
|
1416
1418
|
}
|
|
1417
1419
|
}
|
|
@@ -1658,7 +1660,7 @@ const isIndexableRoute = (tokens) => {
|
|
|
1658
1660
|
return true;
|
|
1659
1661
|
};
|
|
1660
1662
|
const isIndexableExpression = ({ vars, operator }) => vars.length === 1 && INDEXABLE_OPERATORS.has(operator);
|
|
1661
|
-
const INDEXABLE_OPERATORS = new Set([
|
|
1663
|
+
const INDEXABLE_OPERATORS = /* @__PURE__ */ new Set([
|
|
1662
1664
|
"",
|
|
1663
1665
|
"/",
|
|
1664
1666
|
"+"
|