@di-framework/cli-plugin-platform 6.0.5 → 6.0.6
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.
|
@@ -439,14 +439,16 @@ class TextDecoderPolyfill {
|
|
|
439
439
|
|
|
440
440
|
class URLSearchParamsPolyfill {
|
|
441
441
|
#pairs = [];
|
|
442
|
+
#onChange;
|
|
442
443
|
constructor(init) {
|
|
443
444
|
if (typeof init === "string") {
|
|
444
445
|
const query = init.startsWith("?") ? init.slice(1) : init;
|
|
445
446
|
if (query !== "") {
|
|
446
447
|
for (const part of query.split("&")) {
|
|
447
448
|
const eq = part.indexOf("=");
|
|
448
|
-
const
|
|
449
|
-
const
|
|
449
|
+
const decode = (text) => decodeURIComponent(text.replaceAll("+", " "));
|
|
450
|
+
const name = decode(eq === -1 ? part : part.slice(0, eq));
|
|
451
|
+
const value = decode(eq === -1 ? "" : part.slice(eq + 1));
|
|
450
452
|
this.#pairs.push([name, value]);
|
|
451
453
|
}
|
|
452
454
|
}
|
|
@@ -457,10 +459,43 @@ class URLSearchParamsPolyfill {
|
|
|
457
459
|
this.#pairs.push([name, String(value)]);
|
|
458
460
|
}
|
|
459
461
|
}
|
|
462
|
+
bind(onChange) {
|
|
463
|
+
this.#onChange = onChange;
|
|
464
|
+
}
|
|
460
465
|
get(name) {
|
|
461
466
|
const found = this.#pairs.find(([key]) => key === name);
|
|
462
467
|
return found ? found[1] : null;
|
|
463
468
|
}
|
|
469
|
+
getAll(name) {
|
|
470
|
+
return this.#pairs.filter(([key]) => key === name).map(([, value]) => value);
|
|
471
|
+
}
|
|
472
|
+
has(name) {
|
|
473
|
+
return this.#pairs.some(([key]) => key === name);
|
|
474
|
+
}
|
|
475
|
+
append(name, value) {
|
|
476
|
+
this.#pairs.push([name, String(value)]);
|
|
477
|
+
this.#onChange?.();
|
|
478
|
+
}
|
|
479
|
+
set(name, value) {
|
|
480
|
+
const next = [];
|
|
481
|
+
let placed = false;
|
|
482
|
+
for (const pair of this.#pairs) {
|
|
483
|
+
if (pair[0] !== name)
|
|
484
|
+
next.push(pair);
|
|
485
|
+
else if (!placed) {
|
|
486
|
+
next.push([name, String(value)]);
|
|
487
|
+
placed = true;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (!placed)
|
|
491
|
+
next.push([name, String(value)]);
|
|
492
|
+
this.#pairs = next;
|
|
493
|
+
this.#onChange?.();
|
|
494
|
+
}
|
|
495
|
+
delete(name) {
|
|
496
|
+
this.#pairs = this.#pairs.filter(([key]) => key !== name);
|
|
497
|
+
this.#onChange?.();
|
|
498
|
+
}
|
|
464
499
|
*entries() {
|
|
465
500
|
yield* this.#pairs;
|
|
466
501
|
}
|
|
@@ -497,6 +532,12 @@ class URLPolyfill {
|
|
|
497
532
|
this.origin = `${this.protocol}//${this.host}`;
|
|
498
533
|
this.href = resolved;
|
|
499
534
|
this.searchParams = new URLSearchParamsPolyfill(this.search);
|
|
535
|
+
this.searchParams.bind(() => this.#sync());
|
|
536
|
+
}
|
|
537
|
+
#sync() {
|
|
538
|
+
const query = this.searchParams.toString();
|
|
539
|
+
this.search = query === "" ? "" : `?${query}`;
|
|
540
|
+
this.href = `${this.origin}${this.pathname}${this.search}${this.hash}`;
|
|
500
541
|
}
|
|
501
542
|
toString() {
|
|
502
543
|
return this.href;
|
|
@@ -794,6 +835,11 @@ function pickFutureType(factory, preferred) {
|
|
|
794
835
|
if (name in factory)
|
|
795
836
|
return factory[name];
|
|
796
837
|
}
|
|
838
|
+
if (preferred.includes("RESULT_VOID_ERROR_CODE")) {
|
|
839
|
+
const httpVoid = Object.keys(factory).find((key) => key.startsWith("RESULT_VOID_WASI_HTTP_TYPES_") && key.endsWith("_ERROR_CODE"));
|
|
840
|
+
if (httpVoid !== undefined)
|
|
841
|
+
return factory[httpVoid];
|
|
842
|
+
}
|
|
797
843
|
const fallback = Object.keys(factory).find((key) => key !== "types" && key !== "from");
|
|
798
844
|
return fallback === undefined ? undefined : factory[fallback];
|
|
799
845
|
}
|
|
@@ -16,12 +16,20 @@ export declare class TextDecoderPolyfill {
|
|
|
16
16
|
export declare class URLSearchParamsPolyfill {
|
|
17
17
|
#private;
|
|
18
18
|
constructor(init?: string | URLSearchParamsPolyfill | Record<string, string>);
|
|
19
|
+
/** Lets `URL` refresh `search` and `href` after `set`, `append`, or `delete`. */
|
|
20
|
+
bind(onChange: () => void): void;
|
|
19
21
|
get(name: string): string | null;
|
|
22
|
+
getAll(name: string): string[];
|
|
23
|
+
has(name: string): boolean;
|
|
24
|
+
append(name: string, value: string): void;
|
|
25
|
+
set(name: string, value: string): void;
|
|
26
|
+
delete(name: string): void;
|
|
20
27
|
entries(): IterableIterator<[string, string]>;
|
|
21
28
|
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
22
29
|
toString(): string;
|
|
23
30
|
}
|
|
24
31
|
export declare class URLPolyfill {
|
|
32
|
+
#private;
|
|
25
33
|
href: string;
|
|
26
34
|
protocol: string;
|
|
27
35
|
hostname: string;
|
|
@@ -31,14 +31,16 @@ export class TextDecoderPolyfill {
|
|
|
31
31
|
}
|
|
32
32
|
export class URLSearchParamsPolyfill {
|
|
33
33
|
#pairs = [];
|
|
34
|
+
#onChange;
|
|
34
35
|
constructor(init) {
|
|
35
36
|
if (typeof init === 'string') {
|
|
36
37
|
const query = init.startsWith('?') ? init.slice(1) : init;
|
|
37
38
|
if (query !== '') {
|
|
38
39
|
for (const part of query.split('&')) {
|
|
39
40
|
const eq = part.indexOf('=');
|
|
40
|
-
const
|
|
41
|
-
const
|
|
41
|
+
const decode = (text) => decodeURIComponent(text.replaceAll('+', ' '));
|
|
42
|
+
const name = decode(eq === -1 ? part : part.slice(0, eq));
|
|
43
|
+
const value = decode(eq === -1 ? '' : part.slice(eq + 1));
|
|
42
44
|
this.#pairs.push([name, value]);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -51,10 +53,44 @@ export class URLSearchParamsPolyfill {
|
|
|
51
53
|
this.#pairs.push([name, String(value)]);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
/** Lets `URL` refresh `search` and `href` after `set`, `append`, or `delete`. */
|
|
57
|
+
bind(onChange) {
|
|
58
|
+
this.#onChange = onChange;
|
|
59
|
+
}
|
|
54
60
|
get(name) {
|
|
55
61
|
const found = this.#pairs.find(([key]) => key === name);
|
|
56
62
|
return found ? found[1] : null;
|
|
57
63
|
}
|
|
64
|
+
getAll(name) {
|
|
65
|
+
return this.#pairs.filter(([key]) => key === name).map(([, value]) => value);
|
|
66
|
+
}
|
|
67
|
+
has(name) {
|
|
68
|
+
return this.#pairs.some(([key]) => key === name);
|
|
69
|
+
}
|
|
70
|
+
append(name, value) {
|
|
71
|
+
this.#pairs.push([name, String(value)]);
|
|
72
|
+
this.#onChange?.();
|
|
73
|
+
}
|
|
74
|
+
set(name, value) {
|
|
75
|
+
const next = [];
|
|
76
|
+
let placed = false;
|
|
77
|
+
for (const pair of this.#pairs) {
|
|
78
|
+
if (pair[0] !== name)
|
|
79
|
+
next.push(pair);
|
|
80
|
+
else if (!placed) {
|
|
81
|
+
next.push([name, String(value)]);
|
|
82
|
+
placed = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!placed)
|
|
86
|
+
next.push([name, String(value)]);
|
|
87
|
+
this.#pairs = next;
|
|
88
|
+
this.#onChange?.();
|
|
89
|
+
}
|
|
90
|
+
delete(name) {
|
|
91
|
+
this.#pairs = this.#pairs.filter(([key]) => key !== name);
|
|
92
|
+
this.#onChange?.();
|
|
93
|
+
}
|
|
58
94
|
*entries() {
|
|
59
95
|
yield* this.#pairs;
|
|
60
96
|
}
|
|
@@ -92,6 +128,12 @@ export class URLPolyfill {
|
|
|
92
128
|
this.origin = `${this.protocol}//${this.host}`;
|
|
93
129
|
this.href = resolved;
|
|
94
130
|
this.searchParams = new URLSearchParamsPolyfill(this.search);
|
|
131
|
+
this.searchParams.bind(() => this.#sync());
|
|
132
|
+
}
|
|
133
|
+
#sync() {
|
|
134
|
+
const query = this.searchParams.toString();
|
|
135
|
+
this.search = query === '' ? '' : `?${query}`;
|
|
136
|
+
this.href = `${this.origin}${this.pathname}${this.search}${this.hash}`;
|
|
95
137
|
}
|
|
96
138
|
toString() {
|
|
97
139
|
return this.href;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@di-framework/cli-plugin-platform",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "di-framework CLI extension that builds, serves, and deploys DI Framework apps as platform WebAssembly components.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|