wrangler 0.0.0-e7cf0caa → 0.0.0-e87ad068
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/miniflare-dist/index.mjs +167 -93
- package/package.json +6 -6
- package/src/__tests__/configuration.test.ts +218 -0
- package/src/__tests__/constellation.test.ts +371 -0
- package/src/__tests__/d1/migrate.test.ts +100 -0
- package/src/__tests__/index.test.ts +4 -2
- package/src/__tests__/init.test.ts +109 -3
- package/src/__tests__/mtls-certificates.test.ts +2 -1
- package/src/__tests__/pages/functions-build.test.ts +77 -0
- package/src/__tests__/pages-deployment-tail.test.ts +2 -0
- package/src/__tests__/publish.test.ts +646 -187
- package/src/__tests__/tail.test.ts +49 -7
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/__tests__/unstableDev.test.ts +61 -0
- package/src/__tests__/user.test.ts +1 -1
- package/src/api/dev.ts +12 -0
- package/src/api/pages/create-worker-bundle-contents.ts +4 -0
- package/src/api/pages/publish.tsx +28 -12
- package/src/bundle.ts +58 -14
- package/src/cfetch/internal.ts +19 -14
- package/src/config/environment.ts +41 -0
- package/src/config/index.ts +21 -0
- package/src/config/validation.ts +182 -0
- package/src/constellation/createProject.tsx +51 -0
- package/src/constellation/deleteProject.ts +51 -0
- package/src/constellation/deleteProjectModel.ts +76 -0
- package/src/constellation/index.ts +75 -0
- package/src/constellation/listCatalog.tsx +35 -0
- package/src/constellation/listModel.tsx +49 -0
- package/src/constellation/listProject.tsx +28 -0
- package/src/constellation/listRuntime.tsx +28 -0
- package/src/constellation/options.ts +17 -0
- package/src/constellation/types.ts +17 -0
- package/src/constellation/uploadModel.tsx +84 -0
- package/src/constellation/utils.ts +90 -0
- package/src/create-worker-upload-form.ts +25 -0
- package/src/d1/backups.tsx +4 -4
- package/src/d1/constants.ts +3 -0
- package/src/d1/create.tsx +77 -43
- package/src/d1/delete.ts +1 -1
- package/src/d1/execute.tsx +27 -13
- package/src/d1/list.tsx +13 -11
- package/src/d1/migrations/apply.tsx +29 -6
- package/src/d1/migrations/helpers.ts +8 -9
- package/src/d1/types.ts +7 -0
- package/src/dev/dev.tsx +9 -2
- package/src/dev/local.tsx +52 -20
- package/src/dev/remote.tsx +4 -0
- package/src/dev/start-server.ts +64 -40
- package/src/dev/use-esbuild.ts +70 -43
- package/src/dev-registry.ts +11 -0
- package/src/dev.tsx +23 -6
- package/src/docs/helpers.ts +50 -0
- package/src/docs/index.ts +25 -68
- package/src/entry.ts +8 -1
- package/src/environment-variables/factory.ts +2 -1
- package/src/generate/index.ts +5 -0
- package/src/index.ts +12 -1
- package/src/init.ts +52 -10
- package/src/inspect.ts +107 -6
- package/src/kv/helpers.ts +7 -4
- package/src/logger.ts +5 -1
- package/src/miniflare-cli/index.ts +2 -2
- package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
- package/src/module-collection.ts +1 -1
- package/src/pages/build.ts +30 -17
- package/src/pages/dev.ts +51 -8
- package/src/pages/functions/buildPlugin.ts +1 -0
- package/src/pages/functions/buildWorker.ts +92 -2
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/publish/publish.ts +9 -1
- package/src/secret/index.ts +4 -0
- package/src/sites.ts +164 -52
- package/src/tail/createTail.ts +9 -0
- package/src/tail/printing.ts +12 -0
- package/src/traverse-module-graph.ts +2 -1
- package/src/type-generation.ts +6 -0
- package/src/user/user.ts +1 -0
- package/src/utils/render.ts +1 -1
- package/src/worker.ts +26 -0
- package/templates/__tests__/tsconfig.tsbuildinfo +1 -1
- package/templates/pages-dev-util.ts +4 -1
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/wrangler-dist/cli.d.ts +78 -2
- package/wrangler-dist/cli.js +65057 -63883
package/miniflare-dist/index.mjs
CHANGED
|
@@ -179,6 +179,9 @@ function mergeHeaders(base, extra) {
|
|
|
179
179
|
...Object.fromEntries(extra.entries())
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
+
function stripLeadingDoubleSlashes(location) {
|
|
183
|
+
return location.replace(/^(\/|%2F|%2f|%5C|%5c|%09|\s|\\)+(.*)/, "/$2");
|
|
184
|
+
}
|
|
182
185
|
var OkResponse, MovedPermanentlyResponse, FoundResponse, NotModifiedResponse, PermanentRedirectResponse, NotFoundResponse, MethodNotAllowedResponse, NotAcceptableResponse, InternalServerErrorResponse, SeeOtherResponse, TemporaryRedirectResponse;
|
|
183
186
|
var init_responses = __esm({
|
|
184
187
|
"../pages-shared/asset-server/responses.ts"() {
|
|
@@ -192,7 +195,12 @@ var init_responses = __esm({
|
|
|
192
195
|
}
|
|
193
196
|
};
|
|
194
197
|
MovedPermanentlyResponse = class extends Response {
|
|
195
|
-
constructor(location, init
|
|
198
|
+
constructor(location, init, {
|
|
199
|
+
preventLeadingDoubleSlash = true
|
|
200
|
+
} = {
|
|
201
|
+
preventLeadingDoubleSlash: true
|
|
202
|
+
}) {
|
|
203
|
+
location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
|
|
196
204
|
super(`Redirecting to ${location}`, {
|
|
197
205
|
...init,
|
|
198
206
|
status: 301,
|
|
@@ -204,7 +212,12 @@ var init_responses = __esm({
|
|
|
204
212
|
}
|
|
205
213
|
};
|
|
206
214
|
FoundResponse = class extends Response {
|
|
207
|
-
constructor(location, init
|
|
215
|
+
constructor(location, init, {
|
|
216
|
+
preventLeadingDoubleSlash = true
|
|
217
|
+
} = {
|
|
218
|
+
preventLeadingDoubleSlash: true
|
|
219
|
+
}) {
|
|
220
|
+
location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
|
|
208
221
|
super(`Redirecting to ${location}`, {
|
|
209
222
|
...init,
|
|
210
223
|
status: 302,
|
|
@@ -224,7 +237,12 @@ var init_responses = __esm({
|
|
|
224
237
|
}
|
|
225
238
|
};
|
|
226
239
|
PermanentRedirectResponse = class extends Response {
|
|
227
|
-
constructor(location, init
|
|
240
|
+
constructor(location, init, {
|
|
241
|
+
preventLeadingDoubleSlash = true
|
|
242
|
+
} = {
|
|
243
|
+
preventLeadingDoubleSlash: true
|
|
244
|
+
}) {
|
|
245
|
+
location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
|
|
228
246
|
super(void 0, {
|
|
229
247
|
...init,
|
|
230
248
|
status: 308,
|
|
@@ -278,7 +296,12 @@ ${err.stack}`;
|
|
|
278
296
|
}
|
|
279
297
|
};
|
|
280
298
|
SeeOtherResponse = class extends Response {
|
|
281
|
-
constructor(location, init
|
|
299
|
+
constructor(location, init, {
|
|
300
|
+
preventLeadingDoubleSlash = true
|
|
301
|
+
} = {
|
|
302
|
+
preventLeadingDoubleSlash: true
|
|
303
|
+
}) {
|
|
304
|
+
location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
|
|
282
305
|
super(`Redirecting to ${location}`, {
|
|
283
306
|
...init,
|
|
284
307
|
status: 303,
|
|
@@ -288,7 +311,12 @@ ${err.stack}`;
|
|
|
288
311
|
}
|
|
289
312
|
};
|
|
290
313
|
TemporaryRedirectResponse = class extends Response {
|
|
291
|
-
constructor(location, init
|
|
314
|
+
constructor(location, init, {
|
|
315
|
+
preventLeadingDoubleSlash = true
|
|
316
|
+
} = {
|
|
317
|
+
preventLeadingDoubleSlash: true
|
|
318
|
+
}) {
|
|
319
|
+
location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
|
|
292
320
|
super(`Redirecting to ${location}`, {
|
|
293
321
|
...init,
|
|
294
322
|
status: 307,
|
|
@@ -351,15 +379,6 @@ var init_rulesEngine = __esm({
|
|
|
351
379
|
}
|
|
352
380
|
});
|
|
353
381
|
|
|
354
|
-
// ../pages-shared/asset-server/url.ts
|
|
355
|
-
function stringifyURLToRootRelativePathname(url) {
|
|
356
|
-
return `${url.pathname}${url.search}${url.hash}`;
|
|
357
|
-
}
|
|
358
|
-
var init_url = __esm({
|
|
359
|
-
"../pages-shared/asset-server/url.ts"() {
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
|
|
363
382
|
// ../pages-shared/asset-server/handler.ts
|
|
364
383
|
var handler_exports = {};
|
|
365
384
|
__export(handler_exports, {
|
|
@@ -370,7 +389,6 @@ __export(handler_exports, {
|
|
|
370
389
|
HEADERS_VERSION_V1: () => HEADERS_VERSION_V1,
|
|
371
390
|
REDIRECTS_VERSION: () => REDIRECTS_VERSION2,
|
|
372
391
|
generateHandler: () => generateHandler,
|
|
373
|
-
getResponseFromMatch: () => getResponseFromMatch,
|
|
374
392
|
normaliseHeaders: () => normaliseHeaders,
|
|
375
393
|
parseQualityWeightedList: () => parseQualityWeightedList
|
|
376
394
|
});
|
|
@@ -444,7 +462,32 @@ async function generateHandler({
|
|
|
444
462
|
if (match.status === 200) {
|
|
445
463
|
pathname = new URL(match.to, request.url).pathname;
|
|
446
464
|
} else {
|
|
447
|
-
|
|
465
|
+
const { status, to } = match;
|
|
466
|
+
const destination = new URL(to, request.url);
|
|
467
|
+
const location = destination.origin === new URL(request.url).origin ? `${destination.pathname}${destination.search || search}${destination.hash}` : `${destination.href}${destination.search ? "" : search}${destination.hash}`;
|
|
468
|
+
switch (status) {
|
|
469
|
+
case 301:
|
|
470
|
+
return new MovedPermanentlyResponse(location, void 0, {
|
|
471
|
+
preventLeadingDoubleSlash: false
|
|
472
|
+
});
|
|
473
|
+
case 303:
|
|
474
|
+
return new SeeOtherResponse(location, void 0, {
|
|
475
|
+
preventLeadingDoubleSlash: false
|
|
476
|
+
});
|
|
477
|
+
case 307:
|
|
478
|
+
return new TemporaryRedirectResponse(location, void 0, {
|
|
479
|
+
preventLeadingDoubleSlash: false
|
|
480
|
+
});
|
|
481
|
+
case 308:
|
|
482
|
+
return new PermanentRedirectResponse(location, void 0, {
|
|
483
|
+
preventLeadingDoubleSlash: false
|
|
484
|
+
});
|
|
485
|
+
case 302:
|
|
486
|
+
default:
|
|
487
|
+
return new FoundResponse(location, void 0, {
|
|
488
|
+
preventLeadingDoubleSlash: false
|
|
489
|
+
});
|
|
490
|
+
}
|
|
448
491
|
}
|
|
449
492
|
}
|
|
450
493
|
if (!request.method.match(/^(get|head)$/i)) {
|
|
@@ -724,27 +767,6 @@ async function generateHandler({
|
|
|
724
767
|
);
|
|
725
768
|
}
|
|
726
769
|
}
|
|
727
|
-
function getResponseFromMatch({
|
|
728
|
-
status,
|
|
729
|
-
to
|
|
730
|
-
}, requestUrl) {
|
|
731
|
-
const destination = new URL(to, requestUrl);
|
|
732
|
-
destination.search = destination.search || requestUrl.search;
|
|
733
|
-
const location = destination.origin === requestUrl.origin ? stringifyURLToRootRelativePathname(destination) : destination.toString();
|
|
734
|
-
switch (status) {
|
|
735
|
-
case 301:
|
|
736
|
-
return new MovedPermanentlyResponse(location);
|
|
737
|
-
case 303:
|
|
738
|
-
return new SeeOtherResponse(location);
|
|
739
|
-
case 307:
|
|
740
|
-
return new TemporaryRedirectResponse(location);
|
|
741
|
-
case 308:
|
|
742
|
-
return new PermanentRedirectResponse(location);
|
|
743
|
-
case 302:
|
|
744
|
-
default:
|
|
745
|
-
return new FoundResponse(location);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
770
|
function parseQualityWeightedList(list = "") {
|
|
749
771
|
const items = {};
|
|
750
772
|
list.replace(/\s/g, "").split(",").forEach((el) => {
|
|
@@ -770,7 +792,6 @@ var init_handler = __esm({
|
|
|
770
792
|
"../pages-shared/asset-server/handler.ts"() {
|
|
771
793
|
init_responses();
|
|
772
794
|
init_rulesEngine();
|
|
773
|
-
init_url();
|
|
774
795
|
ASSET_PRESERVATION_CACHE = "assetPreservationCache";
|
|
775
796
|
CACHE_CONTROL_PRESERVATION = "public, s-maxage=604800";
|
|
776
797
|
CACHE_CONTROL_BROWSER = "public, max-age=0, must-revalidate";
|
|
@@ -783,11 +804,11 @@ var init_handler = __esm({
|
|
|
783
804
|
});
|
|
784
805
|
|
|
785
806
|
// src/miniflare-cli/index.ts
|
|
786
|
-
import { fetch } from "@miniflare/core";
|
|
787
807
|
import {
|
|
788
808
|
DurableObjectNamespace,
|
|
789
809
|
DurableObjectStub
|
|
790
810
|
} from "@miniflare/durable-objects";
|
|
811
|
+
import { upgradingFetch } from "@miniflare/web-sockets";
|
|
791
812
|
import {
|
|
792
813
|
Log as MiniflareLog,
|
|
793
814
|
LogLevel as MiniflareLogLevel,
|
|
@@ -799,7 +820,7 @@ import {
|
|
|
799
820
|
// ../../node_modules/yargs/lib/platform-shims/esm.mjs
|
|
800
821
|
import { notStrictEqual, strictEqual } from "assert";
|
|
801
822
|
|
|
802
|
-
// ../../node_modules/cliui/build/lib/index.js
|
|
823
|
+
// ../../node_modules/yargs/node_modules/cliui/build/lib/index.js
|
|
803
824
|
var align = {
|
|
804
825
|
right: alignRight,
|
|
805
826
|
center: alignCenter
|
|
@@ -810,9 +831,9 @@ var bottom = 2;
|
|
|
810
831
|
var left = 3;
|
|
811
832
|
var UI = class {
|
|
812
833
|
constructor(opts) {
|
|
813
|
-
var
|
|
834
|
+
var _a2;
|
|
814
835
|
this.width = opts.width;
|
|
815
|
-
this.wrap = (
|
|
836
|
+
this.wrap = (_a2 = opts.wrap) !== null && _a2 !== void 0 ? _a2 : true;
|
|
816
837
|
this.rows = [];
|
|
817
838
|
}
|
|
818
839
|
span(...args) {
|
|
@@ -1053,7 +1074,7 @@ function cliui(opts, _mixin) {
|
|
|
1053
1074
|
});
|
|
1054
1075
|
}
|
|
1055
1076
|
|
|
1056
|
-
// ../../node_modules/cliui/build/lib/string-utils.js
|
|
1077
|
+
// ../../node_modules/yargs/node_modules/cliui/build/lib/string-utils.js
|
|
1057
1078
|
var ansi = new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)", "g");
|
|
1058
1079
|
function stripAnsi(str) {
|
|
1059
1080
|
return str.replace(ansi, "");
|
|
@@ -1074,7 +1095,7 @@ function wrap(str, width) {
|
|
|
1074
1095
|
return wrapped;
|
|
1075
1096
|
}
|
|
1076
1097
|
|
|
1077
|
-
// ../../node_modules/cliui/index.mjs
|
|
1098
|
+
// ../../node_modules/yargs/node_modules/cliui/index.mjs
|
|
1078
1099
|
function ui(opts) {
|
|
1079
1100
|
return cliui(opts, {
|
|
1080
1101
|
stringWidth: (str) => {
|
|
@@ -1365,9 +1386,9 @@ var YargsParser = class {
|
|
|
1365
1386
|
let m;
|
|
1366
1387
|
let next;
|
|
1367
1388
|
let value;
|
|
1368
|
-
if (arg !== "--" && isUnknownOptionAsArg(arg)) {
|
|
1389
|
+
if (arg !== "--" && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
|
|
1369
1390
|
pushPositional(arg);
|
|
1370
|
-
} else if (truncatedArg.match(
|
|
1391
|
+
} else if (truncatedArg.match(/^---+(=|$)/)) {
|
|
1371
1392
|
pushPositional(arg);
|
|
1372
1393
|
continue;
|
|
1373
1394
|
} else if (arg.match(/^--.+=/) || !configuration["short-option-groups"] && arg.match(/^-.+=/)) {
|
|
@@ -2050,9 +2071,13 @@ function stripQuotes(val) {
|
|
|
2050
2071
|
|
|
2051
2072
|
// ../../node_modules/yargs/node_modules/yargs-parser/build/lib/index.js
|
|
2052
2073
|
import { readFileSync } from "fs";
|
|
2074
|
+
var _a;
|
|
2075
|
+
var _b;
|
|
2076
|
+
var _c;
|
|
2053
2077
|
var minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
|
|
2054
|
-
|
|
2055
|
-
|
|
2078
|
+
var nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
|
2079
|
+
if (nodeVersion) {
|
|
2080
|
+
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
|
2056
2081
|
if (major < minNodeVersion) {
|
|
2057
2082
|
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
2058
2083
|
}
|
|
@@ -2115,7 +2140,9 @@ var YError = class extends Error {
|
|
|
2115
2140
|
constructor(msg) {
|
|
2116
2141
|
super(msg || "yargs error");
|
|
2117
2142
|
this.name = "YError";
|
|
2118
|
-
Error.captureStackTrace
|
|
2143
|
+
if (Error.captureStackTrace) {
|
|
2144
|
+
Error.captureStackTrace(this, YError);
|
|
2145
|
+
}
|
|
2119
2146
|
}
|
|
2120
2147
|
};
|
|
2121
2148
|
|
|
@@ -2315,7 +2342,7 @@ try {
|
|
|
2315
2342
|
} catch (e) {
|
|
2316
2343
|
__dirname = process.cwd();
|
|
2317
2344
|
}
|
|
2318
|
-
var mainFilename = __dirname.
|
|
2345
|
+
var mainFilename = __dirname.substring(0, __dirname.lastIndexOf("node_modules"));
|
|
2319
2346
|
var esm_default = {
|
|
2320
2347
|
assert: {
|
|
2321
2348
|
notStrictEqual,
|
|
@@ -2700,6 +2727,7 @@ var CommandInstance = class {
|
|
|
2700
2727
|
const builder = commandHandler.builder;
|
|
2701
2728
|
let innerYargs = yargs;
|
|
2702
2729
|
if (isCommandBuilderCallback(builder)) {
|
|
2730
|
+
yargs.getInternalMethods().getUsageInstance().freeze();
|
|
2703
2731
|
const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
|
|
2704
2732
|
if (isPromise(builderOutput)) {
|
|
2705
2733
|
return builderOutput.then((output) => {
|
|
@@ -2708,6 +2736,7 @@ var CommandInstance = class {
|
|
|
2708
2736
|
});
|
|
2709
2737
|
}
|
|
2710
2738
|
} else if (isCommandBuilderOptionDefinitions(builder)) {
|
|
2739
|
+
yargs.getInternalMethods().getUsageInstance().freeze();
|
|
2711
2740
|
innerYargs = yargs.getInternalMethods().reset(aliases);
|
|
2712
2741
|
Object.keys(commandHandler.builder).forEach((key) => {
|
|
2713
2742
|
innerYargs.option(key, builder[key]);
|
|
@@ -2741,15 +2770,7 @@ var CommandInstance = class {
|
|
|
2741
2770
|
pc.push(c);
|
|
2742
2771
|
return `$0 ${pc.join(" ")}`;
|
|
2743
2772
|
}
|
|
2744
|
-
|
|
2745
|
-
let positionalMap = {};
|
|
2746
|
-
if (helpOnly)
|
|
2747
|
-
return innerArgv;
|
|
2748
|
-
if (!yargs.getInternalMethods().getHasOutput()) {
|
|
2749
|
-
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
|
|
2750
|
-
}
|
|
2751
|
-
const middlewares = this.globalMiddleware.getMiddleware().slice(0).concat(commandHandler.middlewares);
|
|
2752
|
-
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
|
|
2773
|
+
handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) {
|
|
2753
2774
|
if (!yargs.getInternalMethods().getHasOutput()) {
|
|
2754
2775
|
const validation2 = yargs.getInternalMethods().runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
|
|
2755
2776
|
innerArgv = maybeAsyncResult(innerArgv, (result) => {
|
|
@@ -2784,6 +2805,17 @@ var CommandInstance = class {
|
|
|
2784
2805
|
}
|
|
2785
2806
|
return innerArgv;
|
|
2786
2807
|
}
|
|
2808
|
+
applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
|
|
2809
|
+
let positionalMap = {};
|
|
2810
|
+
if (helpOnly)
|
|
2811
|
+
return innerArgv;
|
|
2812
|
+
if (!yargs.getInternalMethods().getHasOutput()) {
|
|
2813
|
+
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
|
|
2814
|
+
}
|
|
2815
|
+
const middlewares = this.globalMiddleware.getMiddleware().slice(0).concat(commandHandler.middlewares);
|
|
2816
|
+
const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
|
|
2817
|
+
return isPromise(maybePromiseArgv) ? maybePromiseArgv.then((resolvedInnerArgv) => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap)) : this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap);
|
|
2818
|
+
}
|
|
2787
2819
|
populatePositionals(commandHandler, argv, context, yargs) {
|
|
2788
2820
|
argv._ = argv._.slice(context.commands.length);
|
|
2789
2821
|
const demanded = commandHandler.demanded.slice(0);
|
|
@@ -2870,12 +2902,11 @@ var CommandInstance = class {
|
|
|
2870
2902
|
Object.keys(positionalMap).forEach((key) => {
|
|
2871
2903
|
positionalKeys.push(...parsed.aliases[key]);
|
|
2872
2904
|
});
|
|
2873
|
-
const defaults = yargs.getOptions().default;
|
|
2874
2905
|
Object.keys(parsed.argv).forEach((key) => {
|
|
2875
2906
|
if (positionalKeys.includes(key)) {
|
|
2876
2907
|
if (!positionalMap[key])
|
|
2877
2908
|
positionalMap[key] = parsed.argv[key];
|
|
2878
|
-
if (!
|
|
2909
|
+
if (!this.isInConfigs(yargs, key) && !this.isDefaulted(yargs, key) && Object.prototype.hasOwnProperty.call(argv, key) && Object.prototype.hasOwnProperty.call(parsed.argv, key) && (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
|
|
2879
2910
|
argv[key] = [].concat(argv[key], parsed.argv[key]);
|
|
2880
2911
|
} else {
|
|
2881
2912
|
argv[key] = parsed.argv[key];
|
|
@@ -2884,6 +2915,14 @@ var CommandInstance = class {
|
|
|
2884
2915
|
});
|
|
2885
2916
|
}
|
|
2886
2917
|
}
|
|
2918
|
+
isDefaulted(yargs, key) {
|
|
2919
|
+
const { default: defaults } = yargs.getOptions();
|
|
2920
|
+
return Object.prototype.hasOwnProperty.call(defaults, key) || Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key));
|
|
2921
|
+
}
|
|
2922
|
+
isInConfigs(yargs, key) {
|
|
2923
|
+
const { configObjects } = yargs.getOptions();
|
|
2924
|
+
return configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, key)) || configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key)));
|
|
2925
|
+
}
|
|
2887
2926
|
runDefaultBuilderOn(yargs) {
|
|
2888
2927
|
if (!this.defaultCommand)
|
|
2889
2928
|
return;
|
|
@@ -3111,13 +3150,16 @@ function usage(yargs, shim3) {
|
|
|
3111
3150
|
wrapSet = true;
|
|
3112
3151
|
wrap2 = cols;
|
|
3113
3152
|
};
|
|
3114
|
-
|
|
3153
|
+
self.getWrap = () => {
|
|
3154
|
+
if (shim3.getEnv("YARGS_DISABLE_WRAP")) {
|
|
3155
|
+
return null;
|
|
3156
|
+
}
|
|
3115
3157
|
if (!wrapSet) {
|
|
3116
3158
|
wrap2 = windowWidth();
|
|
3117
3159
|
wrapSet = true;
|
|
3118
3160
|
}
|
|
3119
3161
|
return wrap2;
|
|
3120
|
-
}
|
|
3162
|
+
};
|
|
3121
3163
|
const deferY18nLookupPrefix = "__yargsString__:";
|
|
3122
3164
|
self.deferY18nLookup = (str) => deferY18nLookupPrefix + str;
|
|
3123
3165
|
self.help = function help() {
|
|
@@ -3141,7 +3183,7 @@ function usage(yargs, shim3) {
|
|
|
3141
3183
|
acc[key] = true;
|
|
3142
3184
|
return acc;
|
|
3143
3185
|
}, {}));
|
|
3144
|
-
const theWrap = getWrap();
|
|
3186
|
+
const theWrap = self.getWrap();
|
|
3145
3187
|
const ui2 = shim3.cliui({
|
|
3146
3188
|
width: theWrap,
|
|
3147
3189
|
wrap: !!theWrap
|
|
@@ -3281,7 +3323,8 @@ function usage(yargs, shim3) {
|
|
|
3281
3323
|
padding: [0, 2, 0, 2 + getIndentation(kswitch)],
|
|
3282
3324
|
width: maxWidth(switches, theWrap) + 4
|
|
3283
3325
|
}, desc);
|
|
3284
|
-
|
|
3326
|
+
const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()["hide-types"] === true;
|
|
3327
|
+
if (extra && !shouldHideOptionExtras)
|
|
3285
3328
|
ui2.div({ text: extra, padding: [0, 0, 0, 2], align: "right" });
|
|
3286
3329
|
else
|
|
3287
3330
|
ui2.div();
|
|
@@ -3542,7 +3585,7 @@ var completionZshTemplate = `#compdef {{app_name}}
|
|
|
3542
3585
|
# yargs command completion script
|
|
3543
3586
|
#
|
|
3544
3587
|
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
3545
|
-
# or {{app_path}} {{completion_command}} >> ~/.
|
|
3588
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
3546
3589
|
#
|
|
3547
3590
|
_{{app_name}}_yargs_completions()
|
|
3548
3591
|
{
|
|
@@ -3560,7 +3603,7 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
|
3560
3603
|
// ../../node_modules/yargs/build/lib/completion.js
|
|
3561
3604
|
var Completion = class {
|
|
3562
3605
|
constructor(yargs, usage2, command2, shim3) {
|
|
3563
|
-
var
|
|
3606
|
+
var _a2, _b2, _c2;
|
|
3564
3607
|
this.yargs = yargs;
|
|
3565
3608
|
this.usage = usage2;
|
|
3566
3609
|
this.command = command2;
|
|
@@ -3569,7 +3612,7 @@ var Completion = class {
|
|
|
3569
3612
|
this.aliases = null;
|
|
3570
3613
|
this.customCompletionFunction = null;
|
|
3571
3614
|
this.indexAfterLastReset = 0;
|
|
3572
|
-
this.zshShell = (
|
|
3615
|
+
this.zshShell = (_c2 = ((_a2 = this.shim.getEnv("SHELL")) === null || _a2 === void 0 ? void 0 : _a2.includes("zsh")) || ((_b2 = this.shim.getEnv("ZSH_NAME")) === null || _b2 === void 0 ? void 0 : _b2.includes("zsh"))) !== null && _c2 !== void 0 ? _c2 : false;
|
|
3573
3616
|
}
|
|
3574
3617
|
defaultCompletion(args, argv, current, done) {
|
|
3575
3618
|
const handlers = this.command.getCommandHandlers();
|
|
@@ -3614,7 +3657,7 @@ var Completion = class {
|
|
|
3614
3657
|
Object.keys(options.key).forEach((key) => {
|
|
3615
3658
|
const negable = !!options.configuration["boolean-negation"] && options.boolean.includes(key);
|
|
3616
3659
|
const isPositionalKey = positionalKeys.includes(key);
|
|
3617
|
-
if (!isPositionalKey && !options.hiddenOptions.includes(key) && !this.argsContainKey(args,
|
|
3660
|
+
if (!isPositionalKey && !options.hiddenOptions.includes(key) && !this.argsContainKey(args, key, negable)) {
|
|
3618
3661
|
this.completeOptionKey(key, completions, current);
|
|
3619
3662
|
if (negable && !!options.default[key])
|
|
3620
3663
|
this.completeOptionKey(`no-${key}`, completions, current);
|
|
@@ -3679,20 +3722,22 @@ var Completion = class {
|
|
|
3679
3722
|
const choices = this.getPreviousArgChoices(args);
|
|
3680
3723
|
return choices !== void 0 && choices.length > 0;
|
|
3681
3724
|
}
|
|
3682
|
-
argsContainKey(args,
|
|
3683
|
-
|
|
3725
|
+
argsContainKey(args, key, negable) {
|
|
3726
|
+
const argsContains = (s) => args.indexOf((/^[^0-9]$/.test(s) ? "-" : "--") + s) !== -1;
|
|
3727
|
+
if (argsContains(key))
|
|
3684
3728
|
return true;
|
|
3685
|
-
if (negable &&
|
|
3729
|
+
if (negable && argsContains(`no-${key}`))
|
|
3686
3730
|
return true;
|
|
3687
3731
|
if (this.aliases) {
|
|
3688
3732
|
for (const alias of this.aliases[key]) {
|
|
3689
|
-
if (
|
|
3733
|
+
if (argsContains(alias))
|
|
3690
3734
|
return true;
|
|
3691
3735
|
}
|
|
3692
3736
|
}
|
|
3693
3737
|
return false;
|
|
3694
3738
|
}
|
|
3695
3739
|
completeOptionKey(key, completions, current) {
|
|
3740
|
+
var _a2, _b2, _c2;
|
|
3696
3741
|
const descs = this.usage.getDescriptions();
|
|
3697
3742
|
const startsByTwoDashes = (s) => /^--/.test(s);
|
|
3698
3743
|
const isShortOption = (s) => /^[^0-9]$/.test(s);
|
|
@@ -3700,8 +3745,13 @@ var Completion = class {
|
|
|
3700
3745
|
if (!this.zshShell) {
|
|
3701
3746
|
completions.push(dashes + key);
|
|
3702
3747
|
} else {
|
|
3703
|
-
const
|
|
3704
|
-
|
|
3748
|
+
const aliasKey = (_a2 = this === null || this === void 0 ? void 0 : this.aliases) === null || _a2 === void 0 ? void 0 : _a2[key].find((alias) => {
|
|
3749
|
+
const desc2 = descs[alias];
|
|
3750
|
+
return typeof desc2 === "string" && desc2.length > 0;
|
|
3751
|
+
});
|
|
3752
|
+
const descFromAlias = aliasKey ? descs[aliasKey] : void 0;
|
|
3753
|
+
const desc = (_c2 = (_b2 = descs[key]) !== null && _b2 !== void 0 ? _b2 : descFromAlias) !== null && _c2 !== void 0 ? _c2 : "";
|
|
3754
|
+
completions.push(dashes + `${key.replace(/:/g, "\\:")}:${desc.replace("__yargsString__:", "").replace(/(\r\n|\n|\r)/gm, " ")}`);
|
|
3705
3755
|
}
|
|
3706
3756
|
}
|
|
3707
3757
|
customCompletion(args, argv, current, done) {
|
|
@@ -3846,7 +3896,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
3846
3896
|
}
|
|
3847
3897
|
};
|
|
3848
3898
|
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
|
|
3849
|
-
var
|
|
3899
|
+
var _a2;
|
|
3850
3900
|
const commandKeys = yargs.getInternalMethods().getCommandInstance().getCommands();
|
|
3851
3901
|
const unknown = [];
|
|
3852
3902
|
const currentContext = yargs.getInternalMethods().getContext();
|
|
@@ -3864,7 +3914,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
3864
3914
|
}
|
|
3865
3915
|
if (checkPositionals) {
|
|
3866
3916
|
const demandedCommands = yargs.getDemandedCommands();
|
|
3867
|
-
const maxNonOptDemanded = ((
|
|
3917
|
+
const maxNonOptDemanded = ((_a2 = demandedCommands._) === null || _a2 === void 0 ? void 0 : _a2.max) || 0;
|
|
3868
3918
|
const expected = currentContext.commands.length + maxNonOptDemanded;
|
|
3869
3919
|
if (expected < argv._.length) {
|
|
3870
3920
|
argv._.slice(expected).forEach((key) => {
|
|
@@ -4164,6 +4214,7 @@ var _YargsInstance_strict;
|
|
|
4164
4214
|
var _YargsInstance_strictCommands;
|
|
4165
4215
|
var _YargsInstance_strictOptions;
|
|
4166
4216
|
var _YargsInstance_usage;
|
|
4217
|
+
var _YargsInstance_usageConfig;
|
|
4167
4218
|
var _YargsInstance_versionOpt;
|
|
4168
4219
|
var _YargsInstance_validation;
|
|
4169
4220
|
function YargsFactory(_shim) {
|
|
@@ -4187,6 +4238,7 @@ var kEmitWarning = Symbol("emitWarning");
|
|
|
4187
4238
|
var kFreeze = Symbol("freeze");
|
|
4188
4239
|
var kGetDollarZero = Symbol("getDollarZero");
|
|
4189
4240
|
var kGetParserConfiguration = Symbol("getParserConfiguration");
|
|
4241
|
+
var kGetUsageConfiguration = Symbol("getUsageConfiguration");
|
|
4190
4242
|
var kGuessLocale = Symbol("guessLocale");
|
|
4191
4243
|
var kGuessVersion = Symbol("guessVersion");
|
|
4192
4244
|
var kParsePositionalNumbers = Symbol("parsePositionalNumbers");
|
|
@@ -4251,6 +4303,7 @@ var YargsInstance = class {
|
|
|
4251
4303
|
_YargsInstance_strictCommands.set(this, false);
|
|
4252
4304
|
_YargsInstance_strictOptions.set(this, false);
|
|
4253
4305
|
_YargsInstance_usage.set(this, void 0);
|
|
4306
|
+
_YargsInstance_usageConfig.set(this, {});
|
|
4254
4307
|
_YargsInstance_versionOpt.set(this, null);
|
|
4255
4308
|
_YargsInstance_validation.set(this, void 0);
|
|
4256
4309
|
__classPrivateFieldSet(this, _YargsInstance_shim, shim3, "f");
|
|
@@ -4360,7 +4413,7 @@ var YargsInstance = class {
|
|
|
4360
4413
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
|
|
4361
4414
|
__classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addCoerceMiddleware((argv, yargs) => {
|
|
4362
4415
|
let aliases;
|
|
4363
|
-
const shouldCoerce = Object.hasOwnProperty.call(argv, keys);
|
|
4416
|
+
const shouldCoerce = Object.prototype.hasOwnProperty.call(argv, keys);
|
|
4364
4417
|
if (!shouldCoerce) {
|
|
4365
4418
|
return argv;
|
|
4366
4419
|
}
|
|
@@ -4675,7 +4728,7 @@ var YargsInstance = class {
|
|
|
4675
4728
|
}
|
|
4676
4729
|
locale(locale) {
|
|
4677
4730
|
argsert("[string]", [locale], arguments.length);
|
|
4678
|
-
if (
|
|
4731
|
+
if (locale === void 0) {
|
|
4679
4732
|
this[kGuessLocale]();
|
|
4680
4733
|
return __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.getLocale();
|
|
4681
4734
|
}
|
|
@@ -4797,7 +4850,10 @@ var YargsInstance = class {
|
|
|
4797
4850
|
this.skipValidation(key);
|
|
4798
4851
|
}
|
|
4799
4852
|
const desc = opt.describe || opt.description || opt.desc;
|
|
4800
|
-
this
|
|
4853
|
+
const descriptions = __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions();
|
|
4854
|
+
if (!Object.prototype.hasOwnProperty.call(descriptions, key) || typeof desc === "string") {
|
|
4855
|
+
this.describe(key, desc);
|
|
4856
|
+
}
|
|
4801
4857
|
if (opt.hidden) {
|
|
4802
4858
|
this.hide(key);
|
|
4803
4859
|
}
|
|
@@ -5038,6 +5094,11 @@ var YargsInstance = class {
|
|
|
5038
5094
|
return this;
|
|
5039
5095
|
}
|
|
5040
5096
|
}
|
|
5097
|
+
usageConfiguration(config) {
|
|
5098
|
+
argsert("<object>", [config], arguments.length);
|
|
5099
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config, "f");
|
|
5100
|
+
return this;
|
|
5101
|
+
}
|
|
5041
5102
|
version(opt, msg, ver) {
|
|
5042
5103
|
const defaultVersionOpt = "version";
|
|
5043
5104
|
argsert("[boolean|string] [string] [string]", [opt, msg, ver], arguments.length);
|
|
@@ -5071,7 +5132,7 @@ var YargsInstance = class {
|
|
|
5071
5132
|
__classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols);
|
|
5072
5133
|
return this;
|
|
5073
5134
|
}
|
|
5074
|
-
[(_YargsInstance_command = /* @__PURE__ */ new WeakMap(), _YargsInstance_cwd = /* @__PURE__ */ new WeakMap(), _YargsInstance_context = /* @__PURE__ */ new WeakMap(), _YargsInstance_completion = /* @__PURE__ */ new WeakMap(), _YargsInstance_completionCommand = /* @__PURE__ */ new WeakMap(), _YargsInstance_defaultShowHiddenOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitError = /* @__PURE__ */ new WeakMap(), _YargsInstance_detectLocale = /* @__PURE__ */ new WeakMap(), _YargsInstance_emittedWarnings = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitProcess = /* @__PURE__ */ new WeakMap(), _YargsInstance_frozens = /* @__PURE__ */ new WeakMap(), _YargsInstance_globalMiddleware = /* @__PURE__ */ new WeakMap(), _YargsInstance_groups = /* @__PURE__ */ new WeakMap(), _YargsInstance_hasOutput = /* @__PURE__ */ new WeakMap(), _YargsInstance_helpOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_isGlobalContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_logger = /* @__PURE__ */ new WeakMap(), _YargsInstance_output = /* @__PURE__ */ new WeakMap(), _YargsInstance_options = /* @__PURE__ */ new WeakMap(), _YargsInstance_parentRequire = /* @__PURE__ */ new WeakMap(), _YargsInstance_parserConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseFn = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_pkgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_preservedGroups = /* @__PURE__ */ new WeakMap(), _YargsInstance_processArgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_recommendCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_shim = /* @__PURE__ */ new WeakMap(), _YargsInstance_strict = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictOptions = /* @__PURE__ */ new WeakMap(), _YargsInstance_usage = /* @__PURE__ */ new WeakMap(), _YargsInstance_versionOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_validation = /* @__PURE__ */ new WeakMap(), kCopyDoubleDash)](argv) {
|
|
5135
|
+
[(_YargsInstance_command = /* @__PURE__ */ new WeakMap(), _YargsInstance_cwd = /* @__PURE__ */ new WeakMap(), _YargsInstance_context = /* @__PURE__ */ new WeakMap(), _YargsInstance_completion = /* @__PURE__ */ new WeakMap(), _YargsInstance_completionCommand = /* @__PURE__ */ new WeakMap(), _YargsInstance_defaultShowHiddenOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitError = /* @__PURE__ */ new WeakMap(), _YargsInstance_detectLocale = /* @__PURE__ */ new WeakMap(), _YargsInstance_emittedWarnings = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitProcess = /* @__PURE__ */ new WeakMap(), _YargsInstance_frozens = /* @__PURE__ */ new WeakMap(), _YargsInstance_globalMiddleware = /* @__PURE__ */ new WeakMap(), _YargsInstance_groups = /* @__PURE__ */ new WeakMap(), _YargsInstance_hasOutput = /* @__PURE__ */ new WeakMap(), _YargsInstance_helpOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_isGlobalContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_logger = /* @__PURE__ */ new WeakMap(), _YargsInstance_output = /* @__PURE__ */ new WeakMap(), _YargsInstance_options = /* @__PURE__ */ new WeakMap(), _YargsInstance_parentRequire = /* @__PURE__ */ new WeakMap(), _YargsInstance_parserConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseFn = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_pkgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_preservedGroups = /* @__PURE__ */ new WeakMap(), _YargsInstance_processArgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_recommendCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_shim = /* @__PURE__ */ new WeakMap(), _YargsInstance_strict = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictOptions = /* @__PURE__ */ new WeakMap(), _YargsInstance_usage = /* @__PURE__ */ new WeakMap(), _YargsInstance_usageConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_versionOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_validation = /* @__PURE__ */ new WeakMap(), kCopyDoubleDash)](argv) {
|
|
5075
5136
|
if (!argv._ || !argv["--"])
|
|
5076
5137
|
return argv;
|
|
5077
5138
|
argv._.push.apply(argv._, argv["--"]);
|
|
@@ -5163,6 +5224,9 @@ var YargsInstance = class {
|
|
|
5163
5224
|
[kGetParserConfiguration]() {
|
|
5164
5225
|
return __classPrivateFieldGet(this, _YargsInstance_parserConfig, "f");
|
|
5165
5226
|
}
|
|
5227
|
+
[kGetUsageConfiguration]() {
|
|
5228
|
+
return __classPrivateFieldGet(this, _YargsInstance_usageConfig, "f");
|
|
5229
|
+
}
|
|
5166
5230
|
[kGuessLocale]() {
|
|
5167
5231
|
if (!__classPrivateFieldGet(this, _YargsInstance_detectLocale, "f"))
|
|
5168
5232
|
return;
|
|
@@ -5246,20 +5310,20 @@ var YargsInstance = class {
|
|
|
5246
5310
|
return this;
|
|
5247
5311
|
}
|
|
5248
5312
|
[kUnfreeze]() {
|
|
5249
|
-
var
|
|
5313
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5250
5314
|
const frozen = __classPrivateFieldGet(this, _YargsInstance_frozens, "f").pop();
|
|
5251
5315
|
assertNotStrictEqual(frozen, void 0, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
|
|
5252
5316
|
let configObjects;
|
|
5253
|
-
|
|
5317
|
+
_a2 = this, _b2 = this, _c2 = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, {
|
|
5254
5318
|
options: { set value(_o) {
|
|
5255
|
-
__classPrivateFieldSet(
|
|
5319
|
+
__classPrivateFieldSet(_a2, _YargsInstance_options, _o, "f");
|
|
5256
5320
|
} }.value,
|
|
5257
5321
|
configObjects,
|
|
5258
5322
|
exitProcess: { set value(_o) {
|
|
5259
|
-
__classPrivateFieldSet(
|
|
5323
|
+
__classPrivateFieldSet(_b2, _YargsInstance_exitProcess, _o, "f");
|
|
5260
5324
|
} }.value,
|
|
5261
5325
|
groups: { set value(_o) {
|
|
5262
|
-
__classPrivateFieldSet(
|
|
5326
|
+
__classPrivateFieldSet(_c2, _YargsInstance_groups, _o, "f");
|
|
5263
5327
|
} }.value,
|
|
5264
5328
|
output: { set value(_o) {
|
|
5265
5329
|
__classPrivateFieldSet(_d, _YargsInstance_output, _o, "f");
|
|
@@ -5310,6 +5374,7 @@ var YargsInstance = class {
|
|
|
5310
5374
|
getLoggerInstance: this[kGetLoggerInstance].bind(this),
|
|
5311
5375
|
getParseContext: this[kGetParseContext].bind(this),
|
|
5312
5376
|
getParserConfiguration: this[kGetParserConfiguration].bind(this),
|
|
5377
|
+
getUsageConfiguration: this[kGetUsageConfiguration].bind(this),
|
|
5313
5378
|
getUsageInstance: this[kGetUsageInstance].bind(this),
|
|
5314
5379
|
getValidationInstance: this[kGetValidationInstance].bind(this),
|
|
5315
5380
|
hasParseCallback: this[kHasParseCallback].bind(this),
|
|
@@ -5790,6 +5855,10 @@ var validateUrl = (token, onlyRelative = false, includeSearch = false, includeHa
|
|
|
5790
5855
|
onlyRelative ? "URLs should begin with a forward-slash." : 'URLs should either be relative (e.g. begin with a forward-slash), or use HTTPS (e.g. begin with "https://").'
|
|
5791
5856
|
];
|
|
5792
5857
|
};
|
|
5858
|
+
function urlHasHost(token) {
|
|
5859
|
+
const host = URL_REGEX.exec(token);
|
|
5860
|
+
return Boolean(host && host.groups && host.groups.host);
|
|
5861
|
+
}
|
|
5793
5862
|
|
|
5794
5863
|
// ../pages-shared/metadata-generator/parseHeaders.ts
|
|
5795
5864
|
var LINE_IS_PROBABLY_A_PATH = new RegExp(/^([^\s]+:\/\/|^\/)/);
|
|
@@ -6002,6 +6071,14 @@ function parseRedirects(input) {
|
|
|
6002
6071
|
});
|
|
6003
6072
|
continue;
|
|
6004
6073
|
}
|
|
6074
|
+
if (/\/\*?$/.test(from) && /\/index(.html)?$/.test(to) && !urlHasHost(to)) {
|
|
6075
|
+
invalid.push({
|
|
6076
|
+
line,
|
|
6077
|
+
lineNumber: i + 1,
|
|
6078
|
+
message: "Infinite loop detected in this rule and has been ignored. This will cause a redirect to strip `.html` or `/index` and end up triggering this rule again. Please fix or remove this rule to silence this warning."
|
|
6079
|
+
});
|
|
6080
|
+
continue;
|
|
6081
|
+
}
|
|
6005
6082
|
if (seen_paths.has(from)) {
|
|
6006
6083
|
invalid.push({
|
|
6007
6084
|
line,
|
|
@@ -6012,8 +6089,7 @@ function parseRedirects(input) {
|
|
|
6012
6089
|
}
|
|
6013
6090
|
seen_paths.add(from);
|
|
6014
6091
|
if (status === 200) {
|
|
6015
|
-
|
|
6016
|
-
if (error) {
|
|
6092
|
+
if (urlHasHost(to)) {
|
|
6017
6093
|
invalid.push({
|
|
6018
6094
|
line,
|
|
6019
6095
|
lineNumber: i + 1,
|
|
@@ -6021,8 +6097,6 @@ function parseRedirects(input) {
|
|
|
6021
6097
|
});
|
|
6022
6098
|
continue;
|
|
6023
6099
|
}
|
|
6024
|
-
rules.push({ from, to: proxyTo, status, lineNumber: i + 1 });
|
|
6025
|
-
continue;
|
|
6026
6100
|
}
|
|
6027
6101
|
rules.push({ from, to, status, lineNumber: i + 1 });
|
|
6028
6102
|
}
|
|
@@ -6053,7 +6127,7 @@ async function generateASSETSBinding(options) {
|
|
|
6053
6127
|
const miniflare = options.tre ? await import("@miniflare/tre") : await import("@miniflare/core");
|
|
6054
6128
|
const Request = miniflare.Request;
|
|
6055
6129
|
const Response2 = miniflare.Response;
|
|
6056
|
-
const
|
|
6130
|
+
const fetch = options.tre ? miniflare.fetch : (await import("@miniflare/web-sockets")).upgradingFetch;
|
|
6057
6131
|
return async function(miniflareRequest) {
|
|
6058
6132
|
if (options.proxyPort) {
|
|
6059
6133
|
try {
|
|
@@ -6064,7 +6138,7 @@ async function generateASSETSBinding(options) {
|
|
|
6064
6138
|
proxyRequest.headers.delete("Sec-WebSocket-Accept");
|
|
6065
6139
|
proxyRequest.headers.delete("Sec-WebSocket-Key");
|
|
6066
6140
|
}
|
|
6067
|
-
return await
|
|
6141
|
+
return await fetch(proxyRequest);
|
|
6068
6142
|
} catch (thrown) {
|
|
6069
6143
|
options.log.error(new Error(`Could not proxy request: ${thrown}`));
|
|
6070
6144
|
return new Response2(`[wrangler] Could not proxy request: ${thrown}`, {
|
|
@@ -6264,7 +6338,7 @@ async function main() {
|
|
|
6264
6338
|
"x-miniflare-durable-object-id",
|
|
6265
6339
|
id.toString()
|
|
6266
6340
|
);
|
|
6267
|
-
return
|
|
6341
|
+
return upgradingFetch(request);
|
|
6268
6342
|
};
|
|
6269
6343
|
return stub;
|
|
6270
6344
|
};
|