wrangler 0.0.0-e22f9d7 → 0.0.0-e273e09
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/Cloudflare_CA.pem +18 -0
- package/README.md +27 -14
- package/bin/wrangler.js +48 -4
- package/miniflare-dist/index.mjs +4886 -0
- package/package.json +60 -31
- package/pages/functions/buildPlugin.ts +105 -0
- package/pages/functions/buildWorker.ts +93 -4
- package/pages/functions/filepath-routing.test.ts +223 -28
- package/pages/functions/filepath-routing.ts +100 -132
- package/pages/functions/routes.ts +16 -18
- package/pages/functions/template-plugin.ts +147 -0
- package/pages/functions/template-worker.ts +37 -38
- package/src/__tests__/config-cache.test.ts +36 -0
- package/src/__tests__/configuration.test.ts +3487 -0
- package/src/__tests__/dev.test.tsx +977 -61
- package/src/__tests__/guess-worker-format.test.ts +85 -0
- package/src/__tests__/{clipboardy-mock.js → helpers/clipboardy-mock.js} +0 -0
- package/src/__tests__/helpers/cmd-shim.d.ts +11 -0
- package/src/__tests__/helpers/faye-websocket.d.ts +6 -0
- package/src/__tests__/helpers/mock-account-id.ts +48 -0
- package/src/__tests__/helpers/mock-bin.ts +36 -0
- package/src/__tests__/{mock-cfetch.ts → helpers/mock-cfetch.ts} +56 -16
- package/src/__tests__/helpers/mock-console.ts +87 -0
- package/src/__tests__/helpers/mock-dialogs.ts +130 -0
- package/src/__tests__/helpers/mock-http-server.ts +46 -0
- package/src/__tests__/helpers/mock-istty.ts +27 -0
- package/src/__tests__/helpers/mock-kv.ts +33 -0
- package/src/__tests__/helpers/mock-oauth-flow.ts +255 -0
- package/src/__tests__/helpers/mock-stdin.ts +103 -0
- package/src/__tests__/helpers/mock-web-socket.ts +29 -0
- package/src/__tests__/helpers/run-in-tmp.ts +39 -0
- package/src/__tests__/helpers/run-wrangler.ts +16 -0
- package/src/__tests__/helpers/write-worker-source.ts +31 -0
- package/src/__tests__/helpers/write-wrangler-toml.ts +17 -0
- package/src/__tests__/https-options.test.ts +130 -0
- package/src/__tests__/index.test.ts +179 -209
- package/src/__tests__/init.test.ts +1637 -0
- package/src/__tests__/jest.setup.ts +61 -6
- package/src/__tests__/kv.test.ts +842 -472
- package/src/__tests__/logger.test.ts +115 -0
- package/src/__tests__/package-manager.test.ts +353 -0
- package/src/__tests__/pages.test.ts +754 -0
- package/src/__tests__/parse.test.ts +330 -0
- package/src/__tests__/publish.test.ts +5755 -0
- package/src/__tests__/r2.test.ts +233 -0
- package/src/__tests__/route.test.ts +45 -0
- package/src/__tests__/secret.test.ts +481 -0
- package/src/__tests__/tail.test.ts +690 -0
- package/src/__tests__/user.test.ts +131 -0
- package/src/__tests__/whoami.test.tsx +139 -0
- package/src/abort.d.ts +3 -0
- package/src/bundle.ts +197 -0
- package/src/cfetch/index.ts +40 -21
- package/src/cfetch/internal.ts +102 -29
- package/src/cli.ts +6 -2
- package/src/config/README.md +107 -0
- package/src/config/config.ts +234 -0
- package/src/config/diagnostics.ts +80 -0
- package/src/config/environment.ts +420 -0
- package/src/config/index.ts +225 -0
- package/src/config/validation-helpers.ts +584 -0
- package/src/config/validation.ts +1548 -0
- package/src/config-cache.ts +45 -0
- package/src/create-worker-preview.ts +185 -0
- package/src/create-worker-upload-form.ts +254 -0
- package/src/dev/dev-vars.ts +36 -0
- package/src/dev/dev.tsx +401 -0
- package/src/dev/local.tsx +326 -0
- package/src/dev/remote.tsx +237 -0
- package/src/dev/use-esbuild.ts +118 -0
- package/src/dialogs.tsx +66 -8
- package/src/durable.ts +102 -0
- package/src/entry.ts +322 -0
- package/src/environment-variables.ts +35 -0
- package/src/errors.ts +11 -0
- package/src/https-options.ts +123 -0
- package/src/index.tsx +1848 -976
- package/src/inspect.ts +156 -33
- package/src/intl-polyfill.d.ts +139 -0
- package/src/{kv.tsx → kv.ts} +199 -67
- package/src/logger.ts +66 -0
- package/src/miniflare-cli/README.md +30 -0
- package/src/miniflare-cli/enum-keys.ts +17 -0
- package/src/miniflare-cli/index.ts +41 -0
- package/src/miniflare-cli/request-context.ts +40 -0
- package/src/module-collection.ts +229 -35
- package/src/open-in-browser.ts +19 -0
- package/src/package-manager.ts +174 -0
- package/src/pages.tsx +1162 -100
- package/src/parse.ts +203 -0
- package/src/paths.ts +26 -0
- package/src/proxy.ts +227 -51
- package/src/publish.ts +633 -276
- package/src/r2.ts +50 -0
- package/src/selfsigned.d.ts +29 -0
- package/src/sites.tsx +270 -62
- package/src/tail/filters.ts +279 -0
- package/src/tail/index.ts +299 -0
- package/src/tail/printing.ts +67 -0
- package/src/update-check.ts +19 -0
- package/src/user.tsx +382 -195
- package/src/whoami.tsx +71 -0
- package/src/{api/worker.ts → worker.ts} +66 -40
- package/src/zones.ts +73 -0
- package/templates/gitignore +171 -0
- package/templates/new-worker-scheduled.js +17 -0
- package/templates/new-worker-scheduled.ts +32 -0
- package/templates/new-worker.js +15 -0
- package/templates/new-worker.ts +30 -0
- package/{static-asset-facade.js → templates/static-asset-facade.js} +1 -5
- package/templates/tsconfig.json +105 -0
- package/wrangler-dist/cli.js +106332 -103741
- package/src/__tests__/mock-dialogs.ts +0 -65
- package/src/__tests__/run-in-tmp.ts +0 -19
- package/src/__tests__/run-wrangler.ts +0 -32
- package/src/api/form_data.ts +0 -131
- package/src/api/preview.ts +0 -128
- package/src/config.ts +0 -487
- package/src/dev.tsx +0 -784
- package/src/tail.tsx +0 -73
- package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
- package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
- package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
- package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
- package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
- package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
- package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
- package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
- package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
- package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
- package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
- package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
- package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
- package/vendor/wrangler-mime/CHANGELOG.md +0 -289
- package/vendor/wrangler-mime/LICENSE +0 -21
- package/vendor/wrangler-mime/Mime.js +0 -97
- package/vendor/wrangler-mime/README.md +0 -187
- package/vendor/wrangler-mime/cli.js +0 -46
- package/vendor/wrangler-mime/index.js +0 -4
- package/vendor/wrangler-mime/lite.js +0 -4
- package/vendor/wrangler-mime/package.json +0 -52
- package/vendor/wrangler-mime/types/other.js +0 -1
- package/vendor/wrangler-mime/types/standard.js +0 -1
- package/wrangler-dist/cli.js.map +0 -7
package/src/inspect.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
import { createServer } from "node:http";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import { URL } from "node:url";
|
|
5
|
+
|
|
6
|
+
import open from "open";
|
|
6
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import WebSocket, { WebSocketServer } from "ws";
|
|
7
9
|
import { version } from "../package.json";
|
|
8
|
-
|
|
10
|
+
import { logger } from "./logger";
|
|
11
|
+
import { waitForPortToBeAvailable } from "./proxy";
|
|
9
12
|
import type Protocol from "devtools-protocol";
|
|
13
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
14
|
+
import type { MessageEvent } from "ws";
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* `useInspector` is a hook for debugging Workers applications
|
|
@@ -40,7 +45,7 @@ interface InspectorProps {
|
|
|
40
45
|
/**
|
|
41
46
|
* The websocket URL exposed by Workers that the inspector should connect to.
|
|
42
47
|
*/
|
|
43
|
-
inspectorUrl:
|
|
48
|
+
inspectorUrl: string | undefined;
|
|
44
49
|
/**
|
|
45
50
|
* Whether console statements and exceptions should be logged to the terminal.
|
|
46
51
|
* (We don't log them in local mode because they're already getting
|
|
@@ -132,7 +137,7 @@ export default function useInspector(props: InspectorProps) {
|
|
|
132
137
|
wsServer.on("connection", (ws: WebSocket) => {
|
|
133
138
|
if (wsServer.clients.size > 1) {
|
|
134
139
|
/** We only want to have one active Devtools instance at a time. */
|
|
135
|
-
|
|
140
|
+
logger.error(
|
|
136
141
|
"Tried to open a new devtools window when a previous one was already open."
|
|
137
142
|
);
|
|
138
143
|
ws.close(1013, "Too many clients; only one can be connected at a time");
|
|
@@ -152,12 +157,26 @@ export default function useInspector(props: InspectorProps) {
|
|
|
152
157
|
* of the component lifecycle. Convenient.
|
|
153
158
|
*/
|
|
154
159
|
useEffect(() => {
|
|
155
|
-
|
|
160
|
+
const abortController = new AbortController();
|
|
161
|
+
async function startInspectorProxy() {
|
|
162
|
+
await waitForPortToBeAvailable(props.port, {
|
|
163
|
+
retryPeriod: 200,
|
|
164
|
+
timeout: 2000,
|
|
165
|
+
abortSignal: abortController.signal,
|
|
166
|
+
});
|
|
167
|
+
server.listen(props.port);
|
|
168
|
+
}
|
|
169
|
+
startInspectorProxy().catch((err) => {
|
|
170
|
+
if ((err as { code: string }).code !== "ABORT_ERR") {
|
|
171
|
+
logger.error("Failed to start inspector:", err);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
156
174
|
return () => {
|
|
157
175
|
server.close();
|
|
158
176
|
// Also disconnect any open websockets/devtools connections
|
|
159
177
|
wsServer.clients.forEach((ws) => ws.close());
|
|
160
178
|
wsServer.close();
|
|
179
|
+
abortController.abort();
|
|
161
180
|
};
|
|
162
181
|
}, [props.port, server, wsServer]);
|
|
163
182
|
|
|
@@ -238,9 +257,7 @@ export default function useInspector(props: InspectorProps) {
|
|
|
238
257
|
const evt = JSON.parse(event.data);
|
|
239
258
|
if (evt.method === "Runtime.exceptionThrown") {
|
|
240
259
|
const params = evt.params as Protocol.Runtime.ExceptionThrownEvent;
|
|
241
|
-
|
|
242
|
-
"🚨", // cheesy, but it works
|
|
243
|
-
// maybe we could use color here too.
|
|
260
|
+
logger.error(
|
|
244
261
|
params.exceptionDetails.text,
|
|
245
262
|
params.exceptionDetails.exception?.description ?? ""
|
|
246
263
|
);
|
|
@@ -252,7 +269,7 @@ export default function useInspector(props: InspectorProps) {
|
|
|
252
269
|
}
|
|
253
270
|
} else {
|
|
254
271
|
// We should never get here, but who know is 2022...
|
|
255
|
-
|
|
272
|
+
logger.error("Unrecognised devtools event:", event);
|
|
256
273
|
}
|
|
257
274
|
});
|
|
258
275
|
}
|
|
@@ -271,7 +288,7 @@ export default function useInspector(props: InspectorProps) {
|
|
|
271
288
|
});
|
|
272
289
|
|
|
273
290
|
ws.on("unexpected-response", () => {
|
|
274
|
-
|
|
291
|
+
logger.log("Waiting for connection...");
|
|
275
292
|
/**
|
|
276
293
|
* This usually means the worker is not "ready" yet
|
|
277
294
|
* so we'll just retry the connection process
|
|
@@ -315,9 +332,14 @@ export default function useInspector(props: InspectorProps) {
|
|
|
315
332
|
};
|
|
316
333
|
}, [
|
|
317
334
|
props.inspectorUrl,
|
|
318
|
-
retryRemoteWebSocketConnectionSigil,
|
|
319
335
|
props.logToTerminal,
|
|
320
336
|
wsServer,
|
|
337
|
+
// We use a state value as a sigil to trigger a retry of the
|
|
338
|
+
// remote websocket connection. It's not used inside the effect,
|
|
339
|
+
// so react-hooks/exhaustive-deps doesn't complain if it's not
|
|
340
|
+
// included in the dependency array. But its presence is critical,
|
|
341
|
+
// so do NOT remove it from the dependency list.
|
|
342
|
+
retryRemoteWebSocketConnectionSigil,
|
|
321
343
|
]);
|
|
322
344
|
|
|
323
345
|
/**
|
|
@@ -361,7 +383,10 @@ export default function useInspector(props: InspectorProps) {
|
|
|
361
383
|
);
|
|
362
384
|
remoteWebSocket.send(event.data);
|
|
363
385
|
} catch (e) {
|
|
364
|
-
if (
|
|
386
|
+
if (
|
|
387
|
+
(e as Error).message !==
|
|
388
|
+
"WebSocket is not open: readyState 0 (CONNECTING)"
|
|
389
|
+
) {
|
|
365
390
|
/**
|
|
366
391
|
* ^ this just means we haven't opened a websocket yet
|
|
367
392
|
* usually happens until there's at least one request
|
|
@@ -369,7 +394,7 @@ export default function useInspector(props: InspectorProps) {
|
|
|
369
394
|
* happens on the first request. Maybe we should buffer
|
|
370
395
|
* these messages too?
|
|
371
396
|
*/
|
|
372
|
-
|
|
397
|
+
logger.error(e);
|
|
373
398
|
}
|
|
374
399
|
}
|
|
375
400
|
}
|
|
@@ -432,6 +457,33 @@ function randomId(): string {
|
|
|
432
457
|
* we're just doing a little bit of the work of the devtools console,
|
|
433
458
|
* directly in the terminal.
|
|
434
459
|
*/
|
|
460
|
+
|
|
461
|
+
export const mapConsoleAPIMessageTypeToConsoleMethod: {
|
|
462
|
+
[key in Protocol.Runtime.ConsoleAPICalledEvent["type"]]: Exclude<
|
|
463
|
+
keyof Console,
|
|
464
|
+
"Console"
|
|
465
|
+
>;
|
|
466
|
+
} = {
|
|
467
|
+
log: "log",
|
|
468
|
+
debug: "debug",
|
|
469
|
+
info: "info",
|
|
470
|
+
warning: "warn",
|
|
471
|
+
error: "error",
|
|
472
|
+
dir: "dir",
|
|
473
|
+
dirxml: "dirxml",
|
|
474
|
+
table: "table",
|
|
475
|
+
trace: "trace",
|
|
476
|
+
clear: "clear",
|
|
477
|
+
count: "count",
|
|
478
|
+
assert: "assert",
|
|
479
|
+
profile: "profile",
|
|
480
|
+
profileEnd: "profileEnd",
|
|
481
|
+
timeEnd: "timeEnd",
|
|
482
|
+
startGroup: "group",
|
|
483
|
+
startGroupCollapsed: "groupCollapsed",
|
|
484
|
+
endGroup: "groupEnd",
|
|
485
|
+
};
|
|
486
|
+
|
|
435
487
|
function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
436
488
|
const args: string[] = [];
|
|
437
489
|
for (const ro of evt.args) {
|
|
@@ -449,7 +501,11 @@ function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
|
449
501
|
break;
|
|
450
502
|
case "object":
|
|
451
503
|
if (!ro.preview) {
|
|
452
|
-
args.push(
|
|
504
|
+
args.push(
|
|
505
|
+
ro.subtype === "null"
|
|
506
|
+
? "null"
|
|
507
|
+
: ro.description ?? "<no-description>"
|
|
508
|
+
);
|
|
453
509
|
} else {
|
|
454
510
|
args.push(ro.preview.description ?? "<no-description>");
|
|
455
511
|
|
|
@@ -467,11 +523,14 @@ function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
|
467
523
|
);
|
|
468
524
|
|
|
469
525
|
break;
|
|
526
|
+
case "weakmap":
|
|
470
527
|
case "map":
|
|
471
528
|
args.push(
|
|
472
529
|
"{\n" +
|
|
473
|
-
|
|
474
|
-
|
|
530
|
+
// Maps always have entries
|
|
531
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
532
|
+
ro.preview
|
|
533
|
+
.entries!.map(({ key, value }) => {
|
|
475
534
|
return ` ${key?.description ?? "<unknown>"} => ${
|
|
476
535
|
value.description
|
|
477
536
|
}`;
|
|
@@ -482,38 +541,47 @@ function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
|
482
541
|
);
|
|
483
542
|
|
|
484
543
|
break;
|
|
544
|
+
case "weakset":
|
|
485
545
|
case "set":
|
|
486
546
|
args.push(
|
|
487
547
|
"{ " +
|
|
488
|
-
|
|
489
|
-
|
|
548
|
+
// Sets always have entries
|
|
549
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
550
|
+
ro.preview
|
|
551
|
+
.entries!.map(({ value }) => {
|
|
490
552
|
return `${value.description}`;
|
|
491
553
|
})
|
|
492
554
|
.join(", ") +
|
|
493
555
|
(ro.preview.overflow ? ", ..." : "") +
|
|
494
556
|
" }"
|
|
495
557
|
);
|
|
496
|
-
|
|
497
558
|
break;
|
|
498
|
-
case "null":
|
|
499
|
-
args.push("null");
|
|
500
|
-
break;
|
|
501
|
-
case "node":
|
|
502
559
|
case "regexp":
|
|
560
|
+
break;
|
|
503
561
|
case "date":
|
|
504
|
-
|
|
505
|
-
case "weakset":
|
|
506
|
-
case "iterator":
|
|
562
|
+
break;
|
|
507
563
|
case "generator":
|
|
508
|
-
|
|
509
|
-
|
|
564
|
+
args.push(ro.preview.properties[0].value || "");
|
|
565
|
+
break;
|
|
510
566
|
case "promise":
|
|
567
|
+
if (ro.preview.properties[0].value === "pending") {
|
|
568
|
+
args.push(`{<${ro.preview.properties[0].value}>}`);
|
|
569
|
+
} else {
|
|
570
|
+
args.push(
|
|
571
|
+
`{<${ro.preview.properties[0].value}>: ${ro.preview.properties[1].value}}`
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
break;
|
|
575
|
+
case "node":
|
|
576
|
+
case "iterator":
|
|
577
|
+
case "proxy":
|
|
511
578
|
case "typedarray":
|
|
512
579
|
case "arraybuffer":
|
|
513
580
|
case "dataview":
|
|
514
581
|
case "webassemblymemory":
|
|
515
582
|
case "wasmvalue":
|
|
516
583
|
break;
|
|
584
|
+
case "error":
|
|
517
585
|
default:
|
|
518
586
|
// just a pojo
|
|
519
587
|
args.push(
|
|
@@ -535,5 +603,60 @@ function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
|
535
603
|
}
|
|
536
604
|
}
|
|
537
605
|
|
|
538
|
-
|
|
606
|
+
const method = mapConsoleAPIMessageTypeToConsoleMethod[evt.type];
|
|
607
|
+
|
|
608
|
+
if (method in console) {
|
|
609
|
+
switch (method) {
|
|
610
|
+
case "dir":
|
|
611
|
+
console.dir(args);
|
|
612
|
+
break;
|
|
613
|
+
case "table":
|
|
614
|
+
console.table(args);
|
|
615
|
+
break;
|
|
616
|
+
default:
|
|
617
|
+
// eslint-disable-next-line prefer-spread
|
|
618
|
+
console[method].apply(console, args);
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
} else {
|
|
622
|
+
logger.warn(`Unsupported console method: ${method}`);
|
|
623
|
+
logger.warn("console event:", evt);
|
|
624
|
+
}
|
|
539
625
|
}
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Opens the chrome debugger
|
|
629
|
+
*/
|
|
630
|
+
export const openInspector = async (inspectorPort: number) => {
|
|
631
|
+
const url = `https://built-devtools.pages.dev/js_app?experiments=true&v8only=true&ws=localhost:${inspectorPort}/ws`;
|
|
632
|
+
const errorMessage =
|
|
633
|
+
"Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
|
|
634
|
+
|
|
635
|
+
// see: https://github.com/sindresorhus/open/issues/177#issue-610016699
|
|
636
|
+
let braveBrowser: string;
|
|
637
|
+
switch (os.platform()) {
|
|
638
|
+
case "darwin":
|
|
639
|
+
case "win32":
|
|
640
|
+
braveBrowser = "Brave";
|
|
641
|
+
break;
|
|
642
|
+
default:
|
|
643
|
+
braveBrowser = "brave";
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const childProcess = await open(url, {
|
|
647
|
+
app: [
|
|
648
|
+
{
|
|
649
|
+
name: open.apps.chrome,
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: braveBrowser,
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: open.apps.edge,
|
|
656
|
+
},
|
|
657
|
+
],
|
|
658
|
+
});
|
|
659
|
+
childProcess.on("error", () => {
|
|
660
|
+
logger.warn(errorMessage);
|
|
661
|
+
});
|
|
662
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TODO Remove once https://github.com/microsoft/TypeScript/pull/47254 lands
|
|
3
|
+
*/
|
|
4
|
+
declare namespace Intl {
|
|
5
|
+
interface DateTimeFormatOptions {
|
|
6
|
+
formatMatcher?: "basic" | "best fit" | "best fit" | undefined;
|
|
7
|
+
dateStyle?: "full" | "long" | "medium" | "short" | undefined;
|
|
8
|
+
timeStyle?: "full" | "long" | "medium" | "short" | undefined;
|
|
9
|
+
dayPeriod?: "narrow" | "short" | "long" | undefined;
|
|
10
|
+
fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ResolvedDateTimeFormatOptions {
|
|
14
|
+
formatMatcher?: "basic" | "best fit" | "best fit";
|
|
15
|
+
dateStyle?: "full" | "long" | "medium" | "short";
|
|
16
|
+
timeStyle?: "full" | "long" | "medium" | "short";
|
|
17
|
+
hourCycle?: "h11" | "h12" | "h23" | "h24";
|
|
18
|
+
dayPeriod?: "narrow" | "short" | "long";
|
|
19
|
+
fractionalSecondDigits?: 0 | 1 | 2 | 3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface NumberFormat {
|
|
23
|
+
formatRange(startDate: number | bigint, endDate: number | bigint): string;
|
|
24
|
+
formatRangeToParts(
|
|
25
|
+
startDate: number | bigint,
|
|
26
|
+
endDate: number | bigint
|
|
27
|
+
): NumberFormatPart[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The locale matching algorithm to use.
|
|
32
|
+
*
|
|
33
|
+
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
|
|
34
|
+
*/
|
|
35
|
+
type ListFormatLocaleMatcher = "lookup" | "best fit";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The format of output message.
|
|
39
|
+
*
|
|
40
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
|
|
41
|
+
*/
|
|
42
|
+
type ListFormatType = "conjunction" | "disjunction" | "unit";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The length of the formatted message.
|
|
46
|
+
*
|
|
47
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
|
|
48
|
+
*/
|
|
49
|
+
type ListFormatStyle = "long" | "short" | "narrow";
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An object with some or all properties of the `Intl.ListFormat` constructor `options` parameter.
|
|
53
|
+
*
|
|
54
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
|
|
55
|
+
*/
|
|
56
|
+
interface ListFormatOptions {
|
|
57
|
+
/** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
|
|
58
|
+
localeMatcher?: ListFormatLocaleMatcher;
|
|
59
|
+
/** The format of output message. */
|
|
60
|
+
type?: ListFormatType;
|
|
61
|
+
/** The length of the internationalized message. */
|
|
62
|
+
style?: ListFormatStyle;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface ListFormat {
|
|
66
|
+
/**
|
|
67
|
+
* Returns a string with a language-specific representation of the list.
|
|
68
|
+
*
|
|
69
|
+
* @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
|
|
70
|
+
*
|
|
71
|
+
* @throws `TypeError` if `list` includes something other than the possible values.
|
|
72
|
+
*
|
|
73
|
+
* @returns {string} A language-specific formatted string representing the elements of the list.
|
|
74
|
+
*
|
|
75
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format).
|
|
76
|
+
*/
|
|
77
|
+
format(list: Iterable<string>): string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Returns an Array of objects representing the different components that can be used to format a list of values in a locale-aware fashion.
|
|
81
|
+
*
|
|
82
|
+
* @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), to be formatted according to a locale.
|
|
83
|
+
*
|
|
84
|
+
* @throws `TypeError` if `list` includes something other than the possible values.
|
|
85
|
+
*
|
|
86
|
+
* @returns {{ type: "element" | "literal", value: string; }[]} An Array of components which contains the formatted parts from the list.
|
|
87
|
+
*
|
|
88
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/formatToParts).
|
|
89
|
+
*/
|
|
90
|
+
formatToParts(
|
|
91
|
+
list: Iterable<string>
|
|
92
|
+
): { type: "element" | "literal"; value: string }[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const ListFormat: {
|
|
96
|
+
prototype: ListFormat;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Creates [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) objects that
|
|
100
|
+
* enable language-sensitive list formatting.
|
|
101
|
+
*
|
|
102
|
+
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
|
|
103
|
+
* For the general form and interpretation of the `locales` argument,
|
|
104
|
+
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
|
|
105
|
+
*
|
|
106
|
+
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters)
|
|
107
|
+
* with some or all options of `ListFormatOptions`.
|
|
108
|
+
*
|
|
109
|
+
* @returns [Intl.ListFormatOptions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) object.
|
|
110
|
+
*
|
|
111
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat).
|
|
112
|
+
*/
|
|
113
|
+
new (
|
|
114
|
+
locales?: BCP47LanguageTag | BCP47LanguageTag[],
|
|
115
|
+
options?: ListFormatOptions
|
|
116
|
+
): ListFormat;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns an array containing those of the provided locales that are
|
|
120
|
+
* supported in list formatting without having to fall back to the runtime's default locale.
|
|
121
|
+
*
|
|
122
|
+
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
|
|
123
|
+
* For the general form and interpretation of the `locales` argument,
|
|
124
|
+
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
|
|
125
|
+
*
|
|
126
|
+
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf#parameters).
|
|
127
|
+
* with some or all possible options.
|
|
128
|
+
*
|
|
129
|
+
* @returns An array of strings representing a subset of the given locale tags that are supported in list
|
|
130
|
+
* formatting without having to fall back to the runtime's default locale.
|
|
131
|
+
*
|
|
132
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf).
|
|
133
|
+
*/
|
|
134
|
+
supportedLocalesOf(
|
|
135
|
+
locales: BCP47LanguageTag | BCP47LanguageTag[],
|
|
136
|
+
options?: Pick<ListFormatOptions, "localeMatcher">
|
|
137
|
+
): BCP47LanguageTag[];
|
|
138
|
+
};
|
|
139
|
+
}
|