@shopify/cli-hydrogen 6.0.2 → 7.0.0
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/dist/commands/hydrogen/build.js +40 -78
- package/dist/commands/hydrogen/codegen.js +8 -3
- package/dist/commands/hydrogen/deploy.js +173 -37
- package/dist/commands/hydrogen/deploy.test.js +192 -20
- package/dist/commands/hydrogen/dev.js +56 -31
- package/dist/commands/hydrogen/init.js +1 -1
- package/dist/commands/hydrogen/init.test.js +155 -53
- package/dist/commands/hydrogen/link.js +5 -21
- package/dist/commands/hydrogen/link.test.js +10 -10
- package/dist/commands/hydrogen/preview.js +22 -11
- package/dist/commands/hydrogen/setup.js +0 -4
- package/dist/commands/hydrogen/setup.test.js +0 -1
- package/dist/commands/hydrogen/shortcut.js +1 -0
- package/dist/commands/hydrogen/upgrade.js +720 -0
- package/dist/commands/hydrogen/upgrade.test.js +786 -0
- package/dist/generator-templates/starter/.graphqlrc.yml +12 -1
- package/dist/generator-templates/starter/CHANGELOG.md +126 -0
- package/dist/generator-templates/starter/README.md +23 -0
- package/dist/generator-templates/starter/app/components/Cart.tsx +1 -1
- package/dist/generator-templates/starter/app/components/Footer.tsx +3 -1
- package/dist/generator-templates/starter/app/components/Header.tsx +5 -1
- package/dist/generator-templates/starter/app/components/Layout.tsx +14 -11
- package/dist/generator-templates/starter/app/components/Search.tsx +1 -1
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerAddressMutations.ts +61 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerDetailsQuery.ts +39 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerOrderQuery.ts +87 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerOrdersQuery.ts +58 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerUpdateMutation.ts +24 -0
- package/dist/generator-templates/starter/app/lib/fragments.ts +102 -0
- package/dist/generator-templates/starter/app/lib/session.ts +67 -0
- package/dist/generator-templates/starter/app/root.tsx +11 -45
- package/dist/generator-templates/starter/app/routes/[robots.txt].tsx +0 -27
- package/dist/generator-templates/starter/app/routes/account.$.tsx +8 -4
- package/dist/generator-templates/starter/app/routes/account._index.tsx +5 -0
- package/dist/generator-templates/starter/app/routes/account.addresses.tsx +215 -206
- package/dist/generator-templates/starter/app/routes/account.orders.$id.tsx +56 -163
- package/dist/generator-templates/starter/app/routes/account.orders._index.tsx +32 -109
- package/dist/generator-templates/starter/app/routes/account.profile.tsx +40 -180
- package/dist/generator-templates/starter/app/routes/account.tsx +20 -135
- package/dist/generator-templates/starter/app/routes/account_.authorize.tsx +5 -0
- package/dist/generator-templates/starter/app/routes/account_.login.tsx +3 -140
- package/dist/generator-templates/starter/app/routes/account_.logout.tsx +5 -24
- package/dist/generator-templates/starter/app/routes/cart.tsx +7 -5
- package/dist/generator-templates/starter/app/routes/collections.$handle.tsx +1 -1
- package/dist/generator-templates/starter/app/routes/products.$handle.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/search.tsx +1 -1
- package/dist/generator-templates/starter/customer-accountapi.generated.d.ts +506 -0
- package/dist/generator-templates/starter/package.json +11 -10
- package/dist/generator-templates/starter/remix.config.js +4 -0
- package/dist/generator-templates/starter/remix.env.d.ts +6 -11
- package/dist/generator-templates/starter/server.ts +24 -167
- package/dist/generator-templates/starter/storefrontapi.generated.d.ts +104 -881
- package/dist/hooks/init.js +4 -4
- package/dist/lib/auth.js +5 -10
- package/dist/lib/build.js +6 -1
- package/dist/lib/bundle/analyzer.js +36 -26
- package/dist/lib/check-lockfile.js +1 -0
- package/dist/lib/codegen.js +59 -18
- package/dist/lib/defer.js +12 -0
- package/dist/lib/file.js +52 -3
- package/dist/lib/flags.js +27 -9
- package/dist/lib/get-oxygen-deployment-data.test.js +4 -2
- package/dist/lib/graphql/admin/client.test.js +2 -2
- package/dist/lib/graphql/admin/get-oxygen-data.js +1 -0
- package/dist/lib/log.js +32 -14
- package/dist/lib/mini-oxygen/assets.js +118 -0
- package/dist/lib/mini-oxygen/common.js +2 -1
- package/dist/lib/mini-oxygen/index.js +7 -5
- package/dist/lib/mini-oxygen/mini-oxygen.test.js +214 -0
- package/dist/lib/mini-oxygen/node.js +19 -5
- package/dist/lib/mini-oxygen/workerd-inspector-logs.js +227 -0
- package/dist/lib/mini-oxygen/workerd-inspector-proxy.js +200 -0
- package/dist/lib/mini-oxygen/workerd-inspector.js +62 -235
- package/dist/lib/mini-oxygen/workerd.js +74 -50
- package/dist/lib/missing-routes.js +6 -3
- package/dist/lib/onboarding/common.js +40 -9
- package/dist/lib/onboarding/local.js +19 -11
- package/dist/lib/onboarding/remote.js +48 -28
- package/dist/lib/render-errors.js +2 -0
- package/dist/lib/request-events.js +65 -31
- package/dist/lib/setups/css/assets.js +1 -46
- package/dist/lib/setups/css/css-modules.js +3 -2
- package/dist/lib/setups/css/postcss.js +4 -2
- package/dist/lib/setups/css/tailwind.js +4 -2
- package/dist/lib/setups/css/vanilla-extract.js +3 -2
- package/dist/lib/setups/i18n/replacers.test.js +56 -38
- package/dist/lib/shell.js +1 -1
- package/dist/lib/template-diff.js +89 -0
- package/dist/lib/template-downloader.js +3 -2
- package/dist/lib/transpile/project.js +1 -1
- package/dist/virtual-routes/assets/debug-network.css +592 -0
- package/dist/virtual-routes/assets/favicon-dark.svg +20 -0
- package/dist/virtual-routes/components/FlameChartWrapper.jsx +8 -10
- package/dist/virtual-routes/components/IconClose.jsx +38 -0
- package/dist/virtual-routes/components/IconDiscard.jsx +44 -0
- package/dist/virtual-routes/components/RequestDetails.jsx +179 -0
- package/dist/virtual-routes/components/RequestTable.jsx +92 -0
- package/dist/virtual-routes/components/RequestWaterfall.jsx +151 -0
- package/dist/virtual-routes/lib/useDebugNetworkServer.jsx +176 -0
- package/dist/virtual-routes/routes/subrequest-profiler.jsx +243 -0
- package/oclif.manifest.json +134 -59
- package/package.json +18 -26
- package/dist/generator-templates/starter/app/routes/account_.activate.$id.$activationToken.tsx +0 -161
- package/dist/generator-templates/starter/app/routes/account_.recover.tsx +0 -129
- package/dist/generator-templates/starter/app/routes/account_.register.tsx +0 -207
- package/dist/generator-templates/starter/app/routes/account_.reset.$id.$resetToken.tsx +0 -136
- package/dist/virtual-routes/routes/debug-network.jsx +0 -289
- /package/dist/generator-templates/starter/app/{utils.ts → lib/variants.ts} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import {type ActionFunctionArgs, json, redirect} from '@shopify/remix-oxygen';
|
|
2
|
-
import {Form, useActionData, type MetaFunction} from '@remix-run/react';
|
|
3
|
-
|
|
4
|
-
type ActionResponse = {
|
|
5
|
-
error: string | null;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const meta: MetaFunction = () => {
|
|
9
|
-
return [{title: 'Reset Password'}];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export async function action({request, context, params}: ActionFunctionArgs) {
|
|
13
|
-
if (request.method !== 'POST') {
|
|
14
|
-
return json({error: 'Method not allowed'}, {status: 405});
|
|
15
|
-
}
|
|
16
|
-
const {id, resetToken} = params;
|
|
17
|
-
const {session, storefront} = context;
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
if (!id || !resetToken) {
|
|
21
|
-
throw new Error('customer token or id not found');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const form = await request.formData();
|
|
25
|
-
const password = form.has('password') ? String(form.get('password')) : '';
|
|
26
|
-
const passwordConfirm = form.has('passwordConfirm')
|
|
27
|
-
? String(form.get('passwordConfirm'))
|
|
28
|
-
: '';
|
|
29
|
-
const validInputs = Boolean(password && passwordConfirm);
|
|
30
|
-
if (validInputs && password !== passwordConfirm) {
|
|
31
|
-
throw new Error('Please provide matching passwords');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const {customerReset} = await storefront.mutate(CUSTOMER_RESET_MUTATION, {
|
|
35
|
-
variables: {
|
|
36
|
-
id: `gid://shopify/Customer/${id}`,
|
|
37
|
-
input: {password, resetToken},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (customerReset?.customerUserErrors?.length) {
|
|
42
|
-
throw new Error(customerReset?.customerUserErrors[0].message);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!customerReset?.customerAccessToken) {
|
|
46
|
-
throw new Error('Access token not found. Please try again.');
|
|
47
|
-
}
|
|
48
|
-
session.set('customerAccessToken', customerReset.customerAccessToken);
|
|
49
|
-
|
|
50
|
-
return redirect('/account', {
|
|
51
|
-
headers: {
|
|
52
|
-
'Set-Cookie': await session.commit(),
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
} catch (error: unknown) {
|
|
56
|
-
if (error instanceof Error) {
|
|
57
|
-
return json({error: error.message}, {status: 400});
|
|
58
|
-
}
|
|
59
|
-
return json({error}, {status: 400});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default function Reset() {
|
|
64
|
-
const action = useActionData<ActionResponse>();
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className="account-reset">
|
|
68
|
-
<h1>Reset Password.</h1>
|
|
69
|
-
<p>Enter a new password for your account.</p>
|
|
70
|
-
<Form method="POST">
|
|
71
|
-
<fieldset>
|
|
72
|
-
<label htmlFor="password">Password</label>
|
|
73
|
-
<input
|
|
74
|
-
aria-label="Password"
|
|
75
|
-
autoComplete="current-password"
|
|
76
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
77
|
-
autoFocus
|
|
78
|
-
id="password"
|
|
79
|
-
minLength={8}
|
|
80
|
-
name="password"
|
|
81
|
-
placeholder="Password"
|
|
82
|
-
required
|
|
83
|
-
type="password"
|
|
84
|
-
/>
|
|
85
|
-
<label htmlFor="passwordConfirm">Re-enter password</label>
|
|
86
|
-
<input
|
|
87
|
-
aria-label="Re-enter password"
|
|
88
|
-
autoComplete="current-password"
|
|
89
|
-
id="passwordConfirm"
|
|
90
|
-
minLength={8}
|
|
91
|
-
name="passwordConfirm"
|
|
92
|
-
placeholder="Re-enter password"
|
|
93
|
-
required
|
|
94
|
-
type="password"
|
|
95
|
-
/>
|
|
96
|
-
</fieldset>
|
|
97
|
-
{action?.error ? (
|
|
98
|
-
<p>
|
|
99
|
-
<mark>
|
|
100
|
-
<small>{action.error}</small>
|
|
101
|
-
</mark>
|
|
102
|
-
</p>
|
|
103
|
-
) : (
|
|
104
|
-
<br />
|
|
105
|
-
)}
|
|
106
|
-
<button type="submit">Reset</button>
|
|
107
|
-
</Form>
|
|
108
|
-
<br />
|
|
109
|
-
<p>
|
|
110
|
-
<a href="/account/login">Back to login →</a>
|
|
111
|
-
</p>
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// NOTE: https://shopify.dev/docs/api/storefront/latest/mutations/customerreset
|
|
117
|
-
const CUSTOMER_RESET_MUTATION = `#graphql
|
|
118
|
-
mutation customerReset(
|
|
119
|
-
$id: ID!,
|
|
120
|
-
$input: CustomerResetInput!
|
|
121
|
-
$country: CountryCode
|
|
122
|
-
$language: LanguageCode
|
|
123
|
-
) @inContext(country: $country, language: $language) {
|
|
124
|
-
customerReset(id: $id, input: $input) {
|
|
125
|
-
customerAccessToken {
|
|
126
|
-
accessToken
|
|
127
|
-
expiresAt
|
|
128
|
-
}
|
|
129
|
-
customerUserErrors {
|
|
130
|
-
code
|
|
131
|
-
field
|
|
132
|
-
message
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
` as const;
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { FlameChartWrapper } from "../components/FlameChartWrapper.jsx";
|
|
4
|
-
import { Link } from "@remix-run/react";
|
|
5
|
-
import { Script } from "@shopify/hydrogen";
|
|
6
|
-
function DebugNetwork() {
|
|
7
|
-
const serverEvents = useRef({
|
|
8
|
-
smallestStartTime: 0,
|
|
9
|
-
mainRequests: [],
|
|
10
|
-
subRequests: {},
|
|
11
|
-
showPutRequests: false
|
|
12
|
-
});
|
|
13
|
-
const [timestamp, setTimestamp] = useState();
|
|
14
|
-
function serverEventHandler(onEvent) {
|
|
15
|
-
return (event) => {
|
|
16
|
-
const data = JSON.parse(event.data);
|
|
17
|
-
if (serverEvents.current.smallestStartTime === 0) {
|
|
18
|
-
serverEvents.current.smallestStartTime = data.startTime;
|
|
19
|
-
} else {
|
|
20
|
-
serverEvents.current.smallestStartTime = Math.min(
|
|
21
|
-
data.startTime,
|
|
22
|
-
serverEvents.current.smallestStartTime
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
onEvent(data);
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
setTimestamp((/* @__PURE__ */ new Date()).getTime());
|
|
28
|
-
}, 0);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const evtSource = new EventSource("/debug-network-server", {
|
|
33
|
-
withCredentials: true
|
|
34
|
-
});
|
|
35
|
-
const mainRequestHandler = serverEventHandler((data) => {
|
|
36
|
-
serverEvents.current.mainRequests = [
|
|
37
|
-
...serverEvents.current.mainRequests,
|
|
38
|
-
{
|
|
39
|
-
...data,
|
|
40
|
-
url: data.url.replace(location.origin, "")
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
});
|
|
44
|
-
evtSource.addEventListener("Request", mainRequestHandler);
|
|
45
|
-
const subRequestHandler = serverEventHandler((data) => {
|
|
46
|
-
let groupEvents = serverEvents.current.subRequests[data.id] || [];
|
|
47
|
-
groupEvents = [...groupEvents, data];
|
|
48
|
-
serverEvents.current.subRequests = {
|
|
49
|
-
...serverEvents.current.subRequests,
|
|
50
|
-
[data.id]: groupEvents
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
evtSource.addEventListener("Sub request", subRequestHandler);
|
|
54
|
-
return () => {
|
|
55
|
-
evtSource.removeEventListener("Request", mainRequestHandler);
|
|
56
|
-
evtSource.removeEventListener("Sub request", subRequestHandler);
|
|
57
|
-
evtSource.close();
|
|
58
|
-
};
|
|
59
|
-
}, []);
|
|
60
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
Script,
|
|
63
|
-
{
|
|
64
|
-
src: "https://unpkg.com/flame-chart-js@2.3.1/dist/index.min.js",
|
|
65
|
-
suppressHydrationWarning: true
|
|
66
|
-
}
|
|
67
|
-
),
|
|
68
|
-
/* @__PURE__ */ jsxs(
|
|
69
|
-
"div",
|
|
70
|
-
{
|
|
71
|
-
style: {
|
|
72
|
-
width: "100vw",
|
|
73
|
-
backgroundColor: "#F5F5F5",
|
|
74
|
-
fontSize: "0.8rem"
|
|
75
|
-
},
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ jsxs(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
style: {
|
|
81
|
-
display: "flex",
|
|
82
|
-
justifyContent: "space-between"
|
|
83
|
-
},
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ jsxs(
|
|
86
|
-
"div",
|
|
87
|
-
{
|
|
88
|
-
style: {
|
|
89
|
-
display: "flex",
|
|
90
|
-
alignItems: "center"
|
|
91
|
-
},
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
"button",
|
|
95
|
-
{
|
|
96
|
-
onClick: () => {
|
|
97
|
-
fetch("/debug-network-server", { method: "DELETE" }).catch(
|
|
98
|
-
(error) => console.error("Could not clear history:", error)
|
|
99
|
-
);
|
|
100
|
-
serverEvents.current = {
|
|
101
|
-
smallestStartTime: 0,
|
|
102
|
-
mainRequests: [],
|
|
103
|
-
subRequests: {},
|
|
104
|
-
showPutRequests: serverEvents.current.showPutRequests
|
|
105
|
-
};
|
|
106
|
-
setTimestamp((/* @__PURE__ */ new Date()).getTime());
|
|
107
|
-
},
|
|
108
|
-
children: "Clear"
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ jsx(
|
|
112
|
-
"input",
|
|
113
|
-
{
|
|
114
|
-
id: "showPutRequests",
|
|
115
|
-
type: "checkbox",
|
|
116
|
-
checked: serverEvents.current.showPutRequests,
|
|
117
|
-
onChange: (event) => {
|
|
118
|
-
serverEvents.current.showPutRequests = event.target.checked;
|
|
119
|
-
setTimestamp((/* @__PURE__ */ new Date()).getTime());
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ jsx("label", { htmlFor: "showPutRequests", children: "Show cache update requests (PUT)" })
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
/* @__PURE__ */ jsx(
|
|
128
|
-
"p",
|
|
129
|
-
{
|
|
130
|
-
style: {
|
|
131
|
-
paddingRight: "5px"
|
|
132
|
-
},
|
|
133
|
-
children: "Unstable"
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ jsx(FlameChart, { serverEvents: serverEvents.current }, timestamp),
|
|
140
|
-
/* @__PURE__ */ jsxs("p", { style: { color: "#777", fontSize: "0.7rem", paddingLeft: "5px" }, children: [
|
|
141
|
-
"Note: You may need to turn on '",
|
|
142
|
-
/* @__PURE__ */ jsx("b", { children: "Disable Cache" }),
|
|
143
|
-
"' for your navigating window. If you are not seeing any requests, try re-running '",
|
|
144
|
-
/* @__PURE__ */ jsx("b", { children: "npm run dev" }),
|
|
145
|
-
"' in your terminal while leaving this window open."
|
|
146
|
-
] })
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
] });
|
|
151
|
-
}
|
|
152
|
-
const PANEL_HEIGHT = 300;
|
|
153
|
-
function FlameChart({ serverEvents }) {
|
|
154
|
-
if (serverEvents.mainRequests.length === 0)
|
|
155
|
-
return /* @__PURE__ */ jsx(
|
|
156
|
-
"div",
|
|
157
|
-
{
|
|
158
|
-
style: {
|
|
159
|
-
height: `${PANEL_HEIGHT}px`,
|
|
160
|
-
display: "flex",
|
|
161
|
-
justifyContent: "center",
|
|
162
|
-
alignItems: "center",
|
|
163
|
-
backgroundColor: "#FAFAFA"
|
|
164
|
-
},
|
|
165
|
-
children: /* @__PURE__ */ jsxs("p", { style: { fontWeight: "bold", color: "#777" }, children: [
|
|
166
|
-
"Navigate your",
|
|
167
|
-
" ",
|
|
168
|
-
/* @__PURE__ */ jsx(Link, { to: "/", target: "_blank", children: "app" })
|
|
169
|
-
] })
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
let totalRequests = 0;
|
|
173
|
-
let totalSubRequests = 0;
|
|
174
|
-
const calcDuration = (time) => time - serverEvents.smallestStartTime;
|
|
175
|
-
let items = [];
|
|
176
|
-
serverEvents.mainRequests.forEach((mainRequest) => {
|
|
177
|
-
const mainResponseStart = calcDuration(mainRequest.endTime);
|
|
178
|
-
let mainResponseEnd = mainResponseStart;
|
|
179
|
-
const subRequestItems = [];
|
|
180
|
-
const subRequests = serverEvents.subRequests[mainRequest.id] || [];
|
|
181
|
-
subRequests.forEach((subRequest) => {
|
|
182
|
-
const subRequestEnd = calcDuration(subRequest.endTime);
|
|
183
|
-
if (subRequest.cacheStatus !== "PUT") {
|
|
184
|
-
mainResponseEnd = Math.max(mainResponseEnd, subRequestEnd);
|
|
185
|
-
}
|
|
186
|
-
const subRequestItem = {
|
|
187
|
-
name: `${subRequest.cacheStatus} ${subRequest.url}`.trim(),
|
|
188
|
-
intervals: "request",
|
|
189
|
-
timing: {
|
|
190
|
-
requestStart: calcDuration(subRequest.startTime),
|
|
191
|
-
requestEnd: subRequestEnd
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
if (serverEvents.showPutRequests) {
|
|
195
|
-
subRequestItems.push(subRequestItem);
|
|
196
|
-
} else {
|
|
197
|
-
subRequest.cacheStatus !== "PUT" && subRequestItems.push(subRequestItem);
|
|
198
|
-
}
|
|
199
|
-
totalSubRequests++;
|
|
200
|
-
});
|
|
201
|
-
totalRequests++;
|
|
202
|
-
items.push({
|
|
203
|
-
name: mainRequest.url,
|
|
204
|
-
intervals: "mainRequest",
|
|
205
|
-
timing: {
|
|
206
|
-
requestStart: calcDuration(mainRequest.startTime),
|
|
207
|
-
responseStart: mainResponseStart,
|
|
208
|
-
responseEnd: mainResponseEnd
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
items = items.concat(subRequestItems);
|
|
212
|
-
});
|
|
213
|
-
const data = {
|
|
214
|
-
items,
|
|
215
|
-
intervals: {
|
|
216
|
-
mainRequest: [
|
|
217
|
-
{
|
|
218
|
-
name: "server",
|
|
219
|
-
color: "#99CC00",
|
|
220
|
-
type: "block",
|
|
221
|
-
start: "requestStart",
|
|
222
|
-
end: "responseStart"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "streaming",
|
|
226
|
-
color: "#33CCFF",
|
|
227
|
-
type: "block",
|
|
228
|
-
start: "responseStart",
|
|
229
|
-
end: "responseEnd"
|
|
230
|
-
}
|
|
231
|
-
],
|
|
232
|
-
request: [
|
|
233
|
-
{
|
|
234
|
-
name: "request",
|
|
235
|
-
color: "#FFCC00",
|
|
236
|
-
type: "block",
|
|
237
|
-
start: "requestStart",
|
|
238
|
-
end: "requestEnd"
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
244
|
-
/* @__PURE__ */ jsx(
|
|
245
|
-
FlameChartWrapper,
|
|
246
|
-
{
|
|
247
|
-
height: PANEL_HEIGHT,
|
|
248
|
-
waterfall: data,
|
|
249
|
-
settings: {
|
|
250
|
-
styles: {
|
|
251
|
-
waterfallPlugin: {
|
|
252
|
-
defaultHeight: PANEL_HEIGHT
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
/* @__PURE__ */ jsxs(
|
|
259
|
-
"div",
|
|
260
|
-
{
|
|
261
|
-
style: {
|
|
262
|
-
display: "flex",
|
|
263
|
-
padding: "5px",
|
|
264
|
-
borderTop: "1px solid #CCC",
|
|
265
|
-
borderBottom: "1px solid #CCC"
|
|
266
|
-
},
|
|
267
|
-
children: [
|
|
268
|
-
totalRequests,
|
|
269
|
-
" requests",
|
|
270
|
-
/* @__PURE__ */ jsx(
|
|
271
|
-
"span",
|
|
272
|
-
{
|
|
273
|
-
style: {
|
|
274
|
-
paddingLeft: "2px",
|
|
275
|
-
paddingRight: "2px"
|
|
276
|
-
},
|
|
277
|
-
children: "|"
|
|
278
|
-
}
|
|
279
|
-
),
|
|
280
|
-
totalSubRequests,
|
|
281
|
-
" sub requests"
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
] });
|
|
286
|
-
}
|
|
287
|
-
export {
|
|
288
|
-
DebugNetwork as default
|
|
289
|
-
};
|
|
File without changes
|