wrangler 2.1.2 → 2.1.3
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/package.json +1 -1
- package/src/__tests__/dev.test.tsx +2 -1
- package/src/__tests__/dialogs.test.tsx +40 -0
- package/src/api/dev.ts +2 -1
- package/src/dev/dev.tsx +2 -2
- package/src/dev/local.tsx +2 -12
- package/src/dev/start-server.ts +2 -13
- package/src/dev.tsx +39 -6
- package/src/dialogs.tsx +8 -1
- package/src/pages/dev.tsx +28 -4
- package/wrangler-dist/cli.d.ts +2 -1
- package/wrangler-dist/cli.js +57 -17
package/package.json
CHANGED
|
@@ -1025,7 +1025,8 @@ describe("wrangler dev", () => {
|
|
|
1025
1025
|
-l, --local Run on my machine [boolean] [default: false]
|
|
1026
1026
|
--minify Minify the script [boolean]
|
|
1027
1027
|
--node-compat Enable node.js compatibility [boolean]
|
|
1028
|
-
--
|
|
1028
|
+
--persist Enable persistence for local mode, using default path: .wrangler/state [boolean]
|
|
1029
|
+
--persist-to Specify directory to use for local persistence (implies --persist) [string]
|
|
1029
1030
|
--inspect Enable dev tools [deprecated] [boolean]",
|
|
1030
1031
|
"warn": "",
|
|
1031
1032
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
jest.unmock("../dialogs");
|
|
2
|
+
import { fromDashMessagePrompt } from "../dialogs";
|
|
3
|
+
import { CI } from "../is-ci";
|
|
4
|
+
|
|
5
|
+
describe("fromDashMessagePrompt", () => {
|
|
6
|
+
it("should return undefined in CI when last deployed from api", async () => {
|
|
7
|
+
//in CI
|
|
8
|
+
jest.spyOn(CI, "isCI").mockReturnValue(true);
|
|
9
|
+
const result = await fromDashMessagePrompt("api");
|
|
10
|
+
expect(result).toBe(undefined);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should return undefined in CI when last deployed from wrangler", async () => {
|
|
14
|
+
//in CI
|
|
15
|
+
jest.spyOn(CI, "isCI").mockReturnValue(true);
|
|
16
|
+
const result = await fromDashMessagePrompt("wrangler");
|
|
17
|
+
expect(result).toBe(undefined);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should return true in CI when last deployed from dash", async () => {
|
|
21
|
+
//in CI
|
|
22
|
+
jest.spyOn(CI, "isCI").mockReturnValue(true);
|
|
23
|
+
const result = await fromDashMessagePrompt("dash");
|
|
24
|
+
expect(result).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should return undefined when last deployed from api", async () => {
|
|
28
|
+
//not in CI
|
|
29
|
+
jest.spyOn(CI, "isCI").mockReturnValue(false);
|
|
30
|
+
const result = await fromDashMessagePrompt("api");
|
|
31
|
+
expect(result).toBe(undefined);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should return undefined when last deployed from wrangler", async () => {
|
|
35
|
+
//not in CI
|
|
36
|
+
jest.spyOn(CI, "isCI").mockReturnValue(false);
|
|
37
|
+
const result = await fromDashMessagePrompt("wrangler");
|
|
38
|
+
expect(result).toBe(undefined);
|
|
39
|
+
});
|
|
40
|
+
});
|
package/src/api/dev.ts
CHANGED
|
@@ -19,7 +19,8 @@ interface DevOptions {
|
|
|
19
19
|
nodeCompat?: boolean;
|
|
20
20
|
compatibilityDate?: string;
|
|
21
21
|
compatibilityFlags?: string[];
|
|
22
|
-
|
|
22
|
+
persist?: boolean;
|
|
23
|
+
persistTo?: string;
|
|
23
24
|
liveReload?: boolean;
|
|
24
25
|
watch?: boolean;
|
|
25
26
|
vars?: {
|
package/src/dev/dev.tsx
CHANGED
|
@@ -136,7 +136,7 @@ export type DevProps = {
|
|
|
136
136
|
upstreamProtocol: "https" | "http";
|
|
137
137
|
localProtocol: "https" | "http";
|
|
138
138
|
localUpstream: string | undefined;
|
|
139
|
-
|
|
139
|
+
localPersistencePath: string | null;
|
|
140
140
|
liveReload: boolean;
|
|
141
141
|
bindings: CfWorkerInit["bindings"];
|
|
142
142
|
define: Config["define"];
|
|
@@ -276,7 +276,7 @@ function DevSession(props: DevSessionProps) {
|
|
|
276
276
|
ip={props.ip}
|
|
277
277
|
rules={props.rules}
|
|
278
278
|
inspectorPort={props.inspectorPort}
|
|
279
|
-
|
|
279
|
+
localPersistencePath={props.localPersistencePath}
|
|
280
280
|
liveReload={props.liveReload}
|
|
281
281
|
crons={props.crons}
|
|
282
282
|
localProtocol={props.localProtocol}
|
package/src/dev/local.tsx
CHANGED
|
@@ -42,7 +42,7 @@ export interface LocalProps {
|
|
|
42
42
|
ip: string;
|
|
43
43
|
rules: Config["rules"];
|
|
44
44
|
inspectorPort: number;
|
|
45
|
-
|
|
45
|
+
localPersistencePath: string | null;
|
|
46
46
|
liveReload: boolean;
|
|
47
47
|
crons: Config["triggers"]["crons"];
|
|
48
48
|
localProtocol: "http" | "https";
|
|
@@ -77,7 +77,7 @@ function useLocalWorker({
|
|
|
77
77
|
port,
|
|
78
78
|
inspectorPort,
|
|
79
79
|
rules,
|
|
80
|
-
|
|
80
|
+
localPersistencePath,
|
|
81
81
|
liveReload,
|
|
82
82
|
ip,
|
|
83
83
|
crons,
|
|
@@ -93,16 +93,6 @@ function useLocalWorker({
|
|
|
93
93
|
const local = useRef<ChildProcess>();
|
|
94
94
|
const removeSignalExitListener = useRef<() => void>();
|
|
95
95
|
const [inspectorUrl, setInspectorUrl] = useState<string | undefined>();
|
|
96
|
-
// if we're using local persistence for data, we should use the cwd
|
|
97
|
-
// as an explicit path, or else it'll use the temp dir
|
|
98
|
-
// which disappears when dev ends
|
|
99
|
-
const localPersistencePath = enableLocalPersistence
|
|
100
|
-
? // Maybe we could make the path configurable as well?
|
|
101
|
-
path.join(process.cwd(), "wrangler-local-state")
|
|
102
|
-
: // We otherwise choose null, but choose true later
|
|
103
|
-
// so that it's persisted in the temp dir across a dev session
|
|
104
|
-
// even when we change source and reload
|
|
105
|
-
null;
|
|
106
96
|
|
|
107
97
|
useEffect(() => {
|
|
108
98
|
if (bindings.services && bindings.services.length > 0) {
|
package/src/dev/start-server.ts
CHANGED
|
@@ -80,7 +80,7 @@ export async function startDevServer(
|
|
|
80
80
|
ip: props.ip,
|
|
81
81
|
rules: props.rules,
|
|
82
82
|
inspectorPort: props.inspectorPort,
|
|
83
|
-
|
|
83
|
+
localPersistencePath: props.localPersistencePath,
|
|
84
84
|
liveReload: props.liveReload,
|
|
85
85
|
crons: props.crons,
|
|
86
86
|
localProtocol: props.localProtocol,
|
|
@@ -203,7 +203,7 @@ export async function startLocalServer({
|
|
|
203
203
|
port,
|
|
204
204
|
inspectorPort,
|
|
205
205
|
rules,
|
|
206
|
-
|
|
206
|
+
localPersistencePath,
|
|
207
207
|
liveReload,
|
|
208
208
|
ip,
|
|
209
209
|
crons,
|
|
@@ -222,17 +222,6 @@ export async function startLocalServer({
|
|
|
222
222
|
inspectorUrl = url;
|
|
223
223
|
};
|
|
224
224
|
|
|
225
|
-
// if we're using local persistence for data, we should use the cwd
|
|
226
|
-
// as an explicit path, or else it'll use the temp dir
|
|
227
|
-
// which disappears when dev ends
|
|
228
|
-
const localPersistencePath = enableLocalPersistence
|
|
229
|
-
? // Maybe we could make the path configurable as well?
|
|
230
|
-
path.join(process.cwd(), "wrangler-local-state")
|
|
231
|
-
: // We otherwise choose null, but choose true later
|
|
232
|
-
// so that it's persisted in the temp dir across a dev session
|
|
233
|
-
// even when we change source and reload
|
|
234
|
-
null;
|
|
235
|
-
|
|
236
225
|
const abortController = new AbortController();
|
|
237
226
|
async function startLocalWorker() {
|
|
238
227
|
if (!bundle || !format) return;
|
package/src/dev.tsx
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
isLegacyEnv,
|
|
25
25
|
DEFAULT_INSPECTOR_PORT,
|
|
26
26
|
} from "./index";
|
|
27
|
-
|
|
28
27
|
import type { Config } from "./config";
|
|
29
28
|
import type { Route } from "./config/environment";
|
|
30
29
|
import type { EnablePagesAssetsServiceBindingOptions } from "./miniflare-cli";
|
|
@@ -66,6 +65,8 @@ interface DevArgs {
|
|
|
66
65
|
define?: string[];
|
|
67
66
|
"node-compat"?: boolean;
|
|
68
67
|
"experimental-enable-local-persistence"?: boolean;
|
|
68
|
+
persist?: boolean;
|
|
69
|
+
"persist-to"?: string;
|
|
69
70
|
"live-reload"?: boolean;
|
|
70
71
|
onReady?: (ip: string, port: number) => void;
|
|
71
72
|
logLevel?: "none" | "error" | "log" | "warn" | "debug";
|
|
@@ -239,8 +240,22 @@ export function devOptions(yargs: Argv): Argv<DevArgs> {
|
|
|
239
240
|
type: "boolean",
|
|
240
241
|
})
|
|
241
242
|
.option("experimental-enable-local-persistence", {
|
|
242
|
-
describe:
|
|
243
|
+
describe:
|
|
244
|
+
"Enable persistence for local mode (deprecated, use --persist)",
|
|
243
245
|
type: "boolean",
|
|
246
|
+
deprecated: true,
|
|
247
|
+
hidden: true,
|
|
248
|
+
})
|
|
249
|
+
.option("persist", {
|
|
250
|
+
describe:
|
|
251
|
+
"Enable persistence for local mode, using default path: .wrangler/state",
|
|
252
|
+
type: "boolean",
|
|
253
|
+
})
|
|
254
|
+
.option("persist-to", {
|
|
255
|
+
describe:
|
|
256
|
+
"Specify directory to use for local persistence (implies --persist)",
|
|
257
|
+
type: "string",
|
|
258
|
+
requiresArg: true,
|
|
244
259
|
})
|
|
245
260
|
.option("live-reload", {
|
|
246
261
|
// TODO: Add back in once we have remote `--live-reload`
|
|
@@ -342,6 +357,7 @@ export async function startDev(args: StartDevOptions) {
|
|
|
342
357
|
getLocalPort,
|
|
343
358
|
getInspectorPort,
|
|
344
359
|
cliDefines,
|
|
360
|
+
localPersistencePath,
|
|
345
361
|
} = await validateDevServerSettings(args, config);
|
|
346
362
|
|
|
347
363
|
await metrics.sendMetricsEvent(
|
|
@@ -382,9 +398,7 @@ export async function startDev(args: StartDevOptions) {
|
|
|
382
398
|
upstreamProtocol={upstreamProtocol}
|
|
383
399
|
localProtocol={args.localProtocol || configParam.dev.local_protocol}
|
|
384
400
|
localUpstream={args["local-upstream"] || host}
|
|
385
|
-
|
|
386
|
-
args.experimentalEnableLocalPersistence || false
|
|
387
|
-
}
|
|
401
|
+
localPersistencePath={localPersistencePath}
|
|
388
402
|
liveReload={args.liveReload || false}
|
|
389
403
|
accountId={configParam.account_id || getAccountFromCache()?.id}
|
|
390
404
|
assetPaths={assetPaths}
|
|
@@ -457,6 +471,7 @@ export async function startApiDev(args: StartDevOptions) {
|
|
|
457
471
|
getLocalPort,
|
|
458
472
|
getInspectorPort,
|
|
459
473
|
cliDefines,
|
|
474
|
+
localPersistencePath,
|
|
460
475
|
} = await validateDevServerSettings(args, config);
|
|
461
476
|
|
|
462
477
|
await metrics.sendMetricsEvent(
|
|
@@ -493,7 +508,7 @@ export async function startApiDev(args: StartDevOptions) {
|
|
|
493
508
|
upstreamProtocol: upstreamProtocol,
|
|
494
509
|
localProtocol: args.localProtocol || configParam.dev.local_protocol,
|
|
495
510
|
localUpstream: args["local-upstream"] || host,
|
|
496
|
-
|
|
511
|
+
localPersistencePath: localPersistencePath,
|
|
497
512
|
liveReload: args.liveReload || false,
|
|
498
513
|
accountId: configParam.account_id || getAccountFromCache()?.id,
|
|
499
514
|
assetPaths: assetPaths,
|
|
@@ -670,6 +685,23 @@ async function validateDevServerSettings(
|
|
|
670
685
|
);
|
|
671
686
|
}
|
|
672
687
|
|
|
688
|
+
if (args.experimentalEnableLocalPersistence) {
|
|
689
|
+
logger.warn(
|
|
690
|
+
`--experimental-enable-local-persistence is deprecated.\n` +
|
|
691
|
+
`Move any existing data to .wrangler/state and use --persist, or\n` +
|
|
692
|
+
`use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const localPersistencePath = args.persistTo
|
|
697
|
+
? // If path specified, always treat it as relative to cwd()
|
|
698
|
+
path.resolve(process.cwd(), args.persistTo)
|
|
699
|
+
: args.persist
|
|
700
|
+
? // If just flagged on, treat it as relative to wrangler.toml,
|
|
701
|
+
// if one can be found, otherwise cwd()
|
|
702
|
+
path.resolve(config.configPath || process.cwd(), ".wrangler/state")
|
|
703
|
+
: null;
|
|
704
|
+
|
|
673
705
|
const cliDefines =
|
|
674
706
|
args.define?.reduce<Record<string, string>>((collectDefines, d) => {
|
|
675
707
|
const [key, ...value] = d.split(":");
|
|
@@ -687,6 +719,7 @@ async function validateDevServerSettings(
|
|
|
687
719
|
host,
|
|
688
720
|
routes,
|
|
689
721
|
cliDefines,
|
|
722
|
+
localPersistencePath,
|
|
690
723
|
};
|
|
691
724
|
}
|
|
692
725
|
|
package/src/dialogs.tsx
CHANGED
|
@@ -4,7 +4,11 @@ import SelectInput from "ink-select-input";
|
|
|
4
4
|
import TextInput from "ink-text-input";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
+
|
|
8
|
+
import { CI } from "./is-ci";
|
|
9
|
+
import isInteractive from "./is-interactive";
|
|
7
10
|
import { logger } from "./logger";
|
|
11
|
+
|
|
8
12
|
type ConfirmProps = {
|
|
9
13
|
text: string;
|
|
10
14
|
onConfirm: (answer: boolean) => void;
|
|
@@ -135,13 +139,16 @@ export function select(
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
export async function fromDashMessagePrompt(
|
|
138
|
-
deploySource:
|
|
142
|
+
deploySource: "dash" | "wrangler" | "api"
|
|
139
143
|
): Promise<boolean | void> {
|
|
140
144
|
if (deploySource === "dash") {
|
|
141
145
|
logger.warn(
|
|
142
146
|
`You are about to publish a Workers Service that was last published via the Cloudflare Dashboard.
|
|
143
147
|
Edits that have been made via the dashboard will be overridden by your local code and config.`
|
|
144
148
|
);
|
|
149
|
+
|
|
150
|
+
if (!isInteractive() || CI.isCI()) return true;
|
|
151
|
+
|
|
145
152
|
return await confirm("Would you like to continue?");
|
|
146
153
|
}
|
|
147
154
|
}
|
package/src/pages/dev.tsx
CHANGED
|
@@ -116,9 +116,22 @@ export function Options(yargs: Argv) {
|
|
|
116
116
|
choices: ["http", "https"] as const,
|
|
117
117
|
},
|
|
118
118
|
"experimental-enable-local-persistence": {
|
|
119
|
+
describe:
|
|
120
|
+
"Enable persistence for local mode (deprecated, use --persist)",
|
|
119
121
|
type: "boolean",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
deprecated: true,
|
|
123
|
+
hidden: true,
|
|
124
|
+
},
|
|
125
|
+
persist: {
|
|
126
|
+
describe:
|
|
127
|
+
"Enable persistence for local mode, using default path: .wrangler/state",
|
|
128
|
+
type: "boolean",
|
|
129
|
+
},
|
|
130
|
+
"persist-to": {
|
|
131
|
+
describe:
|
|
132
|
+
"Specify directory to use for local persistence (implies --persist)",
|
|
133
|
+
type: "string",
|
|
134
|
+
requiresArg: true,
|
|
122
135
|
},
|
|
123
136
|
"node-compat": {
|
|
124
137
|
describe: "Enable node.js compatibility",
|
|
@@ -151,7 +164,9 @@ export const Handler = async ({
|
|
|
151
164
|
r2: r2s = [],
|
|
152
165
|
"live-reload": liveReload,
|
|
153
166
|
"local-protocol": localProtocol,
|
|
154
|
-
|
|
167
|
+
experimentalEnableLocalPersistence,
|
|
168
|
+
persist,
|
|
169
|
+
persistTo,
|
|
155
170
|
"node-compat": nodeCompat,
|
|
156
171
|
config: config,
|
|
157
172
|
_: [_pages, _dev, ...remaining],
|
|
@@ -189,6 +204,14 @@ export const Handler = async ({
|
|
|
189
204
|
directory = resolve(directory);
|
|
190
205
|
}
|
|
191
206
|
|
|
207
|
+
if (experimentalEnableLocalPersistence) {
|
|
208
|
+
logger.warn(
|
|
209
|
+
`--experimental-enable-local-persistence is deprecated.\n` +
|
|
210
|
+
`Move any existing data to .wrangler/state and use --persist, or\n` +
|
|
211
|
+
`use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
192
215
|
let scriptReadyResolve: () => void;
|
|
193
216
|
const scriptReadyPromise = new Promise<void>(
|
|
194
217
|
(promiseResolve) => (scriptReadyResolve = promiseResolve)
|
|
@@ -358,7 +381,8 @@ export const Handler = async ({
|
|
|
358
381
|
directory,
|
|
359
382
|
},
|
|
360
383
|
forceLocal: true,
|
|
361
|
-
|
|
384
|
+
persist,
|
|
385
|
+
persistTo,
|
|
362
386
|
showInteractiveDevSession: undefined,
|
|
363
387
|
inspect: true,
|
|
364
388
|
logLevel: "error",
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -52,7 +52,8 @@ declare interface DevOptions {
|
|
|
52
52
|
nodeCompat?: boolean;
|
|
53
53
|
compatibilityDate?: string;
|
|
54
54
|
compatibilityFlags?: string[];
|
|
55
|
-
|
|
55
|
+
persist?: boolean;
|
|
56
|
+
persistTo?: string;
|
|
56
57
|
liveReload?: boolean;
|
|
57
58
|
watch?: boolean;
|
|
58
59
|
vars?: {
|
package/wrangler-dist/cli.js
CHANGED
|
@@ -138674,7 +138674,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
|
|
|
138674
138674
|
var wrapper_default = import_websocket.default;
|
|
138675
138675
|
|
|
138676
138676
|
// package.json
|
|
138677
|
-
var version = "2.1.
|
|
138677
|
+
var version = "2.1.3";
|
|
138678
138678
|
var package_default = {
|
|
138679
138679
|
name: "wrangler",
|
|
138680
138680
|
version,
|
|
@@ -139940,7 +139940,7 @@ function useLocalWorker({
|
|
|
139940
139940
|
port,
|
|
139941
139941
|
inspectorPort,
|
|
139942
139942
|
rules,
|
|
139943
|
-
|
|
139943
|
+
localPersistencePath,
|
|
139944
139944
|
liveReload,
|
|
139945
139945
|
ip,
|
|
139946
139946
|
crons,
|
|
@@ -139955,7 +139955,6 @@ function useLocalWorker({
|
|
|
139955
139955
|
const local = (0, import_react3.useRef)();
|
|
139956
139956
|
const removeSignalExitListener = (0, import_react3.useRef)();
|
|
139957
139957
|
const [inspectorUrl, setInspectorUrl] = (0, import_react3.useState)();
|
|
139958
|
-
const localPersistencePath = enableLocalPersistence ? import_node_path13.default.join(process.cwd(), "wrangler-local-state") : null;
|
|
139959
139958
|
(0, import_react3.useEffect)(() => {
|
|
139960
139959
|
if (bindings.services && bindings.services.length > 0) {
|
|
139961
139960
|
logger.warn(
|
|
@@ -143193,7 +143192,7 @@ function DevSession(props) {
|
|
|
143193
143192
|
ip: props.ip,
|
|
143194
143193
|
rules: props.rules,
|
|
143195
143194
|
inspectorPort: props.inspectorPort,
|
|
143196
|
-
|
|
143195
|
+
localPersistencePath: props.localPersistencePath,
|
|
143197
143196
|
liveReload: props.liveReload,
|
|
143198
143197
|
crons: props.crons,
|
|
143199
143198
|
localProtocol: props.localProtocol,
|
|
@@ -143476,7 +143475,7 @@ async function startDevServer(props) {
|
|
|
143476
143475
|
ip: props.ip,
|
|
143477
143476
|
rules: props.rules,
|
|
143478
143477
|
inspectorPort: props.inspectorPort,
|
|
143479
|
-
|
|
143478
|
+
localPersistencePath: props.localPersistencePath,
|
|
143480
143479
|
liveReload: props.liveReload,
|
|
143481
143480
|
crons: props.crons,
|
|
143482
143481
|
localProtocol: props.localProtocol,
|
|
@@ -143576,7 +143575,7 @@ async function startLocalServer({
|
|
|
143576
143575
|
port,
|
|
143577
143576
|
inspectorPort,
|
|
143578
143577
|
rules,
|
|
143579
|
-
|
|
143578
|
+
localPersistencePath,
|
|
143580
143579
|
liveReload,
|
|
143581
143580
|
ip,
|
|
143582
143581
|
crons,
|
|
@@ -143594,7 +143593,6 @@ async function startLocalServer({
|
|
|
143594
143593
|
const setInspectorUrl = (url3) => {
|
|
143595
143594
|
inspectorUrl = url3;
|
|
143596
143595
|
};
|
|
143597
|
-
const localPersistencePath = enableLocalPersistence ? path20.join(process.cwd(), "wrangler-local-state") : null;
|
|
143598
143596
|
const abortController = new AbortController();
|
|
143599
143597
|
async function startLocalWorker() {
|
|
143600
143598
|
if (!bundle || !format4)
|
|
@@ -143850,6 +143848,8 @@ async function fromDashMessagePrompt(deploySource) {
|
|
|
143850
143848
|
`You are about to publish a Workers Service that was last published via the Cloudflare Dashboard.
|
|
143851
143849
|
Edits that have been made via the dashboard will be overridden by your local code and config.`
|
|
143852
143850
|
);
|
|
143851
|
+
if (!isInteractive() || CI.isCI())
|
|
143852
|
+
return true;
|
|
143853
143853
|
return await confirm("Would you like to continue?");
|
|
143854
143854
|
}
|
|
143855
143855
|
}
|
|
@@ -149726,9 +149726,19 @@ function Options2(yargs) {
|
|
|
149726
149726
|
choices: ["http", "https"]
|
|
149727
149727
|
},
|
|
149728
149728
|
"experimental-enable-local-persistence": {
|
|
149729
|
+
describe: "Enable persistence for local mode (deprecated, use --persist)",
|
|
149729
149730
|
type: "boolean",
|
|
149730
|
-
|
|
149731
|
-
|
|
149731
|
+
deprecated: true,
|
|
149732
|
+
hidden: true
|
|
149733
|
+
},
|
|
149734
|
+
persist: {
|
|
149735
|
+
describe: "Enable persistence for local mode, using default path: .wrangler/state",
|
|
149736
|
+
type: "boolean"
|
|
149737
|
+
},
|
|
149738
|
+
"persist-to": {
|
|
149739
|
+
describe: "Specify directory to use for local persistence (implies --persist)",
|
|
149740
|
+
type: "string",
|
|
149741
|
+
requiresArg: true
|
|
149732
149742
|
},
|
|
149733
149743
|
"node-compat": {
|
|
149734
149744
|
describe: "Enable node.js compatibility",
|
|
@@ -149759,7 +149769,9 @@ var Handler2 = async ({
|
|
|
149759
149769
|
r2: r2s = [],
|
|
149760
149770
|
"live-reload": liveReload,
|
|
149761
149771
|
"local-protocol": localProtocol,
|
|
149762
|
-
|
|
149772
|
+
experimentalEnableLocalPersistence,
|
|
149773
|
+
persist,
|
|
149774
|
+
persistTo,
|
|
149763
149775
|
"node-compat": nodeCompat,
|
|
149764
149776
|
config,
|
|
149765
149777
|
_: [_pages, _dev, ...remaining]
|
|
@@ -149790,6 +149802,13 @@ var Handler2 = async ({
|
|
|
149790
149802
|
} else {
|
|
149791
149803
|
directory = (0, import_node_path26.resolve)(directory);
|
|
149792
149804
|
}
|
|
149805
|
+
if (experimentalEnableLocalPersistence) {
|
|
149806
|
+
logger.warn(
|
|
149807
|
+
`--experimental-enable-local-persistence is deprecated.
|
|
149808
|
+
Move any existing data to .wrangler/state and use --persist, or
|
|
149809
|
+
use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
149810
|
+
);
|
|
149811
|
+
}
|
|
149793
149812
|
let scriptReadyResolve;
|
|
149794
149813
|
const scriptReadyPromise = new Promise(
|
|
149795
149814
|
(promiseResolve) => scriptReadyResolve = promiseResolve
|
|
@@ -149928,7 +149947,8 @@ var Handler2 = async ({
|
|
|
149928
149947
|
directory
|
|
149929
149948
|
},
|
|
149930
149949
|
forceLocal: true,
|
|
149931
|
-
|
|
149950
|
+
persist,
|
|
149951
|
+
persistTo,
|
|
149932
149952
|
showInteractiveDevSession: void 0,
|
|
149933
149953
|
inspect: true,
|
|
149934
149954
|
logLevel: "error",
|
|
@@ -154848,8 +154868,17 @@ function devOptions(yargs) {
|
|
|
154848
154868
|
describe: "Enable node.js compatibility",
|
|
154849
154869
|
type: "boolean"
|
|
154850
154870
|
}).option("experimental-enable-local-persistence", {
|
|
154851
|
-
describe: "Enable persistence for
|
|
154871
|
+
describe: "Enable persistence for local mode (deprecated, use --persist)",
|
|
154872
|
+
type: "boolean",
|
|
154873
|
+
deprecated: true,
|
|
154874
|
+
hidden: true
|
|
154875
|
+
}).option("persist", {
|
|
154876
|
+
describe: "Enable persistence for local mode, using default path: .wrangler/state",
|
|
154852
154877
|
type: "boolean"
|
|
154878
|
+
}).option("persist-to", {
|
|
154879
|
+
describe: "Specify directory to use for local persistence (implies --persist)",
|
|
154880
|
+
type: "string",
|
|
154881
|
+
requiresArg: true
|
|
154853
154882
|
}).option("live-reload", {
|
|
154854
154883
|
hidden: true,
|
|
154855
154884
|
type: "boolean"
|
|
@@ -154904,7 +154933,8 @@ async function startDev(args) {
|
|
|
154904
154933
|
routes,
|
|
154905
154934
|
getLocalPort,
|
|
154906
154935
|
getInspectorPort,
|
|
154907
|
-
cliDefines
|
|
154936
|
+
cliDefines,
|
|
154937
|
+
localPersistencePath
|
|
154908
154938
|
} = await validateDevServerSettings(args, config);
|
|
154909
154939
|
await sendMetricsEvent(
|
|
154910
154940
|
"run dev",
|
|
@@ -154940,7 +154970,7 @@ async function startDev(args) {
|
|
|
154940
154970
|
upstreamProtocol,
|
|
154941
154971
|
localProtocol: args.localProtocol || configParam.dev.local_protocol,
|
|
154942
154972
|
localUpstream: args["local-upstream"] || host,
|
|
154943
|
-
|
|
154973
|
+
localPersistencePath,
|
|
154944
154974
|
liveReload: args.liveReload || false,
|
|
154945
154975
|
accountId: configParam.account_id || getAccountFromCache()?.id,
|
|
154946
154976
|
assetPaths,
|
|
@@ -154998,7 +155028,8 @@ async function startApiDev(args) {
|
|
|
154998
155028
|
routes,
|
|
154999
155029
|
getLocalPort,
|
|
155000
155030
|
getInspectorPort,
|
|
155001
|
-
cliDefines
|
|
155031
|
+
cliDefines,
|
|
155032
|
+
localPersistencePath
|
|
155002
155033
|
} = await validateDevServerSettings(args, config);
|
|
155003
155034
|
await sendMetricsEvent(
|
|
155004
155035
|
"run dev (api)",
|
|
@@ -155031,7 +155062,7 @@ async function startApiDev(args) {
|
|
|
155031
155062
|
upstreamProtocol,
|
|
155032
155063
|
localProtocol: args.localProtocol || configParam.dev.local_protocol,
|
|
155033
155064
|
localUpstream: args["local-upstream"] || host,
|
|
155034
|
-
|
|
155065
|
+
localPersistencePath,
|
|
155035
155066
|
liveReload: args.liveReload || false,
|
|
155036
155067
|
accountId: configParam.account_id || getAccountFromCache()?.id,
|
|
155037
155068
|
assetPaths,
|
|
@@ -155161,6 +155192,14 @@ async function validateDevServerSettings(args, config) {
|
|
|
155161
155192
|
"Enabling node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details."
|
|
155162
155193
|
);
|
|
155163
155194
|
}
|
|
155195
|
+
if (args.experimentalEnableLocalPersistence) {
|
|
155196
|
+
logger.warn(
|
|
155197
|
+
`--experimental-enable-local-persistence is deprecated.
|
|
155198
|
+
Move any existing data to .wrangler/state and use --persist, or
|
|
155199
|
+
use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
155200
|
+
);
|
|
155201
|
+
}
|
|
155202
|
+
const localPersistencePath = args.persistTo ? import_node_path33.default.resolve(process.cwd(), args.persistTo) : args.persist ? import_node_path33.default.resolve(config.configPath || process.cwd(), ".wrangler/state") : null;
|
|
155164
155203
|
const cliDefines = args.define?.reduce((collectDefines, d) => {
|
|
155165
155204
|
const [key2, ...value] = d.split(":");
|
|
155166
155205
|
collectDefines[key2] = value.join("");
|
|
@@ -155175,7 +155214,8 @@ async function validateDevServerSettings(args, config) {
|
|
|
155175
155214
|
zoneId,
|
|
155176
155215
|
host,
|
|
155177
155216
|
routes,
|
|
155178
|
-
cliDefines
|
|
155217
|
+
cliDefines,
|
|
155218
|
+
localPersistencePath
|
|
155179
155219
|
};
|
|
155180
155220
|
}
|
|
155181
155221
|
async function getBindingsAndAssetPaths(args, configParam) {
|