@hanzo/build 0.2.36 → 0.2.37
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/lib/back.d.ts +1 -1
- package/lib/back.js +14 -4
- package/package.json +1 -1
package/lib/back.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type Landing = {
|
|
|
16
16
|
};
|
|
17
17
|
/** The answer a return carried in `search`, or null when it carried none. */
|
|
18
18
|
export declare function landed(search: string): Landing | null;
|
|
19
|
-
/** `href` without the answer keys; `href` itself when it carries none. */
|
|
19
|
+
/** `href` without the answer keys, every other pair exactly as written; `href` itself when it carries none. */
|
|
20
20
|
export declare function clean(href: string): string;
|
|
21
21
|
/** This page's address, as a connect's return. */
|
|
22
22
|
export declare function here(): string;
|
package/lib/back.js
CHANGED
|
@@ -31,13 +31,23 @@ export function landed(search) {
|
|
|
31
31
|
return { kind: 'connected', provider: connected, account: q.get('account') ?? '' };
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
34
|
+
/** The decoded key of one `k=v` pair, or '' when it does not decode. */
|
|
35
|
+
function key(pair) {
|
|
36
|
+
try {
|
|
37
|
+
return decodeURIComponent(pair.split('=')[0].replace(/\+/g, ' '));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** `href` without the answer keys, every other pair exactly as written; `href` itself when it carries none. */
|
|
35
44
|
export function clean(href) {
|
|
36
45
|
const url = new URL(href);
|
|
37
|
-
|
|
46
|
+
const pairs = url.search.slice(1).split('&').filter(Boolean);
|
|
47
|
+
const kept = pairs.filter((p) => !ANSWER.includes(key(p)));
|
|
48
|
+
if (kept.length === pairs.length)
|
|
38
49
|
return href;
|
|
39
|
-
|
|
40
|
-
url.searchParams.delete(k);
|
|
50
|
+
url.search = kept.length ? `?${kept.join('&')}` : '';
|
|
41
51
|
return url.href;
|
|
42
52
|
}
|
|
43
53
|
/** This page's address, as a connect's return. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/build",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
|