@shopify/cli-kit 3.84.2 → 3.85.1
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/README.md +1 -1
- package/dist/private/node/analytics/bounded-collections.js.map +1 -0
- package/dist/{public/node/themes → private/node}/analytics/error-categorizer.d.ts +7 -1
- package/dist/private/node/analytics/error-categorizer.js +106 -0
- package/dist/private/node/analytics/error-categorizer.js.map +1 -0
- package/dist/{public/node/themes → private/node}/analytics/storage.js +8 -3
- package/dist/private/node/analytics/storage.js.map +1 -0
- package/dist/private/node/api/graphql/business-platform-destinations/user-email.d.ts +6 -0
- package/dist/private/node/api/graphql/business-platform-destinations/user-email.js +8 -0
- package/dist/private/node/api/graphql/business-platform-destinations/user-email.js.map +1 -0
- package/dist/private/node/api/headers.d.ts +3 -6
- package/dist/private/node/api/headers.js +8 -24
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/conf-store.d.ts +20 -3
- package/dist/private/node/conf-store.js +32 -7
- package/dist/private/node/conf-store.js.map +1 -1
- package/dist/private/node/constants.d.ts +0 -1
- package/dist/private/node/constants.js +0 -1
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/context/service.d.ts +8 -2
- package/dist/private/node/context/service.js +9 -5
- package/dist/private/node/context/service.js.map +1 -1
- package/dist/private/node/otel-metrics.js +2 -3
- package/dist/private/node/otel-metrics.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +796 -41
- package/dist/private/node/session/schema.js +24 -25
- package/dist/private/node/session/schema.js.map +1 -1
- package/dist/private/node/session/store.d.ts +21 -11
- package/dist/private/node/session/store.js +52 -18
- package/dist/private/node/session/store.js.map +1 -1
- package/dist/private/node/session/validate.d.ts +2 -7
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/session.d.ts +8 -6
- package/dist/private/node/session.js +99 -71
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.d.ts +8 -0
- package/dist/private/node/ui/components/LoadingBar.js +21 -0
- package/dist/private/node/ui/components/LoadingBar.js.map +1 -0
- package/dist/private/node/ui/components/LoadingBar.test.d.ts +1 -0
- package/dist/private/node/ui/components/LoadingBar.test.js +182 -0
- package/dist/private/node/ui/components/LoadingBar.test.js.map +1 -0
- package/dist/private/node/ui/components/SingleTask.d.ts +8 -0
- package/dist/private/node/ui/components/SingleTask.js +27 -0
- package/dist/private/node/ui/components/SingleTask.js.map +1 -0
- package/dist/private/node/ui/components/SingleTask.test.d.ts +1 -0
- package/dist/private/node/ui/components/SingleTask.test.js +145 -0
- package/dist/private/node/ui/components/SingleTask.test.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.d.ts +2 -1
- package/dist/private/node/ui/components/Tasks.js +5 -25
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +19 -103
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/hooks/use-exit-on-ctrl-c.d.ts +4 -0
- package/dist/private/node/ui/hooks/use-exit-on-ctrl-c.js +15 -0
- package/dist/private/node/ui/hooks/use-exit-on-ctrl-c.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.d.ts +77 -0
- package/dist/public/node/analytics.js +88 -0
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.js +2 -3
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/app-dev.d.ts +2 -0
- package/dist/public/node/api/app-dev.js +1 -0
- package/dist/public/node/api/app-dev.js.map +1 -1
- package/dist/public/node/base-command.d.ts +22 -0
- package/dist/public/node/base-command.js +1 -1
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/context/fqdn.d.ts +0 -4
- package/dist/public/node/context/fqdn.js +1 -23
- package/dist/public/node/context/fqdn.js.map +1 -1
- package/dist/public/node/context/local.d.ts +2 -2
- package/dist/public/node/context/local.js +2 -6
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/error-handler.js +2 -1
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/http.d.ts +1 -1
- package/dist/public/node/http.js +1 -1
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/metadata.d.ts +31 -4
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/session-prompt.d.ts +10 -0
- package/dist/public/node/session-prompt.js +86 -0
- package/dist/public/node/session-prompt.js.map +1 -0
- package/dist/public/node/session.d.ts +11 -6
- package/dist/public/node/session.js +15 -4
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/themes/api.js +28 -8
- package/dist/public/node/themes/api.js.map +1 -1
- package/dist/public/node/ui.d.ts +17 -1
- package/dist/public/node/ui.js +26 -2
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vendor/dev_server/dev-server.js +1 -5
- package/dist/public/node/vendor/dev_server/dev-server.js.map +1 -1
- package/dist/public/node/vendor/dev_server/env.js +2 -2
- package/dist/public/node/vendor/dev_server/env.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/private/node/context/spin-cache.d.ts +0 -2
- package/dist/private/node/context/spin-cache.js +0 -8
- package/dist/private/node/context/spin-cache.js.map +0 -1
- package/dist/public/node/context/spin.d.ts +0 -69
- package/dist/public/node/context/spin.js +0 -152
- package/dist/public/node/context/spin.js.map +0 -1
- package/dist/public/node/themes/analytics/bounded-collections.js.map +0 -1
- package/dist/public/node/themes/analytics/error-categorizer.js +0 -49
- package/dist/public/node/themes/analytics/error-categorizer.js.map +0 -1
- package/dist/public/node/themes/analytics/storage.js.map +0 -1
- package/dist/public/node/themes/analytics.d.ts +0 -60
- package/dist/public/node/themes/analytics.js +0 -71
- package/dist/public/node/themes/analytics.js.map +0 -1
- package/dist/public/node/vendor/dev_server/dev-server-spin.d.ts +0 -5
- package/dist/public/node/vendor/dev_server/dev-server-spin.js +0 -28
- package/dist/public/node/vendor/dev_server/dev-server-spin.js.map +0 -1
- /package/dist/{public/node/themes → private/node}/analytics/bounded-collections.d.ts +0 -0
- /package/dist/{public/node/themes → private/node}/analytics/bounded-collections.js +0 -0
- /package/dist/{public/node/themes → private/node}/analytics/storage.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/cli-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.85.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A set of utilities, interfaces, and models that are common across all the platform features",
|
|
6
6
|
"keywords": [
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@bugsnag/js": "7.25.0",
|
|
91
91
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
92
92
|
"@iarna/toml": "2.2.5",
|
|
93
|
-
"@oclif/core": "4.
|
|
93
|
+
"@oclif/core": "4.5.3",
|
|
94
94
|
"@opentelemetry/api": "1.9.0",
|
|
95
95
|
"@opentelemetry/core": "1.30.0",
|
|
96
96
|
"@opentelemetry/exporter-metrics-otlp-http": "0.57.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spin-cache.js","sourceRoot":"","sources":["../../../../src/private/node/context/spin-cache.ts"],"names":[],"mappings":"AAAA,IAAI,cAAsB,CAAA;AAE1B,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,cAAc,GAAG,IAAI,CAAA;AACvB,CAAC","sourcesContent":["let cachedSpinFQDN: string\n\nexport function getCachedSpinFqdn(): string | undefined {\n return cachedSpinFQDN\n}\n\nexport function setCachedSpinFqdn(fqdn: string) {\n cachedSpinFQDN = fqdn\n}\n"]}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* When ran in a Spin environment, it returns the fqdn of the instance.
|
|
3
|
-
*
|
|
4
|
-
* Will cache the value of the Spin FQDN during the execution of the CLI.
|
|
5
|
-
* To avoid multiple calls to `readSync` or `show`.
|
|
6
|
-
*
|
|
7
|
-
* @param env - Environment variables.
|
|
8
|
-
* @returns Fqdn of the Spin environment.
|
|
9
|
-
*/
|
|
10
|
-
export declare function spinFqdn(env?: NodeJS.ProcessEnv): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Runs "spin show" and returns the JSON-parsed output.
|
|
13
|
-
*
|
|
14
|
-
* @param spinInstance - When it's undefined, we'll fetch the latest one.
|
|
15
|
-
* @param env - Environment variables.
|
|
16
|
-
* @returns The JSON-parsed output of the Spin CLI.
|
|
17
|
-
* @throws Any error raised from the underlying Spin CLI.
|
|
18
|
-
*/
|
|
19
|
-
export declare function show(spinInstance: string | undefined, env?: NodeJS.ProcessEnv): Promise<{
|
|
20
|
-
fqdn: string;
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* Returns true if the CLI is running in a Spin environment.
|
|
24
|
-
*
|
|
25
|
-
* @param env - Environment variables.
|
|
26
|
-
* @returns True if the CLI is running in a Spin environment.
|
|
27
|
-
*/
|
|
28
|
-
export declare function isSpin(env?: NodeJS.ProcessEnv): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the value of the SPIN_INSTANCE environment variable.
|
|
31
|
-
*
|
|
32
|
-
* @param env - Environment variables.
|
|
33
|
-
* @returns The value of the SPIN_INSTANCE environment variable.
|
|
34
|
-
*/
|
|
35
|
-
export declare function instance(env?: NodeJS.ProcessEnv): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Returns true if the CLI is running in a Spin environment.
|
|
38
|
-
*
|
|
39
|
-
* @param env - Environment variables.
|
|
40
|
-
* @returns True if the CLI is running in a Spin environment.
|
|
41
|
-
*/
|
|
42
|
-
export declare function isSpinEnvironment(env?: NodeJS.ProcessEnv): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the value of the SERVER_PORT environment variable.
|
|
45
|
-
*
|
|
46
|
-
* @param env - Environment variables.
|
|
47
|
-
* @returns The value of the SERVER_PORT environment variable.
|
|
48
|
-
*/
|
|
49
|
-
export declare function appPort(env?: NodeJS.ProcessEnv): number | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the value of the SPIN_APP_HOST environment variable.
|
|
52
|
-
*
|
|
53
|
-
* @param env - Environment variables.
|
|
54
|
-
* @returns The value of the SPIN_APP_HOST environment variable.
|
|
55
|
-
*/
|
|
56
|
-
export declare function appHost(env?: NodeJS.ProcessEnv): string | undefined;
|
|
57
|
-
export declare const spinVariables: {
|
|
58
|
-
partnersSpinService: string;
|
|
59
|
-
manualCliSpinPortName: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Fetches the port for a given spin service and port environment variable.
|
|
63
|
-
*
|
|
64
|
-
* @param service - The name of the spin service to fetch the port for.
|
|
65
|
-
* @param portEnvName - The name of the environment variable to fetch the port from.
|
|
66
|
-
* @param basePath - The base path to look for the port file.
|
|
67
|
-
* @returns The port number or undefined if the port could not be found.
|
|
68
|
-
*/
|
|
69
|
-
export declare function fetchSpinPort(service: string, portEnvName: string, basePath?: string): Promise<number | undefined>;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { isTruthy } from './utilities.js';
|
|
2
|
-
import { fileExists, readFile, readFileSync } from '../fs.js';
|
|
3
|
-
import { environmentVariables } from '../../../private/node/constants.js';
|
|
4
|
-
import { captureOutput } from '../system.js';
|
|
5
|
-
import { outputContent, outputToken } from '../output.js';
|
|
6
|
-
import { getCachedSpinFqdn, setCachedSpinFqdn } from '../../../private/node/context/spin-cache.js';
|
|
7
|
-
import { AbortError } from '../error.js';
|
|
8
|
-
import { Environment, serviceEnvironment } from '../../../private/node/context/service.js';
|
|
9
|
-
import { joinPath } from '../path.js';
|
|
10
|
-
const SpinInstanceNotFoundMessages = (spinInstance, error) => {
|
|
11
|
-
const errorMessage = outputContent `${outputToken.genericShellCommand(`spin`)} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:
|
|
12
|
-
${error}
|
|
13
|
-
`;
|
|
14
|
-
let nextSteps;
|
|
15
|
-
if (spinInstance) {
|
|
16
|
-
nextSteps = `Make sure ${spinInstance} is the instance name and not a fully qualified domain name`;
|
|
17
|
-
}
|
|
18
|
-
return { errorMessage, nextSteps };
|
|
19
|
-
};
|
|
20
|
-
const spinFqdnFilePath = '/etc/spin/machine/fqdn';
|
|
21
|
-
/**
|
|
22
|
-
* When ran in a Spin environment, it returns the fqdn of the instance.
|
|
23
|
-
*
|
|
24
|
-
* Will cache the value of the Spin FQDN during the execution of the CLI.
|
|
25
|
-
* To avoid multiple calls to `readSync` or `show`.
|
|
26
|
-
*
|
|
27
|
-
* @param env - Environment variables.
|
|
28
|
-
* @returns Fqdn of the Spin environment.
|
|
29
|
-
*/
|
|
30
|
-
export async function spinFqdn(env = process.env) {
|
|
31
|
-
let spinFqdn = getCachedSpinFqdn();
|
|
32
|
-
if (spinFqdn)
|
|
33
|
-
return spinFqdn;
|
|
34
|
-
if (await fileExists(spinFqdnFilePath)) {
|
|
35
|
-
spinFqdn = await readFileSync(spinFqdnFilePath).toString();
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
const spinInstance = await instance(env);
|
|
39
|
-
const showResponse = await show(spinInstance, env);
|
|
40
|
-
spinFqdn = showResponse.fqdn;
|
|
41
|
-
}
|
|
42
|
-
setCachedSpinFqdn(spinFqdn);
|
|
43
|
-
return spinFqdn;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Runs "spin show" and returns the JSON-parsed output.
|
|
47
|
-
*
|
|
48
|
-
* @param spinInstance - When it's undefined, we'll fetch the latest one.
|
|
49
|
-
* @param env - Environment variables.
|
|
50
|
-
* @returns The JSON-parsed output of the Spin CLI.
|
|
51
|
-
* @throws Any error raised from the underlying Spin CLI.
|
|
52
|
-
*/
|
|
53
|
-
export async function show(spinInstance, env = process.env) {
|
|
54
|
-
const latest = spinInstance === undefined;
|
|
55
|
-
const args = latest ? ['show', '--latest', '--json'] : ['show', '--json'];
|
|
56
|
-
const output = await captureOutput('spin', args, { env });
|
|
57
|
-
const json = JSON.parse(output);
|
|
58
|
-
if (json.error) {
|
|
59
|
-
const { errorMessage, nextSteps } = SpinInstanceNotFoundMessages(spinInstance, json.error);
|
|
60
|
-
throw new AbortError(errorMessage, nextSteps);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return json;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Returns true if the CLI is running in a Spin environment.
|
|
68
|
-
*
|
|
69
|
-
* @param env - Environment variables.
|
|
70
|
-
* @returns True if the CLI is running in a Spin environment.
|
|
71
|
-
*/
|
|
72
|
-
export function isSpin(env = process.env) {
|
|
73
|
-
return isTruthy(env[environmentVariables.spin]);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Returns the value of the SPIN_INSTANCE environment variable.
|
|
77
|
-
*
|
|
78
|
-
* @param env - Environment variables.
|
|
79
|
-
* @returns The value of the SPIN_INSTANCE environment variable.
|
|
80
|
-
*/
|
|
81
|
-
export function instance(env = process.env) {
|
|
82
|
-
return env[environmentVariables.spinInstance];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns true if the CLI is running in a Spin environment.
|
|
86
|
-
*
|
|
87
|
-
* @param env - Environment variables.
|
|
88
|
-
* @returns True if the CLI is running in a Spin environment.
|
|
89
|
-
*/
|
|
90
|
-
export function isSpinEnvironment(env = process.env) {
|
|
91
|
-
return serviceEnvironment(env) === Environment.Spin;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Returns the value of the SERVER_PORT environment variable.
|
|
95
|
-
*
|
|
96
|
-
* @param env - Environment variables.
|
|
97
|
-
* @returns The value of the SERVER_PORT environment variable.
|
|
98
|
-
*/
|
|
99
|
-
export function appPort(env = process.env) {
|
|
100
|
-
const port = Number(env[environmentVariables.spinAppPort]);
|
|
101
|
-
return (!isNaN(port) && port) || undefined;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns the value of the SPIN_APP_HOST environment variable.
|
|
105
|
-
*
|
|
106
|
-
* @param env - Environment variables.
|
|
107
|
-
* @returns The value of the SPIN_APP_HOST environment variable.
|
|
108
|
-
*/
|
|
109
|
-
export function appHost(env = process.env) {
|
|
110
|
-
return env[environmentVariables.spinAppHost];
|
|
111
|
-
}
|
|
112
|
-
export const spinVariables = {
|
|
113
|
-
partnersSpinService: 'shopify--partners',
|
|
114
|
-
manualCliSpinPortName: 'CLI_EXTENSION_SERVER',
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Fetches the port for a given spin service and port environment variable.
|
|
118
|
-
*
|
|
119
|
-
* @param service - The name of the spin service to fetch the port for.
|
|
120
|
-
* @param portEnvName - The name of the environment variable to fetch the port from.
|
|
121
|
-
* @param basePath - The base path to look for the port file.
|
|
122
|
-
* @returns The port number or undefined if the port could not be found.
|
|
123
|
-
*/
|
|
124
|
-
export async function fetchSpinPort(service, portEnvName, basePath = '/run') {
|
|
125
|
-
const spinVersionConfigurations = [
|
|
126
|
-
{
|
|
127
|
-
path: joinPath(basePath, 'ports2', service, 'custom', portEnvName),
|
|
128
|
-
contentPattern: /\[{"internal":(\d+)}\]/,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
path: joinPath(basePath, 'ports', service, 'proc', portEnvName),
|
|
132
|
-
contentPattern: /(\d+)/,
|
|
133
|
-
},
|
|
134
|
-
];
|
|
135
|
-
for (const config of spinVersionConfigurations) {
|
|
136
|
-
let fileContent;
|
|
137
|
-
try {
|
|
138
|
-
// eslint-disable-next-line no-await-in-loop
|
|
139
|
-
fileContent = await readFile(config.path);
|
|
140
|
-
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
const match = config.contentPattern.exec(fileContent);
|
|
146
|
-
if (match?.[1] && !isNaN(parseInt(match[1], 10))) {
|
|
147
|
-
return parseInt(match[1], 10);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=spin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spin.js","sourceRoot":"","sources":["../../../../src/public/node/context/spin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,cAAc,CAAA;AACvD,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,6CAA6C,CAAA;AAChG,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,0CAA0C,CAAA;AACxF,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAEnC,MAAM,4BAA4B,GAAG,CAAC,YAAgC,EAAE,KAAa,EAAE,EAAE;IACvF,MAAM,YAAY,GAAG,aAAa,CAAA,GAAG,WAAW,CAAC,mBAAmB,CAClE,MAAM,CACP;EACD,KAAK;GACJ,CAAA;IACD,IAAI,SAA6B,CAAA;IACjC,IAAI,YAAY,EAAE,CAAC;QACjB,SAAS,GAAG,aAAa,YAAY,6DAA6D,CAAA;IACpG,CAAC;IACD,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,wBAAwB,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAA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OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC;YAClE,cAAc,EAAE,wBAAwB;SACzC;QACD;YACE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC;YAC/D,cAAc,EAAE,OAAO;SACxB;KACF,CAAA;IACD,KAAK,MAAM,MAAM,IAAI,yBAAyB,EAAE,CAAC;QAC/C,IAAI,WAAmB,CAAA;QAEvB,IAAI,CAAC;YACH,4CAA4C;YAC5C,WAAW,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACzC,qDAAqD;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAQ;QACV,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACrD,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;YACjD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["import {isTruthy} from './utilities.js'\nimport {fileExists, readFile, readFileSync} from '../fs.js'\nimport {environmentVariables} from '../../../private/node/constants.js'\nimport {captureOutput} from '../system.js'\nimport {outputContent, outputToken} from '../output.js'\nimport {getCachedSpinFqdn, setCachedSpinFqdn} from '../../../private/node/context/spin-cache.js'\nimport {AbortError} from '../error.js'\nimport {Environment, serviceEnvironment} from '../../../private/node/context/service.js'\nimport {joinPath} from '../path.js'\n\nconst SpinInstanceNotFoundMessages = (spinInstance: string | undefined, error: string) => {\n const errorMessage = outputContent`${outputToken.genericShellCommand(\n `spin`,\n )} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:\n${error}\n `\n let nextSteps: string | undefined\n if (spinInstance) {\n nextSteps = `Make sure ${spinInstance} is the instance name and not a fully qualified domain name`\n }\n return {errorMessage, nextSteps}\n}\n\nconst spinFqdnFilePath = '/etc/spin/machine/fqdn'\n\n/**\n * When ran in a Spin environment, it returns the fqdn of the instance.\n *\n * Will cache the value of the Spin FQDN during the execution of the CLI.\n * To avoid multiple calls to `readSync` or `show`.\n *\n * @param env - Environment variables.\n * @returns Fqdn of the Spin environment.\n */\nexport async function spinFqdn(env = process.env): Promise<string> {\n let spinFqdn = getCachedSpinFqdn()\n if (spinFqdn) return spinFqdn\n\n if (await fileExists(spinFqdnFilePath)) {\n spinFqdn = await readFileSync(spinFqdnFilePath).toString()\n } else {\n const spinInstance = await instance(env)\n const showResponse = await show(spinInstance, env)\n\n spinFqdn = showResponse.fqdn\n }\n setCachedSpinFqdn(spinFqdn)\n return spinFqdn\n}\n\n/**\n * Runs \"spin show\" and returns the JSON-parsed output.\n *\n * @param spinInstance - When it's undefined, we'll fetch the latest one.\n * @param env - Environment variables.\n * @returns The JSON-parsed output of the Spin CLI.\n * @throws Any error raised from the underlying Spin CLI.\n */\nexport async function show(spinInstance: string | undefined, env = process.env): Promise<{fqdn: string}> {\n const latest = spinInstance === undefined\n const args = latest ? ['show', '--latest', '--json'] : ['show', '--json']\n const output = await captureOutput('spin', args, {env})\n const json = JSON.parse(output)\n if (json.error) {\n const {errorMessage, nextSteps} = SpinInstanceNotFoundMessages(spinInstance, json.error)\n throw new AbortError(errorMessage, nextSteps)\n } else {\n return json\n }\n}\n\n/**\n * Returns true if the CLI is running in a Spin environment.\n *\n * @param env - Environment variables.\n * @returns True if the CLI is running in a Spin environment.\n */\nexport function isSpin(env = process.env): boolean {\n return isTruthy(env[environmentVariables.spin])\n}\n\n/**\n * Returns the value of the SPIN_INSTANCE environment variable.\n *\n * @param env - Environment variables.\n * @returns The value of the SPIN_INSTANCE environment variable.\n */\nexport function instance(env = process.env): string | undefined {\n return env[environmentVariables.spinInstance]\n}\n\n/**\n * Returns true if the CLI is running in a Spin environment.\n *\n * @param env - Environment variables.\n * @returns True if the CLI is running in a Spin environment.\n */\nexport function isSpinEnvironment(env = process.env): boolean {\n return serviceEnvironment(env) === Environment.Spin\n}\n\n/**\n * Returns the value of the SERVER_PORT environment variable.\n *\n * @param env - Environment variables.\n * @returns The value of the SERVER_PORT environment variable.\n */\nexport function appPort(env = process.env): number | undefined {\n const port = Number(env[environmentVariables.spinAppPort])\n return (!isNaN(port) && port) || undefined\n}\n\n/**\n * Returns the value of the SPIN_APP_HOST environment variable.\n *\n * @param env - Environment variables.\n * @returns The value of the SPIN_APP_HOST environment variable.\n */\nexport function appHost(env = process.env): string | undefined {\n return env[environmentVariables.spinAppHost]\n}\n\nexport const spinVariables = {\n partnersSpinService: 'shopify--partners',\n manualCliSpinPortName: 'CLI_EXTENSION_SERVER',\n}\n/**\n * Fetches the port for a given spin service and port environment variable.\n *\n * @param service - The name of the spin service to fetch the port for.\n * @param portEnvName - The name of the environment variable to fetch the port from.\n * @param basePath - The base path to look for the port file.\n * @returns The port number or undefined if the port could not be found.\n */\nexport async function fetchSpinPort(\n service: string,\n portEnvName: string,\n basePath = '/run',\n): Promise<number | undefined> {\n const spinVersionConfigurations = [\n {\n path: joinPath(basePath, 'ports2', service, 'custom', portEnvName),\n contentPattern: /\\[{\"internal\":(\\d+)}\\]/,\n },\n {\n path: joinPath(basePath, 'ports', service, 'proc', portEnvName),\n contentPattern: /(\\d+)/,\n },\n ]\n for (const config of spinVersionConfigurations) {\n let fileContent: string\n\n try {\n // eslint-disable-next-line no-await-in-loop\n fileContent = await readFile(config.path)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n continue\n }\n\n const match = config.contentPattern.exec(fileContent)\n if (match?.[1] && !isNaN(parseInt(match[1], 10))) {\n return parseInt(match[1], 10)\n }\n }\n\n return undefined\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-collections.js","source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IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;QACxB,KAAK,CAAC,KAAK,EAAE,CAAA;IACf,CAAC;IAED,QAAQ;QACN,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAEO,YAAY;QAClB,OAAO,IAAI,CAAC,IAAI,GAAG,YAAY,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClE,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;YAC7C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5B,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YACzB,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * Ensures bounded arrays stay within reasonable memory limits.\n */\nconst MAX_ARRAY_SIZE = 1000\n\n/**\n * Estimated ~500KB total across timing, error, retry, and event entries.\n */\nconst MAX_MAP_KEYS = 1000\n\n/**\n * A bounded array that automatically maintains a maximum size by removing\n * the oldest entries when new items are added beyond the limit.\n *\n * Extends the native Array class to provide all standard array methods\n * while enforcing a fixed maximum size of MAX_ARRAY_SIZE (1000 entries).\n *\n * When the size limit is exceeded, the oldest entries (at the beginning\n * of the array) are automatically removed to make room for new ones.\n *\n * @example\n * const commands = new BArray()\n * commands.push(entry) // Automatically removes oldest if over 1000\n */\nexport class BArray<T> extends Array<T> {\n push(...items: T[]): number {\n const result = super.push(...items)\n this.enforceLimit()\n return result\n }\n\n clear(): void {\n this.length = 0\n }\n\n toArray(): T[] {\n return [...this]\n }\n\n private enforceLimit(): void {\n while (this.length > MAX_ARRAY_SIZE) {\n this.shift()\n }\n }\n}\n\n/**\n * A bounded map that automatically maintains a maximum number of keys by\n * removing the oldest entries when new keys are added beyond the limit.\n *\n * Extends the native Map class to provide all standard map methods while\n * enforcing a fixed maximum size of MAX_MAP_KEYS (1000 entries).\n *\n * Tracks insertion order to ensure the oldest keys are removed first when\n * the limit is exceeded. This provides LRU-like behavior based on insertion\n * time rather than access time.\n *\n * @example\n * const events = new BMap()\n * events.set('event', 1) // Automatically removes oldest if over 1000\n */\nexport class BMap<TKey, TValue> extends Map<TKey, TValue> {\n private insertionOrder: TKey[] = []\n\n set(key: TKey, value: TValue): this {\n if (!this.has(key)) {\n this.insertionOrder.push(key)\n }\n super.set(key, value)\n this.enforceLimit()\n return this\n }\n\n delete(key: TKey): boolean {\n const index = this.insertionOrder.indexOf(key)\n if (index > -1) {\n this.insertionOrder.splice(index, 1)\n }\n return super.delete(key)\n }\n\n clear(): void {\n this.insertionOrder = []\n super.clear()\n }\n\n toObject(): {[key: string]: TValue} {\n return Object.fromEntries(this)\n }\n\n private enforceLimit(): void {\n while (this.size > MAX_MAP_KEYS && this.insertionOrder.length > 0) {\n const oldestKey = this.insertionOrder.shift()\n if (oldestKey !== undefined) {\n super.delete(oldestKey)\n }\n }\n }\n}\n"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export var ErrorCategory;
|
|
2
|
-
(function (ErrorCategory) {
|
|
3
|
-
ErrorCategory["ThemeCheck"] = "THEME_CHECK";
|
|
4
|
-
ErrorCategory["Network"] = "NETWORK";
|
|
5
|
-
ErrorCategory["FileSystem"] = "FILE_SYSTEM";
|
|
6
|
-
ErrorCategory["Authentication"] = "AUTHENTICATION";
|
|
7
|
-
ErrorCategory["Validation"] = "VALIDATION";
|
|
8
|
-
ErrorCategory["Permission"] = "PERMISSION";
|
|
9
|
-
ErrorCategory["RateLimit"] = "RATE_LIMIT";
|
|
10
|
-
ErrorCategory["Parsing"] = "PARSING";
|
|
11
|
-
ErrorCategory["Unknown"] = "UNKNOWN";
|
|
12
|
-
})(ErrorCategory || (ErrorCategory = {}));
|
|
13
|
-
const ERROR_CATEGORY_TERMS = {
|
|
14
|
-
[ErrorCategory.ThemeCheck]: ['theme check'],
|
|
15
|
-
[ErrorCategory.Authentication]: ['unauthorized', 'forbidden', 'auth', 'token', 'credential'],
|
|
16
|
-
[ErrorCategory.Network]: [
|
|
17
|
-
'eai_again',
|
|
18
|
-
'econn',
|
|
19
|
-
'enetunreach',
|
|
20
|
-
'enotfound',
|
|
21
|
-
'epipe',
|
|
22
|
-
'etimedout',
|
|
23
|
-
'fetch',
|
|
24
|
-
'network',
|
|
25
|
-
'request',
|
|
26
|
-
'socket',
|
|
27
|
-
'the operation was aborted',
|
|
28
|
-
'timed out',
|
|
29
|
-
'timeout',
|
|
30
|
-
],
|
|
31
|
-
[ErrorCategory.FileSystem]: ['enoent', 'eacces', 'file', 'directory', 'path'],
|
|
32
|
-
[ErrorCategory.Permission]: ['permission', 'denied', 'access', 'insufficient'],
|
|
33
|
-
[ErrorCategory.RateLimit]: ['rate limit', 'too many requests', 'throttle'],
|
|
34
|
-
[ErrorCategory.Parsing]: ['parse', 'syntax', 'json', 'invalid'],
|
|
35
|
-
[ErrorCategory.Validation]: ['validation', 'invalid', 'required'],
|
|
36
|
-
};
|
|
37
|
-
export function categorizeError(error) {
|
|
38
|
-
if (!(error instanceof Error))
|
|
39
|
-
return ErrorCategory.Unknown;
|
|
40
|
-
const message = error.message.toLowerCase();
|
|
41
|
-
for (const [category, terms] of Object.entries(ERROR_CATEGORY_TERMS)) {
|
|
42
|
-
const hasTerm = terms.some((term) => message.includes(term));
|
|
43
|
-
if (hasTerm) {
|
|
44
|
-
return category;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return ErrorCategory.Unknown;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=error-categorizer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-categorizer.js","sourceRoot":"","sources":["../../../../../src/public/node/themes/analytics/error-categorizer.ts"],"names":[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KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,aAAa,CAAC,OAAO,CAAA;IAE3D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;IAE3C,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACrE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;QAE5D,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,QAAyB,CAAA;QAClC,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC,OAAO,CAAA;AAC9B,CAAC","sourcesContent":["export enum ErrorCategory {\n ThemeCheck = 'THEME_CHECK',\n Network = 'NETWORK',\n FileSystem = 'FILE_SYSTEM',\n Authentication = 'AUTHENTICATION',\n Validation = 'VALIDATION',\n Permission = 'PERMISSION',\n RateLimit = 'RATE_LIMIT',\n Parsing = 'PARSING',\n Unknown = 'UNKNOWN',\n}\n\nconst ERROR_CATEGORY_TERMS = {\n [ErrorCategory.ThemeCheck]: ['theme check'],\n [ErrorCategory.Authentication]: ['unauthorized', 'forbidden', 'auth', 'token', 'credential'],\n [ErrorCategory.Network]: [\n 'eai_again',\n 'econn',\n 'enetunreach',\n 'enotfound',\n 'epipe',\n 'etimedout',\n 'fetch',\n 'network',\n 'request',\n 'socket',\n 'the operation was aborted',\n 'timed out',\n 'timeout',\n ],\n [ErrorCategory.FileSystem]: ['enoent', 'eacces', 'file', 'directory', 'path'],\n [ErrorCategory.Permission]: ['permission', 'denied', 'access', 'insufficient'],\n [ErrorCategory.RateLimit]: ['rate limit', 'too many requests', 'throttle'],\n [ErrorCategory.Parsing]: ['parse', 'syntax', 'json', 'invalid'],\n [ErrorCategory.Validation]: ['validation', 'invalid', 'required'],\n}\n\nexport function categorizeError(error: unknown): ErrorCategory {\n if (!(error instanceof Error)) return ErrorCategory.Unknown\n\n const message = error.message.toLowerCase()\n\n for (const [category, terms] of Object.entries(ERROR_CATEGORY_TERMS)) {\n const hasTerm = terms.some((term) => message.includes(term))\n\n if (hasTerm) {\n return category as ErrorCategory\n }\n }\n\n return ErrorCategory.Unknown\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../../src/public/node/themes/analytics/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAgB,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,0BAA0B,CAAA;AAgCrD,MAAM,sBAAsB,GAAG;IAC7B,OAAO,EAAE,IAAI,MAAM,EAAe;IAClC,aAAa,EAAE,IAAI,IAAI,EAAkB;IACzC,MAAM,EAAE,IAAI,MAAM,EAAc;IAChC,OAAO,EAAE,IAAI,MAAM,EAAc;IACjC,MAAM,EAAE,IAAI,MAAM,EAAc;CACjC,CAAA;AAED,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAEtB,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QACxD,WAAW,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAA;QACxC,OAAM;IACR,CAAC;IAED,MAAM,SAAS,GAAG,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrE,IAAI,SAAS,KAAK,SAAS;QAAE,OAAM;IAEnC,MAAM,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAA;IAEhC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC;QAClC,KAAK,EAAE,SAAS;QAChB,QAA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EAAE,SAAS;QACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO;QACL,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE;QACjD,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,OAAO,EAAE;QAC/C,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE;QACjD,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,OAAO,EAAE;KAChD,CAAA;AACH,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtC,sBAAsB,CAAC,aAAa,CAAC,KAAK,EAAE,CAAA;IAC5C,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACrC,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtC,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;AACvC,CAAC","sourcesContent":["import {categorizeError, ErrorCategory} from './error-categorizer.js'\nimport {BArray, BMap} from './bounded-collections.js'\n\ninterface TimingEntry {\n event: string\n duration: number\n}\n\ninterface ErrorEntry {\n category: ErrorCategory\n message: string\n timestamp: number\n}\n\ninterface RetryEntry {\n url: string\n operation: string\n attempts: number\n timestamp: number\n}\n\ninterface EventEntry {\n name: string\n timestamp: number\n}\n\nexport interface RuntimeData {\n timings: TimingEntry[]\n errors: ErrorEntry[]\n retries: RetryEntry[]\n events: EventEntry[]\n}\n\nconst _runtimeAnalyticsStore = {\n timings: new BArray<TimingEntry>(),\n activeTimings: new BMap<string, number>(),\n errors: new BArray<ErrorEntry>(),\n retries: new BArray<RetryEntry>(),\n events: new BArray<EventEntry>(),\n}\n\nexport function recordTiming(eventName: string): void {\n const now = Date.now()\n\n if (!_runtimeAnalyticsStore.activeTimings.has(eventName)) {\n _runtimeAnalyticsStore.activeTimings.set(eventName, now)\n recordEvent(`timing:start:${eventName}`)\n return\n }\n\n const startTime = _runtimeAnalyticsStore.activeTimings.get(eventName)\n if (startTime === undefined) return\n\n const duration = now - startTime\n\n _runtimeAnalyticsStore.timings.push({\n event: eventName,\n duration,\n })\n\n _runtimeAnalyticsStore.activeTimings.delete(eventName)\n\n recordEvent(`timing:end:${eventName}`)\n}\n\nexport function recordError(error: unknown): void {\n const category = categorizeError(error)\n const errorEntry: ErrorEntry = {\n category,\n message: error instanceof Error ? error.message : String(error),\n timestamp: Date.now(),\n }\n\n _runtimeAnalyticsStore.errors.push(errorEntry)\n\n recordEvent(`error:${category}:${errorEntry.message.substring(0, 50)}`)\n}\n\nexport function recordRetry(url: string, operation: string): void {\n const existingEntries = _runtimeAnalyticsStore.retries.filter(\n (entry) => entry.url === url && entry.operation === operation,\n )\n const attemptCount = existingEntries.length + 1\n\n _runtimeAnalyticsStore.retries.push({\n url,\n operation,\n attempts: attemptCount,\n timestamp: Date.now(),\n })\n\n recordEvent(`retry:${operation}:attempt:${attemptCount}`)\n}\n\nexport function recordEvent(eventName: string): void {\n _runtimeAnalyticsStore.events.push({\n name: eventName,\n timestamp: Date.now(),\n })\n}\n\nexport function compileData(): RuntimeData {\n return {\n timings: _runtimeAnalyticsStore.timings.toArray(),\n errors: _runtimeAnalyticsStore.errors.toArray(),\n retries: _runtimeAnalyticsStore.retries.toArray(),\n events: _runtimeAnalyticsStore.events.toArray(),\n }\n}\n\nexport function reset(): void {\n _runtimeAnalyticsStore.timings.clear()\n _runtimeAnalyticsStore.activeTimings.clear()\n _runtimeAnalyticsStore.errors.clear()\n _runtimeAnalyticsStore.retries.clear()\n _runtimeAnalyticsStore.events.clear()\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Records timing data for performance monitoring. Call twice with the same
|
|
3
|
-
* event name to start and stop timing. First call starts the timer, second
|
|
4
|
-
* call stops it and records the duration.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* recordTiming('theme-upload') // Start timing
|
|
9
|
-
* // ... do work ...
|
|
10
|
-
* recordTiming('theme-upload') // Stop timing and record duration
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param eventName - Unique identifier for the timing event
|
|
14
|
-
*/
|
|
15
|
-
export declare function recordTiming(eventName: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Records error information for debugging and monitoring. Use this to track
|
|
18
|
-
* any exceptions or error conditions that occur during theme operations.
|
|
19
|
-
* Errors are automatically categorized for easier analysis.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* try {
|
|
24
|
-
* // ... risky operation ...
|
|
25
|
-
* } catch (error) {
|
|
26
|
-
* recordError(error)
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @param error - Error object or message to record
|
|
31
|
-
*/
|
|
32
|
-
export declare function recordError<T>(error: T): T;
|
|
33
|
-
/**
|
|
34
|
-
* Records retry attempts for network operations. Use this to track when
|
|
35
|
-
* operations are retried due to transient failures. Helps identify
|
|
36
|
-
* problematic endpoints or operations that frequently fail.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* recordRetry('https://api.shopify.com/themes', 'upload')
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param url - The URL or endpoint being retried
|
|
44
|
-
* @param operation - Description of the operation being retried
|
|
45
|
-
*/
|
|
46
|
-
export declare function recordRetry(url: string, operation: string): void;
|
|
47
|
-
/**
|
|
48
|
-
* Records custom events for tracking specific user actions or system events.
|
|
49
|
-
* Use this for important milestones, user interactions, or significant
|
|
50
|
-
* state changes in the application.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* recordEvent('theme-dev-started')
|
|
55
|
-
* recordEvent('file-watcher-connected')
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* @param eventName - Descriptive name for the event
|
|
59
|
-
*/
|
|
60
|
-
export declare function recordEvent(eventName: string): void;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { recordTiming as storeRecordTiming, recordError as storeRecordError, recordRetry as storeRecordRetry, recordEvent as storeRecordEvent, } from './analytics/storage.js';
|
|
2
|
-
/**
|
|
3
|
-
* Records timing data for performance monitoring. Call twice with the same
|
|
4
|
-
* event name to start and stop timing. First call starts the timer, second
|
|
5
|
-
* call stops it and records the duration.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* recordTiming('theme-upload') // Start timing
|
|
10
|
-
* // ... do work ...
|
|
11
|
-
* recordTiming('theme-upload') // Stop timing and record duration
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param eventName - Unique identifier for the timing event
|
|
15
|
-
*/
|
|
16
|
-
export function recordTiming(eventName) {
|
|
17
|
-
storeRecordTiming(eventName);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Records error information for debugging and monitoring. Use this to track
|
|
21
|
-
* any exceptions or error conditions that occur during theme operations.
|
|
22
|
-
* Errors are automatically categorized for easier analysis.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* try {
|
|
27
|
-
* // ... risky operation ...
|
|
28
|
-
* } catch (error) {
|
|
29
|
-
* recordError(error)
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @param error - Error object or message to record
|
|
34
|
-
*/
|
|
35
|
-
export function recordError(error) {
|
|
36
|
-
storeRecordError(error);
|
|
37
|
-
return error;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Records retry attempts for network operations. Use this to track when
|
|
41
|
-
* operations are retried due to transient failures. Helps identify
|
|
42
|
-
* problematic endpoints or operations that frequently fail.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* recordRetry('https://api.shopify.com/themes', 'upload')
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @param url - The URL or endpoint being retried
|
|
50
|
-
* @param operation - Description of the operation being retried
|
|
51
|
-
*/
|
|
52
|
-
export function recordRetry(url, operation) {
|
|
53
|
-
storeRecordRetry(url, operation);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Records custom events for tracking specific user actions or system events.
|
|
57
|
-
* Use this for important milestones, user interactions, or significant
|
|
58
|
-
* state changes in the application.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* recordEvent('theme-dev-started')
|
|
63
|
-
* recordEvent('file-watcher-connected')
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @param eventName - Descriptive name for the event
|
|
67
|
-
*/
|
|
68
|
-
export function recordEvent(eventName) {
|
|
69
|
-
storeRecordEvent(eventName);
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../../src/public/node/themes/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,iBAAiB,EACjC,WAAW,IAAI,gBAAgB,EAC/B,WAAW,IAAI,gBAAgB,EAC/B,WAAW,IAAI,gBAAgB,GAChC,MAAM,wBAAwB,CAAA;AAE/B;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACvB,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,SAAiB;IACxD,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB;IAC3C,gBAAgB,CAAC,SAAS,CAAC,CAAA;AAC7B,CAAC","sourcesContent":["import {\n recordTiming as storeRecordTiming,\n recordError as storeRecordError,\n recordRetry as storeRecordRetry,\n recordEvent as storeRecordEvent,\n} from './analytics/storage.js'\n\n/**\n * Records timing data for performance monitoring. Call twice with the same\n * event name to start and stop timing. First call starts the timer, second\n * call stops it and records the duration.\n *\n * @example\n * ```ts\n * recordTiming('theme-upload') // Start timing\n * // ... do work ...\n * recordTiming('theme-upload') // Stop timing and record duration\n * ```\n *\n * @param eventName - Unique identifier for the timing event\n */\nexport function recordTiming(eventName: string): void {\n storeRecordTiming(eventName)\n}\n\n/**\n * Records error information for debugging and monitoring. Use this to track\n * any exceptions or error conditions that occur during theme operations.\n * Errors are automatically categorized for easier analysis.\n *\n * @example\n * ```ts\n * try {\n * // ... risky operation ...\n * } catch (error) {\n * recordError(error)\n * }\n * ```\n *\n * @param error - Error object or message to record\n */\nexport function recordError<T>(error: T): T {\n storeRecordError(error)\n return error\n}\n\n/**\n * Records retry attempts for network operations. Use this to track when\n * operations are retried due to transient failures. Helps identify\n * problematic endpoints or operations that frequently fail.\n *\n * @example\n * ```ts\n * recordRetry('https://api.shopify.com/themes', 'upload')\n * ```\n *\n * @param url - The URL or endpoint being retried\n * @param operation - Description of the operation being retried\n */\nexport function recordRetry(url: string, operation: string): void {\n storeRecordRetry(url, operation)\n}\n\n/**\n * Records custom events for tracking specific user actions or system events.\n * Use this for important milestones, user interactions, or significant\n * state changes in the application.\n *\n * @example\n * ```ts\n * recordEvent('theme-dev-started')\n * recordEvent('file-watcher-connected')\n * ```\n *\n * @param eventName - Descriptive name for the event\n */\nexport function recordEvent(eventName: string): void {\n storeRecordEvent(eventName)\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { assertCompatibleEnvironment } from './env.js';
|
|
3
|
-
export function createServer(projectName) {
|
|
4
|
-
return {
|
|
5
|
-
host: (options = {}) => host(projectName, options),
|
|
6
|
-
url: (options = {}) => url(projectName, options),
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function host(projectName, { nonstandardHostPrefix } = {}) {
|
|
10
|
-
assertCompatibleEnvironment();
|
|
11
|
-
const services = fs.readdirSync('/run/ports2').filter((file) => file.endsWith(`--${projectName}`));
|
|
12
|
-
if (services.length === 0) {
|
|
13
|
-
throw new Error(`DevServer for '${projectName}' not present in this spin environment`);
|
|
14
|
-
}
|
|
15
|
-
// Spin mostly doesn't do alternative hostname prefixing for core.
|
|
16
|
-
if (projectName === 'shopify') {
|
|
17
|
-
const prefix = nonstandardHostPrefix?.replace(/[-_]dev[-_]api$/, '');
|
|
18
|
-
return `${prefix}.${projectName}.${process.env.SPIN_FQDN}`;
|
|
19
|
-
}
|
|
20
|
-
const match = new RegExp(`^(.+)${projectName}$`).exec(services[0]);
|
|
21
|
-
const organization = match ? match[1] : '';
|
|
22
|
-
const spinPrefix = organization === 'shopify--' ? '' : `${organization}`;
|
|
23
|
-
return `${spinPrefix}${projectName}.${process.env.SPIN_FQDN}`;
|
|
24
|
-
}
|
|
25
|
-
function url(projectName, options = {}) {
|
|
26
|
-
return `https://${host(projectName, options)}`;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=dev-server-spin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server-spin.js","sourceRoot":"","sources":["../../../../../src/public/node/vendor/dev_server/dev-server-spin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAGxB,OAAO,EAAC,2BAA2B,EAAC,MAAM,UAAU,CAAA;AAEpD,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO;QACL,IAAI,EAAE,CAAC,UAAuB,EAAE,EA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C;AAED,SAAS,GAAG,CAAC,WAAmB,EAAE,UAAuB,EAAE;IACzD,OAAO,WAAW,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAA;AAChD,CAAC","sourcesContent":["import fs from 'node:fs'\n\nimport type {HostOptions} from './types.js'\nimport {assertCompatibleEnvironment} from './env.js'\n\nexport function createServer(projectName: string) {\n return {\n host: (options: HostOptions = {}) => host(projectName, options),\n url: (options: HostOptions = {}) => url(projectName, options),\n }\n}\n\nfunction host(projectName: string, {nonstandardHostPrefix}: HostOptions = {}): string {\n assertCompatibleEnvironment()\n\n const services = fs.readdirSync('/run/ports2').filter((file) => file.endsWith(`--${projectName}`))\n if (services.length === 0) {\n throw new Error(`DevServer for '${projectName}' not present in this spin environment`)\n }\n\n // Spin mostly doesn't do alternative hostname prefixing for core.\n if (projectName === 'shopify') {\n const prefix = nonstandardHostPrefix?.replace(/[-_]dev[-_]api$/, '')\n\n return `${prefix}.${projectName}.${process.env.SPIN_FQDN}`\n }\n\n const match = new RegExp(`^(.+)${projectName}$`).exec(services[0]!)\n const organization = match ? match[1] : ''\n const spinPrefix = organization === 'shopify--' ? '' : `${organization}`\n\n return `${spinPrefix}${projectName}.${process.env.SPIN_FQDN}`\n}\n\nfunction url(projectName: string, options: HostOptions = {}) {\n return `https://${host(projectName, options)}`\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|