@optique/core 1.3.0-dev.2583 → 1.3.0-dev.2585
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/valueparser.cjs +8 -8
- package/dist/valueparser.js +8 -8
- package/package.json +2 -2
package/dist/valueparser.cjs
CHANGED
|
@@ -2817,7 +2817,7 @@ function origin(options = {}) {
|
|
|
2817
2817
|
const invalidOrigin = options.errors?.invalidOrigin;
|
|
2818
2818
|
const disallowedProtocol = options.errors?.disallowedProtocol;
|
|
2819
2819
|
function invalidOriginError(input) {
|
|
2820
|
-
return invalidOrigin ? typeof invalidOrigin === "function" ? invalidOrigin(input) : invalidOrigin : require_message.message`Invalid origin
|
|
2820
|
+
return invalidOrigin ? typeof invalidOrigin === "function" ? invalidOrigin(input) : invalidOrigin : require_message.message`Invalid origin.`;
|
|
2821
2821
|
}
|
|
2822
2822
|
function disallowedProtocolError(protocol) {
|
|
2823
2823
|
return disallowedProtocol ? typeof disallowedProtocol === "function" ? disallowedProtocol(protocol, originalProtocols) : disallowedProtocol : [
|
|
@@ -2853,18 +2853,18 @@ function origin(options = {}) {
|
|
|
2853
2853
|
} else if (!hostname$1.endsWith(".")) url$1.hostname = `${hostname$1}.`;
|
|
2854
2854
|
return url$1;
|
|
2855
2855
|
}
|
|
2856
|
-
function resolve(url$1
|
|
2856
|
+
function resolve(url$1) {
|
|
2857
2857
|
if (allowedProtocols != null && !allowedProtocols.includes(url$1.protocol)) return {
|
|
2858
2858
|
success: false,
|
|
2859
2859
|
error: disallowedProtocolError(url$1.protocol)
|
|
2860
2860
|
};
|
|
2861
2861
|
if (url$1.protocol === "blob:") return {
|
|
2862
2862
|
success: false,
|
|
2863
|
-
error: require_message.message`The
|
|
2863
|
+
error: require_message.message`The ${url$1.protocol} URL wraps another origin. Pass that origin instead.`
|
|
2864
2864
|
};
|
|
2865
2865
|
if (url$1.origin === "null") return {
|
|
2866
2866
|
success: false,
|
|
2867
|
-
error: require_message.message`The
|
|
2867
|
+
error: require_message.message`The ${url$1.protocol} URL has no origin.`
|
|
2868
2868
|
};
|
|
2869
2869
|
if (url$1.username !== "" || url$1.password !== "") return {
|
|
2870
2870
|
success: false,
|
|
@@ -2872,7 +2872,7 @@ function origin(options = {}) {
|
|
|
2872
2872
|
};
|
|
2873
2873
|
if (extraComponents === "reject" && (url$1.pathname !== "/" || url$1.search !== "" || url$1.hash !== "")) return {
|
|
2874
2874
|
success: false,
|
|
2875
|
-
error: require_message.message`Expected only an origin, but got
|
|
2875
|
+
error: require_message.message`Expected only an origin, but got extra components on ${url$1.origin}.`
|
|
2876
2876
|
};
|
|
2877
2877
|
return {
|
|
2878
2878
|
success: true,
|
|
@@ -2890,21 +2890,21 @@ function origin(options = {}) {
|
|
|
2890
2890
|
success: false,
|
|
2891
2891
|
error: invalidOriginError(input)
|
|
2892
2892
|
};
|
|
2893
|
-
return resolve(new URL(input)
|
|
2893
|
+
return resolve(new URL(input));
|
|
2894
2894
|
},
|
|
2895
2895
|
validate(value) {
|
|
2896
2896
|
if (!(value instanceof URL)) return {
|
|
2897
2897
|
success: false,
|
|
2898
2898
|
error: invalidOriginError(String(value))
|
|
2899
2899
|
};
|
|
2900
|
-
return resolve(value
|
|
2900
|
+
return resolve(value);
|
|
2901
2901
|
},
|
|
2902
2902
|
format(value) {
|
|
2903
2903
|
return value.origin;
|
|
2904
2904
|
},
|
|
2905
2905
|
normalize(value) {
|
|
2906
2906
|
if (!(value instanceof URL)) return value;
|
|
2907
|
-
const result = resolve(value
|
|
2907
|
+
const result = resolve(value);
|
|
2908
2908
|
return result.success ? result.value : value;
|
|
2909
2909
|
},
|
|
2910
2910
|
*suggest(prefix) {
|
package/dist/valueparser.js
CHANGED
|
@@ -2817,7 +2817,7 @@ function origin(options = {}) {
|
|
|
2817
2817
|
const invalidOrigin = options.errors?.invalidOrigin;
|
|
2818
2818
|
const disallowedProtocol = options.errors?.disallowedProtocol;
|
|
2819
2819
|
function invalidOriginError(input) {
|
|
2820
|
-
return invalidOrigin ? typeof invalidOrigin === "function" ? invalidOrigin(input) : invalidOrigin : message`Invalid origin
|
|
2820
|
+
return invalidOrigin ? typeof invalidOrigin === "function" ? invalidOrigin(input) : invalidOrigin : message`Invalid origin.`;
|
|
2821
2821
|
}
|
|
2822
2822
|
function disallowedProtocolError(protocol) {
|
|
2823
2823
|
return disallowedProtocol ? typeof disallowedProtocol === "function" ? disallowedProtocol(protocol, originalProtocols) : disallowedProtocol : [
|
|
@@ -2853,18 +2853,18 @@ function origin(options = {}) {
|
|
|
2853
2853
|
} else if (!hostname$1.endsWith(".")) url$1.hostname = `${hostname$1}.`;
|
|
2854
2854
|
return url$1;
|
|
2855
2855
|
}
|
|
2856
|
-
function resolve(url$1
|
|
2856
|
+
function resolve(url$1) {
|
|
2857
2857
|
if (allowedProtocols != null && !allowedProtocols.includes(url$1.protocol)) return {
|
|
2858
2858
|
success: false,
|
|
2859
2859
|
error: disallowedProtocolError(url$1.protocol)
|
|
2860
2860
|
};
|
|
2861
2861
|
if (url$1.protocol === "blob:") return {
|
|
2862
2862
|
success: false,
|
|
2863
|
-
error: message`The
|
|
2863
|
+
error: message`The ${url$1.protocol} URL wraps another origin. Pass that origin instead.`
|
|
2864
2864
|
};
|
|
2865
2865
|
if (url$1.origin === "null") return {
|
|
2866
2866
|
success: false,
|
|
2867
|
-
error: message`The
|
|
2867
|
+
error: message`The ${url$1.protocol} URL has no origin.`
|
|
2868
2868
|
};
|
|
2869
2869
|
if (url$1.username !== "" || url$1.password !== "") return {
|
|
2870
2870
|
success: false,
|
|
@@ -2872,7 +2872,7 @@ function origin(options = {}) {
|
|
|
2872
2872
|
};
|
|
2873
2873
|
if (extraComponents === "reject" && (url$1.pathname !== "/" || url$1.search !== "" || url$1.hash !== "")) return {
|
|
2874
2874
|
success: false,
|
|
2875
|
-
error: message`Expected only an origin, but got
|
|
2875
|
+
error: message`Expected only an origin, but got extra components on ${url$1.origin}.`
|
|
2876
2876
|
};
|
|
2877
2877
|
return {
|
|
2878
2878
|
success: true,
|
|
@@ -2890,21 +2890,21 @@ function origin(options = {}) {
|
|
|
2890
2890
|
success: false,
|
|
2891
2891
|
error: invalidOriginError(input)
|
|
2892
2892
|
};
|
|
2893
|
-
return resolve(new URL(input)
|
|
2893
|
+
return resolve(new URL(input));
|
|
2894
2894
|
},
|
|
2895
2895
|
validate(value) {
|
|
2896
2896
|
if (!(value instanceof URL)) return {
|
|
2897
2897
|
success: false,
|
|
2898
2898
|
error: invalidOriginError(String(value))
|
|
2899
2899
|
};
|
|
2900
|
-
return resolve(value
|
|
2900
|
+
return resolve(value);
|
|
2901
2901
|
},
|
|
2902
2902
|
format(value) {
|
|
2903
2903
|
return value.origin;
|
|
2904
2904
|
},
|
|
2905
2905
|
normalize(value) {
|
|
2906
2906
|
if (!(value instanceof URL)) return value;
|
|
2907
|
-
const result = resolve(value
|
|
2907
|
+
const result = resolve(value);
|
|
2908
2908
|
return result.success ? result.value : value;
|
|
2909
2909
|
},
|
|
2910
2910
|
*suggest(prefix) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.3.0-dev.
|
|
3
|
+
"version": "1.3.0-dev.2585",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
},
|
|
238
238
|
"sideEffects": false,
|
|
239
239
|
"devDependencies": {
|
|
240
|
-
"@optique/env": "1.3.0-dev.
|
|
240
|
+
"@optique/env": "1.3.0-dev.2585+77a42c40",
|
|
241
241
|
"@types/node": "^24.0.0",
|
|
242
242
|
"fast-check": "^4.7.0",
|
|
243
243
|
"tsdown": "^0.13.0",
|